當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Forum::create方法代碼示例

本文整理匯總了PHP中Forum::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Forum::create方法的具體用法?PHP Forum::create怎麽用?PHP Forum::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Forum的用法示例。


在下文中一共展示了Forum::create方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: approve

 /**
  *	approve - Approve pending project.
  *
  *	@param	object	The User object who is doing the updating.
  *	@access public
  */
 function approve(&$user)
 {
     if ($this->getStatus() == 'A') {
         $this->setError(_("Group already active"));
         return false;
     }
     db_begin();
     // Step 1: Activate group and create LDAP entries
     if (!$this->setStatus($user, 'A')) {
         db_rollback();
         return false;
     }
     //
     //
     //	Tracker Integration
     //
     //
     $ats = new ArtifactTypes($this);
     if (!$ats || !is_object($ats)) {
         $this->setError(_('Error creating ArtifactTypes object'));
         db_rollback();
         return false;
     } else {
         if ($ats->isError()) {
             $this->setError(sprintf(_('ATS%d: %s'), 1, $ats->getErrorMessage()));
             db_rollback();
             return false;
         }
     }
     if (!$ats->createTrackers()) {
         $this->setError(sprintf(_('ATS%d: %s'), 2, $ats->getErrorMessage()));
         db_rollback();
         return false;
     }
     //
     //
     //	Forum Integration
     //
     //
     $f = new Forum($this);
     if (!$f->create('Open-Discussion', 'General Discussion', 1, '', 1, 0)) {
         $this->setError(sprintf(_('F%d: %s'), 1, $f->getErrorMessage()));
         db_rollback();
         return false;
     }
     $f = new Forum($this);
     if (!$f->create('Help', 'Get Public Help', 1, '', 1, 0)) {
         $this->setError(sprintf(_('F%d: %s'), 2, $f->getErrorMessage()));
         db_rollback();
         return false;
     }
     $f = new Forum($this);
     if (!$f->create('Developers', 'Project Developer Discussion', 0, '', 1, 0)) {
         $this->setError(sprintf(_('F%d: %s'), 3, $f->getErrorMessage()));
         db_rollback();
         return false;
     }
     //
     //
     //	Doc Mgr Integration
     //
     //
     $dg = new DocumentGroup($this);
     if (!$dg->create('Uncategorized Submissions')) {
         $this->setError(sprintf(_('DG: %s'), $dg->getErrorMessage()));
         db_rollback();
         return false;
     }
     //
     //
     //	FRS integration
     //
     //
     $frs = new FRSPackage($this);
     if (!$frs->create($this->getUnixName())) {
         $this->setError(sprintf(_('FRSP: %s'), $frs->getErrorMessage()));
         db_rollback();
         return false;
     }
     //
     //
     //	PM Integration
     //
     //
     $pg = new ProjectGroup($this);
     if (!$pg->create('To Do', 'Things We Have To Do', 1)) {
         $this->setError(sprintf(_('PG%d: %s'), 1, $pg->getErrorMessage()));
         db_rollback();
         return false;
     }
     $pg = new ProjectGroup($this);
     if (!$pg->create('Next Release', 'Items For Our Next Release', 1)) {
         $this->setError(sprintf(_('PG%d: %s'), 2, $pg->getErrorMessage()));
         db_rollback();
//.........這裏部分代碼省略.........
開發者ID:neymanna,項目名稱:fusionforge,代碼行數:101,代碼來源:Group.class.php

示例2: getStringFromRequest

 }
 $summary = getStringFromRequest('summary');
 $details = getStringFromRequest('details');
 //check to make sure both fields are there
 if ($summary && $details) {
     /*
     	Insert the row into the db if it's a generic message
     	OR this person is an admin for the group involved
     */
     /*
     	create a new discussion forum without a default msg
     	if one isn't already there
     */
     db_begin();
     $f = new Forum(group_get_object($sys_news_group));
     if (!$f->create(ereg_replace('[^_\\.0-9a-z-]', '-', strtolower($summary)), $details, 1, '', 0, 0)) {
         db_rollback();
         exit_error('Error', $f->getErrorMessage());
     }
     $new_id = $f->getID();
     $sanitizer = new TextSanitizer();
     $details = $sanitizer->SanitizeHtml($details);
     $sql = "INSERT INTO news_bytes (group_id,submitted_by,is_approved,post_date,forum_id,summary,details) " . " VALUES ('{$group_id}','" . user_getid() . "','0','" . time() . "','{$new_id}','" . htmlspecialchars($summary) . "','" . $details . "')";
     $result = db_query($sql);
     if (!$result) {
         db_rollback();
         form_release_key(getStringFromRequest('form_key'));
         $feedback = ' ' . _('ERROR doing insert') . ' ';
     } else {
         db_commit();
         $feedback = ' ' . _('News Added.') . ' ';
開發者ID:neymanna,項目名稱:fusionforge,代碼行數:31,代碼來源:submit.php


注:本文中的Forum::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。