예제 #1
0
파일: Password.php 프로젝트: gudwin/extasy
 public static function hash($str)
 {
     $salt = Configure::read(CMS::SaltConfigureKey);
     $salt = md5($salt);
     $result = crypt($str, $salt);
     return $result;
 }
예제 #2
0
파일: Memcache.php 프로젝트: gudwin/faid
 protected function autoloadConfig()
 {
     $this->config = \Faid\Configure\Configure::read(self::ConfigurePath);
     $valid = isset($this->config['servers']) && is_array($this->config['servers']);
     if (!$valid) {
         throw new Exception('Memcache config not valid');
     }
     $this->prefix = !empty($this->config['prefix']) ? $this->config['prefix'] : '';
 }
예제 #3
0
파일: Runner.php 프로젝트: gudwin/extasy
 protected function getTimeLimit()
 {
     try {
         $result = Configure::read(self::TimeoutConfigureKey);
     } catch (ConfigureException $e) {
         $result = 1;
     }
     return $result;
 }
예제 #4
0
파일: Latests.php 프로젝트: gudwin/extasy
 public function __construct($data = [])
 {
     parent::__construct($data);
     try {
         $this->limit = Configure::read(self::ConfigureKey);
     } catch (\Exception $e) {
         $this->limit = self::DefaultLimit;
     }
 }
예제 #5
0
파일: Menu.php 프로젝트: gudwin/extasy
 protected function autoloadMenuItems()
 {
     try {
         $menuItems = Configure::read(self::AutoloadMenuItemsConfigureKey);
     } catch (ConfigureException $e) {
         return;
     }
     $menuItems = \EventController::callFilter(self::FilterName, $menuItems);
     foreach ($menuItems as $item) {
         $this->items->add($item);
     }
 }
예제 #6
0
파일: template.php 프로젝트: gudwin/extasy
 public static function getViewPath()
 {
     try {
         $result = Configure::read(self::ConfigureKey);
     } catch (ConfigureException $e) {
         $result = '';
     }
     if (empty($result)) {
         $result = VIEW_PATH;
     }
     return $result;
 }
예제 #7
0
파일: DB.php 프로젝트: gudwin/faid
 /**
  * Check if connection with mysql server was established or not
  */
 public static function checkConnection()
 {
     if (!empty(self::$connection)) {
         // connection established, exit function
     } else {
         // no, we have to connect Mysql-server
         $data = Configure::read('DB');
         self::$connection = new \mysqli($data['host'], $data['user'], $data['password'], $data['database'], isset($data['port']) ? $data['port'] : null, isset($data['socket']) ? $data['socket'] : null);
         if (self::$connection->connect_error) {
             $msg = sprintf('DB failed to connect mysql server. Mysql respone - %s', self::$connection->connect_error);
             throw new \Exception($msg);
         }
         self::$connection->set_charset('utf8');
     }
 }
예제 #8
0
 /**
  *   @desc Обрабатываем запрос и пересылаем на вывод
  *   @return
  */
 public function post($sql)
 {
     $this->szError = '';
     $this->aResult = array();
     // Замеряем время
     $timeStart = microtime(true);
     $connection = Configure::read('DB');
     $mysql = new mysqli($connection['host'], $connection['user'], $connection['password'], $connection['database']);
     $mysql->set_charset('utf8');
     $result = $mysql->query($sql);
     $timeFinish = microtime(true);
     // Если у запроса есть результаты
     if ($result !== FALSE) {
         // Если имеется результат запроса
         if (!is_bool($result)) {
             $row = $result->fetch_assoc();
             while ($row) {
                 $this->aResult[] = $row;
                 $row = $result->fetch_assoc();
             }
         }
     } else {
         $result = array();
         $this->szError = $mysql->error;
     }
     array_push($this->aSession, $sql);
     $_SESSION['cms_sql_query_time'] = $timeFinish - $timeStart;
     // Выводим результат запроса
     ob_start();
     $this->outputResults();
     $content = ob_get_clean();
     // Получаем последний список запросов
     ob_start();
     $this->outputSessionRequests();
     $requests = ob_get_clean();
     // Вывод блока ошибки
     ob_start();
     $this->outputError();
     $error = ob_get_clean();
     // Время запроса
     $time = $_SESSION['cms_sql_query_time'];
     // Формируем результат
     $output = array('request' => $sql, 'time' => $time, 'sql_log' => $requests, 'error' => $error, 'size' => sizeof($result), 'results' => $content);
     print json_encode($output);
     die;
 }
예제 #9
0
 protected function loadConfigurationFile()
 {
     try {
         $sql = sprintf('truncate %s ', Job::TableName);
         DB::post($sql);
         $path = \Faid\Configure\Configure::read(self::ConfigureKey);
         $validator = new ReadableFile($path);
         if ($validator->isValid()) {
             include $path;
         }
         \CMSLog::addMessage(__CLASS__, 'Schedule restarted');
     } catch (\Exception $e) {
         \CMSLog::addMessage(__CLASS__, $e);
         return ['error' => 'internal error'];
     }
     return;
 }
예제 #10
0
 /**
  *
  */
 public function __construct($urlInfo = array())
 {
     parent::__construct($urlInfo);
     // confirmation page
     $this->addGet('code', 'confirm');
     $this->addPost('code', 'confirm');
     $this->addGet('email_confirmation_code', 'confirmEmail');
     // after regstration page
     $this->addGet('success', 'showSuccess');
     // submit page
     $this->AddPost('login,password,email', 'signup');
     $register = new SystemRegister('Applications/users');
     $captcha_provider = $register->captcha_provider->value;
     if ('recaptcha' == $captcha_provider) {
         require_once LIB_PATH . '3rdparty/recaptchalib.php';
         $config = \Faid\Configure\Configure::read('Recaptcha');
         $this->recaptchaPublicKey = $config['public_key'];
         $this->recaptchaPrivateKey = $config['private_key'];
     }
 }
예제 #11
0
파일: UParser.php 프로젝트: gudwin/faid
 /**
  * @param $szContent
  * @param $aVariables
  *
  * @return string
  * @throws \Exception
  */
 public static function parsePHPCode($szContent, $viewVariables = null)
 {
     self::callEvent('UParser::before_parse_code', $szContent, $viewVariables);
     try {
         $baseDir = Configure::read('UParser.tmp_dir');
     } catch (ConfigureException $e) {
         throw new \Exception('Directive "UParser.tmp_dir" not defined ');
     }
     $szOld = ob_get_contents();
     ob_clean();
     $__szPath = $baseDir . uniqid();
     file_put_contents($__szPath, $szContent);
     if (!empty($viewVariables)) {
         extract($viewVariables);
     }
     include $__szPath;
     unlink($__szPath);
     $szContent = ob_get_contents();
     ob_clean();
     print $szOld;
     self::callEvent('UParser::after_parse_code', $szContent, $viewVariables, $szContent);
     return $szContent;
 }
예제 #12
0
파일: login.php 프로젝트: gudwin/extasy
 protected static function setCookie($value, $time)
 {
     $domain = Configure::read(\Extasy\CMS::MainDomainConfigureKey);
     $domain = '.' . $domain;
     setcookie(self::cookieName, $value, $time, '/', $domain);
 }
예제 #13
0
파일: account.php 프로젝트: gudwin/extasy
 public static function getFieldsInfo()
 {
     return \Faid\Configure\Configure::read(static::ModelConfigureKey);
 }
예제 #14
0
파일: SimpleCache.php 프로젝트: gudwin/faid
 /**
  * @return \Faid\Cache\Engine\CacheEngineInterface
  */
 protected static function factoryInstance()
 {
     $engineClass = Configure::read(self::ConfigurePath . '.Engine');
     self::$instance = new $engineClass();
 }
예제 #15
0
파일: FileCache.php 프로젝트: gudwin/faid
 public function __construct()
 {
     $key = self::ConfigurePath . '.BaseDir';
     $this->basePath = Configure::read($key);
 }
예제 #16
0
파일: CMS.php 프로젝트: gudwin/extasy
 public static function getUnitTestCookie()
 {
     $string = SITE_NAME . Configure::read('Security.Salt');
     return md5($string);
 }
예제 #17
0
 /**
  *
  */
 protected function getInitialCookies()
 {
     return sprintf(".%s\tTRUE\t/\tFALSE\t%d\t%s\t%s", \Faid\Configure\Configure::read('MainDomain'), time() + 3600, CMS::UnitTestCookieName, CMS::getUnitTestCookie());
 }
예제 #18
0
파일: Debug.php 프로젝트: gudwin/faid
 /**
  * Setups handlers for errors and exceptions
  */
 protected static function linkErrorHandlers()
 {
     $errorHandler = Configure::read('Error.Handler');
     $errorLevel = Configure::read('Error.Level');
     $exceptionHandler = Configure::read('Exception.Handler');
     // enable error handler
     set_error_handler($errorHandler, $errorLevel);
     // enable exception handler
     set_exception_handler($exceptionHandler);
 }
예제 #19
0
 public function __construct($accessToken = null)
 {
     $this->config = \Faid\Configure\Configure::read(self::ConfigureKey);
     $this->config['redirect_url'] = sprintf('http://%s/oauth/vkontakte/', \Extasy\CMS::getMainDomain());
     $this->token = $accessToken;
 }
예제 #20
0
 protected static function isDebugEnabled()
 {
     $debug = Configure::read('Debug');
     return $debug;
 }
예제 #21
0
파일: MenuItem.php 프로젝트: gudwin/extasy
 public function __construct()
 {
     $config = Configure::read(self::ConfigureKey);
     $this->depth = $config['depth'];
     $this->title = $config['title'];
 }
예제 #22
0
 public function __construct($accessToken = null)
 {
     $this->config = Configure::read(self::ConfigureKey);
     FacebookSession::setDefaultApplication($this->config['app_id'], $this->config['app_secret']);
     $this->token = $accessToken;
 }
예제 #23
0
 public function testSetAndEditArrays()
 {
     $data = array('item1' => 1, 'item2' => 2, 'item3' => 3, 'level2' => array('subitem' => 3, 'sublevel' => array(1, 2, 3)));
     Configure::write('test', $data);
     $this->assertEquals($data['level2'], Configure::read('test.level2'));
 }
예제 #24
0
파일: Logout.php 프로젝트: gudwin/extasy
 protected function getLogoutUrl()
 {
     return Configure::read(self::LogoutUrlKey);
 }