예제 #1
0
 function output()
 {
     global $_G;
     if (true === BigAppConf::$debug) {
         $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
     }
     $variable = array();
     if (isset($_G['messageparam'])) {
         foreach ($_G['messageparam'] as $value) {
             if (is_array($value) && isset($value['favid'])) {
                 $variable['favid'] = $value['favid'];
                 break;
             }
         }
     }
     if (!isset($variable['favid'])) {
         $sql = 'SELECT favid FROM ' . DB::table('home_favorite') . ' WHERE uid = ' . $_G['uid'] . ' AND id = ' . $_GET['id'] . ' AND idtype = \'fid\'';
         $query = DB::query($sql);
         while ($dbRet = DB::fetch($query)) {
             if (isset($dbRet['favid'])) {
                 $variable['favid'] = $dbRet['favid'];
                 break;
             }
         }
     }
     if (!isset($variable['favid'])) {
         $variable['favid'] = 0;
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #2
0
 function output()
 {
     global $_G;
     //如果拉取过,就在db里面标明
     if (isset($_REQUEST['pull']) && isset($_REQUEST['pull']) == '1') {
         $setting = array('bigapp_similes_zip' => '1');
         C::t('common_setting')->update_batch($setting);
         $variable['pull'] = '1';
     } else {
         if (!isset($_REQUEST['type']) || isset($_REQUEST['type']) && $_REQUEST['type'] == '0') {
             //$type_cnt = 0;
             foreach (C::t('forum_imagetype')->fetch_all_by_type('smiley') as $type) {
                 $available = $type['available'];
                 if ($available == '0') {
                     continue;
                 }
                 $id = $type['typeid'];
                 $tmp = array();
                 $tmp['name'] = $type['name'];
                 $tmp['directory'] = $type['directory'];
                 $smiley_cnt = 0;
                 foreach (C::t('common_smiley')->fetch_all_by_typeid_type($id, 'smiley') as $smiley) {
                     $tmp['smiley'][$smiley_cnt]['code'] = $smiley['code'];
                     $tmp['smiley'][$smiley_cnt]['url'] = $smiley['url'];
                     $tmp['smiley'][$smiley_cnt]['id'] = $smiley['id'];
                     $smiley_cnt++;
                 }
                 $variable['smilies'][] = $tmp;
             }
         }
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
 /**
  * add new comment
  * @param int $id post id
  * @param string $comment  comment value
  * @param int $parent_id 父评论的ID
  */
 public function add_comment($id, $comment, $author = '', $email = '', $parent_id = 0, $type = 0)
 {
     if (empty($id) || empty($comment)) {
         json_error(BigAppErr::$comment['code'], "empty id or comment");
     }
     $user_id = get_current_user_id();
     $comment_type = bigapp_core::check_comment_status();
     if ($comment_type == 2 && $user_id == 0) {
         if ($author == '' or $email == '') {
             json_error(BigAppErr::$comment['code'], 'need email or author');
         }
         if (false == check_email($email)) {
             json_error(BigAppErr::$comment['code'], 'email format is wrong');
         }
     }
     if ($comment_type == 3) {
         if ($user_id == 0) {
             json_error(BigAppErr::$login['code'], 'need login');
         }
     }
     $commentdata = array("comment_post_ID" => $id, 'comment_content' => $comment, 'comment_approved' => 1, 'comment_author' => $author, 'comment_author_email' => $email, 'comment_parent' => $parent_id, "user_ID" => $user_id);
     $result = wp_new_comment($commentdata);
     if (!$result) {
         json_error(BigAppErr::$comment['code'], "creat new comment failed");
     }
     return array('id' => $result);
 }
예제 #4
0
 public function output()
 {
     global $_G;
     if (!empty($GLOBALS['totalcomment'])) {
         $totalcomment = strip_tags($GLOBALS['totalcomment']);
         $info = explode(' ', $totalcomment);
         $data = array();
         foreach ($info as $index => $comment) {
             if ($comment) {
                 if (is_numeric($comment)) {
                     $data[$index / 2]['score'] = $comment;
                 } else {
                     $data[$index / 2]['option'] = $comment;
                 }
             }
         }
         $GLOBALS['totalcomment'] = array_reverse($data);
     }
     $variable = array();
     $variable['comments'] = $GLOBALS['comments'];
     $variable['totalcomment'] = $GLOBALS['totalcomment'];
     $variable['count'] = $GLOBALS['count'];
     $variable['need_more'] = $GLOBALS['count'] > $_GET['page'] * $_G['setting']['commentnumber'] ? 1 : 0;
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #5
0
 public function output()
 {
     global $_G;
     //echo  json_encode($_G['group']); die(0);
     //echo  json_encode($maxratetoday); die(0);
     // 评分项列表
     $raterange = $_G['group']['raterange'];
     $maxratetoday = getratingleft($raterange);
     $creditmap = $_G['setting']['extcredits'];
     $ratelist = array();
     $isself = 0;
     foreach ($raterange as $extcredits => &$im) {
         if (!isset($creditmap[$extcredits])) {
             continue;
         }
         $im["extcredits"] = $extcredits;
         $im["title"] = $creditmap[$extcredits]["title"];
         $im["todayleft"] = $maxratetoday[$extcredits];
         $ratelist[] = $im;
         if ($im['isself'] == 1) {
             $isself = 1;
         }
     }
     // 评分理由列表
     $reasons = explode("\n", $_G['setting']["userreasons"]);
     foreach ($reasons as $k => &$v) {
         $v = trim($v);
         if ($v == "") {
             unset($reasons[$k]);
         }
     }
     $variable = array("status" => isset($_G['messageparam'][0]) ? 0 : 1, "isself" => $isself, "ratelist" => $ratelist, "reasons" => $reasons);
     bigapp_core::result(bigapp_core::variable($variable));
     die(0);
 }
예제 #6
0
 public function output()
 {
     global $_G;
     if (true === BigAppConf::$debug) {
         $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
     }
     loadcache('forums');
     foreach ($GLOBALS['data']['hot']['threadlist'] as $tid => &$thread) {
         if (!isset($_G['cache']['stamps'][$thread['icon']]['url'])) {
             $thread['icon'] = -1;
         }
         $thread['forum_name'] = $_G['cache']['forums'][$thread['fid']]['name'];
     }
     //echo json_encode($GLOBALS['data']['hot']['threadlist']);
     //die(0);
     unset($thread);
     $GLOBALS['data']['hot']['threadlist'] = bigapp_core::getvalues($GLOBALS['data']['hot']['threadlist'], array('/^\\d+$/'), array('tid', 'attachment', 'avatar', 'subject', 'author', 'views', 'replies', 'forum_name', 'authorid', 'dateline'));
     if (is_null($GLOBALS['data']['hot']['threadlist']) || !is_array($GLOBALS['data']['hot']['threadlist'])) {
         $GLOBALS['data']['hot']['threadlist'] = array();
     }
     foreach ($GLOBALS['data']['hot']['threadlist'] as $tid => $thread) {
         $GLOBALS['data']['hot']['threadlist'][$tid]['avatar'] = avatar($thread['authorid'], 'big', true);
         $GLOBALS['data']['hot']['threadlist'][$tid]['dateline'] = str_replace(' ', '', $GLOBALS['data']['hot']['threadlist'][$tid]['dateline']);
     }
     /////////////////////////////////////////////////////////////////
     BigAppAPI::_getDetails($GLOBALS['data']['hot']['threadlist']);
     /////////////////////////////////////////////////////////////////
     $variable = array('data' => array_values($GLOBALS['data']['hot']['threadlist']), 'perpage' => $GLOBALS['perpage']);
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #7
0
 public function output()
 {
     global $_G;
     $messageval = $_G['messageparam'][0];
     $variable = array("status" => 1, "message_val" => $messageval);
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #8
0
 function output()
 {
     global $_G;
     if (true === BigAppConf::$debug) {
         $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
     }
     $list = array_values($GLOBALS['list']);
     $tids = array();
     foreach ($list as $key => $value) {
         $tids[] = $value['id'];
     }
     if ($tids) {
         $threadinfo = C::t('forum_thread')->fetch_all($tids);
     }
     foreach ($list as $key => $value) {
         $list[$key]['replies'] = $threadinfo[$value['id']]['replies'];
         $list[$key]['author'] = $threadinfo[$value['id']]['author'];
     }
     if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] <= 0) {
         $_GET['page'] = 1;
     }
     $start = $GLOBALS['perpage'] * ($_GET['page'] - 1);
     $end = count($GLOBALS['list']) + $start;
     if ($end >= $GLOBALS['count']) {
         $GLOBALS['need_more'] = 0;
     } else {
         $GLOBALS['need_more'] = 1;
     }
     $variable = array('list' => $list, 'perpage' => $GLOBALS['perpage'], 'count' => $GLOBALS['count'], 'need_more' => $GLOBALS['need_more']);
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #9
0
 public function output()
 {
     global $_G;
     if (true === BigAppConf::$debug) {
         $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
     }
     bigapp_core::result(bigapp_core::variable($G));
 }
예제 #10
0
 public function output()
 {
     global $_G;
     $variable = array();
     $variable['list'] = array_values($GLOBALS['list']);
     $variable['count'] = $GLOBALS['count'];
     $variable['need_more'] = $GLOBALS['count'] > $GLOBALS['page'] * $GLOBALS['perpage'] ? 1 : 0;
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #11
0
 function output()
 {
     global $_G;
     if (true === BigAppConf::$debug) {
         $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
     }
     $variable = array('pmid' => $GLOBALS['return']);
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #12
0
 public function output()
 {
     global $_G;
     $status = 0;
     if ($messageval == 'thread_rate_succeed') {
         $status = 1;
     }
     $variable = array("status" => $status);
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #13
0
 public function output()
 {
     global $_G;
     $messageval = $_G['messageparam'][0];
     $variable = array("status" => 0, "messageval" => $messageval, "show_message" => preg_replace("'<script[^>]*?>.*?</script>'si", "", $GLOBALS['show_message']));
     $errmsgvals = array('space_does_not_exist', 'submit_invalid');
     if (in_array($messageval, $errmsgvals)) {
         $variable["status"] = 1;
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #14
0
 function output()
 {
     global $_G;
     if (true === BigAppConf::$debug) {
         $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
     }
     $variable = array('messageval' => 'unkown_error', 'messagestr' => 'unkown error');
     if (isset($_G['Message'])) {
         $variable = $_G['Message'];
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #15
0
function check()
{
    $plat = $_GET["platform"];
    if ($plat == "qq") {
        include_once CUR_PATH . "/../qqconnect/check.php";
    }
    if ($plat == "wechat") {
        include_once CUR_PATH . "/../wechatconnect/check.php";
    }
    $variable["message"] = "unkown_plat";
    bigapp_core::result(bigapp_core::variable($variable));
}
예제 #16
0
 function output()
 {
     global $_G;
     $GLOBALS['space']['avatar'] = '';
     if (isset($GLOBALS['space']['uid']) && !empty($GLOBALS['space']['uid'])) {
         $GLOBALS['space']['avatar'] = avatar($GLOBALS['space']['uid'], 'big', true);
         $GLOBALS['space']['avatar'] = str_replace("\r", '', $GLOBALS['space']['avatar']);
         $GLOBALS['space']['avatar'] = str_replace("\n", '', $GLOBALS['space']['avatar']);
     }
     $tmp = bigapp_core::getvalues($GLOBALS['space'], array('uid', 'username', 'regdate', 'avatar', 'credits', 'gender', 'posts', 'threads', 'constellation', 'realname', 'group', 'self', 'friends', 'feedfriend'));
     $tmp['self'] = strval($tmp['self']);
     foreach ($_G['setting']['extcredits'] as $idx => $detail) {
         if (isset($GLOBALS['space']['extcredits' . $idx])) {
             $tmp['extcredits'][] = array('value' => $GLOBALS['space']['extcredits' . $idx], 'name' => $detail['title']);
         }
     }
     if (!isset($tmp['posts'])) {
         $tmp['posts'] = 0;
     }
     if (!isset($tmp['threads'])) {
         $tmp['threads'] = 0;
     }
     $tmp['posts'] = $tmp['posts'] - $tmp['threads'];
     if ($tmp['posts'] < 0) {
         $tmp['posts'] = 0;
     }
     $GLOBALS['space'] = $tmp;
     $GLOBALS['space']['group'] = bigapp_core::getvalues($GLOBALS['space']['group'], array('grouptitle'));
     if (empty($GLOBALS['space']['group'])) {
         unset($GLOBALS['space']['group']);
     } else {
         $GLOBALS['space']['group']['grouptitle'] = preg_replace('/<.*?\\>/', '', $GLOBALS['space']['group']['grouptitle']);
     }
     if (!isset($GLOBALS['space']['constellation'])) {
         $GLOBALS['space']['constellation'] = '';
     }
     $GLOBALS['space']['is_my_friend'] = 0;
     if (isset($GLOBALS['space']['feedfriend']) && $GLOBALS['space']['feedfriend'] != "") {
         $member_uid = $_G['uid'];
         $feedfriend = $GLOBALS['space']['feedfriend'];
         if ($member_uid == $feedfriend) {
             $GLOBALS['space']['is_my_friend'] = 1;
         } else {
             $arr = explode(",", $feedfriend);
             if (count($arr) > 0 && in_array($member_uid, $arr)) {
                 $GLOBALS['space']['is_my_friend'] = 1;
             }
         }
     }
 }
예제 #17
0
 public function output()
 {
     global $_G;
     $status = "1";
     if (!$_G['setting']['commentnumber']) {
         $status = "0";
     }
     $thread = C::t('forum_thread')->fetch($_GET['tid']);
     if ($thread['closed'] && !$_G['forum']['ismoderator']) {
         $status = "0";
     }
     $post = C::t('forum_post')->fetch('tid:' . $_G['tid'], $_GET['pid']);
     if ($_G['group']['allowcommentitem'] && !empty($_G['uid']) && $post['authorid'] != $_G['uid']) {
         $thread = C::t('forum_thread')->fetch($post['tid']);
         $itemi = $thread['special'];
         if ($thread['special'] > 0) {
             if ($thread['special'] == 2) {
                 $thread['special'] = $post['first'] || C::t('forum_trade')->check_goods($post['pid']) ? 2 : 0;
             } elseif ($thread['special'] == 127) {
                 $thread['special'] = $_GET['special'];
             } else {
                 $thread['special'] = $post['first'] ? $thread['special'] : 0;
             }
         }
         //$_G['setting']['commentitem'] = $_G['setting']['commentitem'][$thread['special']];
         if ($thread['special'] == 0) {
             loadcache('forums');
             if ($_G['cache']['forums'][$post['fid']]['commentitem']) {
                 $_G['setting']['commentitem'] = $_G['cache']['forums'][$post['fid']]['commentitem'];
             }
         }
         if ($_G['setting']['commentitem'] && !C::t('forum_postcomment')->count_by_pid($_GET['pid'], $_G['uid'], 1)) {
             $commentitem = explode("\n", $_G['setting']['commentitem']);
         }
     }
     $variable = array();
     $variable['status'] = $status;
     if ($status) {
         if (is_array($commentitem)) {
             foreach ($commentitem as $item) {
                 $item = trim($item);
                 $variable['comment_fields'][] = array("fieldid" => "commentitem[{$item}]", "title" => $item);
             }
         }
         $variable['comment_fields'][] = array("fieldid" => "message", "title" => "发表观点");
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #18
0
 function uploadmsg($statusid)
 {
     global $_G;
     $errorMap = array(0 => '上传成功', 10 => '非法提交', 2 => '上传失败', 6 => '附件个数超限制', 1 => '非法附件后缀', 2 => '上传失败', 3 => '附件超最大限制', 4 => '附件超最大限制', 5 => '附件超最大限制', 11 => '今日附件总大小超限制', 8 => '保存图片失败', 9 => '保存附件失败', 7 => '文件格式不一致');
     $msg = '附件提交失败';
     if (isset($errorMap[$statusid])) {
         $msg = $errorMap[$statusid];
     }
     if (function_exists('iconv')) {
         $msg = iconv('UTF-8', CHARSET . '//ignore', $msg);
     } else {
         $msg = mb_convert_encoding($msg, CHARSET, 'UTF-8');
     }
     $variable = array('code' => $statusid, 'message' => $msg, 'ret' => array('aId' => $this->aid, 'relative_url' => $this->attach['attachment'], 'abs_url' => ApiUtils::getDzRoot() . $_G['setting']['attachurl'] . 'forum/' . $this->attach['attachment'], 'image' => $this->attach['isimage'] ? -1 : 2));
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #19
0
 public function output()
 {
     global $_G;
     $variable = array("count" => $GLOBALS['count'], "list" => array_values(mobile_core::getvalues($GLOBALS['list'], array('/^.+?$/'), array('uid', 'username', 'gid', 'groupid', 'adminid'))));
     foreach ($variable["list"] as &$item) {
         $uid = $item["uid"];
         $gid = $item["groupid"];
         //unset($item["gid"]);
         //$item["groupid"] = $gid;
         $item["groupname"] = "unknown";
         if (isset($_G['cache']['usergroups'][$gid]['grouptitle'])) {
             $item['groupname'] = preg_replace('/<.*?\\>/', '', $_G['cache']['usergroups'][$gid]['grouptitle']);
         }
         $item["avatar"] = avatar($uid, 'big', 'true');
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #20
0
 function output()
 {
     $search = array("'<script[^>]*?>.*?</script>'si", "'<img.*src=\"(.*)\" .*>'iU", "'<a.*href=\"(.*)\".*target=\"_blank\">(.*)<\\/a>'iU", "'<[\\/\\!]*?[^<>]*?>'si", "'&(quot|#34);'i", "'&(amp|#38);'i", "'&(lt|#60);'i", "'&(gt|#62);'i", "'&(nbsp|#160);'i", "'&(iexcl|#161);'i", "'&(cent|#162);'i", "'&(pound|#163);'i", "'&(copy|#169);'i", "'\\\\r\\\\n'i");
     $replace = array("", "[img]\\1[/img]", "[url]\\1[/url]", "", "\"", "&", "<", ">", " ", chr(161), chr(162), chr(163), chr(169), "\r\n");
     foreach ($GLOBALS['list'] as &$value) {
         if (isset($value['message'])) {
             $message = preg_replace($search, $replace, $value['message']);
             $message = preg_replace_callback("/&#(\\d+);/i", function ($m) {
                 return chr($m[1]);
             }, $message);
             if (function_exists('iconv')) {
                 $message = iconv(CHARSET, 'UTF-8//ignore', $message);
             } else {
                 $message = mb_convert_encoding($message, 'UTF-8', CHARSET);
             }
             $message = $ret = preg_replace_callback('/\\[img](.*)\\[\\/img]/U', 'BigAppAPI::callback', $message);
             $value['message'] = '__DONT_DICONV_TO_UTF8___' . $message;
         }
         if (isset($value['msgtoid'])) {
             $value['msgtoid_avatar'] = avatar($value['msgtoid'], 'big', 'true');
             $value['msgtoid_avatar'] = str_replace("\r", '', $value['msgtoid_avatar']);
             $value['msgtoid_avatar'] = str_replace("\n", '', $value['msgtoid_avatar']);
         }
         if (isset($value['msgfromid'])) {
             $value['msgfromid_avatar'] = avatar($value['msgfromid'], 'big', 'true');
             $value['msgfromid_avatar'] = str_replace("\r", '', $value['msgfromid_avatar']);
             $value['msgfromid_avatar'] = str_replace("\n", '', $value['msgfromid_avatar']);
         }
     }
     unset($value);
     $variable = array('list' => bigapp_core::getvalues($GLOBALS['list'], array('/^\\d+$/'), array('plid', 'isnew', 'pmnum', 'lastupdate', 'lastdateline', 'authorid', 'author', 'pmtype', 'subject', 'members', 'dateline', 'touid', 'pmid', 'lastauthorid', 'lastauthor', 'lastsummary', 'msgfromid', 'msgfrom', 'message', 'msgtoid', 'msgtoid_avatar', 'msgfromid_avatar', 'tousername')), 'count' => $GLOBALS['count'], 'perpage' => $GLOBALS['perpage'], 'page' => intval($GLOBALS['page']));
     $start = $variable['perpage'] * ($variable['page'] - 1);
     $end = count($variable['list']) + $start;
     if ($end >= $variable['count']) {
         $variable['need_more'] = 0;
     } else {
         $variable['need_more'] = 1;
     }
     if ($_GET['subop']) {
         $variable = array_merge($variable, array('pmid' => $GLOBALS['pmid']));
     }
     $variable['list'] = array_values($variable['list']);
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #21
0
 function output()
 {
     global $_G;
     $perpage = 20;
     $page = isset($_G['page']) ? $_G['page'] : 1;
     $start = $perpage * ($page - 1);
     $view = $_GET['view'];
     $data[$view] = BigAppAPI::get_guide_list($view, $start, $perpage);
     $threadsInfo = isset($data[$view]['threadlist']) ? $data[$view]['threadlist'] : array();
     //数据映射
     foreach ($threadsInfo as $tid => &$thread) {
         if (!isset($_G['cache']['stamps'][$thread['icon']]['url'])) {
             $thread['icon'] = -1;
         }
         $thread['forum_name'] = $_G['cache']['forums'][$thread['fid']]['name'];
     }
     unset($thread);
     $threadsInfo = bigapp_core::getvalues($threadsInfo, array('/^\\d+$/'), array('tid', 'fid', 'posttableid', 'attachment', 'avatar', 'subject', 'author', 'views', 'replies', 'forum_name', 'authorid', 'icon', 'digest', 'dateline'));
     if (is_null($threadsInfo) || !is_array($threadsInfo)) {
         $threadsInfo = array();
     }
     foreach ($threadsInfo as $tid => $thread) {
         $threadsInfo[$tid]['avatar'] = avatar($thread['authorid'], 'big', true);
         $threadsInfo[$tid]['dateline'] = str_replace('&nbsp;', '', $threadsInfo[$tid]['dateline']);
         $threadsInfo[$tid]['dateline'] = preg_replace('/<.*?\\>/', '', $threadsInfo[$tid]['dateline']);
     }
     //filter &quot
     foreach ($threadsInfo as &$thread) {
         $thread['subject'] = str_replace('&quot;', '"', $thread['subject']);
     }
     BigAppAPI::_getDetails($threadsInfo);
     $thread_count = isset($data[$view]['threadcount']) ? $data[$view]['threadcount'] : 0;
     $need_more = $perpage * $page < $thread_count ? '1' : '0';
     $pic_mode = isset($_GET['style']) ? $_GET['style'] : '2';
     foreach ($threadsInfo as $tid => &$thread) {
         if ('2' == $pic_mode) {
             //无图模式
             $thread['attachment_urls'] = array();
             $thread['message_abstract'] = "";
         }
     }
     $variable = array("data" => array_values($threadsInfo), "count" => $thread_count, "page" => $page, "need_more" => $need_more, "pic_mode" => $pic_mode);
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #22
0
 public function output()
 {
     global $_G;
     $only_count = false;
     if (isset($_GET["only_count"]) && $_GET["only_count"] == 1) {
         $only_count = true;
     }
     if ($only_count) {
         $variable = array("count" => $GLOBALS['count']);
         bigapp_core::result(bigapp_core::variable($variable));
         return;
     }
     $variable = array("count" => $GLOBALS['count'], "list" => array_values(mobile_core::getvalues($GLOBALS['list'], array('/^.+?$/'), array('fuid', 'fusername', 'note', 'dateline', 'gid'))));
     $uidarr = array();
     foreach ($variable["list"] as &$item) {
         $uid = $item["fuid"];
         $username = $item["fusername"];
         unset($item["fuid"]);
         unset($item["fusername"]);
         $item["uid"] = $uid;
         $item["username"] = $username;
         $item["avatar"] = avatar($uid, 'big', 'true');
         $uidarr[] = $uid;
     }
     ////////////////////////////////
     // map group
     $ugmap = BigAppAPI::get_user_group_map($uidarr);
     foreach ($variable["list"] as &$item) {
         $uid = $item["uid"];
         $item["groupname"] = "unknown";
         if (!isset($ugmap[$uid])) {
             $item["groupid"] = 0;
         } else {
             $gid = $ugmap[$uid];
             $item["groupid"] = $gid;
             if (isset($_G['cache']['usergroups'][$gid]['grouptitle'])) {
                 $item['groupname'] = preg_replace('/<.*?\\>/', '', $_G['cache']['usergroups'][$gid]['grouptitle']);
             }
         }
     }
     ////////////////////////////////
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #23
0
 public function output()
 {
     global $_G;
     $creditmap = $_G['setting']['extcredits'];
     $variable = array("list" => $GLOBALS["loglist"]);
     foreach ($variable["list"] as $k => &$im) {
         //$im["credit"]
         $extcredits = $im["extcredits"];
         if (!isset($creditmap[$extcredits])) {
             unset($variable["list"][$k]);
         } else {
             $im["credit"] = $creditmap[$extcredits]["title"];
             unset($im["pid"]);
             unset($im["extcredits"]);
             unset($im["dateline"]);
         }
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #24
0
 function common()
 {
     global $_G;
     if (!isset($_GET['fid']) && isset($_GET['tid'])) {
         $sql = 'SELECT fid FROM ' . DB::table('forum_thread') . ' WHERE tid = ' . intval($_GET['tid']);
         $query = DB::query($sql);
         $fid = null;
         while ($tmp = DB::fetch($query)) {
             $fid = $tmp['fid'];
             break;
         }
         loadforum($fid, null);
     }
     $apifile = dirname(__FILE__) . '/sub_checkpost.php';
     if (file_exists($apifile)) {
         require_once $apifile;
     }
     bigapp_core::result(bigapp_core::variable(bigapp_api_sub::getvariable()));
 }
예제 #25
0
 function output()
 {
     global $_G;
     global $GLOBALS;
     if (true === BigAppConf::$debug) {
         $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
     }
     $GLOBALS['list'] = (array) $GLOBALS['list'];
     foreach ($GLOBALS['list'] as &$value) {
         $value['dateline'] = str_replace('&nbsp;', '', $value['dateline']);
         $value['dateline'] = preg_replace('/<.*?\\>/', '', $value['dateline']);
         $value['lastpost'] = str_replace('&nbsp;', '', $value['lastpost']);
         $value['lastpost'] = preg_replace('/<.*?\\>/', '', $value['lastpost']);
         $value['forum_name'] = $value['forumname'];
         unset($value['forumname']);
     }
     unset($value);
     $GLOBALS['list'] = bigapp_core::getvalues($GLOBALS['list'], array('/^\\d+$/'), array('author', 'forum_name', 'message', 'pid', 'subject', 'dateline', 'tid', 'replies', 'views', 'avatar', 'lastpost', 'lastposter', 'authorid', 'fid'));
     $GLOBALS['posts'] = (array) $GLOBALS['posts'];
     foreach ($GLOBALS['posts'] as &$value) {
         $value['dateline'] = date('Y-m-d H:i:s', $value['dateline']);
     }
     $GLOBALS['posts'] = bigapp_core::getvalues($GLOBALS['posts'], array('/^\\d+$/'), array('author', 'forum_name', 'message', 'pid', 'subject', 'dateline', 'tid', 'replies', 'views', 'avatar', 'lastpost', 'lastposter', 'authorid', 'fid'));
     unset($value);
     if (!empty($_GET['uid'])) {
         $variable['avatar'] = avatar($_GET['uid'], 'big', 'true');
     } else {
         $variable['avatar'] = avatar($_G['uid'], 'big', 'true');
     }
     $variable['avatar'] = str_replace("\r", '', $variable['avatar']);
     $variable['avatar'] = str_replace("\n", '', $variable['avatar']);
     $variable['data'] = (array) $GLOBALS['list'];
     foreach ($GLOBALS['posts'] as $value) {
         if (isset($variable['data'][$value['tid']])) {
             $variable['data'][$value['tid']]['details'][] = $value;
         }
     }
     $variable['data'] = array_values($variable['data']);
     bigapp_core::result($variable);
 }
예제 #26
0
 public static function outputList()
 {
     global $_G;
     $variable = array('applylist' => array());
     if (isset($GLOBALS['applylist']) && !empty($GLOBALS['applylist'])) {
         $variable['applylist'] = $GLOBALS['applylist'];
     }
     foreach ($variable['applylist'] as &$v) {
         $v['can_select'] = 1;
         if ($_G['uid'] === $v['uid']) {
             $v['can_select'] = 0;
         }
         $v['dateline'] = str_replace('&nbsp;', ' ', $v['dateline']);
         /*$ufielddata = $v['ufielddata'];
         		$ufielddata = str_replace('</li><li>', '__s__', $ufielddata);
         		$ufielddata = str_replace('<li>', '', $ufielddata);
         		$ufielddata = str_replace('</li>', '', $ufielddata);
         		$ufielddata = explode('__s__', $ufielddata);
         		$v['ufielddata'] = array();
         		foreach ($ufielddata as $item){
         			$item = explode(':', $item);
         			if(is_array($item) && count($item) === 2){
         				$k = trim($item[0]);
         				$_v = trim($item[1]);
         				$k = str_replace('&nbsp;', '', $k);
         				$_v = str_replace('&nbsp;', '', $_v);
         				$k = preg_replace('/<.*?\>/', '', $k);
         				$_v = preg_replace('/<.*?\>/', '', $_v);
         				$_v = str_replace("\r\n", ',', $_v);
         			}
         			$v['ufielddata'][$k] = $_v;
         		}
         		if(empty($v['ufielddata'])){
         			unset($v['ufielddata']);
         		}*/
     }
     unset($v);
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #27
0
 public function output()
 {
     global $_G;
     $map = array();
     foreach ($GLOBALS["nearlist"] as $uid => &$item) {
         $map[$uid] = $item;
     }
     foreach ($GLOBALS["onlinelist"] as $uid => &$item) {
         $map[$uid] = $item;
     }
     $variable = array("count" => count($map), "list" => array_values(mobile_core::getvalues($map, array('/^.+?$/'), array('uid', 'username', 'groupid'))));
     foreach ($variable["list"] as &$item) {
         $uid = $item["uid"];
         $gid = $item["groupid"];
         $item["groupname"] = "unknown";
         if (isset($_G['cache']['usergroups'][$gid]['grouptitle'])) {
             $item['groupname'] = preg_replace('/<.*?\\>/', '', $_G['cache']['usergroups'][$gid]['grouptitle']);
         }
         $item["avatar"] = avatar($uid, 'big', 'true');
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #28
0
 function output()
 {
     global $_G;
     $variable = array('pmid' => $GLOBALS['return'], 'message' => $_POST['show_message']);
     if (isset($_G['setting']['bigapp_push_config']) && is_string($_G['setting']['bigapp_push_config'])) {
         $_G['setting']['bigapp_push_config'] = unserialize($_G['setting']['bigapp_push_config']);
     }
     if (!isset($_G['setting']['bigapp_push_config']['push_enabled'])) {
         $_G['setting']['bigapp_push_config']['push_enabled'] = 1;
     }
     if ($_G['setting']['bigapp_push_config']['push_enabled']) {
         if ($GLOBALS['return'] > 0) {
             $sql = 'SELECT uid, username FROM ' . DB::table('common_member') . ' WHERE uid IN (' . $_G['uid'] . ', ' . $_REQUEST['touid'] . ')';
             $query = DB::query($sql);
             $uid = null;
             $touid = null;
             $user = null;
             $touser = null;
             while ($tmp = DB::fetch($query)) {
                 if ($tmp['uid'] === $_G['uid']) {
                     $uid = $_G['uid'];
                     $user = $tmp['username'];
                     continue;
                 }
                 $touid = $tmp['uid'];
                 $touser = $tmp['username'];
             }
             if (!is_null($uid) && !is_null($touid) && !is_null($user) && !is_null($touser) && $uid != $touid) {
                 if (function_exists('iconv')) {
                     $user = iconv(CHARSET, 'UTF-8//ignore', $user);
                     $touser = iconv(CHARSET, 'UTF-8//ignore', $touser);
                 } else {
                     $user = mb_convert_encoding($user, 'UTF-8', CHARSET);
                     $touser = mb_convert_encoding($touser, 'UTF-8', CHARSET);
                 }
                 $title = '您有新的消息,请注意查收';
                 $content = "用户 {$user} 向您发来新消息,详情点击查看";
                 $extra = array('user' => '__DONT_DICONV_TO_UTF8___' . $user, 'touser' => '__DONT_DICONV_TO_UTF8___' . $touser, 'uid' => $uid, 'touid' => $touid, 'pmid' => $GLOBALS['return'], 'message' => '__DONT_DICONV_TO_UTF8___' . $_REQUEST['message']);
                 require_once dirname(dirname(dirname(__FILE__))) . '/libs/pushmsg.inc.php';
                 $ret = PushMsg::sendMessage($touid, $title, $content, 1, $extra, 1);
                 //仅仅推送消息
                 $result = 'fail';
                 if (true === $ret) {
                     $result = 'succ';
                 }
                 runlog('bigapp', "[mobile]try to send message notice [ uid: {$uid}, touid: {$touid}, user: {$user}, touser: {$touser}, result: {$result} ].");
             }
         }
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #29
0
 function process()
 {
     global $_G;
     //1. try to get user mask
     $authority = array();
     if ($_G['uid'] && !empty($_G['member']['accessmasks'])) {
         loadcache('plugin');
         $bucketNum = 100003;
         $expire = 5;
         $userBucket = $_G['uid'] % $bucketNum;
         loadcache('bigapp_authority_' . $userBucket);
         if (!isset($_G['cache']['bigapp_authority_' . $userBucket]) || TIMESTAMP - $_G['cache']['bigapp_authority_' . $userBucket]['expiration'] > $expire) {
             $sql = 'SELECT uid, fid, allowview FROM ' . DB::table('forum_access') . ' WHERE uid % ' . $bucketNum . ' = ' . $userBucket;
             $query = DB::query($sql);
             $authorities = array();
             while ($tmp = DB::fetch($query)) {
                 $authorities[$tmp['uid']][$tmp['fid']] = $tmp['allowview'];
             }
             savecache('bigapp_authority_' . $userBucket, array('variable' => $authorities, 'expiration' => TIMESTAMP));
         } else {
             $authorities = $_G['cache']['bigapp_authority_' . $userBucket]['variable'];
         }
         if (isset($authorities[$_G['uid']])) {
             $authority = $authorities[$_G['uid']];
         }
     }
     //2. try to get all forums
     $forums = array();
     loadcache('bigapp_forumnav');
     $expire = 5;
     if (!isset($_G['cache']['bigapp_forumnav']) || empty($_G['cache']['bigapp_forumnav']) || TIMESTAMP - $_G['cache']['bigapp_forumnav']['expiration'] > $expire) {
         //need update all forums from database
         $sql = "SELECT f.fid, f.type, f.name, f.fup, f.status, f.threads, f.posts, f.todayposts, " . "ff.password, ff.redirect, ff.viewperm, ff.postperm, ff.threadtypes, ff.threadsorts, ff.icon, ff.description, ff.moderators FROM " . DB::table('forum_forum') . " f LEFT JOIN " . DB::table('forum_forumfield') . " ff USING(fid) WHERE f.status='1' ORDER BY f.type, f.displayorder";
         $query = DB::query($sql);
         while ($forum = DB::fetch($query)) {
             if ($forum['redirect'] || $forum['password']) {
                 continue;
             }
             if (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm'])) {
                 if ($forum['threadsorts']) {
                     $forum['threadsorts'] = bigapp_core::getvalues(unserialize($forum['threadsorts']), array('required', 'types'));
                 }
                 if ($forum['threadtypes']) {
                     $forum['threadtypes'] = unserialize($forum['threadtypes']);
                     $unsetthreadtype = false;
                     if ($_G['adminid'] == 3 && strpos($forum['moderators'], $_G['username']) === false) {
                         $unsetthreadtype = true;
                     }
                     if ($_G['adminid'] == 0) {
                         $unsetthreadtype = true;
                     }
                     if ($unsetthreadtype) {
                         foreach ($forum['threadtypes']['moderators'] as $k => $v) {
                             if (!empty($v)) {
                                 unset($forum['threadtypes']['types'][$k]);
                             }
                         }
                     }
                     $flag = 0;
                     foreach ($forum['threadtypes']['types'] as $k => $v) {
                         if ($k == 0) {
                             $flag = 1;
                             break;
                         }
                     }
                     if ($flag == 1) {
                         krsort($forum['threadtypes']['types']);
                     }
                     $forum['threadtypes'] = bigapp_core::getvalues($forum['threadtypes'], array('required', 'types'));
                 }
                 $moderators = explode("\t", $forum['moderators']);
                 if (!is_array($moderators) || 0 === count($moderators)) {
                     $forum['moderators'] = array();
                 } else {
                     foreach ($moderators as &$_v) {
                         $_v = "'{$_v}'";
                     }
                     unset($_v);
                     $sql = 'SELECT username, uid FROM ' . DB::table('common_member') . ' WHERE username IN (' . implode(', ', $moderators) . ')';
                     $subQuery = DB::query($sql);
                     $forum['moderators'] = array();
                     while ($moderator = DB::fetch($subQuery)) {
                         $forum['moderators'][] = array('uid' => $moderator['uid'], 'username' => $moderator['username']);
                     }
                 }
                 $forums[] = bigapp_core::getvalues($forum, array('fid', 'type', 'name', 'fup', 'viewperm', 'postperm', 'status', 'threadsorts', 'threadtypes', 'icon', 'description', 'threads', 'posts', 'todayposts', 'moderators'));
             }
         }
         //add result to syscache
         savecache('bigapp_forumnav', array('variable' => $forums, 'expiration' => TIMESTAMP));
     } else {
         $forums = $_G['cache']['bigapp_forumnav']['variable'];
     }
     //3. judge which forum should be displayed
     $retData = array();
     if (!empty($authority)) {
         foreach ($forums as $forum) {
             if (isset($authority[$forum['fid']]) && -1 == $authority[$forum['fid']]) {
                 continue;
             }
             $retData[] = $forum;
         }
     } else {
         $retData = $forums;
     }
     foreach ($retData as &$value) {
         BigAppAPI::_textDescription($value);
     }
     unset($value);
     $variable['forums'] = array_values(BigAppAPI::_sortResult($retData));
     $variable['forum_list'] = array();
     BigAppAPI::_doSearch($variable, 'forums', $variable['forum_list']);
     unset($variable['forums']);
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #30
0
 function error($errstr)
 {
     $variable = array('uploadavatar' => $errstr);
     bigapp_core::result(bigapp_core::variable($variable));
 }