本文整理汇总了PHP中Channel::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::setId方法的具体用法?PHP Channel::setId怎么用?PHP Channel::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::setId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: create_account
function create_account()
{
global $CONF;
$user = new RegUser();
if (!preg_match("/^[".$CONF['nickname_chars']."]+$/i", $_POST['nickname_create_account']))
return array('ok'=>false, 'error'=>'invalid nickname');
if (trim($_POST['password_create_account'])=='')
return array('ok'=>false, 'error'=>'no password');
$user->setEmail($_POST['email_create_account']);
$user->setNickname($_POST['nickname_create_account']);
$user->setPassword($_POST['password_create_account']);
if (isset($_POST['signature_create_account']))
$user->setSignature($_POST['signature_create_account']);
if (isset($_POST['camefrom_create_account']))
$user->setCameFrom($_POST['camefrom_create_account']);
$r = $user->save();
if ($r=='ok')
{
$channel=new Channel();
$channel->setId(1);
$channel->forceFollow($user);
$r = $user->sendEmail();
if (!$r)
return array('ok'=>false, 'error'=>'we could not send the e-mail.');
else{
$GLOBALS['user'] = $user;
$rc = new RegUser();
$rc->setNickname("RapidCoffee");
$rc->load();
$topic = new Topic();
$topic->setChannel($channel);
$topic->setUser($rc);
$topic->setSubject("Dêem boas vindas ao usuário " . $user->getNickname() . "!");
$msg = "Seja bem-vindo(a), <b>" . $user->getNickname() . "</b>. Criamos este tópico para que você possa se apresentar e conhecer um pouco dos usuários do site. Boa estadia =)<br /><br />Equipe Rapid Coffee.";
$msg = str_replace(' ',' ',$msg);
$topic->setMsg($msg);
$topic->save();
$topic->follow();
return array('ok'=>true, 'error'=>'');
}
}
return array('ok'=>false, 'error'=>$r);
}
示例3: 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");
}
示例4: 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');
}
示例5: cloneNew
static function cloneNew($lastid, $qtd=-1, $lastorderid=-1,$channel){ //Retorna um array com os ultimos topicos
global $CONF;
if (!isset($lastid) || empty($lastid)) return;
if ($qtd<=0) $qtd=$CONF['topic_list_qt'];
if (isset($lastorderid) && $lastorderid>0) $addwhere=" and orderid<$lastorderid ";
else $addwhere="";
if (isset($channel) && !empty($channel) && $channel!=0) {
require_once("class/Channel.php");
$_channel = new Channel();
$_channel->setId($channel);
if (!$_channel->canIRead()) return array();
$addwhere.=" and channelid='$channel' ";
} else {
return array();
}
if (isset($channel) && !empty($channel) && $channel!=0) {
$addwhere.=" and channelid='$channel' ";
}
$db = clone $GLOBALS['maindb'];
$user = $_SESSION['user'];
$db->query("SELECT * FROM vw_topic_notoff WHERE orderid>{$lastid} {$addwhere} ORDER BY orderid DESC LIMIT $qtd;");
if ($db->number_rows()<=0) return null;
$stArr = array($db->number_rows());
$i = 0;
while ($row = $db->fetch())
{
$tmp = new Topic();
$tmp->constructFromRow($row);
$stArr[$i]=$tmp;
$i++;
}
return $stArr;
}
示例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: array
$db = clone $GLOBALS['maindb'];
if (!isset($_GET['b']))
return array("ok"=>false, error=>"no following");
$check=hash('sha512',"00`Θ^*' ♣ hk".chr(11)."1".$_GET['b']);
if ($check==$_GET['c']){
$ufc_=Channel::confirmFollow($_GET['b'],$_GET['a']=='accept');
if (count($ufc_)>0){
$userto=new RegUser();
$userto->setId($ufc_['userid']);$userto->load();
$channel=new Channel();
$channel->setId($ufc_['channelid']);
$message = new Message();
$message->setUserFrom($_SESSION['user']);
$message->setUserTo($userto);
if ($_GET['a']=='accept'){
$msg=$LANG['channel_confirmfollow_accepted'];
if ($userto->getLang()=='pt_br'){
$message->setSubject($LANGALL['pt_br']['channel_asktofollow_subject']);
$message->setMsg('#'.$channel->getName().'\n<br/>'.$LANGALL['pt_br']['channel_confirmfollow_accepted']);
} else {
$message->setSubject($LANGALL['en_us']['channel_asktofollow_subject']);
$message->setMsg('#'.$channel->getName().'\n<br/>'.$LANGALL['en_us']['channel_confirmfollow_accepted']);
}
} else {
$msg=$LANG['channel_confirmfollow_rejected'];
if ($userto->getLang()=='pt_br'){
示例8: add_topic
function add_topic()
{
global $CONF;
$user = $_SESSION['user'];
if ($user->getBanned()>0){
return array('ok'=>false, 'error'=>'banned '.$user->getBanned());
}
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);
}
}
$user = $_SESSION['user'];
$topic = new Topic();
if (isset($_GET['channelid_add_topic'])){
$channel = new Channel();
$channel->setId($_GET['channelid_add_topic']);
if (!$channel->canITopic())
return array('ok'=>false, 'error'=>'you cant create topic in this channel');
$topic->setChannel($channel);
}
$topic->setUser($user);
$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 = $_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);
$msg = str_replace(' ',' ',$msg);
$topic->setMsg($msg);
if ($topic->save()=='ok'){
$_SESSION['topic_last_flood_time']=time();
$topic->follow();
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=UTF-8\r\n";
$headers .= "From: {$CONF['email_from']}\r\n";
$headers .= "To: YOU <you>\r\n";
$_pretty=Topic::prettyUrl($topic->getSubject());
$body='Acesse: <a href="http://rapidcoffee.com//'.$topic->getId().'/'.$_pretty.'">http://rapidcoffee.com//'.$topic->getId().'/'.$_pretty.'</a>';
//system("echo \"".$body."\" > email.html");
//mail('lucasvendramin85@gmail.com, danilo.horta@gmail.com', "Rapidcoffee-NOVO TOPICO", $body, $headers);
return array('ok'=>true, 'error'=>'');
}
else
return array('ok'=>false, 'error'=>'Problems with this topic.');
}