本文整理汇总了PHP中Topic::getChannel方法的典型用法代码示例。如果您正苦于以下问题:PHP Topic::getChannel方法的具体用法?PHP Topic::getChannel怎么用?PHP Topic::getChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topic
的用法示例。
在下文中一共展示了Topic::getChannel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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.');
}
示例3: engine_doit
//.........这里部分代码省略.........
require_once('template/TListTopic.php');
require_once('class/User.php');
if (isset($_GET['nickname_userposttopics'])){
$tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneByUserPost"); $tlisttopic->setOnlySubsumed(true);
if (isset($_GET['sorting_userposttopics'])) $tlisttopic->setSorting($_GET['sorting_userposttopics']);
$u=new RegUser();
$u->setNickname($_GET['nickname_userposttopics']); $u->load();
$tlisttopic->setUser($u);
if (isset($_GET['orderid_userposttopics'])) $tlisttopic->setOrderId($_GET['orderid_userposttopics']);
if (isset($_GET['idchannel_userposttopics'])) $tlisttopic->setIdChannel($_GET['idchannel_userposttopics']);
$result['userposttopics']=$tlisttopic->getJsonTags();
} else $result['userposttopics']=array();
break;
case 'uft':
require_once('getter/uft.php');
$result['uft']=uft();
break;
case 'followedtopics':
require_once('conf/session.php');
require_once('template/TListTopic.php');
$tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneFollowed"); $tlisttopic->setOnlySubsumed(true);
if (isset($_GET['orderid_followedtopics'])) $tlisttopic->setOrderId($_GET['orderid_followedtopics']);
if (isset($_GET['idchannel_followedtopics'])) $tlisttopic->setIdChannel($_GET['idchannel_followedtopics']);
$result['followedtopics']=$tlisttopic->getJsonTags() ;
break;
case 'topic':
if (!isset($_GET['id_topic']) || empty($_GET['id_topic'])) { $result['topic']=array(); break; }
require_once('template/TTopic.php');
require_once('template/TListPost.php');
require_once('class/Topic.php');
require_once('class/Channel.php');
$topic = new Topic(); $topic->setId($_GET['id_topic']);
if (!$topic->getChannel()->canIRead()){ $result['topic']=array("error"=>'you cant see this topic'); break; }
$ttopic = new TTopic(); $ttopic->setTopic($topic);
$tlistpost = new TListPost(); $tlistpost->setTopic($topic);
$tlistpostbest = new TListPost(); $tlistpostbest->setTopic($topic); $tlistpostbest->setQtd($CONF['post_best_qt']); $tlistpostbest->setSorting("likes desc,date desc");
$result['topic']=(array('topic'=>$ttopic->getJsonTags(), "posts"=>$tlistpost->getJsonTags(), "bestposts"=>$tlistpostbest->getJsonTags()) );
break;
case 'refresh_topic_previews':
if (!isset($_GET['ids_refresh_topic_previews']) || empty($_GET['ids_refresh_topic_previews'])) { $result['refresh_topic_previews']=array(); break;}
if (!isset($_GET['versions_refresh_topic_previews']) || empty($_GET['versions_refresh_topic_previews'])) { $result['refresh_topic_previews']=array(); break;}
require_once("template/TListTopic.php");
$tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneUpdated"); $tlisttopic->setOnlySubsumed(true);
$tlisttopic->setIds(explode(",",$_GET['ids_refresh_topic_previews']));
$tlisttopic->setCounters(explode(",",$_GET['versions_refresh_topic_previews']));
$result['refresh_topic_previews']=$tlisttopic->getJsonTags();
break;
case 'refresh_topics':
if (!isset($_GET['ids_refresh_topics']) || empty($_GET['ids_refresh_topics'])) { $result['refresh_topics']=array(); break;}
if (!isset($_GET['versions_refresh_topics']) || empty($_GET['versions_refresh_topics'])){ $result['refresh_topics']=array(); break;}
require_once("template/TListTopic.php");
$tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneUpdated"); $tlisttopic->setWithPosts(true);
if (isset($_GET['idchannel_refresh_topics'])) $tlisttopic->setIdChannel($_GET['idchannel_refresh_topics']);
$tlisttopic->setIds(explode(",",$_GET['ids_refresh_topics']));
$tlisttopic->setCounters(explode(",",$_GET['versions_refresh_topics']));
$result['refresh_topics']=$tlisttopic->getJsonTags();
break;
case 'new_topic_previews':
require_once("getter/new_topic_previews.php");
$result['new_topic_previews']=new_topic_previews();
break;
case 'reguser':
require_once("template/TUser.php");
require_once("class/User.php");
示例4: Topic
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');
}
if (isset($_GET['sms_ss'])){