Example #1
0
 function output()
 {
     global $_G;
     $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 ($GLOBALS['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;
             }
             //取出回帖的内容
             include_once libfile('function/forum');
             require_once libfile('function/discuzcode');
             loadforum(null, $tid);
             if ($pid) {
                 $postlist = $this->post = get_post_by_pid($pid, 'message');
                 $GLOBALS['list'][$_k]['message'] = discuzcode($postlist['message']);
             }
             $GLOBALS['list'][$_k]['dateline'] = dgmdate($GLOBALS['list'][$_k]['dateline']);
             $GLOBALS['list'][$_k]['dbdateline'] = $GLOBALS['list'][$_k]['dateline'];
             $GLOBALS['list'][$_k]['notevar'] = array('tid' => $tid, 'pid' => $pid, 'subject' => $subject, 'actoruid' => $actoruid, 'actorusername' => $actorusername);
         }
     }
     $variable = array('hash' => md5(substr(md5($_G['config']['security']['authkey']), 8) . $_G['uid']), 'list' => mobile_core::getvalues(array_values($GLOBALS['list']), array('/^\\d+$/'), array('id', 'uid', 'type', 'new', 'authorid', 'author', 'note', 'dateline', 'from_id', 'from_idtype', 'from_num', 'style', 'rowid', 'notevar', 'message')), 'count' => $GLOBALS['count'], 'perpage' => $GLOBALS['perpage'], 'page' => intval($GLOBALS['page']));
     mobile_core::result(mobile_core::variable($variable));
 }
	public function __construct($fid = null) {
		parent::__construct();
		if($fid) {
			include_once libfile('function/forum');
			loadforum($fid);
		}
		$this->forum = &$this->app->var['forum'];
	}
Example #3
0
 function common()
 {
     global $_G;
     $_G['wechat']['setting'] = unserialize($_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;
 }
Example #4
0
	public function __construct($tid = null, $pid = null) {
		parent::__construct();
		require_once libfile('function/post');
		require_once libfile('function/forumlist');
		if($tid) {
			include_once libfile('function/forum');
			loadforum(null, $tid);
			if($pid) {
				$this->post = get_post_by_tid_pid($tid, $pid);
			}
		}
		$this->forum = &$this->app->var['forum'];
		$this->thread = &$this->app->var['thread'];
		$this->group = &$this->app->var['group'];
	}
Example #5
0
 function common()
 {
     global $_G;
     if (!isset($_GET['fid']) && isset($_GET['tid'])) {
         $sql = 'SELECT fid FROM ' . DB::table('forum_thread') . ' WHERE tid = ' . intval($_GET['tid']);
         $query = DB::query($sql);
         $fid = null;
         while ($tmp = DB::fetch($query)) {
             $fid = $tmp['fid'];
             break;
         }
         loadforum($fid, null);
     }
     $apifile = dirname(__FILE__) . '/sub_checkpost.php';
     if (file_exists($apifile)) {
         require_once $apifile;
     }
     bigapp_core::result(bigapp_core::variable(bigapp_api_sub::getvariable()));
 }
         $currenttype = 'thread';
     }
 }
 if ($currenttype == 'thread') {
     $_G['setting']['seccodestatus'] = 0;
     $_G['setting']['secqaa']['status'] = 0;
     $_POST['replysubmit'] = true;
     $_GET['tid'] = $currentid;
     $_G['gp_action'] = 'reply';
     $_G['gp_message'] = $_POST['general'];
     if ($commentcable[$type] == 'article') {
         $_POST['portal_referer'] = 'portal.php?mod=view&aid=' . $id;
     }
     include_once libfile('function/forum');
     require_once libfile('function/post');
     loadforum();
     $inspacecpshare = 1;
     include_once libfile('forum/post', 'module');
     $redirecturl = $url ? $url : '';
     $showmessagecontent = $modnewreplies && $commentcable[$type] != 'article' ? 'do_success_thread_share_mod' : '';
 } elseif ($currenttype == 'article') {
     if (!checkperm('allowcommentarticle')) {
         showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
     }
     include_once libfile('function/spacecp');
     include_once libfile('function/portalcp');
     cknewuser();
     $waittime = interval_check('post');
     if ($waittime > 0) {
         showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
     }
Example #7
0
 public function loadForum($fid, $tid = 0)
 {
     require_once libfile('function/forum');
     $path = Yii::getPathOfAlias('application.components.discuz.source.function');
     require_once sprintf('%s/function_forum_%s.php', $path, MobcentDiscuz::getMobcentDiscuzVersion());
     $_GET['fid'] = $fid;
     $_GET['tid'] = $tid;
     global $_G;
     $_G['setting']['forumpicstyle'] = null;
     loadforum();
 }
Example #8
0
function getNormalThread() {
	global $_G;
	$tid = intval($_GET['tid']);
	if(empty($tid)) {
		return false;
	}

	require_once libfile('function/forum');
	require_once libfile('function/discuzcode');
	loadforum();

	$subject = strip_tags($_G['thread']['subject']);
	$hasImage = $_G['thread']['attachment'] ? true : false;

	ajaxshowheader();
	echo showNormalTemplateLi($tid, $subject, $hasImage, true);
	ajaxshowfooter();
}
Example #9
0
 function process()
 {
     global $_G;
     //1. try to get user mask
     $authority = array();
     if ($_G['uid'] && !empty($_G['member']['accessmasks'])) {
         loadcache('plugin');
         $bucketNum = 100003;
         $expire = 5;
         $userBucket = $_G['uid'] % $bucketNum;
         loadcache('bigapp_authority_' . $userBucket);
         if (!isset($_G['cache']['bigapp_authority_' . $userBucket]) || TIMESTAMP - $_G['cache']['bigapp_authority_' . $userBucket]['expiration'] > $expire) {
             $sql = 'SELECT uid, fid, allowview FROM ' . DB::table('forum_access') . ' WHERE uid % ' . $bucketNum . ' = ' . $userBucket;
             $query = DB::query($sql);
             $authorities = array();
             while ($tmp = DB::fetch($query)) {
                 $authorities[$tmp['uid']][$tmp['fid']] = $tmp['allowview'];
             }
             savecache('bigapp_authority_' . $userBucket, array('variable' => $authorities, 'expiration' => TIMESTAMP));
         } else {
             $authorities = $_G['cache']['bigapp_authority_' . $userBucket]['variable'];
         }
         if (isset($authorities[$_G['uid']])) {
             $authority = $authorities[$_G['uid']];
         }
     }
     //2. try to get all forums
     $forums = array();
     $cacheKey = 'bigapp_forumnav';
     if (isset($_G['adminid'])) {
         $cacheKey = 'bigapp_forumnav_' . $_G['adminid'];
     }
     loadcache($cacheKey);
     $expire = 5;
     if (!isset($_G['cache'][$cacheKey]) || empty($_G['cache'][$cacheKey]) || TIMESTAMP - $_G['cache'][$cacheKey]['expiration'] > $expire) {
         //need update all forums from database
         $sql = "SELECT f.fid, f.type, f.name, f.fup, f.status, f.threads, f.posts, f.todayposts, f.allowpostspecial, f.allowspecialonly, " . "ff.password, ff.redirect, ff.viewperm, ff.postperm, ff.threadtypes, ff.threadsorts, ff.icon, ff.description, ff.moderators FROM " . DB::table('forum_forum') . " f LEFT JOIN " . DB::table('forum_forumfield') . " ff USING(fid) WHERE f.status='1' ORDER BY f.type, f.displayorder";
         $query = DB::query($sql);
         while ($forum = DB::fetch($query)) {
             if ($forum['redirect'] || $forum['password']) {
                 continue;
             }
             if (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm'])) {
                 if ($forum['threadsorts']) {
                     $forum['threadsorts'] = bigapp_core::getvalues(unserialize($forum['threadsorts']), array('required', 'types'));
                 }
                 if ($forum['threadtypes']) {
                     $forum['threadtypes'] = unserialize($forum['threadtypes']);
                     $unsetthreadtype = false;
                     if ($_G['adminid'] == 3 && strpos($forum['moderators'], $_G['username']) === false) {
                         $unsetthreadtype = true;
                     }
                     if ($_G['adminid'] == 0) {
                         $unsetthreadtype = true;
                     }
                     if ($unsetthreadtype) {
                         foreach ($forum['threadtypes']['moderators'] as $k => $v) {
                             if (!empty($v)) {
                                 unset($forum['threadtypes']['types'][$k]);
                             }
                         }
                     }
                     $flag = 0;
                     foreach ($forum['threadtypes']['types'] as $k => $v) {
                         if ($k == 0) {
                             $flag = 1;
                             break;
                         }
                     }
                     if ($flag == 1) {
                         krsort($forum['threadtypes']['types']);
                     }
                     $forum['threadtypes'] = bigapp_core::getvalues($forum['threadtypes'], array('required', 'types'));
                 }
                 loadforum($forum['fid'], null);
                 if (!empty($_G['forum']['threadtypes']) || !empty($_GET['debug'])) {
                     $forum['threadtypes_detail'] = $_G['forum']['threadtypes'];
                     unset($forum['threadtypes_detail']['types']);
                     foreach ($_G['forum']['threadtypes']['types'] as $typeId => $typeValue) {
                         $typeValue = preg_replace('/<.*?>/', '', $typeValue);
                         if (isset($_G['forum']['threadtypes']['moderators'][$typeId]) && !empty($_G['forum']['threadtypes']['moderators'][$typeId])) {
                             if (isset($_G['adminid']) && $_G['adminid'] != $_G['forum']['threadtypes']['moderators'][$typeId]) {
                                 continue;
                             }
                         }
                         $forum['threadtypes_detail']['types'][] = array('typeid' => $typeId, 'typename' => $typeValue);
                     }
                     unset($forum['threadtypes_detail']['icons']);
                     foreach ($_G['forum']['threadtypes']['icons'] as $typeId => $icon) {
                         $forum['threadtypes_detail']['icons'][] = array('typeid' => $typeId, 'typeicon' => $icon);
                     }
                 }
                 $moderators = explode("\t", $forum['moderators']);
                 if (!is_array($moderators) || 0 === count($moderators)) {
                     $forum['moderators'] = array();
                 } else {
                     foreach ($moderators as &$_v) {
                         $_v = "'{$_v}'";
                     }
                     unset($_v);
                     $sql = 'SELECT username, uid FROM ' . DB::table('common_member') . ' WHERE username IN (' . implode(', ', $moderators) . ')';
                     $subQuery = DB::query($sql);
                     $forum['moderators'] = array();
                     while ($moderator = DB::fetch($subQuery)) {
                         $forum['moderators'][] = array('uid' => $moderator['uid'], 'username' => $moderator['username']);
                     }
                 }
                 $forums[] = bigapp_core::getvalues($forum, array('fid', 'type', 'name', 'fup', 'viewperm', 'postperm', 'status', 'threadsorts', 'threadtypes', 'threadtypes_detail', 'icon', 'description', 'threads', 'allowpostspecial', 'allowspecialonly', 'posts', 'todayposts', 'moderators'));
             }
         }
         //add result to syscache
         savecache($cacheKey, array('variable' => $forums, 'expiration' => TIMESTAMP));
     } else {
         $forums = $_G['cache'][$cacheKey]['variable'];
     }
     //3. judge which forum should be displayed
     $retData = array();
     if (!empty($authority)) {
         foreach ($forums as $forum) {
             if (isset($authority[$forum['fid']]) && -1 == $authority[$forum['fid']]) {
                 continue;
             }
             $retData[] = $forum;
         }
     } else {
         $retData = $forums;
     }
     //4. AppDegin 论坛视图设置过滤
     $res = C::t('common_setting')->fetch("bigapp_view_2", true);
     if (isset($res['displayid']) && isset($res['forbiddenid'])) {
         //获取论坛视图配置
         $displayArr = array();
         $forbiddenArr = array();
         if (!empty($res['displayid'])) {
             $displayArr = explode(',', $res['displayid']);
         }
         if (!empty($res['forbiddenid'])) {
             $forbiddenArr = explode(',', $res['forbiddenid']);
         }
         $retData = BigAppAPI::_filterResult($retData, $displayArr, $forbiddenArr);
     }
     $activityForum = array();
     foreach ($retData as $forum) {
         if (isset($_G['group']['allowpostactivity']) && $_G['group']['allowpostactivity'] && $forum['allowpostspecial'] & 8) {
             $activityForum[] = $forum;
         }
     }
     foreach ($retData as &$value) {
         BigAppAPI::_textDescription($value);
     }
     unset($value);
     $variable['forums'] = array_values(BigAppAPI::_sortResult($retData));
     $variable['activity_forums'] = $activityForum;
     if (isset($_G['setting']['bigapp_settings'])) {
         $_G['setting']['bigapp_settings'] = unserialize($_G['setting']['bigapp_settings']);
     }
     $res = C::t('common_setting')->fetch("bigapp_view_2", true);
     if (isset($res[0]) && empty($res[0])) {
         //没有获取论坛视图配置
         $variable['display_style'] = strval(isset($_G['setting']['bigapp_settings']['display_style']) ? $_G['setting']['bigapp_settings']['display_style'] : 0);
     } else {
         $variable['display_style'] = isset($res["type"]) ? strval(intval($res["type"]) - 1) : '0';
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }