Beispiel #1
0
 public function pre_ceti_use()
 {
     if (!base_certificate::certi_id() || !base_certificate::token()) {
         return false;
     }
     return true;
 }
Beispiel #2
0
 function command_show()
 {
     $token = base_certificate::token();
     echo $token . "\n";
     //        parse_str("direct=true&method=b2c.payment.create&order_bn=20101026134778&money=12&cur_money=12&pay_type=online&payment_tid=1&paymethod=abc&t_gegin=10&t_end=20&ip=127.0.0.1&trade_no=123", $request);
     //        echo base_certificate::gen_sign($request) . "\n";
 }
Beispiel #3
0
 /**
  * 췽
  * @params object app object
  * @return null
  */
 public function __construct($app)
 {
     parent::__construct($app);
     header("cache-control: no-store, no-cache, must-revalidate");
     $this->certi_id = base_certificate::certi_id();
     $this->token = base_certificate::token();
 }
Beispiel #4
0
 static function send_to_center($app_id, $data = null, $method = 'node.reg')
 {
     $app_info = app::get($app_id)->define();
     $obj_app = app::get($app_id);
     // 生成参数...
     $api_data = array('certi_app' => $method, 'certificate_id' => base_certificate::certi_id(), 'node_type' => 'ecos.' . $app_id, 'url' => kernel::base_url(true), 'version' => $app_info['version'], 'channel_ver' => $app_info['api_ver'], 'api_ver' => '1.2', 'format' => 'json', 'api_url' => kernel::base_url(1) . kernel::url_prefix() . '/api');
     //更新时,多带个参数
     if ($method == 'node.update') {
         $api_data['node_id'] = base_shopnode::node_id($app_id);
     }
     ksort($api_data);
     foreach ($api_data as $key => $value) {
         $str .= $value;
     }
     $api_data['certi_ac'] = strtoupper(md5($str . base_certificate::token()));
     $http = kernel::single('base_httpclient');
     $http->set_timeout(6);
     $result = $http->post(LICENSE_CENTER_V, $api_data);
     $result = json_decode($result, true);
     if ($result['res'] == 'succ') {
         return self::set_node_id($result['info'], $app_id);
     } else {
         return false;
     }
 }
Beispiel #5
0
 /**
  * 转给接口ac验证用
  * @param array 需要验证的参数
  * @return string 结构sign
  */
 static function gen_sign_ac($params = array())
 {
     if ($params) {
         $sign = self::assemble_params_ac($params);
         return strtoupper(md5($sign . base_certificate::token()));
     }
     return '';
 }
Beispiel #6
0
 /**
  * 获取桌面widgets的html内容
  * @param null
  * @return string html内容
  */
 public function get_html()
 {
     $render = $this->render;
     $render->pagedata['page_url'] = SHOPEX_STAT_WEBURL;
     $render->pagedata['certi_id'] = base_certificate::certi_id();
     $render->pagedata['sign'] = md5($render->pagedata['certi_id'] . base_certificate::token());
     return $render->fetch('desktop/widgets/exstatistics.html');
 }
Beispiel #7
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;
 }
Beispiel #8
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');
 }
Beispiel #9
0
 /**
  * 获取桌面widgets的html内容
  * @param null
  * @return string html内容
  */
 public function get_html()
 {
     $render = $this->render;
     $render->pagedata['page_url'] = SHOPEX_STAT_WEBURL;
     $render->pagedata['certi_id'] = base_certificate::certi_id();
     $render->pagedata['sign'] = md5($render->pagedata['certi_id'] . base_certificate::token());
     $render->pagedata['stats_url'] = 'http://stats.shopex.cn/index.php';
     $render->pagedata['callback_url'] = urlencode('http://' . base_request::get_host() . app::get('site')->router()->gen_url(array('app' => 'stats', 'ctl' => 'site_openstats', 'act' => 'index')));
     $is_open = $this->app->getConf('site.stats.is_open');
     if ($is_open) {
         // 取到生意经的授权
         return $render->fetch('desktop/widgets/exstatistics.html');
     } else {
         // 显示激活页面
         return $render->fetch('desktop/widgets/activation.html');
     }
 }
Beispiel #10
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;
 }
Beispiel #11
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;
 }
Beispiel #12
0
 public function sign_data()
 {
     $query_params = array('direct' => 'true', 'date' => date('Y-m-d H:m:s', time()));
     unset($_POST['sign']);
     $params = array_merge($query_params, $_POST);
     //     	print_r($params);
     $token = base_certificate::token();
     $query_params['sign'] = $sign = $this->get_sign($params, $token);
     $sign_string = "";
     foreach ($params as $key => $value) {
         if (is_array($value)) {
             foreach ($value as $k => $v) {
                 $sign_string .= $key . '[' . $k . ']=' . $v . '&';
             }
         } else {
             $sign_string .= $key . '=' . $value . '&';
         }
     }
     exit($sign_string . 'sign=' . $query_params['sign']);
 }
Beispiel #13
0
 public function index()
 {
     if (!$this->token) {
         $this->begin('index.php?app=desktop&ctl=default&act=workground&wg=b2c.wrokground.sale');
         $this->end(false, app::get('stats')->_('LICENSE错误!'));
     }
     $sign = md5($this->certi_id . $this->token);
     $shoex_stat_webUrl = SHOPEX_STAT_WEBURL . "?site_id=" . $this->certi_id . "&sign=" . $sign . "&innerdesktop=true";
     $this->pagedata['shoex_stat_webUrl'] = $shoex_stat_webUrl;
     $this->pagedata['certi_id'] = base_certificate::certi_id();
     $this->pagedata['sign'] = md5($this->pagedata['certi_id'] . base_certificate::token());
     $this->pagedata['stats_url'] = SHOPEX_STAT_WEBURL;
     $this->pagedata['callback_url'] = urlencode('http://' . base_request::get_host() . app::get('site')->router()->gen_url(array('app' => 'stats', 'ctl' => 'site_openstats', 'act' => 'index')));
     $is_open = $this->app->getConf('site.stats.is_open');
     if ($is_open) {
         // 显示生意经统计页面
         $this->page('admin/bussiness/index.html');
     } else {
         // 显示激活页面
         $this->page('admin/bussiness/activation.html');
     }
 }
Beispiel #14
0
 function test_api()
 {
     $str = "不是21-P,sdf";
     $pmatch = preg_match("/.*?(\\d+)P.*/i", $str, $matches);
     echo $pmatch;
     print_r($matches);
     exit;
     $certi = base_certificate::get('certificate_id');
     $app_id = 'b2c';
     $_node_token = base_shopnode::get('token', $app_id);
     $token = base_certificate::token();
     /*
     $params=array(
     		'V'=>1.0,
     		'Method'=>'b2c.order.detail',
     		'app_id'=>$app_id,
     		'Date'=>'2014-02-26 17:16:30',
     		'certi_id'=>$app_id,
     		'node_id'=>$node_id,
     );
     */
     $headers = array('Connection' => 'Close');
     $query_params = array('method' => 'diyapi.hello.get_hello', 'date' => date('Y-m-d H:m:s', time()), 'direct' => 'true');
     $query_params['sign'] = $sign = $this->get_sign($query_params, $token);
     $core_http = kernel::single('base_httpclient');
     $response = $core_http->set_timeout(6)->post('http://vip.hcyy.cn/index.php/api', $query_params, $headers);
     //$result = json_decode($response,true);
     print_r($response);
     echo "==============custom====== 00 999 ";
     print_r($query_params);
     echo "certi = " . $certi . ' ####### token=' . $token . '++++++' . $sign . '====== app_node_token=' . $_node_token;
     exit;
     echo kernel::single('system_request')->gen_sign($params, $token);
     $this->pagedata['project_name'] = $params;
     $this->display('default_api.html');
 }
Beispiel #15
0
 private function get_sign($params)
 {
     return strtoupper(md5(strtoupper(md5($this->assemble($params))) . base_certificate::token()));
 }