First commit

This commit is contained in:
2025-06-18 10:24:27 +08:00
commit ebc39cd5dd
3873 changed files with 412712 additions and 0 deletions

0
source/plugin/index.htm Normal file
View File

View File

@@ -0,0 +1,39 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: buyattachment.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
$_GET['action'] = 'attachpay';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'filename' => $GLOBALS['attach']['filename'],
'description' => $GLOBALS['attach']['description'],
'authorid' => $GLOBALS['attach']['uid'],
'author' => $GLOBALS['attach']['author'],
'price' => $GLOBALS['attach']['price'],
'balance' => $GLOBALS['balance'],
'credit' => mobile_core::getvalues($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]], array('title', 'unit')),
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,37 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: buythread.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
$_GET['action'] = 'pay';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'authorid' => $GLOBALS['thread']['authorid'],
'author' => $GLOBALS['thread']['author'],
'price' => $GLOBALS['thread']['price'],
'balance' => $GLOBALS['balance'],
'credit' => mobile_core::getvalues($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]], array('title', 'unit')),
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,31 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: checkpost.php 32489 2013-01-29 03:57:16Z monkey $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'forumdisplay';
include_once 'forum.php';
class mobile_api {
public static function common() {
$apifile = 'source/plugin/mobile/api/'.$_GET['version'].'/sub_checkpost.php';
if(file_exists($apifile)) {
require_once $apifile;
}
mobile_core::result(mobile_core::variable(mobile_api_sub::getvariable()));
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,52 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: connect.php 34240 2013-11-21 08:32:04Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'connect';
include_once 'member.php';
class mobile_api {
public static function common() {
global $_G, $seccodecheck, $secqaacheck, $connect_guest;
if($_G['uid'] && $_G['member']['conisbind']) {
dheader('location: '.$_G['siteurl'].'index.php');
}
$connect_guest = array();
if($_G['connectguest'] && (submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck) || submitcheck('loginsubmit', 1, $seccodestatus))) {
if(!$_GET['auth_hash']) {
$_GET['auth_hash'] = $_G['cookie']['con_auth_hash'];
}
$conopenid = authcode($_GET['auth_hash']);
$connect_guest = C::t('#qqconnect#common_connect_guest')->fetch($conopenid);
if(!$connect_guest) {
dsetcookie('con_auth_hash');
showmessage('qqconnect:connect_login_first');
}
}
}
public static function output() {
if(!empty($_POST)) {
mobile_core::result(mobile_core::variable());
} else {
global $_G;
$bbrulehash = $_G['setting']['bbrules'] ? substr(md5(FORMHASH), 0, 8) : '';
$isconnect = $_G['qc']['connect_app_id'] && $_G['qc']['connect_openid'];
include template('mobile:register');
exit;
}
}
}
?>

View File

@@ -0,0 +1,32 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: favforum.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'spacecp';
$_GET['ac'] = 'favorite';
$_GET['type'] = 'forum';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,31 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: favthread.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'spacecp';
$_GET['ac'] = 'favorite';
$_GET['type'] = 'thread';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,64 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumdisplay.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
define('MOBILE_HIDE_STICKY', !isset($_GET['hidesticky']) ? 1 : $_GET['hidesticky']);
$_GET['mod'] = 'forumdisplay';
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
if(!empty($_GET['pw'])) {
$_GET['action'] = 'pwverify';
}
$_G['forum']['allowglobalstick'] = false;
}
public static function output() {
global $_G;
foreach($_G['forum_threadlist'] as $k => $thread) {
$_G['forum_threadlist'][$k]['cover'] = array();
if($thread['cover']) {
$_img = @getimagesize($thread['coverpath']);
if($_img) {
$_G['forum_threadlist'][$k]['cover'] = array('w' => $_img[0], 'h' => $_img[1]);
}
}
if(!$thread['authorid'] || !$thread['author']) {
$_G['forum_threadlist'][$k]['author'] = $_G['setting']['anonymoustext'];
$_G['forum_threadlist'][$k]['authorid'] = 0;
}
}
$variable = array(
'forum' => mobile_core::getvalues($_G['forum'], array('fid', 'fup', 'name', 'threads', 'posts', 'rules', 'autoclose', 'password')),
'group' => mobile_core::getvalues($_G['group'], array('groupid', 'grouptitle')),
'forum_threadlist' => mobile_core::getvalues($_G['forum_threadlist'], array('/^\d+$/'), array('tid', 'author', 'authorid', 'subject', 'subject', 'dbdateline', 'dateline', 'dblastpost', 'lastpost', 'lastposter', 'attachment', 'replies', 'readperm', 'views', 'digest', 'cover')),
'sublist' => mobile_core::getvalues($GLOBALS['sublist'], array('/^\d+$/'), array('fid', 'name', 'threads', 'todayposts', 'posts')),
'tpp' => $_G['tpp'],
'page' => $GLOBALS['page'],
);
if(!empty($_G['forum']['threadtypes']) || !empty($_GET['debug'])) {
$variable['threadtypes'] = $_G['forum']['threadtypes'];
}
if(!empty($_G['forum']['threadsorts']) || !empty($_GET['debug'])) {
$variable['threadsorts'] = $_G['forum']['threadsorts'];
}
$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumindex.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'index';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
if($_GET['checknotice']) {
$variable = array();
} else {
$variable = array(
'member_email' => $_G['member']['email'],
'member_credits' => $_G['member']['credits'],
'setting_bbclosed' => $_G['setting']['bbclosed'],
'group' => mobile_core::getvalues($_G['group'], array('groupid', 'grouptitle', '/^allow.+?$/')),
'catlist' => array_values(mobile_core::getvalues($GLOBALS['catlist'], array('/^\d+$/'), array('fid', 'name', 'forums'))),
'forumlist' => array_values(mobile_core::getvalues($GLOBALS['forumlist'], array('/^\d+$/'), array('fid', 'name', 'threads', 'posts', 'redirect', 'todayposts', 'description'))),
);
}
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,80 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumnav.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
$forums = array();
$sql = !empty($_G['member']['accessmasks']) ?
"SELECT f.fid, f.type, f.name, f.fup, f.status, ff.password, ff.redirect, ff.viewperm, ff.postperm, ff.threadtypes, ff.threadsorts
FROM ".DB::table('forum_forum')." f
LEFT JOIN ".DB::table('forum_forumfield')." ff ON ff.fid=f.fid
LEFT JOIN ".DB::table('forum_access')." a ON a.uid='{$_G['uid']}' AND a.allowview>'0' AND a.fid=f.fid
WHERE f.status='1' ORDER BY f.type, f.displayorder"
: "SELECT f.fid, f.type, f.name, f.fup, f.status, ff.password, ff.redirect, ff.viewperm, ff.postperm, ff.threadtypes, ff.threadsorts
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'] = mobile_core::getvalues(dunserialize($forum['threadsorts']), array('required', 'types'));
}
if($forum['threadtypes']) {
$forum['threadtypes'] = dunserialize($forum['threadtypes']);
$unsetthreadtype = false;
if($_G['adminid'] == 3 && strpos($forum['moderators'], $_G['username']) === false) {
$unsetthreadtype = true;
}
if(in_array($_G['adminid'], array(0, -1))) {
$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'] = mobile_core::getvalues($forum['threadtypes'], array('required', 'types'));
}
$forums[] = mobile_core::getvalues($forum, array('fid', 'type', 'name', 'fup', 'viewperm', 'postperm', 'status', 'threadsorts', 'threadtypes'));
}
}
$variable['forums'] = $forums;
mobile_core::result(mobile_core::variable($variable));
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumupload.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'swfupload';
$_GET['action'] = 'swfupload';
$_GET['operation'] = 'upload';
include_once 'misc.php';
class mobile_api {
public static function common() {}
public static function output() {}
}
?>

View File

@@ -0,0 +1,34 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: friend.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'friend';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'list' => array_values(mobile_core::getvalues($GLOBALS['list'], array('/^.+?$/'), array('uid', 'username'))),
'count' => $GLOBALS['count'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,47 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: hotforum.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
loadcache('mobile_hotforum');
if(!$_G['cache']['mobile_hotforum'] || TIMESTAMP - $_G['cache']['mobile_hotforum']['expiration'] > 3600) {
$query = DB::query("SELECT f.*, ff.redirect FROM ".DB::table('forum_forum')." f LEFT JOIN ".DB::table('forum_forumfield')." ff ON ff.fid=f.fid WHERE f.status='1' AND f.type='forum' ORDER BY f.todayposts DESC");
$data = array();
while($row = DB::fetch($query)) {
if($row['redirect']) {
continue;
}
list($row['lastpost_tid'], $row['lastpost_subject'], $row['lastpost'], $row['lastposter']) = explode("\t", $row['lastpost']);
$row['lastpost'] = dgmdate($row['lastpost']);
$data[] = mobile_core::getvalues($row, array('fid', 'name', 'threads', 'posts', 'lastpost', 'lastposter', 'lastpost_tid', 'lastpost_subject', 'todayposts'));
}
$variable = array(
'data' => $data,
);
savecache('mobile_hotforum', array('variable' => $variable, 'expiration' => TIMESTAMP));
} else {
$variable = $_G['cache']['mobile_hotforum']['variable'];
}
mobile_core::result(mobile_core::variable($variable));
}
public static function output() {
}
}
?>

View File

@@ -0,0 +1,67 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: hotthread.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'guide';
$_GET['view'] = 'hot';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
require_once libfile('function/post');
foreach($GLOBALS['data']['hot']['threadlist'] as $tid=>$thread) {
$GLOBALS['data']['hot']['threadlist'][$tid]['avatar'] = avatar($thread['authorid'], 'big', true);
$firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
if($thread['readperm'] < $_G['group']['readaccess'] && $firstpost['invisible'] == 0) {
$firstPostMessage = $firstpost['message'];
preg_match_all('/\[attach\](\d+)\[\/attach\]/i', $firstPostMessage, $matches, PREG_SET_ORDER);
$GLOBALS['data']['hot']['threadlist'][$tid]['attachmentImageNumber'] = count($matches);
$cnt = 0;
$aidList = array();
foreach ($matches as $i => $match) {
if ($cnt > 3) {
break;
}
$cnt += 1;
$aidList[] = $match[1];
}
$attachmentImageList = array();
$attachments = C::t('forum_attachment')->fetch_all($aidList);
foreach ($attachments as $aid => $attach) {
$attachment = C::t('forum_attachment_n')->fetch_attachment($attach["tableid"], $attach["aid"], true);
$attachmentImageList[] = $attachment;
}
$GLOBALS['data']['hot']['threadlist'][$tid]['attachmentImagePreviewList'] = $attachmentImageList;
$attach_img_text = lang('forum/misc', 'attach_img');
$attach_words = '['.$attach_img_text.']';
$firstPostMessage = preg_replace('/\[attach\](\d+)\[\/attach\]/i', $attach_words, $firstPostMessage);
$firstPostMessage = preg_replace('/<\/*.*?>|&nbsp;|\r\n|\[attachimg\].*?\[\/attachimg\]|\[quote\].*?\[\/quote\]|\[(?!'.$attach_words.')\/*.*?\]/ms', '', $firstPostMessage);
$firstPostMessage = trim(threadmessagecutstr($thread, $firstPostMessage, 500));
$GLOBALS['data']['hot']['threadlist'][$tid]['message'] = $firstPostMessage;
}
}
$variable = array(
'data' => array_values($GLOBALS['data']['hot']['threadlist']),
'perpage' => $GLOBALS['perpage'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

View File

@@ -0,0 +1,31 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: login.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'logging';
$_GET['action'] = !empty($_GET['action']) ? $_GET['action'] : 'login';
include_once 'member.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,36 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: myfavforum.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'favorite';
$_GET['type'] = 'forum';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'list' => array_values($GLOBALS['list']),
'perpage' => $GLOBALS['perpage'],
'count' => $GLOBALS['count'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: myfavthread.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'favorite';
$_GET['type'] = 'thread';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$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'];
}
$variable = array(
'list' => $list,
'perpage' => $GLOBALS['perpage'],
'count' => $GLOBALS['count'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,39 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: mypm.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'pm';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'list' => mobile_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', 'tousername')),
'count' => $GLOBALS['count'],
'perpage' => $GLOBALS['perpage'],
'page' => intval($GLOBALS['page']),
);
if($_GET['subop']) {
$variable = array_merge($variable, array('pmid' => $GLOBALS['pmid']));
}
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,34 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: mythread.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'guide';
$_GET['view'] = 'my';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'data' => array_values($GLOBALS['data']['my']['threadlist']),
'perpage' => $GLOBALS['perpage'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,87 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: newthread.php 34771 2014-07-30 09:29:44Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'post';
$_GET['action'] = 'newthread';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function post_mobile_message($message, $url_forward, $values, $extraparam, $custom) {
if($values['tid'] && $values['pid']) {
global $_G;
$threadstatus = DB::result_first("SELECT status FROM ".DB::table('forum_thread')." WHERE tid='{$values['tid']}'");
if(!empty($_POST['allowsound'])) {
$setstatus = array(1, 0, 0);
} elseif(!empty($_POST['allowphoto'])) {
$setstatus = array(0, 1, 1);
} elseif(!empty($_POST['allowlocal'])) {
$setstatus = array(0, 1, 0);
} else {
$setstatus = array(0, 0, 1);
}
foreach($setstatus as $i => $bit) {
$threadstatus = setstatus(13 - $i, $bit, $threadstatus);
}
C::t('forum_thread')->update($values['tid'], array('status' => $threadstatus));
$poststatus = DB::result_first("SELECT status FROM ".DB::table('forum_post')." WHERE pid='{$values['pid']}'");
$poststatus = setstatus(4, 1, $poststatus);
if(!empty($_POST['allowlocal'])) {
$poststatus = setstatus(6, 1, $poststatus);
}
if(!empty($_POST['allowsound'])) {
$poststatus = setstatus(7, 1, $poststatus);
}
if(!empty($_POST['mobiletype'])) {
$mobiletype = base_convert($_POST['mobiletype'], 10, 2);
$mobiletype = sprintf('%03d', $mobiletype);
for($i = 0;$i < 3;$i++) {
$poststatus = setstatus(10 - $i, $mobiletype[$i], $poststatus);
}
}
C::t('forum_post')->update_post(0, $values['pid'], array('status' => $poststatus));
if($_POST['location']) {
list($mapx, $mapy, $location) = explode('|', dhtmlspecialchars($_POST['location']));
C::t('forum_post_location')->insert(array(
'pid' => $values['pid'],
'tid' => $values['tid'],
'uid' => $_G['uid'],
'mapx' => $mapx,
'mapy' => $mapy,
'location' => $location,
));
}
}
}
public static function output() {
global $_G;
$variable = array(
'tid' => $GLOBALS['tid'],
'pid' => $GLOBALS['pid'],
);
if(!empty($_G['forum']['threadtypes'])) {
$variable['threadtypes'] = $_G['forum']['threadtypes'];
}
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,69 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: newthreads.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
require_once libfile('function/post');
$start = !empty($_GET['start']) ? $_GET['start'] : 0;
$limit = !empty($_GET['limit']) ? $_GET['limit'] : 20;
$variable['data'] = C::t('forum_newthread')->fetch_all_by_fids(dintval(explode(',', $_GET['fids']), true), $start, $limit);
foreach(C::t('forum_thread')->fetch_all_by_tid(array_keys($variable['data']), 0, $limit) as $thread) {
$thread['dbdateline'] = $thread['dateline'];
$thread['dblastpost'] = $thread['lastpost'];
$thread['dateline'] = dgmdate($thread['dateline'], 'u');
$thread['lastpost'] = dgmdate($thread['lastpost'], 'u');
$tid = $thread['tid'];
$firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
if($thread['readperm'] < $_G['group']['readaccess'] && $firstpost['invisible'] == 0) {
$firstPostMessage = $firstpost['message'];
preg_match_all('/\[attach\](\d+)\[\/attach\]/i', $firstPostMessage, $matches, PREG_SET_ORDER);
$thread['attachmentImageNumber'] = count($matches);
$cnt = 0;
$aidList = array();
foreach ($matches as $i => $match) {
if ($cnt > 3) {
break;
}
$cnt += 1;
$aidList[] = $match[1];
}
$attachmentImageList = array();
$attachments = C::t('forum_attachment')->fetch_all($aidList);
foreach ($attachments as $aid => $attach) {
$attachment = C::t('forum_attachment_n')->fetch_attachment($attach["tableid"], $attach["aid"], true);
$attachmentImageList[] = $attachment;
}
$thread['attachmentImagePreviewList'] = $attachmentImageList;
$attach_words = '['.lang('forum/misc', 'attach_img').']';
$attach_img_text = lang('forum/misc', 'attach_img');
$attach_words = '['.$attach_img_text.']';
$firstPostMessage = preg_replace('/\[attach\](\d+)\[\/attach\]/i', $attach_words, $firstPostMessage);
$firstPostMessage = preg_replace('/<\/*.*?>|&nbsp;|\r\n|\[attachimg\].*?\[\/attachimg\]|\[quote\].*?\[\/quote\]|\[(?!'.$attach_words.')\/*.*?\]/ms', '', $firstPostMessage);
$firstPostMessage = trim(threadmessagecutstr($thread, $firstPostMessage, 500));
$thread['message'] = $firstPostMessage;
$variable['data'][$thread['tid']] = mobile_core::getvalues($thread, array('tid', 'author', 'authorid', 'subject', 'subject', 'dbdateline', 'dateline', 'dblastpost', 'lastpost', 'lastposter', 'attachment', 'replies', 'readperm', 'views', 'digest', 'message', 'attachmentImageNumber', 'attachmentImagePreviewList'));
}
}
$variable['data'] = array_values($variable['data']);
mobile_core::result(mobile_core::variable($variable));
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,29 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: pollvote.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
$_GET['action'] = 'votepoll';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,36 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: profile.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'profile';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$data = $GLOBALS['space'];
unset($data['password'], $data['email'], $data['regip'], $data['lastip'], $data['regip_loc'], $data['lastip_loc'], $data['qq'], $data['alipay'], $data['icq'], $data['yahoo'], $data['msn'], $data['taobao'], $data['mobile'], $data['telephone'], $data['idcard'], $data['idcardtype'], $data['address'], $data['realname'], $data['zipcode']);
$variable = array(
'space' => $data,
'extcredits' => $_G['setting']['extcredits'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,37 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: publicpm.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'pm';
$_GET['filter'] = 'announcepm';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'list' => mobile_core::getvalues($GLOBALS['grouppms'], array('/^\d+$/'), array('id', 'authorid', 'author', 'dateline', 'message')),
'count' => count($GLOBALS['grouppms']),
'perpage' => $GLOBALS['perpage'],
'page' => $GLOBALS['page'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,39 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: register.php 32489 2013-01-29 03:57:16Z monkey $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'member.php';
class mobile_api {
public static function common() {
global $_G;
if(empty($_POST['regsubmit'])) {
$_G['mobile_version'] = intval($_GET['version']);
}
require_once libfile('class/member');
$ctl_obj = new register_ctl();
$ctl_obj->setting = $_G['setting'];
$ctl_obj->template = 'mobile:register';
$ctl_obj->on_register();
if(empty($_POST['regsubmit'])) {
exit;
}
}
public static function output() {
mobile_core::result(mobile_core::variable());
}
}
?>

View File

@@ -0,0 +1,61 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: seccode.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
require_once libfile('function/seccode');
$seccode = make_seccode($_GET['sechash']);
if(!$_G['setting']['nocacheheaders']) {
@header("Expires: -1");
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache");
}
require_once libfile('class/seccode');
$type = in_array($_G['setting']['seccodedata']['type'], array(2, 3)) ? 0 : $_G['setting']['seccodedata']['type'];
$code = new seccode();
$code->code = $seccode;
$code->type = $type;
$code->width = $_G['setting']['seccodedata']['width'];
$code->height = $_G['setting']['seccodedata']['height'];
$code->background = $_G['setting']['seccodedata']['background'];
$code->adulterate = $_G['setting']['seccodedata']['adulterate'];
$code->ttf = $_G['setting']['seccodedata']['ttf'];
$code->angle = $_G['setting']['seccodedata']['angle'];
$code->warping = $_G['setting']['seccodedata']['warping'];
$code->scatter = $_G['setting']['seccodedata']['scatter'];
$code->color = $_G['setting']['seccodedata']['color'];
$code->size = $_G['setting']['seccodedata']['size'];
$code->shadow = $_G['setting']['seccodedata']['shadow'];
$code->animator = 0;
$code->fontpath = DISCUZ_ROOT.'./static/image/seccode/font/';
$code->datapath = DISCUZ_ROOT.'./static/image/seccode/';
$code->includepath = DISCUZ_ROOT.'./source/class/';
$code->display();
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: secure.php 34397 2014-04-14 06:53:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
$seccodecheck = $secqaacheck = false;
if($_GET['type'] == 'register') {
$seccodecheck = $_G['setting']['seccodestatus'] & 1;
$secqaacheck = $_G['setting']['secqaa']['status'] & 1;
} elseif($_GET['type'] == 'login') {
$seccodecheck = $_G['setting']['seccodestatus'] & 2;
} elseif($_GET['type'] == 'post') {
$seccodecheck = ($_G['setting']['seccodestatus'] & 4) && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']);
$secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']);
}
$sechash = random(8);
if($seccodecheck || $secqaacheck) {
$variable = array('sechash' => $sechash);
if($seccodecheck) {
$variable['seccode'] = $_G['siteurl'].'api/mobile/index.php?module=seccode&sechash='.$sechash.'&version='.(empty($_GET['secversion']) ? '1' : $_GET['secversion']);
}
if($secqaacheck) {
require_once libfile('function/seccode');
$variable['secqaa'] = make_secqaa($sechash);
}
}
mobile_core::result(mobile_core::variable($variable));
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,34 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sendpm.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'spacecp';
$_GET['ac'] = 'pm';
$_GET['op'] = 'send';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'pmid' => $GLOBALS['return']
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,92 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sendreply.php 34771 2014-07-30 09:29:44Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'post';
$_GET['action'] = 'reply';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function post_mobile_message($message, $url_forward, $values, $extraparam, $custom) {
if($values['tid'] && $values['pid']) {
global $_G;
$threadstatus = DB::result_first("SELECT status FROM ".DB::table('forum_thread')." WHERE tid='{$values['tid']}'");
$setstatusold = base_convert(getstatus($threadstatus, 13).getstatus($threadstatus, 12).getstatus($threadstatus, 11), 2, 10);
$updatestatus = false;
if(!empty($_POST['allowsound'])) {
$setstatus = array(1, 0, 0);
$updatestatus = $setstatusold < 4;
} elseif(!empty($_POST['allowphoto'])) {
$setstatus = array(0, 1, 1);
$updatestatus = $setstatusold < 3;
} elseif(!empty($_POST['allowlocal'])) {
$setstatus = array(0, 1, 0);
$updatestatus = $setstatusold < 2;
} else {
$setstatus = array(0, 0, 1);
}
if($updatestatus) {
foreach($setstatus as $i => $bit) {
$threadstatus = setstatus(13 - $i, $bit, $threadstatus);
}
C::t('forum_thread')->update($values['tid'], array('status' => $threadstatus));
}
$posttable = getposttablebytid($values['tid']);
$poststatus = DB::result_first("SELECT status FROM ".DB::table($posttable)." WHERE pid='{$values['pid']}'");
$poststatus = setstatus(4, 1, $poststatus);
if(!empty($_POST['allowlocal'])) {
$poststatus = setstatus(6, 1, $poststatus);
}
if(!empty($_POST['allowsound'])) {
$poststatus = setstatus(7, 1, $poststatus);
}
if(!empty($_POST['mobiletype']) && $_POST['mobiletype'] < 8) {
$mobiletype = base_convert($_POST['mobiletype'], 10, 2);
$mobiletype = sprintf('%03d', $mobiletype);
for($i = 0;$i < 3;$i++) {
$poststatus = setstatus(10 - $i, $mobiletype[$i], $poststatus);
}
}
C::t('forum_post')->update_post('tid:'.$values['tid'], $values['pid'], array('status' => $poststatus));
if($_POST['location']) {
list($mapx, $mapy, $location) = explode('|', dhtmlspecialchars($_POST['location']));
C::t('forum_post_location')->insert(array(
'pid' => $values['pid'],
'tid' => $values['tid'],
'uid' => $_G['uid'],
'mapx' => $mapx,
'mapy' => $mapy,
'location' => $location,
));
}
}
}
public static function output() {
global $_G;
$variable = array(
'tid' => $_G['tid'],
'pid' => $GLOBALS['pid'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,30 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: signin.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'signin';
include_once 'misc.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,36 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: smiley.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
loadcache(array('smilies', 'smileytypes'));
$variable = array();
foreach($_G['cache']['smilies']['replacearray'] as $id => $img) {
$variable['smilies'][] = array(
'code' => $_G['cache']['smilies']['searcharray'][$id],
'image' => $_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$id]]['directory'].'/'.$img
);
}
mobile_core::result(mobile_core::variable($variable));
}
public static function output() {
}
}
?>

View File

@@ -0,0 +1,111 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sub_checkpost.php 32489 2013-01-29 03:57:16Z monkey $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
class mobile_api_sub {
public static function getvariable() {
global $_G;
if(empty($_G['forum'])) {
$allowpost = 0;
} elseif(!$_G['uid'] && !((!$_G['forum']['postperm'] && $_G['group']['allowpost']) || ($_G['forum']['postperm'] && forumperm($_G['forum']['postperm'])))) {
$allowpost = 0;
} elseif(empty($_G['forum']['allowpost'])) {
if(!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
$allowpost = 0;
} elseif($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
$allowpost = 0;
} else {
$allowpost = 1;
}
} elseif($_G['forum']['allowpost'] == -1) {
$allowpost = 0;
} else {
$allowpost = 1;
}
if(empty($_G['forum'])) {
$allowreply = 0;
} elseif(!$_G['uid'] && !((!$_G['forum']['replyperm'] && $_G['group']['allowreply']) || ($_G['forum']['replyperm'] && forumperm($_G['forum']['replyperm'])))) {
$allowreply = 0;
} elseif(empty($_G['forum']['allowreply'])) {
if(!$_G['forum']['replyperm'] && !$_G['group']['allowreply']) {
$allowreply = 0;
} elseif($_G['forum']['replyperm'] && !forumperm($_G['forum']['replyperm'])) {
$allowreply = 0;
} else {
$allowreply = 1;
}
} elseif($_G['forum']['allowreply'] == -1) {
$allowreply = 0;
} else {
$allowreply = 1;
}
$mobile_attachextensions = array('jpg', 'jpeg', 'gif', 'png', 'mp3', 'txt', 'zip', 'rar', 'pdf');
$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$allowupload = $_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || (!$_G['forum']['postattachperm'] && $_G['group']['allowpostattach']) || ($_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])));
$allowupload = $allowupload && (!$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > getuserprofile('todayattachs'));
$attachremain = array();
if($allowupload) {
$attachextensions = !$_G['group']['attachextensions'] ? $mobile_attachextensions : array_map('trim', explode(',', $_G['group']['attachextensions']));
$allowupload = $forummaxattachsize = array();
loadcache('attachtype');
if(isset($_G['cache']['attachtype'][$_G['forum']['fid']])) {
$attachtype = $_G['cache']['attachtype'][$_G['forum']['fid']];
} elseif(isset($_G['cache']['attachtype'][0])) {
$attachtype = $_G['cache']['attachtype'][0];
} else {
$attachtype = array();
}
if($attachtype) {
foreach($attachtype as $extension => $maxsize) {
$forummaxattachsize[$extension] = $maxsize;
}
}
foreach($mobile_attachextensions as $ext) {
if(in_array($ext, $attachextensions)) {
if(isset($forummaxattachsize[$ext])) {
if($forummaxattachsize[$ext] > 0) {
$allowupload[$ext] = $forummaxattachsize[$ext] ? $forummaxattachsize[$ext] : $_G['group']['maxattachsize'];
} else {
$allowupload[$ext] = 0;
}
} else {
$allowupload[$ext] = -1;
}
} else {
$allowupload[$ext] = 0;
}
}
$attachremain = array(
'size' => $_G['group']['maxsizeperday'] ? $_G['group']['maxsizeperday'] - getuserprofile('todayattachsize') : -1,
'count' => $_G['group']['maxattachnum'] ? $_G['group']['maxattachnum'] - getuserprofile('todayattachs') : -1,
);
} else {
$allowupload = array();
}
$uploadhash = md5(substr(md5($_G['config']['security']['authkey']), 8).$_G['uid']);
$allowperm = array();
$allowperm['allowperm'] = array();
$allowkey = array('allowpost', 'allowreply', 'allowupload', 'attachremain', 'uploadhash');
foreach($allowkey as $key) {
if((!empty(${$key}) || ${$key} === 0) || !empty($_GET['debug'])) {
$allowperm['allowperm'][$key] = ${$key};
}
}
return $allowperm;
}
}
?>

View File

@@ -0,0 +1,33 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sublist.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'forumdisplay';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'sublist' => mobile_core::getvalues($GLOBALS['sublist'], array('/^\d+$/'), array('fid', 'name', 'threads', 'todayposts', 'posts')),
);
$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,30 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: threadrecommend.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
$_GET['action'] = 'recommend';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: toplist.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'forumdisplay';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$threads = array();
loadcache('mobile_toplist_'.$_G['fid']);
if(!$_G['cache']['mobile_toplist_'.$_G['fid']] || TIMESTAMP - $_G['cache']['mobile_toplist_'.$_G['fid']]['expiration'] > 3600) {
$query = DB::query("SELECT * FROM ".DB::table('forum_thread')." WHERE tid IN (".dimplode($GLOBALS['stickytids']).") ORDER BY lastpost DESC");
while($thread = DB::fetch($query)) {
$threads[] = $thread;
}
$query = DB::query("SELECT * FROM ".DB::table('forum_thread')." WHERE `fid`='".$_G['fid']."' AND `displayorder`='1' ORDER BY lastpost DESC");
while($thread = DB::fetch($query)) {
$threads[] = $thread;
}
savecache('mobile_toplist_'.$_G['fid'], array('variable' => $threads, 'expiration' => TIMESTAMP));
} else {
$threads = $_G['cache']['mobile_toplist_'.$_G['fid']]['variable'];
}
$variable = array(
'forum_threadlist' => mobile_core::getvalues($threads, array('/^\d+$/')),
);
$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,154 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: viewthread.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'viewthread';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G, $thread, $postlist, $threadsortshow;
if($GLOBALS['hiddenreplies']) {
foreach($postlist as $k => $post) {
if(!$post['first'] && $_G['uid'] != $post['authorid'] && $_G['uid'] != $_G['forum_thread']['authorid'] && !$_G['forum']['ismoderator']) {
$postlist[$k]['message'] = lang('plugin/mobile', 'mobile_post_author_visible');
$postlist[$k]['attachments'] = array();
}
}
}
$_G['thread']['lastpost'] = dgmdate($_G['thread']['lastpost']);
$variable = array(
'thread' => $_G['thread'],
'fid' => $_G['fid'],
'postlist' => array_values(mobile_core::getvalues($postlist, array('/^\d+$/'), array('pid', 'tid', 'author', 'first', 'dbdateline', 'dateline', 'username', 'adminid', 'memberstatus', 'authorid', 'username', 'groupid', 'memberstatus', 'status', 'message', 'number', 'memberstatus', 'groupid', 'attachment', 'attachments', 'attachlist', 'imagelist', 'anonymous'))),
'imagelist' => array(),
'ppp' => $_G['ppp'],
'setting_rewriterule' => $_G['setting']['rewriterule'],
'setting_rewritestatus' => $_G['setting']['rewritestatus'],
'forum_threadpay' => $_G['forum_threadpay'],
'cache_custominfo_postno' => $_G['cache']['custominfo']['postno'],
);
if(!empty($threadsortshow)) {
$optionlist = array();
foreach ($threadsortshow['optionlist'] AS $key => $val) {
$val['optionid'] = $key;
$optionlist[] = $val;
}
if(!empty($optionlist)) {
$threadsortshow['optionlist'] = $optionlist;
$threadsortshow['threadsortname'] = $_G['forum']['threadsorts']['types'][$thread['sortid']];
}
}
$threadsortshowvar = mobile_core::getvalues($threadsortshow, array('/^(?!typetemplate).*$/'));
if(!empty($threadsortshowvar)) {
$variable['threadsortshow'] = $threadsortshowvar;
}
foreach($variable['postlist'] as $k => $post) {
if(!$_G['forum']['ismoderator'] && $_G['setting']['bannedmessages'] & 1 && (($post['authorid'] && !$post['username']) || ($_G['thread']['digest'] == 0 && ($post['groupid'] == 4 || $post['groupid'] == 5 || $post['memberstatus'] == '-1')))) {
$message = lang('forum/template', 'message_banned');
} elseif(!$_G['forum']['ismoderator'] && $post['status'] & 1) {
$message = lang('forum/template', 'message_single_banned');
} elseif($GLOBALS['needhiddenreply']) {
$message = lang('forum/template', 'message_ishidden_hiddenreplies');
} elseif($post['first'] && $_G['forum_threadpay']) {
$message = lang('forum/template', 'pay_threads').' '.$GLOBALS['thread']['price'].' '.$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['unit'].$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['title'];
} elseif($_G['forum_discuzcode']['passwordlock']) {
$message = lang('forum/template', 'message_password_exists');
} else {
$message = '';
}
if($message) {
$variable['postlist'][$k]['message'] = $message;
}
if($post['anonymous'] && !$_G['forum']['ismoderator']) {
$variable['postlist'][$k]['username'] = $variable['postlist'][$k]['author'] = $_G['setting']['anonymoustext'];
$variable['postlist'][$k]['adminid'] = $variable['postlist'][$k]['groupid'] = $variable['postlist'][$k]['authorid'] = 0;
if($post['first']) {
$variable['thread']['authorid'] = 0;
}
}
if(strpos($variable['postlist'][$k]['message'], '[/tthread]') !== FALSE) {
$matches = array();
preg_match('/\[tthread=(.+?),(.+?)\](.*?)\[\/tthread\]/', $variable['postlist'][$k]['message'], $matches);
$variable['postlist'][$k]['message'] = preg_replace('/\[tthread=(.+?)\](.*?)\[\/tthread\]/', lang('plugin/qqconnect', 'connect_tthread_message', array('username' => $matches[1], 'nick' => $matches[2])), $variable['postlist'][$k]['message']);
}
$firstpost = current($GLOBALS['postarr']);
if($firstpost['first'] && strpos($firstpost['message'],'[/hide]') !== FALSE ){
$authorreplyexist = false;
if(!$_G['forum']['ismoderator']) {
if($_G['uid']) {
$_post = C::t('forum_post')->fetch('tid:'.$_G['tid'], $pid);
$authorreplyexist = $_post['tid'] == $_G['tid'] ? C::t('forum_post')->fetch_pid_by_tid_authorid($_G['tid'], $_G['uid']) : false;
}
} else {
$authorreplyexist = true;
}
if(!$authorreplyexist){
$aids = array();
preg_match_all("/\[hide(.*?)?\]\s*(.*?)\s*\[\/hide\]/is",$firstpost['message'],$matches);
foreach ($matches[2] as $match){
preg_match_all("/\[attach\](\d+)\[\/attach\]/i",$match,$matchaids);
$aids = array_merge($aids,$matchaids[1]);
}
foreach($aids as $aid){
unset($variable['postlist'][$k]['attachments'][$aid]);
}
$variable['postlist'][$k]['attachlist'] = array_diff($variable['postlist'][$k]['attachlist'],$aids);
$variable['postlist'][$k]['imagelist'] = array_diff($variable['postlist'][$k]['imagelist'],$aids);
}
}
}
foreach($GLOBALS['aimgs'] as $pid => $aids) {
foreach($aids as $aid) {
$variable['imagelist'][] = $GLOBALS['postlist'][$pid]['attachments'][$aid]['url'].$GLOBALS['postlist'][$pid]['attachments'][$aid]['attachment'];
}
}
if(!empty($GLOBALS['polloptions'])) {
$variable['special_poll']['polloptions'] = $GLOBALS['polloptions'];
$variable['special_poll']['expirations'] = $GLOBALS['expirations'];
$variable['special_poll']['multiple'] = $GLOBALS['multiple'];
$variable['special_poll']['maxchoices'] = $GLOBALS['maxchoices'];
$variable['special_poll']['voterscount'] = $GLOBALS['voterscount'];
$variable['special_poll']['visiblepoll'] = $GLOBALS['visiblepoll'];
$variable['special_poll']['allowvote'] = $_G['group']['allowvote'];
$variable['special_poll']['remaintime'] = $thread['remaintime'];
}
if(!empty($GLOBALS['rewardprice'])) {
$variable['special_reward']['rewardprice'] = $GLOBALS['rewardprice'].' '.$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['title'];
$variable['special_reward']['bestpost'] = $GLOBALS['bestpost'];
}
if(!empty($GLOBALS['trades'])) {
$variable['special_trade'] = $GLOBALS['trades'];
}
if(!empty($GLOBALS['debate'])) {
$variable['special_debate'] = $GLOBALS['debate'];
}
if(!empty($GLOBALS['activity'])) {
$variable['special_activity'] = $GLOBALS['activity'];
}
$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,79 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumimage.php 32489 2013-01-29 03:57:16Z monkey $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
if(!defined('IN_DISCUZ') || empty($_GET['aid']) || empty($_GET['size']) || empty($_GET['key'])) {
header('location: '.$_G['siteurl'].'static/image/common/none.gif');
exit;
}
$allowsize = array('960x960', '268x380', '266x698', '2000x2000');
if(!in_array($_GET['size'], $allowsize)) {
header('location: '.$_G['siteurl'].'static/image/common/none.gif');
exit;
}
$nocache = !empty($_GET['nocache']) ? 1 : 0;
$daid = intval($_GET['aid']);
$type = !empty($_GET['type']) ? $_GET['type'] : 'fixwr';
list($w, $h) = explode('x', $_GET['size']);
$dw = intval($w);
$dh = intval($h);
$thumbfile = 'image/'.$daid.'_'.$dw.'_'.$dh.'.jpg';
$parse = parse_url($_G['setting']['attachurl']);
$attachurl = !isset($parse['host']) ? $_G['siteurl'].$_G['setting']['attachurl'] : $_G['setting']['attachurl'];
if(!$nocache) {
if(file_exists($_G['setting']['attachdir'].$thumbfile)) {
dheader('location: '.$attachurl.$thumbfile);
}
}
define('NOROBOT', TRUE);
$id = !empty($_GET['atid']) ? $_GET['atid'] : $daid;
if(md5($id.'|'.$dw.'|'.$dh) != $_GET['key']) {
dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
}
if($attach = C::t('forum_attachment_n')->fetch_attachment('aid:'.$daid, $daid, array(1, -1))) {
if(!$dw && !$dh && $attach['tid'] != $id) {
dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
}
dheader('Expires: '.gmdate('D, d M Y H:i:s', TIMESTAMP + 3600).' GMT');
if($attach['remote']) {
$filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'];
} else {
$filename = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
}
require_once libfile('class/image');
$img = new image;
if($img->Thumb($filename, $thumbfile, $w, $h, $type)) {
if($nocache) {
dheader('Content-Type: image');
@readfile($_G['setting']['attachdir'].$thumbfile);
@unlink($_G['setting']['attachdir'].$thumbfile);
} else {
dheader('location: '.$attachurl.$thumbfile);
}
} else {
dheader('Content-Type: image');
@readfile($filename);
}
}
exit;
}
}
?>

View File

View File

@@ -0,0 +1,25 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp.php 32489 2013-01-29 03:57:16Z monkey $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'modcp';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
mobile_core::result(mobile_core::variable());
}
}
?>

View File

@@ -0,0 +1,33 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: mynotelist.php 32489 2013-01-29 03:57:16Z monkey $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'notice';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$variable = array(
'list' => mobile_core::getvalues($GLOBALS['list'], array('/^\d+$/'), array('id', 'uid', 'type', 'new', 'authorid', 'author', 'note', 'dateline', 'from_id', 'from_idtype', 'from_num', 'style', 'rowid')),
'count' => $GLOBALS['count'],
'perpage' => $GLOBALS['perpage'],
'page' => intval($GLOBALS['page']),
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: pollvote.php 32489 2013-01-29 03:57:16Z monkey $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
$_GET['action'] = 'votepoll';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
mobile_core::result(mobile_core::variable());
}
}
?>

View File

@@ -0,0 +1,111 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sub_checkpost.php 34236 2013-11-21 01:13:12Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
class mobile_api_sub {
public static function getvariable() {
global $_G;
if(empty($_G['forum'])) {
$allowpost = 0;
} elseif(!$_G['uid'] && !((!$_G['forum']['postperm'] && $_G['group']['allowpost']) || ($_G['forum']['postperm'] && forumperm($_G['forum']['postperm'])))) {
$allowpost = 0;
} elseif(empty($_G['forum']['allowpost'])) {
if(!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
$allowpost = 0;
} elseif($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
$allowpost = 0;
} else {
$allowpost = 1;
}
} elseif($_G['forum']['allowpost'] == -1) {
$allowpost = 0;
} else {
$allowpost = 1;
}
if(empty($_G['forum'])) {
$allowreply = 0;
} elseif(!$_G['uid'] && !((!$_G['forum']['replyperm'] && $_G['group']['allowreply']) || ($_G['forum']['replyperm'] && forumperm($_G['forum']['replyperm'])))) {
$allowreply = 0;
} elseif(empty($_G['forum']['allowreply'])) {
if(!$_G['forum']['replyperm'] && !$_G['group']['allowreply']) {
$allowreply = 0;
} elseif($_G['forum']['replyperm'] && !forumperm($_G['forum']['replyperm'])) {
$allowreply = 0;
} else {
$allowreply = 1;
}
} elseif($_G['forum']['allowreply'] == -1) {
$allowreply = 0;
} else {
$allowreply = 1;
}
$mobile_attachextensions = array('jpg', 'jpeg', 'gif', 'png', 'mp3', 'txt', 'zip', 'rar', 'pdf');
$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$allowupload = $_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || (!$_G['forum']['postattachperm'] && $_G['group']['allowpostattach']) || ($_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])));
$allowupload = $allowupload && (!$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > getuserprofile('todayattachs'));
$attachremain = array();
if($allowupload) {
$attachextensions = !$_G['group']['attachextensions'] ? $mobile_attachextensions : array_map('trim', explode(',', $_G['group']['attachextensions']));
$allowupload = $forummaxattachsize = array();
loadcache('attachtype');
if(isset($_G['cache']['attachtype'][$_G['forum']['fid']])) {
$attachtype = $_G['cache']['attachtype'][$_G['forum']['fid']];
} elseif(isset($_G['cache']['attachtype'][0])) {
$attachtype = $_G['cache']['attachtype'][0];
} else {
$attachtype = array();
}
if($attachtype) {
foreach($attachtype as $extension => $maxsize) {
$forummaxattachsize[$extension] = $maxsize;
}
}
foreach($mobile_attachextensions as $ext) {
if(in_array($ext, $attachextensions)) {
if(isset($forummaxattachsize[$ext])) {
if($forummaxattachsize[$ext] > 0) {
$allowupload[$ext] = $forummaxattachsize[$ext] ? $forummaxattachsize[$ext] : $_G['group']['maxattachsize'];
} else {
$allowupload[$ext] = 0;
}
} else {
$allowupload[$ext] = -1;
}
} else {
$allowupload[$ext] = 0;
}
}
$attachremain = array(
'size' => $_G['group']['maxsizeperday'] ? $_G['group']['maxsizeperday'] - getuserprofile('todayattachsize') : -1,
'count' => $_G['group']['maxattachnum'] ? $_G['group']['maxattachnum'] - getuserprofile('todayattachs') : -1,
);
} else {
$allowupload = array();
}
$uploadhash = md5(substr(md5($_G['config']['security']['authkey']), 8).$_G['uid']);
$allowperm = array();
$allowperm['allowperm'] = array();
$allowkey = array('allowpost', 'allowreply', 'allowupload', 'attachremain', 'uploadhash');
foreach($allowkey as $key) {
if((!empty(${$key}) || ${$key} === 0) || !empty($_GET['debug'])) {
$allowperm['allowperm'][$key] = ${$key};
}
}
return $allowperm;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: topicadmin.php 32489 2013-01-29 03:57:16Z monkey $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'topicadmin';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
mobile_core::result(mobile_core::variable());
}
}
?>

View File

@@ -0,0 +1,146 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: uploadavatar.php 34944 2014-09-05 08:06:41Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'spacecp';
$_GET['ac'] = 'avatar';
include_once 'home.php';
class mobile_api {
public static $tmpavatar;
public static $tmpavatarbig;
public static $tmpavatarmiddle;
public static $tmpavatarsmall;
public static function common() {
global $_G;
if(empty($_G['uid'])) {
self::error('api_uploadavatar_unavailable_user');
}
if(empty($_FILES['Filedata'])) {
self::error('api_uploadavatar_unavailable_pic');
}
list($width, $height, $type, $attr) = getimagesize($_FILES['Filedata']['tmp_name']);
$imgtype = array(1 => '.gif', 2 => '.jpg', 3 => '.png');
$filetype = $imgtype[$type];
if (!$filetype) {
$filetype = '.jpg';
}
$avatarpath = $_G['setting']['attachdir'];
$tmpavatar = $avatarpath.'./temp/upload'.$_G['uid'].$filetype;
file_exists($tmpavatar) && @unlink($tmpavatar);
if(@copy($_FILES['Filedata']['tmp_name'], $tmpavatar) || @move_uploaded_file($_FILES['Filedata']['tmp_name'], $tmpavatar)) {
@unlink($_FILES['Filedata']['tmp_name']);
list($width, $height, $type, $attr) = getimagesize($tmpavatar);
if($width < 10 || $height < 10 || $type == 4) {
@unlink($tmpavatar);
self::error('api_uploadavatar_unusable_image');
}
} else {
@unlink($_FILES['Filedata']['tmp_name']);
self::error('api_uploadavatar_service_unwritable');
}
$tmpavatarbig = './temp/upload'.$_G['uid'].'big'.$filetype;
$tmpavatarmiddle = './temp/upload'.$_G['uid'].'middle'.$filetype;
$tmpavatarsmall = './temp/upload'.$_G['uid'].'small'.$filetype;
$image = new image;
if($image->Thumb($tmpavatar, $tmpavatarbig, 200, 250, 1) <= 0) {
self::error('api_uploadavatar_unusable_image');
}
if($image->Thumb($tmpavatar, $tmpavatarmiddle, 120, 120, 1) <= 0) {
self::error('api_uploadavatar_unusable_image');
}
if($image->Thumb($tmpavatar, $tmpavatarsmall, 48, 48, 2) <= 0) {
self::error('api_uploadavatar_unusable_image');
}
self::$tmpavatar = $tmpavatar;
self::$tmpavatarbig = $avatarpath.$tmpavatarbig;
self::$tmpavatarmiddle = $avatarpath.$tmpavatarmiddle;
self::$tmpavatarsmall = $avatarpath.$tmpavatarsmall;
}
public static function output() {
global $_G;
if(!empty($_G['uid'])) {
if (self::$tmpavatarbig && self::$tmpavatarmiddle && self::$tmpavatarsmall) {
$avatar1 = self::byte2hex(file_get_contents(self::$tmpavatarbig));
$avatar2 = self::byte2hex(file_get_contents(self::$tmpavatarmiddle));
$avatar3 = self::byte2hex(file_get_contents(self::$tmpavatarsmall));
$extra = '&avatar1='.$avatar1.'&avatar2='.$avatar2.'&avatar3='.$avatar3;
$result = self::uc_api_post_ex('user', 'rectavatar', array('uid' => $_G['uid']), $extra);
@unlink(self::$tmpavatar);
@unlink(self::$tmpavatarbig);
@unlink(self::$tmpavatarmiddle);
@unlink(self::$tmpavatarsmall);
if($result == '<?xml version="1.0" ?><root><face success="1"/></root>') {
$variable = array(
'uploadavatar' => 'api_uploadavatar_success',
);
C::t('common_member')->update($_G['uid'], array('avatarstatus'=>'1'));
mobile_core::result(mobile_core::variable($variable));
} else {
self::error('api_uploadavatar_uc_error');
}
}
} else {
self::error('api_uploadavatar_unavailable_user');
}
}
public static function byte2hex($string) {
$buffer = '';
$value = unpack('H*', $string);
$value = str_split($value[1], 2);
$b = '';
foreach($value as $k => $v) {
$b .= strtoupper($v);
}
return $b;
}
public static function uc_api_post_ex($module, $action, $arg = array(), $extra = '') {
$s = $sep = '';
foreach($arg as $k => $v) {
$k = urlencode($k);
if(is_array($v)) {
$s2 = $sep2 = '';
foreach($v as $k2 => $v2) {
$k2 = urlencode($k2);
$s2 .= "$sep2{$k}[$k2]=".urlencode($v2);
$sep2 = '&';
}
$s .= $sep.$s2;
} else {
$s .= "$sep$k=".urlencode($v);
}
$sep = '&';
}
$postdata = uc_api_requestdata($module, $action, $s, $extra);
return uc_fopen2(UC_API.'/index.php', 500000, $postdata, '', TRUE, UC_IP, 20);
}
public static function error($errstr) {
$variable = array(
'uploadavatar' => $errstr,
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,18 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: check.php 34236 2013-11-21 01:13:12Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include 'data/sysdata/cache_mobile.php';
echo $mobilecheck;
?>

View File

@@ -0,0 +1,65 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumdisplay.php 34236 2013-11-21 01:13:12Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
define('MOBILE_HIDE_STICKY', !isset($_GET['hidesticky']) ? 1 : $_GET['hidesticky']);
$_GET['mod'] = 'forumdisplay';
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
if(!empty($_GET['pw'])) {
$_GET['action'] = 'pwverify';
}
$_G['forum']['allowglobalstick'] = false;
}
public static function output() {
global $_G;
foreach($_G['forum_threadlist'] as $k => $thread) {
$_G['forum_threadlist'][$k]['tid'] = $thread['icontid'];
if($thread['displayorder'] > 0) {
unset($_G['forum_threadlist'][$k]);
continue;
}
$_G['forum_threadlist'][$k]['cover'] = array();
if($thread['cover']) {
$_img = @getimagesize($thread['coverpath']);
if($_img) {
$_G['forum_threadlist'][$k]['cover'] = array('w' => $_img[0], 'h' => $_img[1]);
}
}
}
$variable = array(
'forum' => mobile_core::getvalues($_G['forum'], array('fid', 'fup', 'name', 'threads', 'posts', 'rules', 'autoclose', 'password')),
'group' => mobile_core::getvalues($_G['group'], array('groupid', 'grouptitle')),
'forum_threadlist' => mobile_core::getvalues(array_values($_G['forum_threadlist']), array('/^\d+$/'), array('tid', 'author', 'authorid', 'subject', 'subject', 'dbdateline', 'dateline', 'dblastpost', 'lastpost', 'lastposter', 'attachment', 'replies', 'readperm', 'views', 'digest', 'cover')),
'sublist' => mobile_core::getvalues($GLOBALS['sublist'], array('/^\d+$/'), array('fid', 'name', 'threads', 'todayposts', 'posts')),
'tpp' => $_G['tpp'],
'page' => $GLOBALS['page'],
);
if(!empty($_G['forum']['threadtypes']) || !empty($_GET['debug'])) {
$variable['threadtypes'] = $_G['forum']['threadtypes'];
}
if(!empty($_G['forum']['threadsorts']) || !empty($_GET['debug'])) {
$variable['threadsorts'] = $_G['forum']['threadsorts'];
}
$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,85 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumnav.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
$forums = array();
$sql = !empty($_G['member']['accessmasks']) ?
"SELECT f.fid, f.type, f.name, f.fup, f.status, ff.password, ff.redirect, ff.viewperm, ff.postperm, ff.threadtypes, ff.threadsorts
FROM ".DB::table('forum_forum')." f
LEFT JOIN ".DB::table('forum_forumfield')." ff ON ff.fid=f.fid
LEFT JOIN ".DB::table('forum_access')." a ON a.uid='{$_G['uid']}' AND a.allowview>'0' AND a.fid=f.fid
WHERE f.status='1' ORDER BY f.type, f.displayorder"
: "SELECT f.fid, f.type, f.name, f.fup, f.status, ff.password, ff.redirect, ff.viewperm, ff.postperm, ff.threadtypes, ff.threadsorts
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']))) {
$forum['name'] = strip_tags($forum['name']);
if($forum['threadsorts']) {
$forum['threadsorts'] = dunserialize($forum['threadsorts']);
foreach($forum['threadsorts']['types'] as $k => $v) {
$forum['threadsorts']['types'][$k] = strip_tags($v);
}
$forum['threadsorts'] = mobile_core::getvalues($forum['threadsorts'], array('required', 'types'));
}
if($forum['threadtypes']) {
$forum['threadtypes'] = dunserialize($forum['threadtypes']);
$unsetthreadtype = false;
if($_G['adminid'] == 3 && strpos($forum['moderators'], $_G['username']) === false) {
$unsetthreadtype = true;
}
if(in_array($_G['adminid'], array(0, -1))) {
$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) {
$forum['threadtypes']['types'][$k] = strip_tags($v);
if($k == 0) {
$flag = 1;
}
}
if($flag == 1) {
krsort($forum['threadtypes']['types']);
}
$forum['threadtypes'] = mobile_core::getvalues($forum['threadtypes'], array('required', 'types'));
}
$forums[] = mobile_core::getvalues($forum, array('fid', 'type', 'name', 'fup', 'viewperm', 'postperm', 'status', 'threadsorts', 'threadtypes'));
}
}
$variable['forums'] = $forums;
mobile_core::result(mobile_core::variable($variable));
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,68 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumupload.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
define('APPTYPEID', 100);
define('CURSCRIPT', 'misc');
require './source/class/class_core.php';
$discuz = C::app();
$discuz->init_cron = false;
$discuz->init_session = false;
$discuz->init();
$_G['uid'] = intval($_POST['uid']);
if((empty($_G['uid']) && $_GET['operation'] != 'upload') || $_POST['hash'] != md5(substr(md5($_G['config']['security']['authkey']), 8).$_G['uid'])) {
exit();
} else {
if($_G['uid']) {
$_G['member'] = getuserbyuid($_G['uid']);
}
$_G['groupid'] = $_G['member']['groupid'];
loadcache('usergroup_'.$_G['member']['groupid']);
$_G['group'] = $_G['cache']['usergroup_'.$_G['member']['groupid']];
}
$_FILES['Filedata']['name'] = diconv(urldecode($_FILES['Filedata']['name']), 'UTF-8');
$_FILES['Filedata']['type'] = $_GET['filetype'];
$forumattachextensions = '';
$fid = intval($_GET['fid']);
if($fid) {
$forum = $fid != $_G['fid'] ? C::t('forum_forum')->fetch_info_by_fid($fid) : $_G['forum'];
if($forum['status'] == 3 && $forum['level']) {
$levelinfo = C::t('forum_grouplevel')->fetch($forum['level']);
if($postpolicy = $levelinfo['postpolicy']) {
$postpolicy = dunserialize($postpolicy);
$forumattachextensions = $postpolicy['attachextensions'];
}
} else {
$forumattachextensions = $forum['attachextensions'];
}
if($forumattachextensions) {
$_G['group']['attachextensions'] = $forumattachextensions;
}
}
class forum_upload_mobile extends forum_upload {
function uploadmsg($statusid) {
$variable = array('code' => $statusid, 'ret' => array('aId' => $this->aid, 'image' => $this->attach['isimage'] ? 1 : 2));
mobile_core::result(mobile_core::variable($variable));
}
}
$upload = new forum_upload_mobile();
?>

View File

View File

@@ -0,0 +1,35 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: login.php 34236 2013-11-21 01:13:12Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'logging';
$_GET['action'] = !empty($_GET['action']) ? $_GET['action'] : 'login';
include_once 'member.php';
class mobile_api {
public static function common() {
global $_G;
if($_G['setting']['seccodedata']['rule']['login']['allow'] == 2) {
$_G['setting']['seccodedata']['rule']['login']['allow'] = 1;
}
}
public static function output() {
global $_G;
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,49 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: myfavforum.php 34236 2013-11-21 01:13:12Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'favorite';
$_GET['type'] = 'forum';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$fids = array();
foreach($GLOBALS['list'] as $_k => $_v) {
$fids[$_v['id']] = $_k;
}
if($fids) {
$favforumlist = C::t('forum_forum')->fetch_all(array_keys($fids));
foreach($favforumlist as $_fid => $_v) {
$GLOBALS['list'][$fids[$_fid]]['threads'] = $_v['threads'];
$GLOBALS['list'][$fids[$_fid]]['posts'] = $_v['posts'];
$GLOBALS['list'][$fids[$_fid]]['todayposts'] = $_v['todayposts'];
$GLOBALS['list'][$fids[$_fid]]['yesterdayposts'] = $_v['yesterdayposts'];
}
}
$variable = array(
'list' => array_values($GLOBALS['list']),
'perpage' => $GLOBALS['perpage'],
'count' => $GLOBALS['count'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,54 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: mynotelist.php 34236 2013-11-21 01:13:12Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'notice';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G, $list;
$noticelang = lang('notification', 'reppost_noticeauthor');
$noticepreg = '/^'.str_replace(array('\{actor\}', '\{subject\}', '\{tid\}', '\{pid\}'), array('(.+?)', '(.+?)', '(\d+)', '(\d+)'), preg_quote($noticelang, '/')).'$/';
$actorlang = '<a href="home.php?mod=space&uid={actoruid}">{actorusername}</a>';
$actorpreg = '/^'.str_replace(array('\{actoruid\}', '\{actorusername\}'), array('(\d+)', '(.+?)'), preg_quote($actorlang, '/')).'$/';
foreach($list as $_k => $_v) {
if(preg_match($noticepreg, $_v['note'], $_r)) {
list(, $actor, $tid, $pid, $subject) = $_r;
if(preg_match($actorpreg, $actor, $_r)) {
list(, $actoruid, $actorusername) = $_r;
}
$list[$_k]['notevar'] = array(
'tid' => $tid,
'pid' => $pid,
'subject' => $subject,
'actoruid' => $actoruid,
'actorusername' => $actorusername,
);
}
}
$variable = array(
'list' => mobile_core::getvalues(array_values($list), array('/^\d+$/'), array('id', 'uid', 'type', 'new', 'authorid', 'author', 'note', 'dateline', 'from_id', 'from_idtype', 'from_num', 'style', 'rowid', 'notevar')),
'count' => $GLOBALS['count'],
'perpage' => $GLOBALS['perpage'],
'page' => intval($GLOBALS['page']),
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,39 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: profile.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'profile';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$data = $GLOBALS['space'];
if($_G['uid'] && $data['uid'] == $_G['uid']) {
$data['favthreads'] = C::t('home_favorite')->count_by_uid_idtype($_G['uid'], 'tid');
}
unset($data['password'], $data['email'], $data['regip'], $data['lastip'], $data['regip_loc'], $data['lastip_loc'], $data['qq'], $data['alipay'], $data['icq'], $data['yahoo'], $data['msn'], $data['taobao'], $data['mobile'], $data['telephone'], $data['idcard'], $data['idcardtype'], $data['address'], $data['realname'], $data['zipcode']);
$variable = array(
'space' => $data,
'extcredits' => $_G['setting']['extcredits'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: seccode.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['idhash'] = $_GET['sechash'];
$_GET['mod'] = 'seccode';
include_once 'misc.php';
class mobile_api {
public static function common() {
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: secure.php 34236 2013-11-21 01:13:12Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
if(!empty($_GET['force'])) {
$_G['setting']['seccodedata']['rule'][$_GET['type']]['allow'] = 1;
}
list($seccodecheck, $secqaacheck) = seccheck($_GET['type']);
$sechash = random(8);
if($seccodecheck || $secqaacheck) {
$variable = array('sechash' => $sechash);
if($seccodecheck) {
$variable['seccode'] = $_G['siteurl'].'api/mobile/index.php?module=seccode&sechash='.$sechash.'&version='.(empty($_GET['secversion']) ? '1' : $_GET['secversion']);
}
if($secqaacheck) {
$variable['secqaa'] = make_secqaa();
}
}
mobile_core::result(mobile_core::variable($variable));
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,93 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sendreply.php 34771 2014-07-30 09:29:44Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'post';
$_GET['action'] = 'reply';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function post_mobile_message($message, $url_forward, $values, $extraparam, $custom) {
if($values['tid'] && $values['pid']) {
global $_G;
$threadstatus = DB::result_first("SELECT status FROM ".DB::table('forum_thread')." WHERE tid='{$values['tid']}'");
$setstatusold = base_convert(getstatus($threadstatus, 13).getstatus($threadstatus, 12).getstatus($threadstatus, 11), 2, 10);
$updatestatus = false;
if(!empty($_POST['allowsound'])) {
$setstatus = array(1, 0, 0);
$updatestatus = $setstatusold < 4;
} elseif(!empty($_POST['allowphoto'])) {
$setstatus = array(0, 1, 1);
$updatestatus = $setstatusold < 3;
} elseif(!empty($_POST['allowlocal'])) {
$setstatus = array(0, 1, 0);
$updatestatus = $setstatusold < 2;
} else {
$setstatus = array(0, 0, 1);
}
if($updatestatus) {
foreach($setstatus as $i => $bit) {
$threadstatus = setstatus(13 - $i, $bit, $threadstatus);
}
C::t('forum_thread')->update($values['tid'], array('status' => $threadstatus));
}
$posttable = getposttablebytid($values['tid']);
$poststatus = DB::result_first("SELECT status FROM ".DB::table($posttable)." WHERE pid='{$values['pid']}'");
$poststatus = setstatus(4, 1, $poststatus);
if(!empty($_POST['allowlocal'])) {
$poststatus = setstatus(6, 1, $poststatus);
}
if(!empty($_POST['allowsound'])) {
$poststatus = setstatus(7, 1, $poststatus);
}
if(!empty($_POST['mobiletype']) && $_POST['mobiletype'] < 8) {
$mobiletype = base_convert($_POST['mobiletype'], 10, 2);
$mobiletype = sprintf('%03d', $mobiletype);
for($i = 0;$i < 3;$i++) {
$poststatus = setstatus(10 - $i, $mobiletype[$i], $poststatus);
}
}
C::t('forum_post')->update_post('tid:'.$values['tid'], $values['pid'], array('status' => $poststatus));
if($_POST['location']) {
list($mapx, $mapy, $location) = explode('|', dhtmlspecialchars($_POST['location']));
C::t('forum_post_location')->insert(array(
'pid' => $values['pid'],
'tid' => $values['tid'],
'uid' => $_G['uid'],
'mapx' => $mapx,
'mapy' => $mapy,
'location' => $location,
));
}
}
}
public static function output() {
global $_G;
$variable = array(
'tid' => $_G['tid'],
'pid' => $GLOBALS['pid'],
'noticetrimstr' => $GLOBALS['noticetrimstr'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,111 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sub_checkpost.php 34236 2013-11-21 01:13:12Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
class mobile_api_sub {
public static function getvariable() {
global $_G;
if(empty($_G['forum'])) {
$allowpost = 0;
} elseif(!$_G['uid'] && !((!$_G['forum']['postperm'] && $_G['group']['allowpost']) || ($_G['forum']['postperm'] && forumperm($_G['forum']['postperm'])))) {
$allowpost = 0;
} elseif(empty($_G['forum']['allowpost'])) {
if(!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
$allowpost = 0;
} elseif($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
$allowpost = 0;
} else {
$allowpost = 1;
}
} elseif($_G['forum']['allowpost'] == -1) {
$allowpost = 0;
} else {
$allowpost = 1;
}
if(empty($_G['forum'])) {
$allowreply = 0;
} elseif(!$_G['uid'] && !((!$_G['forum']['replyperm'] && $_G['group']['allowreply']) || ($_G['forum']['replyperm'] && forumperm($_G['forum']['replyperm'])))) {
$allowreply = 0;
} elseif(empty($_G['forum']['allowreply'])) {
if(!$_G['forum']['replyperm'] && !$_G['group']['allowreply']) {
$allowreply = 0;
} elseif($_G['forum']['replyperm'] && !forumperm($_G['forum']['replyperm'])) {
$allowreply = 0;
} else {
$allowreply = 1;
}
} elseif($_G['forum']['allowreply'] == -1) {
$allowreply = 0;
} else {
$allowreply = 1;
}
$mobile_attachextensions = array('jpg', 'jpeg', 'gif', 'png', 'mp3', 'txt', 'zip', 'rar', 'pdf');
$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$allowupload = $_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || (!$_G['forum']['postattachperm'] && $_G['group']['allowpostattach']) || ($_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])));
$allowupload = $allowupload && (!$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > getuserprofile('todayattachs'));
$attachremain = array();
if($allowupload) {
$attachextensions = !$_G['group']['attachextensions'] ? $mobile_attachextensions : array_map('trim', explode(',', $_G['group']['attachextensions']));
$allowupload = $forummaxattachsize = array();
loadcache('attachtype');
if(isset($_G['cache']['attachtype'][$_G['forum']['fid']])) {
$attachtype = $_G['cache']['attachtype'][$_G['forum']['fid']];
} elseif(isset($_G['cache']['attachtype'][0])) {
$attachtype = $_G['cache']['attachtype'][0];
} else {
$attachtype = array();
}
if($attachtype) {
foreach($attachtype as $extension => $maxsize) {
$forummaxattachsize[$extension] = $maxsize;
}
}
foreach($mobile_attachextensions as $ext) {
if(in_array($ext, $attachextensions)) {
if(isset($forummaxattachsize[$ext])) {
if($forummaxattachsize[$ext] > 0) {
$allowupload[$ext] = $forummaxattachsize[$ext] ? $forummaxattachsize[$ext] : $_G['group']['maxattachsize'];
} else {
$allowupload[$ext] = 0;
}
} else {
$allowupload[$ext] = -1;
}
} else {
$allowupload[$ext] = 0;
}
}
$attachremain = array(
'size' => $_G['group']['maxsizeperday'] ? $_G['group']['maxsizeperday'] - getuserprofile('todayattachsize') : -1,
'count' => $_G['group']['maxattachnum'] ? $_G['group']['maxattachnum'] - getuserprofile('todayattachs') : -1,
);
} else {
$allowupload = array();
}
$uploadhash = md5(substr(md5($_G['config']['security']['authkey']), 8).$_G['uid']);
$allowperm = array();
$allowperm['allowperm'] = array();
$allowkey = array('allowpost', 'allowreply', 'allowupload', 'attachremain', 'uploadhash');
foreach($allowkey as $key) {
if((!empty(${$key}) || ${$key} === 0) || !empty($_GET['debug'])) {
$allowperm['allowperm'][$key] = ${$key};
}
}
return $allowperm;
}
}
?>

View File

@@ -0,0 +1,86 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: viewthread.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
define('IS_WEBVIEW', true);
$_GET['mod'] = 'viewthread';
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
$_G['setting']['avatarmethod'] = 0;
}
public static function output() {
extract($GLOBALS);
$_G['forum_thread']['replies'] = $_G['forum_thread']['replies'] >= 0 ? $_G['forum_thread']['replies'] : 0;
if($_G['page'] > @ceil(($_G['forum_thread']['replies'] + 1) / $_G['ppp'])) {
$content = '';
} elseif($postlist) {
if(!function_exists('mobileoem_template')) {
include_once DISCUZ_ROOT.'./source/plugin/mobileoem/discuzcode.func.php';
}
$variable = array();
foreach($GLOBALS['aimgs'] as $pid => $aids) {
foreach($aids as $aid) {
$_url = parse_url($postlist[$pid]['attachments'][$aid]['url']);
$variable['imagelist'][$aid] = (!$postlist[$pid]['attachments'][$aid]['remote'] && !$_url['scheme'] ? $_G['siteurl'] : '').$postlist[$pid]['attachments'][$aid]['url'].$postlist[$pid]['attachments'][$aid]['attachment'];
if(strexists($postlist[$pid]['message'], '[attach]'.$aid.'[/attach]')) {
$postlist[$pid]['message'] = str_replace('[attach]'.$aid.'[/attach]', mobileoem_parseimg($postlist[$pid]['attachments'][$aid]['width'], 0, $variable['imagelist'][$aid]), $postlist[$pid]['message']);
} else {
$postlist[$pid]['message'] .= '<br /><br />'.mobileoem_parseimg($postlist[$pid]['attachments'][$aid]['width'], 0, $variable['imagelist'][$aid]);
}
}
}
foreach($postlist as $pid => $post) {
if($post['attachlist']) {
foreach($post['attachlist'] as $aid) {
$aidencode = packaids($postlist[$pid]['attachments'][$aid]);
$_code = parseurl('/forum.php?mod=attachment&aid='.$aidencode, $postlist[$pid]['attachments'][$aid]['filename'], 0);
if(strexists($postlist[$pid]['message'], '[attach]'.$aid.'[/attach]')) {
$postlist[$pid]['message'] = str_replace('[attach]'.$aid.'[/attach]', $_code, $postlist[$pid]['message']);
} else {
$postlist[$pid]['message'] .= '<br /><br />'.$_code;
}
}
}
$postlist[$pid]['message'] = preg_replace("/\[attach\]\d+\[\/attach\]/i", '', $postlist[$pid]['message']);
}
$get = $_GET;
unset($get['page'], $get['debug']);
$nexturl = http_build_query($get);
include mobileoem_template('forum/viewthread');
if(!empty($_GET['debug'])) {
exit;
}
$content = ob_get_contents();
ob_end_clean();
}
$variable['forumname'] = $forum['name'];
$variable['datatype'] = $_G['page'] == 1 ? 0 : 1;
$variable['webview_page'] = $content;
$variable['ppp'] = $_G['ppp'];
$variable['posts'] = count($postlist);
$variable['page'] = $_G['page'];
if($_G['forum_discuzcode']['passwordauthor']) {
$variable['passwordpid'] = array_keys($_G['forum_discuzcode']['passwordauthor']);
}
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,30 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id$
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
$_GET['action'] = 'bestanswer';
$_GET['bestanswersubmit'] = 'yes';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,63 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: check.php 36332 2016-12-30 01:44:19Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
require './source/class/class_core.php';
$discuz = C::app();
$discuz->init();
if(!defined('DISCUZ_VERSION')) {
require './source/discuz_version.php';
}
if(in_array('mobile', $_G['setting']['plugins']['available'])) {
loadcache('wsq_checkinfo');
if (!$_G['cache']['wsq_checkinfo'] || TIMESTAMP - $_G['cache']['wsq_checkinfo']['expiration'] > 600) {
$_G['wechat']['setting'] = dunserialize($_G['setting']['mobilewechat']);
$forums = C::t('forum_forum')->fetch_all_by_status(1);
foreach ($forums as $forum) {
$posts += $forum['posts'];
}
loadcache('userstats');
$array = array(
'discuzversion' => 'X3.2',
'truediscuzversion' => DISCUZ_VERSION,
'charset' => CHARSET,
'version' => MOBILE_PLUGIN_VERSION,
'pluginversion' => $_G['setting']['plugins']['version']['mobile'],
'regname' => $_G['setting']['regname'],
'qqconnect' => in_array('qqconnect', $_G['setting']['plugins']['available']) ? '1' : '0',
'wsqqqconnect' => in_array('qqconnect', $_G['setting']['plugins']['available']) ? '1' : '0',
'wsqhideregister' => $_G['wechat']['setting']['wechat_allowregister'] && $_G['wechat']['setting']['wechat_allowfastregister'] ? '1' : '0',
'sitename' => $_G['setting']['bbname'],
'mysiteid' => $_G['setting']['my_siteid'],
'ucenterurl' => $_G['setting']['ucenterurl'],
'defaultfid' => $_G['wechat']['setting']['wsq_fid'],
'totalposts' => $posts,
'totalmembers' => $_G['cache']['userstats']['totalmembers'],
);
savecache('wsq_checkinfo', array('variable' => $array, 'expiration' => TIMESTAMP));
} else {
$array = $_G['cache']['wsq_checkinfo']['variable'];
}
} else {
$array = array();
}
$array['testcookie'] = $_G['cookie']['testcookie'];
$data = mobile_core::json($array);
mobile_core::make_cors($_SERVER['REQUEST_METHOD'], REQUEST_METHOD_DOMAIN);
echo $data;
?>

View File

@@ -0,0 +1,20 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: checkcookie.php 35028 2014-10-21 09:55:55Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
require './source/class/class_core.php';
$discuz = C::app();
$discuz->init();
dsetcookie('testcookie', $_GET['siteid'], 600);
mobile_core::result(array());

View File

@@ -0,0 +1,37 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: checkinfo.php 34424 2014-04-24 05:17:08Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
require './source/class/class_core.php';
$discuz = C::app();
$cachelist = array();
$discuz->cachelist = $cachelist;
$discuz->init();
$_G['wechat']['setting'] = dunserialize($_G['setting']['mobilewechat']);
require_once DISCUZ_ROOT.'./source/plugin/wechat/wsq.class.php';
$result = wsq::check($_GET);
if($result) {
$setting = C::t('common_setting')->fetch_all_setting(array('mobilewechat'));
$setting = dunserialize($setting['mobilewechat']);
$setting['wsq_status'] = 1;
$settings = array('mobilewechat' => serialize($setting));
C::t('common_setting')->update_batch($settings);
}
echo $result;
exit;

View File

@@ -0,0 +1,28 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: checknewpm.php 35183 2017-11-03 16:46:53Z leiyu $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'spacecp';
$_GET['ac'] = 'pm';
$_GET['op'] = 'checknewpm';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
}
}
?>

View File

@@ -0,0 +1,47 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: credit.php 34983 2014-09-22 06:16:09Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
if (!$_G['uid'] || !in_array('wechat', $_G['setting']['plugins']['available'])) {
mobile_core::result(mobile_core::variable(array()));
}
$_G['wechat']['setting'] = dunserialize($_G['setting']['mobilewechat']);
if (!$_G['wechat']['setting']['wsq_apicredit']) {
mobile_core::result(mobile_core::variable(array()));
}
$extcredit = 'extcredits'.$_G['wechat']['setting']['wsq_apicredit'];
$ac = $_GET['ac'];
$return = array();
if(submitcheck('creditsubmit') && ($ac == 'inc' || $ac == 'dec') && $_GET['value'] > 0) {
$v = $ac == 'inc' ? $_GET['value'] : -$_GET['value'];
$log = lang('plugin/wechat', 'wsq_apicredit_log_'.$ac);
updatemembercount(array($_G['uid']), array($extcredit => $v), true, '', 0, '', $log);
$data = C::t('common_member_count')->fetch($_G['uid']);
$return['extcredit'] = $data[$extcredit];
} elseif($ac == 'get') {
$return['extcredit'] = getuserprofile($extcredit);
}
mobile_core::result(mobile_core::variable($return));
}
public static function output() {
}
}
?>

View File

@@ -0,0 +1,38 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumdisplay.php 35213 2015-02-26 06:15:12Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'forumdisplay';
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
if (!empty($_GET['pw'])) {
$_GET['action'] = 'pwverify';
}
$_G['forum']['allowglobalstick'] = true;
if($_G['forum']['redirect']) {
mobile_core::result(mobile_core::variable(array('forum' => array('fid' => $_G['fid'], 'redirect' => $_G['forum']['redirect']))));
}
}
public static function output() {
global $_G;
include_once 'source/plugin/mobile/api/4/sub_threadlist.php';
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,55 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumindex.php 34398 2014-04-14 07:11:22Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'index';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$forums = $GLOBALS['forums'] ? $GLOBALS['forums'] : C::t('forum_forum')->fetch_all_by_status(1);
foreach ($forums as $forum) {
if ($forum['fup'] && $GLOBALS['forumlist'][$forum['fup']]) {
$GLOBALS['forumlist'][$forum['fup']]['sublist'][] = mobile_core::getvalues($forum, array('fid', 'name', 'threads', 'posts', 'redirect', 'todayposts', 'description'));
}
if ($GLOBALS['forumlist'][$forum['fid']]['icon']) {
$icon = preg_match('/src="(.+?)"/', $GLOBALS['forumlist'][$forum['fid']]['icon'], $r) ? $r[1] : '';
if (!preg_match('/^https?:\//', $icon)) {
$icon = $_G['siteurl'] . $icon;
}
$GLOBALS['forumlist'][$forum['fid']]['icon'] = $icon;
}
}
if ($_GET['checknotice']) {
$variable = array();
} else {
$variable = array(
'member_email' => $_G['member']['email'],
'member_credits' => $_G['member']['credits'],
'setting_bbclosed' => $_G['setting']['bbclosed'],
'group' => mobile_core::getvalues($_G['group'], array('groupid', 'grouptitle', '/^allow.+?$/')),
'catlist' => array_values(mobile_core::getvalues($GLOBALS['catlist'], array('/^\d+$/'), array('fid', 'name', 'forums'))),
'forumlist' => array_values(mobile_core::getvalues($GLOBALS['forumlist'], array('/^\d+$/'), array('fid', 'name', 'threads', 'posts', 'redirect', 'todayposts', 'description', 'sublist', 'icon'))),
);
}
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,34 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forummisc.php 35102 2014-11-18 10:09:27Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
include_once 'forum.php';
class mobile_api {
public static function common() {
if($_GET['t'] == 'common') {
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
public static function output() {
if($_GET['t'] == 'output') {
$variable = array();
mobile_core::result(mobile_core::variable($variable));
}
}
}
?>

View File

@@ -0,0 +1,32 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forumupload.php 35181 2015-01-08 01:51:31Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
error_reporting(0);
mobile_core::make_cors($_SERVER['REQUEST_METHOD'], REQUEST_METHOD_DOMAIN);
$_GET['mod'] = 'swfupload';
$_GET['action'] = 'swfupload';
$_GET['operation'] = 'upload';
include_once 'misc.php';
class mobile_api {
public static function common() {
}
public static function output() {
}
}
?>

View File

View File

@@ -0,0 +1,52 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: login.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'logging';
$_GET['action'] = !empty($_GET['action']) ? $_GET['action'] : 'login';
include_once 'member.php';
class mobile_api {
public static function common() {
if(!empty($_GET['mlogout'])) {
if($_GET['hash'] == formhash()) {
clearcookies();
}
mobile_core::result(array());
}
}
public static function output() {
global $_G;
parse_str($_G['messageparam'][1], $p);
$variable = array('auth' => $p['auth']);
if($_G['uid']) {
require_once DISCUZ_ROOT.'./source/plugin/wechat/wsq.class.php';
if(method_exists('wsq', 'userloginUrl')) {
$_source = isset($_GET['_source']) ? $_GET['_source'] : '';
if(!$_source && !empty($_GET['openid']) && !empty($_GET['openidsign'])) {
$variable['loginUrl'] = wsq::userloginUrl($_G['uid'], $_GET['openid'], $_GET['openidsign']);
if(!C::t('#wechat#common_member_wechatmp')->fetch($_G['uid'])) {
C::t('#wechat#common_member_wechatmp')->insert(array('uid' => $_G['uid'], 'openid' => $_GET['openid'], 'status' => 1), false, true);
}
} else {
$variable['loginUrl'] = wsq::userloginUrl2($_G['uid']);
}
}
}
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,36 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id$
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
if(submitcheck('hash', true) && $_G['uid']){
$r = updatecreditbyaction('mobilesign', $_G['uid']);
if($r['updatecredit']) {
$_G['messageparam'][0] = 'mobilesign_success';
} else {
$_G['messageparam'][0] = 'mobilesign_failed';
}
} else {
$_G['messageparam'][0] = 'mobilesign_formhash_failed';
}
mobile_core::result(mobile_core::variable(array()));
}
public static function output() {
}
}
?>

View File

@@ -0,0 +1,46 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: mypm.php 35183 2015-01-14 07:46:53Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'pm';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
foreach($GLOBALS['list'] as $_k => $_v) {
if($_v['lastdateline']) {
$GLOBALS['list'][$_k]['vdateline'] = dgmdate($_v['lastdateline'], 'u');
} elseif($_v['dateline']) {
$GLOBALS['list'][$_k]['vdateline'] = dgmdate($_v['dateline'], 'u');
}
}
$variable = array(
'list' => mobile_core::getvalues($GLOBALS['list'], array('/^\d+$/'), array('plid', 'isnew', 'vdateline', 'subject', 'pmid', 'msgfromid', 'msgfrom', 'message', 'touid', 'tousername')),
'count' => $GLOBALS['count'],
'perpage' => $GLOBALS['perpage'],
'page' => intval($GLOBALS['page']),
);
if($_GET['subop']) {
$variable = array_merge($variable, array('pmid' => $GLOBALS['pmid']));
}
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,87 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: newthread.php 35251 2015-04-09 06:05:51Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'post';
$_GET['action'] = 'newthread';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function post_mobile_message($message, $url_forward, $values, $extraparam, $custom) {
if($values['tid'] && $values['pid']) {
global $_G;
$threadstatus = DB::result_first("SELECT status FROM ".DB::table('forum_thread')." WHERE tid='{$values['tid']}'");
if(!empty($_POST['allowsound'])) {
$setstatus = array(1, 0, 0);
} elseif(!empty($_POST['allowphoto'])) {
$setstatus = array(0, 1, 1);
} elseif(!empty($_POST['allowlocal'])) {
$setstatus = array(0, 1, 0);
} else {
$setstatus = array(0, 0, 1);
}
foreach($setstatus as $i => $bit) {
$threadstatus = setstatus(13 - $i, $bit, $threadstatus);
}
C::t('forum_thread')->update($values['tid'], array('status' => $threadstatus));
$poststatus = DB::result_first("SELECT status FROM ".DB::table('forum_post')." WHERE pid='{$values['pid']}'");
$poststatus = setstatus(4, 1, $poststatus);
if(!empty($_POST['allowlocal'])) {
$poststatus = setstatus(6, 1, $poststatus);
}
if(!empty($_POST['allowsound'])) {
$poststatus = setstatus(7, 1, $poststatus);
}
if(!empty($_POST['mobiletype'])) {
$mobiletype = base_convert($_POST['mobiletype'], 10, 2);
$mobiletype = sprintf('%03d', $mobiletype);
for($i = 0;$i < 3;$i++) {
$poststatus = setstatus(10 - $i, $mobiletype[$i], $poststatus);
}
}
C::t('forum_post')->update_post(0, $values['pid'], array('status' => $poststatus));
if($_POST['location']) {
list($mapx, $mapy, $location) = explode('|', dhtmlspecialchars($_POST['location']));
C::t('forum_post_location')->insert(array(
'pid' => $values['pid'],
'tid' => $values['tid'],
'uid' => $_G['uid'],
'mapx' => $mapx,
'mapy' => $mapy,
'location' => $location,
));
}
}
}
public static function output() {
global $_G;
$variable = array(
'tid' => $GLOBALS['tid'],
'pid' => $GLOBALS['pid'],
);
if(!empty($_G['forum']['threadtypes'])) {
$variable['threadtypes'] = $_G['forum']['threadtypes'];
}
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,31 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: profile.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'plugin.php';
class mobile_api {
public static function common() {
}
public static function output() {
json_output();
}
}
function json_output() {
mobile_core::result(mobile_core::variable(array('html' => $GLOBALS['variable'])));
}
?>

View File

@@ -0,0 +1,43 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: profile.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'space';
$_GET['do'] = 'profile';
include_once 'home.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
$data = $GLOBALS['space'];
$data['groupiconid'] = mobile_core::usergroupIconId($data['groupid']);
if($data['group']['type'] == 'member' && $data['group']['groupcreditslower'] != 999999999) {
$data['upgradecredit'] = $data['group']['creditslower'] - $data['credits'];
$data['upgradeprogress'] = 100 - ceil($data['upgradecredit'] / ($data['group']['creditslower'] - $data['group']['creditshigher']) * 100);
$data['upgradeprogress'] = max($data['upgradeprogress'], 2);
}
unset($data['password'], $data['email'], $data['regip'], $data['lastip'], $data['regip_loc'], $data['lastip_loc'], $data['qq'], $data['alipay'], $data['icq'], $data['yahoo'], $data['msn'], $data['taobao'], $data['mobile'], $data['telephone'], $data['idcard'], $data['idcardtype'], $data['address'], $data['realname'], $data['zipcode']);
$variable = array(
'space' => $data,
'extcredits' => $_G['setting']['extcredits'],
'wsq' => array('wsq_apicredit' => getuserprofile('extcredits'.$_G['wechat']['setting']['wsq_apicredit'])),
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,37 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: profiles.php 34989 2014-09-24 07:22:03Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
$uids = explode(',', $_GET['uids']);
if(!$uids) {
mobile_core::result(mobile_core::variable(array()));
}
$profiles = C::t('common_member')->fetch_all_username_by_uid($uids);
$return = array();
foreach($uids as $uid) {
$return[] = array('uid' => $uid, 'username' => $profiles[$uid]);
}
mobile_core::result(mobile_core::variable(array('profiles' => $return)));
}
public static function output() {
}
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: recommend.php 34398 2014-04-14 07:11:22Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
$_GET['action'] = 'recommend';
$_GET['do'] = 'add';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
mobile_core::result(mobile_core::variable(array()));
}
public static function misc_mobile_message($message) {
global $_G, $thread;
if (!in_array($message, array('recommend_succed', 'recommend_daycount_succed'))) {
return;
}
$thaquote = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
$quote = $thaquote['message'];
$quote = threadmessagecutstr($thread, $quote, 100);
$quote = implode("\n", array_slice(explode("\n", $quote), 0, 3));
}
}
?>

View File

@@ -0,0 +1,28 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: seccodehtml.php 34428 2014-04-25 09:09:34Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
echo '<img src="'.$_G['siteurl'].'api/mobile/index.php?module=seccode&sechash='.urlencode($_GET['sechash']).'&version='.(empty($_GET['secversion']) ? '4' : $_GET['secversion']).'" />';
exit;
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: secure.php 34428 2014-04-25 09:09:34Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
if(!empty($_GET['force'])) {
$_G['setting']['seccodedata']['rule'][$_GET['type']]['allow'] = 1;
}
list($seccodecheck, $secqaacheck) = seccheck($_GET['type']);
$sechash = random(8);
if($seccodecheck || $secqaacheck) {
$variable = array('sechash' => $sechash);
if($seccodecheck) {
$variable['seccode'] = $_G['siteurl'].'api/mobile/index.php?module=seccodehtml&sechash='.$sechash.'&version=4';
}
if($secqaacheck) {
$variable['secqaa'] = make_secqaa();
}
}
mobile_core::result(mobile_core::variable($variable));
}
public static function output() {}
}
?>

View File

@@ -0,0 +1,35 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sendpm.php 35183 2015-01-14 07:46:53Z nemohou $
*/
if(!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'spacecp';
$_GET['ac'] = 'pm';
$_GET['op'] = 'send';
include_once 'home.php';
class mobile_api {
public static function common() {
$_POST = $_GET;
}
public static function output() {
global $_G;
$variable = array(
'pmid' => $GLOBALS['return']
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,95 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sendreply.php 34771 2014-07-30 09:29:44Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'post';
$_GET['action'] = 'reply';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function post_mobile_message($message, $url_forward, $values, $extraparam, $custom) {
if($message == 'comment_add_succeed') {
showmessage($message);
}
if ($values['tid'] && $values['pid']) {
global $_G;
$threadstatus = DB::result_first("SELECT status FROM " . DB::table('forum_thread') . " WHERE tid='{$values['tid']}'");
$setstatusold = base_convert(getstatus($threadstatus, 13) . getstatus($threadstatus, 12) . getstatus($threadstatus, 11), 2, 10);
$updatestatus = false;
if (!empty($_POST['allowsound'])) {
$setstatus = array(1, 0, 0);
$updatestatus = $setstatusold < 4;
} elseif (!empty($_POST['allowphoto'])) {
$setstatus = array(0, 1, 1);
$updatestatus = $setstatusold < 3;
} elseif (!empty($_POST['allowlocal'])) {
$setstatus = array(0, 1, 0);
$updatestatus = $setstatusold < 2;
} else {
$setstatus = array(0, 0, 1);
}
if ($updatestatus) {
foreach ($setstatus as $i => $bit) {
$threadstatus = setstatus(13 - $i, $bit, $threadstatus);
}
C::t('forum_thread')->update($values['tid'], array('status' => $threadstatus));
}
$posttable = getposttablebytid($values['tid']);
$poststatus = DB::result_first("SELECT status FROM " . DB::table($posttable) . " WHERE pid='{$values['pid']}'");
$poststatus = setstatus(4, 1, $poststatus);
if (!empty($_POST['allowlocal'])) {
$poststatus = setstatus(6, 1, $poststatus);
}
if (!empty($_POST['allowsound'])) {
$poststatus = setstatus(7, 1, $poststatus);
}
if (!empty($_POST['mobiletype']) && $_POST['mobiletype'] < 8) {
$mobiletype = base_convert($_POST['mobiletype'], 10, 2);
$mobiletype = sprintf('%03d', $mobiletype);
for ($i = 0; $i < 3; $i++) {
$poststatus = setstatus(10 - $i, $mobiletype[$i], $poststatus);
}
}
C::t('forum_post')->update_post('tid:' . $values['tid'], $values['pid'], array('status' => $poststatus));
if($_POST['location']) {
list($mapx, $mapy, $location) = explode('|', dhtmlspecialchars($_POST['location']));
C::t('forum_post_location')->insert(array(
'pid' => $values['pid'],
'tid' => $values['tid'],
'uid' => $_G['uid'],
'mapx' => $mapx,
'mapy' => $mapy,
'location' => $location,
));
}
}
}
public static function output() {
global $_G;
$variable = array(
'tid' => $_G['tid'],
'pid' => $GLOBALS['pid'],
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,80 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: showactivity.php 35113 2014-11-26 03:31:52Z anezhou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
$_GET['action'] = 'commentmore';
$_GET['inajax'] = 1;
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
if($_GET['do'] == 'recommend') {
if(!$_GET['hash'] || FORMHASH != $_GET['hash'] || !$_GET['pid'] || !$_GET['tid'] || !$_G['uid']) {
mobile_core::result(mobile_core::variable(array('result' => -1)));
}
$_G['wechat']['setting'] = dunserialize($_G['setting']['mobilewechat']);
if(!$_G['wechat']['setting']['wsq_allow'] || !in_array($_GET['tid'], (array)$_G['wechat']['setting']['showactivity']['tids'])) {
mobile_core::result(mobile_core::variable(array('result' => -2)));
}
$postinfo = C::t('forum_post')->fetch_post('tid:'.$_GET['tid'], $_GET['pid']);
if(!$postinfo) {
mobile_core::result(mobile_core::variable(array('result' => -3)));
}
$activity = C::t('forum_activity')->fetch($_G['tid']);
if($activity['starttimeto'] && $activity['starttimeto'] < TIMESTAMP) {
mobile_core::result(mobile_core::variable(array('result' => -4)));
}
$post = C::t('forum_debatepost')->fetch($_GET['pid']);
if(!$post) {
C::t('forum_debatepost')->insert(array(
'pid' => $_GET['pid'],
'tid' => $_GET['tid'],
'dateline' => TIMESTAMP,
'stand' => 0,
'voters' => 1,
'voterids' => "{$_G['uid']}\t",
));
mobile_core::result(mobile_core::variable(array('result' => 1)));
} elseif(strpos("\t".$post['voterids'], "\t{$_G['uid']}\t") === FALSE) {
C::t('forum_debatepost')->update_voters($_GET['pid'], $_G['uid']);
mobile_core::result(mobile_core::variable(array('result' => 1)));
} else {
mobile_core::result(mobile_core::variable(array('result' => 0)));
}
}
}
public static function output() {
$comments = array();
foreach($GLOBALS['comments'] as $comment) {
$comments[] = array(
'author' => $comment['author'],
'authorid' => $comment['authorid'],
'avatar' => avatar($comment['authorid'], 'small', 1),
'message' => $comment['comment'],
'dateline' => strip_tags($comment['dateline']),
);
}
$variable = array(
'tid' => $_GET['tid'],
'pid' => $_GET['pid'],
'postlist' => $comments,
);
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,38 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: smiley.php 34398 2014-04-14 07:11:22Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
loadcache(array('smilies', 'smileytypes'));
$variable = array();
foreach ($_G['cache']['smilies']['replacearray'] as $id => $img) {
$variable['smilies'][$_G['cache']['smilies']['typearray'][$id]][] = array(
'code' => $_G['cache']['smilies']['searcharray'][$id],
'image' => $_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$id]]['directory'] . '/' . $img
);
}
$variable['smilies'] = array_values($variable['smilies']);
mobile_core::result(mobile_core::variable($variable));
}
public static function output() {
}
}
?>

View File

@@ -0,0 +1,73 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sub_sendreply.php 35073 2014-11-04 09:14:30Z anezhou $
*/
if (!defined('IN_DISCUZ')) {
exit('Access Denied');
}
global $pid, $thread, $_G;
$newmessage = preg_replace('/<\/*.*?>|&nbsp;|\r\n|\[attachimg\].*?\[\/attachimg\]|\[quote\].*?\[\/quote\]|\[\/*.*?\]/ms', '', $GLOBALS['message']);
$newmessage = messagecutstr($newmessage, 100);
$key = C::t('#mobile#mobile_wsq_threadlist')->fetch($_G['tid']);
$posts = is_array($key) ? dunserialize($key['svalue']) : array();
$posts = is_array($posts) ? $posts : array();
if (trim($newmessage) != '' && !getstatus($thread['status'], 2)) {
if (!$posts) {
$posts = array();
}
if (count($posts) > 2) {
array_shift($posts);
}
$post = array(
'pid' => $pid,
'author' => empty($_GET['isanonymous']) ? $_G['username'] : $_G['setting']['anonymoustext'],
'authorid' => empty($_GET['isanonymous']) ? $_G['uid'] : 0,
'message' => $newmessage,
);
array_push($posts, $post);
}
if (count($posts) < 3 && ($thread['replies'] >= count($posts)) && !getstatus($thread['status'], 2)) {
$posts = array();
foreach (C::t('forum_post')->fetch_all_by_tid($thread['posttableid'], $thread['tid'], true, 'DESC', 0, 10, 0, 0) as $p) {
$p['message'] = preg_replace('/<\/*.*?>|&nbsp;|\r\n|\[attachimg\].*?\[\/attachimg\]|\[quote\].*?\[\/quote\]|\[\/*.*?\]/ms', '', $p['message']);
$p['message'] = trim(messagecutstr($p['message'], 100));
if($p['anonymous']) {
$p['author'] = $_G['setting']['anonymoustext'];
$p['authorid'] = 0;
}
$post = array(
'pid' => $p['pid'],
'author' => $p['author'],
'authorid' => $p['authorid'],
'message' => $p['message'],
'avatar' => avatar($p['authorid'], 'small', true),
);
if ($post['message'] != '') {
array_push($posts, $post);
}
if (count($posts) > 2) {
break;
}
}
$posts = array_reverse($posts);
}
$data = array(
'skey' => $_G['tid'],
'svalue' => serialize($posts)
);
if($message != 'post_reply_mod_succeed') {
C::t('#mobile#mobile_wsq_threadlist')->insert_thread($_G['tid'], $data, false, true);
}
?>

View File

@@ -0,0 +1,127 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sub_threadlist.php 35068 2014-11-04 02:37:45Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_G['wechat']['setting'] = dunserialize($_G['setting']['mobilewechat']);
require_once libfile('function/post');
$tids = array();
foreach ($_G['forum_threadlist'] as $k => $thread) {
$tids[] = $_G['forum_threadlist'][$k]['tid'] = $thread['icontid'];
$_G['forum_threadlist'][$k]['cover'] = array();
if ($thread['cover']) {
$_G['forum_threadlist'][$k]['cover'] = array('w' => 200, 'h' => 200);
}
$_G['forum_threadlist'][$k]['reply'] = array();
if(!isset($_G['wechat']['setting']['wechat_forumdisplay_reply']) || $_G['wechat']['setting']['wechat_forumdisplay_reply']) {
$key = C::t('#mobile#mobile_wsq_threadlist')->fetch($thread['tid']);
if ($key['svalue']) {
$_G['forum_threadlist'][$k]['reply'] = dunserialize($key['svalue']);
}
}
$_G['forum_threadlist'][$k]['dateline'] = strip_tags($thread['dateline']);
$_G['forum_threadlist'][$k]['lastpost'] = strip_tags($thread['lastpost']);
if(!$thread['authorid'] || !$thread['author']) {
$_G['forum_threadlist'][$k]['author'] = $_G['setting']['anonymoustext'];
$_G['forum_threadlist'][$k]['authorid'] = 0;
}
$userids[] = $thread['authorid'];
$firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
if($thread['readperm'] < $_G['group']['readaccess'] && $firstpost['invisible'] == 0){
$firstPostMessage = $firstpost['message'];
preg_match_all('/\[attach\](\d+)\[\/attach\]/i', $firstPostMessage, $matches, PREG_SET_ORDER);
$_G['forum_threadlist'][$k]['attachmentImageNumber'] = count($matches);
$cnt = 0;
$aidList = array();
foreach ($matches as $i => $match){
if($cnt > 3){
break;
}
$cnt += 1;
$aidList[] = $match[1];
}
$attachmentImageList = array();
$attachments = C::t('forum_attachment')->fetch_all($aidList);
foreach($attachments as $aid => $attach) {
$attachment = C::t('forum_attachment_n')->fetch_attachment($attach["tableid"], $attach["aid"], true);
$attachmentImageList[] = $attachment;
}
$_G['forum_threadlist'][$k]['attachmentImagePreviewList'] = $attachmentImageList;
$attach_img_text = lang('forum/misc', 'attach_img');
$attach_words = '['.$attach_img_text.']';
$firstPostMessage = preg_replace('/\[attach\](\d+)\[\/attach\]/i', $attach_words, $firstPostMessage);
$firstPostMessage = preg_replace('/<\/*.*?>|&nbsp;|\r\n|\[attachimg\].*?\[\/attachimg\]|\[quote\].*?\[\/quote\]|\[(?!'.$attach_words.')\/*.*?\]/ms', '', $firstPostMessage);
$firstPostMessage = trim(threadmessagecutstr($thread, $firstPostMessage, 500));
$_G['forum_threadlist'][$k]['message'] = $firstPostMessage;
}
}
foreach(C::t('common_member')->fetch_all($userids) as $user) {
$groupiconIds[$user['uid']] = mobile_core::usergroupIconId($user['groupid']);
}
if($_G['uid']) {
$memberrecommends = array();
$query = DB::query('SELECT * FROM %t WHERE recommenduid=%d AND tid IN (%n)', array('forum_memberrecommend', $_G['uid'], $tids));
while ($memberrecommend = DB::fetch($query)) {
$memberrecommends[$memberrecommend['tid']] = 1;
}
foreach ($_G['forum_threadlist'] as $k => $thread) {
$_G['forum_threadlist'][$k]['recommend'] = isset($memberrecommends[$thread['icontid']]) ? 1 : 0;
}
}
foreach ($GLOBALS['sublist'] as $k => $sublist) {
if ($sublist['icon']) {
$icon = preg_match('/src="(.+?)"/', $sublist['icon'], $r) ? $r[1] : '';
if (!preg_match('/^https?:\//', $icon)) {
$icon = $_G['siteurl'] . $icon;
}
$GLOBALS['sublist'][$k]['icon'] = $icon;
}
}
if($_G['forum']['icon']) {
require_once libfile('function/forumlist');
if(!preg_match('/^https?:\/\//i', $_G['forum']['icon'])) {
$_G['forum']['icon'] = get_forumimg($_G['forum']['icon']);
if(!preg_match('/^https?:\/\//i', $_G['forum']['icon'])) {
$_G['forum']['icon'] = $_G['siteurl'] . $_G['forum']['icon'];
}
}
}
$_G['forum']['threadcount'] = $_G['forum_threadcount'];
$variable = array(
'forum' => mobile_core::getvalues($_G['forum'], array('fid', 'fup', 'name', 'threads', 'posts', 'rules', 'autoclose', 'password', 'icon', 'threadcount', 'picstyle', 'description')),
'group' => mobile_core::getvalues($_G['group'], array('groupid', 'grouptitle')),
'forum_threadlist' => mobile_core::getvalues(array_values(is_array($_G['forum_threadlist']) ? $_G['forum_threadlist'] : array()), array('/^\d+$/'), array('tid', 'author', 'special', 'authorid', 'subject', 'subject', 'dbdateline', 'dateline', 'dblastpost', 'lastpost', 'lastposter', 'attachment', 'replies', 'readperm', 'views', 'digest', 'cover', 'recommend', 'recommend_add', 'reply', 'avatar', 'displayorder', 'coverpath', 'typeid', 'rushreply', 'replycredit', 'price', 'message', 'attachmentImageNumber', 'attachmentImagePreviewList')),
'groupiconid' => $groupiconIds,
'sublist' => mobile_core::getvalues($GLOBALS['sublist'], array('/^\d+$/'), array('fid', 'name', 'threads', 'todayposts', 'posts', 'icon')),
'tpp' => $_G['tpp'],
'page' => $GLOBALS['page'],
'reward_unit' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['unit'].$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['title'],
);
if (!empty($_G['forum']['threadtypes']) || !empty($_GET['debug'])) {
$variable['threadtypes'] = $_G['forum']['threadtypes'];
}
if (!empty($_G['forum']['threadsorts']) || !empty($_GET['debug'])) {
$variable['threadsorts'] = $_G['forum']['threadsorts'];
}
$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
?>

View File

@@ -0,0 +1,45 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sublist.php 34398 2014-04-14 07:11:22Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'forumdisplay';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G;
foreach ($GLOBALS['sublist'] as $k => $sublist) {
if ($sublist['icon']) {
$icon = preg_match('/src="(.+?)"/', $sublist['icon'], $r) ? $r[1] : '';
if (!preg_match('/^https?:\//', $icon)) {
$icon = $_G['siteurl'] . $icon;
}
$GLOBALS['sublist'][$k]['icon'] = $icon;
}
}
$variable = array(
'sublist' => mobile_core::getvalues($GLOBALS['sublist'], array('/^\d+$/'), array('fid', 'name', 'threads', 'todayposts', 'posts', 'icon')),
);
$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,42 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: recommend.php 34398 2014-04-14 07:11:22Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'misc';
$_GET['action'] = 'commentmore';
$_GET['inajax'] = 1;
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
$comments = mobile_core::getvalues($GLOBALS['comments'], array('/^\d+$/'), array('id', 'tid', 'pid', 'author', 'authorid', 'dateline', 'comment', 'avatar'));
foreach($GLOBALS['comments'] as $k => $c) {
$comments[$k]['avatar'] = avatar($c['authorid'], 'small', true);
}
$variables = array(
'tid' => $_GET['tid'],
'pid' => $_GET['pid'],
'comments' => array($_GET['pid'] => $comments),
'totalcomment' => $GLOBALS['totalcomment'],
'count' => $GLOBALS['count'],
);
mobile_core::result(mobile_core::variable($variables));
}
}
?>

View File

@@ -0,0 +1,237 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: viewthread.php 36278 2016-12-09 07:52:35Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
$_GET['mod'] = 'viewthread';
include_once 'forum.php';
class mobile_api {
public static function common() {
}
public static function output() {
global $_G, $thread, $postlist, $threadsortshow;
if ($GLOBALS['hiddenreplies']) {
foreach ($postlist as $k => $post) {
if (!$post['first'] && $_G['uid'] != $post['authorid'] && $_G['uid'] != $_G['forum_thread']['authorid'] && !$_G['forum']['ismoderator']) {
$postlist[$k]['message'] = lang('plugin/mobile', 'mobile_post_author_visible');
$postlist[$k]['attachments'] = array();
}
}
}
$_G['thread']['lastpost'] = dgmdate($_G['thread']['lastpost']);
$_G['thread']['ordertype'] = $GLOBALS['ordertype'];
$_G['thread']['recommend'] = $_G['uid'] && C::t('forum_memberrecommend')->fetch_by_recommenduid_tid($_G['uid'], $_G['tid']) ? 1 : 0;
if (!empty($_GET['viewpid'])) {
$postlist[$_GET['viewpid']] = $GLOBALS['post'];
}
if ($GLOBALS['rushreply']) {
$_G['thread']['rushreply'] = $GLOBALS['rushreply'];
$_G['thread']['rushresult'] = $GLOBALS['rushresult'];
}
foreach ($GLOBALS['comments'] as $pid => $comments) {
$comments = mobile_core::getvalues($comments, array('/^\d+$/'), array('id', 'tid', 'pid', 'author', 'authorid', 'dateline', 'comment', 'avatar'));
foreach ($comments as $k => $c) {
$comments[$k]['avatar'] = avatar($c['authorid'], 'small', true);
$comments[$k]['dateline'] = dgmdate($c['dateline'], 'u');
}
$GLOBALS['comments'][$pid] = $comments;
}
$variable = array(
'thread' => $_G['thread'],
'fid' => $_G['fid'],
'postlist' => array_values(mobile_core::getvalues($postlist, array('/^\d+$/'), array('pid', 'tid', 'author', 'first', 'dbdateline', 'dateline', 'username', 'adminid', 'memberstatus', 'authorid', 'username', 'groupid', 'memberstatus', 'status', 'message', 'number', 'memberstatus', 'groupid', 'attachment', 'attachments', 'attachlist', 'imagelist', 'anonymous', 'position', 'rewardfloor', 'replycredit'))),
'allowpostcomment' => $_G['setting']['allowpostcomment'],
'comments' => $GLOBALS['comments'],
'commentcount' => $GLOBALS['commentcount'],
'ppp' => $_G['ppp'],
'setting_rewriterule' => $_G['setting']['rewriterule'],
'setting_rewritestatus' => $_G['setting']['rewritestatus'],
'forum_threadpay' => $_G['forum_threadpay'],
'cache_custominfo_postno' => $_G['cache']['custominfo']['postno'],
);
if (!empty($threadsortshow)) {
$optionlist = array();
foreach ($threadsortshow['optionlist'] AS $key => $val) {
$val['optionid'] = $key;
$optionlist[] = $val;
}
if (!empty($optionlist)) {
$threadsortshow['optionlist'] = $optionlist;
$threadsortshow['threadsortname'] = $_G['forum']['threadsorts']['types'][$thread['sortid']];
}
}
$threadsortshowvar = mobile_core::getvalues($threadsortshow, array('/^(?!typetemplate).*$/'));
if (!empty($threadsortshowvar)) {
$variable['threadsortshow'] = $threadsortshowvar;
}
foreach ($variable['postlist'] as $k => $post) {
if (!$_G['forum']['ismoderator'] && $_G['setting']['bannedmessages'] & 1 && (($post['authorid'] && !$post['username']) || ($_G['thread']['digest'] == 0 && ($post['groupid'] == 4 || $post['groupid'] == 5 || $post['memberstatus'] == '-1')))) {
$message = lang('forum/template', 'message_banned');
} elseif (!$_G['forum']['ismoderator'] && $post['status'] & 1) {
$message = lang('forum/template', 'message_single_banned');
} elseif ($GLOBALS['needhiddenreply']) {
$message = lang('forum/template', 'message_ishidden_hiddenreplies');
} elseif ($post['first'] && $_G['forum_threadpay']) {
$message = lang('forum/template', 'pay_threads') . ' ' . $GLOBALS['thread']['price'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['unit'] . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['title'];
} elseif ($_G['forum_discuzcode']['passwordlock']) {
$message = lang('forum/template', 'message_password_exists');
} else {
$message = '';
}
if ($message) {
$variable['postlist'][$k]['message'] = $message;
}
if ($post['anonymous'] && !$_G['forum']['ismoderator']) {
$variable['postlist'][$k]['username'] = $variable['postlist'][$k]['author'] = $_G['setting']['anonymoustext'];
$variable['postlist'][$k]['adminid'] = $variable['postlist'][$k]['groupid'] = $variable['postlist'][$k]['authorid'] = 0;
if ($post['first']) {
$variable['thread']['authorid'] = 0;
}
}
if (strpos($variable['postlist'][$k]['message'], '[/tthread]') !== FALSE) {
$matches = array();
preg_match('/\[tthread=(.+?),(.+?)\](.*?)\[\/tthread\]/', $variable['postlist'][$k]['message'], $matches);
$variable['postlist'][$k]['message'] = preg_replace('/\[tthread=(.+?)\](.*?)\[\/tthread\]/', lang('plugin/qqconnect', 'connect_tthread_message', array('username' => $matches[1], 'nick' => $matches[2])), $variable['postlist'][$k]['message']);
}
$variable['postlist'][$k]['message'] = preg_replace("/<a\shref=\"([^\"]+?)\"\starget=\"_blank\">\[viewimg\]<\/a>/is", "<img src=\"\\1\" />", $variable['postlist'][$k]['message']);
$variable['postlist'][$k]['message'] = mobile_api::_findimg($variable['postlist'][$k]['message']);
if ($GLOBALS['aimgs'][$post['pid']]) {
$imagelist = array();
foreach ($GLOBALS['aimgs'][$post['pid']] as $aid) {
$extra = '';
$url = mobile_api::_parseimg('', $GLOBALS['postlist'][$post['pid']]['attachments'][$aid]['url'] . $GLOBALS['postlist'][$post['pid']]['attachments'][$aid]['attachment'], '');
if ($GLOBALS['postlist'][$post['pid']]['attachments'][$aid]['thumb']) {
$extra = 'file="' . $url . '" ';
$url .= '.thumb.jpg';
}
$extra .= 'attach="' . $post['pid'] . '" ';
if (strexists($variable['postlist'][$k]['message'], '[attach]' . $aid . '[/attach]')) {
$variable['postlist'][$k]['message'] = str_replace('[attach]' . $aid . '[/attach]', mobile_image($url, $extra), $variable['postlist'][$k]['message']);
unset($variable['postlist'][$k]['attachments'][$aid]);
} elseif (!in_array($aid, $_G['forum_attachtags'][$post['pid']])) {
$imagelist[] = $aid;
}
}
$variable['postlist'][$k]['imagelist'] = $imagelist;
}
$variable['postlist'][$k]['message'] = preg_replace("/\[attach\]\d+\[\/attach\]/i", '', $variable['postlist'][$k]['message']);
$variable['postlist'][$k]['message'] = preg_replace('/(&nbsp;){2,}/', '', $variable['postlist'][$k]['message']);
$variable['postlist'][$k]['dateline'] = strip_tags($post['dateline']);
$variable['postlist'][$k]['groupiconid'] = mobile_core::usergroupIconId($post['groupid']);
if($firstpost['first'] && strpos($firstpost['message'],'[/hide]') !== FALSE ){
$authorreplyexist = false;
if(!$_G['forum']['ismoderator']) {
if($_G['uid']) {
$_post = C::t('forum_post')->fetch('tid:'.$_G['tid'], $pid);
$authorreplyexist = $_post['tid'] == $_G['tid'] ? C::t('forum_post')->fetch_pid_by_tid_authorid($_G['tid'], $_G['uid']) : false;
}
} else {
$authorreplyexist = true;
}
if(!$authorreplyexist){
$aids = array();
preg_match_all("/\[hide(.*?)?\]\s*(.*?)\s*\[\/hide\]/is",$firstpost['message'],$matches);
foreach ($matches[2] as $match){
preg_match_all("/\[attach\](\d+)\[\/attach\]/i",$match,$matchaids);
$aids = array_merge($aids,$matchaids[1]);
}
foreach($aids as $aid){
unset($variable['postlist'][$k]['attachments'][$aid]);
}
$variable['postlist'][$k]['attachlist'] = array_diff($variable['postlist'][$k]['attachlist'],$aids);
}
}
}
if (!empty($GLOBALS['polloptions'])) {
$variable['special_poll']['polloptions'] = $GLOBALS['polloptions'];
$variable['special_poll']['expirations'] = $GLOBALS['expirations'];
$variable['special_poll']['multiple'] = $GLOBALS['multiple'];
$variable['special_poll']['maxchoices'] = $GLOBALS['maxchoices'];
$variable['special_poll']['voterscount'] = $GLOBALS['voterscount'];
$variable['special_poll']['visiblepoll'] = $GLOBALS['visiblepoll'];
$variable['special_poll']['allowvote'] = $_G['group']['allowvote'];
$variable['special_poll']['remaintime'] = $thread['remaintime'];
}
if (!empty($GLOBALS['rewardprice'])) {
$variable['special_reward']['rewardprice'] = $GLOBALS['rewardprice'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['title'];
$variable['special_reward']['bestpost'] = $GLOBALS['bestpost'];
}
if (!empty($GLOBALS['trades'])) {
$variable['special_trade'] = $GLOBALS['trades'];
}
if (!empty($GLOBALS['debate'])) {
$variable['special_debate'] = $GLOBALS['debate'];
}
if (!empty($GLOBALS['activity'])) {
$variable['special_activity'] = $GLOBALS['activity'];
$variable['special_activity']['allapplynum'] = $GLOBALS['allapplynum'];
if ($_G['setting']['activitycredit'] && $GLOBALS['activity']['credit'] && !$GLOBALS['applied']) {
$variable['special_activity']['creditcost'] = $GLOBALS['activity']['credit'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['activitycredit']]['title'];
}
$setting = array();
foreach ($GLOBALS['activity']['ufield']['userfield'] as $field) {
$setting[$field] = $_G['cache']['profilesetting'][$field];
}
$variable['special_activity']['joinfield'] = mobile_core::getvalues($setting, array('/./'), array('fieldid', 'formtype', 'available', 'title', 'formtype', 'choices'));
$variable['special_activity']['userfield'] = $GLOBALS['ufielddata']['userfield'];
$variable['special_activity']['extfield'] = $GLOBALS['ufielddata']['extfield'];
$variable['special_activity']['basefield'] = mobile_core::getvalues($GLOBALS['applyinfo'], array('message', 'payment'));
$variable['special_activity']['closed'] = $GLOBALS['activityclose'];
if ($GLOBALS['applied'] && $GLOBALS['isverified'] < 2) {
if (!$GLOBALS['isverified']) {
$variable['special_activity']['status'] = 'wait';
} else {
$variable['special_activity']['status'] = 'joined';
}
if (!$GLOBALS['activityclose']) {
$variable['special_activity']['button'] = 'cancel';
}
} elseif (!$GLOBALS['activityclose']) {
if ($GLOBALS['isverified'] != 2) {
$variable['special_activity']['status'] = 'join';
} else {
$variable['special_activity']['status'] = 'complete';
}
$variable['special_activity']['button'] = 'join';
}
}
$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
mobile_core::result(mobile_core::variable($variable));
}
static function _findimg($string) {
return preg_replace_callback('/(<img src=\")(.+?)(\".*?\>)/is', array(__CLASS__, 'findimg_callback_parseimg_123'), $string);
}
static function findimg_callback_parseimg_123($matches) {
return mobile_api::_parseimg($matches[1], $matches[2], $matches[3]);
}
static function _parseimg($before, $img, $after) {
$before = stripslashes($before);
$after = stripslashes($after);
if (!in_array(strtolower(substr($img, 0, 6)), array('http:/', 'https:', 'ftp://'))) {
global $_G;
$img = $_G['siteurl'] . $img;
}
return $before . $img . $after;
}
}
?>

View File

@@ -0,0 +1,29 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: wechat.php 34480 2014-05-07 01:18:15Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
define('DISABLEXSSCHECK', true);
require './source/class/class_core.php';
$discuz = C::app();
$cachelist = array('plugin');
$discuz->cachelist = $cachelist;
$discuz->init();
$_G['siteurl'] = str_replace('api/mobile/', '', $_G['siteurl']);
$_G['wechat']['setting'] = dunserialize($_G['setting']['mobilewechat']);
require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
$svr = new WeChatServer($_G['wechat']['setting']['wechat_token'], WeChatHook::getResponse($_GET['id']));

View File

@@ -0,0 +1,26 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: wechat_clearlogin.php 34422 2014-04-23 09:56:17Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
require './source/class/class_core.php';
$discuz = C::app();
$discuz->cachelist = $cachelist;
$discuz->init();
$variable = array('result' => 0);
if($_G['uid'] && FORMHASH == $_GET['hash']) {
C::t('#wechat#common_member_wechat')->update($_G['uid'], array('status' => 1));
$variable['result'] = 1;
}
mobile_core::result(mobile_core::variable($variable));

View File

@@ -0,0 +1,59 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: wsqindex.php 34422 2014-04-23 09:56:17Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
define('MOBILE_HIDE_STICKY', !isset($_GET['hidesticky']) ? 1 : $_GET['hidesticky']);
$_GET['mod'] = 'forumdisplay';
include_once 'forum.php';
class mobile_api {
public static function common() {
global $_G;
$_G['wechat']['setting'] = dunserialize($_G['setting']['mobilewechat']);
if (!in_array('wechat', $_G['setting']['plugins']['available']) || !$_G['wechat']['setting']['wsq_fid']) {
mobile_core::result(mobile_core::variable(array()));
}
$_GET['fid'] = $_G['fid'] = $_G['wechat']['setting']['wsq_fid'];
loadforum();
if (!empty($_GET['pw'])) {
$_GET['action'] = 'pwverify';
}
$_G['forum']['allowglobalstick'] = false;
}
public static function output() {
global $_G;
include_once 'source/plugin/mobile/api/4/sub_threadlist.php';
loadcache('mobile_stats');
if (!$_G['cache']['mobile_stats'] || TIMESTAMP - $_G['cache']['mobile_stats']['expiration'] > 3600) {
$forums = C::t('forum_forum')->fetch_all_by_status(1);
foreach ($forums as $forum) {
$posts += $forum['posts'];
}
loadcache('userstats');
$_G['cache']['mobile_stats']['variable'] = array(
'totalposts' => $posts,
'totalmembers' => $_G['cache']['userstats']['totalmembers'],
);
savecache('mobile_stats', array('variable' => $_G['cache']['mobile_stats']['variable'], 'expiration' => TIMESTAMP));
}
$variable['stats'] = $_G['cache']['mobile_stats']['variable'];
require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
$variable['wsqsiteinfo'] = wsq::siteinfo();
mobile_core::result(mobile_core::variable($variable));
}
}
?>

View File

@@ -0,0 +1,32 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: wsqsiteinfo.php 34422 2014-04-23 09:56:17Z nemohou $
*/
if (!defined('IN_MOBILE_API')) {
exit('Access Denied');
}
include_once 'misc.php';
class mobile_api {
public static function common() {
global $_G;
if (!in_array('wechat', $_G['setting']['plugins']['available'])) {
mobile_core::result(mobile_core::variable(array()));
}
require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
mobile_core::result(mobile_core::variable(wsq::siteinfo()));
}
public static function output() {
}
}
?>

View File

View File

@@ -0,0 +1,56 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cache_mobile.php 34314 2014-02-20 01:04:24Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
function build_cache_plugin_mobile() {
if(!defined('DISCUZ_VERSION')) {
require './source/discuz_version.php';
}
global $_G;
$setting = array();
$settings = array('closeforumorderby');
foreach($settings as $v) {
$setting[$v] = $_G['setting'][$v];
}
if(in_array('mobile', $_G['setting']['plugins']['available'])) {
$extendsetting = C::t('#mobile#mobile_setting')->fetch_all(array(
'extend_used',
'extend_lastupdate'
));
$array = array(
'discuzversion' => DISCUZ_VERSION,
'charset' => CHARSET,
'version' => MOBILE_PLUGIN_VERSION,
'pluginversion' => $_G['setting']['plugins']['version']['mobile'],
'oemversion' => in_array('mobileoem', $_G['setting']['plugins']['available']) ? $_G['setting']['plugins']['version']['mobileoem'] : '0',
'regname' => $_G['setting']['regname'],
'qqconnect' => in_array('qqconnect', $_G['setting']['plugins']['available']) ? '1' : '0',
'sitename' => $_G['setting']['bbname'],
'mysiteid' => $_G['setting']['my_siteid'],
'ucenterurl' => $_G['setting']['ucenterurl'],
'setting' => $setting,
'extends' => array('used' => $extendsetting['extend_used'], 'lastupdate' => $extendsetting['extend_lastupdate']),
);
} else {
$array = array();
}
require_once './source/plugin/mobile/mobile.class.php';
define('IN_MOBILE_API', 1);
$data = array('mobilecheck' => mobile_core::json($array));
writetocache('mobile', getcachevars($data));
}

0
source/plugin/mobile/cache/index.htm vendored Normal file
View File

View File

@@ -0,0 +1,14 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: check.php 34236 2013-11-21 01:13:12Z nemohou $
*/
@include '../../../data/sysdata/cache_mobile.php';
echo $mobilecheck;
?>

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<item id="Title"><![CDATA[Discuz! Plugin]]></item>
<item id="Data">
<item id="plugin">
<item id="available"><![CDATA[1]]></item>
<item id="adminid"><![CDATA[1]]></item>
<item id="name"><![CDATA[掌上论坛]]></item>
<item id="identifier"><![CDATA[mobile]]></item>
<item id="description"><![CDATA[]]></item>
<item id="datatables"><![CDATA[]]></item>
<item id="directory"><![CDATA[mobile/]]></item>
<item id="copyright"><![CDATA[Comsenz Inc.]]></item>
<item id="version"><![CDATA[1.4.8]]></item>
<item id="__modules">
<item id="0">
<item id="name"><![CDATA[mobile]]></item>
<item id="menu"><![CDATA[]]></item>
<item id="url"><![CDATA[]]></item>
<item id="type"><![CDATA[28]]></item>
<item id="adminid"><![CDATA[0]]></item>
<item id="displayorder"><![CDATA[0]]></item>
<item id="navtitle"><![CDATA[]]></item>
<item id="navicon"><![CDATA[]]></item>
<item id="navsubname"><![CDATA[]]></item>
<item id="navsuburl"><![CDATA[]]></item>
</item>
<item id="1">
<item id="name"><![CDATA[mobile]]></item>
<item id="menu"><![CDATA[]]></item>
<item id="url"><![CDATA[]]></item>
<item id="type"><![CDATA[11]]></item>
<item id="adminid"><![CDATA[0]]></item>
<item id="displayorder"><![CDATA[0]]></item>
<item id="navtitle"><![CDATA[]]></item>
<item id="navicon"><![CDATA[]]></item>
<item id="navsubname"><![CDATA[]]></item>
<item id="navsuburl"><![CDATA[]]></item>
</item>
</item>
</item>
<item id="version"><![CDATA[X2.5,X3,X3.1,X3.2,X3.3,X3.4,X3.5]]></item>
<item id="language">
<item id="scriptlang">
<item id="mobile_tip_ios"><![CDATA[<a href="https://discuz.dismall.com/mobile.php?platform=ios">用掌上论坛访问本站,拥有更好阅读体验</a>]]></item>
<item id="mobile_tip_android"><![CDATA[<a href="https://discuz.dismall.com/mobile.php?platform=android">用掌上论坛访问本站,拥有更好阅读体验</a>]]></item>
<item id="mobile_tip_wp7"><![CDATA[<a href="https://discuz.dismall.com/mobile.php?platform=windowsphone">用掌上论坛访问本站,拥有更好阅读体验</a>]]></item>
<item id="mobile_extend_newthread"><![CDATA[最新发表]]></item>
<item id="mobile_extend_newreply"><![CDATA[最新回复]]></item>
<item id="mobile_extend_digest"><![CDATA[最新精华]]></item>
<item id="mobile_extend_newpic"><![CDATA[最新图片]]></item>
<item id="mobile_fromtype_ios"><![CDATA[来自: iPhone客户端]]></item>
<item id="mobile_fromtype_android"><![CDATA[来自: Android客户端]]></item>
<item id="mobile_fromtype_windowsphone"><![CDATA[来自: WindowsPhone客户端]]></item>
<item id="mobile_post_author_visible"><![CDATA[该帖仅作者可见]]></item>
<item id="mobilesign_formhash_failed"><![CDATA[formhash验证失败或未登录]]></item>
<item id="mobilesign_success"><![CDATA[签到成功]]></item>
<item id="mobilesign_failed"><![CDATA[已进行过签到]]></item>
</item>
<item id="templatelang">
<item id="mobile_tips"><![CDATA[推荐使用二维码收藏并访问论坛<br />使用二维码收藏论坛的方法:<br />1装掌上论坛应用后点击使用二维码收藏论坛。<br />2将二维码置于相机焦点中即可收藏成功。]]></item>
<item id="username"><![CDATA[用户名]]></item>
<item id="password"><![CDATA[密码]]></item>
<item id="password_confirm"><![CDATA[确认密码]]></item>
<item id="email"><![CDATA[Email]]></item>
<item id="invite_code"><![CDATA[邀请码]]></item>
<item id="register_message"><![CDATA[注册原因]]></item>
<item id="seccode"><![CDATA[验证码]]></item>
<item id="change_seccode"><![CDATA[换一个]]></item>
<item id="secqaa"><![CDATA[验证问答]]></item>
<item id="close"><![CDATA[关闭]]></item>
<item id="admin_tips"><![CDATA[尊敬的站长您可以在Discuz!程序根目录上传"mobile.png"图片(尺寸178x178)以确保论坛客户端能成功获得到论坛的logo]]></item>
<item id="iphone_alt"><![CDATA[iphone-适用于苹果手机]]></item>
<item id="android_alt"><![CDATA[Android-适用于装有安卓系统的三星/HTC/小米等手机]]></item>
<item id="windowsphone_alt"><![CDATA[WinodwsPhone-适用于装有微软WindowsPhone7 系统的手机]]></item>
<item id="discuzmobile_alt"><![CDATA[掌上论坛优势]]></item>
<item id="tips_1"><![CDATA[随时随地,快速访问]]></item>
<item id="tips_1_desc"><![CDATA[只要手机在手,您都可以快速、方便地看贴发帖,与论坛好友收发短消息。]]></item>
<item id="tips_2"><![CDATA[极致优化,畅快"悦"读]]></item>
<item id="tips_2_desc"><![CDATA[独有的论坛界面和触屏设计,手机论坛也变得赏心悦目,操作自如。]]></item>
<item id="tips_3"><![CDATA[即拍即发,分享生活]]></item>
<item id="tips_3_desc"><![CDATA[不管是风景图画,还是新闻现场,拍照发帖一气呵成,让您在论坛出尽风头。]]></item>
<item id="qr_desc"><![CDATA[下载客户端后,拍摄二维码快速访问本站:]]></item>
<item id="qr"><![CDATA[二维码]]></item>
<item id="wapmode"><![CDATA[或者通过以下地址访问:]]></item>
<item id="qqregmode1"><![CDATA[完善账号信息]]></item>
<item id="qqregmode2"><![CDATA[绑定已有账号]]></item>
<item id="register_validate_email_tips"><![CDATA[注册需要验证邮箱,请务必填写正确的邮箱,提交后请及时查收邮件。]]></item>
<item id="post_hide_reply_hidden"><![CDATA[如果您要查看本帖隐藏内容请回复]]></item>
</item>
<item id="installlang">
<item id="mobilesign"><![CDATA[微社区签到]]></item>
</item>
</item>
<item id="installfile"><![CDATA[install.php]]></item>
<item id="upgradefile"><![CDATA[upgrade.php]]></item>
</item>
</root>

View File

@@ -0,0 +1,385 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: discuzcode.func.php 36284 2016-12-12 00:47:50Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
include template('mobile:discuzcode');
function mobile_discuzcode($param) {
global $_G;
list($message, $smileyoff, $bbcodeoff, $htmlon, $allowsmilies, $allowbbcode, $allowimgcode, $allowhtml, $jammer, $parsetype, $authorid, $allowmediacode, $pid, $lazyload, $pdateline, $first) = $param;
static $authorreplyexist;
$message = preg_replace(array(lang('forum/misc', 'post_edit_regexp'), lang('forum/misc', 'post_edithtml_regexp'), lang('forum/misc', 'post_editnobbcode_regexp')), '', $message);
if($pid && strpos($message, '[/password]') !== FALSE) {
if($authorid != $_G['uid'] && !$_G['forum']['ismoderator']) {
$message = preg_replace_callback(
"/\s?\[password\](.+?)\[\/password\]\s?/i",
function ($matches) use ($pid) {
return parsepassword($matches[1], intval($pid));
},
$message
);
if($_G['forum_discuzcode']['passwordlock'][$pid]) {
return '';
}
} else {
$message = preg_replace("/\s?\[password\](.+?)\[\/password\]\s?/i", "", $message);
$_G['forum_discuzcode']['passwordauthor'][$pid] = 1;
}
}
$message = preg_replace('/\[\tDISCUZ_CODE_\d+\t\]/', '', $message);
if($parsetype != 1 && !$bbcodeoff && $allowbbcode && (strpos($message, '[/code]') || strpos($message, '[/CODE]')) !== FALSE) {
$message = preg_replace_callback("/\s?\[code\](.+?)\[\/code\]\s?/is", 'mobile_discuzcode_callback_mobile_parsecode_1', $message);
}
$msglower = strtolower($message);
$htmlon = $htmlon && $allowhtml ? 1 : 0;
if(!$htmlon) {
$message = dhtmlspecialchars($message);
} else {
$message = preg_replace("/<script[^\>]*?>(.*?)<\/script>/i", '', $message);
}
if(!$smileyoff && $allowsmilies) {
$message = mobile_parsesmiles($message);
}
if($_G['setting']['allowattachurl'] && strpos($msglower, 'attach://') !== FALSE) {
$message = preg_replace_callback("/attach:\/\/(\d+)\.?(\w*)/i", 'mobile_discuzcode_callback_parseattachurl_12', $message);
}
if($allowbbcode) {
if(strpos($msglower, 'ed2k://') !== FALSE) {
$message = preg_replace_callback("/ed2k:\/\/([^\/\s'\"]+)\//", 'mobile_discuzcode_callback_mobile_parseed2k_1', $message);
}
}
if(!$bbcodeoff && $allowbbcode) {
if(strpos($msglower, '[/url]') !== FALSE) {
$message = preg_replace_callback("/\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\/\/|www\.|mailto:)?([^\r\n\[\"']+?))?\](.+?)\[\/url\]/is", 'mobile_discuzcode_callback_mobile_parseurl_152', $message);
}
if(strpos($msglower, '[/email]') !== FALSE) {
$message = preg_replace_callback("/\[email(=([A-Za-z0-9\-_.+]+)@([A-Za-z0-9\-_]+[.][A-Za-z0-9\-_.]+))?\](.+?)\[\/email\]/is", 'mobile_discuzcode_callback_mobile_parseemail_14', $message);
}
$nest = 0;
while(strpos($msglower, '[table') !== FALSE && strpos($msglower, '[/table]') !== FALSE){
$message = preg_replace_callback("/\[table(?:=(\d{1,4}%?)(?:,([\(\)%,#\w ]+))?)?\]\s*(.+?)\s*\[\/table\]/is", 'mobile_discuzcode_callback_mobile_parsetable_123', $message);
if(++$nest > 4) break;
}
$message = str_replace(array(
'[/color]', '[/backcolor]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]', '[/p]',
'[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]',
'[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'
), array(
'</font>', '</font>', '', '', '', '<strong>', '</strong>', '<strike>', '</strike>', '<hr class="l" />', '</p>', '', '',
'', '', '', '<ul>', '<ul type="1" class="litype_1">', '<ul type="a" class="litype_2">',
'<ul type="A" class="litype_3">', '<li>', '<li>', '</ul>', '', '', ''
), preg_replace(array(
"/\[color=([#\w]+?)\]/i",
"/\[color=((rgb|rgba)\([\d\s\.,]+?\))\]/i",
"/\[backcolor=([#\w]+?)\]/i",
"/\[backcolor=((rgb|rgba)\([\d\s\.,]+?\))\]/i",
"/\[size=(\d{1,2}?)\]/i",
"/\[size=(\d+(\.\d+)?(px|pt)+?)\]/i",
"/\[font=([^\[\<]+?)\]/i",
"/\[align=(left|center|right)\]/i",
"/\[p=(\d{1,2}|null), (\d{1,2}|null), (left|center|right)\]/i",
"/\[float=left\]/i",
"/\[float=right\]/i"
), array(
"<font color=\"\\1\">",
"<font style=\"color:\\1\">",
"<font style=\"background-color:\\1\">",
"<font style=\"background-color:\\1\">",
"",
"",
"",
"",
"<p>",
"",
""
), $message));
$message = preg_replace("/\s?\[postbg\]\s*([^\[\<\r\n;'\"\?\(\)]+?)\s*\[\/postbg\]\s?/is", "", $message);
if($parsetype != 1) {
if(strpos($msglower, '[/quote]') !== FALSE) {
$message = preg_replace("/\s?\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s?/is", mobile_quote(), $message);
}
if(strpos($msglower, '[/free]') !== FALSE) {
$message = preg_replace("/\s*\[free\][\n\r]*(.+?)[\n\r]*\[\/free\]\s*/is", mobile_free(), $message);
}
}
if(strpos($msglower, '[/media]') !== FALSE) {
$message = preg_replace_callback("/\[media=([\w%,]+)\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/is", 'mobile_discuzcode_callback_bbcodeurl_media2', $message);
}
if(strpos($msglower, '[/audio]') !== FALSE) {
$message = preg_replace_callback("/\[audio(=1)*\]\s*([^\[\<\r\n]+?)\s*\[\/audio\]/is", 'mobile_discuzcode_callback_bbcodeurl_href2', $message);
}
if(strpos($msglower, '[/flash]') !== FALSE) {
$message = preg_replace_callback("/\[flash(=(\d+),(\d+))?\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/is", 'mobile_discuzcode_callback_bbcodeurl_4', $message);
}
if($parsetype != 1 && $allowbbcode < 0 && isset($_G['cache']['bbcodes'][-$allowbbcode])) {
$message = preg_replace($_G['cache']['bbcodes'][-$allowbbcode]['searcharray'], $_G['cache']['bbcodes'][-$allowbbcode]['replacearray'], $message);
}
if($parsetype != 1 && strpos($msglower, '[/hide]') !== FALSE && $pid) {
if($_G['setting']['hideexpiration'] && $pdateline && (TIMESTAMP - $pdateline) / 86400 > $_G['setting']['hideexpiration']) {
$message = preg_replace("/\[hide[=]?(d\d+)?[,]?(\d+)?\]\s*(.*?)\s*\[\/hide\]/is", "\\3", $message);
$msglower = strtolower($message);
}
if(strpos($msglower, '[hide=d') !== FALSE) {
$message = preg_replace_callback(
"/\[hide=(d\d+)?[,]?(\d+)?\]\s*(.*?)\s*\[\/hide\]/is",
function ($matches) use ($pdateline) {
return expirehide($matches[1], $matches[2], $matches[3], intval($pdateline));
},
$message
);
$msglower = strtolower($message);
}
if(strpos($msglower, '[hide]') !== FALSE) {
if($authorreplyexist === null) {
if(!$_G['forum']['ismoderator']) {
if($_G['uid']) {
$authorreplyexist = C::t('forum_post')->fetch_pid_by_tid_authorid($_G['tid'], $_G['uid']);
}
} else {
$authorreplyexist = TRUE;
}
}
if($authorreplyexist) {
$message = preg_replace("/\[hide\]\s*(.*?)\s*\[\/hide\]/is", mobile_hide_reply(), $message);
} else {
$message = preg_replace("/\[hide\](.*?)\[\/hide\]/is", mobile_hide_reply_hidden(), $message);
}
}
if(strpos($msglower, '[hide=') !== FALSE) {
$message = preg_replace_callback(
"/\[hide=(\d+)\]\s*(.*?)\s*\[\/hide\]/is",
function ($matches) use ($pid, $authorid) {
return creditshide($matches[1], $matches[2], intval($pid), intval($authorid));
},
$message
);
}
}
}
if(strpos($message, '[/tthread]') !== FALSE) {
$matches = array();
preg_match('/\[tthread=(.+?),(.+?)\](.*?)\[\/tthread\]/', $message, $matches);
$message = preg_replace('/\[tthread=(.+?)\](.*?)\[\/tthread\]/', lang('plugin/qqconnect', 'connect_tthread_message', array('username' => $matches[1], 'nick' => $matches[2])), $message);
}
if(!$bbcodeoff) {
if($parsetype != 1 && strpos($msglower, '[swf]') !== FALSE) {
$message = preg_replace_callback("/\[swf\]\s*([^\[\<\r\n]+?)\s*\[\/swf\]/is", 'mobile_discuzcode_callback_bbcodeurl_1', $message);
}
$attrsrc = !IS_ROBOT && $lazyload ? 'file' : 'src';
if(strpos($msglower, '[/img]') !== FALSE) {
$message = preg_replace_callback(
"/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/is",
function ($matches) use ($allowimgcode, $lazyload, $pid, $allowbbcode) {
if ($allowimgcode) {
return mobile_parseimg(0, 0, $matches[1], intval($lazyload), intval($pid), 'onmouseover="img_onmouseoverfunc(this)" '.(intval($lazyload) ? 'lazyloadthumb="1"' : 'onload="thumbImg(this)"'));
}
return (intval($allowbbcode) ? (!defined('IN_MOBILE') ? bbcodeurl($matches[1], '<a href="{url}" target="_blank">{url}</a>') : bbcodeurl($matches[1], '')) : bbcodeurl($matches[1], '{url}'));
},
$message
);
$message = preg_replace_callback(
"/\[img=(\d{1,4})[x|\,](\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/is",
function($matches) use ($allowimgcode, $lazyload, $pid, $allowbbcode) {
if (intval($allowimgcode)) {
mobile_parseimg($matches[1], $matches[2], $matches[3], intval($lazyload), intval($pid));
}
return (intval($allowbbcode) ? (!defined('IN_MOBILE') ? bbcodeurl($matches[3], '<a href="{url}" target="_blank">{url}</a>') : bbcodeurl($matches[3], '')) : bbcodeurl($matches[3], '{url}'));
},
$message
);
}
}
for($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) {
$message = str_replace("[\tDISCUZ_CODE_$i\t]", $_G['forum_discuzcode']['codehtml'][$i], $message);
}
unset($msglower);
$message = preg_replace("/(\[groupid=\d+\].*\[\/groupid\])/i", '', $message);
$message = preg_replace("/(\r\n|\n|\r){3,}/i", "\\1\\1\\1", $message);
return $message;
}
function mobile_discuzcode_callback_mobile_parsecode_1($matches) {
return mobile_parsecode($matches[1]);
}
function mobile_discuzcode_callback_parseattachurl_12($matches) {
return parseattachurl($matches[1], $matches[2], 1);
}
function mobile_discuzcode_callback_mobile_parseed2k_1($matches) {
return mobile_parseed2k($matches[1]);
}
function mobile_discuzcode_callback_mobile_parseurl_152($matches) {
return mobile_parseurl($matches[1], $matches[5], $matches[2]);
}
function mobile_discuzcode_callback_mobile_parseemail_14($matches) {
return strip_tags(parseemail($matches[1], $matches[4]));
}
function mobile_discuzcode_callback_mobile_parsetable_123($matches) {
return mobile_parsetable($matches[1], $matches[2], $matches[3]);
}
function mobile_discuzcode_callback_bbcodeurl_media2($matches) {
return bbcodeurl($matches[2], '<a class="media" href="{url}" target="_blank">{url}</a>');
}
function mobile_discuzcode_callback_bbcodeurl_href2($matches) {
return bbcodeurl($matches[2], '<a href="{url}" target="_blank">{url}</a>');
}
function mobile_discuzcode_callback_bbcodeurl_4($matches) {
return bbcodeurl($matches[4], '<a href="{url}" target="_blank">{url}</a>');
}
function mobile_discuzcode_callback_bbcodeurl_1($matches) {
return bbcodeurl($matches[1], ' <img src="'.STATICURL.'image/filetype/flash.gif" align="absmiddle" alt="" /> <a href="{url}" target="_blank">Flash: {url}</a> ');
}
function mobile_parseurl($url, $text, $scheme) {
global $_G;
if(!$url && preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\/\/|www\.)[^\[\"']+/i", trim($text), $matches)) {
$url = $matches[0];
$length = 65;
if(strlen($url) > $length) {
$text = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
}
$url = substr(strtolower($url), 0, 4) == 'www.' ? 'http://'.$url : $url;
return '<a href="'.$url.'">'.$text.'</a>';
} else {
$url = substr($url, 1);
if(substr(strtolower($url), 0, 4) == 'www.') {
$url = 'http://'.$url;
}
$url = !$scheme ? $_G['siteurl'].$url : $url;
return '<a href="'.$url.'">'.$text.'</a>';
}
}
function mobile_parsecode($code) {
global $_G;
$_G['forum_discuzcode']['pcodecount']++;
$code = dhtmlspecialchars(str_replace('\\"', '"', $code));
$code = str_replace("\n", "<li>", $code);
$_G['forum_discuzcode']['codehtml'][$_G['forum_discuzcode']['pcodecount']] = mobile_codedisp($code);
$_G['forum_discuzcode']['codecount']++;
return "[\tDISCUZ_CODE_".$_G['forum_discuzcode']['pcodecount']."\t]";
}
function mobile_parseimg($width, $height, $url) {
global $_G;
$url = htmlspecialchars(str_replace(array('<', '>'), '', str_replace('\\"', '\"', $url)));
if(strtolower(substr($url, 0, 7)) == 'static/') {
$url = $_G['siteurl'].$url;
}
if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://'))) {
$url = 'http://'.$url;
}
$extra = ($width > 0 ? 'width="'.$width.'" ' : '').($height > 0 ? 'height="'.$height.'" ' : '');
return mobile_image($url, $extra);
}
function mobile_parsesmiles(&$message) {
global $_G;
static $enablesmiles;
if($enablesmiles === null) {
$url = !in_array(strtolower(substr(STATICURL, 0, 6)), array('http:/', 'https:', 'ftp://')) ? $_G['siteurl'] : '';
$enablesmiles = false;
if(!empty($_G['cache']['smilies']) && is_array($_G['cache']['smilies'])) {
foreach($_G['cache']['smilies']['replacearray'] AS $key => $smiley) {
$enablesmiles[$key] = '<img src="'.$url.STATICURL.'image/smiley/'.$_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$key]]['directory'].'/'.$smiley.'" />';
}
}
}
$enablesmiles && $message = preg_replace($_G['cache']['smilies']['searcharray'], $enablesmiles, $message, $_G['setting']['maxsmilies']);
return $message;
}
function mobile_parsetable($width, $bgcolor, $message) {
if(strpos($message, '[/tr]') === FALSE && strpos($message, '[/td]') === FALSE) {
$rows = explode("\n", $message);
$s = '<ul>';
foreach($rows as $row) {
$s .= '<li>'.str_replace(array('\|', '|', '\n'), array('&#124;', '</li><li>', "\n"), $row).'</li>';
}
$s .= '</ul>';
return $s;
} else {
if(!preg_match("/^\[tr(?:=([\(\)\s%,#\w]+))?\]\s*\[td([=\d,%]+)?\]/", $message) && !preg_match("/^<tr[^>]*?>\s*<td[^>]*?>/", $message)) {
return str_replace('\\"', '"', preg_replace("/\[tr(?:=([\(\)\s%,#\w]+))?\]|\[td([=\d,%]+)?\]|\[\/td\]|\[\/tr\]/", '', $message));
}
$message = preg_replace_callback("/\[tr(?:=([\(\)\s%,#\w]+))?\]\s*\[td(?:=(\d{1,4}%?))?\]/i", 'mobile_parsetable_callback_mobile_parsetrtd_12', $message);
$message = preg_replace_callback("/\[\/td\]\s*\[td(?:=(\d{1,4}%?))?\]/i", 'mobile_parsetable_callback_mobile_parsetrtd_1', $message);
$message = preg_replace_callback("/\[tr(?:=([\(\)\s%,#\w]+))?\]\s*\[td(?:=(\d{1,2}),(\d{1,2})(?:,(\d{1,4}%?))?)?\]/i", 'mobile_parsetable_callback_mobile_parsetrtd_1234', $message);
$message = preg_replace_callback("/\[\/td\]\s*\[td(?:=(\d{1,2}),(\d{1,2})(?:,(\d{1,4}%?))?)?\]/i", 'mobile_parsetable_callback_mobile_parsetrtd_123', $message);
return '<table class="dzcode_table" cellspacing="0" '.
($bgcolor ? ' bgcolor="'.$bgcolor.'">' : '>').
str_replace('\\"', '"', preg_replace("/\[\/td\]\s*\[\/tr\]\s*/i", '</td></tr>', $message)
).'</table>';
}
}
function mobile_parsetable_callback_mobile_parsetrtd_12($matches) {
return mobile_parsetrtd($matches[1], 0, 0, $matches[2]);
}
function mobile_parsetable_callback_mobile_parsetrtd_1($matches) {
return mobile_parsetrtd('td', 0, 0, $matches[1]);
}
function mobile_parsetable_callback_mobile_parsetrtd_1234($matches) {
return mobile_parsetrtd($matches[1], $matches[2], $matches[3], $matches[4]);
}
function mobile_parsetable_callback_mobile_parsetrtd_123($matches) {
return mobile_parsetrtd('td', $matches[1], $matches[2], $matches[3]);
}
function mobile_parsetrtd($bgcolor, $colspan, $rowspan, $width) {
return ($bgcolor == 'td' ? '</td></tr>' : '<tr'.($bgcolor ? ' style="background-color:'.$bgcolor.'"' : '').'>').'<td class="dzcode_td">';
}
function mobile_parseed2k($url) {
global $_G;
list(,$type, $name, $size,) = explode('|', $url);
$name = addslashes($name);
if($type == 'file') {
return '<a ed2k="'.urlencode($url).'">'.$name.' ('.sizecount($size).')</a>';
} else {
return '<a ed2k="'.urlencode($url).'">'.$url.'</a>';
}
}
?>

View File

@@ -0,0 +1 @@

Some files were not shown because too many files have changed in this diff Show More