コード例 #1
0
ファイル: enterprise.php プロジェクト: syjzwjj/quyeba
 function upLicense()
 {
     if ($_FILES) {
         if ($_FILES['enterprise']['name']) {
             $fileName = explode('.', $_FILES['enterprise']['name']);
             if ('CER' != $fileName['1']) {
                 echo "<script>parent.MessageBox.error('" . app::get('entermembercenter')->_('"企业帐号格式不对"') . "');</script>";
                 return;
             } else {
                 $content = file_get_contents($_FILES['enterprise']['tmp_name']);
                 list($entid, $ent_ac, $ent_email) = explode('|||', $content);
                 $result = base_enterprise::set_enterprise_info(array('ent_id' => $entid, 'ent_ac' => $ent_ac, 'ent_email' => $ent_email));
                 if (!$result) {
                     header("Content-type:text/html; charset=utf-8");
                     echo "<script>parent.MessageBox.error('" . app::get('entermembercenter')->_('"企业帐号重置失败,请先上传文件"') . "');</script>";
                 } else {
                     // 删除证书和node_id.
                     base_certificate::del_certificate();
                     $obj = kernel::single('base_shell_buildin');
                     $obj->command_inactive_node_id('ceti_node_id');
                     header("Content-type:text/html; charset=utf-8");
                     echo "<script>parent.MessageBox.success('" . app::get('entermembercenter')->_('"企业帐号上传成功"') . "');</script>";
                 }
             }
         } else {
             echo "<script>parent.MessageBox.error('" . app::get('entermembercenter')->_('"请选择要上传的文件"') . "');</script>";
         }
     }
 }
コード例 #2
0
ファイル: register.php プロジェクト: sss201413/ecstore
 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;
 }
コード例 #3
0
ファイル: default.php プロジェクト: syjzwjj/quyeba
 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;
 }
コード例 #4
0
ファイル: cleandata.php プロジェクト: 453111208/bbc
 function clean($type = "clean")
 {
     //清除node_id
     $config = base_setup_config::deploy_info();
     foreach ($config['package']['app'] as $k => $app) {
         $applist[] = $app['id'];
     }
     foreach ($applist as $str_app_id) {
         $app_xml = kernel::single('base_xml')->xml2array(file_get_contents(app::get($str_app_id)->app_dir . '/app.xml'), 'base_app');
         if (isset($app_xml['node_id']) && $app_xml['node_id'] == "true" && base_shopnode::node_id($str_app_id)) {
             // 获取节点.
             base_shopnode::delete_node_id($str_app_id);
         }
     }
     //清除证书
     base_certificate::del_certificate();
     //清除shopex_id
     base_enterprise::set_enterprise_info(null);
 }
コード例 #5
0
ファイル: buildin.php プロジェクト: syjzwjj/quyeba
 function command_recover_shopex_id()
 {
     $args = func_get_args();
     $options = $this->get_options();
     if ($options['backup_dir']) {
         $file_name = $args[1];
         $backup_dir = $args[0];
         $backup_file = $backup_dir . "/" . $file_name . "_shopex_id.log";
         if (is_file($backup_file)) {
             if (!($fp = fopen($backup_file, 'r'))) {
                 echo "Failed to read file";
                 exit;
             }
             $content = fgets($fp);
             list($ent_id, $ent_ac, $ent_email) = explode('|||', $content);
             $data = array('ent_id' => $ent_id, 'ent_ac' => $ent_ac, 'ent_email' => $ent_email);
             $result = base_enterprise::set_enterprise_info($data);
             if (!$result) {
                 echo "failed shopex_id recovery.....";
                 exit;
             } else {
                 base_certificate::del_certificate();
                 $obj = kernel::single('base_shell_buildin');
                 $obj->command_inactive_node_id('ceti_node_id');
                 echo "success of the shopex_id recovery......";
                 exit;
             }
         } else {
             echo "File does not exist......";
             exit;
         }
     } else {
         echo "缺少参数,使用-d 指定已经备份好的shopex_id存放的目录?使用-n指定要恢复的项目名称";
     }
 }
コード例 #6
0
ファイル: buildin.php プロジェクト: sss201413/ecstore
 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]) {
         logger::info('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');
             }
             logger::info('Application active cetificate... ok.');
         } else {
             logger::info('Application active cetificate... failed.');
         }
     }
 }