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"]) {
         $res = ActivityStream::removeNotificationsByUser();
     } else {
         $res = array('result' => false, 'msg' => 'something somewhere went terribly wrong');
     }
     Rest::json($res);
     Yii::app()->end();
 }
 public function actionNotif()
 {
     echo "Push a notication <br/>";
     //push an activity Stream Notification
     /* **********************************
        Activity Stream and Notifications
        */
     //$type,$perimetre,$verb,$label,$id
     $asParam = array("type" => ActStr::TEST, "codeInsee" => "97400", "verb" => "add", "actorType" => "persons", "objectType" => "test", "label" => "Testing Notification Push", "id" => Yii::app()->session['userId']);
     $action = ActStr::buildEntry($asParam);
     //LOGGING WHO TO NOTIFY
     $action["notify"] = ActivityStream::addNotification(array("persons" => array(Yii::app()->session['userId']), "label" => "Something Changed", "icon" => ActStr::ICON_QUESTION, "url" => 'javascript:alert(  "testing notifications"  );'));
     ActivityStream::addEntry($action);
 }
Exemple #4
0
 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);
     }
 }
Exemple #7
0
 public static function viewPage($url)
 {
     $asParam = array("type" => ActStr::VIEW_PAGE, "verb" => ActStr::VERB_VIEW, "actorType" => Person::COLLECTION, "objectType" => ActStr::TYPE_URL, "id" => $url, "ip" => $_SERVER['REMOTE_ADDR']);
     $action = self::buildEntry($asParam);
     ActivityStream::addEntry($action);
 }