Example #1
0
 public function function_wapfooter($params, &$smarty)
 {
     $footers = $smarty->pagedata['footers'];
     if (is_array($footers)) {
         foreach ($footers as $footer) {
             $html .= $footer;
         }
     } else {
         $html .= $footers;
     }
     $html .= app::get('wap')->getConf('wap.foot_edit');
     $obj = kernel::service('site_footer_copyright');
     if (is_object($obj) && method_exists($obj, 'get')) {
         $html .= $obj->get();
     } else {
         if (!defined('WITHOUT_POWERED') || !constant('WITHOUT_POWERED')) {
             $html .= ecos_cactus('wap', 'wapcopyr', $html);
         }
     }
     if (isset($_COOKIE['wap']['preview']) && $_COOKIE['wap']['preview'] == 'true') {
         $base_dir = kernel::base_url();
         $remove_cookie = "\$.fn.cookie('wap[preview]','',{path:'" . $base_dir . "/'});\$(document.body).removeClass('set-margin-body');";
         $set_window = '$("body").addClass("set-margin-body");moveTo(0,0);resizeTo(screen.availWidth,screen.availHeight);';
         $html .= '<style>body.set-margin-body{margin-top:36px;}#_theme_preview_tip_ {width:100%; position: absolute; left: 0; top: 0; background: #FCE2BC; height: 25px; line-height: 25px; padding: 5px 0; border-bottom: 1px solid #FF9900;box-shadow: 0 2px 5px #CCCCCC; }#_theme_preview_tip_ span.msg { float: left; _display: inline;zoom:1;line-height: 25px;margin-left:10px;padding:0; }#_theme_preview_tip_ a.btn {vertical-align:middle; color:#333;float: right; margin:0 10px; }</style><div id="_theme_preview_tip_"><span class="msg">' . app::get('site')->_('目前正在预览模式') . '</span><a href="javascript:void(0);" class="btn" onclick="' . $remove_cookie . 'location.reload();"><span><span>' . app::get('site')->_('退出预览') . '</span></span></a></div>';
         $html .= '<script>' . $set_window . '$(window).on("unload",function(){' . $remove_cookie . '});</script>';
     }
     $html .= $smarty->fetch('footer.html', app::get('wap')->app_id);
     $icp = app::get('site')->getConf('system.site_icp');
     if ($icp) {
         $html .= '<div style="text-align: center;">' . $icp . '</div>';
     }
     return $html;
 }
Example #2
0
 public function add_source_page()
 {
     $theme = input::get('theme');
     if (!$this->check($theme, $msg)) {
         return $this->_error($msg);
     }
     $pagedata['theme'] = $theme;
     $pagedata['type'] = input::get('type');
     $pagedata['types'] = kernel::single('site_theme_tmpl')->get_name($this->platform);
     $pagedata['content'] = ecos_cactus('site', 'theme_get_source_code', $theme, $pagedata['type']);
     return view::make('site/admin/theme/tmpl/add_resource.html', $pagedata);
 }
Example #3
0
 public function editor($widgets, $widgets_app, $widgets_theme, $theme, $values = false)
 {
     $return = array();
     $widgets_config = $this->widgets_config($widgets, $widgets_app, $widgets_theme);
     $widgets_dir = $widgets_config['dir'];
     $setting = $this->widgets_info($widgets, $widgets_app, $widgets_theme);
     is_array($values) or $values = array();
     $values = array_merge($setting, $values);
     if (!empty($setting['template'])) {
         if (!is_array($setting['template'])) {
             $setting['template'] = array($setting['template'] => 'DEFAULT');
         }
         $return['tpls'][$file] = $setting['template'];
     } else {
         if ($widgets == 'html') {
             $widgets = 'usercustom';
             if (!$values['usercustom']) {
                 $values['usercustom'] = $values['html'];
             }
         }
         if ($handle = opendir($widgets_dir)) {
             while (false !== ($file = readdir($handle))) {
                 if (substr($file, 0, 1) != '_' && strtolower(substr($file, -5)) == '.html' && file_exists($widgets_dir . '/' . $file)) {
                     $return['tpls'][$file] = $file;
                 }
             }
             closedir($handle);
         } else {
             return false;
         }
     }
     $cur_theme = $theme;
     try {
         $isFind = true;
         theme::uses($theme);
         $configPath = theme::getThemeNamespace('widgets/' . $widgets . '/_config.html');
         view::getFinder()->find($configPath);
     } catch (\InvalidArgumentException $e) {
         $isFind = false;
     }
     if ($isFind) {
         $sFunc = $widgets_config['crun'];
         $sFuncFile = $widgets_config['cfg'];
         if (file_exists($sFuncFile)) {
             include_once $sFuncFile;
             if (function_exists($sFunc)) {
                 $pagedata['data'] = $sFunc($widgets_config['app']);
             }
         }
         $pagedata['setting'] =& $values;
         //$compile_code = $smarty->fetch_admin_widget($widgets_dir.'/_config.html',$widgets_app);
         $compile_code = view::make($configPath, $pagedata)->render();
         if ($compile_code) {
             $compile_code = ecos_cactus('site', 'theme_widget_prefix_content', $compile_code, $widgets_config['url']);
         }
         $return['html'] = $compile_code;
     }
     return $return;
 }
Example #4
0
 public function get_view($theme)
 {
     return ecos_cactus('site', 'theme_get_view', $theme);
 }
Example #5
0
    function getFinderScriptHtml()
    {
        $finderOptions = array('selectName' => $this->dbschema['idColumn'] . '[]', 'object_name' => $this->object_name, 'finder_aliasname' => $this->finder_aliasname, 'packet' => $this->getViews() ? true : false);
        $finderOptions = ecos_cactus('desktop', 'finder_builder_view_script_gen_finderoptions', $this->getViews(), $this->options, $finderOptions);
        return <<<EOF
<script>
Ex_Loader('finder',function(){
 finderDestory();
 var finderOption={$finderOptions};
 {$this->var_name} = new Finder("{$this->name}",finderOption);
 });
</script>
EOF;
    }
Example #6
0
    public function function_wapfooter($params, $template)
    {
        $services = kernel::servicelist("site_view_helper");
        foreach ($services as $service) {
            if (method_exists($service, 'function_wapfooter')) {
                $html .= $service->function_wapfooter($params);
            }
        }
        // $html .= app::get('site')->getConf('system.foot_edit');
        $obj = kernel::service('site_footer_copyright');
        if (is_object($obj) && method_exists($obj, 'get')) {
            $html .= $obj->get();
        } else {
            if (!defined('WITHOUT_POWERED') || !constant('WITHOUT_POWERED')) {
                $html .= ecos_cactus('site', 'copyr', $html);
            }
        }
        if (isset($_COOKIE['site']['preview']) && $_COOKIE['site']['preview'] == 'true') {
            $base_dir = kernel::base_url();
            $remove_cookie = "\$.cookie.raw = true; \$.removeCookie('site[preview]',{path:'" . $base_dir . "/'});";
            $set_window = '$(document.body).addClass("set-margin-body");
moveTo(0,0);
resizeTo(screen.availWidth,screen.availHeight);';
            $html .= '<style>
.set-margin-body{margin-top:36px;}#_theme_preview_tip_{width:100%;position:absolute;left:0;top:0;background:#FCE2BC;height:25px;line-height: 25px;padding:5px 0;border-bottom:1px solid #FF9900;box-shadow:0 2px 5px #CCCCCC;}#_theme_preview_tip_ span.msg{float:left;_display:inline;zoom:1;line-height:25px;margin-left:10px;color:#333;}#_theme_preview_tip_ button.btn{vertical-align:middle;color:#333;display:block;float:right;margin:0 10px;}
</style>
<div id="_theme_preview_tip_">
  <span class="msg">' . app::get('site')->_('目前正在预览模式') . '</span>
  <button class="btn" onclick="' . $remove_cookie . 'this.disabled=true;location.reload();"><span><span>' . app::get('site')->_('退出预览') . '</span></span></button>
</div>
<script>' . $set_window . '$(window).on("unload",function(){' . $remove_cookie . '});</script>';
        }
        $icp = app::get('site')->getConf('system.site_icp');
        if ($icp) {
            $html .= '<div style="text-align: center;">' . $icp . '</div>';
        }
        return $html;
    }
Example #7
0
 private function get_theme_dir($theme, $open_path = '')
 {
     return ecos_cactus('site', 'theme_get_theme_dir', $theme, $open_path);
 }
Example #8
0
 function get_source_code($theme, $tmpl_type)
 {
     return ecos_cactus('site', 'theme_get_source_code', $theme, $tmpl_type);
 }
Example #9
0
 protected function _get_args()
 {
     return ecos_cactus('desktop', 'finder_get_args', $_GET);
 }
Example #10
0
 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')->_('管理后台');
     }
     $title = ecos_cactus('desktop', 'check_demosite', $title);
     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/?sess_id=" . urlencode($this->pagedata['session_id']) . "&certi_id=" . urlencode($this->Certi) . "&version=ecstore&confirmkey=" . urlencode($confirmkey) . "&_key_=do";
     $commerce_class = kernel::single('system_commerce');
     if ($commerce_class->get_commerce_version()) {
         $this->pagedata['commerce_b2c'] = true;
     }
     return view::make('desktop/index.html', $this->pagedata);
 }
Example #11
0
    function _script()
    {
        $finderOptions = array('selectName' => $this->dbschema['idColumn'] . '[]', 'object_name' => $this->object_name, 'finder_aliasname' => $this->finder_aliasname, 'packet' => $this->__view ? true : false);
        $finderOptions = ecos_cactus('desktop', 'finder_builder_view_script_gen_finderoptions', $this->__view, $this->options, $finderOptions);
        $this->html_script .= <<<EOF
<script>
Ex_Loader('finder',function(){
 finderDestory();
 var finderOption={$finderOptions};
 {$this->var_name} = new Finder("{$this->name}",finderOption);
EOF;
        $this->html_script .= '});</script>';
    }
Example #12
0
 public function editor($widgets, $widgets_app, $widgets_theme, $theme, $values = false)
 {
     $return = array();
     $widgets_config = $this->widgets_config($widgets, $widgets_app, $widgets_theme);
     $widgets_dir = $widgets_config['dir'];
     $setting = $this->widgets_info($widgets, $widgets_app, $widgets_theme);
     if (ECAE_MODE) {
         if (!empty($setting['template'])) {
             if (!is_array($setting['template'])) {
                 $setting['template'] = array($setting['template'] => 'DEFAULT');
             }
             $return['tpls'][$file] = $setting['template'];
         } else {
             if ($widgets == 'html') {
                 $widgets = 'usercustom';
                 if (!$values['usercustom']) {
                     $values['usercustom'] = $values['html'];
                 }
             }
             if ($widgets_app) {
                 // $objfile = app::get('site')->model('widgets_file');
                 // $files = $objfile->getList('filename,filetype',array('app'=>$widgets_app),0,-1);
                 if ($handle = opendir($widgets_dir)) {
                     while (false !== ($file = readdir($handle))) {
                         if (substr($file, 0, 1) != '_' && strtolower(substr($file, -5)) == '.html' && file_exists($widgets_dir . '/' . $file)) {
                             $return['tpls'][$file] = $file;
                         }
                     }
                     closedir($handle);
                 } else {
                     return false;
                 }
             } elseif ($theme) {
                 $objfile = app::get('site')->model('themes_file');
                 $files = $objfile->getList('filename,filetype', array('theme' => $theme), 0, -1);
                 foreach ($files as $file) {
                     if (substr($file, 0, 1) != '_' && strtolower(substr($file, -5)) == '.html') {
                         $return['tpls'][$file] = $file;
                     }
                 }
             }
         }
         is_array($values) or $values = array();
         $values = array_merge($setting, $values);
     } else {
         is_array($values) or $values = array();
         $values = array_merge($setting, $values);
         if (!empty($setting['template'])) {
             if (!is_array($setting['template'])) {
                 $setting['template'] = array($setting['template'] => 'DEFAULT');
             }
             $return['tpls'][$file] = $setting['template'];
         } else {
             if ($widgets == 'html') {
                 $widgets = 'usercustom';
                 if (!$values['usercustom']) {
                     $values['usercustom'] = $values['html'];
                 }
             }
             if ($handle = opendir($widgets_dir)) {
                 while (false !== ($file = readdir($handle))) {
                     if (substr($file, 0, 1) != '_' && strtolower(substr($file, -5)) == '.html' && file_exists($widgets_dir . '/' . $file)) {
                         $return['tpls'][$file] = $file;
                     }
                 }
                 closedir($handle);
             } else {
                 return false;
             }
         }
     }
     $return['borders'] = kernel::single('site_theme_base')->get_theme_borders($theme);
     $return['borders']['__none__'] = app::get('site')->_('无边框');
     $cur_theme = $theme;
     if (file_exists($widgets_dir . '/_config.html') || ECAE_MODE) {
         $smarty = kernel::single('site_admin_render');
         $smarty->tmpl_cachekey('widget_modifty', true);
         $sFunc = $widgets_config['crun'];
         $sFuncFile = $widgets_config['cfg'];
         if (file_exists($sFuncFile) || ECAE_MODE) {
             if (ECAE_MODE) {
                 // $tmpl = substr($sFuncFile,strpos($sFuncFile,'/widgets/')+1);
                 if ($widgets_app) {
                     // $widgets_file = app::get('site')->model('widgets_file');
                     // $file_row = $widgets_file->getList('content',array('fileuri'=>$widgets_app.':'.$tmpl,'app'=>$widgets_app),0,1);
                     include_once $sFuncFile;
                 } elseif ($cur_theme) {
                     $tmpl = substr($sFuncFile, strpos($sFuncFile, '/widgets/') + 1);
                     $theme_file = app::get('site')->model('themes_file');
                     $file_row = $theme_file->getList('content', array('fileuri' => $cur_theme . ':' . $tmpl, 'theme' => $cur_theme), 0, 1);
                     eval('?>' . $file_row[0]['content']);
                 }
             } else {
                 include_once $sFuncFile;
             }
             if (function_exists($sFunc)) {
                 $smarty->pagedata['data'] = $sFunc($widgets_config['app']);
             }
         }
         $smarty->pagedata['setting'] =& $values;
         $compile_code = $smarty->fetch_admin_widget($widgets_dir . '/_config.html', $widgets_app);
         if ($compile_code) {
             $compile_code = ecos_cactus('site', 'theme_widget_prefix_content', $compile_code, $widgets_config['url']);
         }
         $return['html'] = $compile_code;
     }
     return $return;
 }