예제 #1
0
function getLoginConfigure()
{
    $svalue = C::t('common_setting')->fetch("bigapp_longin_register_setting", false);
    $params = BIGAPPJSON::decode($svalue, true);
    if (empty($params)) {
        $params["login_mod"] = 0;
        $params["login_url"] = "";
        $params["reg_mod"] = 0;
        $params["reg_url"] = "";
        $params["reg_switch"] = 1;
        $params["allow_avatar_change"] = 1;
    } else {
        if ($params['login_mod'] == 0) {
            $params['login_url'] = "";
        }
        if ($params['reg_mod'] == 0) {
            $params['reg_url'] = "";
        }
    }
    return $params;
}
예제 #2
0
 function getOauthCode($userName, $password, $state)
 {
     $posts = BigAppConf::$login3BodyInfo;
     unset($posts['passport_url']);
     $posts['state'] = $state;
     $posts['LoginForm'] = array('username' => $userName, 'password' => $password);
     $ch = curl_init();
     $opt = array(CURLOPT_URL => BigAppConf::$login3BodyInfo['passport_url'], CURLOPT_POST => 1, CURLOPT_POSTFIELDS => http_build_query($posts), CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => 1, CURLOPT_TIMEOUT => 2, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0);
     curl_setopt_array($ch, $opt);
     $data = @curl_exec($ch);
     curl_close($ch);
     $ret = @BIGAPPJSON::decode($data, true);
     if (!is_array($ret) || !isset($ret['status'])) {
         bigapp_core::result(array('error' => 'passport_error', 'error_msg' => 'access passport failed'));
     }
     if (0 == $ret['status']) {
         bigapp_core::result(array('error' => 'login_failed', 'error_msg' => $ret['message']));
     }
     $url = $ret['msg'];
     $arrUrl = parse_url($url);
     if (!is_array($arrUrl) || !isset($arrUrl['query'])) {
         bigapp_core::result(array('error' => 'passport_error', 'error_msg' => 'no query string was found in returned msg'));
     }
     $tmp = explode('&', $arrUrl['query']);
     $code = null;
     foreach ($tmp as $v) {
         if (false !== strpos($v, 'code=')) {
             $code = str_replace('code=', '', $v);
             break;
         }
     }
     if (is_null($code)) {
         bigapp_core::result(array('error' => 'passport_error', 'error_msg' => 'query string was invalid'));
     }
     return $code;
 }
예제 #3
0
 public function curlInfo($url, $postData = null)
 {
     $ch = curl_init();
     if (!is_null($postData)) {
         $curlPost = http_build_query($postData);
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
     }
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
     curl_setopt($ch, CURLOPT_TIMEOUT, 20);
     curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
     $data = curl_exec($ch);
     $errorInfo = curl_error($ch);
     if (!empty($errorInfo)) {
         $data = array();
     }
     curl_close($ch);
     return BIGAPPJSON::decode($data);
 }
예제 #4
0
function prepCreateTask()
{
    global $_G;
    $param = array();
    $oldParam = array();
    if (isset($_GET['old_params'])) {
        $oldParam = BIGAPPJSON::decode($_GET['old_params'], true);
    }
    //$arrNeedParam = array('nav_color', 'icon_image', 'startup_image', 'os', 'plugin_version', 'bbs_name', 'app_name', 'package_name', 'channel_name');
    //////////////////////////////////////////////////////
    $arrNeedParam = array('nav_color', 'icon_image', 'startup_image', 'os', 'plugin_version', 'bbs_name', 'app_name', 'package_name', 'channel_name', 'version_name', 'push_enabled', 'key_alias', 'store_password', 'key_password', 'app_id_wechat', 'sec_key_wechat', 'app_id_qq', 'sec_key_qq', 'app_id_sina', 'sec_key_sina', 'jpush_app_key', 'jpush_master_secret', 'jpush_is_free');
    /////////////////////////////////////////////////////
    $param['method'] = 'create';
    $param['plugin_version'] = '0.0.0';
    if (isset($_G['setting']['plugins']['version']['bigapp'])) {
        $param['plugin_version'] = $_G['setting']['plugins']['version']['bigapp'];
    }
    //$param['plugin_version'] = '2.0.0';//测试用
    if (isset($_REQUEST['os']) && is_array($_REQUEST['os']) && !empty($_REQUEST['os'])) {
        foreach ($_REQUEST['os'] as $v) {
            $os += 1 << $v;
        }
        $_REQUEST['os'] = $os;
    }
    foreach ($arrNeedParam as $key) {
        if (isset($_REQUEST[$key])) {
            if ('icon_image' === $key || 'startup_image' === $key) {
                $_REQUEST[$key] = htmlspecialchars_decode($_REQUEST[$key]);
            }
            $param[$key] = $_REQUEST[$key];
        }
    }
    checkParams($param);
    return $param;
}
예제 #5
0
function accessMe($pmid)
{
    global $_G;
    if (true === BigAppConf::$debug) {
        $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
    }
    $ch = curl_init();
    prepareCurl($ch, $pmid);
    $data = curl_exec($ch);
    curl_close($ch);
    $ret = BIGAPPJSON::decode($data, true);
    if (!is_array($ret)) {
        return 0;
    }
    return $ret;
}
예제 #6
0
 public function getInfoByPost($url, $param, $checkRes = true)
 {
     if (!isset($param['timestamp'])) {
         $check['timestamp'] = time();
     }
     if (!isset($param['expire']) && !is_null($this->_expire)) {
         $check['expire'] = $this->_expire;
     }
     if (!isset($param['v']) && !is_null($this->_v)) {
         $check['v'] = $this->_v;
     }
     $this->_checkCode($param);
     $sign = $this->_makeSign(true, $url, $check);
     $check['sign'] = $sign;
     $tmp = Utils::addUrlQueryString($url, $check);
     $rawResult = $this->_curlInfo($tmp, $param);
     $arrResult = @BIGAPPJSON::decode($rawResult, true);
     if (true === $checkRes) {
         if (is_array($arrResult) && $arrResult['error_code'] == 0) {
             runlog('bigapp', "post, need check and succ, url: {$tmp}, ret: {$rawResult}");
             return $arrResult['data'];
         }
         runlog('bigapp', "post, need check but failed, url: {$tmp}, ret: {$rawResult}");
         return false;
     }
     runlog('bigapp', "post, need not check, finished, url: {$tmp}, ret: {$rawResult}");
     return $arrResult;
 }
예제 #7
0
 public static function getCheckJson()
 {
     global $_G;
     if (file_exists(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/data/sysdata/cache_mobile.php')) {
         @(require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/data/sysdata/cache_mobile.php');
     } else {
         $mobilecheck = '[]';
     }
     if (isset($mobilecheck)) {
         $mobilecheck = BIGAPPJSON::decode($mobilecheck, true);
         if (!is_array($mobilecheck)) {
             $mobilecheck = array();
         }
     }
     if (isset($_G['charset'])) {
         $mobilecheck['charset'] = $_G['charset'];
     }
     if (isset($_G['setting']['version'])) {
         $mobilecheck['discuzversion'] = $_G['setting']['version'];
     }
     if (isset($_G['setting']['sitename'])) {
         $mobilecheck['sitename'] = $_G['setting']['sitename'];
     }
     if (isset($_G['setting']['ucenterurl'])) {
         $mobilecheck['ucenterurl'] = $_G['setting']['ucenterurl'];
     }
     $mobilecheck['plugin_info'] = array('mobile' => array('enabled' => 0, 'version' => 'NA'), 'bigapp' => array('enabled' => 0, 'version' => 'NA'));
     //die(json_encode($_G['setting']['plugins']));
     $lostPlugin = array();
     foreach ($mobilecheck['plugin_info'] as $plugin => &$info) {
         if (isset($_G['setting']['plugins']['available']) && in_array($plugin, $_G['setting']['plugins']['available'])) {
             $info['enabled'] = 1;
         } else {
             $lostPlugin[] = $plugin;
         }
         if (isset($_G['setting']['plugins']['version'][$plugin])) {
             $info['version'] = $_G['setting']['plugins']['version'][$plugin];
         }
     }
     $mobilecheck['bigapp_api_status'] = 'AVAILABLE';
     if (!empty($lostPlugin)) {
         $mobilecheck['bigapp_api_status'] = 'UNAVAILABLE, plugin(s) [ ' . implode(', ', $lostPlugin) . ' ] do not exist or have been closed';
     }
     $mobDir = dirname(dirname(__FILE__)) . '/mobile';
     if (!is_dir($mobDir)) {
         $mobilecheck['plugin_info']['mobile']['dir_check'] = 0;
         $mobilecheck['bigapp_api_status'] = 'UNAVAILABLE, mobile plugin dir [' . $mobDir . '] does not exist';
     }
     $mobilecheck['inner_edition'] = '__INNER_EDITION__';
     if (strpos($mobilecheck['inner_edition'], 'INNER_EDITION') !== false) {
         $mobilecheck['inner_edition'] = 'NA';
     }
     $mobilecheck['mobile_enabled'] = 0;
     if (isset($_G['setting']['mobile']['allowmobile']) && $_G['setting']['mobile']['allowmobile']) {
         $mobilecheck['mobile_enabled'] = 1;
     }
     $mobilecheck['bbclosed'] = 0;
     if (isset($_G['setting']['bbclosed']) && $_G['setting']['bbclosed']) {
         $mobilecheck['bbclosed'] = 1;
     }
     return $mobilecheck;
 }
예제 #8
0
 protected function _disableSecCode()
 {
     global $_G;
     if (true === BigAppConf::$debug) {
         $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
     }
     //make client's operation more simple
     $_G['setting']['seccodedata'] = BIGAPPJSON::decode('{"cloudip":"0","rule":{"register":{"allow":"0","numlimit":"",' . '"timelimit":"60"},"login":{"allow":"0","nolocal":"0","pwsimple":"0","pwerror":"0","outofday":"","numiptry":"",' . '"timeiptry":"60"},"post":{"allow":"0","numlimit":"","timelimit":"60","nplimit":"","vplimit":""},"password":{"allow":"0"},' . '"card":{"allow":"0"}},"minposts":"","type":"0","width":100,"height":30,"scatter":"","background":"0","adulterate":"0",' . '"ttf":"0","angle":"0","warping":"0","color":"0","size":"0","shadow":"0","animator":"0"}', true);
     $tmp = BIGAPPJSON::decode('{"allowmobile":1,"mobileseccode":0,"mobilehotthread":1,"mobiledisplayorder3":1}', true);
     $_G['setting']['mobile'] = $tmp + $_G['setting']['mobile'];
     $_G['setting']['secqaa']['status'] = 0;
     $_G['cache']['plugin']['dsu_paulsign']['ftopen'] = 0;
     //close dsu plugin location
 }