当前位置: 首页>>代码示例>>PHP>>正文


PHP Topic::load方法代码示例

本文整理汇总了PHP中Topic::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Topic::load方法的具体用法?PHP Topic::load怎么用?PHP Topic::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Topic的用法示例。


在下文中一共展示了Topic::load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deletetopic

function deletetopic()
{
	global $CONF;
	$user = $_SESSION['user'];

	if (!isset($_GET['topicid_deletetopic']) || empty($_GET['topicid_deletetopic']))
		return array('ok'=>'false','error'=>'no id');
	elseif ($user->isAnon())
		return array('ok'=>false,'error'=>'anon cannot delete topic');
	else {

		$topic = new Topic();
		$topic->setId($_GET['topicid_deletetopic']);
		$topic->load();
		if (
		    (!$topic->getUser()->isAnon() && $topic->getUser()->getId() == $user->getId()) ||
		    ($topic->getChannel()->getUser()->getId() == $user->getId())
		   )
		{
			$topic->delete();
			return array('ok'=>true,'error'=>'');
		}
		return array('ok'=>false,'error'=>'you cannot delete this topic');
	}
}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:25,代码来源:deletetopic.php

示例2: update_topic

function update_topic()
{
	global $user;
	global $CONF;

//	if (isset($_SESSION['topic_last_flood_time'])){
//
//		if ((time() - $_SESSION['topic_last_flood_time']) < $CONF['topic_time_to_wait_flood']){
//			$time_to_wait = $CONF['topic_time_to_wait_flood'] - (time() - $_SESSION['topic_last_flood_time']);
//			return array('ok'=>false, 'error'=>'flood '.$time_to_wait);
//		}
//
//	}

	$_SESSION['topic_last_flood_time']=time();

	$user = $_SESSION['user'];	

	$topic = new Topic();
	if (isset($_GET['topicid_update_topic'])){
		$topic->setId($_GET['topicid_update_topic']);
		$topic->load();
		if ( ($user->getId()!=$topic->getUser()->getId()) || ($user->isAnon()!=$topic->getUser()->isAnon()) )
			return array('ok'=>false, 'error'=>'you are not the owner');
	} else {
		return array('ok'=>false, 'error'=>'no id');
	}

	//$subject = strip_tags($_POST['subject']);
	//if (strlen(str_replace(' ', '', $subject)) < $CONF['min_msg_chars'])
	//	return array('ok'=>false, 'error'=>'Too short subject.');
	//$topic->setSubject($subject);

	$msg = unescape_ampersand($_POST['msg_update_topic']);
	if (strlen(str_replace(' ', '', strip_tags($msg))) < $CONF['min_msg_chars'])
		return array('ok'=>false, 'error'=>'Too short message.');

	$msg = strip_tags($msg, $CONF['permitted_tags_msg']);
	$topic->setMsg($msg);

	if ($topic->save()=='ok'){
		//$topic->follow();
		return array('ok'=>true, 'error'=>'');
	}
	else
		return array('ok'=>false, 'error'=>'problems with this topic');
}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:47,代码来源:update_topic.php

示例3: load

 public function load($iCategoryID)
 {
     $oCon = new Connection();
     $sSQL = 'SELECT CategoryID,CategoryName,CategoryDesc,Active FROM tbcategory WHERE CategoryID=' . $iCategoryID;
     $oResultSet = $oCon->query($sSQL);
     $aRow = $oCon->fetchArray($oResultSet);
     $this->iCategoryID = $aRow['CategoryID'];
     $this->sCategoryName = $aRow['CategoryName'];
     $this->sCategoryDesc = $aRow['CategoryDesc'];
     $this->iActive = $aRow['Active'];
     $sSQL = 'SELECT TopicID FROM tbtopics WHERE CategoryID=' . $iCategoryID . ' AND Active = 1';
     $oResultSet = $oCon->query($sSQL);
     while ($aRow = $oCon->fetchArray($oResultSet)) {
         $iTopicID = $aRow['TopicID'];
         $oTopic = new Topic();
         $oTopic->load($iTopicID);
         $this->aTopics[] = $oTopic;
     }
     $oCon->close();
 }
开发者ID:Professorsaurus,项目名称:Assignment-3-Final-Demo,代码行数:20,代码来源:categories.php

示例4: or

                     $email=null;
                     $errors['err']='Unable to fetch info on email ID#'.$id;
                 }
             }
             $page=($email or ($_REQUEST['a']=='new' && !$emailID))?'email.inc.php':'emails.inc.php';
     }
     break;
 case 'topics':
     require_once(INCLUDE_DIR.'class.topic.php');
     $topic=null;
     $nav->setTabActive('topics');
     $nav->addSubMenu(array('desc'=>'Help Topics','href'=>'admin.php?t=topics','iconclass'=>'helpTopics'));
     $nav->addSubMenu(array('desc'=>'Add New Topic','href'=>'admin.php?t=topics&a=new','iconclass'=>'newHelpTopic'));
     if(($id=$_REQUEST['id']?$_REQUEST['id']:$_POST['topic_id']) && is_numeric($id)) {
         $topic= new Topic($id);
         if(!$topic->load() && $topic->getId()==$id) {
             $topic=null;
             $errors['err']='Unable to fetch info on topic #'.$id;
         }
     }
     $page=($topic or ($_REQUEST['a']=='new' && !$topicID))?'topic.inc.php':'helptopics.inc.php';
     break;
 //Staff (users, groups and teams)
 case 'grp':
 case 'groups':
 case 'staff':
     $group=null;
     //Tab and Nav options.
     $nav->setTabActive('staff');
     $nav->addSubMenu(array('desc'=>'Staff Members','href'=>'admin.php?t=staff','iconclass'=>'users'));
     $nav->addSubMenu(array('desc'=>'Add New User','href'=>'admin.php?t=staff&a=new','iconclass'=>'newuser'));
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:admin.php

示例5: Topic

<?php

require_once 'includes/header.php';
require_once 'includes/topics.php';
$oTopic = new Topic();
$oTopic->load($_GET["TopicID"]);
if (isset($_SESSION["MemberID"]) != 2) {
    header("Location:viewCategories.php");
} else {
    $oTopic->Active = 0;
    $oTopic->save();
    $sHTML = '<div class=
    "mainBackground"><h3>Topic ' . $oTopic->TopicID . ' has been successfully deleted!</h3>
    <a href="viewCategories.php">Continue</a></div>';
    echo $sHTML;
}
require_once 'includes/footer.php';
开发者ID:Professorsaurus,项目名称:Assignment-3-Final-Demo,代码行数:17,代码来源:deleteTopic.php


注:本文中的Topic::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。