Example #1
0
 static function writeLog($msg)
 {
     if (!Settings::$log) {
         return false;
     }
     $fileName = Route::getDir(Settings::$logDir) . '/log_' . date('d-m-Y');
     file_put_contents($fileName, date('H:i:s') . '->' . $msg . "\r\n", FILE_APPEND);
     return true;
 }
Example #2
0
 /**
  * Метод загрузки вида
  *
  * @param            $name название файла
  * @param null|array $args необязательный параметр, массив значений маркеров для загружаемого вида
  *
  * @return mixed|string строка
  */
 static function load($name, $args = null)
 {
     $view = file_get_contents(Route::getDir(Settings::$viewsDir, $name));
     preg_match_all('/{(.*?)}/', $view, $items);
     foreach ($items[1] as $key => $val) {
         if ($args && !array_key_exists($val, $args)) {
             $args[$val] = '';
         }
         $view = preg_replace('{' . $items[0][$key] . '}', $args[$val], $view);
     }
     return $view;
 }
 /**
  * Logout action handler.
  *
  * @return array Success note
  */
 protected function logout()
 {
     if ($this->session->isConnected()) {
         // Destroy the session of the user
         $this->session->closeSession();
     }
     header('Location: ' . Route::getDir());
 }
 /**
  * Clean variables used to define a user loaded
  */
 public function destroy()
 {
     $this->closeSession();
     $_SESSION = array();
     session_destroy();
     // Reset cookies
     setcookie(session_name(), '', time() - 3600, Route::getDir());
 }
Example #5
0
 function statistic()
 {
     $this->loadNavigation();
     $arr = array('NODES' => '');
     $stat = array('NAME' => 'Движок', 'STATISTIC' => 'Пользователей онлайн: ' . SessionManager::getConnectedCount());
     $stat['STATISTIC'] .= ' IP-адресов в списке: ' . Engine::getIpCount();
     $stat['STATISTIC'] .= ' Софт в списке: ' . Engine::getStuffCount();
     $stat['STATISTIC'] .= ' Подключено контроллеров: ' . Engine::getControllersCount();
     $stat['STATISTIC'] .= ', из них активно: ' . Engine::getActivedControllersCount();
     $arr['NODES'] = View::load(array('engine', 'statisticNode'), $stat);
     $files = Engine::loadControllers();
     foreach ($files as $file) {
         if ($file['name'] != strtolower(__CLASS__)) {
             $class = Route::getDir(Settings::$controllersDir, $file['name']);
             if ($class) {
                 include_once $class;
                 $class = new $file['name'](true);
                 $arr['NODES'] .= $class->statistic();
             }
         }
     }
     View::loadContent('statistic', $arr, 'engine');
     View::render();
 }