Example #1
0
 function __construct()
 {
     set_time_limit(0);
     cachemgr::init(false);
     cacheobject::init(false);
     kernel::$console_output = true;
     set_error_handler(array(&$this, 'error_handle'));
     if (file_exists(ROOT_DIR . '/config/config.php')) {
         require ROOT_DIR . '/config/config.php';
         $this->status['config'] = ROOT_DIR . '/config/config.php';
     } else {
         $this->status['config'] = 'false';
     }
     include APP_DIR . '/base/defined.php';
     //为shell设置BASE_URL
     if (!defined('BASE_URL')) {
         if ($shell_base_url = app::get('base')->getConf('shell_base_url')) {
             define('BASE_URL', $shell_base_url);
         } else {
             trigger_error('please login backend first!', E_USER_NOTICE);
         }
     }
     date_default_timezone_set(defined('DEFAULT_TIMEZONE') ? 'Etc/GMT' . (DEFAULT_TIMEZONE >= 0 ? DEFAULT_TIMEZONE * -1 : '+' . DEFAULT_TIMEZONE * -1) : 'UTC');
     $this->buildin_commander = new base_shell_buildin($this);
 }
Example #2
0
 static function boot()
 {
     $pathinfo = request::getPathInfo();
     // 生成part
     if (isset($pathinfo[1])) {
         if ($p = strpos($pathinfo, '/', 2)) {
             $part = substr($pathinfo, 0, $p);
         } else {
             $part = $pathinfo;
         }
     } else {
         $part = '/';
     }
     if ($part == '/openapi') {
         return kernel::single('base_rpc_service')->process($pathinfo);
     } elseif ($part == '/app-doc') {
         //cachemgr::init();
         return kernel::single('base_misc_doc')->display($pathinfo);
     }
     // 确认是否安装流程. 如果是安装流程则开启debug. 如果不是则检查是否安装, 如果未安装则跳到安装流程
     // 目前其他的url, 都应移到routes中进行
     //
     if ($part == '/setup') {
         config::set('app.debug', true);
     } else {
         static::checkInstalled();
     }
     cacheobject::init();
     static::registRouteMiddleware();
     $response = route::dispatch(request::instance());
     // 临时处理方式
     kernel::single('base_session')->close();
     $response->send();
     exit;
 }
Example #3
0
 function __construct()
 {
     if (!kernel::is_online()) {
         die('error');
     }
     cacheobject::init();
     self::$is_start = true;
 }
Example #4
0
 public function __construct()
 {
     set_time_limit(0);
     cachemgr::init(false);
     cacheobject::init(false);
     vmc::$console_output = true;
     set_error_handler(array(&$this, 'error_handle'));
     $this->buildin_commander = new base_shell_buildin($this);
 }
Example #5
0
 function __construct()
 {
     if (!kernel::is_online()) {
         die('error');
     } else {
         require ROOT_DIR . '/config/config.php';
         @(include APP_DIR . '/base/defined.php');
     }
     cachemgr::init();
     cacheobject::init();
 }
Example #6
0
 function __construct()
 {
     if (!kernel::is_online()) {
         die('error');
     } else {
         @(include APP_DIR . '/base/defined.php');
     }
     cachemgr::init();
     cacheobject::init();
     self::$is_start = true;
 }
Example #7
0
 function __construct()
 {
     if (!kernel::is_online()) {
         die('error');
     } else {
         @(include APP_DIR . '/base/defined.php');
     }
     cachemgr::init();
     cacheobject::init();
     self::$is_start = true;
     //@file_put_contents(ROOT_DIR.'/api_post_log.txt', json_encode($_POST));
 }
Example #8
0
 public function maintenance_theme_files($platform, $theme_dir = '')
 {
     if (!$theme_dir) {
         return;
     }
     set_time_limit(0);
     cacheobject::init(false);
     header('Content-type: text/html;charset=utf-8');
     ignore_user_abort(false);
     ob_implicit_flush(1);
     ini_set('implicit_flush', true);
     kernel::$console_output = true;
     while (ob_get_level()) {
         ob_end_flush();
     }
     echo str_repeat("", 1024);
     echo '<pre>';
     echo '>update themes' . "\n";
     if ($theme_dir == THEME_DIR) {
         $dir = new DirectoryIterator($theme_dir);
         foreach ($dir as $file) {
             $filename = $file->getFilename();
             if ($filename[0] == '.') {
                 continue;
             } else {
                 $this->update_theme_widgets($platform, $filename);
             }
         }
     } else {
         $this->update_theme_widgets($platform, $theme_dir);
     }
     echo 'ok.</pre>';
 }
Example #9
0
 public function touch_theme_tmpl($theme)
 {
     $db = app::get('site')->database();
     $qb = $db->createQueryBuilder();
     $rows = $qb->select('*')->from('site_themes_tmpl')->where('theme=' . $qb->createPositionalParameter($theme))->execute()->fetchAll();
     if ($rows) {
         array_push($rows, array('tmpl_path' => 'block/header.html'), array('tmpl_path' => 'block/footer.html'));
         foreach ($rows as $row) {
             $this->touch_tmpl_file($theme . '/' . $row['tmpl_path']);
         }
         kernel::single('site_theme_base')->set_theme_cache_version($theme);
     }
     $cache_keys = $db->executeQuery('SELECT `prefix`, `key` FROM base_kvstore WHERE `prefix` IN ("cache/template", "cache/theme")')->fetchAll();
     foreach ($cache_keys as $value) {
         base_kvstore::instance($value['prefix'])->get_controller()->delete($value['key']);
     }
     app::get('base')->database()->executeUpdate('DELETE FROM base_kvstore WHERE `prefix` IN ("cache/template", "cache/theme")');
     //todo cacheobject touch tmpl时清缓存
     cacheobject::init(true);
     cacheobject::clean($msg);
     cacheobject::init(false);
     return true;
 }
Example #10
0
 static function boot()
 {
     set_error_handler(array('kernel', 'exception_error_handler'));
     try {
         if (!self::register_autoload()) {
             require dirname(__FILE__) . '/autoload.php';
         }
         require ROOT_DIR . '/config/mapper.php';
         if (self::is_online()) {
             require ROOT_DIR . '/config/config.php';
         }
         @(include APP_DIR . '/base/defined.php');
         date_default_timezone_set(defined('DEFAULT_TIMEZONE') ? 'Etc/GMT' . (DEFAULT_TIMEZONE >= 0 ? DEFAULT_TIMEZONE * -1 : '+' . DEFAULT_TIMEZONE * -1) : 'UTC');
         self::$url_app_map = $urlmap;
         foreach (self::$url_app_map as $flag => $value) {
             self::$app_url_map[$value['app']] = $flag;
         }
         if (get_magic_quotes_gpc()) {
             self::strip_magic_quotes($_GET);
             self::strip_magic_quotes($_POST);
         }
         $pathinfo = self::request()->get_path_info();
         $jump = false;
         if (isset($pathinfo[1])) {
             if ($p = strpos($pathinfo, '/', 2)) {
                 $part = substr($pathinfo, 0, $p);
             } else {
                 $part = $pathinfo;
                 $jump = true;
             }
         } else {
             $part = '/';
         }
         if ($part == '/api') {
             return kernel::single('base_rpc_service')->process($pathinfo);
         } elseif ($part == '/openapi') {
             return kernel::single('base_rpc_service')->process($pathinfo);
         } elseif ($part == '/app-doc') {
             //cachemgr::init();
             return kernel::single('base_misc_doc')->display($pathinfo);
         }
         if (isset(self::$url_app_map[$part])) {
             if ($jump) {
                 $request_uri = self::request()->get_request_uri();
                 $urlinfo = parse_url($request_uri);
                 $query = $urlinfo['query'] ? '?' . $urlinfo['query'] : '';
                 header('Location: ' . $urlinfo['path'] . '/' . $query);
                 exit;
             } else {
                 $app = self::$url_app_map[$part]['app'];
                 $prefix_len = strlen($part) + 1;
                 kernel::set_lang(self::$url_app_map[$part]['lang']);
             }
         } else {
             $app = self::$url_app_map['/']['app'];
             $prefix_len = 1;
             kernel::set_lang(self::$url_app_map['/']['lang']);
         }
         if (!$app) {
             readfile(ROOT_DIR . '/app/base/readme.html');
             exit;
         }
         if (!self::is_online()) {
             if (file_exists(APP_DIR . '/setup/app.xml')) {
                 if ($app != 'setup') {
                     //todo:进入安装check
                     setcookie('LOCAL_SETUP_URL', app::get('setup')->base_url(1), 0, '/');
                     header('Location: ' . kernel::base_url() . '/app/setup/check.php');
                     exit;
                 }
             } else {
                 echo '<h1>System is Offline, install please.</h1>';
                 exit;
             }
         }
         // 检查是否手机端
         if (base_mobiledetect::is_mobile()) {
             base_mobiledetect::select_terminator($part, $_GET['ignore_ua_check'], self::$url_app_map);
         }
         if (isset($pathinfo[$prefix_len])) {
             $path = substr($pathinfo, $prefix_len);
         } else {
             $path = '';
         }
         //init cachemgr
         if ($app == 'setup') {
             cachemgr::init(false);
         } else {
             cachemgr::init();
             cacheobject::init();
         }
         //get app router
         self::$__router = app::get($app)->router();
         self::$__router->dispatch($path);
     } catch (Exception $e) {
         base_errorpage::exception_handler($e);
     }
 }
Example #11
0
<?php

ob_implicit_flush(1);
require __DIR__ . '/../../bootstrap/start.php';
kernel::$console_output = true;
cacheobject::init(false);
// 时区设置
//$timezone = config::get('app.timezone', 8);
//date_default_timezone_set('Etc/GMT'.($timezone>=0?($timezone*-1):'+'.($timezone*-1)));
if (!defined('BASE_URL')) {
    if ($shell_base_url = app::get('base')->getConf('shell_base_url')) {
        define('BASE_URL', $shell_base_url);
    } else {
        echo 'Please install ecstore first, and login to the backend ';
    }
}
Example #12
0
 function command_cacheclean()
 {
     logger::info('Cache Clear...');
     if (cacheobject::clean($msg)) {
         logger::info($msg ? $msg : '...Clear Success');
     } else {
         logger::info($msg ? $msg : '...Clear Failure');
     }
     cacheobject::init(false);
 }
Example #13
0
 function __construct()
 {
     require ROOT_DIR . '/config/config.php';
     @(include APP_DIR . '/base/defined.php');
     cacheobject::init();
 }