当前位置: 首页>>代码示例>>PHP>>正文


PHP Channel::getId方法代码示例

本文整理汇总了PHP中Channel::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::getId方法的具体用法?PHP Channel::getId怎么用?PHP Channel::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Channel的用法示例。


在下文中一共展示了Channel::getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getJsonTags

	function getJsonTags(){
		if ( (empty($this->idchannel) || $this->idchannel<=0) ) {
			if (isset($_GET['channel']) && !empty($_GET['channel'])) { 
				require_once("class/Channel.php");
				$tmp = new Channel(); $tmp->setUrlname($_GET['channel']);
				$this->idchannel=$tmp->getId();
				if (empty($this->idchannel)) $this->idchannel=-1;
			}
		}
		if ($this->listType=='cloneUFLast')
			$query = Topic::cloneUFLast($this->qtd, $this->lastorderid, $this->idchannel);
		elseif ($this->listType=='cloneFollowed')
			$query = Topic::cloneFollowed($this->qtd, $this->lastorderid, $this->idchannel);
		elseif ($this->listType=='cloneSearch')
			$query = Topic::cloneSearch($this->search, $this->qtd, $this->orderid);
		elseif ($this->listType=='cloneUpdated')
			$query = Topic::cloneUpdated($this->ids, $this->counters, $this->qtd, $this->orderid, $this->idchannel);
		elseif ($this->listType=='cloneNew')
			$query = Topic::cloneNew($this->lastid, $this->qtd, $this->orderid, $this->idchannel);
		elseif ($this->listType=='cloneByUser')
			$query = Topic::cloneByUser($this->user, $this->qtd, $this->orderid, $this->sorting, $this->idchannel);
		elseif ($this->listType=='cloneByUserPost')
			$query = Topic::cloneByUserPost($this->user, $this->qtd, $this->orderid, $this->sorting, $this->idchannel);
		elseif ($this->listType=='cloneByDate')
			$query = Topic::cloneByDate($this->user, $this->year, $this->month, $this->day);
		elseif ($this->listType=='cloneChannelFollowed')
			$query = Topic::cloneChannelFollowed($this->qtd, $this->orderid, $this->lastorderid, $this->sorting);
		else
			$query = Topic::cloneLast($this->qtd, $this->orderid, $this->sorting, $this->idchannel);

		$result = array();

		if ($query!=null){
			global $CONF;
			if ($this->with_posts){
				require_once('template/TListPost.php');
				foreach ($query as $topic){
					$tlistpost = new TListPost(); $tlistpost->setTopic($topic);
					$ttopic = new TTopic(); $ttopic->setTopic($topic);
					array_push($result, array('topic'=>$ttopic->getJsonTags(), "posts"=>$tlistpost->getJsonTags()) );
				}
			} else {
				foreach ($query as $topic){
					$tmp=$topic->getJsonTags();
					if ($this->onlysubsumed)
						unset($tmp['msg']);
					array_push($result, $tmp);
				}
			}
		}

		return $result;
	}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:53,代码来源:TListTopic.php

示例2: 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";
	}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:47,代码来源:Topic.php

示例3: 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('&nbsp;',' ',$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);
}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:89,代码来源:add_channel.php

示例4: Channel

	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']."');");
			}
	
			$_newcookie=(isset($_COOKIE['autoopenchannel']))?$_COOKIE['autoopenchannel'].'_':'';
			$_newcookie.=$channel->getId();
			setcookie("autoopenchannel", $_newcookie, time()+60);
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:31,代码来源:autoopenchannel.php

示例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;
	}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:24,代码来源:Channel.php

示例6: isStored

 public function isStored(Channel $channel)
 {
     return !empty($this->findById($channel->getId()));
 }
开发者ID:Zzortell,项目名称:Pyro,代码行数:4,代码来源:ChannelRepository.php


注:本文中的Channel::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。