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


PHP Channel::load方法代码示例

本文整理汇总了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;
 }
开发者ID:rajtrivedi2001,项目名称:shopify_app,代码行数:9,代码来源:channel.php

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

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

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


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