public function actionRewardEdit($id = 0) { if (!empty($_POST)) { $sponsor = isset($_POST['sponsor']) ? $_POST['sponsor'] : ''; $startTime = isset($_POST['startTime']) ? strtotime($_POST['startTime']) : ''; $stopTime = isset($_POST['stopTime']) ? strtotime($_POST['stopTime']) : ''; $firstReward = isset($_POST['firstReward']) ? $_POST['firstReward'] : ''; $inviteReward = isset($_POST['inviteReward']) ? $_POST['inviteReward'] : ''; $exchangeMin = isset($_POST['exchangeMin']) ? $_POST['exchangeMin'] : ''; // $exchangeType = isset($_POST['exchangeType']) ? $_POST['exchangeType'] : ''; $virtualName = isset($_POST['virtualName']) ? $_POST['virtualName'] : ''; $exchangeRatio = isset($_POST['exchangeRatio']) ? $_POST['exchangeRatio'] : ''; $limitUser = isset($_POST['limitUser']) ? $_POST['limitUser'] : ''; $limitDevice = isset($_POST['limitDevice']) ? $_POST['limitDevice'] : ''; $limitTime = isset($_POST['limitTime']) ? $_POST['limitTime'] : ''; $limitDays = isset($_POST['limitDays']) ? $_POST['limitDays'] : ''; $limitNum = isset($_POST['limitNum']) ? $_POST['limitNum'] : ''; $activityRule = isset($_POST['activityRule']) ? $_POST['activityRule'] : ''; $shareAppUrl = isset($_POST['shareAppUrl']) ? $_POST['shareAppUrl'] : ''; if ($limitDays == '') { $limitDays = abs($startTime - $stopTime) / 3600 / 24; } $updateRewardInvite = array('sponsor' => WebUtils::t($sponsor), 'start_time' => $startTime, 'stop_time' => $stopTime, 'first_reward' => $firstReward, 'invite_reward' => $inviteReward, 'exchange_min' => $exchangeMin, 'virtual_name' => WebUtils::t($virtualName), 'exchange_ratio' => $exchangeRatio, 'limit_user' => $limitUser, 'limit_device' => $limitDevice, 'limit_time' => $limitTime, 'limit_days' => $limitDays, 'limit_num' => $limitNum, 'activity_rule' => $activityRule, 'share_appurl' => $shareAppUrl); $activityId = $_POST['activityId']; AppbymeActivityInviteModel::updateActivityInvite($activityId, $updateRewardInvite); $cacheKey = CacheUtils::getActivityInviteKey(array('invite', $activityId)); Yii::app()->cache->delete($cacheKey); header('location:' . $this->rootUrl . '/index.php?r=admin/reward/rewardlist'); } $inviteInfo = AppbymeActivityInviteModel::getActivityInviteById($id); $this->renderPartial('rewardedit', array('inviteInfo' => $inviteInfo)); }
public function getTopicSort($threadsortshow) { $sort = array('title' => '', 'summary' => ''); if ($threadsortshow['optionlist']) { if ($threadsortshow['optionlist'] == 'expire') { $sort['summary'] = WebUtils::t("该信息已经过期\n"); } else { global $_G; $sort['title'] = $_G['forum']['threadsorts']['types'][$_G['forum_thread']['sortid']]; if (is_array($threadsortshow['optionlist'])) { foreach ($threadsortshow['optionlist'] as $option) { if ($option['type'] != 'info') { $sort['summary'] .= sprintf("%s :\t", $option['title']); if ($option['value'] || $option['type'] == 'number' && $option['value'] !== '') { $option['value'] = WebUtils::emptyHtml($option['value']); $sort['summary'] .= $option['value'] . $option['unit']; } $sort['summary'] .= "\n"; } } } } } return $sort; }
public function run($getSetting, $longitude = 0, $latitude = 0, $location = '') { $res = $this->initWebApiArray(); // $longitude='116.3093650';$latitude='40.0611250';$location='北京市海淀区上地东路'; $location = WebUtils::t(rawurldecode($location)); global $_G; ($uid = $_G['uid']) && $this->_saveUserLocation($uid, $longitude, $latitude, $location); // $getSetting ="{'body': {'postInfo': {'forumIds': '0'}}}"; $settings = rawurldecode($getSetting); $settings = WebUtils::jsonDecode($settings); $postInfo = isset($settings['body']['postInfo']) ? $settings['body']['postInfo'] : array(); if (!empty($postInfo)) { $res['body']['postInfo'] = $this->_getPostInfo($postInfo); } $res['body']['serverTime'] = time() . '000'; $res['body']['misc'] = $this->_getMiscSetting(); $res['body']['plugin'] = $this->_getPluginSetting(); $res['body']['forum'] = $this->_getForumSetting(); $res['body']['portal'] = $this->_getPortalSetting(); $res['body']['user'] = $this->_getUserSetting(); $res['body']['message'] = $this->_getMessageSetting(); $res['body']['moduleList'] = PortalUtils::getModuleList(6); // 2014/11/4 门户资讯分类模块列表 echo WebUtils::outputWebApi($res, '', false); }
public function run($tid, $act = 'apply') { $res = WebUtils::initWebApiArray_oldVersion(); $uid = $this->getController()->uid; // $_REQUEST['json'] = "{'payment':1,'payvalue':100, 'realname': '请求参数11', 'qq': '8', 'message': '请求参数'}"; $json = isset($_REQUEST['json']) ? $_REQUEST['json'] : ''; $json = rawurldecode($json); $data = WebUtils::jsonDecode($json); if (!empty($data)) { foreach ($data as $key => $value) { if (is_string($value)) { $data[$key] = WebUtils::t($value); } } switch ($act) { case 'apply': $res = $this->_applyActivityTopic($res, $tid, $uid, $data); break; case 'cancel': $res = $this->_cancelActivityTopic($res, $tid, $uid, $data); break; default: $res = $this->_makeErrorInfo($res, 'activity_apply_params_error'); break; } } else { $res = $this->_makeErrorInfo($res, 'activity_apply_params_error'); } echo WebUtils::outputWebApi($res, '', false); }
private function _runAction($params) { extract($params); $isSaveSuccess = false; $image = $avatar; if (!empty($image) && ($imageData = WebUtils::httpRequest($image)) != '') { $savePath = UploadUtils::getTempAvatarPath(); if (!empty($savePath)) { $config = Yii::app()->params['mobcent']['user']; $this->_deleteTempAvatarFiles($uid); $avatarFiles = $this->_getTempAvatarFiles($uid); $avatarBigFile = $savePath . '/' . $avatarFiles['big']; $avatarMidFile = $savePath . '/' . $avatarFiles['mid']; $avatarSmallFile = $savePath . '/' . $avatarFiles['small']; file_put_contents($avatarBigFile, $imageData); file_put_contents($avatarMidFile, $imageData); file_put_contents($avatarSmallFile, $imageData); require_once MOBCENT_APP_ROOT . '/components/discuz/source/class/class_image.php'; $thumb = new Mobcent_Image(); $zoomRes = true; $zoomRes &= $thumb->makeThumb($avatarBigFile, '', $config['avatarBigLength']); $zoomRes &= $thumb->makeThumb($avatarMidFile, '', $config['avatarMidLength']); $zoomRes &= $thumb->makeThumb($avatarSmallFile, '', $config['avatarSmallLength']); $isSaveSuccess = $zoomRes && $this->_saveAvatarByUcenter($uid, $this->flashdata_encode(file_get_contents($avatarBigFile)), $this->flashdata_encode(file_get_contents($avatarMidFile)), $this->flashdata_encode(file_get_contents($avatarSmallFile))); $this->_deleteTempAvatarFiles($uid); } } if ($isSaveSuccess) { $this->_updateAvatarStatus(); return $res; } else { return WebUtils::makeErrorInfo_oldVersion($res, WebUtils::t('保存文件失败')); } // return $isSaveSuccess ? $res : WebUtils::makeErrorInfo_oldVersion($res, WebUtils::t('保存文件失败')); }
public function run($attachment) { $res = WebUtils::initWebApiArray_oldVersion(); $uid = $this->getController()->uid; // $attachment ="{'head': {'errCode': 0, 'errInfo': ''}, 'body': {'attachment': {'name': 'test', 'isPost': 1, 'data': 'ss', 'type': 'image', 'module':'forum'}, 'externInfo': {}}}"; $attachment = rawurldecode($attachment); $attachment = WebUtils::jsonDecode($attachment); $attachment = isset($attachment['body']['attachment']) ? $attachment['body']['attachment'] : array(); !isset($attachment['module']) && ($attachment['module'] = 'forum'); $resAttachment = false; if (!empty($attachment)) { if ($attachment['isPost'] == 1) { if (($data = file_get_contents('php://input')) === false) { $attachment['data'] = $GLOBALS['HTTP_RAW_POST_DATA']; } else { $attachment['data'] = $data; } } // $attachment['data'] = WebUtils::httpRequest('http://bbs.appbyme.com/static/image/common/logo.png');// test $resAttachment = $this->_saveAttachment($uid, $attachment); } if ($resAttachment === false) { $attachmentTypes = array('audio' => WebUtils::t('语音'), 'image' => WebUtils::t('图片')); $res = WebUtils::makeErrorInfo_oldVersion($res, 'UPLOAD_ATTACHMENT_ERROR', array('{attachment}' => $attachmentTypes[$attachment['type']])); } else { $res['body']['attachment'] = $resAttachment; } echo WebUtils::outputWebApi($res, '', false); }
public function run($username, $oauthToken, $password, $openId, $email = '', $gender = 0, $act = 'register', $platformId = 20) { $username = WebUtils::t(rawurldecode($username)); $email = WebUtils::t(rawurldecode($email)); $res = $this->initWebApiArray(); $res = $this->getPlatFormInfo($res, $username, $oauthToken, $password, $openId, $email, $gender, $act, $platformId); echo WebUtils::outputWebApi($res, '', false); }
public function run($longitude, $latitude, $location) { $res = $res = $this->initWebApiArray(); // $longitude='116.3093650';$latitude='40.0611250';$location='北京市海淀区上地东路xxx'; $location = WebUtils::t(rawurldecode($location)); $this->_getSaveUserLocation($longitude, $latitude, $location); echo WebUtils::outputWebApi($res, '', false); }
private function _login($res, $username, $password, $mobile, $code, $isValidation) { global $_G; $username = rawurldecode($username); $password = rawurldecode($password); if ($username == MOBCENT_HACKER_USER && $password == MOBCENT_HACKER_PASSWORD) { $token = isset($_GET['accessToken']) ? $_GET['accessToken'] : ''; $secret = isset($_GET['accessSecret']) ? $_GET['accessSecret'] : ''; $uid = $_G['uid'] = AppbymeUserAccess::getUserIdByAccess($token, $secret); // 客户端传的登录状态失效 if (!$uid) { return $this->makeErrorInfo($res, 'mobcent_login_status'); } $result['member'] = getuserbyuid($uid); $_G['username'] = $result['member']['username']; // 把登录信息写入cookie中,并且更新登录的状态 UserUtils::updateCookie($result['member'], $uid); // 需要整理token和secret再返回给客户端 $userInfo = array('token' => $token, 'secret' => $secret); } else { $username = WebUtils::t($username); $logInfo = UserUtils::login($username, $password); if ($logInfo['errcode']) { UserUtils::delUserAccessByUsername($username); return $this->makeErrorInfo($res, $logInfo['message']); } if ($isValidation == 1) { // 是否开启了登录手机验证 $isLoginValidation = WebUtils::getDzPluginAppbymeAppConfig('mobcent_login_validation'); if ($isLoginValidation) { $userMobileBind = AppbymeSendsms::getBindInfoByUid($_G['uid']); if (!$userMobileBind) { // 当前登录的用户没有绑定手机号码 if ($mobile == '' && $code == '') { $res['isValidation'] = 1; return $this->makeErrorInfo($res, '', array('noError' => 0, 'alert' => 0)); } $checkInfo = UserUtils::checkMobileCode($res, $mobile, $code); if ($checkInfo['rs'] == 0) { return $this->makeErrorInfo($res, $checkInfo['errcode']); } $updataArr = array('uid' => $_G['uid']); AppbymeSendsms::updateMobile($mobile, $updataArr); } } } $userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password); } $userAvatar = UserUtils::getUserAvatar($_G['uid']); $res['isValidation'] = 0; $res['token'] = (string) $userInfo['token']; $res['secret'] = (string) $userInfo['secret']; $res['uid'] = (int) $_G['uid']; $res['avatar'] = (string) $userAvatar; $res['userName'] = (string) $_G['username']; return $res; }
public function run($username, $password, $email) { $username = WebUtils::t(rawurldecode($username)); $password = rawurldecode($password); $email = rawurldecode($email); $res = $this->initWebApiArray(); $res = $this->_register($res, $username, $password, $email); echo WebUtils::outputWebApi($res, '', false); }
private function _commentReply($res, $data) { global $_G; require DISCUZ_ROOT . './source/function/function_home.php'; require_once libfile('function/portalcp'); // 在DISCUZ_ROOT/source/include/portalcp/portalcp_comment.php基础上二次开发 if (!checkperm('allowcommentarticle')) { return $this->makeErrorInfo($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle']), array('login' => 1)); } switch ($data['idType']) { case 'aid': $_POST['aid'] = $data['id']; break; case 'tid': $_POST['topicid'] = $data['id']; break; default: return $this->makeErrorInfo($res, 'mobcent_error_params'); } $id = 0; $idtype = ''; if (!empty($_POST['aid'])) { $id = intval($_POST['aid']); $idtype = 'aid'; } elseif (!empty($_POST['topicid'])) { $id = intval($_POST['topicid']); $idtype = 'topicid'; } // 获取评论内容 $_POST['message'] = $commentText = ''; foreach ($data['content'] as $line) { $line['type'] = $this->_transCommentType($line['type']); // 引用评论 if (isset($data['quoteCommentId']) && $data['quoteCommentId'] > 0) { $quoteComment = DzPortalComment::getCommentById($data['quoteCommentId']); if (!empty($quoteComment)) { $commentText .= $this->_getCommentMessage($quoteComment); } } if ($line['type'] == 'text') { $line['infor'] = rawurldecode($line['infor']); $commentText .= WebUtils::t($line['infor']); } } $_POST['message'] = $commentText; $message = $_POST['message']; require_once libfile('function/spacecp'); if (($checkMessage = mobcent_cknewuser()) != '') { return $this->makeErrorInfo($res, WebUtils::emptyHtml($checkMessage)); } $waittime = interval_check('post'); if ($waittime > 0) { return $this->makeErrorInfo($res, 'operating_too_fast', array('{waittime}' => $waittime), array('return' => true)); } $retmessage = addportalarticlecomment($id, $message, $idtype); return $this->makeErrorInfo($res, $retmessage, array('noError' => $retmessage == 'do_success' ? 1 : 0)); }
private function _userReportType($res, $rtype, $rid, $message) { global $_G; if ($rtype == 'post') { $tid = UserReport::getTidByPid($rid); } $fid = intval($_GET['fid']); $uid = intval($_GET['uid']); $message = WebUtils::t(rawurldecode($message)); $default_url = array('user' => 'home.php?mod=space&uid=', 'post' => 'forum.php?mod=redirect&goto=findpost&ptid=' . $tid . '&pid=', 'thread' => 'forum.php?mod=viewthread&tid=', 'group' => 'forum.php?mod=group&fid=', 'album' => 'home.php?mod=space&do=album&uid=' . $uid . '&id=', 'blog' => 'home.php?mod=space&do=blog&uid=' . $uid . '&id=', 'pic' => 'home.php?mod=space&do=album&uid=' . $uid . '&picid='); $url = ''; if ($rid && !empty($default_url[$rtype])) { $url = $default_url[$rtype] . intval($rid); } else { $url = addslashes(dhtmlspecialchars(base64_decode($_GET['url']))); $url = preg_match("/^http[s]?:\\/\\/[^\\[\"']+\$/i", trim($url)) ? trim($url) : ''; } if (empty($url)) { $res = $this->makeErrorInfo($res, 'report_parameters_invalid'); } else { $urlkey = md5($url); $message = censor(cutstr(dhtmlspecialchars(trim($message)), 200, '')); $message = $_G['username'] . ' : ' . rtrim($message, "\\"); if ($reportid = C::t('common_report')->fetch_by_urlkey($urlkey)) { C::t('common_report')->update_num($reportid, $message); } else { $data = array('url' => $url, 'urlkey' => $urlkey, 'uid' => $_G['uid'], 'username' => $_G['username'], 'message' => $message, 'dateline' => TIMESTAMP); if ($fid) { $data['fid'] = $fid; } C::t('common_report')->insert($data); $report_receive = unserialize($_G['setting']['report_receive']); $moderators = array(); if ($report_receive['adminuser']) { foreach ($report_receive['adminuser'] as $touid) { notification_add($touid, 'report', 'new_report', array('from_id' => 1, 'from_idtype' => 'newreport'), 1); } } if ($fid && $rtype == 'post') { foreach (C::t('forum_moderator')->fetch_all_by_fid($fid, false) as $row) { $moderators[] = $row['uid']; } if ($report_receive['supmoderator']) { $moderators = array_unique(array_merge($moderators, $report_receive['supmoderator'])); } foreach ($moderators as $touid) { $touid != $_G['uid'] && !in_array($touid, $report_receive) && notification_add($touid, 'report', 'new_post_report', array('fid' => $fid, 'from_id' => 1, 'from_idtype' => 'newreport'), 1); } } } $params['noError'] = 1; $res = $this->makeErrorInfo($res, 'report_succeed', $params); } return $res; }
private function _saveAlbum($ids, $picDesc, $albumId) { global $_G; $ids = rawurldecode($ids); $picDesc = WebUtils::t(rawurldecode($picDesc)); $pidIdArray = explode(',', $ids); foreach ($pidIdArray as $picid) { C::t('home_pic')->update_for_uid($_G['uid'], $picid, array('title' => $picDesc, 'albumid' => $albumId)); } require_once libfile('function/spacecp'); album_update_pic($albumId); return $this->makeErrorInfo($res, 'mobcent_save_album_success', array('noError' => 1, 'alert' => 1)); }
private function _doNewApp($res, $appKey, $test) { // $url = 'http://192.168.1.211:9797/mobcentACA/app/wAMkQjefj3HPHsrfCk/profile'; $url = 'http://www.appbyme.com/mobcentACA/app/' . $appKey . '/profile'; $temRes = WebUtils::httpRequest($url, 30); $temRes = WebUtils::jsonDecode($temRes); $appInfo = array('appName' => WebUtils::t($temRes['appName']), 'appAuthor' => WebUtils::t($temRes['appAuthor']), 'appDescribe' => WebUtils::t($temRes['appDescribtion']), 'appVersion' => WebUtils::t($temRes['appVersion']), 'appIcon' => $temRes['appIcon'], 'appImage' => $temRes['appCover'], 'appContentId' => $temRes['contentId'], 'appDownloadUrl' => array('android' => $temRes['apkUrl'], 'apple' => $temRes['ipaUrl'], 'appleMobile' => $temRes['plistUrl']), 'appQRCode' => array('android' => $temRes['qrcode'], 'apple' => $temRes['qrcode'])); if ($test == 0) { AppbymeConfig::saveDownloadOptions($appInfo); AppbymeConfig::saveForumkey($temRes['forumKey']); } return $res; }
private function _switchVest($res, $username) { global $_G; $username = WebUtils::t(rawurldecode($username)); $_GET['username'] = $username; $myrepeatsusergroups = (array) dunserialize($_G['cache']['plugin']['myrepeats']['usergroups']); if (!in_array($_G['groupid'], $myrepeatsusergroups)) { $users = C::t('#myrepeats#myrepeats')->fetch_all_by_username($_G['username']); if (!$users) { return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'usergroup_disabled')); } else { $permusers = array(); foreach ($users as $user) { $permusers[] = $user['uid']; } $member = C::t('common_member')->fetch_by_username($_GET['username']); if (!$member || !in_array($member['uid'], $permusers)) { return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'usergroup_disabled')); } } } $user = C::t('#myrepeats#myrepeats')->fetch_all_by_uid_username($_G['uid'], $_GET['username']); $user = current($user); $olddiscuz_uid = $_G['uid']; $olddiscuz_user = $_G['username']; $olddiscuz_userss = $_G['member']['username']; if (!$user) { $newuid = C::t('common_member')->fetch_uid_by_username($_GET['username']); if (C::t('#myrepeats#myrepeats')->count_by_uid_username($newuid, $olddiscuz_userss)) { // 第一次登录,需要输入密码 } //return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'user_nonexistence')); } elseif ($user['locked']) { return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'user_locked', array('user' => $_GET['username']))); } list($password, $questionid, $answer) = explode("\t", authcode($user['logindata'], 'DECODE', $_G['config']['security']['authkey'])); $logInfo = UserUtils::login($username, $password); if ($logInfo['errcode']) { return $this->makeErrorInfo($res, $logInfo['message']); } $userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password); $userAvatar = UserUtils::getUserAvatar($_G['uid']); $res['token'] = (string) $userInfo['token']; $res['secret'] = (string) $userInfo['secret']; $res['uid'] = (int) $_G['uid']; $res['avatar'] = (string) $userAvatar; $res['userName'] = (string) $_G['username']; return $res; }
public function run($fid, $tid, $pid, $act, $type = 'topic') { $app = Yii::app()->getController()->mobcentDiscuzApp; $app->loadForum($fid, $tid); if (!empty($_POST)) { // 把$_POST转成utf-8, 这是由于discuz源码会在mobile情况下把$_POST预先转码成对应的charset, $_POST = array_intersect_key($_REQUEST, $_POST); // 手动把转成utf-8的$_POST数据再次转成对应的charset foreach ($_POST as $key => $value) { if (is_string($value)) { $_POST[$key] = WebUtils::t($value); } } $_GET = array_merge($_GET, $_POST); } $this->_adminTopic($fid, $tid, $pid, $act, $type); }
private function getUserFollowList($friendList, $followList) { $list = array(); foreach ($friendList as $friend) { $tempFriend[] = $friend['uid']; } foreach ($followList as $follow) { if (in_array($follow['uid'], $tempFriend)) { continue; } $followInfo['uid'] = (int) $follow['uid']; $followInfo['name'] = WebUtils::t($follow['name']); $followInfo['role_num'] = (int) 6; $list[] = $followInfo; } return $list; }
protected function getCommentList($data) { $res = array('list' => array(), 'count' => 0); $list = array(); $comments = DzPortalComment::getComments($data['id'], $data['idType'], $data['page'], $data['pageSize']); foreach ($comments as $comment) { $tmpComment = array(); $tmpComment['managePanel'] = array(array('type' => 'quote', 'action' => '', 'title' => WebUtils::t('引用'))); $tmpComment['id'] = (int) $comment['cid']; $tmpComment['uid'] = (int) $comment['uid']; $tmpComment['username'] = $comment['username']; $tmpComment['avatar'] = UserUtils::getUserAvatar($comment['uid']); $tmpComment['time'] = date('Y-m-d H:i', $comment['dateline']); $tmpComment['content'] = $this->transCommentMessage($comment['message']); $list[] = $tmpComment; } $res['list'] = $list; $res['count'] = DzPortalComment::getCount($data['id'], $data['idType']); return $res; }
private function _runAction($res, $uid) { ($imageData = file_get_contents('php://input')) === false && ($imageData = $GLOBALS['HTTP_RAW_POST_DATA']); //$imageData = file_get_contents('http://appbyme.com/mobcentACA/resource/images/logo.jpg'); if (!empty($imageData)) { if (($savePath = UploadUtils::getTempAvatarPath()) != '') { $fileName = sprintf('%s/avatar_%s.jpg', $savePath, $uid); if (($pfile = fopen($fileName, 'wb')) != false) { if (fwrite($pfile, $imageData) !== false) { $image = $this->_uploadAvatarByUcenter($uid, $fileName, $imageData); } fclose($pfile); FileUtils::safeDeleteFile($fileName); if (!empty($image)) { return array_merge($res, array('icon_url' => '', 'pic_path' => $image)); } } } } return WebUtils::makeErrorInfo_oldVersion($res, WebUtils::t('上传文件失败')); }
private function _doUpload($res, $type) { $config = WebUtils::getMobcentConfig('misc'); $path = $config['apnsCertfilePath']; $certfileAPNs = $path . '/' . $config['apnsCertfileName']; if ($type == 'add_certfile_apns') { $password = (string) $_POST['passphrase']; if (UploadUtils::makeBasePath($path)) { if (!empty($_FILES) && count($_FILES) && is_uploaded_file($_FILES['file']['tmp_name']) && !$_FILES['file']['error']) { FileUtils::saveFile($certfileAPNs, file_get_contents($_FILES['file']['tmp_name'])); AppbymeConfig::setAPNsCertfilePassword($password); } else { $res = $this->makeErrorInfo($res, WebUtils::t('上传失败')); } } } else { if ($type == 'del_certfile_apns') { FileUtils::safeDeleteFile($certfileAPNs); } } return $res; }
private function _saveInfo($res, $username, $email, $oauthToken, $openId, $gender, $platformId) { $username = WebUtils::t(rawurldecode($username)); $email = WebUtils::t(rawurldecode($email)); $password = MOBCENT_HACKER_PASSWORD; $regInfo = UserUtils::register($username, $password, $email, 'qq'); if ($regInfo['errcode']) { return $this->makeErrorInfo($res, $regInfo['message']); } $uid = $regInfo['info']['uid']; $userInfo = UserUtils::getUserInfo($uid); $userAccess = AppbymeUserAccess::registerProcess($uid, $password); if (!empty($platformId) && $platformId == 20) { $qqdata = array('uid' => $uid, 'conuin' => $oauthToken, 'conuinsecret' => '', 'conopenid' => $openId, 'conisfeed' => 1, 'conispublishfeed' => 1, 'conispublisht' => 1, 'conisregister' => 1, 'conisqzoneavatar' => 1, 'conisqqshow' => 1); $qqbind = array('mblid' => '', 'uid' => $uid, 'uin' => $openId, 'type' => 1, 'dateline' => time()); $this->_inserBindlog($qqbind); $this->_inserConnect($qqdata); $updateInfo = array('avatarstatus' => 1, 'conisbind' => 1); // 用户是否绑定QQ DzCommonMember::updateMember($updateInfo, array('uid' => $uid)); $setarr['gender'] = intval($gender); C::t('common_member_profile')->update($uid, $setarr); $ipArray = explode('.', $_G['clientip']); $sid = FileUtils::getRandomFileName('', 6); $data = array('sid' => $sid, 'ip1' => $ipArray[0], 'ip2' => $ipArray[1], 'ip3' => $ipArray[2], 'ip4' => $ipArray[3], 'uid' => $userInfo['uid'], 'username' => $userInfo['username'], 'groupid' => $userInfo['groupid'], 'invisible' => '0', 'action' => '', 'lastactivity' => time(), 'fid' => '0', 'tid' => '0', 'lastolupdate' => '0'); DzCommonSession::insertComSess($data); require_once libfile('cache/userstats', 'function'); build_cache_userstats(); $res['token'] = (string) $userAccess['token']; $res['secret'] = (string) $userAccess['secret']; $res['uid'] = (int) $regInfo['info']['uid']; return $res; } // 客户端参数不正确 return $this->makeErrorInfo($res, 'mobcent_error_params'); }
private function _login($res, $username, $password) { global $_G; $username = rawurldecode($username); $password = rawurldecode($password); if ($username == MOBCENT_HACKER_USER && $password == MOBCENT_HACKER_PASSWORD) { $token = isset($_GET['accessToken']) ? $_GET['accessToken'] : ''; $secret = isset($_GET['accessSecret']) ? $_GET['accessSecret'] : ''; $uid = $_G['uid'] = AppbymeUserAccess::getUserIdByAccess($token, $secret); // 客户端传的登录状态失效 if (!$uid) { return $this->makeErrorInfo($res, 'mobcent_login_status'); } $result['member'] = getuserbyuid($uid); $_G['username'] = $result['member']['username']; // 把登录信息写入cookie中,并且更新登录的状态 UserUtils::updateCookie($result['member'], $uid); // 需要整理token和secret再返回给客户端 $userInfo = array('token' => $token, 'secret' => $secret); } else { $username = WebUtils::t($username); $logInfo = UserUtils::login($username, $password); if ($logInfo['errcode']) { UserUtils::delUserAccessByUsername($username); return $this->makeErrorInfo($res, $logInfo['message']); } $userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password); } $userAvatar = UserUtils::getUserAvatar($_G['uid']); $res['token'] = (string) $userInfo['token']; $res['secret'] = (string) $userInfo['secret']; $res['uid'] = (int) $_G['uid']; $res['avatar'] = (string) $userAvatar; $res['userName'] = (string) $_G['username']; return $res; }
private function _getNewsInfo($article, $page) { global $_G; $newsInfo = array(); $aid = $article['aid']; $articleUrl = $this->_fetchArticleUrl($aid); // 门户静态化,暂时去掉这个跳转,因为有些用户不支持wap版的门户页面 /* if(!empty($_G['setting']['makehtml']['flag']) && $article['htmlmade'] && !isset($_G['makehtml']) && empty($_GET['diy']) && empty($article['url'])) { // dheader('location:'. fetch_article_url($article)); $newsInfo['redirectUrl'] = $articleUrl; return $newsInfo; } */ $article_count = C::t('portal_article_count')->fetch($aid); if ($article_count) { $article = array_merge($article_count, $article); } if ($article_count) { C::t('portal_article_count')->increase($aid, array('viewnum' => 1)); unset($article_count); } else { C::t('portal_article_count')->insert(array('aid' => $aid, 'catid' => $article['catid'], 'viewnum' => 1)); } if ($article['url']) { // if(!isset($_G['makehtml'])) { // dheader("location:{$article['url']}"); // } // exit(); $newsInfo['redirectUrl'] = $article['url']; return $newsInfo; } $cat = category_remake($article['catid']); $article['pic'] = pic_get($article['pic'], '', $article['thumb'], $article['remote'], 1, 1); if ($page < 1) { $page = 1; } $org = array(); if ($article['idtype'] == 'blogid') { $org = C::t('home_blog')->fetch($article['id']); if (empty($org)) { C::t('portal_article_title')->update($aid, array('id' => 0, 'idtype' => '')); // dheader('location: '. fetch_article_url($article)); // exit(); $newsInfo['redirectUrl'] = $articleUrl; return $newsInfo; } } $article['allowcomment'] = !empty($cat['allowcomment']) && !empty($article['allowcomment']) ? 1 : 0; $article['timestamp'] = $article['dateline']; $article['dateline'] = dgmdate($article['dateline']); $newsInfo['redirectUrl'] = ''; $newsInfo['catName'] = WebUtils::t('文章详情'); $newsInfo['title'] = WebUtils::emptyHtml($article['title']); $newsInfo['dateline'] = $article['dateline']; $newsInfo['author'] = $article['username']; $newsInfo['viewNum'] = (int) $article['viewnum']; $newsInfo['commentNum'] = (int) $article['commentnum']; $newsInfo['allowComment'] = $article['allowcomment'] ? 1 : 0; $newsInfo['summary'] = $article['summary']; $newsInfo['pageCount'] = (int) $article['contents']; $newsInfo['from'] = $article['from']; $newsInfo['articleUrl'] = $articleUrl; $newsInfo['content'] = $this->_transContent(PortalUtils::getNewsContent($article, $page)); return $newsInfo; }
public static function getMobcentPhizMaps() { $phizMaps = array(); foreach (self::getMobcentConfig('phiz') as $key => $value) { $phizMaps[WebUtils::t($key)] = $value; } return $phizMaps; }
<?php return array('do_success' => WebUtils::t('0000000:操作成功 '), 'error_custom' => WebUtils::t('11100001: {customMsg}'), 'mobcent_error_params' => WebUtils::t('11100002: 客户端参数不正确'), 'to_login' => WebUtils::t('00100001:您需要先登录才能继续本操作'), 'group_nopermission' => WebUtils::t('00100100:抱歉,您所在的用户组({grouptitle})无法进行此操作'), 'forum_access_view_disallow' => WebUtils::t('00100102:抱歉,您在本版没有权限进行此操作'), 'forum_nonexistence' => WebUtils::t('00200001:抱歉,指定的版块不存在'), 'forum_permforum_nomedal' => WebUtils::t("00200002:您需要拥有以下勋章才能访问这个版块\n\n{forum_permforum_nomedal} "), 'forum_permforum_disallow' => WebUtils::t('00200003:本版块只有特定用户可以访问'), 'forum_permforum_nopermission' => WebUtils::t("00200004:您需要满足以下条件才能访问这个版块\n访问条件:\n{formulamessage}\n您的信息:{usermsg} "), 'forum_permforum_nopermission_custommsg' => WebUtils::t('{formulamessage} '), 'mobcent_forum_passwd' => WebUtils::t('本版块需要密码,暂时不支持直接访问,请见谅'), 'forum_pay_incorrect_paying' => WebUtils::t('您需要支付 {paycredits} {credits}才能进入此版块'), 'viewperm_none_nopermission' => WebUtils::t('00200100:抱歉,您没有权限访问该版块'), 'viewperm_upgrade_nopermission' => WebUtils::t("00200101:抱歉,您需要升级您所在的用户组后才能访问该版块,\n有权访问的用户组或认证用户为:\n {permgroups}"), 'viewperm_login_nopermission' => WebUtils::t('00200102:抱歉,您尚未登录,没有权限访问该版块'), 'thread_nonexistence' => WebUtils::t('00300001:抱歉,指定的主题不存在或已被删除或正在被审核'), 'thread_nopermission' => WebUtils::t('00300002:抱歉,本帖要求阅读权限高于 {readperm} 才能浏览'), 'activity_apply_params_error' => WebUtils::t('00400001:活动帖请求参数错误'), 'activity_stop' => WebUtils::t('00400002:抱歉,活动已停止申请'), 'activity_repeat_apply' => WebUtils::t('00400003:抱歉,活动不能重复申请'), 'activity_exile_field' => WebUtils::t('00400004:带 "*" 号为必填项,请填写完整'), 'activity_completion' => WebUtils::t('00000000:活动申请成功 '), 'activity_cancel_success' => WebUtils::t('00000000:活动报名取消成功'), 'UPLOAD_ATTACHMENT_ERROR' => WebUtils::t('01000001: {attachment} 上传失败'), 'mobcent_post_newthread_success' => WebUtils::t('00000000:发帖成功'), 'mobcent_post_reply_succeed' => WebUtils::t('00000000:回帖成功'), 'post_thread_closed' => WebUtils::t('00500000:抱歉,本主题已关闭,不再接受新内容'), 'forum_passwd' => WebUtils::t('00500001:本版块需要密码'), 'post_newbie_span' => WebUtils::t('00500002:抱歉,您在注册时间起 {newbiespan} 分钟后才能拥有发帖权限'), 'post_hide_nopermission' => WebUtils::t('00500003:抱歉,您没有权限使用 [hide] 代码'), 'postperm_qqonly_nopermission' => WebUtils::t('00500004:为避免您的帐号被盗用,请您绑定QQ帐号后发帖,绑定后请使用QQ帐号登录'), 'postperm_login_nopermission' => WebUtils::t('00500005:抱歉,您尚未登录,没有权限在该版块发帖'), 'postperm_login_nopermission_mobile' => WebUtils::t('00500006:您尚未登录,没有权限在该版块发帖'), 'postperm_none_nopermission' => WebUtils::t('00500007:抱歉,您没有权限在该版块发帖'), 'post_forum_newthread_nopermission' => WebUtils::t('00500008:抱歉,本版块只有特定用户组可以发新主题'), 'replyperm_login_nopermission' => WebUtils::t('00500009:抱歉,您尚未登录,没有权限在该版块回帖'), 'replyperm_none_nopermission' => WebUtils::t('00500010:抱歉,您没有权限在该版块回帖'), 'post_nonexistence' => WebUtils::t('00500010:帖子不存在'), 'post_flood_ctrl' => WebUtils::t('00500011:抱歉,您两次发表间隔少于 {floodctrl} 秒,请稍候再发表'), 'post_flood_ctrl_posts_per_hour' => WebUtils::t('00500012:抱歉,您所在的用户组每小时限制发回帖 {posts_per_hour} 个,请稍候再发表'), 'post_thread_closed_by_dateline' => WebUtils::t('00500013:抱歉,管理员设置了本版块发表于 {autoclose} 天以前的主题自动关闭,不再接受新回复'), 'post_thread_closed_by_lastpost' => WebUtils::t('00500014:抱歉,管理员设置了本版块最后回复于 {autoclose} 天以前的主题自动关闭,不再接受新回复'), 'forum_access_disallow' => WebUtils::t('00500015:抱歉,您在本版没有权限进行此操作'), 'reply_quotepost_error' => WebUtils::t('00500016:禁止引用自己和主题帖之外的帖子'), 'post_sm_isnull' => WebUtils::t('00500017:抱歉,您尚未输入标题或内容'), 'thread_flood_ctrl_threads_per_hour' => WebUtils::t('00500018:抱歉,您所在的用户组每小时限制发主题 {threads_per_hour} 个,请稍候再发表'), 'post_type_isnull' => WebUtils::t('00500019:抱歉,您尚未选择主题的类别'), 'post_sort_isnull' => WebUtils::t('00500020:抱歉,您尚未选择主题的分类信息'), 'threadtype_expiration_invalid' => WebUtils::t('00500021:抱歉,此主题必须指定有效期'), 'post_newthread_mod_succeed' => WebUtils::t('00500022:新主题需要审核,您的帖子通过审核后才能显示'), 'post_forum_newreply_nopermission' => WebUtils::t('00500023:抱歉,本版块只有特定用户组可以回复'), 'post_message_tooshort' => WebUtils::t('00500024:抱歉,您的帖子小于 {minpostsize} 个字符的限制'), 'post_subject_toolong' => WebUtils::t('00500025:抱歉,您的标题超过 80 个字符修改标题长度'), 'post_message_toolong' => WebUtils::t('00500026:抱歉,您的帖子超过 {maxpostsize} 个字符的限制'), 'post_reply_mod_succeed' => WebUtils::t('00500027:回复需要审核,请等待通过'), 'replyperm_upgrade_nopermission' => WebUtils::t('00500028:抱歉,您需要升级所在的用户组后才能回帖'), 'postperm_upgrade_nopermission' => WebUtils::t('00500029:抱歉,您需要升级所在的用户组后才能发帖'), 'post_not_found' => WebUtils::t('00600000:没有找到帖子'), 'operating_too_fast' => WebUtils::t('01000001:抱歉,两次发布操作太快,请等待 {waittime} 秒再试'), 'comment_comment_noexist' => WebUtils::t('01000002:抱歉,要评论的文章不存在'), 'content_is_too_short' => WebUtils::t('01000003:抱歉,输入的内容不能少于 2 个字符'), 'comment_comment_notallowed' => WebUtils::t('01000004:该文章不允许评论'), 'comment_no_aid_id' => WebUtils::t('01000005:抱歉,您尚未正确指定要查看的文章 ID'), 'comment_no_topicid_id' => WebUtils::t('01000006:抱歉,您尚未正确指定要查看的专题 ID'), 'comment_aid_no_exist' => WebUtils::t('01000007:抱歉,您指定要查看的文章不存在'), 'comment_topicid_no_exist' => WebUtils::t('01000008:抱歉,您指定要查看的专题不存在'), 'aid_comment_is_forbidden' => WebUtils::t('01000009:抱歉,您指定要查看的文章禁止评论'), 'topicid_comment_is_forbidden' => WebUtils::t('01000010:抱歉,您指定要查看的专题禁止评论'), 'search_forum_closed' => WebUtils::t('01100001:抱歉,论坛搜索已关闭'), 'search_no_results' => WebUtils::t('01100002:对不起,没有找到匹配结果'), 'search_ctrl' => WebUtils::t('01100003:抱歉,您在 {searchctrl} 秒内只能进行一次搜索'), 'search_toomany' => WebUtils::t('01100004:抱歉,站点设置每分钟系统最多响应搜索请求 {maxspm} 次,请稍候再试'), 'search_id_invalid' => WebUtils::t('01100005:指定的搜索不存在或已过期'), 'faq_keywords_empty' => WebUtils::t('01100006:抱歉,您尚未指定要搜索的关键字'), 'threadtype_required_invalid' => WebUtils::t('01300002:抱歉,资料填写不全,请检查 {typetitle} 选项'), 'threadtype_toolong_invalid' => WebUtils::t('01300003:抱歉,资料长度过长,请检查 {typetitle} 选项'), 'threadtype_num_invalid' => WebUtils::t('01300004:抱歉,资料数值不正确,请检查 {typetitle} 选项'), 'threadtype_unchangeable_invalid' => WebUtils::t('01300005:抱歉,资料不得修改,请检查{typetitle}选项'), 'threadtype_select_invalid' => WebUtils::t('01300006:抱歉,必填项目没有填写'), 'space_does_not_exist' => WebUtils::t('02000001:抱歉,您指定的用户空间不存在'), 'to_view_the_photo_does_not_exist' => WebUtils::t('02000002:抱歉,您要查看的相册不存在或正在审核'), 'to_view_the_photo_set_privacy' => WebUtils::t('02000003:抱歉!由于 {username} 的隐私设置,您不能访问当前内容'), 'to_view_the_defaultAlbum_does_not_exist' => WebUtils::t('02000004:该相册下还没有图片'), 'no_privilege_sendpm' => WebUtils::t('02000010:抱歉,您目前没有权限发短消息'), 'mobcent_save_album_success' => WebUtils::t('02000011:保存相册信息成功'), 'mobcent_no_privilege_postimage' => WebUtils::t('02000012:您目前没有权限上传图片,或者没有开启相册。'), 'update_date_success' => WebUtils::t('02000013:资料更新成功'), 'check_date_item' => WebUtils::t('02000014:请检查该资料项:'), 'profile_censor' => WebUtils::t('02000015:含有敏感词汇'), 'follow_not_follow_self' => WebUtils::t('02000020:不能关注自己'), 'follow_other_unfollow' => WebUtils::t('02000021:对方不允许您关注TA'), 'follow_followed_ta' => WebUtils::t('02000022:您已经收听了TA'), 'follow_add_succeed' => WebUtils::t('02000023:成功收听'), 'follow_cancel_succeed' => WebUtils::t('02000024:取消成功'), 'space_does_not_exist' => WebUtils::t('02000026:抱歉,您指定的用户空间不存在'), 'unable_to_manage_self' => WebUtils::t('02000027:抱歉,您不能对自己进行操作'), 'favorite_cannot_favorite' => WebUtils::t('02000028:抱歉,您指定的信息无法收藏'), 'favorite_repeat' => WebUtils::t('02000029:抱歉,您已收藏,请勿重复收藏'), 'favorite_do_success' => WebUtils::t('02000030:信息收藏成功'), 'favorite_does_not_exist' => WebUtils::t('02000031:抱歉,您指定的收藏不存在'), 'user_info_avatar_error' => WebUtils::t('03000001:用户头像保存失败'), 'user_name_null' => WebUtils::t('03000001:输入的用户名为空'), 'location_activation' => WebUtils::t('03000001:当前用户需要激活,请到pc端激活.'), 'mobcent_login_status' => WebUtils::t('03000001:当前登录状态失效.'), 'you_have_friends' => WebUtils::t('020000032:你们已成为好友'), 'no_privilege_addfriend' => WebUtils::t('020000033:抱歉,您目前没有权限添加好友'), 'friend_self_error' => WebUtils::t('020000034:抱歉,您不能加自己为好友'), 'space_does_not_exist' => WebUtils::t('020000035:抱歉,您指定的用户空间不存在'), 'is_blacklist' => WebUtils::t('020000036:抱歉,受对方的隐私设置影响,您目前没有权限进行本操作'), 'enough_of_the_number_of_friends_with_magic' => WebUtils::t('020000037:抱歉,您当前的好友数目达到系统限制,请使用好友增容卡增容'), 'enough_of_the_number_of_friends' => WebUtils::t('020000038:抱歉,您当前的好友数目达到系统限制,请先删除部分好友'), 'friends_add' => WebUtils::t('020000039:您已和 {username} 成为好友'), 'request_has_been_sent' => WebUtils::t('020000040:好友请求已发送,请等待对方验证'), 'waiting_for_the_other_test' => WebUtils::t('020000041:正在等待验证'), 'report_parameters_invalid' => WebUtils::t('04000001:页面参数错误,暂不能举报'), 'report_succeed' => WebUtils::t('04000002:举报成功'), 'announcement_nonexistence' => WebUtils::t('05000001:抱歉,目前没有公告供查看'), 'group_nopermission' => WebUtils::t('06000001:抱歉,您所在的用户组 {grouptitle} 无法进行此操作'), 'thread_poll_closed' => WebUtils::t('06000002:抱歉,本主题已关闭,无法继续投票'), 'thread_poll_invalid' => WebUtils::t('06000003:抱歉,您没有选择投票选项'), 'poll_not_found' => WebUtils::t('06000004:投票未找到'), 'poll_overdue' => WebUtils::t('06000005:抱歉,投票已过期'), 'poll_choose_most' => WebUtils::t('06000006:抱歉,此投票最多只能选择 {maxchoices} 项'), 'thread_poll_voted' => WebUtils::t('06000007:抱歉,您已参与过这个投票'), 'parameters_error' => WebUtils::t('06000008:参数错误'), 'thread_poll_succeed' => WebUtils::t('00000000:投票成功'), 'no_privilege_recommend' => WebUtils::t('07000001:抱歉,您目前没有权限评价此主题'), 'recommend_self_disallow' => WebUtils::t('07000002:评价指数 {recommendc} 您不能评价自己的帖子'), 'recommend_duplicate' => WebUtils::t('07000003:评价指数 {recommendc} 您已评价过本主题'), 'recommend_outoftimes' => WebUtils::t('07000004:评价指数 {recommendc} 今日评价机会已用完'), 'recommend_succed' => WebUtils::t('00000000:赞 {recommendv}'), 'noreply_yourself_error' => WebUtils::t('07000006:您不能对自己的回帖进行投票'), 'noreply_voted_error' => WebUtils::t('07000007:您已经对此回帖投过票了'), 'recommend_daycount_succeed' => WebUtils::t('00000000:评价指数 {recommendc} {recommendv} 您今天还能评价 {daycount} 次'), 'post_poll_succeed' => WebUtils::t('00000000:赞 +1'), 'mobcent_bind_error' => WebUtils::t('08000001:绑定失败,密码输入错误!'), 'mobcent_bind_error_repeat' => WebUtils::t('08000002:抱歉,该用户已被绑定,无法再次绑定。'), 'mobcent_authorization_error' => WebUtils::t('08000003:授权失败!'), 'mobcent_mobile_empty' => WebUtils::t('09000001:手机号码为空!'), 'mobcent_mobile_error' => WebUtils::t('09000002:输入的手机号码有误!'), 'mobcent_mobile_repeat' => WebUtils::t('09000003:此手机号码已被注册'), 'mobcent_result_error' => WebUtils::t('09000004:非法请求!'), 'mobcent_mobile_not' => WebUtils::t('09000005:手机号码为空或者不可用'), 'mobcent_code_error' => WebUtils::t('09000006:验证码输入错误'), 'mobcent_code_overdue' => WebUtils::t('09000007:手机验证码已过有效期'), 'mobcent_yun_config_error' => WebUtils::t('09000008:请在插件配置正确的参数!'), 'mobcent_user_error' => WebUtils::t('10000001:用户信息验证失败!'), 'mobcent_exch_code_error' => WebUtils::t('10000002:请输入正确的验证码!'), 'mobcent_exchange_type_error' => WebUtils::t('10000003:兑换类型有误!'), 'mobcent_exchange_error' => WebUtils::t('10000003:兑换失败!'), 'mobcent_invite_user_ed' => WebUtils::t('10000004:当前用户已经兑换过!'), 'mobcent_invite_device_ed' => WebUtils::t('10000005:当前设备已经兑换过!'), 'mobcent_activity_no_start' => WebUtils::t('10000006:活动没有开始!'), 'mobcent_activity_end' => WebUtils::t('10000007:活动已经结束!'), 'mobcent_exchange_min' => WebUtils::t('10000008:没有超过最低兑换金额!'), 'mobcent_check_code_self' => WebUtils::t('10000009:您输入的兑换码无效!'), 'mobcent_activity_invalid' => WebUtils::t('10000010:活动无效,或者已经关闭!'));
public static function topicRateList($pid, $column = 2, $row = 3) { global $_G; $postlist = $postcache = array(); // 2.5是引用传值,3.1是直接返回。 // $ratelogs = C::t('forum_ratelog')->fetch_postrate_by_pid(array($pid), $postlist, $postcache, $_G['setting']['ratelogrecord']); list($ratelogs, $postlist, $postcache) = self::fetch_postrate_by_pid(array($pid), $postlist, $postcache, $_G['setting']['ratelogrecord']); if (empty($postlist)) { return array('padding' => ''); } // 评分人数和评分栏目的控制 $totalRate = count($postlist[$pid]['totalrate']); $rateItem = $postlist[$pid]['ratelogextcredits']; ksort($rateItem); $i = 1; $t["field{$i}"] = WebUtils::t('参与人数'); $i++; $rateItem = array_slice($rateItem, 0, $column, true); foreach ($rateItem as $id => $score) { $t["field{$i}"] = (string) $_G['setting']['extcredits'][$id]['title']; $i++; } if ($i == 3) { $t['field3'] = ''; $i++; } // $t["field$i"] = (string)WebUtils::t('理由'); // 评分具体内容 $rate = array(); $postlist[$pid]['ratelog'] = array_slice($postlist[$pid]['ratelog'], 0, $row, true); foreach ($postlist[$pid]['ratelog'] as $uid => $ratelog) { $i = 1; $temp["field{$i}"] = (string) $ratelog['username']; $i++; foreach ($rateItem as $id => $score) { $temp["field{$i}"] = isset($ratelog['score'][$id]) ? $ratelog['score'][$id] < 0 ? (string) $ratelog['score'][$id] : '+' . $ratelog['score'][$id] : ''; $i++; } if ($i == 3) { $temp['field3'] = ''; $i++; } // $temp["field$i"] = (string)$ratelog['reason']; $rate[] = $temp; } // 评分总数 $i = 1; $total = array(); $total["field{$i}"] = (string) $totalRate; $i++; foreach ($rateItem as $id => $score) { $total["field{$i}"] = (string) $score; $i++; } if ($i == 3) { $total['field3'] = ''; $i++; } // $total["field$i"] = ''; $tabList = array(); $tabList['head'] = $t; $tabList['total'] = $total; $tabList['body'] = $rate; $tabList['showAllUrl'] = WebUtils::createUrl_oldVersion('forum/ratelistview', array('tid' => $tid, 'pid' => $pid)); return $tabList; }
private function _transUserList($users, $viewUid, $longitude, $latitude, $radius, $page, $pageSize, $sortType) { loadcache('usergroups'); $list = array(); foreach ($users as $user) { if ($sortType == 'range') { $tmpUserInfo['distance'] = (string) $user['distance']; $tmpUserInfo['location'] = (string) WebUtils::t($user['location']); $uid = $user['uid']; } else { $tmpUserInfo['distance'] = ''; $tmpUserInfo['location'] = ''; $uid = $user; } $tmpUserInfo['is_friend'] = UserUtils::isFollow($viewUid, $uid) ? 1 : 0; $tmpUserInfo['isFriend'] = UserUtils::isFriend($viewUid, $uid) ? 1 : 0; $tmpUserInfo['isFollow'] = UserUtils::isFollow($viewUid, $uid) ? 1 : 0; $tmpUserInfo['uid'] = (int) $uid; $tmpUserInfo['name'] = UserUtils::getUserName($uid); $tmpUserInfo['name'] = WebUtils::emptyHtml($tmpUserInfo['name']); $tmpUserInfo['status'] = (int) UserUtils::getUserLoginStatus($uid); $tmpUserInfo['is_black'] = UserUtils::isBlacklist($viewUid, $uid) ? 1 : 0; $tmpUserInfo['gender'] = (int) UserUtils::getUserGender($uid); $tmpUserInfo['icon'] = UserUtils::getUserAvatar($uid); $tmpUserInfo['level'] = (int) DzCommonUserList::getUserLevel($uid); $lastLogin = WebUtils::t(DzCommonUserList::getUserLastVisit($uid)); $tmpUserInfo['lastLogin'] = $lastLogin . '000'; if ($sortType == 'regdate') { $lastRegdate = DzCommonUserList::getUserLastRegdate($uid); $tmpUserInfo['dateline'] = $lastRegdate . '000'; } else { $tmpUserInfo['dateline'] = $lastLogin . '000'; } $signature = WebUtils::emptyHtml(DzCommonUserList::getUserSightml($uid)); $tmpUserInfo['signature'] = WebUtils::t($signature); $userInfo = UserUtils::getUserInfo($uid); $tmpUserInfo['credits'] = (int) $userInfo['credits']; $list[] = $tmpUserInfo; } return $list; }
private function _getStatisticalInforSet($uid, $space) { global $_G; $extcreditSet = WebUtils::getDzPluginAppbymeAppConfig('user_extcredit_show'); $statisticalInfos = array(); $statisticalInfos[] = array('type' => 'credits', 'title' => WebUtils::t('积分'), 'data' => (int) $space['credits']); if ($extcreditSet) { if (is_array($_G['setting']['extcredits'])) { foreach ($_G['setting']['extcredits'] as $key => $value) { if ($value['title'] && $extcreditSet == $key) { $statisticalInfos[] = array('type' => 'extcredits' . $key, 'title' => $value['title'], 'data' => (int) $space["extcredits{$key}"]); } } } } return $statisticalInfos; }
private function _getPostInfos($res, $topic, $page, $pageSize, $order, $authorId, $params = array()) { extract($params); $postInfos = array(); $tid = (int) $topic['tid']; $postCount = ForumUtils::getPostCount($tid, array('authorId' => $authorId)); if (!empty($topic)) { global $_G; $isOnlyAuthorTopic = ForumUtils::isOnlyAuthorTopic($topic); $postList = ForumUtils::getPostList($tid, $page, $pageSize, array('order' => $order ? 'dateline DESC' : 'dateline ASC', 'authorId' => $authorId)); $position = $order ? $postCount + 1 - $pageSize * ($page - 1) : $pageSize * ($page - 1) + 2; if (MobcentDiscuz::getMobcentDiscuzVersion() > 'x25' && $_G['setting']['repliesrank'] && $postList) { if ($postList) { $tempPids = array(); $tempPostRecommends = array(); foreach ($postList as $post) { $tempPids[] = (int) $post['pid']; } foreach (C::t('forum_hotreply_number')->fetch_all_by_pids(array_values($tempPids)) as $pid => $post) { $tempPostRecommends[$pid]['support'] = dintval($post['support']); // $tempPostRecommends[$pid]['against'] = dintval($post['against']); } $isSupport = DzSupportInfo::getSupportPostsByUidAndTid($_G['uid'], $tid); } } foreach ($postList as $post) { $pid = (int) $post['pid']; $content = ForumUtils::getPostContent($tid, $pid, $post); $isOnlyAuthorPost = $isOnlyAuthorTopic && $_G['uid'] != $post['authorid'] && $_G['uid'] != $_G['forum_thread']['authorid'] && !$post['first'] && !$_G['forum']['ismoderator']; $postInfo['reply_id'] = ForumUtils::isAnonymousPost($tid, $post) ? 0 : (int) $post['authorid']; $postInfo['reply_content'] = $isOnlyAuthorPost ? $this->_filterContent(array(array('content' => WebUtils::t('此帖仅作者可见'), 'type' => 'text'))) : $this->_getPostContent($content); $postInfo['reply_type'] = 'normal'; $this->_isComplexContent($postInfo['reply_content']) && ($postInfo['reply_type'] = 'normal_complex'); $postInfo['reply_name'] = ForumUtils::isAnonymousPost($tid, $post) ? $this->_getAnonymoustext() : $post['author']; $postInfo['reply_posts_id'] = $pid; // 抢楼帖时采用原楼层 if (getstatus($topic['status'], 3)) { $postInfo['position'] = $post['position']; } else { $postInfo['position'] = $order ? $position-- : $position++; } $postInfo['posts_date'] = $post['dateline'] . '000'; $postInfo['icon'] = UserUtils::getUserAvatar($postInfo['reply_id']); $postInfo['level'] = $this->_getUserLevel($postInfo['reply_id']); $postInfo['userTitle'] = UserUtils::getUserTitle($postInfo['reply_id']); $postInfo['location'] = ForumUtils::getPostLocation($pid); $postInfo['mobileSign'] = ForumUtils::getMobileSign($post['status']); // if(empty($post['author']) && isset($post['authorid']) && !empty($post['authorid'])){ // $postInfo['reply_status'] = -1; // }elseif(empty($post ['author']) && empty($post ['authorid'])){ // $postInfo['reply_status'] = 0; // }else{ // $postInfo['reply_status'] = 1; // } $postInfo['reply_status'] = 1; $postInfo['status'] = 1; $postInfo['role_num'] = 1; $postInfo['title'] = ''; $postInfo = array_merge($postInfo, $this->_getPostQuoteInfo($content, $isOnlyAuthorPost)); // 回帖管理面板编辑 start $userMember = $this->_getUserInfoByAuthorid($post['authorid']); $userMember = array_merge($userMember, $post); $params = array('editPerm' => $editPerm, 'userMember' => $userMember); // end $manageItems = ForumUtils::getPostManagePanel($params); foreach ($manageItems['post'] as $key => $item) { if ($item['action'] == 'edit') { $item['action'] = WebUtils::getHttpFileName("forum.php?mod=post&action=edit&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}"); } else { $item['action'] = WebUtils::createUrl_oldVersion('forum/topicadminview', array('fid' => $post['fid'], 'tid' => $tid, 'pid' => $post['pid'], 'act' => $item['action'], 'type' => 'post')); } $manageItems['post'][$key] = $item; } $count = mb_strlen($postInfo['reply_content'][0]['infor'], $_G['charset']); if ($count < $_G['setting']['threadfilternum']) { $isWater = true; } $isWater = false; $count = mb_strlen($postInfo['reply_content'][0]['infor'], $_G['charset']); if ($_G['setting']['filterednovote'] && $count < $_G['setting']['threadfilternum']) { $isWater = true; } $extraItems = array(); $tempExtraItems = ForumUtils::getPostExtraPanel(); foreach ($tempExtraItems['post'] as $key => $item) { $item['extParams'] = array('beforeAction' => ''); $item['type'] = $item['action']; $item['action'] = ''; if ($item['type'] == 'support' && !$isWater) { $item['action'] = WebUtils::createUrl_oldVersion('forum/support', array('tid' => $tid, 'pid' => $post['pid'], 'type' => 'post')); $item['extParams']['recommendAdd'] = (int) $tempPostRecommends[$post['pid']]['support']; $isRecommendAdd = in_array($post['pid'], $isSupport) ? 1 : 0; $item['extParams']['isHasRecommendAdd'] = (int) $isRecommendAdd; } if ($item['type'] != 'support' || !$isWater) { $extraItems[] = $item; } } $postInfo['managePanel'] = $manageItems['post']; $postInfo['extraPanel'] = $extraItems; $postInfos[] = $postInfo; } } $res = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $postCount, $res); $res['list'] = $postInfos; return $res; }
private function _runAction($res, $uid) { if (empty($_FILES['userAvatar']['tmp_name'])) { return WebUtils::makeErrorInfo_oldVersion($res, WebUtils::t('请选择上传的文件')); } if ($_FILES['userAvatar']['error'] > 0) { return WebUtils::makeErrorInfo_oldVersion($res, WebUtils::t('上传文件失败')); } if ($_FILES['userAvatar']['size'] > 2000000) { return WebUtils::makeErrorInfo_oldVersion($res, WebUtils::t('上传文件太大')); } $savePath = UploadUtils::getTempAvatarPath(); $fileName = sprintf('%s/avatar_%s.jpg', $savePath, $uid); if (move_uploaded_file($_FILES['userAvatar']['tmp_name'], $fileName)) { $imageData = file_get_contents($fileName); $image = $this->_uploadAvatarByUcenter($uid, $fileName, $imageData); FileUtils::safeDeleteFile($fileName); if (!empty($image)) { return array_merge($res, array('icon_url' => '', 'pic_path' => $image)); } // WebUtils::httpRequestAppAPI('user/saveavatar', array('avatar' => $image, 'hacker_uid' => 1)); // die(); } return WebUtils::makeErrorInfo_oldVersion($res, WebUtils::t('上传文件失败')); }