本文整理汇总了PHP中Channel::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::getUser方法的具体用法?PHP Channel::getUser怎么用?PHP Channel::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::getUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: followchannel
function followchannel($channelid){
if ($_SESSION['user']->isAnon())
return array("ok"=>false, "error"=>"you have to login");
global $LANGALL;
global $CONF;
$channel = new Channel();
if (!isset($channelid))
return array("ok"=>false, "error"=>"no id");
$channel->setId($channelid);
if ($channel->getAsktofollow()){
if ($_SESSION['user']->isAnon())
return array("ok"=>false, "error"=>"anon cant follow");
require_once('class/Message.php');
$message = new Message();
$message->setUserFrom($_SESSION['user']);
$message->setUserTo($channel->getUser());
$__ufid = $channel->unconfirmed_follow();
$check=hash('sha512',"00`Θ^*' ♣ hk".chr(11)."1".$__ufid);
if ($channel->getUser()->getLang()=='pt_br'){
$message->setSubject($LANGALL['pt_br']['channel_asktofollow_subject']);
eval($LANGALL['pt_br']['channel_asktofollow_msg']);
$msg = '#'.$channel->getName().'\n<br/>'.'@'.$_SESSION['user']->getNickname().'\n<br/>'.$body;
if (isset($_GET['msg_followchannel']))
$msg.=$_GET['msg_followchannel'];
$message->setMsg($msg);
} else {
$message->setSubject($LANGALL['en_us']['channel_asktofollow_subject']);
eval($LANGALL['pt_br']['channel_asktofollow_msg']);
$msg = '#'.$channel->getName().'\n<br/>'.'@'.$_SESSION['user']->getNickname().'\n<br/>'.$body;
if (isset($_GET['msg_followchannel']))
$msg.=$_GET['msg_followchannel'];
$message->setMsg($msg);
}
$result=$message->save();
if ($result=='ok')
return array("ok"=>false, "error"=>"asked for permission", "msg"=>"asked for permission");
else
return array("ok"=>false, "error"=>"error cant send message: ".$result, "msg"=>"");
} else {
if ($channel->follow())
return array("ok"=>true, "error"=>"");
else
return array("ok"=>false, "error"=>"cant follow");
}
}
示例2: unfollowchannel
function unfollowchannel(){
if ($_SESSION['user']->isAnon())
return array("ok"=>false, "error"=>"you have to login");
$channel = new Channel();
if (!isset($_GET['channelid_unfollowchannel']))
return array("ok"=>false, "error"=>"no id");
$channel->setId($_GET['channelid_unfollowchannel']);
if ($channel->getUser()->getId()==$_SESSION['user']->getId())
return array("ok"=>false, "error"=>"channel owner cant unfollow");
if ($channel->unfollow())
return array("ok"=>true, "error"=>"");
else
return array("ok"=>false, "error"=>"cant unfollow");
}
示例3: update_channel
function update_channel()
{
global $user;
global $CONF;
$_SESSION['channel_last_flood_time']=time();
$user = $_SESSION['user'];
$channel = new Channel();
if (isset($_GET['channelid_update_channel'])){
$channel->setId($_GET['channelid_update_channel']);
$channel->load();
if ( ($user->getId()!=$channel->getUser()->getId()) || ($user->isAnon()) )
return array('ok'=>false, 'error'=>'you are not the owner');
} else {
return array('ok'=>false, 'error'=>'no id');
}
$description = unescape_ampersand($_POST['description']);
$description = strip_tags($description, $CONF['permitted_tags_msg']);
$description = text_linkify($description);
$description = str_replace(' ',' ',$description);
$channel->setDescription($description);
//system("echo \"$description\" > log.txt");
if (isset($_POST['lang']) && !empty($_POST['lang']))
$channel->setLang($_POST['lang']);
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']);
if ($channel->save()=='ok'){
return array('ok'=>true, 'error'=>'');
}
else
return array('ok'=>false, 'error'=>'problems with this channel');
}