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(); }
function __construct() { if (!kernel::is_online()) { die('error'); } else { @(include APP_DIR . '/base/defined.php'); } cachemgr::init(); cacheobject::init(); self::$is_start = true; }
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)); }
public function init() { cachemgr::init(false); set_error_handler(array(&$this, '_errorHandler')); $demo_dir = ROOT_DIR . '/demodata'; if (is_dir($demo_dir)) { $handle = opendir($demo_dir); while ($file = readdir($handle)) { $realfile = $demo_dir . '/' . $file; $data_arr = array(); $data = null; if (is_file($realfile)) { list($app_id, $model, $ext) = explode('.', $file); switch ($ext) { case 'sdf': $this->init_sdf($app_id, $model, $realfile); break; case 'php': $setting = (include $realfile); $this->init_setting($app_id, $setting); case 'json': $json_str = file_get_contents($realfile); $json_str = $this->json_fix($json_str); $data = json_decode($json_str, true); $data && ($data_arr = $data['data']); if (count($data_arr) > 0) { $this->init_json($app_id, $model, $data_arr); } else { if ($json_str) { echo "---{$realfile}---JSON STR BEGIN------\n\n"; echo $json_str; echo "---{$realfile}---JSON STR END------\n\n"; logger::info($realfile . ' JSON_DECODE ERROR'); } else { logger::info($realfile . ' NO DATA'); } } break; default: # code... break; } } } restore_error_handler(); closedir($handle); } }
public function command_cacheclean() { if (app::get('base')->status() == 'uninstalled') { logger::info('系统未安装!请先运行install'); return; } logger::info('Cache Clear...'); cachemgr::init(true); if (cachemgr::clean($msg)) { logger::info($msg ? $msg : '...Clear Success'); } else { logger::info($msg ? $msg : '...Clear Failure'); } cachemgr::init(false); }
public function maintenance_theme_files($theme_dir = '') { if (!$theme_dir) { return; } set_time_limit(0); cachemgr::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 == WAP_THEME_DIR) { $dir = new DirectoryIterator($theme_dir); foreach ($dir as $file) { $filename = $file->getFilename(); if ($filename[0] == '.') { continue; } else { $this->update_theme_widgets($filename); } } } else { $this->update_theme_widgets($theme_dir); } echo 'ok.</pre>'; }
public function touch_theme_tmpl($theme) { $rows = app::get('site')->model('themes_tmpl')->select()->columns('tmpl_path')->where('theme = ?', $theme)->instance()->fetch_all(); 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 = kernel::database()->select('SELECT `prefix`, `key` FROM sdb_base_kvstore WHERE `prefix` IN ("cache/template", "cache/theme")'); foreach ($cache_keys as $value) { base_kvstore::instance($value['prefix'])->get_controller()->delete($value['key']); } kernel::database()->exec('DELETE FROM sdb_base_kvstore WHERE `prefix` IN ("cache/template", "cache/theme")'); cachemgr::init(true); cachemgr::clean($msg); cachemgr::init(false); return true; }
<?php ob_implicit_flush(1); require realpath(dirname(dirname(dirname(__FILE__)))) . '/driver/vmcshop.php'; vmc::register_autoload(); cachemgr::init(false); if (!defined('BASE_URL')) { if ($shell_base_url = app::get('base')->getConf('shell_base_url')) { define('BASE_URL', $shell_base_url); } else { echo 'Please login vmcshop shopadmin first'; } }
static function boot() { self::$url_app_map = (array) (require ROOT_DIR . '/config/mapper.php'); self::$url_app_map['/setup'] = 'setup'; 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') { cachemgr::init(); 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]; $prefix_len = strlen($part) + 1; } } else { $app = self::$url_app_map['/']; $prefix_len = 1; } 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') { header('Location: ' . app::get('setup')->base_url()); exit; } } else { echo '<h1>System is Offline, install please.</h1>'; exit; } } else { require ROOT_DIR . '/config/config.php'; } date_default_timezone_set(defined('DEFAULT_TIMEZONE') ? 'Etc/GMT' . (DEFAULT_TIMEZONE >= 0 ? DEFAULT_TIMEZONE * -1 : '+' . DEFAULT_TIMEZONE * -1) : 'UTC'); @(include APP_DIR . '/base/defined.php'); if (isset($pathinfo[$prefix_len])) { $path = substr($pathinfo, $prefix_len); } else { $path = ''; } //init cachemgr if ($app == 'setup') { cachemgr::init(false); } else { cachemgr::init(); } //get app router self::$__router = app::get($app)->router(); self::$__router->dispatch($path); }
public function touch_theme_tmpl($theme) { vmc::singleton('site_theme_base')->set_theme_cache_version($theme); $cache_keys = vmc::database()->select('SELECT `prefix`, `key` FROM vmc_base_kvstore WHERE `prefix` IN ("cache/template", "cache/theme")'); foreach ($cache_keys as $value) { base_kvstore::instance($value['prefix'])->get_controller()->delete($value['key']); } vmc::database()->exec('DELETE FROM vmc_base_kvstore WHERE `prefix` IN ("cache/template", "cache/theme")', true); cachemgr::init(true); cachemgr::clean($msg); cachemgr::init(false); return true; }
function command_cacheclean() { kernel::log('Cache Clear...'); cachemgr::init(true); if (cachemgr::clean($msg)) { kernel::log($msg ? $msg : '...Clear Success'); } else { kernel::log($msg ? $msg : '...Clear Failure'); } cachemgr::init(false); }
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); } }
public function run() { ignore_user_abort(false); ob_implicit_flush(1); ini_set('implicit_flush', true); cachemgr::init(false); if (strpos(strtolower(PHP_OS), 'win') === 0) { if (function_exists('mb_internal_encoding')) { mb_internal_encoding('UTF-8'); mb_http_output('GBK'); ob_start('mb_output_handler', 2); } elseif (function_exists('iconv_set_encoding')) { iconv_set_encoding('internal_encoding', 'UTF-8'); iconv_set_encoding('output_encoding', 'GBK'); ob_start('ob_iconv_handler', 2); } } if (isset($_SERVER['argv'][1])) { $args = array_shift($_SERVER['argv']); $rst = $this->exec_command(implode(' ', $_SERVER['argv'])); if ($rst === false) { exit(-1); } } else { $this->interactive(); } }