Ejemplo n.º 1
0
 function init()
 {
     global $db, $user, $mainframe, $hideMenu;
     $hideMenu = 0;
     $task = Request::getVar("task", "");
     if ($task != "") {
         $cmd = "action{$task}()";
         if (method_exists($this, $cmd)) {
             $this->{$cmd}();
         }
     }
     $db = $this->db = Yii::app()->db;
     Yii::app()->name = "Back end";
     $user = $this->user = Yii::app()->session['userbackend'];
     $mainframe = MainFrame::getInstance($this->db, $this->user);
     parent::init();
     $app = Yii::app();
     if (!$mainframe->isLogin()) {
         $duration = time() + 300;
         // 365 days
     } else {
         $remember_admin = (isset($_COOKIE['remember_admin']) and $_COOKIE['remember_admin'] == 1) ? 1 : 0;
         if ($remember_admin == 1) {
             $duration = time() + 86400 * 30;
         } else {
             $duration = time() + 900;
         }
         // 15 minutes
     }
     $cookie = new CHttpCookie(session_name(), session_id(), array("expire" => $duration));
     $app->getRequest()->getCookies()->add($cookie->name, $cookie);
 }
Ejemplo n.º 2
0
 function init()
 {
     //        echo '<br />init frontend';
     global $mainframe, $user, $db;
     if (isset($_REQUEST['dest'])) {
         $dest = $_REQUEST['dest'];
         $dest = base64_decode($dest);
         if (strpos($dest, '<>')) {
             $arr_dest = explode("<>", $dest);
             $arr_dest['job-title'] = $arr_dest[0];
             $arr_dest['job-link'] = $arr_dest[1];
             Yii::app()->session['dest'] = $arr_dest;
         }
     }
     $db = $this->db = Yii::app()->db;
     parent::init();
     Yii::app()->name = "Front end";
     $user = $this->user = Yii::app()->session['userfront'];
     if (is_object($user)) {
         $user->reloaUserLogin();
     }
     $mainframe = MainFrame::getInstance($this->db, $this->user, "frontend");
     $YiiApp = Yii::app();
     if (!$mainframe->isLogin()) {
         $timeout = isset(Yii::app()->params->timeout) ? Yii::app()->params->timeout : 30 * 60;
         // 15 phut
         $duration = time() + $timeout;
         // 5 phut
     } else {
         $remember_user = (isset($_COOKIE['remember_user']) and $_COOKIE['remember_user'] == 1) ? 1 : 0;
         if ($remember_user == 1) {
             $timeout = isset(Yii::app()->params->timeout2) ? Yii::app()->params->timeout2 : 43200;
         } else {
             $timeout = isset(Yii::app()->params->timeout) ? Yii::app()->params->timeout : 1800;
         }
         // 15 phut
         $duration = time() + $timeout;
     }
     $cookie = new CHttpCookie(session_name(), session_id(), array("expire" => $duration));
     $YiiApp->getRequest()->getCookies()->add($cookie->name, $cookie);
     $afterLogin = (isset($_SESSION['afterLogin']) and $_SESSION['afterLogin'] == 1) ? 1 : 0;
     if ($mainframe->isLogin() == true and $afterLogin == 0) {
         if (ENABLE_SSO == 1) {
             $clientID = $apiKey;
         } else {
             $clientID = session_id();
         }
         $this->afterLogin($clientID, $clientID);
         $_SESSION['afterLogin'] = 1;
     }
     parent::init();
 }
Ejemplo n.º 3
0
 function init()
 {
     global $db, $user, $mainframe, $hideMenu;
     setSysConfig("sidebar.display", 1);
     $task = Request::getVar("task", "");
     if ($task != "") {
         $cmd = "action{$task}()";
         if (method_exists($this, $cmd)) {
             $this->{$cmd}();
         }
     }
     $db = $this->db = Yii::app()->db;
     Yii::app()->name = "Back end";
     $user = $this->user = Yii::app()->session['userbackend'];
     if (is_object($user)) {
         $user->reloaUserLogin();
     }
     $mainframe = MainFrame::getInstance($this->db, $user);
     parent::init();
     $copyright = isset(Yii::app()->params->copyright) ? Yii::app()->params->copyright : 0;
     $timeout = isset(Yii::app()->params->timeout) ? Yii::app()->params->timeout : 900;
     // 15 phut
     $timeout2 = isset(Yii::app()->params->timeout2) ? Yii::app()->params->timeout2 : 1800;
     // 30 phut
     $YiiApp = Yii::app();
     if (!$mainframe->isLogin()) {
         $duration = time() + $timeout;
         // 365 days
     } else {
         $permission = isset(Yii::app()->params->permission) ? Yii::app()->params->permission : 1;
         if ($permission == 1) {
             CheckPerMission::checking();
         }
         $remember_admin = (isset($_COOKIE['remember_admin']) and $_COOKIE['remember_admin'] == 1) ? 1 : 0;
         if ($remember_admin == 1) {
             $duration = time() + $timeout2;
         } else {
             $duration = time() + $timeout;
         }
         // 15 minutes
     }
     $cookie = new CHttpCookie(session_name(), session_id(), array("expire" => $duration));
     $YiiApp->getRequest()->getCookies()->add($cookie->name, $cookie);
 }
Ejemplo n.º 4
0
 public function OnInit()
 {
     $main = new MainFrame();
     $main->Show();
     $controller = new ControlFrame($main->getDemoNames());
     $controller->Show();
     $controller->setChangeHandler(function ($index) use($main) {
         $main->switchDemo($index);
     });
     // Must be called after the handler is set
     $controller->setChoice(0);
     return true;
 }
Ejemplo n.º 5
0
 private function Clean($string)
 {
     $string = MainFrame::Init("input__filter")->process($string);
     return $string;
 }
Ejemplo n.º 6
0
 public function OnInit()
 {
     // Create a window (works fine)
     $main = new MainFrame();
     $main->Show();
     return true;
 }