function common() { include_once 'source/language/lang_admincp_login.php'; $data = array(array('questionid' => "0", "question" => $lang['security_question_0']), array('questionid' => "1", "question" => $lang['security_question_1']), array('questionid' => "2", "question" => $lang['security_question_2']), array('questionid' => "3", "question" => $lang['security_question_3']), array('questionid' => "4", "question" => $lang['security_question_4']), array('questionid' => "5", "question" => $lang['security_question_5']), array('questionid' => "6", "question" => $lang['security_question_6']), array('questionid' => "7", "question" => $lang['security_question_7'])); echo BIGAPPJSON::encode(array('error_code' => 0, 'error_msg' => 'succ', 'data' => $data)); die(0); }
public static function getAkSkMd5() { /*{{{*/ $aksk = self::getAkSk(); if ($aksk === false) { return ""; } $vf = BIGAPPJSON::encode($aksk); return md5($vf); }
public static function sendMessage($params) { $paramRet = json_encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100801, 'error_msg' => 'invalid param', 'show_tips' => '参数错误')); $authRet = json_encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100802, 'error_msg' => 'auth failed', 'show_tips' => '必须是管理员帐号才可执行此操作')); $akskRet = json_encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100803, 'error_msg' => 'auth failed', 'show_tips' => '您尚未在应用设置中填写jpush的appkey或master_secret,无法发送消息')); $svrRet = json_encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100804, 'error_msg' => 'internal server error', 'show_tips' => '服务器内部错误')); $aliasRet = json_encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100805, 'error_msg' => 'invalid alias', 'show_tips' => '请在网络良好的环境下开启客户端')); $jpushkeyRet = json_encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100806, 'error_msg' => 'jpush key lost', 'show_tips' => '请申请您自己的JpushKey并在生成应用填写该key')); $reqparams = self::$default_reqpack; if (isset($params["alias"])) { $reqparams["alias"] = $params["alias"]; } if (isset($params["message_type"])) { $reqparams["message_type"] = $params["message_type"]; } if (isset($params["mask"])) { $reqparams["mask"] = $params["mask"]; } if (isset($params["title"])) { $reqparams["title"] = $params["title"]; } if (isset($params["content"])) { $reqparams["content"] = $params["content"]; } if (isset($params["extra"])) { $reqparams["extra"] = $params["extra"]; } if (isset($params["istest"])) { $reqparams["istest"] = $params["istest"]; } $aksk = BigappEnv::getAkSk(); $ak = $aksk["ak"]; $sk = $aksk["sk"]; $obj = new BkSvr($ak, $sk, 30); $ret = $obj->getInfo(BigAppConf::$pushUrl, $reqparams, false, false); if (false === $ret || 0 != $ret['error_code']) { if (100020 == $ret['error_code']) { $aliasRet['show_tips'] .= '并以' . $_G['username'] . '帐号登录,然后重试'; $aliasRet = BIGAPPJSON::encode($aliasRet); return $aliasRet; } if (100021 == $ret['error_code']) { return $akskRet; } if (100022 == $ret['error_code']) { return $jpushkeyRet; } return $svrRet; } C::t("#bigapp#bigapp_push_message")->save($reqparams); return json_encode($ret); }
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; }
public static function sendMessage($uid, $title, $content, $msgType, $extra = null, $mask = 3, $jpushAk = null, $jpushSk = null) { global $_G; $tmp = Utils::readLocalAkSk2(); if (!isset($tmp['app_key']) || !isset($tmp['app_secret'])) { return false; } $ak = $tmp['app_key']; $sk = $tmp['app_secret']; $appInfo = self::getAppInfo($ak, $sk); if (!isset($appInfo['app_id'])) { return false; } $appId = $appInfo['app_id']; $alias = sprintf('%020lu%020lu', $appId, $uid); $params = array('alias' => $alias, 'mask' => $mask, 'message_type' => $msgType, 'title' => $title, 'content' => $content); if (is_array($extra)) { $params['extra'] = BIGAPPJSON::encode($extra); } if (!is_null($jpushAk) && !is_null($jpushSk)) { $params['jpush_app_key'] = $jpushAk; $params['jpush_master_secret'] = $jpushSk; } $url = BigAppConf::$pushUrl; $obj = new BkSvr($ak, $sk, 30); $ret = $obj->getInfo($url, $params, false, false); if (!is_array($ret)) { runlog('bigapp', 'send message failed, invalid return [ ret: ' . $ret . ' ]'); return false; } if (0 != $ret['error_code']) { runlog('bigapp', 'send message failed, error code is not 0 [ ret: ' . BIGAPPJSON::encode($ret) . ' ]'); return $ret; } return true; }
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; }
function register() { /*{{{*/ require_once dirname(dirname(dirname(__FILE__))) . '/bigappjson.class.php'; require_once libfile('function/misc'); require_once libfile('function/member'); require_once libfile('class/member'); $userName = isset($_REQUEST["username"]) ? $_REQUEST["username"] : ""; $password = isset($_REQUEST["password"]) ? $_REQUEST["password"] : ""; $email = isset($_REQUEST["email"]) ? strtolower($_REQUEST["email"]) : ""; global $_G; if (function_exists('iconv')) { $userName = iconv('UTF-8', CHARSET . '//ignore', $userName); } else { $userName = mb_convert_encoding($userName, CHARSET, 'UTF-8'); } if (empty($userName) || empty($password) || empty($email)) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'empty_params'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'empty_params')))); die(0); } $userNamelen = dstrlen($userName); if ($userNamelen < 3) { echo BIGAPPJSON::encode(array('error_code' => 3, 'error_msg' => lang('plugin/bigapp', 'username_short'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_short')))); die(0); } if ($userNamelen > 15) { echo BIGAPPJSON::encode(array('error_code' => 4, 'error_msg' => lang('plugin/bigapp', 'username_long'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_long')))); die(0); } $ctlObj = new register_ctl(); $ctlObj->setting = $_G['setting']; if (isset($ctlObj->setting['pwlength']) && $ctlObj->setting['pwlength']) { if (strlen($password) < $ctlObj->setting['pwlength']) { echo BIGAPPJSON::encode(array('error_code' => 5, 'error_msg' => lang('plugin/bigapp', 'password_length') . ' [ >= ' . $ctlObj->setting['pwlength'] . ' ]', 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_not_equal') . ' [ >= ' . $ctlObj->setting['pwlength'] . ' ]'))); die(0); } } if (isset($ctlObj->setting['strongpw']) && $ctlObj->setting['strongpw']) { $strongpw_str = array(); if (in_array(1, $ctlObj->setting['strongpw']) && !preg_match("/\\d+/", $password)) { $strongpw_str[] = lang('plugin/bigapp', 'password_number'); } if (in_array(2, $ctlObj->setting['strongpw']) && !preg_match("/[a-z]+/", $password)) { $strongpw_str[] = lang('plugin/bigapp', 'password_lowercase_char'); } if (in_array(3, $ctlObj->setting['strongpw']) && !preg_match("/[A-Z]+/", $password)) { $strongpw_str[] = lang('plugin/bigapp', 'password_uppercase_char'); } if (in_array(4, $ctlObj->setting['strongpw']) && !preg_match("/[^a-zA-Z0-9]+/", $password)) { $strongpw_str[] = lang('plugin/bigapp', 'password_charset'); } if ($strongpw_str) { echo BIGAPPJSON::encode(array('error_code' => 6, 'error_msg' => lang('plugin/bigapp', 'password_invalid') . ' [ ' . implode(', ', $strongpw_str) . ' ]', 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_invalid') . ' [ ' . implode(', ', $strongpw_str) . ' ]'))); die(0); } } /* if(!isset($_G['setting']['mobile']['mobileregister']) || !$_G['setting']['mobile']['mobileregister']){ echo BIGAPPJSON::encode(array('error_code' => 7, 'error_msg' => lang('plugin/bigapp', 'forbid_mobreg'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_mobreg')))); die(0); } */ loaducenter(); if (!$ctlObj->setting['regclosed'] && (!$ctlObj->setting['regstatus'] || !$ctlObj->setting['ucactivation'])) { if (!$ctlObj->setting['regstatus']) { echo BIGAPPJSON::encode(array('error_code' => 8, 'error_msg' => lang('plugin/bigapp', 'forbid_registration'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_registration')))); die(0); } } if ($ctlObj->setting['regverify']) { if ($ctlObj->setting['areaverifywhite']) { $location = $whitearea = ''; $location = trim(convertip($_G['clientip'], "./")); if ($location) { $whitearea = preg_quote(trim($ctlObj->setting['areaverifywhite']), '/'); $whitearea = str_replace(array("\\*"), array('.*'), $whitearea); $whitearea = '.*' . $whitearea . '.*'; $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i'; if (@preg_match($whitearea, $location)) { $ctlObj->setting['regverify'] = 0; } } } if ($_G['cache']['ipctrl']['ipverifywhite']) { foreach (explode("\n", $_G['cache']['ipctrl']['ipverifywhite']) as $ctrlip) { if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) { $ctlObj->setting['regverify'] = 0; break; } } } } if ($ctlObj->setting['regverify']) { $groupinfo['groupid'] = 8; } else { $groupinfo['groupid'] = $ctlObj->setting['newusergroupid']; } if (!$password || $password != addslashes($password)) { echo BIGAPPJSON::encode(array('error_code' => 9, 'error_msg' => lang('plugin/bigapp', 'password_invalid_char'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_invalid_char')))); die(0); } $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($ctlObj->setting['censoruser'] = trim($ctlObj->setting['censoruser']), '/')) . ')$/i'; if ($ctlObj->setting['censoruser'] && @preg_match($censorexp, $userName)) { echo BIGAPPJSON::encode(array('error_code' => 10, 'error_msg' => lang('plugin/bigapp', 'forbid_username'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_username')))); die(0); } if ($_G['cache']['ipctrl']['ipregctrl']) { foreach (explode("\n", $_G['cache']['ipctrl']['ipregctrl']) as $ctrlip) { if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) { $ctrlip = $ctrlip . '%'; $ctlObj->setting['regctrl'] = $ctlObj->setting['ipregctrltime']; break; } else { $ctrlip = $_G['clientip']; } } } else { $ctrlip = $_G['clientip']; } if ($ctlObj->setting['regctrl']) { if (C::t('common_regip')->count_by_ip_dateline($ctrlip, $_G['timestamp'] - $ctlObj->setting['regctrl'] * 3600)) { echo BIGAPPJSON::encode(array('error_code' => 11, 'error_msg' => lang('plugin/bigapp', 'forbid_ip'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_ip')))); die(0); } } $setregip = null; if ($ctlObj->setting['regfloodctrl']) { $regip = C::t('common_regip')->fetch_by_ip_dateline($_G['clientip'], $_G['timestamp'] - 86400); if ($regip) { if ($regip['count'] >= $ctlObj->setting['regfloodctrl']) { echo BIGAPPJSON::encode(array('error_code' => 12, 'error_msg' => lang('plugin/bigapp', 'forbid_ip_today'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_ip_today')))); die(0); } else { $setregip = 1; } } else { $setregip = 2; } } $uid = uc_user_register($userName, $password, $email, '', '', $_G['clientip']); if ($uid <= 0) { if ($uid == -1) { echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'username_invalid_char'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_invalid_char')))); } elseif ($uid == -2) { echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'username_invalid_char'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_invalid_char')))); } elseif ($uid == -3) { echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'username_used'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_used')))); } elseif ($uid == -4) { echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'invalid_email'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'invalid_email')))); } elseif ($uid == -5) { echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'invalid_email'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'invalid_email')))); } elseif ($uid == -6) { echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'email_used'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'email_used')))); } die(0); } $_G['username'] = $userName; $password = md5(random(10)); if ($setregip !== null) { if ($setregip == 1) { C::t('common_regip')->update_count_by_ip($_G['clientip']); } else { C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => 1, 'dateline' => $_G['timestamp'])); } } $profile = $verifyarr = array(); $emailstatus = 0; $init_arr = array('credits' => explode(',', $ctlObj->setting['initcredits']), 'profile' => $profile, 'emailstatus' => $emailstatus); C::t('common_member')->insert($uid, $userName, $password, $email, $_G['clientip'], $groupinfo['groupid'], $init_arr); if ($ctlObj->setting['regctrl'] || $ctlObj->setting['regfloodctrl']) { C::t('common_regip')->delete_by_dateline($_G['timestamp'] - ($ctlObj->setting['regctrl'] > 72 ? $ctlObj->setting['regctrl'] : 72) * 3600); if ($ctlObj->setting['regctrl']) { C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => -1, 'dateline' => $_G['timestamp'])); } } if ($ctlObj->setting['regverify'] == 1) { $idstring = random(6); $authstr = $ctlObj->setting['regverify'] == 1 ? "{$_G['timestamp']}\t2\t{$idstring}" : ''; C::t('common_member_field_forum')->update($uid, array('authstr' => $authstr)); $verifyurl = "{$_G[siteurl]}member.php?mod=activate&uid={$uid}&id={$idstring}"; $email_verify_message = lang('email', 'email_verify_message', array('username' => $username, 'bbname' => $ctlObj->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $verifyurl)); if (!sendmail("{$username} <{$email}>", lang('email', 'email_verify_subject'), $email_verify_message)) { runlog('sendmail', "{$email} sendmail failed."); } } require_once libfile('cache/userstats', 'function'); build_cache_userstats(); $_GET['regmessage'] = 'from bigapp client'; $regmessage = dhtmlspecialchars($_GET['regmessage']); if ($ctlObj->setting['regverify'] == 2) { C::t('common_member_validate')->insert(array('uid' => $uid, 'submitdate' => $_G['timestamp'], 'moddate' => 0, 'admin' => '', 'submittimes' => 1, 'status' => 0, 'message' => $regmessage, 'remark' => ''), false, true); manage_addnotify('verifyuser'); } setloginstatus(array('uid' => $uid, 'username' => $_G['username'], 'password' => $password, 'groupid' => $groupinfo['groupid']), 0); include_once libfile('function/stat'); updatestat('register'); checkfollowfeed(); C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP)); //////////////////////////////////////////////// // 注册成功,绑定第三方openid $plat = $_GET["platform"]; if ($plat == "qq") { include_once CUR_PATH . "/../qqconnect/bind.php"; } else { if ($plat == "wechat") { include_once CUR_PATH . "/../wechatconnect/bind.php"; } } //////////////////////////////////////////////// echo BIGAPPJSON::encode(array('error_code' => 0, 'error_msg' => lang('plugin/bigapp', 'regist_succ'), 'Message' => array('messageval' => 'register_succeed', 'messagestr' => lang('plugin/bigapp', 'regist_succ')), 'Variables' => array('auth' => 'in order to be comapatible'))); die(0); }
$result['msg'] = "Succ"; echo BIGAPPJSON::encode($result); die(0); } else { if (isset($_GET["method"]) && $_GET["method"] == "get") { //获取setting数据 require_once libfile('function/cache'); updatecache('setting'); if (isset($_G['setting']['bigapp_settings'])) { $_G['setting']['bigapp_settings'] = unserialize($_G['setting']['bigapp_settings']); } //主题列表多图样式 if (!isset($_G['setting']['bigapp_settings']['threadlist_image_mode'])) { $_G['setting']['bigapp_settings']['threadlist_image_mode'] = '1'; } //图片优化是否开启 if (!isset($_G['setting']['bigapp_settings']['enable_pic_opt'])) { $_G['setting']['bigapp_settings']['enable_pic_opt'] = '1'; } //回复按钮样式 if (!isset($_G['setting']['bigapp_settings']['reply_button_type'])) { $_G['setting']['bigapp_settings']['reply_button_type'] = '0'; } $setting = array('threadlist_image_mode' => $_G['setting']['bigapp_settings']['threadlist_image_mode'], 'enable_pic_opt' => $_G['setting']['bigapp_settings']['enable_pic_opt'], 'reply_button_type' => $_G['setting']['bigapp_settings']['reply_button_type']); $result['data'] = $setting; $result['code'] = '0'; $result['msg'] = "Succ"; echo BIGAPPJSON::encode($result); die(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); }
function common() { global $_G; $space = getuserbyuid($_G['uid']); if (empty($space)) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'cant find user info'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'cant find user info')))); die(0); } $membersql = $memberfieldsql = $authstradd1 = $authstradd2 = $newpasswdadd = ''; $setarr = array(); $emailnew = dhtmlspecialchars($_GET['emailnew']); $ignorepassword = 0; if (empty($_GET['newpassword'])) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'empty_params'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'empty_params')))); die(0); } if (!isset($_GET['questionidnew']) || $_GET['questionidnew'] === '') { $_GET['questionidnew'] = $_GET['answernew'] = ''; } else { $secquesnew = $_GET['questionidnew'] > 0 ? random(8) : ''; } //密码强度,取消 $strongpw = false; if ($strongpw && !empty($_GET['newpassword']) && $_G['setting']['strongpw']) { $strongpw_str = array(); if (in_array(1, $_G['setting']['strongpw']) && !preg_match("/\\d+/", $_GET['newpassword'])) { $strongpw_str[] = lang('member/template', 'strongpw_1'); } if (in_array(2, $_G['setting']['strongpw']) && !preg_match("/[a-z]+/", $_GET['newpassword'])) { $strongpw_str[] = lang('member/template', 'strongpw_2'); } if (in_array(3, $_G['setting']['strongpw']) && !preg_match("/[A-Z]+/", $_GET['newpassword'])) { $strongpw_str[] = lang('member/template', 'strongpw_3'); } if (in_array(4, $_G['setting']['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['newpassword'])) { $strongpw_str[] = lang('member/template', 'strongpw_4'); } if ($strongpw_str) { showmessage(lang('member/template', 'password_weak') . implode(',', $strongpw_str)); } } if (!empty($_GET['newpassword']) && $_GET['newpassword'] != addslashes($_GET['newpassword'])) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'password illegal'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password illegal')))); } if (!empty($_GET['newpassword']) && $_GET['newpassword'] != $_GET['newpassword2']) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'password notmatch'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password notmatch')))); die(0); } loaducenter(); //检测email,可以省略 if (false && $emailnew != $_G['member']['email']) { include_once libfile('function/member'); checkemail($emailnew); } $ucresult = uc_user_edit(addslashes($_G['username']), $_GET['oldpassword'], $_GET['newpassword'], '', $ignorepassword, $_GET['questionidnew'], $_GET['answernew']); if ($ucresult == -1) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'password wrong'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password wrong')))); die(0); } elseif ($ucresult == -4) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'email illegal'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'email illegal')))); die(0); } elseif ($ucresult == -5) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'email domain illegal'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'email domain illegal')))); die(0); } elseif ($ucresult == -6) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'email duplicate'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'email duplicate')))); die(0); } if (!empty($_GET['newpassword']) || $secquesnew) { $setarr['password'] = md5(random(10)); } $authstr = false; if (false && $emailnew != $_G['member']['email']) { $authstr = true; emailcheck_send($space['uid'], $emailnew); dsetcookie('newemail', "{$space['uid']}\t{$emailnew}\t{$_G['timestamp']}", 31536000); } if ($setarr) { if ($_G['member']['freeze'] == 1) { $setarr['freeze'] = 0; } C::t('common_member')->update($_G['uid'], $setarr); } if ($_G['member']['freeze'] == 2) { C::t('common_member_validate')->update($_G['uid'], array('message' => dhtmlspecialchars($_G['gp_freezereson']))); } echo BIGAPPJSON::encode(array('error_code' => 0, 'error_msg' => lang('plugin/bigapp', 'succ'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => '', 'messagestr' => lang('plugin/bigapp', 'succ')))); die(0); }
<?php /** * @file checknewpm.php * @Brief check whether there are new pms * @author youzu * @version 1.0.0 * @date 2015-07-07 */ if (!defined('IN_MOBILE_API')) { exit('Access Denied'); } define('APPTYPEID', 0); define('CURSCRIPT', 'member'); require './source/class/class_core.php'; $discuz = C::app(); $discuz->init(); loaducenter(); $newpm['newpm'] = intval(uc_pm_checknew($_G['uid'])); require_once dirname(dirname(dirname(__FILE__))) . '/bigappjson.class.php'; echo BIGAPPJSON::encode($newpm); die(0);
return; } require '../../../source/class/class_core.php'; $discuz = C::app(); $discuz->cachelist = array(); $discuz->init(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @(include 'bigapp.class.php'); require_once dirname(__FILE__) . '/libs/utils.inc.php'; define("PLUGIN_INNER_VERSION", "9143"); $mobilecheck = Utils::getCheckJson(); if (isset($mobilecheck['plugin_info']['bigapp']['version'])) { $mobilecheck['plugin_info']['bigapp']['version'] .= "." . PLUGIN_INNER_VERSION; } if (isset($_GET['json']) && $_GET['json']) { echo BIGAPPJSON::encode($mobilecheck); die(0); } header("Content-type:text/html;charset=utf-8"); $output = <<<EOF <html> <style type="text/css"> table.gridtable { \tfont-family: verdana,arial,sans-serif; \tfont-size:13px; \tcolor:#333333; \tborder-width: 1px; \tborder-color: #666666; \tborder-collapse: collapse; } table.gridtable th {
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; }
if (isset($_REQUEST["ajax"]) && $_REQUEST['ajax'] == 1) { require_once dirname(__FILE__) . "/models/push/JpushClient.php"; $paramRet = BIGAPPJSON::encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100802, 'error_msg' => 'invalid param')); $authRet = BIGAPPJSON::encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100803, 'error_msg' => 'auth failed')); $svrRet = BIGAPPJSON::encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100800, 'error_msg' => 'internal server error')); if (!isset($_G['groupid']) || 1 != $_G['groupid']) { echo $authRet; die(0); } //1. 发送消息 if ($_REQUEST["action"] == 'submit') { $params = array("alias" => "all", "title" => $_REQUEST["title"], "content" => $_REQUEST["msg"], "istest" => 0); $ret = Bigapp_JpushClient::sendMessage($params); echo $ret; } else { if ($_REQUEST["action"] == 'query') { $resData = C::t("#bigapp#bigapp_push_message")->query(); echo BIGAPPJSON::encode(array("data" => $resData)); } else { echo $paramRet; } } die(0); } require_once dirname(__FILE__) . '/libs/menu.inc.php'; require_once dirname(__FILE__) . '/libs/verify.inc.php'; $params = array("groupid" => isset($_G['groupid']) ? intval($_G['groupid']) : 7, "appid" => $appid, "api" => BigappEnv::getSiteUrl() . "/plugin.php?id=bigapp:pushmsg&ajax=1"); $tplVars = array("plugin_path" => BigappEnv::getPluginPath()); Utils::loadTemplate(dirname(__FILE__) . '/view/pushmsg.tpl', $params, $tplVars); runlog('bigapp', 'show pushmsg page succ'); // vim600: sw=4 ts=4 fdm=marker syn=php
$akskRet = BIGAPPJSON::encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100803, 'error_msg' => 'auth failed', 'show_tips' => '__DONT_DICONV_TO_UTF8___您尚未在应用设置中填写jpush的appkey或master_secret,无法发送测试消息')); $svrRet = BIGAPPJSON::encode(array('request_id' => rand(1000000, 10000000000), 'error_code' => 100804, 'error_msg' => 'internal server error', 'show_tips' => '__DONT_DICONV_TO_UTF8___服务器内部错误')); $aliasRet = array('request_id' => rand(1000000, 10000000000), 'error_code' => 100805, 'error_msg' => 'invalid alias', 'show_tips' => '__DONT_DICONV_TO_UTF8___请在网络良好的环境下开启客户端'); header('Content-Type: text/html; charset=utf-8'); if (!isset($_G['groupid']) || 1 != $_G['groupid']) { echo $authRet; die(0); } $aksk = BigappEnv::getAkSk(); $ak = $aksk["ak"]; $sk = $aksk["sk"]; $obj = new BkSvr($ak, $sk, 30); $ret = $obj->getInfo(BigAppConf::$pushUrl, $_GET, false, false); if (false === $ret || 0 != $ret['error_code']) { if (100020 == $ret['error_code']) { $aliasRet['show_tips'] .= '并以' . $_G['username'] . '帐号登录,然后重试'; $aliasRet = BIGAPPJSON::encode($aliasRet); echo $aliasRet; die(0); } if (100021 == $ret['error_code']) { echo $akskRet; die(0); } echo $svrRet; die(0); } $ret['show_tips'] = '__DONT_DICONV_TO_UTF8___测试消息发送成功,稍后您手机应该能收到消息'; echo BIGAPPJSON::encode($ret); runlog('bigapp', 'send test message succ'); die(0);
public function output() { global $_G; $tmp = $_G['setting']['bigapp_settings_checkin']; if (isset($_G['setting']['bigapp_settings_checkin']) && is_string($_G['setting']['bigapp_settings_checkin'])) { $tmp = unserialize($_G['setting']['bigapp_settings_checkin']); } $succRet['data'] = $tmp; $uid = $_REQUEST['uid']; $date = date('Ymd'); $last_date = date("Ymd", strtotime("-1 day")); $type = $_REQUEST['check']; if ($uid == "") { $variable = array("status" => strval(1), "checkin_enabled" => strval($succRet['data']['enabled'])); echo BIGAPPJSON::encode(array('Message' => array('messageval' => '1', 'messagestr' => 'success'), 'Variables' => $variable)); die(0); //bigapp_core::result(bigapp_core::variable($variable)); } //获取当前用户的cookie userid $cookie_uid = BigAppAPI::getCookieUserId(); if ($cookie_uid !== $uid) { $variable = array("status" => strval(0), "message" => 'checkin failed'); echo BIGAPPJSON::encode(array('Message' => array('messageval' => '0', 'messagestr' => 'unauthorized user'), 'Variables' => $variable)); die(0); } //合法的用户id $uid = $cookie_uid; try { $value = BigAppAPI::getInfo($uid, $date); $has_checked = empty($value) ? '0' : '1'; if ($type == '1') { if ($succRet['data']['enabled'] == '1' && $has_checked == '1') { $checked = "1"; } else { $checked = "0"; } $variable = array("status" => strval(1), "checkin_enabled" => strval($succRet['data']['enabled']), "checked" => strval($checked)); echo BIGAPPJSON::encode(array('Message' => array('messageval' => '1', 'messagestr' => 'success'), 'Variables' => $variable)); die(0); } else { if ($succRet['data']['enabled'] == '1' && $has_checked == '0') { $value = BigAppAPI::getInfo($uid, $last_date); $has_checked_yesterday = empty($value) ? '0' : '1'; if ($has_checked_yesterday == '1') { //昨天签到过,修正用户签到信息 $value = BigAppAPI::getInfo($uid, $last_date); $days = $value['days'] + 1; $data = array("date" => $date, "days" => $days); $ret = DB::update('bigapp_checkin', $data, array('uid' => $uid, "date" => $last_date)); } else { //昨天未签到,重置用户签到信息 DB::delete('bigapp_checkin', DB::field("uid", $uid)); $data = array("uid" => $uid, "date" => $date, "days" => '1'); DB::insert('bigapp_checkin', $data, $return_insert_id); } $value = BigAppAPI::getInfo($uid, $date); $credit = $succRet['data']['credit_plus']; if ($value['days'] > 0 && $value['days'] % $succRet['data']['bonus_day'] == 0) { //加上连续签到奖励 $credit = $credit + $succRet['data']['bonus_plus']; } $ret = BigAppAPI::updateCredits($uid, $credit, $succRet['data']['credit']); if ($ret) { if (!isset($succRet['data']['credit'])) { $title['title'] = ""; } else { $index = substr($succRet['data']['credit'], -1); $i = 1; foreach ($_G['setting']['extcredits'] as $key => $credits_value) { if ($i++ < $index) { continue; } $title = $_G['setting']['extcredits'][$key]; break; } } $variable = array("status" => strval(1), "days" => $value['days'], "credit" => $credit, "bonus_days" => $succRet['data']['bonus_day'], "bonus_plus" => $succRet['data']['bonus_plus'], "title" => $title['title'], "message" => 'checked in success'); echo BIGAPPJSON::encode(array('Message' => array('messageval' => '1', 'messagestr' => 'checked in success'), 'Variables' => $variable)); die(0); } else { $variable = array("status" => strval(1), "message" => 'credit update failed'); echo BIGAPPJSON::encode(array('Message' => array('messageval' => '1', 'messagestr' => 'credit update failed'), 'Variables' => $variable)); die(0); } } else { if ($succRet['data']['enabled'] == '0') { $variable = array("status" => strval(1), "message" => 'checkin not support'); echo BIGAPPJSON::encode(array('Message' => array('messageval' => '1', 'messagestr' => 'checkin not support'), 'Variables' => $variable)); die(0); } else { $variable = array("status" => strval(1), "message" => 'has checked in'); echo BIGAPPJSON::encode(array('Message' => array('messageval' => '1', 'messagestr' => 'has checked in'), 'Variables' => $variable)); die(0); } } } echo BIGAPPJSON::encode(array('Message' => array('messageval' => '1', 'messagestr' => 'success'), 'Variables' => $variable)); die(0); } catch (Exception $e) { $variable = array("status" => strval(1), "message" => 'checkin not support'); echo BIGAPPJSON::encode(array('Message' => array('messageval' => '0', 'messagestr' => $e->getMessage()), 'Variables' => $variable)); die(0); } //bigapp_core::result(bigapp_core::variable($variable)); }
function returnData($errorCode, $errorMsg, $data = array()) { if (function_exists('ob_clean')) { ob_end_clean(); } $ret = array('error_code' => $errorCode, 'error_msg' => lang('plugin/bigapp', $errorMsg), 'data' => $data); //header('Access-Control-Allow-Origin: *'); //header('Access-Control-Allow-Credentials:true'); if (isset($_GET['callback'])) { echo $_GET['callback'] . "(" . BIGAPPJSON::encode($ret) . ")"; } else { echo BIGAPPJSON::encode($ret); } $content = ob_get_contents(); ob_end_clean(); global $_G; function_exists('ob_gzhandler') && $_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start(); echo $content; runlog('bigapp', 'returned data [ ' . BIGAPPJSON::encode($ret) . ' ]'); exit(0); }
* @Brief variable setting page for admin center * @author youzu * @version 1.0.0 * @date 2015-07-07 */ if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) { exit('Access Denied'); } require_once dirname(__FILE__) . '/libs/menu.inc.php'; require_once dirname(__FILE__) . '/bigappjson.class.php'; if (submitcheck('variable')) { //必须和showsubmit参数相同 $setting = array('threadlist_image_mode' => $_GET['setting']['threadlist_image_mode'], 'display_style' => $_GET['setting']['display_style'], 'enable_pic_opt' => $_GET['setting']['enable_pic_opt']); $settings = array('bigapp_settings' => $setting); C::t('common_setting')->update_batch($settings); runlog('bigapp', 'save settings variable succ [ settings: ' . BIGAPPJSON::encode($settings) . ' ]'); cpmsg('plugins_edit_succeed', 'action=plugins&operation=config&do=' . $pluginid . '&identifier=bigapp&pmod=variable', 'succeed'); die(0); } updatecache('setting'); if (isset($_G['setting']['bigapp_settings'])) { $_G['setting']['bigapp_settings'] = unserialize($_G['setting']['bigapp_settings']); } if (!isset($_G['setting']['bigapp_settings']['threadlist_image_mode'])) { $_G['setting']['bigapp_settings']['threadlist_image_mode'] = 1; } if (!isset($_G['setting']['bigapp_settings']['display_style'])) { $_G['setting']['bigapp_settings']['display_style'] = 0; } if (!isset($_G['setting']['bigapp_settings']['enable_pic_opt'])) { $_G['setting']['bigapp_settings']['enable_pic_opt'] = 1;
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; }
function login() { global $_G; $userName = null; $password = null; if (isset($_REQUEST['username'])) { $userName = $_REQUEST['username']; } if (isset($_REQUEST['password'])) { $password = $_REQUEST['password']; } if (isset($_REQUEST['questionid'])) { $questionid = intval($_REQUEST['questionid']); } else { $questionid = 0; } if (isset($_REQUEST['answer'])) { $answer = $_REQUEST['answer']; } else { $answer = ''; } if (function_exists('iconv')) { $userName = iconv('UTF-8', CHARSET . '//ignore', $userName); $answer = iconv('UTF-8', CHARSET . '//ignore', $answer); } else { $userName = mb_convert_encoding($userName, CHARSET, 'UTF-8'); $answer = mb_convert_encoding($answer, CHARSET, 'UTF-8'); } $_G['uid'] = $_G['member']['uid'] = 0; $_G['username'] = $_G['member']['username'] = $_G['member']['password'] = ''; if (empty($userName) || empty($password) || $password != addslashes($password)) { echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'invalid_param'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'invalid_param')))); die(0); } require_once dirname(dirname(dirname(__FILE__))) . '/bigappjson.class.php'; require_once libfile('function/misc'); require_once libfile('function/mail'); loaducenter(); if (!($_G['member_loginperm'] = logincheck($userName))) { echo BIGAPPJSON::encode(array('error_code' => 3, 'error_msg' => lang('plugin/bigapp', 'too_many_errors'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'too_many_errors')))); die(0); } $result = userlogin($userName, $password, $questionid, $answer, 'username', $_G['clientip']); if ($result['ucresult']['uid'] == '-3') { /* $sql = 'SELECT * FROM ' . DB::table('common_member') . " WHERE username = '******'"; $query = DB::query($sql); $userInfo = array(); while($tmp = DB::fetch($query)) { $userInfo = $tmp; break; } if(empty($userInfo)){ echo BIGAPPJSON::encode(array('error_code' => 4, 'error_msg' => lang('plugin/bigapp', 'user_not_exists'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'user_not_exists')))); die(0); }else */ //if(!empty($answer)){ echo BIGAPPJSON::encode(array('error_code' => 9, 'error_msg' => lang('plugin/bigapp', 'user_seq_question'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'user_seq_question')))); die(0); //} /* $result['ucresult']['uid'] = $userInfo['uid']; $result['member'] = $userInfo; $result['status'] = 1; */ } $uid = $_G['uid'] = $result['ucresult']['uid']; $userName = $result['ucresult']['username']; $userAvatar = avatar($_G['uid'], 'big', true); $userAvatar = str_replace("\r", '', $userAvatar); $userAvatar = str_replace("\n", '', $userAvatar); $ctlObj = new logging_ctl(); $ctlObj->setting = $_G['setting']; if ($result['status'] == -1) { if (!$ctlObj->setting['fastactivation']) { echo BIGAPPJSON::encode(array('error_code' => 5, 'error_msg' => lang('plugin/bigapp', 'activate_first'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'login_failed')))); die(0); } $init_arr = explode(',', $ctlObj->setting['initcredits']); $groupid = $ctlObj->setting['regverify'] ? 8 : $ctlObj->setting['newusergroupid']; C::t('common_member')->insert($uid, $result['ucresult']['username'], md5(random(10)), $result['ucresult']['email'], $_G['clientip'], $groupid, $init_arr); $result['member'] = getuserbyuid($uid); $result['status'] = 1; } if ($result['status'] > 0) { if ($ctlObj->extrafile && file_exists($ctlObj->extrafile)) { require_once $ctlObj->extrafile; } setloginstatus($result['member'], $_GET['cookietime'] ? 2592000 : 0); checkfollowfeed(); C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP)); if (isset($result['member']['password'])) { unset($result['member']['password']); } if (isset($result['member']['credits'])) { unset($result['member']['credits']); } echo BIGAPPJSON::encode(array('error_code' => 0, 'error_msg' => lang('plugin/bigapp', 'login_succ'), 'data' => $result['member'], 'Message' => array('messageval' => 'login_succeed', 'messagestr' => lang('plugin/bigapp', 'login_succ')), 'Variables' => array('auth' => 'in order to be comapatible'))); die(0); } if ($_G['member_loginperm'] > 1) { echo BIGAPPJSON::encode(array('error_code' => 6, 'error_msg' => lang('plugin/bigapp', 'login_failed'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'login_failed')))); } elseif ($_G['member_loginperm'] == -1) { echo BIGAPPJSON::encode(array('error_code' => 7, 'error_msg' => lang('plugin/bigapp', 'error_password'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'error_password')))); } else { echo BIGAPPJSON::encode(array('error_code' => 8, 'error_msg' => lang('plugin/bigapp', 'too_many_errors'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'too_many_errors')))); } die(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; }
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; }
/*********************************************************** * @file: bind.php * @author: mawentao(mawt@youzu.com) * @create: 2015-08-05 09:06:25 * @modify: 2015-08-05 09:06:25 * @brief: 绑定qq账号 ***********************************************************/ global $_G; $conopenid = $_GET["openid"]; $token = $_GET["token"]; $current_connect_member = C::t('#qqconnect#common_member_connect')->fetch($_G['uid']); //print_r($current_connect_member); die(0); // 当前登录账号已绑定过QQ if ($current_connect_member['conopenid']) { // 该登录账号绑定的是另一个QQ if (strtoupper($current_connect_member['conopenid']) != $conopenid) { echo BIGAPPJSON::encode(array('error_code' => 5, 'error_msg' => lang('plugin/qqconnect', 'connect_register_bind_already'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/qqconnect', 'connect_register_bind_already')))); die(0); } else { // do nothing } } else { if (empty($current_connect_member)) { C::t('#qqconnect#common_member_connect')->insert(!$_G['setting']['connect']['oauth2'] ? array('uid' => $_G['uid'], 'conuin' => $token, 'conuinsecret' => '', 'conopenid' => $conopenid, 'conispublishfeed' => 1, 'conispublisht' => 1, 'conisregister' => 0, 'conisfeed' => 1, 'conisqqshow' => 1) : array('uid' => $_G['uid'], 'conuin' => '', 'conuintoken' => $token, 'conopenid' => $conopenid, 'conispublishfeed' => 1, 'conispublisht' => 1, 'conisregister' => 0, 'conisfeed' => 1, 'conisqqshow' => 1)); } else { C::t('#qqconnect#common_member_connect')->update($_G['uid'], !$_G['setting']['connect']['oauth2'] ? array('conuin' => $token, 'conuinsecret' => '', 'conopenid' => $conopenid, 'conispublishfeed' => 1, 'conispublisht' => 1, 'conisregister' => 0, 'conisfeed' => 1, 'conisqqshow' => 1) : array('conuintoken' => $token, 'conopenid' => $conopenid, 'conispublishfeed' => 1, 'conispublisht' => 1, 'conisregister' => 0, 'conisfeed' => 1, 'conisqqshow' => 1)); } C::t('common_member')->update($_G['uid'], array('conisbind' => '1')); C::t('#qqconnect#common_connect_guest')->delete($conopenid); } // vim600: sw=4 ts=4 fdm=marker syn=php
function json($encode) { if (!empty($_GET['debug']) && defined('DISCUZ_DEBUG') && DISCUZ_DEBUG) { return debug($encode); } return BIGAPPJSON::encode($encode); }