Пример #1
0
/**
 * 功能:与 ECShop 交换数据
 *
 * @param   array     $certi    登录参数
 * @param   array     $license  网店license信息
 * @param   bool      $use_lib  使用哪一个json库,0为ec,1为shopex
 * @return  array
 */
function exchange_shop_license($certi, $license, $use_lib = 0)
{
    if (!is_array($certi)) {
        return array();
    }
    include_once ROOT_PATH . 'includes/cls_transport.php';
    include_once ROOT_PATH . 'includes/cls_json.php';
    $params = '';
    foreach ($certi as $key => $value) {
        $params .= '&' . $key . '=' . $value;
    }
    $params = trim($params, '&');
    $transport = new transport();
    //$transport->connect_timeout = 1;
    $request = $transport->request($license['certi'], $params, 'POST');
    $request_str = json_str_iconv($request['body']);
    if (empty($use_lib)) {
        $json = new JSON();
        $request_arr = $json->decode($request_str, 1);
    } else {
        include_once ROOT_PATH . 'includes/shopex_json.php';
        $request_arr = json_decode($request_str, 1);
    }
    return $request_arr;
}
Пример #2
0
 public function check_fee()
 {
     es_session::start();
     $last_visit = intval(es_session::get("last_visit_smsbao"));
     if (get_gmtime() - $last_visit > 10) {
         $sms = new transport();
         $params = array("u" => $this->sms['user_name'], "p" => md5($this->sms['password']));
         $url = "http://www.smsbao.com/query";
         $result = $sms->request($url, $params);
         $match = explode(',', $result['body']);
         if ($match[0] != '') {
             $remain = (int) $match[1];
             $str = sprintf('短信宝增值平台  剩余:%d 条', $remain);
         } else {
             $str = "短信宝增值平台 (<a href='http://www.smsbao.com/reg?r=5001' target='_blank'><font color='red'>还没账号?点击这免费注册</font></a>)";
         }
         es_session::set("smsbao_info", $str);
         es_session::set("last_visit_smsbao", get_gmtime());
         return $str;
     } else {
         $qxt_info = es_session::get("smsbao_info");
         if ($smsbao_info) {
             return $smsbao_info;
         } else {
             return "短信宝增值平台 (<a href='http://www.smsbao.com/reg?r=5001' target='_blank'><font color='red'>还没账号?点击这免费注册</font></a>)";
         }
     }
 }
Пример #3
0
/**
 * 功能:与 ECShop 交换数据
 *
 * @param   array $certi 登录参数
 * @param   array $license 网店license信息
 * @param   bool $use_lib 使用哪一个json库,0为ec,1为shopex
 * @return  array
 */
function exchange_shop_license($certi, $license, $use_lib = 0)
{
    $touch =& get_instance();
    if (!is_array($certi)) {
        return array();
    }
    $touch->load->library('transport');
    //    include_once(ROOT_PATH . 'includes/cls_transport.php');
    //    include_once(ROOT_PATH . 'includes/cls_json.php');
    $params = '';
    foreach ($certi as $key => $value) {
        $params .= '&' . $key . '=' . $value;
    }
    $params = trim($params, '&');
    $transport = new transport();
    //$transport->connect_timeout = 1;
    $request = $transport->request($license['certi'], $params, 'POST');
    $request_str = json_str_iconv($request['body']);
    //    if (empty($use_lib))
    //    {
    //$json = new JSON();
    $request_arr = json_decode($request_str, 1);
    //    }
    //    else
    //    {
    //        //include_once(ROOT_PATH . 'includes/shopex_json.php');
    //        $request_arr = json_decode($request_str, 1);
    //    }
    return $request_arr;
}
Пример #4
0
 public function check_fee()
 {
     $sms = new transport();
     $params = array("OperID" => $this->sms['user_name'], "OperPass" => $this->sms['password']);
     $url = "http://221.179.180.158:9000/QxtSms/surplus";
     $result = $sms->request($url, $params);
     $result = toArray($result['body'], "resRoot");
     $str = "企信通短信平台,剩余:" . $result['rcode'][0] . "条";
     return $str;
 }
Пример #5
0
 public function check_fee()
 {
     $sms = new transport();
     $url = $this->sms['server_url'] . "get";
     $params = json_encode($this->sms);
     $result = $sms->request($url, $params);
     $result = json_decode($result['body'], 1);
     $str = $result['info'];
     return $str;
 }
Пример #6
0
 /**
  * Register the new install with the LC API
  *  
  * @access private      
  * @return string
  */
 private function _doRegister($data)
 {
     global $lC_Database, $lC_Cache;
     if (isset($data['activation_email']) && $data['activation_email'] != NULL) {
         $storeEmail = $data['activation_email'];
     } else {
         $storeEmail = STORE_OWNER_EMAIL_ADDRESS;
     }
     if (isset($data['activation_serial']) && $data['activation_serial'] != NULL) {
         $storeSerial = $data['activation_serial'];
     } else {
         $storeSerial = '';
     }
     // register the install with LC API
     $registerArr = array('serial' => $storeSerial, 'storeName' => STORE_NAME, 'storeEmail' => $storeEmail, 'storeWWW' => HTTP_SERVER . DIR_WS_HTTP_CATALOG, 'storeSSL' => HTTPS_SERVER . DIR_WS_HTTPS_CATALOG, 'systemMetaData' => base64_encode(json_encode(lc_get_system_information())), 'serverMetaData' => isset($_SERVER) && is_array($_SERVER) ? base64_encode(json_encode($_SERVER)) : NULL, 'envMetaData' => isset($_ENV) && is_array($_ENV) ? base64_encode(json_encode($_ENV)) : NULL);
     $checksum = hash('sha256', json_encode($registerArr));
     $registerArr['checksum'] = $checksum;
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     $registerArr['ver'] = utility::getVersion();
     $request_type = getRequestType();
     $resultXML = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/register/install/', 'method' => 'post', 'parameters' => $registerArr, 'timeout' => 10));
     $newInstallationID = preg_match("'<installationID[^>]*?>(.*?)</installationID>'i", $resultXML, $regs) == 1 ? $regs[1] : NULL;
     $products = preg_match("'<products[^>]*?>(.*?)</products>'i", $resultXML, $regs) == 1 ? $regs[1] : NULL;
     if (lC_Server_info_Admin::updateInstallID($newInstallationID)) {
         return utility::arr2xml(array('error' => FALSE, 'installationID' => $newInstallationID, 'products' => $products));
     } else {
         return utility::arr2xml(array('error' => TRUE, 'message' => 'error processing the request'));
     }
 }
 public function initialize()
 {
     global $lC_Product;
     if (defined('MODULE_CONTENT_PRODUCT_ON_HOMEPAGE')) {
         $lC_Product = new lC_Product(MODULE_CONTENT_PRODUCT_ON_HOMEPAGE);
         $product_url = HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'products.php?' . $lC_Product->getKeyword();
         $resultHTML = transport::getResponse(array('url' => $product_url, 'method' => 'get'));
         $content = substr($resultHTML, strpos($resultHTML, '<!--content/products/info.php start'));
         $this->_content = substr($content, strpos($content, '<!--content/products/info.php start'), strpos($content, 'content/products/info.php end-->') + 32);
     }
 }
Пример #8
0
 public function call($operation, $params = '')
 {
     $this->log .= time() . ": call() called.\n";
     if (!stristr($this->url, 'http://')) {
         throw new Exception("URL self::{$url} is not correct.");
     }
     if (!empty($params)) {
         $call['method'] = $operation;
         $call['params'] = $params;
         $postdata = $this->rc4(json_encode($call));
         $postdata = 'call=' . str_replace('=', '', base64_encode($postdata));
         $http = new transport();
         $content = $http->request($this->url, $postdata);
         //$a = file_put_contents('debug.txt',base64_decode($content['body']));
         $cbody = $this->rc4(base64_decode($content['body']));
         return json_decode($cbody, true);
     } else {
         throw new Exception("params is empty.");
     }
 }
Пример #9
0
 /**
  * 定位经续度
  * @param unknown_type $x 经度
  * @param unknown_type $y 纬度
  */
 public static function locate_geo($xpoint = 0, $ypoint = 0)
 {
     $xpoint = floatval($xpoint);
     $ypoint = floatval($ypoint);
     $current_geo = es_session::get("current_geo");
     if ($xpoint != 0) {
         $current_geo['xpoint'] = $xpoint;
         $current_geo['address'] = "";
     } elseif (empty($current_geo['xpoint'])) {
         $current_geo['xpoint'] = 0;
     }
     if ($ypoint != 0) {
         $current_geo['ypoint'] = $ypoint;
         $current_geo['address'] = "";
     } elseif (empty($current_geo['ypoint'])) {
         $current_geo['ypoint'] = 0;
     }
     if ($current_geo['xpoint'] > 0 || $current_geo['ypoint'] > 0) {
         if ($current_geo['address'] == "") {
             $url = "http://api.map.baidu.com/geocoder/v2/?ak=FANWE_MAP_KEY&location=FANWE_MAP_YPOINT,FANWE_MAP_XPOINT&output=json";
             $url = str_replace("FANWE_MAP_KEY", app_conf("BAIDU_MAP_APPKEY"), $url);
             $url = str_replace("FANWE_MAP_YPOINT", $current_geo['ypoint'], $url);
             $url = str_replace("FANWE_MAP_XPOINT", $current_geo['xpoint'], $url);
             require_once APP_ROOT_PATH . "system/utils/transport.php";
             $trans = new transport();
             $trans->use_curl = true;
             $request_data = $trans->request($url);
             $data = $request_data['body'];
             $data = json_decode($data, 1);
             $address = $data['result']['sematic_description'];
             if ($address) {
                 $current_geo['address'] = $address;
             } else {
                 es_session::delete("current_geo");
                 return null;
             }
         }
     }
     es_session::set("current_geo", $current_geo);
     return $current_geo;
 }
 public function install($config_seralized)
 {
     //uc数据的安装
     $post_config = unserialize($config_seralized);
     include_once APP_ROOT_PATH . 'system/utils/transport.php';
     $result = array('status' => 1, 'msg' => '');
     if (!file_exists(APP_ROOT_PATH . "uc_client/client.php") || !file_exists(APP_ROOT_PATH . "api/uc.php")) {
         $result['status'] = 0;
         $result['msg'] = '缺少 /uc_client/目录与/api/uc.php, 无法正常安装Ucenter整合';
         $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CODE'");
         $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CFG'");
         return $result;
     }
     $app_type = 'OTHER';
     $app_name = app_conf("SITE_NAME");
     $app_url = get_domain() . APP_ROOT;
     $app_charset = 'utf-8';
     $app_dbcharset = strtolower(str_replace('-', '', $app_charset));
     $ucapi = !empty($post_config['UCENTER_URL']) ? trim($post_config['UCENTER_URL']) : '';
     $ucip = !empty($post_config['UCENTER_IP']) ? trim($post_config['UCENTER_IP']) : '';
     $dns_error = false;
     if (!$ucip) {
         $temp = @parse_url($ucapi);
         $ucip = gethostbyname($temp['host']);
         if (ip2long($ucip) == -1 || ip2long($ucip) === FALSE) {
             $ucip = '';
             $dns_error = true;
         }
     }
     if ($dns_error) {
         $result['status'] = 0;
         $result['msg'] = 'DNS解析出错';
         $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CODE'");
         $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CFG'");
         return $result;
     }
     $ucfounderpw = trim($post_config['UCENTER_ADMIN']);
     $app_tagtemplates = '';
     if ($post_config['DB_CHARSET'] != 'utf-8') {
         $app_name = iconv('utf-8', $post_config['DB_CHARSET'], $app_name);
     }
     $postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucfounderpw) . "&apptype=" . urlencode($app_type) . "&appname=" . urlencode($app_name) . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . $app_charset . '&appdbcharset=' . $app_dbcharset . '&apptagtemplates=' . $app_tagtemplates;
     $t = new transport();
     $ucconfig = $t->request($ucapi . '/index.php', $postdata);
     $ucconfig = $ucconfig['body'];
     if (empty($ucconfig)) {
         //ucenter 验证失败
         $result['status'] = 0;
         $result['msg'] = "Ucenter验证失败";
     } elseif ($ucconfig == '-1') {
         //管理员密码无效
         $result['status'] = 0;
         $result['msg'] = "管理员密码无效";
     } else {
         list($appauthkey, $appid) = explode('|', $ucconfig);
         if (empty($appauthkey) || empty($appid)) {
             //ucenter 安装数据错误
             $result['status'] = 0;
             $result['msg'] = '安装数据错误';
         } else {
             //开始写入public下的uc_config.php
             $ucconfig = explode("|", $ucconfig);
             //开始写入配置文件
             $key_name = array('UC_KEY', 'UC_APPID', 'UC_DBHOST', 'UC_DBNAME', 'UC_DBUSER', 'UC_DBPW', 'UC_DBCHARSET', 'UC_DBTABLEPRE', 'UC_CHARSET');
             $config_str = "<?php\n";
             foreach ($ucconfig as $k => $v) {
                 if ($k == 7) {
                     $v = "`" . $ucconfig[3] . "`." . $v;
                 }
                 $config_str .= "define('" . $key_name[$k] . "','" . $v . "');\n";
             }
             $uc_connect = $post_config['INTEGERATE_TYPE'] == 1 ? 'mysql' : '';
             $config_str .= "define('UC_CONNECT','" . $uc_connect . "');\n";
             $config_str .= "define('UC_DBCONNECT','0');\n";
             $config_str .= "define('UC_API','" . $ucapi . "');\n";
             $config_str .= "define('UC_IP','" . $ucip . "');\n";
             $config_str .= "\n ?>";
             @file_put_contents(APP_ROOT_PATH . "/public/uc_config.php", $config_str);
             //开始同步会员数据
             if ($uc_connect == 'mysql') {
                 $this->import_user();
             }
             if (file_exists(APP_ROOT_PATH . "/public/uc_config.php")) {
                 require_once APP_ROOT_PATH . "/public/uc_config.php";
                 $apps = uc_call("uc_app_ls");
                 $cachefile = APP_ROOT_PATH . 'public/uc_data/apps.php';
                 $fp = fopen($cachefile, 'w');
                 $s = "<?php\r\n";
                 $s .= '$_CACHE[\'apps\'] = ' . var_export($apps, TRUE) . ";\r\n";
                 fwrite($fp, $s);
                 fclose($fp);
             }
             $result['status'] = 1;
         }
     }
     if ($result['status'] == 0) {
         $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CODE'");
         $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CFG'");
     } else {
         $GLOBALS['db']->query("update " . DB_PREFIX . "conf set value = '' where name = 'INTEGRATE_CFG'");
     }
     return $result;
 }
Пример #11
0
                }
                $api_arr['api_time'] = date('Ymd');
                write_static_cache('cloud_remind', $api_arr);
                make_json_result($api_arr['content']);
            } else {
                make_json_result('0');
            }
        } else {
            make_json_result('0');
        }
    } else {
        make_json_result($api_data['content']);
    }
} elseif ($act == 'close_remind') {
    $remind_id = $_REQUEST['remind_id'];
    $t = new transport('-1', 5);
    $apiget = "ver= {$data['version']} &ecs_lang= {$data['ecs_lang']} &charset= {$data['charset']} &certificate_id={$data['certificate_id']}&ent_id={$data['ent_id']}&remind_id={$remind_id}";
    $api_comment = $t->request('http://ecshop.ecmoban.com/cloud_remind.php', $apiget);
    $api_str = $api_comment["body"];
    $json = new Services_JSON();
    $api_arr = array();
    $api_arr = @$json->decode($api_str, 1);
    if (!empty($api_str)) {
        if (!empty($api_arr) && $api_arr['error'] == 0 && md5($api_arr['content']) == $api_arr['hash']) {
            $api_arr['content'] = urldecode($api_arr['content']);
            if ($data['charset'] != 'UTF-8') {
                $api_arr['content'] = ecs_iconv('UTF-8', $data['charset'], $api_arr['content']);
            }
            if (admin_priv('all', '', false)) {
                $apiget .= "&act=close_remind&ent_ac={$data['ent_ac']}";
                $result = $t->request('http://ecshop.ecmoban.com/cloud_remind.php', $apiget);
Пример #12
0
        $goods['total'] = $db->GetOne('SELECT COUNT(*) FROM ' . $ecs->table('goods') . ' WHERE is_delete = 0 AND is_alone_sale = 1 AND is_real = 1');
        $gcount = $goods['total'];
        $ecs_charset = strtoupper(EC_CHARSET);
        $ecs_user = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('users'));
        $ecs_template = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'template\'');
        $style = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'stylename\'');
        if ($style == '') {
            $style = '0';
        }
        $ecs_style = $style;
        $shop_url = urlencode($ecs->url());
        $ip = real_ip();
        $type = 1;
        $patch_file = file_get_contents(ROOT_PATH . ADMIN_PATH . "/patch_num");
        $apiget = "ver= {$ecs_version} &name= {$ecs_product} &lang= {$ecs_lang} &release= {$ecs_release} &php_ver= {$php_ver} &mysql_ver= {$mysql_ver} &ocount= {$ocount} &oamount= {$oamount} &gcount= {$gcount} &charset= {$ecs_charset} &usecount= {$ecs_user} &template= {$ecs_template} &style= {$ecs_style} &url= {$shop_url} &ip= {$ip} &type= {$type} &patch= {$patch_file} ";
        $t = new transport();
        $api_comment = $t->request('http://api.shopne.com/census.php', $apiget);
        $api_str = $api_comment["body"];
        echo $api_str;
        $f = ROOT_PATH . 'data/config.php';
        file_put_contents($f, str_replace("'API_TIME', '" . API_TIME . "'", "'API_TIME', '" . date('Y-m-d H:i:s', time()) . "'", file_get_contents($f)));
        write_static_cache('api_str_68', $api_str);
    } else {
        echo $data;
    }
} elseif ($_REQUEST['act'] == 'first') {
    $smarty->assign('countries', get_regions());
    $smarty->assign('provinces', get_regions(1, 1));
    $smarty->assign('cities', get_regions(2, 2));
    $sql = 'SELECT value from ' . $ecs->table('shop_config') . " WHERE code='shop_name'";
    $shop_name = $db->getOne($sql);
Пример #13
0
 public function setup_ucenter()
 {
     require_once FANWE_ROOT . 'core/class/transport.class.php';
     $result = array('status' => 0, 'info' => '', 'data' => '');
     $app_type = 'OTHER';
     $app_name = 'FANWE';
     //fanweC('SHOP_NAME'); //$db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . " WHERE code = 'shop_name'");
     $app_url = 'http://' . $_SERVER['HTTP_HOST'] . __ROOT__;
     $app_charset = 'UTF-8';
     $app_dbcharset = strtolower(str_replace('-', '', 'UTF-8'));
     $ucapi = trim($_REQUEST['uc_url']);
     $ucfounderpw = trim($_REQUEST['uc_pass']);
     $postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucfounderpw) . "&apptype=" . urlencode($app_type) . "&appname=" . urlencode($app_name) . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . $app_charset . '&appdbcharset=' . $app_dbcharset;
     $t = new transport();
     $ucconfig = $t->request($ucapi . '/index.php', $postdata);
     // dump($ucconfig);exit;
     $ucconfig = $ucconfig['body'];
     if (empty($ucconfig)) {
         //ucenter 验证失败
         $result['error'] = 1;
         $result['info'] = '验证失败:' . $ucapi . '/index.php?' . $postdata;
     } elseif ($ucconfig == '-1') {
         //管理员密码无效
         $result['error'] = 1;
         $result['info'] = '创始人密码错误';
     } else {
         list($appauthkey, $appid) = explode('|', $ucconfig);
         if (empty($appauthkey) || empty($appid)) {
             //ucenter 安装数据错误
             $result['error'] = 1;
             $result['info'] = '安装数据错误:' . $ucconfig;
         } else {
             $result['error'] = 0;
             $result['data'] = $ucconfig;
             $result['info'] = '服务器通信连接成功!';
         }
     }
     return $result;
 }
Пример #14
0
 /**
  * Get all available update packages
  *  
  * @access public      
  * @return array
  */
 public static function getAvailablePackages()
 {
     global $lC_Api;
     $result = array('entries' => array());
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     $request_type = getRequestType();
     $versions = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'get', 'timeout' => 10));
     $versions_array = utility::xml2arr($versions);
     $counter = 0;
     foreach ($versions_array['data'] as $l => $v) {
         if (version_compare(utility::getVersion(), $v['version'], '<')) {
             $result['entries'][] = array('key' => $counter, 'version' => $v['version'], 'date' => lC_DateTime::getShort(lC_DateTime::fromUnixTimestamp(lC_DateTime::getTimestamp($v['dateCreated'], 'Ymd'))), 'announcement' => $v['newsLink'], 'update_package' => isset($v['pharLink']) ? $v['pharLink'] . '?ref=' . urlencode($_SERVER['SCRIPT_FILENAME']) : null);
             $counter++;
         }
     }
     @usort($result['entries'], function ($a, $b) {
         return version_compare($a['version'], $b['version'], '>');
     });
     $result['total'] = count($result['entries']);
     return $result;
 }
Пример #15
0
     $temp = @parse_url($ucapi);
     $ucip = gethostbyname($temp['host']);
     if (ip2long($ucip) == -1 || ip2long($ucip) === FALSE) {
         $ucip = '';
         $dns_error = true;
     }
 }
 if ($dns_error) {
     $result['error'] = 2;
     $result['message'] = '';
     die($json->encode($result));
 }
 $ucfounderpw = trim($_POST['ucfounderpw']);
 $app_tagtemplates = 'apptagtemplates[template]=' . urlencode('<a href="{url}" target="_blank">{goods_name}</a>') . '&' . 'apptagtemplates[fields][goods_name]=' . urlencode($_LANG['tagtemplates_goodsname']) . '&' . 'apptagtemplates[fields][uid]=' . urlencode($_LANG['tagtemplates_uid']) . '&' . 'apptagtemplates[fields][username]=' . urlencode($_LANG['tagtemplates_username']) . '&' . 'apptagtemplates[fields][dateline]=' . urlencode($_LANG['tagtemplates_dateline']) . '&' . 'apptagtemplates[fields][url]=' . urlencode($_LANG['tagtemplates_url']) . '&' . 'apptagtemplates[fields][image]=' . urlencode($_LANG['tagtemplates_image']) . '&' . 'apptagtemplates[fields][goods_price]=' . urlencode($_LANG['tagtemplates_price']);
 $postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucfounderpw) . "&apptype=" . urlencode($app_type) . "&appname=" . urlencode($app_name) . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . $app_charset . '&appdbcharset=' . $app_dbcharset . '&apptagtemplates=' . $app_tagtemplates;
 $t = new transport();
 $ucconfig = $t->request($ucapi . '/index.php', $postdata);
 $ucconfig = $ucconfig['body'];
 if (empty($ucconfig)) {
     //ucenter 验证失败
     $result['error'] = 1;
     $result['message'] = $_LANG['uc_msg_verify_failur'];
 } elseif ($ucconfig == '-1') {
     //管理员密码无效
     $result['error'] = 1;
     $result['message'] = $_LANG['uc_msg_password_wrong'];
 } else {
     list($appauthkey, $appid) = explode('|', $ucconfig);
     if (empty($appauthkey) || empty($appid)) {
         //ucenter 安装数据错误
         $result['error'] = 1;
Пример #16
0
 public function check_fee()
 {
     $sms = new transport();
     $pwd = md5($this->sms['password'] . $this->sms['user_name']);
     $params = array("uid" => $this->sms['user_name'], "pwd" => $pwd);
     $url = "http://api.sms.cn/mm/";
     $result = $sms->request($url, $params);
     $jg = explode("&", $result);
     if ($jg[1] = 'stat=100') {
         $tiaoshu = explode('=', $jg[2]);
         $tiaoshu = $tiaoshu[1];
     }
     //$result = toArray($result['body'],"resRoot");
     $str = "短信平台,剩余:" . $tiaoshu . "条";
     return $str;
 }
Пример #17
0
 public static function apiCheck()
 {
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     $request_type = getRequestType();
     $apiCheck = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ver=' . utility::getVersion() . '&ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'get', 'timeout' => 10));
     $versions = utility::xml2arr($apiCheck);
     $error = false;
     if (count($versions) == 0) {
         // there was an error with the api
         $error = true;
         $errorMsg = preg_match("'<title[^>]*?>.*?</title>'si", $versions, $regs);
         $errorMsg = is_array($regs) ? strip_tags(end($regs)) : NULL;
         if ($errorMsg == '') {
             $errorMsg = 'Resource Unavailable at ' . $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ver=' . utility::getVersion() . '&ref=' . $_SERVER['SCRIPT_FILENAME'];
         }
         $error = true;
         // log the error
         self::log('Error: ' . $errorMsg);
     }
     if ($versions == null || $error) {
         // set the error flag
         return -1;
     }
     return 1;
 }
Пример #18
0
                }
                $api_arr['api_time'] = date('Ymd');
                write_static_cache('cloud_remind', $api_arr);
                make_json_result($api_arr['content']);
            } else {
                make_json_result('0');
            }
        } else {
            make_json_result('0');
        }
    } else {
        make_json_result($api_data['content']);
    }
} elseif ($act == 'close_remind') {
    $remind_id = $_REQUEST['remind_id'];
    $t = new transport('-1', 5);
    $apiget = "ver= {$data['version']} &ecs_lang= {$data['ecs_lang']} &charset= {$data['charset']} &certificate_id={$data['certificate_id']}&ent_id={$data['ent_id']}&remind_id={$remind_id}";
    $api_comment = $t->request('http://cloud..com/cloud_remind.php', $apiget);
    $api_str = $api_comment["body"];
    $json = new Services_JSON();
    $api_arr = array();
    $api_arr = @$json->decode($api_str, 1);
    if (!empty($api_str)) {
        if (!empty($api_arr) && $api_arr['error'] == 0 && md5($api_arr['content']) == $api_arr['hash']) {
            $api_arr['content'] = urldecode($api_arr['content']);
            if ($data['charset'] != 'UTF-8') {
                $api_arr['content'] = ecs_iconv('UTF-8', $data['charset'], $api_arr['content']);
            }
            if (admin_priv('all', '', false)) {
                $apiget .= "&act=close_remind&ent_ac={$data['ent_ac']}";
                $result = $t->request('http://cloud..com/cloud_remind.php', $apiget);
Пример #19
0
 private function _upsGetQuote()
 {
     if (!isset($this->_upsActionCode)) {
         $this->_upsActionCode = '4';
     }
     $request = join('&', array('accept_UPS_license_agreement=yes', '10_action=' . $this->_upsActionCode, '13_product=' . $this->_upsProductCode, '14_origCountry=' . $this->_upsOriginCountryCode, '15_origPostal=' . $this->_upsOriginPostalCode, '19_destPostal=' . $this->_upsDestPostalCode, '22_destCountry=' . $this->_upsDestCountryCode, '23_weight=' . $this->_upsPackageWeight, '47_rate_chart=' . $this->_upsRateCode, '48_container=' . $this->_upsContainerCode, '49_residential=' . $this->_upsResComCode));
     $response = transport::getResponse(array('url' => 'http://www.ups.com/using/services/rave/qcostcgi.cgi?' . $request, 'method' => 'get'));
     $body_array = explode("\n", $response);
     $returnval = array();
     $errorret = 'error';
     // only return error if NO rates returned
     $n = sizeof($body_array);
     for ($i = 0; $i < $n; $i++) {
         $result = explode('%', $body_array[$i]);
         $errcode = substr($result[0], -1);
         switch ($errcode) {
             case 3:
                 if (is_array($returnval)) {
                     $returnval[] = array($result[1] => $result[8]);
                 }
                 break;
             case 4:
                 if (is_array($returnval)) {
                     $returnval[] = array($result[1] => $result[8]);
                 }
                 break;
             case 5:
                 $errorret = $result[1];
                 break;
             case 6:
                 if (is_array($returnval)) {
                     $returnval[] = array($result[3] => $result[10]);
                 }
                 break;
         }
     }
     if (empty($returnval)) {
         $returnval = $errorret;
     }
     return $returnval;
 }
Пример #20
0
        $ocount = $order['stats']['oCount'];
        $oamount = $order['stats']['oAmount'];
        $goods['total'] = $db->GetOne('SELECT COUNT(*) FROM ' . $ecs->table('goods') . ' WHERE is_delete = 0 AND is_alone_sale = 1 AND is_real = 1');
        $gcount = $goods['total'];
        $ecs_charset = strtoupper(EC_CHARSET);
        $ecs_user = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('users'));
        $ecs_template = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'template\'');
        $style = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'stylename\'');
        if ($style == '') {
            $style = '0';
        }
        $ecs_style = $style;
        $shop_url = urlencode($ecs->url());
        $patch_file = file_get_contents(ROOT_PATH . ADMIN_PATH . "/patch_num");
        $apiget = "ver= {$ecs_version} &lang= {$ecs_lang} &release= {$ecs_release} &php_ver= {$php_ver} &mysql_ver= {$mysql_ver} &ocount= {$ocount} &oamount= {$oamount} &gcount= {$gcount} &charset= {$ecs_charset} &usecount= {$ecs_user} &template= {$ecs_template} &style= {$ecs_style} &url= {$shop_url} &patch= {$patch_file} ";
        $t = new transport();
        $api_comment = $t->request('http://api..com/checkver.php', $apiget);
        $api_str = $api_comment["body"];
        echo $api_str;
        $f = ROOT_PATH . 'data/config.php';
        file_put_contents($f, str_replace("'API_TIME', '" . API_TIME . "'", "'API_TIME', '" . date('Y-m-d H:i:s', time()) . "'", file_get_contents($f)));
        write_static_cache('api_str', $api_str);
    } else {
        echo $data;
    }
} elseif ($_REQUEST['act'] == 'first') {
    $smarty->assign('countries', get_regions());
    $smarty->assign('provinces', get_regions(1, 1));
    $smarty->assign('cities', get_regions(2, 2));
    $sql = 'SELECT value from ' . $ecs->table('shop_config') . " WHERE code='shop_name'";
    $shop_name = $db->getOne($sql);
Пример #21
0
 public function checkIdCard()
 {
     $return['status'] = 0;
     $card = trim($_REQUEST['card']);
     $url = "http://www.cz88.net/tools/id.php";
     require APP_ROOT_PATH . "/system/utils/transport.php";
     $transport = new transport();
     $result = $transport->request($url, "in_id=" . $card);
     $result = $result['body'];
     $result = iconv("gbk", "utf-8", $result);
     $result = str_replace(array("\r", "\n"), "", $result);
     preg_match_all("/<div class=\"box\">  <div class=\"name\">(.*?):<\\/div>  <div class=\"data\">(.*?)<\\/div> <\\/div>/i", $result, $matchs);
     $return = array();
     foreach ($matchs[2] as $kk => $vv) {
         if ($kk == 1) {
             $return['address'] = $vv;
         }
         if ($kk == 2) {
             $return['birthday'] = $vv;
         }
         if ($kk == 3) {
             $return['sex'] = $vv;
         }
         if ($kk == 4) {
             $return['cardNO'] = $vv;
         }
     }
     if ($return) {
         echo json_encode($return);
     } else {
         $return['status'] = 0;
         $return['info'] = '没找到';
         echo json_encode($return);
     }
 }
Пример #22
0
    } else {
        echo $data;
    }
} elseif ($_REQUEST['act'] == 'menu_api') {
    if (!admin_priv('all', '', false)) {
        exit;
    }
    require_once ROOT_PATH . '/includes/lib_base.php';
    $data = read_static_cache('menu_api');
    if ($data === false || isset($data['api_time']) && $data['api_time'] < date('dmY')) {
        include_once ROOT_PATH . 'includes/cls_transport.php';
        $ecs_lang = $_CFG['lang'];
        $ecs_charset = strtoupper(EC_CHARSET);
        $ecs_version = VERSION;
        $apiget = "ver= {$ecs_version} &ecs_lang= {$ecs_lang} &charset= {$ecs_charset} ";
        $t = new transport();
        $api_comment = $t->request('http://cloud.ecshop.com/menu_api.php', $apiget);
        $api_str = $api_comment["body"];
        if (!empty($api_str)) {
            include_once ROOT_PATH . 'includes/cls_json.php';
            $json = new JSON();
            $api_arr = @$json->decode($api_str, 1);
            if (!empty($api_arr) && $api_arr['error'] == 0 && md5($api_arr['content']) == $api_arr['hash']) {
                $api_arr['content'] = urldecode($api_arr['content']);
                if ($ecs_charset != 'UTF-8') {
                    $api_arr['content'] = ecs_iconv('UTF-8', $ecs_charset, $api_arr['content']);
                }
                echo $api_arr['content'];
                $api_arr['api_time'] = date('dmY');
                write_static_cache('menu_api', $api_arr);
                exit;
Пример #23
0
        $ecs_charset = strtoupper(EC_CHARSET);
        $ecs_user = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('users'));
        $ecs_template = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'template\'');
        $style = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . ' WHERE code = \'stylename\'');
        if($style == '')
        {
            $style = '0';
        }
        $ecs_style = $style;
        $shop_url = urlencode($ecs->url());

        $patch_file = file_get_contents(ROOT_PATH.ADMIN_PATH."/patch_num");

        $apiget = "ver= $ecs_version &lang= $ecs_lang &release= $ecs_release &php_ver= $php_ver &mysql_ver= $mysql_ver &ocount= $ocount &oamount= $oamount &gcount= $gcount &charset= $ecs_charset &usecount= $ecs_user &template= $ecs_template &style= $ecs_style &url= $shop_url &patch= $patch_file ";

        $t = new transport;
        $api_comment = $t->request('http://ecshop.ecmoban.com/checkver.php', $apiget);
        $api_str = $api_comment["body"];
        echo $api_str;
        
        $f=ROOT_PATH . 'data/config.php'; 
        file_put_contents($f,str_replace("'API_TIME', '".API_TIME."'","'API_TIME', '".date('Y-m-d H:i:s',time())."'",file_get_contents($f)));
        
        write_static_cache('api_str', $api_str);
    }
    else 
    {
        echo $data;
    }

}
Пример #24
0
<?php

// +----------------------------------------------------------------------
// | o2o商业系统
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://www.vonwey.com All rights reserved.
// +----------------------------------------------------------------------
/* 模块的基本信息 */
if (isset($read_modules) && $read_modules == true) {
    $module['server_url'] = 'http://esm2.9wtd.com:9001';
    $module['class_name'] = 'ESM';
    /* 名称 */
    $module['name'] = "ESM短信平台";
    if (ACTION_NAME == "install" || ACTION_NAME == "edit") {
        require_once APP_ROOT_PATH . "system/sms/FW/transport.php";
        $tran = new transport();
        $install_info = $tran->request($module['server_url'] . "data/install.php");
        $install_info = json_decode($install_info['body'], 1);
        $module['lang'] = $install_info['lang'];
        $module['config'] = $install_info['config'];
    }
    return $module;
}
// ESM短信平台
require_once APP_ROOT_PATH . "system/libs/sms.php";
//引入接口
require_once APP_ROOT_PATH . "system/sms/FW/transport.php";
class ESM_sms implements sms
{
    public $sms;
    public $message = "";
Пример #25
0
    $smarty->assign('enable_order_check', $_CFG['enable_order_check']);
} else {
    $smarty->assign('enable_order_check', 0);
}
/* 验证通行证信息 */
if (isset($_GET['ent_id']) && isset($_GET['ent_ac']) && isset($_GET['ent_sign']) && isset($_GET['ent_email'])) {
    $ent_id = trim($_GET['ent_id']);
    $ent_ac = trim($_GET['ent_ac']);
    $ent_sign = trim($_GET['ent_sign']);
    $ent_email = trim($_GET['ent_email']);
    $certificate_id = trim($_CFG['certificate_id']);
    $domain_url = $ecs->url();
    $token = $_GET['token'];
    if ($token == md5(md5($_CFG['token']) . $domain_url . ADMIN_PATH)) {
        require ROOT_PATH . 'includes/cls_transport.php';
        $t = new transport('-1', 5);
        $apiget = "act=ent_sign&ent_id= {$ent_id} & certificate_id={$certificate_id}";
        $t->request('http://cloud.ecshop.com/api.php', $apiget);
        $db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_id . '" WHERE code = "ent_id"');
        $db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_ac . '" WHERE code = "ent_ac"');
        $db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_sign . '" WHERE code = "ent_sign"');
        $db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_email . '" WHERE code = "ent_email"');
        clear_cache_files();
        ecs_header("Location: ./index.php\n");
    }
}
/* 验证管理员身份 */
if ((!isset($_SESSION['admin_id']) || intval($_SESSION['admin_id']) <= 0) && $_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'signin' && $_REQUEST['act'] != 'forget_pwd' && $_REQUEST['act'] != 'reset_pwd' && $_REQUEST['act'] != 'check_order') {
    /* session 不存在,检查cookie */
    if (!empty($_COOKIE['ECSCP']['admin_id']) && !empty($_COOKIE['ECSCP']['admin_pass'])) {
        // 找到了cookie, 验证cookie信息
Пример #26
0
 public static function getAddonPhar($key, $type = 'addon')
 {
     // remove the old phar if it exists
     if (file_exists(DIR_FS_WORK . 'addons/' . $key . '.phar')) {
         unlink(DIR_FS_WORK . 'addons/' . $key . '.phar');
     }
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     // add the pubkey
     $pubkey = file_get_contents(DIR_FS_WORK . 'addons/update.phar.pubkey');
     file_put_contents(DIR_FS_WORK . 'addons/' . $key . '.phar.pubkey', $pubkey);
     $request_type = getRequestType();
     $response = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/get/' . $key . '?type=addon&ver=' . utility::getVersion() . '&ref=' . urlencode($_SERVER['SCRIPT_FILENAME']), 'method' => 'get', 'timeout' => 10));
     if (strlen($response) == 0) {
         $response = file_get_contents($request_type . '://api.loadedcommerce.com/' . $api_version . '/get/' . $key . '?type=addon&ver=' . utility::getVersion() . '&ref=' . urlencode($_SERVER['SCRIPT_FILENAME']));
     }
     return file_put_contents(DIR_FS_WORK . 'addons/' . $key . '.phar', $response);
 }