public function flush() { $base_url = vmc::base_url(); foreach ($this->db->select('select queue_id from vmc_base_queue limit ' . $this->limit) as $r) { $this->runtask($r['queue_id']); } }
public function index() { $desktop_user = vmc::singleton('desktop_user'); $menus = $desktop_user->get_work_menu(); $user_id = $this->user->get_id(); foreach ((array) $menus['workground'] as $key => $value) { //if($i++>$workground_count) break; $fav_menus[] = $key; } $this->pagedata['title'] = $title; $this->pagedata['title_desc'] = $title_desc; $this->pagedata['session_id'] = vmc::singleton('base_session')->sess_id(); $this->pagedata['uname'] = $this->user->get_login_name(); $this->pagedata['avatar'] = $this->user->get_avatar(); $this->pagedata['is_super'] = $this->user->is_super(); $this->pagedata['param_id'] = $user_id; $this->pagedata['menus'] = $menus; $this->pagedata['fav_menus'] = (array) $fav_menus; $this->pagedata['shop_base'] = vmc::base_url(1); $this->pagedata['shopadmin_dir'] = $_SERVER['REQUEST_URI']; // 桌面内容替换埋点 foreach (vmc::servicelist('desktop_content') as $services) { if (is_object($services)) { if (method_exists($services, 'changeContent')) { $services->changeContent(app::get('desktop')); $services->changeContent($desktop_menu); } } } $this->display('index.html'); }
public function detail_statics($id) { $render = app::get('routeplus')->render(); $render->pagedata['base_url'] = vmc::base_url(true); $render->pagedata['app_url_map'] = vmc::$app_url_map; $render->pagedata['statics'] = app::get('routeplus')->model('statics')->dump($id); return $render->fetch('admin/edit_statics.html'); }
public function show($run_id) { /* $oXHProf = $this->app->model('xhprof'); $this->pagedata["data"] = $oXHProf->read_data($run_id); $this->display("/admin/show_data.html");*/ echo "<iframe src='" . vmc::base_url(1) . "/app/serveradm/vendor/xhprof_html/index.php?run=" . $run_id . "&source=xhprof' width='100%' height='100%'></iframe>"; }
public function get_varys() { $varys['HOST'] = vmc::base_url(true); //host信息 $varys['REWRITE'] = defined('URL_REWRITE') ? URL_REWRITE : ''; //是否有rewirte支持 return $varys; }
public function base_url($full = false) { $c = $full ? 'full' : 'part'; if (!$this->base_url[$c]) { $part = vmc::$app_url_map[$this->app_id]; $this->base_url[$c] = vmc::base_url($full) . vmc::url_prefix() . $part . ($part == '/' ? '' : '/'); } return $this->base_url[$c]; }
public function write_lock_file($cookie = true) { $lock_code = md5(microtime()) . md5(print_r($_SERVER, 1)); if ($this->put_lockfile($this->lockcode_prefix . $lock_code)) { $path = vmc::base_url(); $path = $path ? $path : '/'; return true; } else { return false; } }
function set_cookie($name, $value, $expire = false, $path = null) { if (!$this->cookie_path) { $this->cookie_path = vmc::base_url() . '/'; #$this->cookie_path = substr(PHP_SELF, 0, strrpos(PHP_SELF, '/')).'/'; $this->cookie_life = $this->app->getConf('system.cookie.life'); } $this->cookie_life = $this->cookie_life > 0 ? $this->cookie_life : 315360000; $expire = $expire === false ? time() + $this->cookie_life : $expire; setcookie($name, $value, $expire, $this->cookie_path); $_COOKIE[$name] = $value; }
public function __construct() { $this->base_url = vmc::base_url('full') . '/'; if (!defined('FILE_STORAGER')) { define('FILE_STORAGER', 'filesystem'); } $this->class_name = 'base_storage_' . constant('FILE_STORAGER'); $this->worker = new $this->class_name(); if (defined('HOST_MIRRORS')) { $host_mirrors = preg_split('/[,\\s]+/', constant('HOST_MIRRORS')); if (is_array($host_mirrors) && isset($host_mirrors[0])) { $this->host_mirrors =& $host_mirrors; $this->host_mirrors_count = count($host_mirrors) - 1; } } }
static function get_files($theme_define) { list($theme_app, $theme_dir) = explode('/', $theme_define); $handle = opendir(app::get($theme_app)->app_dir . '/desktop_themes/' . $theme_dir); $theme_base_url = vmc::base_url() . '/app/' . $theme_app . '/desktop_themes/' . $theme_dir; while (false !== ($file = readdir($handle))) { if ($file[0] != '.') { if (substr($file, -4, 4) == '.css') { $css[] = $theme_base_url . '/' . $file; } elseif (substr($file, -3, 3) == '.js') { $js[] = $theme_base_url . '/' . $file; } } } closedir($handle); return array($js, $css); }
public function edit($id) { $mdl_rstatics = $this->app->model('statics'); $this->pagedata['base_url'] = vmc::base_url(true); $this->pagedata['app_url_map'] = vmc::$app_url_map; if ($_POST) { $save_data = $_POST; if ($save_data['id']) { $this->begin(); } else { $this->begin('index.php?app=routeplus&ctl=admin_statics&act=index'); } $this->end($mdl_rstatics->save($save_data)); } else { $this->display('admin/edit_statics.html'); } }
public static function select_terminator($part, $ignore_ua_check, $url_app_map) { if (app::get('mobile')->getConf('select_terminator') == false || app::get('mobile')->getConf('select_terminator') == 'false') { return false; } //地址扩展名 if (app::get('mobile')->getConf('enable_mobile_uri_expanded') == 'true') { $uri_expended_name = app::get('mobile')->getConf('mobile_uri_expanded_name'); } else { $uri_expended_name == 'html'; } foreach ($url_app_map as $k => $v) { if ($v['app'] == 'mobile') { $mb_map = $k; } } if (($part == '/' || $part == '/index.php' || $part == '/index.' . $uri_expended_name || substr($part, 0, strlen($mb_map) + 1) != $mb_map . '/') && $ignore_ua_check != 1 && $part != $mb_map) { header('Location:' . vmc::base_url(1) . (WITH_REWRITE ? '' : '/index.php') . $mb_map . $part); exit; } }
public function destory() { if (!$this->_session_started) { return false; } $this->_session_started = false; $res = $this->_set_session(array(), 1); if ($res) { $_SESSION = array(); $this->_session_destoryed = true; $cookie_path = vmc::base_url(); $cookie_path = $cookie_path ? $cookie_path : '/'; header(sprintf('Set-Cookie: %s=%s; path=%s; httpOnly;', $this->_sess_key, $this->_sess_id, $cookie_path), true); unset($this->_sess_id); return true; } else { return false; } }
public final function display_tmpl($tmpl, $fetch = false, $is_preview = false) { vmc::singleton('site_theme_install')->monitor_change($this->get_theme()); array_unshift($this->_files, $this->get_theme() . '/' . $tmpl); $this->_vars = $this->pagedata; $this->_vars['base_url'] = vmc::base_url(true); $this->_vars['site_theme_url'] = vmc::get_themes_host_url() . '/' . $this->get_theme(); //title description $title = $this->title ? $this->title : app::get('site')->getConf('site_name', app::get('site')->getConf('page_default_title')); $keywords = $this->keywords ? $this->keywords : app::get('site')->getConf('page_default_keywords', $title); $description = $this->description ? $this->description : app::get('site')->getConf('page_default_description', $title); $this->pagedata = array_merge($this->pagedata, array('title' => htmlspecialchars($title), 'keywords' => htmlspecialchars($keywords), 'description' => htmlspecialchars($description))); $this->_vars = array_merge($this->_vars, array('title' => htmlspecialchars($title), 'keywords' => htmlspecialchars($keywords), 'description' => htmlspecialchars($description))); $tmpl_file = realpath(vmc::get_themes_root_dir() . '/' . $this->get_theme() . '/' . $tmpl); if (!$tmpl_file) { $tmpl_file = realpath(vmc::get_themes_root_dir() . '/' . $this->get_theme() . '/default.html'); if (!$tmpl_file) { $unexists_path = vmc::get_themes_root_dir() . '/' . $this->get_theme() . '/' . $tmpl; setcookie('CURRENT_THEME', '', time() - 1000, '/'); unset($_COOKIE['CURRENT_THEME']); setcookie('CURRENT_THEME_M', '', time() - 1000, '/'); unset($_COOKIE['CURRENT_THEME_M']); setcookie('THEME_DIR', '', time() - 1000, '/'); unset($_COOKIE['THEME_DIR']); setcookie('THEME_M_DIR', '', time() - 1000, '/'); unset($_COOKIE['THEME_M_DIR']); trigger_error('File not exists [' . $unexists_path . ']', E_USER_ERROR); } } $tmpl_content = file_get_contents($tmpl_file); $compile_code = $this->_compiler()->compile($tmpl_content); if ($compile_code !== false) { $compile_code = $this->fix_statics_dir($compile_code); } $theme_url = vmc::get_themes_host_url(); ob_start(); eval('?>' . $compile_code); $content = ob_get_contents(); ob_end_clean(); array_shift($this->_files); $this->pre_display($content); if ($fetch === true) { return $content; } else { echo $content; } }
public function __construct($app) { header('Cache-Control:no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // 强制查询etag header('Progma: no-cache'); if (app::get('base')->getConf('shell_base_url') != vmc::base_url(1)) { app::get('base')->setConf('shell_base_url', vmc::base_url(1)); } $this->fix_location(); $this->defaultwg = $this->defaultWorkground; parent::__construct($app); vmc::singleton('base_session')->start(); if ($_COOKIE['autologin'] > 0) { vmc::singleton('base_session')->set_sess_expires($_COOKIE['autologin']); } //如果有自动登录,设置session过期时间,单位:分 $auth = pam_auth::instance(pam_account::get_account_type('desktop')); $account = $auth->account(); if (get_class($this) != 'desktop_ctl_passport' && !$account->is_valid()) { if (get_class($this) != 'desktop_ctl_default') { $url = app::get('desktop')->router()->gen_url($_GET, 1); } else { $url = app::get('desktop')->router()->gen_url(array(), 1); } $url = base64_encode($url); $_SESSION['passport_redirect_url'] = $url; echo "<script>top.location = '?ctl=passport'</script>"; exit; } $this->user = vmc::singleton('desktop_user'); if ($_GET['ctl'] != 'passport' && $_GET['ctl'] != '') { $this->status = $this->user->get_status(); if (!$this->status && $this->status == 0) { unset($_SESSION['account']); $url = app::get('desktop')->router()->gen_url(array(), 1); $url = base64_encode($url); $_SESSION['passport_redirect_url'] = $url; header('Content-Type:text/html; charset=utf-8'); $this->pagedata['link_url'] = '?ctl=passport'; echo $this->fetch('auth_error.html'); exit; } } ###如果不是超级管理员就查询操作权限 if (!$this->user->is_super()) { if (!$this->user->chkground()) { echo $this->fetch('auth_error.html'); exit; } } $this->_finish_modifier = array(); foreach (vmc::servicelist(sprintf('desktop_controller_content.%s.%s.%s', $_GET['app'], $_GET['ctl'], $_GET['act'])) as $class_name => $service) { if ($service instanceof desktop_interface_controller_content) { if (method_exists($service, 'modify')) { $this->_finish_modifier[$class_name] = $service; } if (method_exists($service, 'boot')) { $service->boot($this); } } } //修改tab detail 里的内容 foreach (vmc::servicelist(sprintf('desktop_controller_content_finderdetail.%s.%s.%s.%s', $_GET['app'], $_GET['ctl'], $_GET['act'], (string) (isset($_GET['finderview']) ? $_GET['finderview'] : '0'))) as $class_name => $service) { if ($service instanceof desktop_interface_controller_content) { if (method_exists($service, 'modify')) { $this->_finish_modifier[$class_name] = $service; } if (method_exists($service, 'boot')) { $service->boot($this); } } } if ($this->_finish_modifier) { ob_start(); register_shutdown_function(array(&$this, 'finish_modifier')); } $this->url = 'index.php?app=' . $this->app->app_id . '&ctl=' . $_GET['ctl']; foreach (vmc::servicelist('desktop_controller_destruct') as $service) { if (is_object($service) && method_exists($service, 'construct')) { $service->construct(); } } }
function get_full_file_url($theme, $file_content, $open_path, $file_name) { return vmc::base_url(1) . rtrim(str_replace('//', '/', '/themes_m/' . $theme . '/' . str_replace(array('-', '.'), array('/', '/'), $open_path) . '/' . $file_name)); }
public final function display_tmpl($tmpl, $fetch = false, $is_preview = false) { vmc::singleton('site_theme_install')->monitor_change($this->get_theme()); array_unshift($this->_files, $this->get_theme() . '/' . $tmpl); $this->_vars = $this->pagedata; $this->_vars['base_url'] = vmc::base_url(true); $this->_vars['site_theme_url'] = $this->_vars['base_url'] . '/' . $this->get_theme(); //title description $title = $this->title ? $this->title : app::get('site')->getConf('site_name', app::get('site')->getConf('page_default_title')); $keywords = $this->keywords ? $this->keywords : app::get('site')->getConf('page_default_keywords', $title); $description = $this->description ? $this->description : app::get('site')->getConf('page_default_description', $title); $this->_vars = array_merge($this->_vars, array('title' => htmlspecialchars($this->title), 'keywords' => htmlspecialchars($keywords), 'description' => htmlspecialchars($description))); $tmpl_file = realpath(THEME_DIR . '/' . $this->get_theme() . '/' . $tmpl); if (!$tmpl_file) { $tmpl = 'default.html'; } $tmpl_content = vmc::singleton('site_theme_file')->get_tmpl_content($this->get_theme(), $tmpl); $compile_code = $this->_compiler()->compile($tmpl_content); if ($compile_code !== false) { $compile_code = $this->fix_statics_dir($compile_code); } $theme_url = vmc::get_themes_host_url(); ob_start(); eval('?>' . $compile_code); $content = ob_get_contents(); ob_end_clean(); array_shift($this->_files); $this->pre_display($content); if ($fetch === true) { return $content; } else { echo $content; } }
public function modifier_custom_url($col) { return vmc::base_url(true) . '/' . $col; }
public function unset_seller() { $auth = pam_auth::instance(pam_account::get_account_type('seller')); foreach (vmc::servicelist('passport') as $k => $passport) { $passport->loginout($auth); } $this->app->seller_id = 0; vmc::singleton('base_session')->set_cookie_expires(0); $this->cookie_path = vmc::base_url() . '/'; $this->set_cookie('UNAME', '', time() - 3600); //用户名 $this->set_cookie('SELLER_IDENT', 0, time() - 3600); //会员ID foreach (vmc::servicelist('seller.logout_after') as $service) { $service->logout(); } }
/** * 浏览历史. */ public function history($gid = flase) { $exits_gv_history = $_COOKIE['goods_view_history']; $exits_gv_history = explode('G', $exits_gv_history); if ($gid) { $exits_gv_history = $exits_gv_history ? $exits_gv_history : array(); array_unshift($exits_gv_history, $gid); $exits_gv_history = array_unique($exits_gv_history); $exits_gv_history = array_slice($exits_gv_history, 0, 20); //限制20个 return setcookie('goods_view_history', implode('G', $exits_gv_history), time() + 315360000, vmc::base_url() . '/'); } $glist = app::get('b2c')->model('goods')->getList('goods_id,gid,name,type_id,cat_id,brand_id,brief,image_default_id,spec_desc', array('goods_id' => $exits_gv_history)); //数据包装 vmc::singleton('b2c_goods_stage')->gallery($glist); $this->success(array_values($glist)); }
/** * 顾客留言 * @params string order id * @return null */ public function detail_msg($order_id) { $render = $this->app->render(); $order = $this->app->model('archive_orders'); $objMath = vmc::singleton("ectools_math"); $oMsg = vmc::singleton("b2c_message_order"); $orderMsg = $oMsg->getList('*', array('order_id' => $order_id, 'object_type' => 'order'), $offset = 0, $limit = -1, 'time DESC'); //bugfix 0029929 change adm_read_status by danny $obj_member_comments = $this->app->model('member_comments'); $obj_member_comments->update(array('adm_read_status' => 'true'), array('object_type' => 'order', 'order_id' => $order_id, 'adm_read_status' => 'false')); //$oMsg->sethasreaded($orderid); //$aItems = $order->getItemList($orderid); $subsdf = array('order_objects' => array('*', array('order_items' => array('*', array(':products' => '*'))))); $sdf_order = $order->dump($order_id, '*', $subsdf); $order_items = array(); $gift_items = array(); $extend_items = array(); $this->get_goods_detail($sdf_order, $order_items, $gift_items, $extend_items, 'admin_detail_msg'); $render->pagedata['status'] = $sdf_order['status']; $render->pagedata['ordermsg'] = $orderMsg; $render->pagedata['goodsItems'] = $order_items; $render->pagedata['giftsItems'] = $gift_items; $render->pagedata['extends_items'] = $extend_items; $render->pagedata['orderid'] = $order_id; $render->pagedata['base_url'] = vmc::base_url(); return $render->fetch('admin/order/od_msg.html', $this->app->app_id); }
public function app_console() { $this->pagedata['base_url'] = vmc::base_url(); $this->display('appmgr/console.html'); }
/** * Check url to be used as internal. * * @param string $url * * @return bool */ public static function _isInternalUrl($url) { if (strpos($url, 'http') !== false) { // Url must start from base url if (strpos($url, vmc::base_url(1)) === 0) { return true; } } return false; }