public function validate($retType) { parent::validate($retType); copyArray($_POST, $v, '*'); if (trim($v['username']) == '') { $rets[] = array('msg' => 'Please enter your username!', 'field' => 'username'); } if (filter_var($v['email'], FILTER_VALIDATE_EMAIL) === FALSE) { $rets[] = array('msg' => 'Invalid email address!', 'field' => 'email'); } if ($v['password'] == '') { $rets[] = array('msg' => 'Please enter your password!', 'field' => 'password'); } if (strlen($v['password']) < 3) { $rets[] = array('msg' => 'Password must have at least 3 chars!', 'field' => 'password'); } if ($v['password'] != $v['cpassword']) { $rets[] = array('msg' => 'Passwords mismatched!', 'field' => 'cpassword'); } if (isset($rets)) { if (isset($retType) && $retType == RT_JSON) { return outputJson($rets); } else { return $rets; } } }
function checkLoginToken() { if (empty($_GET['accessToken'])) { $arr = array('success' => 0, 'message' => 'empty token'); outputJson($arr); } }
function getShareByUserClickShareID() { global $_FANWE; $share_id = (int) $_FANWE['user_click_share_id']; if ($share_id > 0) { $share = FS('Share')->getShareById($share_id); if ($share) { $temp_share[] = $share; $temp_share = FS('Share')->getShareDetailList($temp_share, false, false, false, true, 5); $temp_share = $temp_share[$share_id]; $args = array('share' => &$temp_share); $result = array(); $result['share_id'] = $share_id; switch (ACTION_NAME) { case 'dapei': $result['html'] = tplFetch('inc/book/book_dapei', $args); break; case 'look': $result['html'] = tplFetch('inc/book/book_look', $args); break; default: $result['html'] = tplFetch('inc/book/book_index', $args); break; } return "ShowUserClickShare(" . outputJson($result, false) . ");"; } } return ''; }
public function validate($retType) { parent::validate($retType); copyArray($_POST, $fv, 'username'); if (validateUsername($fv['username']) == false) { $rets[] = array('msg' => '<br/>Invalid username!', 'field' => 'username'); } if (isset($rets)) { if (isset($retType) && $retType == RT_JSON) { return outputJson($rets); } else { return $rets; } } }
public function validate($retType) { copyArray($_POST, $v, '*'); $rets = parent::validate($retType, $v); if (filter_var($v['email'], FILTER_VALIDATE_EMAIL) === FALSE) { $rets[] = array('msg' => 'Invalid email address!', 'field' => 'email', 'focus' => 'email'); } if (strlen($v['password']) < 3) { $rets[] = array('msg' => 'Password must have at least 3 chars!', 'field' => 'password', 'focus' => 'password'); } if ($v['password'] != $v['cpassword']) { $rets[] = array('msg' => 'Passwords mismatched!', 'field' => 'cpassword', 'focus' => 'cpassword'); } if (isset($retType) && $retType == RT_JSON && isset($rets)) return outputJson($rets); return $rets; }
public function validate($retType) { parent::validate($retType); copyArray($_POST, $fv, 'name', 'email', 'content'); if (trim($fv['name']) == '') { $rets[] = array('msg' => 'Please enter your name!', 'field' => 'name'); } if (filter_var($fv['email'], FILTER_VALIDATE_EMAIL) === FALSE) { $rets[] = array('msg' => 'Invalid email!', 'field' => 'email'); } if (trim($fv['content']) == '') { $rets[] = array('msg' => 'Please enter content!', 'field' => 'content'); } if (isset($rets)) { if (isset($retType) && $retType == RT_JSON) { return outputJson($rets); } else { return $rets; } } }
public function validate($retType) { parent::validate($retType); copyArray($_POST, $fv, 'name', 'email', 'msg'); if (trim($fv['name']) == '') { $rets[] = array('msg' => 'Please enter your name!', 'field' => 'name'); } if (filter_var($fv['email'], FILTER_VALIDATE_EMAIL) === FALSE) { $rets[] = array('msg' => 'Invalid email!', 'field' => 'email'); } if (trim($fv['msg']) == '') { $rets[] = array('msg' => 'Please enter your message!', 'field' => 'msg'); } if (ReCaptcha::checkAnswer() == false && isset($retType) && $retType == RT_JSON) { $rets[] = array('msg' => 'The reCAPTCHA wasn\'t entered correctly!', 'field' => 'recaptcha'); } if (isset($retType) && $retType == RT_JSON && isset($rets)) return outputJson($rets); return $rets; }
if ($nag_version == 4) { $data = getData4($statusFile); } else { if ($nag_version == 3) { $data = getData3($statusFile); } else { $data = getData2($statusFile); } } $hosts = $data['hosts']; $services = $data['services']; $program = ""; if (array_key_exists("program", $data)) { $program = $data['program']; } outputJson($hosts, $services, $program); function outputJson($hosts, $services, $program) { // begin outputting XML header("Content-type: application/json"); echo "{" . "\n"; // program status if ($program != "") { echo ' "programStatus": {' . "\n"; foreach ($program as $key => $val) { echo ' "' . jsonString($key) . '": "' . jsonString($val) . '"' . (isLast($program, $key) ? '' : ',') . "\n"; } unset($key, $val); echo ' },' . "\n"; } // hosts
<?php if ($_FANWE['uid'] == 0) { exit; } $uid = $_FANWE['request']['uid']; if ($uid == 0) { exit; } if (!FS('User')->getUserExists($uid)) { exit; } $is_delete = FS('User')->removeFans($uid); outputJson(array('status' => $is_delete));
<?php if ($_FANWE['uid'] == 0) { exit; } $user_tags = array(); $tags = explode(',', $_FANWE['request']['tags']); $i = 0; foreach ($tags as $tag) { if ($tag != '' && $i < 20) { $user_tags[] = addslashes(urldecode($tag)); } } FS('User')->updateUserTags($_FANWE['uid'], $user_tags); outputJson(array('status' => true, 'tags' => $user_tags));
public function ajaxRegister() { global $_FANWE; $rhash = $_FANWE['request']['rhash']; $agreement = isset($_FANWE['request']['agreement']) ? intval($_FANWE['request']['agreement']) : 0; if ($agreement == 0) { exit('Access Denied'); } $verify = fAddslashes(explode("\t", authcode($_FANWE['cookie']['verify' . $rhash], 'DECODE', $_FANWE['config']['security']['authkey']))); if (empty($rhash) || $rhash != FORM_HASH || empty($verify) || $verify[2] != $rhash || $verify[3] != FORM_HASH) { exit('Access Denied'); } $result = array(); $data = array('checkcode' => strtoupper($_FANWE['request']['checkcode']), 'email' => $_FANWE['request']['email'], 'user_name' => $_FANWE['request']['user_name'], 'password' => $_FANWE['request']['password'], 'confirm_password' => $_FANWE['request']['confirm_password'], 'gender' => intval($_FANWE['request']['gender'])); $vservice = FS('Validate'); $validate = array(array('checkcode', 'equal', lang('user', 'register_checkcode_error'), $verify[0]), array('email', 'required', lang('user', 'register_email_require')), array('email', 'email', lang('user', 'register_email_error')), array('user_name', 'required', lang('user', 'register_user_name_require')), array('user_name', 'range_length', lang('user', 'register_user_name_len'), 2, 20), array('user_name', '/^[\\x{4e00}-\\x{9fa5}a-zA-Z][\\x{4e00}-\\x{9fa5}a-zA-Z0-9]+$/u', lang('user', 'register_user_name_error')), array('password', 'range_length', lang('user', 'register_password_range'), 6, 20), array('confirm_password', 'equal', lang('user', 'confirm_password_error'), $data['password'])); if (!$vservice->validation($validate, $data)) { $result['status'] = 0; $result['msg'] = $vservice->getError(); outputJson($result); } $uservice = FS('User'); if ($uservice->getEmailExists($data['email'])) { $result['status'] = 0; $result['msg'] = lang('user', 'register_email_exist'); outputJson($result); } if ($uservice->getUserNameExists($data['user_name'])) { $result['status'] = 0; $result['msg'] = lang('user', 'register_user_name_exist'); outputJson($result); } //================add by chenfq 2011-10-14 ======================= $user_field = $_FANWE['setting']['integrate_field_id']; $integrate_id = FS("Integrate")->addUser($data['user_name'], $data['password'], $data['email']); if ($integrate_id < 0) { $info = FS("Integrate")->getInfo(); $result['status'] = 0; $result['msg'] = $info; outputJson($result); } //================add by chenfq 2011-10-14======================= $user = array('email' => $data['email'], 'user_name' => $data['user_name'], 'user_name_match' => segmentToUnicode($data['user_name']), 'password' => md5($data['password']), 'status' => 1, 'email_status' => 0, 'avatar_status' => 0, 'gid' => 7, 'invite_id' => FS('User')->getReferrals(), 'reg_time' => TIME_UTC, $user_field => $integrate_id); $uid = FDB::insert('user', $user, true); if ($uid > 0) { $_FANWE['uid'] = $uid; FDB::insert('user_count', array('uid' => $uid)); if ($user['invite_id'] > 0) { FS('User')->insertReferral($uid, $user['invite_id'], $user['user_name']); } FS("User")->updateUserScore($uid, 'user', 'register'); unset($user); $user_profile = array('uid' => $uid, 'gender' => $data['gender']); FDB::insert('user_profile', $user_profile); unset($user_profile); $user_status = array('uid' => $uid, 'reg_ip' => $_FANWE['client_ip'], 'last_ip' => $_FANWE['client_ip'], 'last_time' => TIME_UTC, 'last_activity' => TIME_UTC); FDB::insert('user_status', $user_status); $user = array('uid' => $uid, 'password' => md5($data['password'])); fSetCookie('last_request', authcode(TIME_UTC - 10, 'ENCODE'), TIME_UTC + 816400, 1, true); FS('User')->setSession($user); $syslogin_js = FS("Integrate")->synLogin($integrate_id); //js 需要在前台执行 add by chenfq 2011-10-15 //$result['syslogin_js'] = $integrate_id.';'.$syslogin_js; if (!empty($syslogin_js)) { fSetCookie("dynamic_script", $syslogin_js); } $result['status'] = 1; if (getCookie('redir_url')) { //判断采集图片回调地址,cookie中保持的地址,只使用一次 unset($_FANWE['cookie']['redir_url']); } outputJson($result); } else { $result['status'] = 0; $result['msg'] = lang('user', 'register_error'); outputJson($result); } }
$share_comments_data[$idxj]['user_url'] = FU('u/index', array('uid' => $vv['user']['uid'])); $share_comments_data[$idxj]['user_name'] = $vv['user']['user_name']; $share_comments_data[$idxj]['avt'] = avatar($vv['uid'], 's', $is_src = 1); $share_comments_data[$idxj]['comment'] = cutStr($vv['content'], 20); $idxj++; } $list[$i]['comments'] = $share_comments_data; } $list[$i]['share_url'] = FU('note/index', array('sid' => $v['share_id'])); $list[$i]['u_url'] = FU('u/index', array('uid' => $v['uid'])); $list[$i]['relay_count'] = FDB::resultFirst("select relay_count from " . FDB::table("share") . " where share_id = " . $v['share_id']); $album_sql = "select a.id,a.title from " . FDB::table('album_share') . " as ah left join " . FDB::table('album') . " as a on ah.album_id = a.id where ah.share_id = " . $v['share_id']; $album = FDB::fetchFirst($album_sql); if ($album) { $list[$i]['album_title'] = $album['title']; $list[$i]['is_album'] = 1; $list[$i]['album_url'] = FU("album/show", array('id' => $album['id'])); } else { $list[$i]['album_title'] = ""; $list[$i]['is_album'] = 0; $list[$i]['album_url'] = ""; } $list[$i]['zf_count'] = 10; $list[$i]['xh_count'] = 20; $list[$i]['user_name'] = FDB::resultFirst("select user_name from " . FDB::table('user') . " where uid =" . $v['uid']); $i++; } outputJson(array('result' => $list, 'current_user' => $current_user, 'status' => 1, 'hasNextPage' => $is_next)); } else { outputJson(array('status' => 0, 'hasNextPage' => $is_next)); }
include 'includes/default.php'; if ($_GET['site'] == 'hitbox') { $apiWrapper = new HitboxApi(); } elseif ($_GET['site'] == 'azubu') { $apiWrapper = new AzubuApi(); } elseif ($_GET['site'] == 'mlg') { $apiWrapper = new MLGApi(); } else { $apiWrapper = new TwitchApi(); } $streams = $apiWrapper->getStreamsByGame('Counter-Strike: Global Offensive'); $teamList = new AvailableTeams(); $matches = array(); foreach ($streams as $stream) { if (!$stream->getIsCast()) { continue; } $streamTeamList = array(); $teams = $teamList->getTeamsInString($stream->getStatus()); sort($teams); foreach ($teams as $team) { $streamTeamList[] = array('identifier' => $team['identifier'], 'name' => $teamList->getNameFromIdentifier($team['identifier'])); } $matchIdentifier = serialize($streamTeamList); if (!isset($matches[$matchIdentifier])) { $matches[$matchIdentifier] = array('teams' => $streamTeamList, 'streams' => array()); } $matches[$matchIdentifier]['streams'][] = $stream; } outputJson(array_values($matches));
<?php $page = $_FANWE['page']; if ($page == 0) { echo '{"status":0}'; exit; } $size = intval($_FANWE['request']['size']); if ($size == 0 || $size > 50) { $size = 15; } $limit = $page * $size . ',' . $size; $daren_list = FS('Daren')->getDarens($limit); $daren_count = count($daren_list); if ($size - $daren_count > 0) { $limit = '0,' . ($size - $daren_count); $daren_list1 = FS('Daren')->getDarens($limit); $daren_list = array_merge($daren_list, $daren_list1); $page = 0; } $args['no_lazyload'] = 1; $args['daren_list'] = $daren_list; $html = tplFetch('inc/index/daren_list', $args); $page++; outputJson(array('status' => 1, 'html' => $html, 'page' => $page));
<?php if ($_FANWE['uid'] == 0) { exit; } $img = FS('Image')->save('avatar', 'temp', true, array('avatar' => array(190, 190, 1)), true); if ($img['thumb']['avatar']['url'] === false) { $img['thumb']['avatar']['url'] = ""; } outputJson(array('src' => $img['thumb']['avatar']['url']));
<?php if ($_FANWE['uid'] == 0) { exit; } $tid = $_FANWE['request']['tid']; if ($tid == 0) { exit; } $is_follow = FS('Ask')->followTopic($tid); $args['follow_count'] = FS('Ask')->getTopicFollowCount($tid); $args['follow_users'] = FS('Ask')->getTopicFollows($tid, 9); $args['topic'] = FS('Ask')->getTopicById($tid); $html = tplFetch('inc/ask/follow_user', $args); outputJson(array('status' => $is_follow, 'html' => $html));
<?php if ($_FANWE['uid'] == 0) { echo '{"status":0}'; exit; } $uids = explode(',', $_FANWE['request']['uids']); if (empty($uids)) { echo '{"status":0}'; exit; } foreach ($uids as $uid) { $uid = intval($uid); if ($uid == 0) { continue; } if (!FS('User')->getUserExists($uid)) { continue; } if (!FS('User')->getIsFollowUId($uid)) { FS('User')->followUser($uid); } } outputJson(array('status' => 1));
<?php global $_FANWE; $result = array(); if ($_FANWE['uid'] == 0) { $result['status'] = 0; $result['message'] = "未登录"; } $result['status'] = 1; $pageUrl = $_FANWE['request']['pageUrl']; $aid = $_FANWE['request']['aidArray']; $content = $_FANWE['request']['contentArray']; $imgs = $_FANWE['request']['imgArray']; $title = $_FANWE['request']['titleArray']; $pub_out_check = $_FANWE['request']['pub_out_check']; $videos = $_FANWE['request']['videoArray']; $data = array(); $data['album_id'] = $aid; $data['content'] = $content; $data['imgs'] = $imgs; $data['videos'] = $videos; $data['title'] = $title; $data['pageUrl'] = $pageUrl; $data['pub_out_check'] = $pub_out_check; $share_submit = FS("Collect")->submitList($data); $success_url = FU("collection/success"); $result['success_url'] = $success_url; outputJson($result);
<?php $page = $_FANWE['page']; if ($page == 0) { echo '{"status":0}'; exit; } $size = intval($_FANWE['request']['size']); if ($size == 0 || $size > 50) { $size = 12; } $begin = $page * $size + 4; $args['best_list'] = array_chunk(FS('Topic')->getImgTopic('best', 12, 1, 0, $begin), 6); foreach ($args['best_list'] as $key => $best_item) { $args['best_list'][$key] = array_chunk($best_item, 3); } $html = tplFetch('inc/club/new_topic_item', $args); outputJson(array('status' => 1, 'html' => $html));