Esempio n. 1
0
 function index($method = 'apply', $app_id = 'b2c', &$callback = '', $api_url = '')
 {
     $this->Certi = base_certificate::get('certificate_id');
     $this->Token = base_certificate::get('token');
     $this->Node_id = base_shopnode::node_id($app_id);
     $token = $this->Token;
     $sess_id = kernel::single('base_session')->sess_id();
     $apply['certi_id'] = $this->Certi;
     if ($this->Node_id) {
         $apply['node_idnode_id'] = $this->Node_id;
     }
     $apply['sess_id'] = $sess_id;
     $str = '';
     ksort($apply);
     foreach ($apply as $key => $value) {
         $str .= $value;
     }
     $apply['certi_ac'] = md5($str . $token);
     if ($method == 'apply') {
         if ($apply['node_idnode_id']) {
             $this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=apply&certi_id=' . $apply['certi_id'] . '&node_id=' . $apply['node_idnode_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '" ></iframe>';
         } else {
             $this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=apply&certi_id=' . $apply['certi_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '" ></iframe>';
         }
     } elseif ($method == 'accept') {
         if ($apply['node_idnode_id']) {
             $this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=accept&certi_id=' . $apply['certi_id'] . '&node_id=' . $apply['node_idnode_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '" ></iframe>';
         } else {
             $this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=accept&certi_id=' . $apply['certi_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '" ></iframe>';
         }
     } else {
         $this->pagedata['_PAGE_CONTENT'] = "";
     }
     $this->page();
 }
Esempio n. 2
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();
 }
Esempio n. 3
0
 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>";
         }
     }
 }
Esempio n. 4
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";
 }
Esempio n. 5
0
 public function pre_ceti_use()
 {
     if (!base_certificate::certi_id() || !base_certificate::token()) {
         return false;
     }
     return true;
 }
Esempio n. 6
0
 private function parse_rpc_request($request)
 {
     $sign = $request['sign'];
     unset($request['sign']);
     $sign_check = base_certificate::gen_sign($request);
     if ($sign != $sign_check) {
         trigger_error('sign error', E_USER_ERROR);
         return false;
     }
     $system_params = array('app_id', 'method', 'date', 'format', 'certi_id', 'v', 'sign');
     foreach ($system_params as $name) {
         $call[$name] = $request[$name];
         unset($request[$name]);
     }
     //if method request = 'aaa.bbb.ccc.ddd'
     //then: object_service = api.aaa.bbb.ccc, method=ddd
     if (isset($call['method'][2])) {
         if ($p = strrpos($call['method'], '.')) {
             $service = 'api.' . substr($call['method'], 0, $p);
             $method = substr($call['method'], $p + 1);
         }
     } else {
         trigger_error('error method', E_ERROR);
         return false;
     }
     return array($service, $method, $request);
 }
Esempio n. 7
0
 function index()
 {
     $mobileshop_url = $this->app->getConf('mobileshop.url');
     $mobileshop_token = $this->app->getConf('mobileshop.token');
     if (!empty($mobileshop_url)) {
         $wlshop = app::get('b2c')->model('shop');
         $node_ids = $wlshop->getList('node_id', array('node_type' => 'shopex_wmall', 'status' => 'bind'));
         foreach ($node_ids as $value) {
             if (!empty($value['node_id'])) {
                 $node_id = $value['node_id'];
             }
         }
         $callinfo['node_id'] = $node_id;
         $callinfo['shop_url'] = kernel::base_url(1) . kernel::url_prefix() . "/";
         $callinfo['shop_license'] = base_certificate::get('certificate_id');
         $callinfo['shop_node'] = base_shopnode::node_id('b2c');
         $callinfo['shop_name'] = app::get('site')->getConf('site.name');
         $callinfo['type'] = '1';
         $callinfo['sign'] = $this->get_sign($callinfo, $mobileshop_token);
         $this->pagedata['ifseturl'] = 1;
         $this->pagedata['node_id'] = $callinfo['node_id'];
         $this->pagedata['type'] = $callinfo['type'];
         $this->pagedata['shop_license'] = $callinfo['shop_license'];
         $this->pagedata['shop_node'] = $callinfo['shop_node'];
         $this->pagedata['shop_url'] = $callinfo['shop_url'];
         $this->pagedata['shop_name'] = $callinfo['shop_name'];
         $this->pagedata['sign'] = $callinfo['sign'];
         $this->pagedata['mobileshop_url'] = $mobileshop_url;
     } else {
         $this->pagedata['ifseturl'] = 0;
     }
     $this->page('admin/index.html');
 }
Esempio n. 8
0
 function check_certid()
 {
     $params['certi_app'] = 'open.login';
     $this->Certi = base_certificate::get('certificate_id');
     $this->Token = base_certificate::get('token');
     $params['certificate_id'] = $this->Certi;
     $params['format'] = 'json';
     /** 增加反查参数result和反查基础地址url **/
     $code = md5(microtime());
     base_kvstore::instance('ecos')->store('net.login_handshake', $code);
     $params['result'] = $code;
     $obj_apps = app::get('base')->model('apps');
     $tmp = $obj_apps->getList('*', array('app_id' => 'base'));
     $app_xml = $tmp[0];
     $params['version'] = $app_xml['local_ver'];
     $params['url'] = kernel::base_url(1);
     /** end **/
     $token = $this->Token;
     $str = '';
     ksort($params);
     foreach ($params as $key => $value) {
         $str .= $value;
     }
     $params['certi_ac'] = md5($str . $token);
     $http = kernel::single('base_httpclient');
     $http->set_timeout(20);
     $result = $http->post(LICENSE_CENTER_INFO, $params);
     $api_result = stripslashes($result);
     $api_arr = json_decode($api_result, true);
     return $api_arr;
 }
Esempio n. 9
0
 function function_footer($params, &$smarty)
 {
     if (app::get('openid')->is_actived()) {
         $smarty->pagedata['openid_open'] = 'true';
         $Certid = base_certificate::get('certificate_id');
         $smarty->pagedata['cert_id'] = $Certid;
         $smarty->pagedata['openid_lg_url'] = kernel::base_url(1);
     } else {
         $smarty->pagedata['openid_open'] = 'false';
     }
     $smarty->pagedata['login_type'] = app::get('b2c')->getConf('site.login_type');
     $smarty->pagedata['app'] = app::get('b2c')->getConf('site.login_type');
     if ($smarty->app->app_id != 'b2c') {
         $shop['url']['region'] = app::get('site')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'site_tools', 'act' => 'selRegion'));
         $shop['url']['placeholder'] = app::get('b2c')->res_url . '/images/imglazyload.gif';
         $smarty->pagedata['shopDefine'] = json_encode($shop);
     }
     foreach (kernel::servicelist('b2c.footer.shop.set.extends') as $obj) {
         if (method_exists($obj, 'header_shop_set_extends')) {
             $obj->header_shop_set_extends($smarty->pagedata['shopDefine']);
         }
     }
     $html = $smarty->fetch('site/common/footer.html', app::get('b2c')->app_id);
     return $html;
 }
Esempio n. 10
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;
     }
 }
Esempio n. 11
0
 function delete()
 {
     $this->begin();
     base_certificate::del_certificate();
     base_certificate::register();
     $this->end();
 }
Esempio n. 12
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');
 }
Esempio n. 13
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 '';
 }
Esempio n. 14
0
 function index($method = 'apply', $app_id = 'b2c', $callback = '', $api_url = '', $user_id = '', $user_name = '', $api_v = '')
 {
     $this->Certi = base_certificate::get('certificate_id');
     $_node_token = base_shopnode::get('token', $app_id);
     $this->Token = $_node_token ? $_node_token : base_certificate::get('token');
     $this->Node_id = base_shopnode::node_id($app_id);
     $token = $this->Token;
     $sess_id = kernel::single('base_session')->sess_id();
     $apply['certi_id'] = $this->Certi;
     if ($this->Node_id) {
         $apply['node_idnode_id'] = $this->Node_id;
     }
     $apply['sess_id'] = $sess_id;
     $str = '';
     ksort($apply);
     foreach ($apply as $key => $value) {
         $str .= $value;
     }
     $apply['certi_ac'] = md5($str . $token);
     if ($method == 'apply') {
         if ($apply['node_idnode_id']) {
             $_url = MATRIX_RELATION_URL . '?source=apply&certi_id=' . $apply['certi_id'] . '&node_id=' . $apply['node_idnode_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '&op_id=' . $user_id . '&op_user='******'&api_v=' . $api_v;
         } else {
             $_url = MATRIX_RELATION_URL . '?source=apply&certi_id=' . $apply['certi_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '&op_id=' . $user_id . '&op_user='******'&api_v=' . $api_v;
         }
     } elseif ($method == 'accept') {
         if ($apply['node_idnode_id']) {
             $_url = MATRIX_RELATION_URL . '?source=accept&certi_id=' . $apply['certi_id'] . '&node_id=' . $apply['node_idnode_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '&op_id=' . $user_id . '&op_user='******'&api_v=' . $api_v;
         } else {
             $_url = MATRIX_RELATION_URL . '?source=accept&certi_id=' . $apply['certi_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '&op_id=' . $user_id . '&op_user='******'&api_v=' . $api_v;
         }
     } else {
         $this->pagedata['_PAGE_CONTENT'] = "";
     }
     // 私有矩阵iframe url
     if ('private' == app::get('system')->getConf('system.matrix.set')) {
         $params = array('source' => $method, 'node_id' => $apply['node_idnode_id'], 'callback' => $callback);
         $sign = kernel::single('system_shopmatrix')->get_sign($params, $apply['node_idnode_id']);
         $iframe_url = kernel::single('system_shopmatrix')->get_iframe_url($this->Node_id);
         if ($method == 'apply') {
             if ($apply['node_idnode_id']) {
                 $_url = $iframe_url . '?source=apply&node_id=' . $apply['node_idnode_id'] . '&callback=' . $callback . '&sign=' . $sign;
             }
         } elseif ($method == 'accept') {
             if ($apply['node_idnode_id']) {
                 $_url = $iframe_url . '?source=accept&node_id=' . $apply['node_idnode_id'] . '&callback=' . $callback . '&sign=' . $sign;
             }
         } else {
             $this->pagedata['_PAGE_CONTENT'] = "";
         }
     }
     if ($_url) {
         echo "<script>new Dialog('{$_url}',{iframe:true,title:'TITLE',width:.8,height:.8});</script>";
     }
     //$this->page();
 }
Esempio n. 15
0
 function __construct($response)
 {
     $sign = $response['sign'];
     unset($response['sign']);
     $this->response = $response;
     $sign_check = base_certificate::gen_sign($response);
     if ($sign != $sign_check) {
         trigger_error('sign error!', E_USER_ERROR);
     }
 }
Esempio n. 16
0
 /**
  * 在后台页面尾部加入商品雷达需要的验证信息
  * @param $params
  * @param $smarty
  */
 function function_desktop_footer($params, &$smarty)
 {
     $Certi = base_certificate::get('certificate_id');
     $token = base_certificate::get('token');
     //计算商品雷达所需sign_key-start-
     $data = array('radar_lincense_id' => $Certi, 'radar_product_key' => 'shopex_zxpt');
     $sign_key = $this->sign($data, $token);
     //-end-
     $html = "<input type='hidden' id='radar_lincense_id' value={$Certi} >\n                 <input type='hidden' id='radar_product_key' value='shopex_zxpt' >\n                 <input type='hidden' id='radar_sign_key' value={$sign_key} >";
     return $html;
 }
Esempio n. 17
0
 function index()
 {
     $callback_url = '';
     $api_url = kernel::base_url(1) . kernel::url_prefix() . '/api';
     $ceti_id = base_certificate::get('certificate_id');
     $node_id = base_shopnode::node_id($this->app->app_id);
     $obj_user = kernel::single('desktop_user');
     $user_id = $obj_user->user_data['user_id'];
     $user_name = $obj_user->user_data['name'];
     $api_v = $this->app->getConf("api.local.version");
     $this->finder('b2c_mdl_shop', array('title' => app::get('b2c')->_('数据互联') . app::get('b2c')->_('证书:') . $ceti_id . ', ' . app::get('b2c')->_('节点:') . $node_id, 'actions' => array(array('label' => app::get('b2c')->_('新建绑定关系'), 'icon' => 'add.gif', 'href' => 'index.php?app=b2c&ctl=admin_shoprelation&act=addnew', 'target' => '_blank'), array('label' => app::get('b2c')->_('查看绑定情况'), 'icon' => 'add.gif', 'onclick' => 'new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get()'))));
 }
Esempio n. 18
0
 public function check_wechat_sign($signature, $openid)
 {
     $shopex_token = base_certificate::get('token');
     $tmpArr = array($shopex_token, $openid);
     sort($tmpArr, SORT_STRING);
     $tmpStr = implode($tmpArr);
     $tmpStr = sha1($tmpStr);
     if ($tmpStr == $signature) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 19
0
 function post_install($options)
 {
     pam_account::register_account_type('b2c', 'member', '前台会员系统');
     kernel::log('Register b2c meta');
     $obj_goods = app::get('b2c')->model('goods');
     $col = array('adjunct' => array('type' => 'text', 'required' => false, 'label' => __('商品配件'), 'width' => 110, 'editable' => false));
     $obj_goods->meta_register($col);
     kernel::log('Initial b2c');
     kernel::single('base_initial', 'b2c')->init();
     kernel::log('Init b2c member');
     $attr_model = app::get('b2c')->model('member_attr')->init();
     if ($options['demodata']) {
         kernel::log('Import demo data');
         kernel::single('base_demo')->init();
     }
     $logo = app::get('b2c')->getConf('site.logo');
     $obj_image = app::get('image')->model('image');
     $app_dir = app::get('b2c')->app_dir;
     $obj_image->store($app_dir . '/initial/site_logo.png', $logo);
     $obj_image->store($app_dir . '/initial/default_images/spec_def.bmp', app::get('b2c')->getConf('spec.default.pic'));
     // set listener and modifier
     $app_b2c = app::get('b2c');
     $all = $app_b2c->getConf('system.event_listener');
     if ($this->arr_listener) {
         foreach ($this->arr_listener as $k => $v) {
             $k = strtolower($k);
             $v = strtolower($v);
             if (!isset($all[$k])) {
                 $all[$k] = array();
             }
             $all[$k][$v] = $v;
         }
     }
     $app_b2c->setConf('system.event_listener', $all);
     $all = $app_b2c->getConf('system.event_listener_key');
     if ($this->arr_lister_keys) {
         foreach ($this->arr_lister_keys as $k => $v) {
             $k = strtolower($k);
             $v = strtolower($v);
             if (!isset($all[$k])) {
                 $all[$k] = array();
             }
             $all[$k][$v] = $v;
         }
     }
     $app_b2c->setConf('system.event_listener_key', $all);
     // 获取node_id...
     if (!base_shopnode::node_id('b2c') && base_certificate::certi_id()) {
         base_shopnode::active('b2c');
     }
 }
Esempio n. 20
0
 function shopex_shop_add()
 {
     $params = $this->params;
     //检查当前网站的证书是否存在
     $certi = base_certificate::get('certificate_id');
     $token = base_certificate::get('token');
     if (empty($certi) || empty($token)) {
         $error['code'] = null;
         $error['msg'] = '网店证书无效';
         $this->send_error($error);
     }
     //必须参数是否定义
     if (!isset($params['certificate_id']) || !isset($params['certificate_salt']) || !isset($params['api_version']) || !isset($params['ac'])) {
         $error['code'] = null;
         $error['msg'] = '必须参数没定义';
         $this->send_error($error);
     } elseif ($params['api_version'] && $params['api_version'] != $this->api_version) {
         //调用的版本和当前版本是否一致
         $error['code'] = null;
         $error['msg'] = 'api版本不一致';
         $this->send_error($error);
     }
     //检查证书id是否一致
     if (isset($params['certificate_id']) && $params['certificate_id'] != $certi) {
         $error['code'] = null;
         $error['msg'] = '证书ID不一致';
         $this->send_error($error);
     }
     //检查签名是否有效
     $sign = $this->get_sign($params, $token);
     if ($sign != $params['ac']) {
         $error['code'] = null;
         $error['msg'] = '签名无效';
         $this->send_error($error);
     }
     $site_setting = array('site_name' => 'system.shopname', 'site_address' => 'store.address', 'site_phone' => 'store.telephone', 'site_zip_code' => 'store.zip_code', 'score_set' => 'site.get_policy.method');
     foreach ($site_setting as $key => $value) {
         if ($value == 'system.shopname') {
             $data[$key] = app::get('site')->getConf($value);
         }
         $data[$key] = app::get('b2c')->getConf($value);
     }
     $deploy = kernel::single('base_xml')->xml2array(file_get_contents(ROOT_DIR . '/config/deploy.xml'), 'base_deploy');
     $data['shop_version'] = $deploy['product_name'] . 'V' . $deploy['product_version'];
     $data['site_type'] = 2;
     // 商品通中 2表示ecstore
     $image_size = IMAGE_MAX_SIZE / 1024;
     //单位为KB
     $data['image_size'] = $image_size ? $image_size : 2048;
     $this->send_success($data);
 }
Esempio n. 21
0
 function __construct()
 {
     $this->params = $_POST;
     $this->token = base_certificate::get('token');
     $this->is_admin = app::get('goodsapi')->getConf('is_admin');
     $this->user_id = app::get('goodsapi')->getConf('shangpintong_login_id');
     if ($_POST['session']) {
         $obj_session = kernel::single('base_session');
         $obj_session->set_sess_id(md5($_POST['session']));
         $obj_session->set_sess_expires(0);
         //永久保存
         $obj_session->start();
     }
 }
Esempio n. 22
0
 function __construct($response, $app_id)
 {
     $sign = $response['sign'];
     unset($response['sign']);
     $this->response = $response;
     if (!$app_id || !base_shopnode::token($app_id)) {
         $sign_check = base_certificate::gen_sign($response);
     } else {
         $sign_check = base_shopnode::gen_sign($response, $app_id);
     }
     if ($sign != $sign_check) {
         //trigger_error('sign error!',E_USER_ERROR);
         echo json_encode(array('rsp' => 'fail', 'res' => 4003, 'data' => 'sign error'));
         exit;
     }
 }
Esempio n. 23
0
 static function get($code = 'certificate_id')
 {
     if (!function_exists('get_certificate')) {
         if (self::$certi === null) {
             if (file_exists(ROOT_DIR . '/config/certi.php')) {
                 require ROOT_DIR . '/config/certi.php';
                 self::$certi = $certificate;
             } else {
                 self::$certi = array();
             }
         }
     } else {
         self::$certi = get_certificate();
     }
     return self::$certi[$code];
 }
Esempio n. 24
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');
     }
 }
Esempio n. 25
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');
 }
Esempio n. 26
0
 public function openapi()
 {
     $params['certi_app'] = 'open.login';
     $this->Certi = base_certificate::get('certificate_id');
     $this->Token = base_certificate::get('token');
     $params['certificate_id'] = $this->Certi;
     $token = $this->Token;
     $str = '';
     ksort($params);
     foreach ($params as $key => $value) {
         $str .= $value;
     }
     $params['certi_ac'] = md5($str . $token);
     $params['format'] = 'image';
     $this->pagedata['open_api_url'] = LICENSE_CENTER_V . '?' . http_build_query($params);
     //echo stripslashes(kernel::single('base_httpclient')->post( LICENSE_CENTER_V,$params ));
     //echo trim(stripslashes(kernel::single('base_httpclient')->post( LICENSE_CENTER_V,$params )), '"');
 }
Esempio n. 27
0
 private static function pull_from_matrix($logi_no, $dlycorp_code, &$hock)
 {
     $logi_no = preg_replace('/\\xEF\\xBB\\xBF/', '', $logi_no);
     $logi = array('format' => 'json', 'date' => time(), 'method' => 'logistics.trace.search', 'tracking_no' => $logi_no, 'logistics_code' => $dlycorp_code);
     $logi['certi_id'] = base_certificate::certi_id();
     $logi['sign'] = base_certificate::gen_sign($logi);
     $httpclient = new base_httpclient();
     $response = $httpclient->post(MATRIX_RELATION_URL . 'service/', $logi);
     $hock = json_decode($response, 1);
     $hock['logi_no'] = $logi_no;
     $hock['dlycorp_code'] = $dlycorp_code;
     $hock['msg'] = $hock['message'] ? $hock['message'] : app::get('logisticstrack')->_('中心不能提供数据');
     if ($hock['status'] == 1 || $hock['message'] == 'ok') {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 28
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;
 }
Esempio n. 29
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;
 }
Esempio n. 30
0
 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);
 }