本文整理汇总了PHP中Topic::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Topic::setId方法的具体用法?PHP Topic::setId怎么用?PHP Topic::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topic
的用法示例。
在下文中一共展示了Topic::setId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
}
示例2: unfollowtopic
function unfollowtopic(){
$topic = new Topic();
if (!isset($_GET['topicid_unfollowtopic']))
return array("ok"=>false, "error"=>"no id");
$topic->setId($_GET['topicid_unfollowtopic']);
if ($topic->unfollow())
return array("ok"=>true, "error"=>"");
else
return array("ok"=>false, "error"=>"cant unfollow");
}
示例3: add_post
function add_post()
{
global $CONF;
$user = $_SESSION['user'];
if ($user->getBanned()>0){
return array('ok'=>false, 'error'=>'banned '.$user->getBanned());
}
if (isset($_SESSION['post_last_flood_time'])){
if ((time() - $_SESSION['post_last_flood_time']) < $CONF['post_time_to_wait_flood']){
$time_to_wait = $CONF['post_time_to_wait_flood'] - (time() - $_SESSION['post_last_flood_time']);
return array('ok'=>false, 'error'=>'flood '.$time_to_wait);
}
}
$post = new Post();
$topic = new Topic(); $topic->setId($_GET['topicid_add_post']);
if (!$topic->getChannel()->canIPost())
return array('ok'=>false, 'error'=>'you cant create post in this channel');
$post->setTopic($topic);
$post->setUser($user);
$msg = unescape_ampersand($_POST['msg']);
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']);
//$msg = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a target=\"_BLANK\" href=\"\\0\">\\0</a>", $msg); //detectando URLs
$msg = text_linkify($msg);
$post->setPost($msg);
if ($post->save()=='ok'){
$_SESSION['post_last_flood_time']=time();
$topic->follow();
$topic->setId($topic->getId()); $topic->load(); //update topic->counter
$topic->visit();
return array('ok'=>true, 'error'=>'');
}
else
return array('ok'=>false, 'error'=>'Problem with this post.');
}
示例4: 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');
}
示例5: like_dislike_this
function like_dislike_this()
{
global $user;
if ($_GET['op']=='topic'){
$topic = new Topic(); $topic->setId($_GET['topicid']);
if ($_GET['liked']=='yes')
$result = $topic->like();
else
$result = $topic->dislike();
} else {
$post = new Post(); $post->setId($_GET['postid']);
if ($_GET['liked']=='yes')
$result = $post->like();
else
$result = $post->dislike();
}
if ($result=='ok')
$result = array('ok'=>true,'error'=>'');
else
$result = array('ok'=>false,'error'=>$result);
return $result;
}
示例6: engine_doit
function engine_doit(){
global $CONF;
$whats = explode(',', $_GET['what']);
$result = null;
if (isset($_GET['SYSTEM_redirect'])){
unset($_GET['SYSTEM_redirect']);
switch($_GET['what']){
case 'topic':
include('basichtml/viewtopic.php');
break;
case 'datetopics':
include('basichtml/topic_list.php');
break;
case 'confirm_user':
include('controller/confirm_user.php');
break;
case 'user_stopmail':
include('controller/user_stopmail.php');
break;
case 'add_email':
include('controller/add_email.php');
break;
case 'remove_email':
include('controller/remove_email.php');
break;
case 'restore_password':
include('controller/restore_password.php');
break;
case 'followchannel_acceptreject':
include('controller/followchannel_acceptreject.php');
break;
case 'autoopenchannel':
include('controller/autoopenchannel.php');
break;
case 'autoopentopic':
include('controller/autoopentopic.php');
break;
/* case 'ETUEngine':
include('tool/ETUEngine.php');
$etu=new ETUEngine();
$etu->start(1);
break;
*/
}
return;
}
foreach ($whats as $what)
{
switch($what)
{
case 'fromname':
require_once("controller/fromname.php");
$result['fromname'] = fromname($_GET['id_fromname']);
break;
case 'setuserfrom':
require_once("class/User.php");
$tuser = new RegUser();
$tuser->setNickname($_GET['nick_setuserfrom']);
$valid = $tuser->validatePassword($_GET['pass_setuserfrom']);
if ($valid)
{
$tuser->load();
$tuser->setCameFrom($_GET['fromid_setuserfrom']);
$tuser->save();
}
break;
case 'message':
require_once('template/TMessage.php');
require_once('class/Message.php');
$message = new Message();
if (isset($_GET['id_message']) && !empty($_GET['id_message']))
$message->setId($_GET['id_message']);
else { $result['message']=array(); break; }
$tmessage = new TMessage(); $tmessage->setMessage($message);
$result['message']=$tmessage->getJsonTags();
break;
case 'mymessages':
require_once('template/TListMessage.php');
$tlist = new TListMessage(); $tlist->setListType("cloneMy"); $tlist->setOnlySubsumed(true);
if (isset($_GET['sorting_mymessages'])) $tlist->setSorting($_GET['sorting_mymessages']);
if (isset($_GET['lastid_mymessages'])) $tlist->setLastId($_GET['lastid_mymessages']);
$result['mymessages']=$tlist->getJsonTags();
break;
case 'regchannel':
require_once("template/TChannel.php");
require_once("class/Channel.php");
$t = new TChannel();
$o=new Channel();
$prettyUrl='';
if (isset($_GET['id_regchannel'])) {
$o->setId($_GET['id_regchannel']);
} elseif (isset($_GET['name_regchannel'])) {
if (substr($_GET['name_regchannel'],-1,1)=='-'){
$result['regchannel']=array("ok"=>false,"error"=>"invalid name","exist"=>true,'prettyUrl'=>'');
break;
} else {
$o->setName($_GET['name_regchannel']);
$prettyUrl=Channel::prettyUrlAvailable($_GET['name_regchannel']);
//.........这里部分代码省略.........
示例7: Topic
require_once('conf/location.php');
require_once('conf/session.php');
require_once("class/User.php");
require_once("class/Channel.php");
require_once("class/Topic.php");
//require_once("class/Addthis.php");
global $CONF;
$user=$_SESSION['user'];
if (isset($_GET['topicid']))
{
$topic = new Topic();
$topic->setId($_GET['topicid']);
$channel = $topic->getChannel();
$channel->load();
$OG['topic_title'] = $topic->getSubject();
$OG['topic_msg'] = $topic->getSubsumedMsg();
if ($channel->getId()>0)
{
$OG['request'] = 'openchannel';
$OG['channel_name'] = $channel->getName();
$OG['channel_desc'] = $channel->getDescription();
$OG['channel_logo'] = $CONF['url_path'] . $channel->getLogoFile('big');
}