本文整理汇总了PHP中forum函数的典型用法代码示例。如果您正苦于以下问题:PHP forum函数的具体用法?PHP forum怎么用?PHP forum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: USING
$gquery = $db->query("SELECT f.fid, f.fup, f.type, f.name, ff.moderators, ff.extra FROM {$tablepre}forums f LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid WHERE f.fid='{$gid}'");
$sql = $accessmasks ? "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, f.inheritedmod, ff.description, ff.moderators, ff.icon, ff.viewperm, ff.extra, a.allowview FROM {$tablepre}forums f\r\n\t\t\t\tLEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid\r\n\t\t\t\tLEFT JOIN {$tablepre}access a ON a.uid='{$discuz_uid}' AND a.fid=f.fid\r\n\t\t\t\tWHERE f.fup='{$gid}' AND f.status='1' AND f.type='forum' ORDER BY f.displayorder" : "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, f.inheritedmod, ff.description, ff.moderators, ff.icon, ff.viewperm, ff.extra FROM {$tablepre}forums f\r\n\t\t\t\tLEFT JOIN {$tablepre}forumfields ff USING(fid)\r\n\t\t\t\tWHERE f.fup='{$gid}' AND f.status='1' AND f.type='forum' ORDER BY f.displayorder";
$query = $db->query($sql);
if (!$db->num_rows($gquery) || !$db->num_rows($query)) {
showmessage('forum_nonexistence', NULL, 'HALTED');
}
while (($forum = $db->fetch_array($gquery)) || ($forum = $db->fetch_array($query))) {
$forum['extra'] = unserialize($forum['extra']);
if (!is_array($forum['extra'])) {
$forum['extra'] = array();
}
if ($forum['type'] != 'group') {
$threads += $forum['threads'];
$posts += $forum['posts'];
$todayposts += $forum['todayposts'];
if (forum($forum)) {
$forum['orderid'] = $catlist[$forum['fup']]['forumscount']++;
$forum['subforums'] = '';
$forumlist[$forum['fid']] = $forum;
$catlist[$forum['fup']]['forums'][] = $forum['fid'];
$fids .= ',' . $forum['fid'];
}
} else {
$forum['collapseimg'] = 'collapsed_no.gif';
$collapse['category_' . $forum['fid']] = '';
if ($forum['moderators']) {
$forum['moderators'] = moddisplay($forum['moderators'], 'flat');
}
$forum['forumscount'] = 0;
$forum['forumcolumns'] = 0;
$catlist[$forum['fid']] = $forum;
示例2: forum_display
public function forum_display($fid, $topicInstance)
{
if (!file_exists('../../data/attachment/appbyme')) {
$url = file_exists('../manage/App.xml') ? join("", file('../manage/App.xml')) : array();
} else {
$url = file_exists('../../data/attachment/appbyme/App.xml') ? join("", file('../../data/attachment/appbyme/App.xml')) : array();
}
$result = $topicInstance->xml_to_array($url);
if (empty($result['board']['fid'])) {
$gid = intval(getgpc('gid'));
$catlist = $forumlist = $sublist = $forumname = $collapse = $favforumlist = array();
if (!$gid) {
$forums = C::t('forum_forum')->fetch_all_by_status(1);
$fids = array();
foreach ($forums as $forum) {
$fids[$forum['fid']] = $forum['fid'];
}
$forum_access = array();
if (!empty($_G['member']['accessmasks'])) {
$forum_access = C::t('forum_access')->fetch_all_by_fid_uid($fids, $_G['uid']);
}
$forum_fields = C::t('forum_forumfield')->fetch_all($fids);
foreach ($forums as $forum) {
if ($forum_fields[$forum['fid']]['fid']) {
$forum = array_merge($forum, $forum_fields[$forum['fid']]);
}
if ($forum_access['fid']) {
$forum = array_merge($forum, $forum_access[$forum['fid']]);
}
$forumname[$forum['fid']] = strip_tags($forum['name']);
$forum['extra'] = empty($forum['extra']) ? array() : dunserialize($forum['extra']);
if (!is_array($forum['extra'])) {
$forum['extra'] = array();
}
if ($forum['type'] != 'group') {
$threads += $forum['threads'];
$posts += $forum['posts'];
$todayposts += $forum['todayposts'];
if ($forum['type'] == 'forum' && isset($catlist[$forum['fup']])) {
if (forum($forum)) {
$catlist[$forum['fup']]['forums'][] = $forum['fid'];
$forum['orderid'] = $catlist[$forum['fup']]['forumscount']++;
$forum['subforums'] = '';
$forumlist[$forum['fid']] = $forum;
}
} elseif (isset($forumlist[$forum['fup']])) {
$forumlist[$forum['fup']]['threads'] += $forum['threads'];
$forumlist[$forum['fup']]['posts'] += $forum['posts'];
$forumlist[$forum['fup']]['todayposts'] += $forum['todayposts'];
if ($_G['setting']['subforumsindex'] && $forumlist[$forum['fup']]['permission'] == 2 && !($forumlist[$forum['fup']]['simple'] & 16) || $forumlist[$forum['fup']]['simple'] & 8) {
$forumurl = !empty($forum['domain']) && !empty($_G['setting']['domain']['root']['forum']) ? 'http://' . $forum['domain'] . '.' . $_G['setting']['domain']['root']['forum'] : 'forum.php?mod=forumdisplay&fid=' . $forum['fid'];
$forumlist[$forum['fup']]['subforums'] .= (empty($forumlist[$forum['fup']]['subforums']) ? '' : ', ') . '<a href="' . $forumurl . '" ' . (!empty($forum['extra']['namecolor']) ? ' style="color: ' . $forum['extra']['namecolor'] . ';"' : '') . '>' . $forum['name'] . '</a>';
}
}
} else {
if ($forum['moderators']) {
$forum['moderators'] = moddisplay($forum['moderators'], 'flat');
}
$forum['forumscount'] = 0;
$catlist[$forum['fid']] = $forum;
}
}
} else {
$gquery = C::t('forum_forum')->fetch_all_info_by_fids($gid);
$query = C::t('forum_forum')->fetch_all_info_by_fids(0, 1, 0, $gid, 1, 0, 0, 'forum');
if (!empty($_G['member']['accessmasks'])) {
$fids = array_keys($query);
$accesslist = C::t('forum_access')->fetch_all_by_fid_uid($fids, $_G['uid']);
foreach ($query as $key => $val) {
$query[$key]['allowview'] = $accesslist[$key];
}
}
$query = array_merge($gquery, $query);
$fids = array();
foreach ($query as $forum) {
$forum['extra'] = dunserialize($forum['extra']);
if (!is_array($forum['extra'])) {
$forum['extra'] = array();
}
if ($forum['type'] != 'group') {
$threads += $forum['threads'];
$posts += $forum['posts'];
$todayposts += $forum['todayposts'];
if (forum($forum)) {
$forum['orderid'] = $catlist[$forum['fup']]['forumscount']++;
$forum['subforums'] = '';
$forumlist[$forum['fid']] = $forum;
$catlist[$forum['fup']]['forums'][] = $forum['fid'];
$fids[] = $forum['fid'];
}
} else {
$forum['collapseimg'] = 'collapsed_no.gif';
$collapse['category_' . $forum['fid']] = '';
if ($forum['moderators']) {
$forum['moderators'] = moddisplay($forum['moderators'], 'flat');
}
$catlist[$forum['fid']] = $forum;
$navigation = '<em>›</em> ' . $forum['name'];
$navtitle_g = strip_tags($forum['name']);
}
//.........这里部分代码省略.........
示例3: unserialize
$forum['typemodels'] = $forum['typemodels'] ? unserialize($forum['typemodels']) : array();
$moderatedby = moddisplay($forum['moderators'], 'forumdisplay');
$highlight = empty($highlight) ? '' : htmlspecialchars($highlight);
if ($forum['autoclose']) {
$closedby = $forum['autoclose'] > 0 ? 'dateline' : 'lastpost';
$forum['autoclose'] = abs($forum['autoclose']) * 86400;
}
$subexists = 0;
foreach ($_DCACHE['forums'] as $sub) {
if ($sub['type'] == 'sub' && $sub['fup'] == $fid && (!$hideprivate || !$sub['viewperm'] || forumperm($sub['viewperm']) || strstr($sub['users'], "\t{$discuz_uid}\t"))) {
$subexists = 1;
$sublist = array();
$sql = $accessmasks ? "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, ff.description, ff.moderators, ff.icon, ff.viewperm, a.allowview FROM {$tablepre}forums f\r\n\t\t\t\t\t\tLEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid\r\n\t\t\t\t\t\tLEFT JOIN {$tablepre}access a ON a.uid='{$discuz_uid}' AND a.fid=f.fid\r\n\t\t\t\t\t\tWHERE fup='{$fid}' AND status>0 AND type='sub' ORDER BY f.displayorder" : "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, ff.description, ff.moderators, ff.icon, ff.viewperm FROM {$tablepre}forums f\r\n\t\t\t\t\t\tLEFT JOIN {$tablepre}forumfields ff USING(fid)\r\n\t\t\t\t\t\tWHERE f.fup='{$fid}' AND f.status>0 AND f.type='sub' ORDER BY f.displayorder";
$query = $db->query($sql);
while ($sub = $db->fetch_array($query)) {
if (forum($sub)) {
$sub['orderid'] = count($sublist);
$sublist[] = $sub;
}
}
break;
}
}
if ($subexists) {
if ($forum['forumcolumns']) {
$forum['forumcolwidth'] = floor(100 / $forum['forumcolumns']) . '%';
$forum['subscount'] = count($sublist);
$forum['endrows'] = '';
if ($colspan = $forum['subscount'] % $forum['forumcolumns']) {
while ($forum['forumcolumns'] - $colspan > 0) {
$forum['endrows'] .= '<td> </td>';
示例4: getResult
protected function getResult($params)
{
extract($params);
$res = $this->initWebApiArray();
if ($page == 1) {
$res['piclist'] = $this->_getPicList($mid);
} else {
$res['piclist'] = array();
}
$portals = AppbymePortalModuleSource::getPortalByMid($mid);
$handCount = $this->_handCount($mid, $portals);
$autoAdd = AppbymePortalModuleSource::getAutoAdd($mid);
$params = unserialize(AppbymePoralModule::getModuleParam($mid));
$params == false && ($params = array());
// 对错误mid的处理
if (empty($portals)) {
$res['list'] = array();
return $res;
}
$count = 0;
// 自动添加的数目
if (!empty($autoAdd)) {
if ($autoAdd[0]['idtype'] == 'fid') {
// [add]板块设置用户组权限后,针对当前用户进行过滤(在列表中是否显示)Author:HanPengyu,Data:14.11.28
require_once libfile('function/forumlist');
foreach ($autoAdd as $auto) {
$forum = DzForumForum::getForumFieldByFid($auto['id']);
forum($forum) && ($fids[] = $auto['id']);
}
$count = DzForumThread::getByFidCount($fids, $params, $longitude, $latitude, $radius);
// Mobcent::dumpSql();
} else {
foreach ($autoAdd as $auto) {
$catids[] = $auto['id'];
}
$count = DzPortalArticle::getByCatidCount($catids, $params);
}
}
$total = $handCount + $count;
// 没有查到数据
if ($total == 0) {
$res['list'] = array();
return $res;
}
$pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $total);
$res = array_merge($res, $pageInfo);
$offset = ($page - 1) * $pageSize;
if ($page == 1) {
if ($handCount <= self::HANDPAGE) {
$autoData = array();
$handData = $handCount != 0 && ($page = 1) ? $this->_handData($mid, $offset, $handCount, $params) : array();
$pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $handCount, $handCount);
$res = array_merge($res, $pageInfo);
if ($count != 0) {
if ($autoAdd[0]['idtype'] == 'fid') {
$autoData = $this->_autoFidData($fids, $offset, $pageSize, $params, $longitude, $latitude, $radius);
} else {
$autoData = $this->_autoCatidData($catids, $offset, $pageSize, $params);
}
$total = $count != 0 ? $count + $handCount : $handCount;
$pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $total);
$res = array_merge($res, $pageInfo);
}
$rows = array_merge((array) $handData, (array) $autoData);
$res['list'] = $rows;
return $res;
}
$total = $count != 0 ? $count + $handCount : $handCount;
$pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $handCount, $total);
$res = array_merge($res, $pageInfo);
$res['list'] = $this->_handData($mid, $offset, $handCount);
return $res;
}
$page = $handCount <= self::HANDPAGE ? $page : $page - 1;
$offset = ($page - 1) * $pageSize;
if ($count != 0) {
if ($autoAdd[0]['idtype'] == 'fid') {
$autoData = $this->_autoFidData($fids, $offset, $pageSize, $params, $longitude, $latitude, $radius);
} else {
$autoData = $this->_autoCatidData($catids, $offset, $pageSize, $params);
}
$pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $count);
$res = array_merge($res, $pageInfo);
$res['list'] = $autoData;
} else {
$pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $handCount, $handCount);
$res = array_merge($res, $pageInfo);
$res['list'] = array();
}
return $res;
}
示例5: switch
switch ($section) {
case "databases":
require_once "admin/admin_databases_lib.php";
database();
break;
case "servers":
require_once "admin/admin_servers_lib.php";
servers();
break;
case "menus":
require_once "admin/admin_menus_lib.php";
menus();
break;
case "forum":
require_once "admin/admin_forum_lib.php";
forum();
break;
case "accounts":
require_once "admin/admin_accounts_lib.php";
accounts();
break;
case "pointsystem":
require_once "admin/admin_pointsystem_lib.php";
pointsystem();
break;
default:
require_once "admin/admin_general_lib.php";
general();
break;
}
require_once "admin/footer.php";
示例6: USING
"SELECT f.fid, f.name, f.fup, f.type, ff.viewperm, a.allowview FROM {$tablepre}forums f
LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid
LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
WHERE f.status='1' AND f.type='forum' ORDER BY f.displayorder"
: "SELECT f.fid, f.name, f.fup, f.type, ff.viewperm FROM {$tablepre}forums f
LEFT JOIN {$tablepre}forumfields ff USING(fid)
WHERE f.status='1' AND f.type='forum' ORDER BY f.type, f.displayorder";
$query = $sdb->query($sql);
$forumlist = array();
while($forum = $sdb->fetch_array($query)) {
$forumlist[] = $forum;
}
foreach($forumlist as $forum) {
if(forum($forum) && (!$forum['viewperm'] || (strexists("\t".trim($forum['viewperm'])."\t", "\t".trim($groupid)."\t") && $forum['viewperm']))) {
echo "<a href=\"index.php?action=forum&fid=$forum[fid]\">".strip_tags($forum['name'])."</a><br/>";
}
if($forumnum ++ >= 10) {
break;
}
}
echo ($forumnum > 10 ? "<a href=\"index.php?action=forum\">$lang[more]</a><br /><br />" : '').
"$lang[home_tools]<br />".
"<a href=\"index.php?action=stats\">$lang[stats]</a><br />".
"<a href=\"index.php?action=goto\">$lang[goto]</a>".
(!empty($allowsearch) ? "<br /><br /><input type=\"text\" name=\"srchtxt\" value=\"\" size=\"8\" emptyok=\"true\" /> ".
"<anchor title=\"submit\">$lang[search]\n".
"<go method=\"post\" href=\"index.php?action=search&do=submit\" />\n".
"<postfield name=\"srchtxt\" value=\"$(srchtxt)\" /></anchor>" : '');
示例7: forumDispatch
function forumDispatch($op)
{
require_once _base_ . '/lib/lib.urlmanager.php';
$url_man =& UrlManager::getInstance('forum');
$url_man->setStdQuery('index.php?modname=forum&op=forum');
switch ($op) {
case "forum":
forum();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "addforum":
addforum();
break;
case "insforum":
insforum();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "modforum":
modforum();
break;
case "upforum":
upforum();
break;
case "downforum":
moveforum($_GET['idForum'], 'down');
break;
case "moveupforum":
moveforum($_GET['idForum'], 'up');
break;
case "modstatus":
changestatus();
break;
case "export":
export();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "delforum":
delforum();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "modforumaccess":
modforumaccess();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "thread":
thread();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "addthread":
addthread();
break;
case "insthread":
insthread();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "modthread":
modthread();
break;
case "movethread":
$id_thread = importVar('id_thread', true, 0);
$id_forum = importVar('id_forum', true, 0);
moveThread($id_thread, $id_forum);
break;
case "upthread":
upthread();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "delthread":
delthread();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "message":
message();
break;
case "moderatemessage":
moderatemessage();
break;
case "modstatusthread":
modstatusthread();
break;
case "changeerased":
changeerase();
break;
//-----------------------------------------------//
//-----------------------------------------------//
case "addmessage":
addmessage();
break;
case "insmessage":
insmessage();
break;
//.........这里部分代码省略.........
示例8: forum
function forum($parent)
{
$result = dbquery("SELECT forum_id, forum_cat, forum_name, forum_description, forum_parent, forum_order FROM " . DB_FORUMS . " WHERE forum_parent='{$parent}' ORDER BY forum_order asc");
$forumR = "";
if (dbrows($result)) {
$k = 1;
while ($data = dbarray($result)) {
$forumR .= forum_parent($data, $result, $k);
$k++;
$forumR .= forum($data['forum_id']);
}
}
return $forumR;
}
示例9: _getForumInfo
private function _getForumInfo($forum)
{
$fid = (int) $forum['fid'];
$forum = array_merge($forum, DzForumForum::getForumFieldByFid($fid));
$dateline = $this->_getDateLine($forum);
// 判断该版块是否有权限访问
if (!forum($forum)) {
return array();
}
$matches = array();
preg_match('/<img src="(.+?)"/', $forum['icon'], $matches);
$image = !empty($matches[1]) ? $matches[1] : '';
// $dateline = '0';
// if (is_array($forum['lastpost'])) {
// $matches = array();
// preg_match('/<span title="(.+?)"/', $forum['lastpost']['dateline'], $matches);
// $dateline = !empty($matches[1]) ? $matches[1] : $forum['lastpost']['dateline'];
// $dateline = strtotime($dateline);
// $dateline !== false or $dateline = '0';
// }
$forumSubList = ForumUtils::getForumSubList($fid);
$forumInfo = array();
$forumInfo['board_id'] = (int) $fid;
$forumInfo['board_name'] = WebUtils::emptyHtml($forum['name']);
$forumInfo['description'] = (string) WebUtils::emptyHtml($forum['description']);
$forumInfo['board_child'] = count($forumSubList) > 0 ? 1 : 0;
$forumInfo['board_img'] = WebUtils::getHttpFileName($image);
$forumInfo['last_posts_date'] = !empty($dateline) ? $dateline . '000' : '';
$forumInfo['board_content'] = $forum['threads'] != 0 && !($forum['simple'] & 1) ? 1 : 0;
$forumInfo['forumRedirect'] = $forum['redirect'];
$todayPosts = (int) $forum['todayposts'];
$threads = (int) $forum['threads'];
$posts = (int) $forum['posts'];
foreach ($forumSubList as $value) {
$todayPosts += $value['todayposts'];
$threads += $value['threads'];
$posts += $value['posts'];
}
$forumInfo['td_posts_num'] = $todayPosts;
$forumInfo['topic_total_num'] = $threads;
$forumInfo['posts_total_num'] = $posts;
return $forumInfo;
}
示例10: Header
<!-- Right side column. Contains the navbar and content of the page -->
<aside class="right-side">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php
$nomEntreprise = 'Sodebo';
echo $nomEntreprise;
?>
</h1>
</section>
<!-- Main content -->
<section class="content">
<?php
echo forum();
?>
</section><!-- /.content -->
</aside><!-- /.right-side -->
</div><!-- ./wrapper -->
<!-- add new calendar event modal -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.min.js" type="text/javascript"></script>
<!-- Morris.js charts -->
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="./AdminLTE/js/plugins/morris/morris.min.js" type="text/javascript"></script>
<!-- Sparkline -->