/**
  * Add a channel to the bouquet.
  * @param Channel $pChannel
  */
 public function addChannel(Channel $pChannel)
 {
     if ($pChannel->getID() != 'none') {
         $this->lChannels[] = $pChannel;
         $this->lChannelCount++;
     }
 }
Example #2
0
 /**
  * Send an message on a channel for an event
  *
  * @param $channel
  * @param $event
  * @param $data
  * @throws SockinException
  * @return string
  */
 public function send($channel, $event, $data)
 {
     $this->route = "send";
     $codedChannel = $this->channel->verify($channel, $this->appId);
     $jsonData = $this->getJson($data);
     $hashedData = $this->hashData($jsonData, $codedChannel, $event);
     return $this->dispatchMessage($jsonData, $codedChannel, $event, $hashedData);
 }
 private function parseWrite(Channel $channel, $message)
 {
     return [$channel, null, function () use($channel, $message) {
         return $channel->write($message);
     }, function ($current) use($channel) {
         $channel->cancelWrite($current);
     }];
 }
Example #4
0
 public function testPubsubhubbub()
 {
     $channel = new Channel();
     $channel->pubsubhubbub('http://example.com/feed.xml', 'http://pubsubhubbub.appspot.com');
     $xml = $channel->asXML()->asXML();
     $this->assertContains('<atom:link rel="self" href="http://example.com/feed.xml" type="application/rss+xml"/>', $xml);
     $this->assertContains('<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/>', $xml);
 }
Example #5
0
 static function start()
 {
     # CREATE GENOSAGE
     $genosage = new Core();
     # CREATE CHANNEL
     $channel = new Channel();
     $channel->channel();
 }
 public function addChannel(Channel $channel)
 {
     if (isset($this->channelNames[$channel->getName()])) {
         return;
     }
     $this->channelNames[$channel->getName()] = true;
     $this->collection->attach($channel);
 }
 /**
  * @param Channel $channel
  */
 public function add(Channel $channel)
 {
     $name = $this->normalizeName($channel->getName());
     // prevent channel overwrites
     if ($this->exists($name)) {
         return;
     }
     $this->channels[$name] = $channel;
 }
 private function findChannelParameter(Channel $channel, $key)
 {
     $parameters = $channel->getParameters();
     foreach ($parameters as $parameter) {
         if ($parameter->getKey() == $key) {
             return $parameter;
         }
     }
     return null;
 }
Example #9
0
	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;
	}
Example #10
0
 public function push($data)
 {
     require_once DIR_SYSTEM . '/baidu/Channel.class.php';
     // var_dump(BAE_API_KEY);
     $channel = new Channel(BAE_API_KEY, BAE_SECRET_KEY);
     if (array_key_exists('description', $data)) {
         if (mb_strlen($data['description'], 'utf-8') > 39) {
             $data['description'] = mb_substr($data['description'], 0, 37, 'utf-8') . '...';
         }
     }
     //推送类型,1单人(必须指定user_id和channel_id)、2群组(必须指定tag_name)、3所有人
     $push_type = $data['push_type'];
     $message["title"] = array_key_exists('title', $data) ? $data['title'] : '';
     //android必选
     $message["description"] = $data['description'];
     //android必选
     // $message["custom_content"] = array ("jump_id" => array_key_exists('jump_id', $data) ? $data['jump_id'] : '', "url" => array_key_exists('url', $data) ? $data['url'] : '');//android自定义字段
     $message["aps"] = array("alert" => $data['description'], "sound" => "", "badge" => 1);
     //ios特有字段
     if (array_key_exists('custom_content', $data)) {
         if ($data['device_type'] == 3) {
             //android
             $message["custom_content"] = $data['custom_content'];
         } elseif ($data['device_type'] == 4) {
             //ios
             foreach ($data['custom_content'] as $key => $value) {
                 $message[$key] = $value;
             }
         }
     }
     $message_key = "msg_key";
     //不支持ios
     //1:浏览器设备、2:pc设备、3:Android设备、4:ios设备、5:windows phone设备
     $optional[Channel::DEVICE_TYPE] = $data['device_type'];
     //Channel::USER_ID,标识用户的ID,分为百度账号与无账号体系:无账号体系的user_id根据端上属性生成;百度账号体系根据账号生成user_id。
     $optional[Channel::USER_ID] = array_key_exists('user_id', $data) ? $data['user_id'] : '';
     //Channel::MESSAGE_TYPE,消息类型,0:消息(透传),1:通知
     $optional[Channel::MESSAGE_TYPE] = array_key_exists('message_type', $data) ? $data['message_type'] : 1;
     //ios部署状态,1开发状态,默认是2生产状态
     $optional[Channel::DEPLOY_STATUS] = array_key_exists('deploy_status', $data) ? $data['deploy_status'] : '';
     $ret = $channel->pushMessage($push_type, $message, $message_key, $optional);
     if (false === $ret) {
         // $err = 'ERROR NUMBER: ' . $channel->errno() . '; ERROR MESSAGE: ' . $channel->errmsg() . '; REQUEST ID: ' .
         // 	 $channel->getRequestId() . ";";
         // Log::record($err);
         // var_dump( array ("ret" => SYS_RET_ERR, "err" => $err) );
     } else {
         // var_dump( array ("ret" => 0, "err" => "") );
     }
 }
Example #11
0
 private function getChannelId($name)
 {
     $name = trim($name);
     static $cache = array();
     if (!isset($cache[$name])) {
         $channel = Channel::model()->findByAttributes(array('name' => $name));
         if ($channel == null) {
             $channel = new Channel();
             $channel->name = $name;
             $channel->save();
         }
         $cache[$name] = $channel->id;
     }
     return $cache[$name];
 }
Example #12
0
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('&nbsp;',' ',$msg);
			$topic->setMsg($msg);
			$topic->save();
			$topic->follow();
			return array('ok'=>true, 'error'=>'');
		}
	}
	return array('ok'=>false, 'error'=>$r);
}
Example #13
0
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");
	}

}
Example #14
0
 /**
  * @return string
  */
 public function getWorkingChannelName()
 {
     if (!isset($this->workingChannelName)) {
         $this->workingChannelName = $this->channel->getName() . '_' . spl_object_hash($this) . '_' . uniqid();
     }
     return $this->workingChannelName;
 }
 public function entries()
 {
     $tag = $this->EE->TMPL->fetch_param('tag');
     // fix spacing
     $tag = str_replace('+', ' ', $tag);
     // Grab all entries with this tag
     $this->EE->db->select('tl.tag_id, tl.entry_id');
     $this->EE->db->from('exp_tagger_links tl');
     $this->EE->db->join('exp_tagger t', 't.tag_id = tl.tag_id', 'left');
     $this->EE->db->where('t.tag_name', $tag);
     $this->EE->db->where_in('tl.site_id', $this->EE->TMPL->site_ids);
     $this->EE->db->where('tl.type', 1);
     $query = $this->EE->db->get();
     // Did we find anything
     if ($query->num_rows() == 0) {
         return "No Results Found.";
     }
     // Loop through the results
     $entry_ids = array();
     foreach ($query->result() as $row) {
         $entry_ids[] = $row->entry_id;
     }
     $this->EE->TMPL->tagparams['entry_id'] = implode('|', $entry_ids);
     return parent::entries();
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Channel::create([]);
     }
 }
Example #17
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     //
     $interactor = new CurlInteractor();
     $interactor->setResponseFactory(new SlackResponseFactory());
     $commander = new Commander($_ENV['SLACK_KEY'], $interactor);
     $channels = Channel::where('is_member', true)->get();
     foreach ($channels as $channel) {
         $latest = $channel->latest ?: 0;
         do {
             $response = $commander->execute('channels.history', ['channel' => $channel->sid, 'oldest' => $latest, 'count' => 1000]);
             $responseBody = $response->getBody();
             foreach ($responseBody['messages'] as $msg) {
                 $latest = $msg['ts'] > $latest ? $msg['ts'] : $latest;
                 $message = new Message();
                 foreach ($msg as $k => $v) {
                     $message->{$k} = is_string($v) ? $v : (object) $v;
                 }
                 $message->channel = $channel->sid;
                 $message->save();
             }
         } while ($responseBody['has_more']);
         $channel->latest = $latest;
         $channel->save();
     }
 }
 public function actionAjaxGetChannels()
 {
     $pointId = Yii::app()->request->getPost('pointId');
     $pointDateStr = date('Y-m-d');
     $requestTime = date('H:i:s');
     $pointDatetimeStr = $pointDateStr . " 23:59:59";
     $pointDateTimestamp = strtotime($pointDateStr);
     $weekDay = strtolower(date('D', $pointDateTimestamp));
     $Playlist = new Playlists();
     $pointChannels = Channel::model()->findAll('id_point=:id_point AND window_id IS NOT NULL', array(':id_point' => $pointId));
     $resp = array();
     foreach ($pointChannels as $pointChannel) {
         $pointChannelId = $pointChannel->internalId;
         $windowId = $pointChannel->window_id;
         if (!is_null($windowId)) {
             $bg = $Playlist->GetBGContentArr($pointId, $pointChannelId, $pointDatetimeStr, $weekDay);
             $adv = $Playlist->GetAdvContentArr($pointId, $pointChannelId, $pointDatetimeStr, $weekDay);
             $blockStructedContent = $Playlist->BuildBlockStructedContent($bg, $adv);
             $straightTimeContent = $Playlist->ConverBlockStructedToStraightTimeContent($blockStructedContent);
             $straightTimeContentHisToSecs = $this->ConvertHisToSecsInStraightTime($straightTimeContent, $requestTime);
             $url = Yii::app()->request->getBaseUrl(true) . '/spool/points/' . $pointId . '/' . $pointChannelId;
             $straightTimeContentWithURLPath = $this->UpdateContentPathes($straightTimeContentHisToSecs, $url);
             $window = Window::model()->findByPK($windowId);
             $widgetToChannel = WidgetToChannel::model()->find("channel_id = :channel_id", array("channel_id" => $pointChannel->id));
             $widget = '';
             if (count($widgetToChannel) > 0) {
                 $widgetModel = Widget::model()->findByPk($widgetToChannel['widget_id']);
                 $widget = $widgetModel['content'];
             }
             $resp[] = array('width' => $window->width, 'height' => $window->height, 'top' => $window->top, 'left' => $window->left, 'content' => $straightTimeContentWithURLPath, 'widget' => $widget);
         }
     }
     echo json_encode($resp);
     exit;
 }
Example #19
0
File: api.php Project: ha1t/epgrec
    public function channelInfo()
    {
        if (isset($_GET['channel_disc'])) {
            try {
                $channel = Channel::get($_GET['channel_disc']);
                $view = <<<EOD
<div class="prg_rec_cfg ui-corner-all">
<div class="prg_title">{$channel->name}</div>

<table>
<tr>
  <td>種別</td><td>{$channel->type}</td>
</tr>
<tr>
  <td>物理チャンネル</td><td>{$channel->channel}</td>
</tr>
<tr>
  <td>サービスID</td>
  <td>
<form method="post" action="channelSetSID.php">
<input type="text" name="n_sid" size="20" id="id_sid" value="{$channel->sid}" />
<input type="hidden" name="n_channel_disc" id="id_disc" value="{$channel->channel_disc}" />
</form>
  </td>
</tr>
</table>
</div>
EOD;
                echo $view;
            } catch (Exception $e) {
                echo 'Error:チャンネル情報の取得に失敗';
            }
        }
    }
Example #20
0
 private function action($form)
 {
     $session = session_currentSession();
     $p = new Channel();
     $p->user = $session->id;
     $p->label = $form->name;
     $p->short_label = $form->shortname;
     $p->key = $this->generateKey();
     $p->secret = $this->generateSecret();
     $p->domain = $form->domain;
     // ISO-8601 2005-08-14T16:13:03+0000;
     $time = time() + $value;
     $p->created = date('c', $time);
     $p->save();
     //header('location:/account/settings');
 }
Example #21
0
/**
 * Prints a <select> of the available channels
/**/
function channel_select($params = '', $selected = '', $id = 00)
{
    $channels = Channel::getChannelList();
    echo "\n<select name=\"chan_{$id}\" {$params}>";
    foreach ($channels as $chanid) {
        $channel =& Channel::find($chanid);
        // Not visible?
        if (empty($channel->visible) || $channel->chanid == 91010) {
            continue;
        }
        // Print the option
        echo '
                <option value="', $channel->chanid, '"', ' title="', html_entities($channel->name), '"';
        // Selected?
        if ($channel->chanid == $selected || $channel->chanid == $_GET['chanid']) {
            echo ' SELECTED';
        }
        // Print the rest of the content
        echo '>';
        if ($_SESSION["prefer_channum"]) {
            echo $channel->channum . '&nbsp;&nbsp;(' . html_entities($channel->callsign) . ')';
        } else {
            echo html_entities($channel->callsign) . '&nbsp;&nbsp;(' . $channel->channum . ')';
        }
        echo '</option>';
    }
    echo '</select>';
}
Example #22
0
 public function getData()
 {
     $view = $this->view;
     $data = array();
     switch ($view) {
         case $view == 'adlist':
             $data = Advertisement::model()->getAdvertisements();
             break;
         case $view == 'channel':
             foreach (Channel::model()->generateChannelList() as $channel => $v) {
                 $data[] = Channel::model()->getChannels(0, $channel);
             }
             break;
         case $view == 'message':
             $data = Advertisement::model()->getValidateAdvertisements(4);
             break;
         case $view == 'register':
             $data = User::model()->findAll(array('order' => 'lastlogin DESC', 'limit' => 10));
             break;
         case $view == 'adrelated':
             $_model = Advertisement::model()->getAdvertisementModel($_GET['id']);
             $data = Advertisement::model()->findAll(array('condition' => 'cid = :cid', 'order' => 'id DESC', 'limit' => 10, 'params' => array(':cid' => $_model->cid)));
             unset($_model);
             break;
         case $view = 'infolist':
             $_model = Advertisement::model()->getAdvertisementModel($_GET['id']);
             $data = Advertisement::model()->findAll(array('condition' => 'uid = :uid', 'order' => 'id DESC', 'limit' => 10, 'params' => array(':uid' => $_model->uid)));
             unset($_model);
             break;
     }
     return $data;
 }
Example #23
0
	function getJsonTags(){
		if ($this->listType=='cloneFollowed')
			$query = Channel::cloneFollowed($this->sorting, $this->qtd);
		elseif ($this->listType=='cloneMy')
			$query = Channel::cloneMy($this->sorting, $this->qtd);
		elseif ($this->listType=='cloneRecommended')
			$query = Channel::cloneRecommended($_SESSION['user'], $this->qtd);
		elseif ($this->listType=='cloneSearch')
			$query = Channel::cloneSearch($this->search, $this->qtd);
		elseif ($this->listType=='cloneMostVisited')
			$query = Channel::cloneMostVisited($this->signed,$this->qtd);
		else
			$query = Channel::cloneAll($this->sorting, $this->qtd);

		$result = array();
		if ($query!=null){
			foreach ($query as $channel){
				$tmp = $channel->getJsonTags();
				if ($this->onlysubsumed)
						unset($tmp['description']);
				array_push($result, $tmp);
			}
		}
		return $result;
	}
Example #24
0
 function edit($ctx)
 {
     _render('form');
     try {
         $channel_id = (string) $_GET['id'] !== '' ? intval($_GET['id']) : '';
         $m = Channel::get($channel_id);
         if (!$m) {
             _redirect($this->_list_url());
             return;
         }
         $wx_info = WxChannelInfo::get($channel_id);
         if ($_POST) {
             $f = $_POST['f'];
             // 生成二维码 每次保存都更新一次 但是如果已经发放了 其实不能更新的 因为会过期 所以,永久的不能更新 临时的更新可以处理
             $expire_type = intval($f['expire_type']);
             $expire_seconds = intval($f['expire_seconds']);
             $expire_seconds = max(0, $expire_seconds);
             $status = intval($f['status']);
             $wx_info = WxChannelInfo::qrcode_create($channel_id, $expire_type, $expire_seconds, $status);
             _redirect($this->_list_url());
         }
         $ctx->wx_info = $wx_info;
         $ctx->m = $m;
     } catch (Exception $e) {
         $msg = $e->getMessage();
         $ctx->errmsg = $msg;
         $ctx->m = $m;
         $ctx->wx_info = $wx_info;
     }
 }
Example #25
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     //
     $interactor = new CurlInteractor();
     $interactor->setResponseFactory(new SlackResponseFactory());
     $commander = new Commander($_ENV['SLACK_KEY'], $interactor);
     $response = $commander->execute('channels.list');
     $responseBody = $response->getBody();
     if (!$responseBody or !$responseBody['ok']) {
         throw new Exception('Sth Error Happened!');
     }
     foreach ($responseBody['channels'] as $chan) {
         if (!$chan['is_channel']) {
             continue;
         }
         $chanData = ['sid' => $chan['id'], 'name' => $chan['name'], 'created' => $chan['created'], 'creator' => $chan['creator'], 'purpose' => (object) $chan['purpose'], 'is_archived' => $chan['is_archived'], 'is_member' => $chan['is_member'], 'num_members' => $chan['num_members'], 'members' => $chan['members'], 'topic' => (object) $chan['topic']];
         if ($channel = Channel::where('sid', $chan['id'])->first()) {
             foreach ($chanData as $k => $v) {
                 $channel->{$k} = $v;
             }
             $channel->save();
         } else {
             $chanData['latest'] = 0;
             Channel::create($chanData);
         }
     }
 }
Example #26
0
	public static function GetDatasource($datasource,$offset=null,$limit=null,&$count=null)
	{
		// format for datasource is:
		// controller://path/path?arg1=val&q=asdads asd ad ad&arg=[123,232,123]
		// channel://channel/datasource?arg1=val&q=asdads asd ad ad&arg=[123,232,123]
		// model://profiles/profile_view?arg1!=val&q=asdads asd ad ad&arg=[123,232,123]
		
		$matches=array();
		if (preg_match_all('#^([^:]*):\/\/([^?]*)(.*)$#',$datasource,$matches))
		{
			switch($matches[1][0])
			{
				case 'controller':
					return Dispatcher::Call($matches[2][0]);
				case 'model':
					$parsed=explode('.',$matches[2][0]);
					if (count($parsed)==2)
					{
						$filter=filter($matches[2][0]);
							
						if ($offset)
							$filter->offset=$offset;
							
						if ($limit)
							$filter->limit=$limit;
							
						if ($matches[3][0]!='')
							$filter->parse(trim($matches[3][0],'?'));
	
                        if ($count==null)
    						$count=$filter->get_count();
		
                        return $filter->find(); 
					}
					
					return null;
				case 'channel':
					$parsed=explode('/',$matches[2][0]);
					$channel=Channel::Get($parsed[0]);
					$query=trim($matches[3][0],'?');
					
					$args=array();
					
					if ($query!="")
					{
						$items=explode('&',$query);
						foreach($items as $item)
						{
							$element=explode('=',$item);
							$args[trim($element[0])]=trim($element[1]);						
						}
						
					}
						
					return $channel->datasource($parsed[1],$offset,$limit,$count,$args);
					
			}
		}
	}
Example #27
0
 function entries()
 {
     # Hijack the Functions class.
     $functions = $this->EE->functions;
     $this->EE->functions = new Dandy_cat_EE_Functions();
     # Create a new instance of the EE Channel class so that it can do all of our heavy lifting.
     $channel = new Channel();
     # EE's Channel class completely refactors any category string with an '&' in it. Let's use commas to sneak past that bit of code.
     if (isset($this->EE->TMPL->tagparams['category'])) {
         $this->EE->TMPL->tagparams['category'] = str_replace('&', ',', $this->EE->TMPL->tagparams['category']);
     }
     # We use the the Channel Entries workhorse for most of this.
     $entries = $channel->entries();
     # Restore the Functions class and return.
     $this->EE->functions =& $functions;
     return $entries;
 }
Example #28
0
 /**
  * @test
  */
 public function shouldGetAllThe4EmptyChannels()
 {
     $channels = Channels::createWaiting(5);
     $process = $this->getMockBuilder('\\Liuggio\\Spawn\\Process\\Process')->disableOriginalConstructor()->getMock();
     $channels->assignAProcess(Channel::createAWaiting(1, 1), $process);
     $this->assertCount(4, $channels->getWaitingChannels());
     $this->assertCount(1, $channels->getAssignedChannels());
 }
Example #29
0
 function get()
 {
     $profile_uid = intval($_GET['p']);
     $load = argc() > 1 && argv(1) == 'load' ? 1 : 0;
     header("Content-type: text/html");
     echo "<!DOCTYPE html><html><body>\r\n";
     /**
      * We can remove this hack once Internet Explorer recognises HTML5 natively
      */
     echo $_GET['msie'] == 1 ? '<div>' : '<section>';
     /**
      *
      * Grab the page inner contents by calling the content function from the profile module directly, 
      * but move any image src attributes to another attribute name. This is because 
      * some browsers will prefetch all the images for the page even if we don't need them.
      * The only ones we need to fetch are those for new page additions, which we'll discover
      * on the client side and then swap the image back.
      *
      */
     $mod = new Channel();
     $text = $mod->get($profile_uid, $load);
     $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
     $replace = "<img\${1} dst=\"\${2}\"";
     //	$text = preg_replace($pattern, $replace, $text);
     /*
     	if(! $load) {
     		$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
     		$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
     		$text = preg_replace($pattern, $replace, $text);
     		$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
     		$text = preg_replace($pattern, $replace, $text);
     		$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
     		$text = preg_replace($pattern, $replace, $text);
         	$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
         	$text = preg_replace($pattern, $replace, $text);
     	}
     */
     /**
      * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
      */
     echo str_replace("\t", '       ', $text);
     echo $_GET['msie'] == 1 ? '</div>' : '</section>';
     echo "</body></html>\r\n";
     killme();
 }
Example #30
0
 public static function getAll()
 {
     $numChannels = count(static::$channels);
     $insts = array();
     for ($i = 1; $i <= $channels; $i++) {
         $insts[] = Channel::load($i);
     }
     return $insts;
 }