예제 #1
0
 /**
  * Create the notification instance
  */
 private final function __construct()
 {
     if (Platform::isCli()) {
         $this->isCli = true;
         return;
     }
     $this->session = Session::getSession();
     $messages = $this->session->get(self::SESSION_KEY);
     if (is_array($messages)) {
         $this->messages = $messages;
         $this->session->delete(self::SESSION_KEY);
         $this->session->write();
     }
 }
예제 #2
0
 private final function __construct()
 {
     if (Platform::isCli()) {
         $this->isCli = true;
         return;
     }
     $this->session = Session::getSession();
     $stored = $this->session->get('messages');
     if (is_array($stored)) {
         $this->messages = $stored;
         $this->session->set('messages', array());
         $this->session->write();
     }
 }
예제 #3
0
 /**
  * Create new object and try to identify the timezone
  */
 public function __construct()
 {
     if (self::$success !== null) {
         return;
     }
     if (Platform::isCli() === false && array_key_exists(self::$cookieName, $_COOKIE)) {
         list($offset, $dst) = explode(',', $_COOKIE[self::$cookieName]);
         $timezoneName = timezone_name_from_abbr('', (int) $offset, (int) $dst);
         self::$success = (bool) $timezoneName;
         if (self::$success === true) {
             self::$offset = $offset;
             self::$timezoneName = $timezoneName;
         }
     }
 }
예제 #4
0
 private final function __construct()
 {
     $session = Session::getSession();
     if (!is_array($session->get('messages'))) {
         $session->messages = array();
     }
     if (Platform::isCli()) {
         $this->is_cli = true;
     }
 }
예제 #5
0
파일: Cli.php 프로젝트: kobmaki/icingaweb2
 /**
  * Fail if Icinga has not been called on CLI
  *
  * @throws ProgrammingError
  * @return void
  */
 private function assertRunningOnCli()
 {
     if (Platform::isCli()) {
         return;
     }
     throw new ProgrammingError('Icinga is not running on CLI');
 }