Ejemplo n.º 1
0
 function delete()
 {
     $this->begin();
     base_certificate::del_certificate();
     base_certificate::register();
     $this->end();
 }
Ejemplo n.º 2
0
 /**
  *     ocs :
  *     $method = 'active.do_active'
  *     $ac = 'SHOPEX_ACTIVE'
  *
  *     其它产品默认
  */
 function check_code($code = null, $method = 'oem.do_active', $ac = 'SHOPEX_OEM')
 {
     if (!$code) {
         return false;
     }
     $certificate_id = base_certificate::certi_id();
     if (!$certificate_id) {
         base_certificate::register();
     }
     $certificate_id = base_certificate::certi_id();
     $token = base_certificate::token();
     $data = array('certi_app' => $method, 'certificate_id' => $certificate_id, 'active_key' => $_POST['auth_code'], 'ac' => md5($certificate_id . $ac));
     $result = kernel::single('base_httpclient')->post(LICENSE_CENTER_INFO, $data);
     $result = json_decode($result, true);
     return $result;
 }
Ejemplo n.º 3
0
 function index()
 {
     //如果没有请求到证书,可以重新请求
     if (!base_certificate::certi_id() || !base_certificate::token()) {
         base_certificate::register();
     }
     if (!base_shopnode::node_id() && base_certificate::certi_id() && base_certificate::token()) {
         $obj_buildin = kernel::single('base_shell_buildin');
         $obj_buildin->command_active_node_id('ceti_node_id');
     }
     $this->pagedata['tip'] = base_application_tips::tip();
     //设置shell_base_url
     if (app::get('base')->getConf('shell_base_url') !== kernel::base_url(1)) {
         app::get('base')->setConf('shell_base_url', kernel::base_url(1));
     }
     $user = kernel::single('desktop_user');
     $is_super = $user->is_super();
     $group = $user->group();
     $group = (array) $group;
     //桌面挂件排序,用户自定义
     $layout_map = array('t-1' => 'top', 'l-1' => 'left', 'l-2' => 'right', 'b-1' => 'bottom');
     foreach (kernel::servicelist('desktop.widgets') as $key => $obj) {
         if ($is_super || in_array(get_class($obj), $group)) {
             $class_full_name = get_class($obj);
             $key = $obj->get_width();
             $item = array('title' => $obj->get_title(), 'html' => $obj->get_html(), 'width' => $obj->get_width(), 'className' => $obj->get_className(), 'class_full_name' => $class_full_name, 'layout' => $layout);
             $widgets[$key][] = $item;
         }
     }
     foreach ((array) $widgets as $key => $arr) {
         $layout = $layout_map[$key];
         if ($user->get_conf('arr_dashboard_widgets_' . $layout . '_sort', $sort_conf) && $sort_conf) {
             //echo $sort_conf.'<br/><br/>';
             $sort_conf = explode(',', $sort_conf);
             array_multisort($sort_conf, SORT_STRING, $arr);
         }
         $widgets[$key] = $arr;
     }
     $this->pagedata['left'] = $widgets['l-1'];
     $this->pagedata['right'] = $widgets['l-2'];
     $this->pagedata['top'] = $widgets['t-1'];
     $this->pagedata['bottom'] = $widgets['b-1'];
     $deploy = kernel::single('base_xml')->xml2array(file_get_contents(ROOT_DIR . '/config/deploy.xml'), 'base_deploy');
     $this->pagedata['deploy'] = $deploy;
     $this->page('dashboard.html');
 }
Ejemplo n.º 4
0
 function active()
 {
     if ($_GET['ent_id'] && $_GET['ent_ac'] && $_GET['ent_sign'] && $_GET['ent_email']) {
         //判断数据是否是中心过来的
         if (md5($_GET['ent_id'] . $_GET['ent_ac'] . 'ShopEXUser') == $_GET['ent_sign']) {
             //检测企业帐号是否正确
             base_enterprise::set_version();
             base_enterprise::set_token();
             if (!base_enterprise::is_valid('json', $_GET['ent_id'])) {
                 header("Content-type: text/html; charset=utf-8");
                 $active_url = kernel::router()->app->base_url(1) . '/index.php?app=entermembercenter&ctl=register';
                 header('Location:' . $active_url);
                 exit;
             } else {
                 $arr_enterprise = array('ent_id' => $_GET['ent_id'], 'ent_ac' => $_GET['ent_ac'], 'ent_email' => $_GET['ent_email']);
                 base_enterprise::set_enterprise_info($arr_enterprise);
                 if (!base_certificate::certi_id() || !base_certificate::token()) {
                     $flag = base_certificate::register();
                 }
                 if (!$flag) {
                     header("Content-type: text/html; charset=utf-8");
                     $active_url = kernel::router()->app->base_url(1) . '/index.php?app=entermembercenter&ctl=register';
                     header('Location:' . $active_url);
                     exit;
                 }
                 if (!base_shopnode::node_id() && base_certificate::certi_id() && base_certificate::token()) {
                     $obj_buildin = kernel::single('base_shell_buildin');
                     $obj_buildin->command_active_node_id('ceti_node_id');
                 }
             }
         }
     } else {
         header("Content-type: text/html; charset=utf-8");
         $active_url = kernel::router()->app->base_url(1) . '/index.php?app=entermembercenter&ctl=register';
         header('Location:' . $active_url);
         exit;
     }
     $url = kernel::router()->gen_url(array(), 1);
     $url = base64_encode($url);
     $login_html = 'index.php?ctl=passport&act=index&url=' . $url;
     header("Content-type: text/html; charset=utf-8");
     header('Location:' . $login_html);
     exit;
 }
Ejemplo n.º 5
0
 public function success()
 {
     /** 获取证书,企业号的验证 **/
     $active_url = kernel::base_url(1) . '/index.php/entermembercenter/default/active';
     if ($_GET['ent_id'] && $_GET['ent_ac'] && $_GET['ent_sign'] && $_GET['ent_email']) {
         //判断数据是否是中心过来的
         if (md5($_GET['ent_id'] . $_GET['ent_ac'] . 'ShopEXUser') == $_GET['ent_sign']) {
             //检测企业帐号是否正确
             base_enterprise::set_version();
             base_enterprise::set_token();
             if (!base_enterprise::is_valid('json', $_GET['ent_id'])) {
                 header("Content-type: text/html; charset=utf-8");
                 header('Location:' . $active_url);
                 exit;
             } else {
                 $arr_enterprise = array('ent_id' => $_GET['ent_id'], 'ent_ac' => $_GET['ent_ac'], 'ent_email' => $_GET['ent_email']);
                 base_enterprise::set_enterprise_info($arr_enterprise);
                 if (!base_enterprise::ent_id() || !base_enterprise::ent_email() || !base_enterprise::ent_ac()) {
                     header("Content-type: text/html; charset=utf-8");
                     header('Location:' . $active_url);
                     exit;
                 }
                 base_certificate::register();
                 if (base_certificate::certi_id() && base_certificate::token()) {
                     $this->get_active_node_id();
                 }
             }
         } else {
             // 出现异常的情况
             header("Content-type: text/html; charset=utf-8");
             header('Location:' . $active_url);
             exit;
         }
     } else {
         header("Content-type: text/html; charset=utf-8");
         header('Location:' . $active_url);
         exit;
     }
     $success_url = kernel::base_url(1) . '/index.php/setup/default/success';
     header("Content-type: text/html; charset=utf-8");
     header('Location:' . $success_url);
     exit;
 }
Ejemplo n.º 6
0
 function command_active_cetificate($app_id = 'activeceti')
 {
     /** 安装完成后获取证书 **/
     $args = func_get_args();
     $options = $this->get_options();
     $config = base_setup_config::deploy_info();
     if ($options['options']) {
         parse_str($options['options'], $this->shell->input);
     }
     $install_options = array();
     $tmp_arr_options = array();
     foreach ((array) $config['active_ceti']['active_ceti_info'] as $key => $active_data) {
         $install_options[$key] = $active_data;
     }
     if (is_array($install_options) && count($install_options) > 0 && !$this->shell->input[$app_id]) {
         $this->shell->input_option($install_options, $app_id);
     }
     if ($this->shell->input[$app_id]) {
         kernel::log('Active cetificate...');
         $api_data = array('certi_app' => 'ent.reg', 'email' => $this->shell->input[$app_id]['email'], 'password' => $this->shell->input[$app_id]['password'], 'tel' => $this->shell->input[$app_id]['tel'], 'province' => $this->shell->input[$app_id]['province'], 'version' => '1.0', 'format' => 'json');
         ksort($api_data);
         foreach ($api_data as $key => $value) {
             $str .= $value;
         }
         base_enterprise::set_token();
         $api_data['certi_ac'] = md5($str . base_enterprise::$token);
         $http = kernel::single('base_httpclient');
         $http->set_timeout(6);
         $result = $http->post(SHOP_USER_ENTERPRISE_API, $api_data);
         $tmp_res = json_decode($result, 1);
         if ($tmp_res['res'] == 'succ') {
             $arr_enterprise = array('ent_id' => $tmp_res['msg']['entid'], 'ent_ac' => $tmp_res['msg']['password'], 'ent_email' => $tmp_res['msg']['email']);
             base_enterprise::set_enterprise_info($arr_enterprise);
             // 申请证书
             if (base_enterprise::ent_id() && base_enterprise::ent_ac() && base_enterprise::ent_email()) {
                 base_certificate::register();
                 // 申请应用的节点
                 $this->command_active_node_id('ceti_node_id');
             }
             kernel::log('Application active cetificate... ok.');
         } else {
             kernel::log('Application active cetificate... failed.');
         }
     }
 }