本文整理汇总了PHP中get_forum_list函数的典型用法代码示例。如果您正苦于以下问题:PHP get_forum_list函数的具体用法?PHP get_forum_list怎么用?PHP get_forum_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_forum_list函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: category_read
function category_read()
{
global $admintpl, $language, $STYLEURL, $CURUSER, $STYLEPATH, $btit_settings;
$admintpl->set("language", $language);
$cres = genrelist();
for ($i = 0; $i < count($cres); $i++) {
$cres[$i]["frm_number"] = "form" . $i;
$cres[$i]["name"] = unesc($cres[$i]["name"]);
$cres[$i]["image"] = "<img src=\"{$STYLEURL}/images/categories/" . $cres[$i]["image"] . "\" alt=\"\" border=\"0\" />";
$cres[$i]["smf_select"] = get_forum_list($cres[$i]["forumid"], $cres[$i]["id"]);
}
$admintpl->set("categories", $cres);
unset($cres);
}
开发者ID:Karpec,项目名称:gizd,代码行数:14,代码来源:admin.cats.forum.php
示例2: get_forum_list
function get_forum_list($page = 1)
{
if (!($db = db::get())) {
return false;
}
if (!is_numeric($page)) {
return false;
}
$offset = calculate_page_offset($page, 10);
$forums_array = array();
$sql = "SELECT SQL_CALC_FOUND_ROWS CONCAT(FORUMS.DATABASE_NAME, '`.`', FORUMS.WEBTAG, '_') AS PREFIX, ";
$sql .= "FORUM_SETTINGS_NAME.SVALUE AS FORUM_NAME, FORUM_SETTINGS_DESC.SVALUE AS FORUM_DESC, ";
$sql .= "FORUMS.FID, FORUMS.WEBTAG, FORUMS.ACCESS_LEVEL FROM FORUMS ";
$sql .= "LEFT JOIN FORUM_SETTINGS FORUM_SETTINGS_NAME ON (FORUM_SETTINGS_NAME.FID = FORUMS.FID AND FORUM_SETTINGS_NAME.SNAME = 'forum_name') ";
$sql .= "LEFT JOIN FORUM_SETTINGS FORUM_SETTINGS_DESC ON (FORUM_SETTINGS_DESC.FID = FORUMS.FID AND FORUM_SETTINGS_DESC.SNAME = 'forum_desc') ";
$sql .= "WHERE FORUMS.ACCESS_LEVEL > -1 AND FORUMS.ACCESS_LEVEL < 3 ORDER BY FORUMS.FID LIMIT {$offset}, 10";
if (!($result = $db->query($sql))) {
return false;
}
$sql = "SELECT FOUND_ROWS() AS ROW_COUNT";
if (!($result_count = $db->query($sql))) {
return false;
}
list($forums_count) = $result_count->fetch_row();
if ($result->num_rows == 0 && $forums_count > 0 && $page > 1) {
return get_forum_list($page - 1);
}
while ($forum_data = $result->fetch_assoc()) {
if (!isset($forum_data['FORUM_NAME']) || strlen(trim($forum_data['FORUM_NAME'])) < 1) {
$forum_data['FORUM_NAME'] = "A Beehive Forum";
}
if (!isset($forum_data['FORUM_DESC']) || strlen(trim($forum_data['FORUM_DESC'])) < 1) {
$forum_data['FORUM_DESC'] = "";
}
$sql = "SELECT COUNT(PID) AS POST_COUNT FROM `{$forum_data['PREFIX']}POST` POST ";
if (!($result_post_count = $db->query($sql))) {
return false;
}
$forum_post_data = $result_post_count->fetch_assoc();
if (!isset($forum_post_data['POST_COUNT']) || is_null($forum_post_data['POST_COUNT'])) {
$forum_data['MESSAGES'] = 0;
} else {
$forum_data['MESSAGES'] = $forum_post_data['POST_COUNT'];
}
$forums_array[] = $forum_data;
}
return array('forums_array' => $forums_array, 'forums_count' => $forums_count);
}
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:48,代码来源:myforums.inc.php
示例3: move_down_category
}
if ('exMvDownCat' == $cmd) {
move_down_category($catId);
}
if ('exMvUpForum' == $cmd) {
move_up_forum($forumId);
}
if ('exMvDownForum' == $cmd) {
move_down_forum($forumId);
}
}
//end of admin commands
//load category and forum lists
$categories = get_category_list();
$total_categories = count($categories);
$forum_list = get_forum_list();
if (claro_is_user_authenticated()) {
$userGroupList = get_user_group_list(claro_get_current_user_id());
$userGroupList = array_keys($userGroupList);
$tutorGroupList = get_tutor_group_list(claro_get_current_user_id());
} else {
$userGroupList = array();
$tutorGroupList = array();
}
//add javascript control for "dangerous" commands (delete-empty)
$htmlHeadXtra[] = "<script type=\"text/javascript\">\n function confirm_delete(name)\n {\n if(confirm('" . clean_str_for_javascript(get_lang('Are you sure to delete')) . " ' + name + ' ?'))\n {return true;}\n else\n {return false;}\n }\n \n function confirm_empty(name)\n {\n if(confirm('" . clean_str_for_javascript(get_lang('Delete all messages of')) . " ' + name + ' ?'))\n {return true;}\n else\n {return false;}\n }\n </script>";
//prepare display
$nameTools = get_lang('Forums');
$pagetype = 'index';
$helpUrl = $is_allowedToEdit ? get_help_page_url('blockForumsHelp', 'CLFRM') : null;
$toolList = disp_forum_toolbar_array($pagetype, 0, 0, 0);
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:index.php
示例4: make_forum_drop_down_box
function make_forum_drop_down_box()
{
global $db, $userdata;
$forums_row = get_forum_list();
$forum_list = "<select name=\"forum_top\">";
$forum_list .= "<option value=\"-1\" selected=\"selected\">All</option>";
for ($i = 1; $i < count($forums_row) + 1; $i++) {
if (isset($forums_row[$i]) && $forums_row[$i]['auth_view']) {
$forum_list .= "<option value=\"" . $i . "\">" . strip_tags(id_to_value($i, 'forum')) . "</option>";
}
}
$forum_list .= "</select>";
return $forum_list;
}
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:14,代码来源:functions_rate.php
示例5: main
//.........这里部分代码省略.........
'REPORT_REASON_TITLE' => $reason['title'],
'REPORT_REASON_DESCRIPTION' => $reason['description'],
'REPORT_TEXT' => $report['report_text'],
'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
'REPORTER_FULL' => get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']),
'REPORTER_COLOUR' => get_username_string('colour', $report['user_id'], $report['username'], $report['user_colour']),
'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']),
'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']),
'POST_PREVIEW' => $message,
'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],
'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
'POST_ID' => $post_info['post_id'],
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? $this->u_action . '&r=' . $report_id . '&p=' . $post_id . '&f=' . $forum_id . '&lookup=' . $post_info['poster_ip'] . '#ip' : '',
));
$this->tpl_name = 'mcp_post';
break;
case 'reports':
case 'reports_closed':
$topic_id = request_var('t', 0);
$forum_info = array();
$forum_list_reports = get_forum_list('m_report', false, true);
if ($topic_id && $forum_id)
{
$topic_info = get_topic_data(array($topic_id));
if (!sizeof($topic_info))
{
trigger_error('TOPIC_NOT_EXIST');
}
$topic_info = $topic_info[$topic_id];
$forum_id = $topic_info['forum_id'];
}
else if ($topic_id && !$forum_id)
{
$topic_id = 0;
}
$forum_list = array();
if (!$forum_id)
{
foreach ($forum_list_reports as $row)
{
$forum_list[] = $row['forum_id'];
}
if (!sizeof($forum_list))
{
trigger_error('NOT_MODERATOR');
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:66,代码来源:mcp_reports.php
示例6: mcp_sorting
/**
* sorting in mcp
*
* @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR
*
* $mode reports and reports_closed: the $where parameters uses aliases p for posts table and r for report table
* $mode unapproved_posts: the $where parameters uses aliases p for posts table and t for topic table
*/
function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE')
{
global $db, $user, $auth, $template;
$sort_days = request_var('st', 0);
$min_time = $sort_days ? time() - $sort_days * 86400 : 0;
switch ($mode) {
case 'viewforum':
$type = 'topics';
$default_key = 't';
$default_dir = 'd';
$sql = 'SELECT COUNT(topic_id) AS total
FROM ' . TOPICS_TABLE . "\n\t\t\t\t{$where_sql} forum_id = {$forum_id}\n\t\t\t\t\tAND topic_type NOT IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ")\n\t\t\t\t\tAND topic_last_post_time >= {$min_time}";
if (!$auth->acl_get('m_approve', $forum_id)) {
$sql .= 'AND topic_approved = 1';
}
break;
case 'viewtopic':
$type = 'posts';
$default_key = 't';
$default_dir = 'a';
$sql = 'SELECT COUNT(post_id) AS total
FROM ' . POSTS_TABLE . "\n\t\t\t\t{$where_sql} topic_id = {$topic_id}\n\t\t\t\t\tAND post_time >= {$min_time}";
if (!$auth->acl_get('m_approve', $forum_id)) {
$sql .= 'AND post_approved = 1';
}
break;
case 'unapproved_posts':
$type = 'posts';
$default_key = 't';
$default_dir = 'd';
$where_sql .= $topic_id ? ' p.topic_id = ' . $topic_id . ' AND' : '';
$sql = 'SELECT COUNT(p.post_id) AS total
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t\n\t\t\t\t{$where_sql} " . $db->sql_in_set('p.forum_id', $forum_id ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
AND p.post_approved = 0
AND t.topic_id = p.topic_id
AND t.topic_first_post_id <> p.post_id';
if ($min_time) {
$sql .= ' AND post_time >= ' . $min_time;
}
break;
case 'unapproved_topics':
$type = 'topics';
$default_key = 't';
$default_dir = 'd';
$sql = 'SELECT COUNT(topic_id) AS total
FROM ' . TOPICS_TABLE . "\n\t\t\t\t{$where_sql} " . $db->sql_in_set('forum_id', $forum_id ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
AND topic_approved = 0';
if ($min_time) {
$sql .= ' AND topic_time >= ' . $min_time;
}
break;
case 'pm_reports':
case 'pm_reports_closed':
case 'reports':
case 'reports_closed':
$pm = strpos($mode, 'pm_') === 0 ? true : false;
$type = $pm ? 'pm_reports' : 'reports';
$default_key = 't';
$default_dir = 'd';
$limit_time_sql = $min_time ? "AND r.report_time >= {$min_time}" : '';
if ($topic_id) {
$where_sql .= ' p.topic_id = ' . $topic_id . ' AND ';
} else {
if ($forum_id) {
$where_sql .= ' p.forum_id = ' . $forum_id . ' AND ';
} else {
if (!$pm) {
$where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true) . ' AND ';
}
}
}
if ($mode == 'reports' || $mode == 'pm_reports') {
$where_sql .= ' r.report_closed = 0 AND ';
} else {
$where_sql .= ' r.report_closed = 1 AND ';
}
if ($pm) {
$sql = 'SELECT COUNT(r.report_id) AS total
FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . " p\n\t\t\t\t\t{$where_sql} r.post_id = 0\n\t\t\t\t\t\tAND p.msg_id = r.pm_id\n\t\t\t\t\t\t{$limit_time_sql}";
} else {
$sql = 'SELECT COUNT(r.report_id) AS total
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p\n\t\t\t\t\t{$where_sql} r.pm_id = 0\n\t\t\t\t\tAND p.post_id = r.post_id\n\t\t\t\t\t{$limit_time_sql}";
}
break;
case 'viewlogs':
$type = 'logs';
$default_key = 't';
$default_dir = 'd';
$sql = 'SELECT COUNT(log_id) AS total
FROM ' . LOG_TABLE . "\n\t\t\t\t{$where_sql} " . $db->sql_in_set('forum_id', $forum_id ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_'))) . '
AND log_time >= ' . $min_time . '
AND log_type = ' . LOG_MOD;
//.........这里部分代码省略.........
开发者ID:puring0815,项目名称:OpenKore,代码行数:101,代码来源:mcp.php
示例7: main
function main($id, $mode)
{
global $auth, $db, $user, $template;
global $config, $phpbb_root_path, $phpEx;
$user->add_lang('acp/common');
//-- mod start : Garage ----------------------------------------------------------------------------------------------------
//-- add
$user->add_lang('acp/garage');
//-- mod finish : Garage ---------------------------------------------------------------------------------------------------
$action = request_var('action', array('' => ''));
if (is_array($action)) {
list($action, ) = each($action);
} else {
$action = request_var('action', '');
}
// Set up general vars
$start = request_var('start', 0);
$deletemark = $action == 'del_marked' ? true : false;
$deleteall = $action == 'del_all' ? true : false;
$marked = request_var('mark', array(0));
// Sort keys
$sort_days = request_var('st', 0);
$sort_key = request_var('sk', 't');
$sort_dir = request_var('sd', 'd');
$this->tpl_name = 'mcp_logs';
$this->page_title = 'MCP_LOGS';
$forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
$forum_list[] = 0;
$forum_id = $topic_id = 0;
switch ($mode) {
case 'front':
break;
case 'forum_logs':
$forum_id = request_var('f', 0);
if (!in_array($forum_id, $forum_list)) {
trigger_error('NOT_AUTHORISED');
}
$forum_list = array($forum_id);
break;
case 'topic_logs':
$topic_id = request_var('t', 0);
$sql = 'SELECT forum_id
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$forum_id = (int) $db->sql_fetchfield('forum_id');
$db->sql_freeresult($result);
if (!in_array($forum_id, $forum_list)) {
trigger_error('NOT_AUTHORISED');
}
$forum_list = array($forum_id);
break;
}
// Delete entries if requested and able
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) {
if (confirm_box(true)) {
if ($deletemark && sizeof($marked)) {
$sql = 'DELETE FROM ' . LOG_TABLE . '
WHERE log_type = ' . LOG_MOD . '
AND ' . $db->sql_in_set('forum_id', $forum_list) . '
AND ' . $db->sql_in_set('log_id', $marked);
$db->sql_query($sql);
add_log('admin', 'LOG_CLEAR_MOD');
} else {
if ($deleteall) {
$sql = 'DELETE FROM ' . LOG_TABLE . '
WHERE log_type = ' . LOG_MOD . '
AND ' . $db->sql_in_set('forum_id', $forum_list);
if ($mode == 'topic_logs') {
$sql .= ' AND topic_id = ' . $topic_id;
}
$db->sql_query($sql);
add_log('admin', 'LOG_CLEAR_MOD');
}
}
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('f' => $forum_id, 't' => $topic_id, 'start' => $start, 'delmarked' => $deletemark, 'delall' => $deleteall, 'mark' => $marked, 'st' => $sort_days, 'sk' => $sort_key, 'sd' => $sort_dir, 'i' => $id, 'mode' => $mode, 'action' => request_var('action', array('' => '')))));
}
}
// Sorting
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
$sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
// Define where and sort sql for use in displaying logs
$sql_where = $sort_days ? time() - $sort_days * 86400 : 0;
$sql_sort = $sort_by_sql[$sort_key] . ' ' . ($sort_dir == 'd' ? 'DESC' : 'ASC');
// Grab log data
$log_data = array();
$log_count = 0;
view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort);
$template->assign_vars(array('PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), 'TOTAL' => $log_count == 1 ? $user->lang['TOTAL_LOG'] : sprintf($user->lang['TOTAL_LOGS'], $log_count), 'PAGINATION' => generate_pagination($this->u_action . "&{$u_sort_param}", $log_count, $config['topics_per_page'], $start), 'L_TITLE' => $user->lang['MCP_LOGS'], 'U_POST_ACTION' => $this->u_action, 'S_CLEAR_ALLOWED' => $auth->acl_get('a_clearlogs') ? true : false, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_LOGS' => $log_count > 0));
foreach ($log_data as $row) {
$data = array();
$checks = array('viewtopic', 'viewforum');
foreach ($checks as $check) {
if (isset($row[$check]) && $row[$check]) {
$data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
}
//.........这里部分代码省略.........
开发者ID:Phatboy82,项目名称:phpbbgarage,代码行数:101,代码来源:mcp_logs.php
示例8: main
//.........这里部分代码省略.........
while ($row = $db->sql_fetchrow($result)) {
$attachments[] = $row;
}
$db->sql_freeresult($result);
if (sizeof($attachments)) {
$update_count = array();
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
}
// Display not already displayed Attachments for this post, we already parsed them. ;)
if (!empty($attachments)) {
$template->assign_var('S_HAS_ATTACHMENTS', true);
foreach ($attachments as $attachment) {
$template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
}
}
$post_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']);
$template->assign_vars(array('S_MCP_QUEUE' => true, 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&p={$post_id}&f={$forum_id}"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, 'MINI_POST_IMG' => $post_unread ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue' . ($topic_id ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . "&start={$start}\">", '</a>'), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'), 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => $auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '') ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'U_LOOKUP_IP' => $auth->acl_get('m_info', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id . '&lookup=' . $post_info['poster_ip']) . '#ip' : ''));
break;
case 'unapproved_topics':
case 'unapproved_posts':
$user->add_lang(array('viewtopic', 'viewforum'));
$topic_id = request_var('t', 0);
$forum_info = array();
if ($topic_id) {
$topic_info = get_topic_data(array($topic_id));
if (!sizeof($topic_info)) {
trigger_error('TOPIC_NOT_EXIST');
}
$topic_info = $topic_info[$topic_id];
$forum_id = $topic_info['forum_id'];
}
$forum_list_approve = get_forum_list('m_approve', false, true);
$forum_list_read = array_flip(get_forum_list('f_read', true, true));
// Flipped so we can isset() the forum IDs
// Remove forums we cannot read
foreach ($forum_list_approve as $k => $forum_data) {
if (!isset($forum_list_read[$forum_data['forum_id']])) {
unset($forum_list_approve[$k]);
}
}
unset($forum_list_read);
if (!$forum_id) {
$forum_list = array();
foreach ($forum_list_approve as $row) {
$forum_list[] = $row['forum_id'];
}
if (!sizeof($forum_list)) {
trigger_error('NOT_MODERATOR');
}
$global_id = $forum_list[0];
$forum_list = implode(', ', $forum_list);
$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
FROM ' . FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id IN (0, {$forum_list})";
$result = $db->sql_query($sql);
$forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
$db->sql_freeresult($result);
} else {
$forum_info = get_forum_data(array($forum_id), 'm_approve');
if (!sizeof($forum_info)) {
trigger_error('NOT_MODERATOR');
}
$forum_info = $forum_info[$forum_id];
$forum_list = $forum_id;
$global_id = $forum_id;
开发者ID:html,项目名称:PI,代码行数:67,代码来源:mcp_queue.php
示例9: phpbb_mcp_sorting
/**
* sorting in mcp
*
* @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR
*
* $mode reports and reports_closed: the $where parameters uses aliases p for posts table and r for report table
* $mode unapproved_posts: the $where parameters uses aliases p for posts table and t for topic table
*/
function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE')
{
global $db, $user, $auth, $template, $phpbb_dispatcher;
$sort_days = request_var('st', 0);
$min_time = $sort_days ? time() - $sort_days * 86400 : 0;
switch ($mode) {
case 'viewforum':
$type = 'topics';
$default_key = 't';
$default_dir = 'd';
$sql = 'SELECT COUNT(topic_id) AS total
FROM ' . TOPICS_TABLE . "\n\t\t\t\t{$where_sql} forum_id = {$forum_id}\n\t\t\t\t\tAND topic_type NOT IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ")\n\t\t\t\t\tAND topic_last_post_time >= {$min_time}";
if (!$auth->acl_get('m_approve', $forum_id)) {
$sql .= 'AND topic_visibility = ' . ITEM_APPROVED;
}
break;
case 'viewtopic':
$type = 'posts';
$default_key = 't';
$default_dir = 'a';
$sql = 'SELECT COUNT(post_id) AS total
FROM ' . POSTS_TABLE . "\n\t\t\t\t{$where_sql} topic_id = {$topic_id}\n\t\t\t\t\tAND post_time >= {$min_time}";
if (!$auth->acl_get('m_approve', $forum_id)) {
$sql .= 'AND post_visibility = ' . ITEM_APPROVED;
}
break;
case 'unapproved_posts':
case 'deleted_posts':
$visibility_const = $mode == 'unapproved_posts' ? array(ITEM_UNAPPROVED, ITEM_REAPPROVE) : ITEM_DELETED;
$type = 'posts';
$default_key = 't';
$default_dir = 'd';
$where_sql .= $topic_id ? ' p.topic_id = ' . $topic_id . ' AND' : '';
$sql = 'SELECT COUNT(p.post_id) AS total
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t\n\t\t\t\t{$where_sql} " . $db->sql_in_set('p.forum_id', $forum_id ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
AND ' . $db->sql_in_set('p.post_visibility', $visibility_const) . '
AND t.topic_id = p.topic_id
AND t.topic_visibility <> p.post_visibility';
if ($min_time) {
$sql .= ' AND post_time >= ' . $min_time;
}
break;
case 'unapproved_topics':
case 'deleted_topics':
$visibility_const = $mode == 'unapproved_topics' ? array(ITEM_UNAPPROVED, ITEM_REAPPROVE) : ITEM_DELETED;
$type = 'topics';
$default_key = 't';
$default_dir = 'd';
$sql = 'SELECT COUNT(topic_id) AS total
FROM ' . TOPICS_TABLE . "\n\t\t\t\t{$where_sql} " . $db->sql_in_set('forum_id', $forum_id ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
AND ' . $db->sql_in_set('topic_visibility', $visibility_const);
if ($min_time) {
$sql .= ' AND topic_time >= ' . $min_time;
}
break;
case 'pm_reports':
case 'pm_reports_closed':
case 'reports':
case 'reports_closed':
$pm = strpos($mode, 'pm_') === 0 ? true : false;
$type = $pm ? 'pm_reports' : 'reports';
$default_key = 't';
$default_dir = 'd';
$limit_time_sql = $min_time ? "AND r.report_time >= {$min_time}" : '';
if ($topic_id) {
$where_sql .= ' p.topic_id = ' . $topic_id . ' AND ';
} else {
if ($forum_id) {
$where_sql .= ' p.forum_id = ' . $forum_id . ' AND ';
} else {
if (!$pm) {
$where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true) . ' AND ';
}
}
}
if ($mode == 'reports' || $mode == 'pm_reports') {
$where_sql .= ' r.report_closed = 0 AND ';
} else {
$where_sql .= ' r.report_closed = 1 AND ';
}
if ($pm) {
$sql = 'SELECT COUNT(r.report_id) AS total
FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . " p\n\t\t\t\t\t{$where_sql} r.post_id = 0\n\t\t\t\t\t\tAND p.msg_id = r.pm_id\n\t\t\t\t\t\t{$limit_time_sql}";
} else {
$sql = 'SELECT COUNT(r.report_id) AS total
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p\n\t\t\t\t\t{$where_sql} r.pm_id = 0\n\t\t\t\t\t\tAND p.post_id = r.post_id\n\t\t\t\t\t\t{$limit_time_sql}";
}
break;
case 'viewlogs':
$type = 'logs';
$default_key = 't';
$default_dir = 'd';
//.........这里部分代码省略.........
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:functions_mcp.php
示例10: getSingleResource
/**
* Returns a single resquested topic.
* @param array $args must contain 'resID' key with the resource identifier of the requested resource
* @throws InvalidArgumentException if one of the paramaters is missing
* @webservice{/module/MOBILE/CLANN/getSingleResource/cidReq/resId}
* @ws_arg{Method,getSingleResource}
* @ws_arg{cidReq,SYSCODE of requested cours}
* @ws_arg{resID,Resource Id of requested resource}
* @return announce object (can be null if not visible for the current user)
*/
function getSingleResource($args)
{
$resourceId = isset($args['resID']) ? $args['resID'] : null;
$cid = claro_get_current_course_id();
if ($cid == null || $resourceId == null) {
throw new InvalidArgumentException('Missing cid or resourceId argument!');
}
FromKernel::uses('forum.lib');
$claroNotification = Claroline::getInstance()->notification;
$date = $claroNotification->getLastActionBeforeLoginDate(claro_get_current_user_id());
$d = new DateTime($date);
$d->sub(new DateInterval('PT1M'));
$item = null;
foreach (get_forum_list() as $forum) {
if ($forum['forum_id'] == $resourceID) {
$item = $forum;
break;
}
}
if ($item) {
$item['resourceId'] = $item['forum_id'];
$item['title'] = $item['forum_name'];
foreach (get_category_list as $cat) {
if ($cat['cat_id'] == $item['cat_id']) {
$item['cat_title'] = $cat['cat_title'];
$item['cat_order'] = $cat['cat_order'];
break;
}
}
$item['topics'] = array();
$topics = new topicLister($item['forum_id'], 0, $item['forum_topics']);
foreach ($topics->get_topic_list() as $topic) {
$topic['resourceId'] = $topic['topic_id'];
$topic['title'] = $topic['topic_title'];
$topic['poster_firstname'] = $topic['prenom'];
$topic['poster_lastname'] = $topic['nom'];
$topic['date'] = $topic['topic_time'];
$topic['posts'] = array();
$posts = new postLister($topic['topic_id'], 0, $topic['topic_replies'] + 1);
foreach ($posts->get_post_list() as $post) {
$notified = $claroNotification->isANotifiedRessource($cid, $date, claro_get_current_user_id(), claro_get_current_group_id(), get_tool_id_from_module_label('CLFRM'), $item['forum_id'] . '-' . $topic['topic_id'] . '-' . $post['post_id'], false);
$post['notifiedDate'] = $notified ? $date : $post['post_time'];
$post['seenDate'] = $d->format('Y-m-d H:i');
$post['post_text'] = trim(strip_tags($post['post_text']));
$post['resourceId'] = $post['post_id'];
$post['date'] = $post['post_time'];
unset($post['post_id']);
unset($post['topic_id']);
unset($post['forum_id']);
unset($post['poster_id']);
unset($post['post_time']);
unset($post['poster_ip']);
$topic['posts'][] = $post;
}
unset($topic['topic_id']);
unset($topic['topic_title']);
unset($topic['topic_poster']);
unset($topic['topic_time']);
unset($topic['topic_replies']);
unset($topic['topic_last_post_id']);
unset($topic['forum_id']);
unset($topic['topic_notify']);
unset($topic['nom']);
unset($topic['prenom']);
unset($topic['post_time']);
$item['topics'][] = $topic;
}
unset($item['forum_id']);
unset($item['forum_name']);
unset($item['forum_moderator']);
unset($item['forum_topics']);
unset($item['forum_posts']);
unset($item['forum_last_post_id']);
unset($item['forum_type']);
unset($item['group_id']);
unset($item['poster_id']);
unset($item['post_time']);
return $item;
} else {
throw new RuntimeException('Resource not found', 404);
}
}
开发者ID:Okhoshi,项目名称:Claroline.REST-API-Plugin,代码行数:92,代码来源:clfrmwebservicecontroller.lib.php
示例11: define
define('SECTION_PLUGINNAME', 'forum');
define('SECTION_PAGE', 'index');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once 'group.php';
safe_require('interaction', 'forum');
require_once 'pieforms/pieform.php';
require_once get_config('docroot') . 'interaction/lib.php';
$groupid = param_integer('group');
define('GROUP', $groupid);
$group = group_current_group();
$membership = group_user_access($groupid);
if (!$membership && !$group->public) {
throw new GroupAccessDeniedException(get_string('cantviewforums', 'interaction.forum'));
}
define('TITLE', $group->name . ' - ' . get_string('nameplural', 'interaction.forum'));
$forums = get_forum_list($group->id, $USER->get('id'));
if ($forums) {
// query gets a new forum object for every moderator of that forum
// this combines all moderators together into one object per forum
$count = count($forums);
for ($i = 0; $i < $count; $i++) {
$forums[$i]->moderators = array();
if ($forums[$i]->moderator) {
$forums[$i]->moderators[] = $forums[$i]->moderator;
}
$temp = $i;
while (isset($forums[$i + 1]) && $forums[$i + 1]->id == $forums[$temp]->id) {
$i++;
$forums[$temp]->moderators[] = $forums[$i]->moderator;
unset($forums[$i]);
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:index.php
示例12: get_forum_list
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\"> </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</form>\n";
echo "</div>\n";
} else {
$forums_array = get_forum_list($page);
echo "<h1>", gettext("My Forums"), "</h1>\n";
if (isset($forums_array['forums_array']) && sizeof($forums_array['forums_array']) < 1) {
html_display_warning_msg(gettext("There are no forums of the selected type available. Please select a different type."), '70%', 'center');
}
echo "<br />\n";
echo "<div align=\"center\">\n";
echo "<form accept-charset=\"utf-8\" name=\"prefs\" action=\"forums.php\" method=\"post\" target=\"_self\">\n";
echo " ", form_input_hidden("webtag", htmlentities_array($webtag)), "\n";
echo " ", form_input_hidden("page", htmlentities_array($page)), "\n";
echo " ", form_input_hidden("webtag_search", htmlentities_array($webtag_search)), "\n";
echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"70%\">\n";
echo " <tr>\n";
echo " <td align=\"left\">\n";
echo " <table class=\"box\" width=\"100%\">\n";
echo " <tr>\n";
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:31,代码来源:forums.php
示例13: generate_link
$_CLASS['core_template']->assign_array(array('S_MCP_QUEUE' => true, 'S_APPROVE_ACTION' => generate_link("forums&file=mcp&i=queue&p={$post_id}&f={$forum_id}"), 'S_CAN_VIEWIP' => $_CLASS['auth']->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'U_EDIT' => $_CLASS['auth']->acl_get('m_edit', $post_info['forum_id']) ? generate_link("forums&file=posting&mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => generate_link('forums&file=mcp&i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_REPORT' => generate_link('forums&file=mcp&i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_USER_NOTES' => generate_link('forums&file=mcp&i=notes&mode=user_notes&u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => $_CLASS['auth']->acl_get('m_warn') ? generate_link('forums&file=mcp&i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => generate_link('forums&file=viewtopic&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), 'U_VIEW_PROFILE' => generate_link('members_list&mode=viewprofile&u=' . $post_info['user_id']), 'U_VIEW_TOPIC' => generate_link('forums&file=viewtopic&t=' . $post_info['topic_id']), 'RETURN_QUEUE' => sprintf($_CLASS['core_user']->get_lang('RETURN_QUEUE'), '<a href="' . generate_link('forums&file=mcp&i=queue' . ($topic_id ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . "&start={$start}\">", '</a>'), 'REPORTED_IMG' => $_CLASS['core_user']->img('icon_reported', $_CLASS['core_user']->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $_CLASS['core_user']->img('icon_unapproved', $_CLASS['core_user']->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $_CLASS['core_user']->img('btn_edit', $_CLASS['core_user']->lang['EDIT_POST']), 'POSTER_NAME' => $poster, 'POST_PREVIEW' => $post_info['post_text'], 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $_CLASS['core_user']->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']), 'POST_ID' => $post_info['post_id']));
$_CLASS['core_display']->display($_CLASS['core_user']->get_lang('MCP_QUEUE'), 'modules/forums/mcp_post.html');
break;
case 'unapproved_topics':
case 'unapproved_posts':
$forum_info = array();
$topic_id = get_variable('t', 'REQUEST', false, 'int');
if ($topic_id) {
$topic_info = get_topic_data(array($topic_id));
if (empty($topic_info[$topic_id])) {
trigger_error('TOPIC_NOT_EXIST');
}
$topic_info = $topic_info[$topic_id];
$forum_id = $topic_info['forum_id'];
}
$forum_list_approve = get_forum_list('m_approve', false, true);
if (!$forum_id) {
$forum_list = array();
foreach ($forum_list_approve as $row) {
$forum_list[] = $row['forum_id'];
}
if (!($forum_list = implode(', ', $forum_list))) {
trigger_error('NOT_MODERATOR');
}
$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
FROM ' . FORUMS_FORUMS_TABLE . "\n\t\t\t\tWHERE forum_id IN ({$forum_list})";
$result = $_CLASS['core_db']->query($sql);
$row = $_CLASS['core_db']->fetch_row_assoc($result);
$_CLASS['core_db']->free_result($result);
$forum_info['forum_topics'] = (int) $row['sum_forum_topics'];
} else {
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:mcp_queue.php
示例14: hook_moderator_needed
/**
* This hook displays moderator messages to moderators
*
* @param hook_moderator_needed $hook
* @return void
*/
function hook_moderator_needed(&$hook)
{
global $auth, $cache, $db, $template, $user, $phpEx, $phpbb_root_path;
if ($auth->acl_getf_global('m_')) {
$allow = false;
// needed language
$user->add_lang('mods/moderator_needed');
if ($auth->acl_getf_global('m_approve') || $auth->acl_getf_global('m_report')) {
if (!function_exists('get_forum_list')) {
include $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
}
// we need global announcements which don't have any forum id ass
|
请发表评论