本文整理汇总了PHP中forumperm函数的典型用法代码示例。如果您正苦于以下问题:PHP forumperm函数的具体用法?PHP forumperm怎么用?PHP forumperm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forumperm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forumselect
function forumselect($groupselectable = FALSE, $tableformat = 0)
{
global $_DCACHE, $discuz_uid, $groupid, $fid, $gid, $indexname;
if (!isset($_DCACHE['forums'])) {
require_once DISCUZ_ROOT . './forumdata/cache/cache_forums.php';
}
$forumlist = $tableformat ? '<dl><dd><ul>' : '<optgroup label=" ">';
foreach ($_DCACHE['forums'] as $forum) {
if ($forum['type'] == 'group') {
if ($tableformat) {
$forumlist .= '</ul></dd></dl><dl><dt><a href="' . $indexname . '?gid=' . $forum['fid'] . '">' . $forum['name'] . '</a></dt><dd><ul>';
} else {
$forumlist .= $groupselectable ? '<option value="' . $forum['fid'] . '">' . $forum['name'] . '</option>' : '</optgroup><optgroup label="' . $forum['name'] . '">';
}
$visible[$forum['fid']] = true;
} elseif ($forum['type'] == 'forum' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm']) || strstr($forum['users'], "\t{$discuz_uid}\t"))) {
if ($tableformat) {
$forumlist .= '<li' . ($fid == $forum['fid'] ? ' class="current"' : '') . '><a href="forumdisplay.php?fid=' . $forum['fid'] . '">' . $forum['name'] . '</a></li>';
} else {
$forumlist .= '<option value="' . $forum['fid'] . '"> > ' . $forum['name'] . '</option>';
}
$visible[$forum['fid']] = true;
} elseif ($forum['type'] == 'sub' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm']) || strstr($forum['users'], "\t{$discuz_uid}\t"))) {
if ($tableformat) {
$forumlist .= '<li class="sub' . ($fid == $forum['fid'] ? ' current"' : '') . '"><a href="forumdisplay.php?fid=' . $forum['fid'] . '">' . $forum['name'] . '</a></li>';
} else {
$forumlist .= '<option value="' . $forum['fid'] . '"> > ' . $forum['name'] . '</option>';
}
}
}
$forumlist .= $tableformat ? '</ul></dd></dl>' : '</optgroup>';
$forumlist = str_replace($tableformat ? '<dl><dd><ul></ul></dd></dl>' : '<optgroup label=" "></optgroup>', '', $forumlist);
return $forumlist;
}
示例2: common
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\r\n\t\t\t\tFROM " . DB::table('forum_forum') . " f\r\n\t\t\t\tLEFT JOIN " . DB::table('forum_forumfield') . " ff ON ff.fid=f.fid\r\n\t\t\t\tLEFT JOIN " . DB::table('forum_access') . " a ON a.uid='{$_G['uid']}' AND a.allowview>'0' AND a.fid=f.fid\r\n\t\t\t\tWHERE 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\r\n\t\t\t\tFROM " . DB::table('forum_forum') . " f\r\n\t\t\t\tLEFT JOIN " . DB::table('forum_forumfield') . " ff USING(fid)\r\n\t\t\t\tWHERE f.status='1' ORDER BY f.type, f.displayorder";
$query = DB::query($sql);
//$query = DB::query("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.fid=f.fid AND a.allowview>'0' WHERE f.status='1' ORDER BY f.type, f.displayorder");
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'] = unserialize($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'] = 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) {
$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));
}
示例3: getGroupFroumInfo
function getGroupFroumInfo($gid = null)
{
global $_G, $expireTime;
$oldGid = $_G['groupid'];
if (!is_null($gid) && is_numeric($gid) && $gid >= 0) {
$cacheKey = 'bigapp_group_fids_' . $gid;
$_G['groupid'] = $gid;
} else {
$cacheKey = 'bigapp_group_fids_' . $_G['groupid'];
}
true === BIGAPP_DEV && runlog('bigapp', 'group key: ' . $cacheKey);
loadcache($cacheKey);
$forums = array();
if (!isset($_G['cache'][$cacheKey]) || empty($_G['cache'][$cacheKey]) || TIMESTAMP - $_G['cache'][$cacheKey]['expiration'] > $expireTime) {
$sql = "SELECT f.fid, f.type, f.name, f.fup, f.status, f.threads, f.posts, f.todayposts, " . "ff.password, ff.redirect, ff.viewperm, ff.postperm, ff.threadtypes, ff.threadsorts, ff.icon, ff.description, ff.moderators FROM " . DB::table('forum_forum') . " f LEFT JOIN " . DB::table('forum_forumfield') . " ff USING(fid) WHERE f.status='1' ORDER BY f.type, f.displayorder";
$query = DB::query($sql);
while ($forum = DB::fetch($query)) {
//过滤掉会跳转或需要密码的板块
if ($forum['redirect'] || $forum['password']) {
true === BIGAPP_DEV && runlog('bigapp', 'such forum will redirect or need password, ignore [ fid: ' . $forum['fid'] . ' ]');
continue;
}
//板块存在用户组的权限设定,那么判定该用户组是否允许访问该板块
if (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm'])) {
$forums[$forum['fid']] = array('fid' => $forum['fid'], 'threadtypes' => unserialize($forum['threadtypes']));
continue;
}
true === BIGAPP_DEV && runlog('bigapp', 'viewperm has been set [ perm: ' . $forum['viewperm'] . ', group id: ' . $_G['groupid'] . ', ignore fid: ' . $forum['fid'] . ' ]');
}
savecache($cacheKey, array('variable' => $forums, 'expiration' => TIMESTAMP));
true === BIGAPP_DEV && runlog('bigapp', 'save forum ids to cache for group id [ group id: ' . $_G['groupid'] . ' ]');
} else {
true === BIGAPP_DEV && runlog('bigapp', 'get forum ids from cache data [ group id: ' . $_G['groupid'] . ' ]');
$forums = $_G['cache'][$cacheKey]['variable'];
}
true === BIGAPP_DEV && runlog('bigapp', 'get group forum info finished [ fids: ' . json_encode(array_keys($forums)) . ' ]');
$_G['groupid'] = $oldGid;
return $forums;
}
示例4: common
function common()
{
global $_G;
$forums = array();
$query = DB::query("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.fid=f.fid AND a.allowview>'0' WHERE f.status='1' ORDER BY f.type, f.displayorder");
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(unserialize($forum['threadsorts']), array('required', 'types'));
}
if ($forum['threadtypes']) {
$forum['threadtypes'] = mobile_core::getvalues(unserialize($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));
}
示例5: forumselect
function forumselect($groupselectable = FALSE, $tableformat = 0, $selectedfid = 0, $showhide = FALSE, $evalue = FALSE, $special = 0)
{
global $_G;
if (!isset($_G['cache']['forums'])) {
loadcache('forums');
}
$forumcache =& $_G['cache']['forums'];
$forumlist = $tableformat ? '<dl><dd><ul>' : '<optgroup label=" ">';
foreach ($forumcache as $forum) {
if ((!$forum['status'] || $forum['status'] == 2) && !$showhide) {
continue;
}
if ($forum['type'] == 'group') {
if ($tableformat) {
$forumlist .= '</ul></dd></dl><dl><dt><a href="forum.php?gid=' . $forum['fid'] . '">' . $forum['name'] . '</a></dt><dd><ul>';
} else {
$forumlist .= $groupselectable ? '<option value="' . ($evalue ? 'gid_' : '') . $forum['fid'] . '" class="bold">--' . $forum['name'] . '</option>' : '</optgroup><optgroup label="--' . $forum['name'] . '">';
}
$visible[$forum['fid']] = true;
} elseif ($forum['type'] == 'forum' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm']) || strstr($forum['users'], "\t{$_G['uid']}\t")) && (!$special || substr($forum['allowpostspecial'], -$special, 1))) {
if ($tableformat) {
$forumlist .= '<li' . ($_G['fid'] == $forum['fid'] ? ' class="current"' : '') . '><a href="forum.php?mod=forumdisplay&fid=' . $forum['fid'] . '">' . $forum['name'] . '</a></li>';
} else {
$forumlist .= '<option value="' . ($evalue ? 'fid_' : '') . $forum['fid'] . '"' . ($selectedfid && $selectedfid == $forum['fid'] ? ' selected' : '') . '>' . $forum['name'] . '</option>';
}
$visible[$forum['fid']] = true;
} elseif ($forum['type'] == 'sub' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm']) || strstr($forum['users'], "\t{$_G['uid']}\t")) && (!$special || substr($forum['allowpostspecial'], -$special, 1))) {
if ($tableformat) {
$forumlist .= '<li class="sub' . ($_G['fid'] == $forum['fid'] ? ' current' : '') . '"><a href="forum.php?mod=forumdisplay&fid=' . $forum['fid'] . '">' . $forum['name'] . '</a></li>';
} else {
$forumlist .= '<option value="' . ($evalue ? 'fid_' : '') . $forum['fid'] . '"' . ($selectedfid && $selectedfid == $forum['fid'] ? ' selected' : '') . '> ' . $forum['name'] . '</option>';
}
}
}
$forumlist .= $tableformat ? '</ul></dd></dl>' : '</optgroup>';
$forumlist = str_replace($tableformat ? '<dl><dd><ul></ul></dd></dl>' : '<optgroup label=" "></optgroup>', '', $forumlist);
return $forumlist;
}
示例6: array_merge
$showthreadsorts = 0;
$quotemessage = '';
if ($special == 5) {
$debate = array_merge($thread, daddslashes(C::t('forum_debate')->fetch($_G['tid'])));
$firststand = C::t('forum_debatepost')->get_firststand($_G['tid'], $_G['uid']);
$stand = $firststand ? $firststand : intval($_GET['stand']);
if ($debate['endtime'] && $debate['endtime'] < TIMESTAMP) {
showmessage('debate_end');
}
}
if (!$_G['uid'] && !(!$_G['forum']['replyperm'] && $_G['group']['allowreply'] || $_G['forum']['replyperm'] && forumperm($_G['forum']['replyperm']))) {
showmessage('replyperm_login_nopermission', NULL, array(), array('login' => 1));
} elseif (empty($_G['forum']['allowreply'])) {
if (!$_G['forum']['replyperm'] && !$_G['group']['allowreply']) {
showmessage('replyperm_none_nopermission', NULL, array(), array('login' => 1));
} elseif ($_G['forum']['replyperm'] && !forumperm($_G['forum']['replyperm'])) {
showmessagenoperm('replyperm', $_G['forum']['fid']);
}
} elseif ($_G['forum']['allowreply'] == -1) {
showmessage('post_forum_newreply_nopermission', NULL);
}
if (!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
showmessage('replyperm_login_nopermission', NULL, array(), array('login' => 1));
}
if (empty($thread)) {
showmessage('thread_nonexistence');
} elseif ($thread['price'] > 0 && $thread['special'] == 0 && !$_G['uid']) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
checklowerlimit('reply', 0, 1, $_G['forum']['fid']);
if ($_G['setting']['commentnumber'] && !empty($_GET['comment'])) {
示例7: rssforumperm
function rssforumperm($forum)
{
$is_allowed = $forum['type'] != 'group' && (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm'], 7));
return $is_allowed;
}
示例8: tasklist
function tasklist($item)
{
global $_G;
$multipage = '';
$page = max(1, intval($_GET['page']));
$start_limit = ($page - 1) * $_G['tpp'];
$tasklist = $endtaskids = $magicids = $medalids = $groupids = array();
$updated = FALSE;
$num = 0;
foreach (C::t('common_task')->fetch_all_by_status($_G['uid'], $item) as $task) {
if ($item == 'new' || $item == 'canapply') {
list($task['allowapply'], $task['t']) = $this->checknextperiod($task);
if ($task['allowapply'] < 0) {
continue;
}
$task['noperm'] = $task['applyperm'] && $task['applyperm'] != 'all' && !($task['applyperm'] == 'member' && $_G['adminid'] == '0' || $task['applyperm'] == 'admin' && $_G['adminid'] > '0' || forumperm($task['applyperm']));
$task['appliesfull'] = $task['tasklimits'] && $task['achievers'] >= $task['tasklimits'];
if ($item == 'canapply' && ($task['noperm'] || $task['appliesfull'])) {
continue;
}
}
$num++;
if ($task['reward'] == 'magic') {
$magicids[] = $task['prize'];
} elseif ($task['reward'] == 'medal') {
$medalids[] = $task['prize'];
} elseif ($task['reward'] == 'invite') {
$invitenum = $task['prize'];
} elseif ($task['reward'] == 'group') {
$groupids[] = $task['prize'];
}
if ($task['available'] == '2' && ($task['starttime'] > TIMESTAMP || $task['endtime'] && $task['endtime'] <= TIMESTAMP)) {
$endtaskids[] = $task['taskid'];
}
$csc = explode("\t", $task['csc']);
$task['csc'] = floatval($csc[0]);
$task['lastupdate'] = intval($csc[1]);
if (!$updated && $item == 'doing' && $task['csc'] < 100) {
$updated = TRUE;
$escript = explode(':', $task['scriptname']);
if (count($escript) > 1) {
include_once DISCUZ_ROOT . './source/plugin/' . $escript[0] . '/task/task_' . $escript[1] . '.php';
$taskclassname = 'task_' . $escript[1];
} else {
require_once libfile('task/' . $task['scriptname'], 'class');
$taskclassname = 'task_' . $task['scriptname'];
}
$taskclass = new $taskclassname();
$task['applytime'] = $task['dateline'];
if (method_exists($taskclass, 'csc')) {
$result = $taskclass->csc($task);
} else {
showmessage('task_not_found', '', array('taskclassname' => $taskclassname));
}
if ($result === TRUE) {
$task['csc'] = '100';
C::t('common_mytask')->update($_G['uid'], $task['taskid'], array('csc' => $task['csc']));
} elseif ($result === FALSE) {
C::t('common_mytask')->update($_G['uid'], $task['taskid'], array('status' => -1));
} else {
$task['csc'] = floatval($result['csc']);
C::t('common_mytask')->update($_G['uid'], $task['taskid'], array('csc' => $task['csc'] . "\t" . $_G['timestamp']));
}
}
if (in_array($item, array('done', 'failed')) && $task['period']) {
list($task['allowapply'], $task['t']) = $this->checknextperiod($task);
$task['allowapply'] = $task['allowapply'] > 0 ? 1 : 0;
}
$task['icon'] = $task['icon'] ? $task['icon'] : 'task.gif';
if (strtolower(substr($task['icon'], 0, 7)) != 'http://') {
$escript = explode(':', $task['scriptname']);
if (count($escript) > 1 && file_exists(DISCUZ_ROOT . './source/plugin/' . $escript[0] . '/task/task_' . $escript[1] . '.gif')) {
$task['icon'] = 'source/plugin/' . $escript[0] . '/task/task_' . $escript[1] . '.gif';
} else {
$task['icon'] = 'static/image/task/' . $task['icon'];
}
}
$task['dateline'] = $task['dateline'] ? dgmdate($task['dateline'], 'u') : '';
$tasklist[] = $task;
}
if ($magicids) {
foreach (C::t('common_magic')->fetch_all($magicids) as $magic) {
$this->listdata[$magic['magicid']] = $magic['name'];
}
}
if ($medalids) {
foreach (C::t('forum_medal')->fetch_all($medalids) as $medal) {
$this->listdata[$medal['medalid']] = $medal['name'];
}
}
if ($groupids) {
foreach (C::t('common_usergroup')->fetch_all($groupids) as $group) {
$this->listdata[$group['groupid']] = $group['grouptitle'];
}
}
if ($invitenum) {
$this->listdata[$invitenum] = $_G['lang']['invite_code'];
}
if ($endtaskids) {
}
//.........这里部分代码省略.........
示例9: foreach
$bi = 1;
foreach ($feeds['data'] as $k => $feed) {
$trans['{addbuddy}'] = $feed['uid'] != $discuz_uid ? '<a href="my.php?item=buddylist&newbuddyid=' . $feed['uid'] . '&buddysubmit=yes" id="ajax_buddy_' . $bi++ . '" onclick="ajaxmenu(this, 3000);doane(event);"><img style="vertical-align:middle" src="manyou/images/myadd.gif" /></a>' : '';
$feeds['data'][$k]['title'] = strtr($feed['title'], $trans);
$feeds['data'][$k]['body'] = strtr($feed['body'], $trans);
$feeds['data'][$k]['title'] = preg_replace("/<a(.+?)href=([\\'\"]?)([^>\\s]+)\\2([^>]*)>/i", '<a target="_blank" \\1 href="\\3&from=indexfeeds" \\4>', $feeds['data'][$k]['title']);
$feeds['data'][$k]['body'] = preg_replace("/<a(.+?)href=([\\'\"]?)([^>\\s]+)\\2([^>]*)>/i", '<a target="_blank" \\1 href="\\3&from=indexfeeds" \\4>', $feeds['data'][$k]['body']);
list($feeds['data'][$k]['body'], $feeds['data'][$k]['general']) = explode(chr(0) . chr(0) . chr(0), $feeds['data'][$k]['body']);
$feeds['data'][$k]['icon_image'] = 'http://appicon.manyou.com/icons/' . $feed['appid'];
$dateline = $feed['dbdateline'] + $timeoffset * 3600;
$feeds['data'][$k]['date'] = gmdate($dateformat, $dateline);
if ($feeddate != $feeds['data'][$k]['date']) {
$feeds['data'][$k]['daterange'] = $feeds['data'][$k]['date'];
} else {
$feeds['data'][$k]['daterange'] = '';
}
$feeddate = $feeds['data'][$k]['date'];
}
}
$multi = $feeds['multipage'];
$feeds = $feeds['data'];
$sql = !empty($accessmasks) ? "SELECT f.threads, f.posts, f.todayposts, ff.viewperm, a.allowview FROM {$tablepre}forums f\r\n\t\tLEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid\r\n\t\tLEFT JOIN {$tablepre}access a ON a.uid='{$discuz_uid}' AND a.fid=f.fid\r\n\t\tWHERE f.status='1' ORDER BY f.type, f.displayorder" : "SELECT f.threads, f.posts, f.todayposts, ff.viewperm FROM {$tablepre}forums f\r\n\t\tLEFT JOIN {$tablepre}forumfields ff USING(fid)\r\n\t\tWHERE f.status='1' ORDER BY f.type, f.displayorder";
$query = $db->query($sql);
while ($forumdata = $db->fetch_array($query)) {
if (!$forumdata['viewperm'] || $forumdata['viewperm'] && forumperm($forumdata['viewperm']) || !empty($forumdata['allowview'])) {
$threads += $forumdata['threads'];
$posts += $forumdata['posts'];
$todayposts += $forumdata['todayposts'];
}
}
include template('discuz_feeds');
示例10: array_merge
}
$discuz_action = 12;
if ($special == 5) {
$debate = array_merge($thread, $db->fetch_first("SELECT * FROM {$tablepre}debates WHERE tid='{$tid}'"));
$standquery = $db->query("SELECT stand FROM {$tablepre}debateposts WHERE tid='{$tid}' AND uid='{$discuz_uid}' AND stand<>'0' ORDER BY dateline LIMIT 1");
$firststand = $db->result_first("SELECT stand FROM {$tablepre}debateposts WHERE tid='{$tid}' AND uid='{$discuz_uid}' AND stand<>'0' ORDER BY dateline LIMIT 1");
if ($debate['endtime'] && $debate['endtime'] < $timestamp) {
showmessage('debate_end');
}
}
if (!$discuz_uid && !(!$forum['replyperm'] && $allowreply || $forum['replyperm'] && forumperm($forum['replyperm']))) {
showmessage('replyperm_login_nopermission', NULL, 'NOPERM');
} elseif (empty($forum['allowreply'])) {
if (!$forum['replyperm'] && !$allowreply) {
showmessage('replyperm_none_nopermission', NULL, 'NOPERM');
} elseif ($forum['replyperm'] && !forumperm($forum['replyperm'])) {
showmessagenoperm('replyperm', $forum['fid']);
}
} elseif ($forum['allowreply'] == -1) {
showmessage('post_forum_newreply_nopermission', NULL, 'HALTED');
}
if (empty($thread)) {
showmessage('thread_nonexistence');
} elseif ($thread['price'] > 0 && $thread['special'] == 0 && !$discuz_uid) {
showmessage('group_nopermission', NULL, 'NOPERM');
}
checklowerlimit($replycredits);
if ($special == 127) {
$postinfo = $db->fetch_first("SELECT message FROM {$tablepre}posts WHERE tid='{$tid}' AND first='1'");
$sppos = strrpos($postinfo['message'], chr(0) . chr(0) . chr(0));
$specialextra = substr($postinfo['message'], $sppos + 3);
示例11: common
function common()
{
global $_G;
loadcache('mobile_pnewpic');
loadcache('forums');
$maxnum = 50000;
$maxtid = C::t('forum_thread')->fetch_max_tid();
$limittid = max(0, $maxtid - $maxnum);
$this->page = intval($_GET['page']) ? intval($_GET['page']) : 1;
$start = ($this->page - 1) * $this->perpage;
$num = $this->perpage;
if ($_G['cache']['mobile_pnewpic'] && TIMESTAMP - $_G['cache']['mobile_pnewpic']['cachetime'] < 900) {
$tids = array_slice($_G['cache']['mobile_pnewpic']['data'], $start, $num);
if (empty($tids)) {
return;
}
} else {
$tids = array();
}
$tsql = $addsql = '';
$updatecache = false;
$fids = array();
if ($_G['setting']['followforumid']) {
$addsql .= ' AND ' . DB::field('fid', $_G['setting']['followforumid'], '<>');
}
if ($tids) {
$tids = dintval($tids, true);
$tidsql = DB::field('tid', $tids);
} else {
$tidsql = 'tid>' . intval($limittid);
$addsql .= ' AND attachment=2 AND displayorder>=0 ORDER BY tid DESC LIMIT 600';
$tids = array();
foreach ($_G['cache']['forums'] as $fid => $forum) {
if ($forum['type'] != 'group' && $forum['status'] > 0 && (!$forum['viewperm'] && $_G['group']['readaccess']) || $forum['viewperm'] && forumperm($forum['viewperm'])) {
$fids[] = $fid;
}
}
if (empty($fids)) {
return;
}
$updatecache = true;
}
$list = $threadids = array();
$n = 0;
$query = DB::query("SELECT * FROM " . DB::table('forum_thread') . " WHERE " . $tidsql . $addsql);
while ($thread = DB::fetch($query)) {
if (empty($tids) && ($thread['isgroup'] || !in_array($thread['fid'], $fids))) {
continue;
}
if ($thread['displayorder'] < 0) {
continue;
}
$threadids[] = $thread['tid'];
if ($tids || $n >= $start && $n < $start + $num) {
$list[$thread['tid']] = $thread;
}
$n++;
}
$threadlist = array();
if ($tids) {
foreach ($tids as $key => $tid) {
if ($list[$tid]) {
$threadlist[$tid] = $list[$tid];
}
}
} else {
$threadlist = $list;
}
unset($list);
$images = array();
if ($threadlist) {
$query = DB::query("SELECT * FROM " . DB::table('forum_threadimage') . " WHERE " . DB::field('tid', array_keys($threadlist)));
while ($image = DB::fetch($query)) {
if ($image['remote']) {
$img = $_G['setting']['ftp']['attachurl'] . 'forum/' . $image['attachment'];
} else {
$img = $_G['setting']['attachurl'] . 'forum/' . $image['attachment'];
}
$images[$image['tid']] = $img;
}
}
if ($updatecache) {
$data = array('cachetime' => TIMESTAMP, 'data' => $threadids);
$_G['cache']['mobile_pnewpic'] = $data;
savecache('mobile_pnewpic', $_G['cache']['mobile_pnewpic']);
}
foreach ($threadlist as $thread) {
$this->field('author', '0', $thread['author']);
$this->field('dateline', '0', $thread['dateline']);
$this->field('replies', '1', $thread['replies']);
$this->field('views', '2', $thread['views']);
$this->id = $thread['tid'];
$this->title = $thread['subject'];
$this->image = $images[$thread['tid']] ? $images[$thread['tid']] : STATICURL . 'image/common/nophoto.gif';
$this->icon = '1';
$this->poptype = '0';
$this->popvalue = '';
$this->clicktype = 'tid';
$this->clickvalue = $thread['tid'];
$this->insertrow();
//.........这里部分代码省略.........
示例12: showmessage
showmessage('post_subject_toolong');
}
$query = $db->query("UPDATE {$tablepre}threads SET subject='{$subjectnew}' WHERE tid='{$tid}'");
$query = $db->query("UPDATE {$tablepre}posts SET subject='{$subjectnew}' WHERE tid='{$tid}' AND first='1'");
showmessage('<a href="viewthread.php?tid=' . $tid . '">' . stripslashes($subjectnew) . '</a>');
}
} elseif ($action == 'editmessage') {
$orig = $db->fetch_first("SELECT m.adminid, p.first, p.authorid, p.author, p.dateline, p.anonymous, p.invisible, p.message FROM {$tablepre}posts p\r\n\t\tLEFT JOIN {$tablepre}members m ON m.uid=p.authorid\r\n\t\tWHERE p.pid='{$pid}' AND p.invisible > -1");
if (empty($orig)) {
showmessage('post_check', NULL, 'AJAXERROR');
}
periodscheck('postbanperiods');
if (empty($forum['allowview'])) {
if (!$forum['viewperm'] && !$readaccess) {
showmessage('group_nopermission', NULL, 'NOPERM');
} elseif ($forum['viewperm'] && !forumperm($forum['viewperm'])) {
showmessage('forum_nopermission', NULL, 'NOPERM');
}
}
if (!$forum['ismoderator'] || !$alloweditpost || in_array($orig['adminid'], array(1, 2, 3)) && $adminid > $orig['adminid']) {
showmessage('post_edit_nopermission', NULL, 'HALTED');
}
if (!submitcheck('editmessagesubmit', 1)) {
include template('modcp_editpost');
exit;
} else {
require_once DISCUZ_ROOT . './include/discuzcode.func.php';
if ($do == 'notupdate') {
$message = $orig['message'];
$message = discuzcode($message, 0, 0, 0, $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'] && $showimages ? 1 : 0, $forum['allowhtml'], 0, 0, $orig['authorid']);
showmessage(stripslashes($message));
示例13: foreach
foreach ($oldtids as $oldtid) {
$oldtid && ($oldtidsnew[] = $oldtid);
}
if ($oldtidsnew) {
$query = DB::query("SELECT tid, subject FROM " . DB::table('forum_thread') . " WHERE tid IN (" . dimplode($oldtidsnew) . ")");
while ($oldthread = DB::fetch($query)) {
$oldthreads[$oldthread['tid']] = $oldthread['subject'];
}
}
}
$_G['group']['allowpost'] = !$_G['forum']['postperm'] && $_G['group']['allowpost'] || $_G['forum']['postperm'] && forumperm($_G['forum']['postperm']) || isset($_G['forum']['allowpost']) && $_G['forum']['allowpost'] == 1 && $_G['group']['allowpost'];
$fastpost = $_G['setting']['fastpost'] && $_G['group']['allowpost'] && !$_G['forum']['allowspecialonly'] && !$_G['forum']['threadsorts']['required'];
$fastpost = $fastpost && !$_G['forum']['allowspecialonly'];
$_G['group']['allowpost'] = isset($_G['forum']['allowpost']) && $_G['forum']['allowpost'] == -1 ? false : $_G['group']['allowpost'];
$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$allowpostattach = $fastpost && ($_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || !$_G['forum']['postattachperm'] && $_G['group']['allowpostattach'] || $_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])));
if ($fastpost) {
if (!$_G['adminid'] && (!cknewuser(1) || $_G['setting']['newbiespan'] && (!getuserprofile('lastpost') || TIMESTAMP - getuserprofile('lastpost') < $_G['setting']['newbiespan'] * 60) && TIMESTAMP - $_G['member']['regdate'] < $_G['setting']['newbiespan'] * 60)) {
$fastpost = false;
}
$usesigcheck = $_G['uid'] && $_G['group']['maxsigsize'];
$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']);
}
$showpoll = $showtrade = $showreward = $showactivity = $showdebate = 0;
if ($_G['forum']['allowpostspecial']) {
$showpoll = $_G['forum']['allowpostspecial'] & 1;
$showtrade = $_G['forum']['allowpostspecial'] & 2;
$showreward = isset($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]) && $_G['forum']['allowpostspecial'] & 4;
$showactivity = $_G['forum']['allowpostspecial'] & 8;
$showdebate = $_G['forum']['allowpostspecial'] & 16;
示例14: periodscheck
if ($_G['group']['allowsearch'] & 32 && $srchtype == 'fulltext') {
periodscheck('searchbanperiods');
} elseif ($srchtype != 'title') {
$srchtype = 'title';
}
$forumsarray = array();
if (!empty($srchfid)) {
foreach (is_array($srchfid) ? $srchfid : explode('_', $srchfid) as $forum) {
if ($forum = intval(trim($forum))) {
$forumsarray[] = $forum;
}
}
}
$fids = $comma = '';
foreach ($_G['cache']['forums'] as $fid => $forum) {
if ($forum['type'] != 'group' && (!$forum['viewperm'] && $_G['group']['readaccess']) || $forum['viewperm'] && forumperm($forum['viewperm'])) {
if (!$forumsarray || in_array($fid, $forumsarray)) {
$fids .= "{$comma}'{$fid}'";
$comma = ',';
}
}
}
if ($_G['setting']['threadplugins'] && $specialplugin) {
$specialpluginstr = implode("','", $specialplugin);
$special[] = 127;
} else {
$specialpluginstr = '';
}
$special = $_G['gp_special'];
$specials = $special ? implode(',', $special) : '';
$srchfilter = in_array($_G['gp_srchfilter'], array('all', 'digest', 'top')) ? $_G['gp_srchfilter'] : 'all';
示例15: getvariable
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;
}