本文整理汇总了PHP中Channel::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::setName方法的具体用法?PHP Channel::setName怎么用?PHP Channel::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_channel
function add_channel()
{
global $CONF;
global $LANGALL;
$user = $_SESSION['user'];
if ($user->getBanned()>0){
return array('ok'=>false, 'error'=>'banned '.$user->getBanned());
}
if (isset($_SESSION['channel_last_flood_time'])){
if ((time() - $_SESSION['channel_last_flood_time']) < $CONF['channel_time_to_wait_flood']){
$time_to_wait = $CONF['channel_time_to_wait_flood'] - (time() - $_SESSION['channel_last_flood_time']);
//return array('ok'=>false, 'error'=>'flood '.$time_to_wait);
}
}
$_SESSION['channel_last_flood_time']=time();
$user = $_SESSION['user'];
if ($user->isAnon())
return array('ok'=>false, 'error'=>'anonymous cannot create channel');
$channel = new Channel();
$channel->setUser($user);
$name = strip_tags($_POST['name']);
if (strlen(str_replace(' ', '', $name)) < $CONF['channel_min_name'])
return array('ok'=>false, 'error'=>'too short name');
$channel->setName($name);
$description = $_POST['description'];
$description = strip_tags($description, $CONF['permitted_tags_msg']);
$description = text_linkify($description);
$description = str_replace(' ',' ',$description);
$channel->setDescription($description);
if (isset($_POST['lang']) && !empty($_POST['lang']))
$channel->setLang($_POST['lang']);
if (!isset($_POST['urlname']))
$channel->setUrlname( Channel::prettyUrlAvailable($_POST['name']) );
else {
if ($_POST['urlname']!=Channel::prettyUrlAvailable($_POST['urlname']))
return array('ok'=>false, 'error'=>'invalid urlname');
else
$channel->setUrlname($_POST['urlname']);
}
if (isset($_POST['asktofollow'])) $channel->setAsktofollow($_POST['asktofollow']);
if (isset($_POST['perm_member'])) $channel->setPermMember($_POST['perm_member']);
if (isset($_POST['perm_reguser'])) $channel->setPermReguser($_POST['perm_reguser']);
if (isset($_POST['perm_anon'])) $channel->setPermAnon($_POST['perm_anon']);
$result=$channel->save();
if ($result=='ok'){
$channel->follow();
/*if ($channel->getLang()=='pt_br'){
$title=$LANGALL['pt_br']['addchannel_welcome_title'];
$message=$LANGALL['pt_br']['addchannel_welcome_message'];
} else {
$title=$LANGALL['en_us']['addchannel_welcome_title'];
$message=$LANGALL['en_us']['addchannel_welcome_message'];
}
require_once('class/Topic.php');
require_once('class/User.php');
$user=new RegUser();
$user->setId(1);
$topic=new Topic();
$topic->setSubject($title);
$topic->setMsg($message);
$topic->setChannel($channel);
$topic->setUser($user);
$topic->save();*/
return array('ok'=>true, 'error'=>'', 'id'=>$channel->getId());
}
elseif ($result=='error channel already exists'){
return array('ok'=>false, 'error'=>'error channel already exists','id'=>null);
} elseif ($result=='error you created many channels'){
return array('ok'=>false, 'error'=>'error you created many channels','id'=>null);
} elseif ($result=='error user anon'){
return array('ok'=>false, 'error'=>'error user anon','id'=>null);
} else
return array('ok'=>false, 'error'=>'problems with this channel - '.$result,'id'=>null);
}
示例2: 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']);
//.........这里部分代码省略.........