本文整理汇总了PHP中Channel::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::load方法的具体用法?PHP Channel::load怎么用?PHP Channel::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAll
public static function getAll()
{
$numChannels = count(static::$channels);
$insts = array();
for ($i = 1; $i <= $channels; $i++) {
$insts[] = Channel::load($i);
}
return $insts;
}
示例2: 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');
}
示例3: save
public function save(){ //Salva o objeto no BD (se ja foi salvo faz update)
$this->_new=false;
$db = clone $GLOBALS['maindb'];
if (empty($this->subject))
return 'error null subject';
if (empty($this->msg))
return 'error null message';
$isanon=$this->getUser()->isAnon();
if (!($isanon))
$isanon = 'FALSE';
else
$isanon = 'TRUE';
if (!isset($this->id) || ($this->id==null)){ //Insert
$db->query("SELECT nextval('topic_id_seq') as id;");
$_gotid_req = $db->fetch();
$_gotid = $_gotid_req['id'];
$lang = $this->getLang();
if (empty($lang)){
$this->lang = $this->getUser()->getLang();
}
if (!empty($this->channel))
$_channelid=$this->channel->getId();
elseif (isset($_GET['channel'])){
require_once('class/Channel.php');
$tmpchannel=new Channel();
$tmpchannel->setUrlname($_GET['channel']);
$tmpchannel->load();
$_channelid = $tmpchannel->getId();
} else
$_channelid = 'null';
if (empty($_channelid)) $_channelid = 'null';
$db->query("INSERT INTO topic(id,subject,msg,anon,userid,lang, channelid) VALUES('{$_gotid}','{$this->getSubject()}','{$this->getMsg()}','$isanon', '{$this->getUser()->getId()}', '{$this->getLang()}', {$_channelid});");
$row = $db->fetch();
$this->id = $_gotid;
} else { //Update
$_alsoupdate='';
if ($this->_update_subject==true) $_alsoupdate.=",subject='{$this->getSubject()}'";
$db->query("UPDATE topic set msg='{$this->getMsg()}',anon='$isanon', userid='{$this->getUser()->getId()}' {$_alsoupdate} WHERE id='{$this->id}';");
$row = $db->fetch();
}
$this->_flush=true;
return "ok";
}
示例4: Channel
require_once('conf/location.php');
require_once('conf/session.php');
require_once("class/User.php");
require_once("class/Channel.php");
//require_once("class/Addthis.php");
global $CONF;
$user=$_SESSION['user'];
if (isset($_GET['urlname']))
{
$channel = new Channel();
$channel->setUrlname($_GET['urlname']);
$channel->load();
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'])){
$db = clone $GLOBALS['maindb'];
$_anon=($user->isAnon())?'true':'false';
$db->query("INSERT INTO addthis(channelid,sms_ss,at_xt,userid,anon,ip) values ('{$channel->getId()}','".$_GET['sms_ss']."','".$_GET['at_xt']."','{$user->getId()}','{$_anon}','".$_SERVER['REMOTE_ADDR']."');");
}
示例5: prettyUrlAvailable
static function prettyUrlAvailable($name)
{
require_once('tool/utility.php');
$url = normalize_chars($name);
$url = strtolower($url);
$url = preg_replace('/[^a-zA-Z0-9]/','-',$url);
$url = preg_replace('/-+/','-',$url);
$ok=false;
$url_prefix=$url;
$cnt=1;
while ($ok==false){
$tmpc = new Channel();
$tmpc->setUrlname($url); $tmpc->load();
$_id=$tmpc->getId();
$_lang=$tmpc->getLang();
if (empty($_id) && empty($_lang))
$ok=true;
else
$url=$url_prefix."_".($cnt);
$cnt++;
}
return $url;
}