Esempio n. 1
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. 2
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. 3
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. 4
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. 5
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. 6
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. 7
0
 function download()
 {
     header("Content-type:application/octet-stream;charset=utf-8");
     header("Content-Type: application/force-download");
     $this->fileName = 'CERTIFICATE.CER';
     header("Content-Disposition:filename=" . $this->fileName);
     $this->Certi = base_certificate::get('certificate_id');
     $this->Token = base_certificate::get('token');
     echo $this->Certi;
     echo '|||';
     echo $this->Token;
 }
Esempio n. 8
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. 9
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. 10
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. 11
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. 12
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. 13
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);
     $matrixRelationUrl = config::get('link.matrix_relation_url');
     if ($method == 'apply') {
         if ($apply['node_idnode_id']) {
             $_url = $matrixRelationUrl . '?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 = $matrixRelationUrl . '?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 = $matrixRelationUrl . '?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 = $matrixRelationUrl . '?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'] = "";
     }
     if ($_url) {
         echo "<script>new Dialog('{$_url}',{iframe:true,title:'TITLE',width:.8,height:.8});</script>";
     }
 }
Esempio n. 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');
 }
Esempio n. 15
0
 function error_view($auth_error_msg)
 {
     $Certi = base_certificate::get('certificate_id');
     if (!$Certi && !$auth_error_msg) {
         $auth_error_msg = "查询不到证书,请确认config/certi.php文件是否存在";
     }
     $render = app::get('desktop')->render();
     $shopexIdUrl = app::get('base')->getConf('certificate_code_url');
     if ($shopexIdUrl && $shopexIdUrl != kernel::base_url(1)) {
         $render->pagedata['url'] = $shopexIdUrl;
     }
     $url = $this->app->base_url(1);
     $render->pagedata['post_url'] = $url . 'index.php?app=desktop&ctl=code&act=codecheck';
     $render->pagedata['res_url'] = app::get('desktop')->res_url;
     $render->pagedata['auth_error_msg'] = $auth_error_msg;
     echo $render->display('active_code.html');
     exit;
 }
Esempio n. 16
0
 private 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;
     $params['format'] = 'image';
     /** 增加反查参数result和反查基础地址url **/
     $code = md5(microtime());
     base_kvstore::instance('ecos')->store('net.login_handshake', $code);
     $params['result'] = $code;
     /** 得到框架的总版本号 **/
     //$app_xml = kernel::single('base_xml')->xml2array(file_get_contents(app::get('base')->app_dir.'/app.xml'),'base_app');
     $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(6);
     $result = $http->post(LICENSE_CENTER_V, $params);
     //$this->pagedata['open_api_url'] = LICENSE_CENTER_V .'?'. utils::http_build_query( $params );
     $tmp_res = json_decode($result, 1);
     if ($tmp_res) {
         // 存在异常
         if ($tmp_res['res'] == 'fail') {
             $this->pagedata['open_api_url'] = $tmp_res['msg'];
         } else {
             if ($tmp_res['res'] == 'succ') {
                 $this->pagedata['open_api_url'] = stripslashes($tmp_res['info']);
             } else {
                 $this->pagedata['open_api_url'] = stripslashes($tmp_res);
             }
         }
     } else {
         $this->pagedata['open_api_url'] = stripslashes($tmp_res);
     }
     return $this->pagedata['open_api_url'];
 }
Esempio n. 17
0
 /**
  * @description 获取token
  * @access public
  * @param void
  * @return void
  *
  * 测试Token: efa5552656ed12705a4afb3502405e45d48f948001291de47ac6fd17bd19013c
  */
 public function getToken()
 {
     if ($this->token) {
         return $this->token;
     } elseif (base_certificate::get('token')) {
         return base_certificate::get('token');
     } else {
         return false;
     }
 }
Esempio n. 18
0
 function _ident()
 {
     $id = md5(microtime() . base_certificate::get());
     $id = '/' . substr($id, 0, 2) . '/' . substr($id, 2, 2) . '/' . $id;
     return $id;
 }
Esempio n. 19
0
 function getToken()
 {
     if (base_certificate::get('token')) {
         return base_certificate::get('token');
     } else {
         return false;
     }
 }
Esempio n. 20
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);
 }
Esempio n. 21
0
 function fetchProtoTypes($link, $querystring = '', $nodeType = '')
 {
     header('Content-Type: text/html;charset=utf-8');
     $net =& kernel::single('base_httpclient');
     $cert = base_certificate::get('certificate_id');
     $token = base_certificate::get('token');
     $sc = md5('goostypefeed' . $cert . $token);
     $url = 'http://feed.shopex.cn/goodstype/' . $link . '?certificate=' . $cert . '&sc=' . $sc . ($querystring ? '&' . $querystring : '') . ($nodeType ? '&nodeType=' . $nodeType : '');
     $net->http_ver = '1.0';
     $net->defaultChunk = 30000;
     $result = $net->get($url);
     if ($result = $net->get($url)) {
         $script = '<SCRIPT LANGUAGE="JavaScript">loadLocalBrands();</SCRIPT><script>function checkTypeNameExists(){
              new Request({url:\'index.php?app=b2c&ctl=admin_goods_type&act=checkTypeNameExists\',method:\'post\',data:\'gtypename=\'+$(\'gtypename\').value,evalScripts:true}).send();
          }
         $("closeftpbutton").getParent("form").store("target",{
             onComplete:function(){
                 $("closeftpbutton").getParent(".dialog").retrieve("instance").close();
             }
          });
         </script>';
         $result = str_replace('ctl=goods/gtype', 'app=b2c&ctl=admin_goods_type', $result);
         $result = str_replace('required="true"', 'vtype="required"', $result);
         $result = str_replace('"submit"', '"submit" id="closeftpbutton"', $result);
         $result = preg_replace('/<SCRIPT([^>]*)>(.*?)<\\/script>/Us', $script, $result);
     }
     if ($link == 'gtype.php') {
         $result .= '<div class="table-action"><button onclick="javascript:autoFetch();" id="previous_step" class="btn btn-primary" type="button"><span><span>' . __("上一步") . '</span></span></button></div>';
     }
     if ($result && false !== substr($result, 'shopexfeed')) {
         echo $result;
     } else {
         echo '<div style="width:300px;height:80px;"><BR><BR>' . __('因网络连接或其它原因,暂时无法获取系统默认类型信息。<BR>请稍候再试...错误信息') . $net->responseCode . '</div><div style="clear:both">';
     }
 }
Esempio n. 22
0
 function _ident($id)
 {
     return '/' . md5(microtime() . base_certificate::get()) . $id;
 }
Esempio n. 23
0
 function __construct()
 {
     $this->license_id = base_certificate::get('certificate_id');
     $this->license_key = base_certificate::get('token');
     $this->entid = base_enterprise::ent_id();
 }
Esempio n. 24
0
 function post_update($dbinfo)
 {
     $dbver = $dbinfo['dbver'];
     if (empty($dbver) || $dbver == '0.1') {
         app::get('base')->model('cache_expires')->delete(array());
         $rows = app::get('base')->model('apps')->getList('app_id', array('installed' => 1));
         $content_detectors['list'] = array('base_application_cache_expires');
         $service = new service($content_detectors);
         foreach ($rows as $row) {
             foreach ($service as $detector) {
                 foreach ($detector->detect(app::get($row['app_id'])) as $name => $item) {
                     $item->install();
                 }
             }
         }
         cachemgr::clean($msg);
         //清空缓存
         kernel::log('cache expiers update');
     }
     //变更cache_expires结构及数据,0.1版本前存在的问题包括0.1
     if ($dbver && $dbver == '0.12') {
         // 升级版本,清理原来rpcpoll表里面的大量冗余数据。
         app::get('base')->model('rpcpoll')->delete(array('type' => 'response'));
     } elseif ($dbver && $dbver == '0.13') {
         // 0.13-0.14版本历史性的解决下openapi的bug-修改数据互联callback_url的地址.
         // 将原来的api->openapi.
         $params = array('app' => 'app.updateRelCallbackUrl', 'cert_id' => base_certificate::get('certificate_id'));
         $token = base_certificate::get('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(6);
         $result = $http->post(MATRIX_RELATION_URL . '/api.php', $params);
     }
     $rpc_global_server = array('node_id' => MATRIX_GLOBAL, 'node_url' => MATRIX_URL, 'node_name' => 'Global Matrix', 'node_api' => '', 'link_status' => 'active');
     app::get('base')->model('network')->replace($rpc_global_server, array('node_id' => MATRIX_GLOBAL), true);
     $rpc_realtime_server = array('node_id' => MATRIX_REALTIME, 'node_url' => MATRIX_REALTIME_URL, 'node_name' => 'Realtime Matrixi', 'node_api' => '', 'link_status' => 'active');
     app::get('base')->model('network')->replace($rpc_realtime_server, array('node_id' => MATRIX_REALTIME), true);
     $rpc_service_server = array('node_id' => MATRIX_SERVICE, 'node_url' => MATRIX_SERVICE_URL, 'node_name' => 'Service Matrix', 'node_api' => '', 'link_status' => 'active');
     app::get('base')->model('network')->replace($rpc_service_server, array('node_id' => MATRIX_SERVICE), true);
 }
Esempio n. 25
0
 function __construct()
 {
     $this->url = "http://www.ecopen.cn/api/";
     $this->cert_id = base_certificate::get('certificate_id');
 }
Esempio n. 26
0
 function command_backup_certificate_id()
 {
     $args = func_get_args();
     $options = $this->get_options();
     $this->Certi = base_certificate::get('certificate_id');
     $this->Token = base_certificate::get('token');
     $str_shop = $this->Certi . "|||" . $this->Token;
     if ($options['backup_dir']) {
         $backup_dir = $args[0];
         if (!is_dir($backup_dir)) {
             mkdir($backup_dir);
         }
         $file_name = $args[1] . "_certificate_id.log";
         if (!$args[1]) {
             $file_name = "certificate_id_backup.log";
         }
         $backup_file = $backup_dir . "/" . $file_name;
         if (is_file($backup_file)) {
             unlink($backup_file);
         }
         if (!($fp = fopen($backup_file, 'w'))) {
             echo "Can not find file......";
             exit;
         }
         $fw = fwrite($fp, $str_shop);
         if ($fw) {
             echo "the write shopex_id the success of the backup file......";
         } else {
             echo "shopex_id written to the backup file failed......";
         }
     } else {
         echo "缺少参数,使用-d 指定'证书'要备份到那个目录?使用-n指定要备份的项目名称";
     }
 }