function initPage() { //managed public and private sections through a url manager if (Yii::app()->controller->id == "admin" && !Yii::app()->session["userIsAdmin"]) { throw new CHttpException(403, Yii::t('error', 'Unauthorized Access.')); } $page = $this->pages[Yii::app()->controller->id][Yii::app()->controller->action->id]; $pagesWithoutLogin = array("person/login", "person/register", "person/authenticate", "person/activate", "person/sendemail", "document/resized"); if (!isset($page["public"]) && !in_array(Yii::app()->controller->id . "/" . Yii::app()->controller->action->id, $pagesWithoutLogin) && !Yii::app()->session["userId"]) { Yii::app()->session["requestedUrl"] = Yii::app()->request->url; $this->redirect(Yii::app()->createUrl("/" . $this->module->id . "/person/login")); } if (isset($_GET["backUrl"])) { Yii::app()->session["requestedUrl"] = $_GET["backUrl"]; } /*if( !isset(Yii::app()->session['logguedIntoApp']) || Yii::app()->session['logguedIntoApp'] != $this->module->id) $this->redirect(Yii::app()->createUrl("/".$this->module->id."/person/logout"));*/ $this->sidebar1 = array_merge(Menu::menuItems(), $this->sidebar1); $this->person = Person::getPersonMap(Yii::app()->session["userId"]); $this->title = isset($page["title"]) ? $page["title"] : $this->title; $this->subTitle = isset($page["subTitle"]) ? $page["subTitle"] : $this->subTitle; $this->pageTitle = isset($page["pageTitle"]) ? $page["pageTitle"] : $this->pageTitle; $this->notifications = ActivityStream::getNotifications(array("notify.id" => Yii::app()->session["userId"])); CornerDev::addWorkLog("communecter", "*****@*****.**", Yii::app()->controller->id, Yii::app()->controller->action->id); }
public function run() { $res = array(); if (Yii::app()->session["userId"]) { $params = array("notify.id" => Yii::app()->session["userId"]); /*if( isset($_GET["ts"])) $params["timestamp"] = array('$gt'=>(int)$_GET["ts"]);*/ $res = ActivityStream::getNotifications($params); } else { $res = array('result' => false, 'msg' => 'something somewhere went terribly wrong'); } Rest::json($res); Yii::app()->end(); }
function initPage() { //managed public and private sections through a url manager if (Yii::app()->controller->id . "/" . Yii::app()->controller->action->id != "person/login" && Yii::app()->controller->id . "/" . Yii::app()->controller->action->id != "person/register" && Yii::app()->controller->id . "/" . Yii::app()->controller->action->id != "person/authenticate" && !Yii::app()->session["userId"]) { $this->redirect(Yii::app()->createUrl("/" . $this->module->id . "/person/login")); } /*if( !isset(Yii::app()->session['logguedIntoApp']) || Yii::app()->session['logguedIntoApp'] != $this->module->id) $this->redirect(Yii::app()->createUrl("/".$this->module->id."/person/logout"));*/ //Granddir //$id = "54eed95ea1aa143e020041c8"; //Larges $this->sidebar1 = array_merge(Menu::menuItems(), $this->sidebar1); $this->person = Person::getPersonMap(Yii::app()->session["userId"]); $page = $this->pages[Yii::app()->controller->id][Yii::app()->controller->action->id]; $this->title = isset($page["title"]) ? $page["title"] : $this->title; $this->subTitle = isset($page["subTitle"]) ? $page["subTitle"] : $this->subTitle; $this->pageTitle = isset($page["pageTitle"]) ? $page["pageTitle"] : $this->pageTitle; $this->notifications = ActivityStream::getNotifications(array("notify.id" => Yii::app()->session["userId"])); CornerDev::addWorkLog("communecter", "*****@*****.**", Yii::app()->controller->id, Yii::app()->controller->action->id); }
function initPage() { //managed public and private sections through a url manager if (Yii::app()->controller->id == "admin" && !Yii::app()->session["userIsAdmin"]) { throw new CHttpException(403, Yii::t('error', 'Unauthorized Access.')); } $page = $this->pages[Yii::app()->controller->id][Yii::app()->controller->action->id]; $pagesWithoutLogin = array("person/login", "person/register", "person/authenticate", "person/activate", "person/sendemail", "person/checkusername", "document/resized"); $prepareData = true; //if (true)//(isset($_SERVER["HTTP_ORIGIN"]) )//&& $_SERVER["REMOTE_ADDR"] == "52.30.32.155" ) //this is an outside call //{ //$host = "meteor.communecter.org"; //if (strpos("http://".$host, $_SERVER["HTTP_ORIGIN"]) >= 0 || strpos("https://".$host, $_SERVER["HTTP_ORIGIN"]) >= 0 ){ if (isset($_POST["X-Auth-Token"]) && Authorisation::isMeteorConnected($_POST["X-Auth-Token"])) { $prepareData = false; } else { if (!isset($page["public"]) && !in_array(Yii::app()->controller->id . "/" . Yii::app()->controller->action->id, $pagesWithoutLogin) && !Yii::app()->session["userId"]) { Yii::app()->session["requestedUrl"] = Yii::app()->request->url; $this->redirect(Yii::app()->createUrl("/" . $this->module->id . "/person/login")); } } if (isset($_GET["backUrl"])) { Yii::app()->session["requestedUrl"] = $_GET["backUrl"]; } /*if( !isset(Yii::app()->session['logguedIntoApp']) || Yii::app()->session['logguedIntoApp'] != $this->module->id) $this->redirect(Yii::app()->createUrl("/".$this->module->id."/person/logout"));*/ if ($prepareData) { $this->sidebar1 = array_merge(Menu::menuItems(), $this->sidebar1); $this->person = Person::getPersonMap(Yii::app()->session["userId"]); $this->title = isset($page["title"]) ? $page["title"] : $this->title; $this->subTitle = isset($page["subTitle"]) ? $page["subTitle"] : $this->subTitle; $this->pageTitle = isset($page["pageTitle"]) ? $page["pageTitle"] : $this->pageTitle; $this->notifications = ActivityStream::getNotifications(array("notify.id" => Yii::app()->session["userId"])); CornerDev::addWorkLog("communecter", "*****@*****.**", Yii::app()->controller->id, Yii::app()->controller->action->id); } }
public function actionIndex() { $userNotifcations = ActivityStream::getNotifications(array("notify.id" => Yii::app()->session["userId"])); //PHDB::find( ActivityStream::COLLECTION,array("notify.id" => Yii::app()->session["userId"] )); echo count($userNotifcations); }