function index() { $desktop_user = kernel::single('desktop_user'); $menus = $desktop_user->get_work_menu(); $user_id = $this->user->get_id(); $desktop_user->get_conf('fav_menus', $fav_menus); //默认显示5个workground if (!$fav_menus) { $i = 0; foreach ((array) $menus['workground'] as $key => $value) { if ($i++ > 4) { break; } $fav_menus[] = $key; } } $this->pagedata['title'] = $titlename . ' - Powered By ShopEx'; $this->pagedata['session_id'] = kernel::single('base_session')->sess_id(); $this->pagedata['uname'] = $this->user->get_name(); $this->pagedata['param_id'] = $user_id; $this->pagedata['menus'] = $menus; $this->pagedata['fav_menus'] = (array) $fav_menus; $this->pagedata['shop_base'] = kernel::base_url(1); $this->pagedata['shopadmin_dir'] = $_SERVER['REQUEST_URI']; $desktop_user->get_conf('shortcuts_menus', $shortcuts_menus); $this->pagedata['shortcuts_menus'] = (array) $shortcuts_menus; $desktop_menu = array(); foreach (kernel::servicelist('desktop_menu') as $service) { $array = $service->function_menu(); $desktop_menu = is_array($array) ? array_merge($desktop_menu, $array) : array_merge($desktop_menu, array($array)); } $this->pagedata['desktop_menu'] = count($desktop_menu) ? '<span>' . join('</span>|<span>', $desktop_menu) . '</span>' : ''; list($this->pagedata['theme_scripts'], $this->pagedata['theme_css']) = desktop_application_theme::get_files($this->user->get_theme()); $this->openapi(); $this->display('index.html'); }
function index() { $this->_init_keyboard_setting(); $desktop_user = kernel::single('desktop_user'); $menus = $desktop_user->get_work_menu(); $user_id = $this->user->get_id(); $set_config = $desktop_user->get_conf('fav_menus', $fav_menus); //默认显示5个workground $workground_count = app::get('desktop')->getConf('workground.count') ? app::get('desktop')->getConf('workground.count') - 1 : 5; if (!$set_config) { $i = 0; foreach ((array) $menus['workground'] as $key => $value) { //if($i++>$workground_count) break; $fav_menus[] = $key; } } $obj = kernel::service('desktop_index_seo'); if (is_object($obj) && method_exists($obj, 'title')) { $title = $obj->title(); } else { $title = app::get('desktop')->_('管理后台'); } if (is_object($obj) && method_exists($obj, 'title_desc')) { $title_desc = $obj->title_desc(); } else { $title_desc = 'Powered By ShopEx'; } /* 检查本地是否有更新,并触发更新 应用场景:在打补丁包或升级包的时候 TODO:之后考虑在线安装的情况 */ $deploy = kernel::single('base_xml')->xml2array(file_get_contents(ROOT_DIR . '/config/deploy.xml'), 'base_deploy'); $local_has_update = false; if (!($product_version = app::get('base')->getConf('product_version'))) { $local_has_update = true; app::get('base')->setConf('product_version', $deploy['product_version']); } elseif (version_compare($product_version, $deploy['product_version'], '!=')) { $local_has_update = true; app::get('base')->setConf('product_version', $deploy['product_version']); } if ($local_has_update) { $shell_handle = kernel::single('base_shell_loader'); kernel::$console_output = false; $shell_handle->exec_command('update'); } $this->pagedata['title'] = $title; $this->pagedata['title_desc'] = $title_desc; $this->pagedata['session_id'] = kernel::single('base_session')->sess_id(); $this->pagedata['uname'] = $this->user->get_login_name(); $this->pagedata['param_id'] = $user_id; $this->pagedata['menus'] = $menus; $this->pagedata['fav_menus'] = (array) $fav_menus; $this->pagedata['shop_base'] = kernel::base_url(1); $this->pagedata['shopadmin_dir'] = $_SERVER['REQUEST_URI']; $desktop_user->get_conf('shortcuts_menus', $shortcuts_menus); $this->pagedata['shortcuts_menus'] = (array) $shortcuts_menus; $desktop_menu = array(); foreach (kernel::servicelist('desktop_menu') as $service) { $array = $service->function_menu(); $desktop_menu = is_array($array) ? array_merge($desktop_menu, $array) : array_merge($desktop_menu, array($array)); } // 桌面内容替换埋点 foreach (kernel::servicelist('desktop_content') as $services) { if (is_object($services)) { if (method_exists($services, 'changeContent')) { $services->changeContent(app::get('desktop')); $services->changeContent($desktop_menu); } } } $this->pagedata['desktop_menu'] = count($desktop_menu) ? '<span>' . join('</span>|<span>', $desktop_menu) . '</span>' : ''; list($this->pagedata['theme_scripts'], $this->pagedata['theme_css']) = desktop_application_theme::get_files($this->user->get_theme()); $this->Certi = base_certificate::get('certificate_id'); $confirmkey = $this->setEncode($this->pagedata['session_id'], $this->Certi); $this->pagedata['certificate_url'] = "http://key-service.shopex.cn/index.php?sess_id=" . urlencode($this->pagedata['session_id']) . "&certi_id=" . urlencode($this->Certi) . "&version=ecstore&confirmkey=" . urlencode($confirmkey) . "&_key_=do"; $this->display('index.html'); }