本文整理汇总了PHP中make_forum_select函数的典型用法代码示例。如果您正苦于以下问题:PHP make_forum_select函数的具体用法?PHP make_forum_select怎么用?PHP make_forum_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_forum_select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_all
/**
* @return array
*/
public function get_all($select_id = false, $ignore_id = false, $ignore_acl = true, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false)
{
$forumlist = make_forum_select($select_id, $ignore_id, $ignore_acl, $ignore_nonpost, $ignore_emptycat, $only_acl_post, true);
$forum_options = array('' => 'ALL');
foreach ($forumlist as $row) {
$forum_options[$row['forum_id']] = $row['padding'] . $row['forum_name'];
}
return $forum_options;
}
示例2: select_forums
public function select_forums($value, $key)
{
$forum_list = make_forum_select(false, false, true, true, true, false, true);
$selected = array();
if (isset($this->config[$key]) && strlen($this->config[$key]) > 0) {
$selected = explode(',', $this->config[$key]);
}
// Build forum options
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
foreach ($forum_list as $f_id => $f_row) {
$s_forum_options .= '<option value="' . $f_id . '"' . (in_array($f_id, $selected) ? ' selected="selected"' : '') . ($f_row['disabled'] ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
}
$s_forum_options .= '</select>';
return $s_forum_options;
}
示例3: acp_manage_forums_display_form
/**
* Event: core.acp_manage_forums_display_form
*
* @param Event $event
*/
public function acp_manage_forums_display_form($event)
{
$this->user->add_lang_ext('kasimi/movetopicswhenlocked', 'acp_forum_settings');
$is_edit = $event['action'] == 'edit';
$forum_data = $event['forum_data'];
$template_vars = array('MOVE_TOPICS_WHEN_LOCKED_VERSION' => $this->config['kasimi.movetopicswhenlocked.version'], 'S_MOVE_TOPICS' => $is_edit ? $forum_data['move_topics_when_locked'] : false, 'S_MOVE_TOPICS_TO_OPTIONS' => make_forum_select($is_edit ? $forum_data['move_topics_when_locked_to'] : false, false, false, true));
$topic_solved_extension = $this->user->lang('MOVE_TOPICS_SOLVED_EXTENSION');
if ($this->extension_manager->is_enabled(self::EXT_TOPIC_SOLVED_NAME)) {
$metadata = $this->extension_manager->create_extension_metadata_manager(self::EXT_TOPIC_SOLVED_NAME, $this->template)->get_metadata();
$is_valid_version = phpbb_version_compare($metadata['version'], self::EXT_TOPIC_SOLVED_MIN_VERSION, '>=');
$template_vars = array_merge($template_vars, array('S_MOVE_TOPICS_SOLVED' => $is_edit ? $forum_data['move_topics_when_locked_solved'] : false, 'MOVE_TOPICS_SOLVED_ENABLED' => $is_valid_version ? $this->user->lang('MOVE_TOPICS_SOLVED_ENABLED', $topic_solved_extension) : false, 'MOVE_TOPICS_SOLVED_VERSION' => $is_valid_version ? false : $this->user->lang('MOVE_TOPICS_SOLVED_VERSION', self::EXT_TOPIC_SOLVED_MIN_VERSION, $topic_solved_extension)));
} else {
$template_vars['MOVE_TOPICS_SOLVED_DISABLED'] = $this->user->lang('EXTENSION_DISABLED', $topic_solved_extension);
}
$this->template->assign_vars($template_vars);
}
示例4: main
public function main($id, $mode)
{
global $config, $user, $template, $request;
$user->add_lang_ext('tas2580/socialbuttons', 'common');
$this->tpl_name = 'acp_socialbuttons_body';
$this->page_title = $user->lang('ACP_SOCIALBUTTONS_TITLE');
add_form_key('acp_socialbuttons');
// Form is submitted
if ($request->is_set_post('submit')) {
if (!check_form_key('acp_socialbuttons')) {
trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
}
$forums = implode(',', $request->variable('enable_f', array(0)));
$desc_forums = implode(',', $request->variable('enable_og_desc_f', array(0)));
// Set the new settings to config
$config->set('socialbuttons_position', $request->variable('position', 0));
$config->set('socialbuttons_enable_forums', $forums);
$config->set('socialbuttons_display_on_index', $request->variable('display_on_index', 0));
$config->set('socialbuttons_enable', $request->variable('enable', 0));
$config->set('socialbuttons_cachetime', $request->variable('cachetime', 0));
$config->set('socialbuttons_multiplicator', $request->variable('multiplicator', 1));
$config->set('socialbuttons_facebook', $request->variable('facebook', 0));
$config->set('socialbuttons_twitter', $request->variable('twitter', 0));
$config->set('socialbuttons_google', $request->variable('google', 0));
$config->set('socialbuttons_linkedin', $request->variable('linkedin', 0));
$config->set('socialbuttons_style', $request->variable('style', 1));
$config->set('socialbuttons_showshares', $request->variable('showshares', 0));
$config->set('socialbuttons_use_seo_urls', $request->variable('use_seo_urls', ''));
$config->set('socialbuttons_enable_og', $request->variable('enable_og', 0));
$config->set('socialbuttons_enable_og_title', $request->variable('enable_og_title', 0));
$config->set('socialbuttons_enable_og_desc', $request->variable('enable_og_desc', 0));
$config->set('socialbuttons_og_image', $request->variable('og_image', ''));
$config->set('socialbuttons_enable_og_desc_forums', $desc_forums);
trigger_error($user->lang('ACP_SAVED') . adm_back_link($this->u_action));
}
// Send the curent settings to template
$position = isset($config['socialbuttons_position']) ? $config['socialbuttons_position'] : false;
$multiplicator = isset($config['socialbuttons_multiplicator']) ? $config['socialbuttons_multiplicator'] : true;
$style = isset($config['socialbuttons_style']) ? $config['socialbuttons_style'] : true;
$desc_forums = isset($config['socialbuttons_enable_og_desc_forums']) ? explode(',', $config['socialbuttons_enable_og_desc_forums']) : array();
$forums = isset($config['socialbuttons_enable_forums']) ? explode(',', $config['socialbuttons_enable_forums']) : array();
$template->assign_vars(array('U_ACTION' => $this->u_action, 'POSITION_OPTIONS' => $this->position_select($position), 'MULTIPLICATOR_OPTIONS' => $this->multiplicator_select($multiplicator), 'BUTTON_STYLES' => $this->button_style($style), 'S_ENABLE' => isset($config['socialbuttons_enable']) ? $config['socialbuttons_enable'] : false, 'S_DISPLAY_ON_INDEX' => isset($config['socialbuttons_display_on_index']) ? $config['socialbuttons_display_on_index'] : false, 'S_USE_SEO_URLS' => isset($config['socialbuttons_use_seo_urls']) ? $config['socialbuttons_use_seo_urls'] : false, 'S_SHOWSHARES' => isset($config['socialbuttons_showshares']) ? $config['socialbuttons_showshares'] : false, 'CACHETIME' => isset($config['socialbuttons_cachetime']) ? $config['socialbuttons_cachetime'] : false, 'S_FACEBOOK' => isset($config['socialbuttons_facebook']) ? $config['socialbuttons_facebook'] : '', 'S_TWITTER' => isset($config['socialbuttons_twitter']) ? $config['socialbuttons_twitter'] : '', 'S_GOOGLE' => isset($config['socialbuttons_google']) ? $config['socialbuttons_google'] : '', 'S_LINKEDIN' => isset($config['socialbuttons_linkedin']) ? $config['socialbuttons_linkedin'] : '', 'S_ENABLE_OG' => isset($config['socialbuttons_enable_og']) ? $config['socialbuttons_enable_og'] : '', 'S_ENABLE_OG_TITLE' => isset($config['socialbuttons_enable_og_title']) ? $config['socialbuttons_enable_og_title'] : '', 'S_ENABLE_OG_DESC' => isset($config['socialbuttons_enable_og_desc']) ? $config['socialbuttons_enable_og_desc'] : '', 'OG_IMAGE' => isset($config['socialbuttons_og_image']) ? $config['socialbuttons_og_image'] : '', 'FORUM_DESC_SELECT' => make_forum_select($desc_forums, false, false, true), 'FORUM_ENABLE_SELECT' => make_forum_select($forums, false, false, true)));
}
示例5: main
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache, $request;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$this->db = $db;
$this->config = $config;
$this->request = $request;
$this->tpl_name = 'acp_maps';
$this->page_title = $user->lang('ACP_MAPS');
add_form_key('saturnZ/maps');
if ($request->is_set_post('submit')) {
if (!check_form_key('saturnZ/maps')) {
trigger_error('FORM_INVALID');
}
$config->set('maps_center', $request->variable('center', '57.16565146, 65.54499550'));
$config->set('maps_title', $request->variable('title', 'Яндекс Карта', true));
$config->set('maps_group', implode(',', $request->variable('maps_group', array(0))));
$config->set('maps_group_edit', implode(',', $request->variable('maps_group_edit', array(0))));
$config->set('maps_group_delete', implode(',', $request->variable('maps_group_delete', array(0))));
$config->set('maps_posts_forum', $request->variable('maps_posts_forum', 1));
$config->set('maps_Placemark_posts', $request->variable('Placemark', 0));
$config->set('maps_post', $request->variable('maps_post', 1));
$config->set('maps_reputation', $request->variable('reputation', 1));
$config->set('maps_bounds', $request->variable('bounds', 1));
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
$groups_ary = explode(',', $this->config['maps_group']);
$groups_edit_ary = explode(',', $this->config['maps_group_edit']);
$groups_delete_ary = explode(',', $this->config['maps_group_delete']);
// get group info from database and assign the block vars
$sql = 'SELECT group_id, group_name
FROM ' . GROUPS_TABLE . '
ORDER BY group_id ASC';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$template->assign_block_vars('group_setting', array('SELECTED' => in_array($row['group_id'], $groups_ary) ? true : false, 'GROUP_NAME' => isset($user->lang['G_' . $row['group_name']]) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], 'GROUP_ID' => $row['group_id']));
$template->assign_block_vars('group_edit_setting', array('SELECTED' => in_array($row['group_id'], $groups_edit_ary) ? true : false, 'GROUP_NAME' => isset($user->lang['G_' . $row['group_name']]) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], 'GROUP_ID' => $row['group_id']));
$template->assign_block_vars('group_delete_setting', array('SELECTED' => in_array($row['group_id'], $groups_delete_ary) ? true : false, 'GROUP_NAME' => isset($user->lang['G_' . $row['group_name']]) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], 'GROUP_ID' => $row['group_id']));
}
$template->assign_vars(array('U_ACTION' => $this->u_action, 'CENTER' => isset($config['maps_center']) ? $config['maps_center'] : '57.16565146, 65.54499550', 'TITLE' => isset($config['maps_title']) ? $config['maps_title'] : 'Яндекс Карта', 'POSTS_FORUM' => make_forum_select(isset($config['maps_posts_forum']) ? $config['maps_posts_forum'] : 1, false, false, true), 'PLACEMARK' => isset($this->config['maps_Placemark_posts']) ? $this->config['maps_Placemark_posts'] : 0, 'MAPS_POST' => isset($this->config['maps_post']) ? $this->config['maps_post'] : 1, 'REPUTATION' => isset($this->config['maps_reputation']) ? $this->config['maps_reputation'] : 1, 'BOUNDS' => isset($this->config['maps_bounds']) ? $this->config['maps_bounds'] : 1));
}
示例6: display_mask
/**
* Display permission mask (assign to template)
*/
function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)
{
global $template, $user, $db, $phpbb_container;
/* @var $phpbb_permissions \phpbb\permissions */
$phpbb_permissions = $phpbb_container->get('acl.permissions');
/** @var \phpbb\group\helper $group_helper */
$group_helper = $phpbb_container->get('group_helper');
// Define names for template loops, might be able to be set
$tpl_pmask = 'p_mask';
$tpl_fmask = 'f_mask';
$tpl_category = 'category';
$tpl_mask = 'mask';
$l_acl_type = $phpbb_permissions->get_type_lang($permission_type, $local ? 'local' : 'global');
// Allow trace for viewing permissions and in user mode
$show_trace = $mode == 'view' && $user_mode == 'user' ? true : false;
// Get names
if ($user_mode == 'user') {
$sql = 'SELECT user_id as ug_id, username as ug_name
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', array_keys($hold_ary)) . '
ORDER BY username_clean ASC';
} else {
$sql = 'SELECT group_id as ug_id, group_name as ug_name, group_type
FROM ' . GROUPS_TABLE . '
WHERE ' . $db->sql_in_set('group_id', array_keys($hold_ary)) . '
ORDER BY group_type DESC, group_name ASC';
}
$result = $db->sql_query($sql);
$ug_names_ary = array();
while ($row = $db->sql_fetchrow($result)) {
$ug_names_ary[$row['ug_id']] = $user_mode == 'user' ? $row['ug_name'] : $group_helper->get_name($row['ug_name']);
}
$db->sql_freeresult($result);
// Get used forums
$forum_ids = array();
foreach ($hold_ary as $ug_id => $row) {
$forum_ids = array_merge($forum_ids, array_keys($row));
}
$forum_ids = array_unique($forum_ids);
$forum_names_ary = array();
if ($local) {
$forum_names_ary = make_forum_select(false, false, true, false, false, false, true);
// Remove the disabled ones, since we do not create an option field here...
foreach ($forum_names_ary as $key => $value) {
if (!$value['disabled']) {
continue;
}
unset($forum_names_ary[$key]);
}
} else {
$forum_names_ary[0] = $l_acl_type;
}
// Get available roles
$sql = 'SELECT *
FROM ' . ACL_ROLES_TABLE . "\n\t\t\tWHERE role_type = '" . $db->sql_escape($permission_type) . "'\n\t\t\tORDER BY role_order ASC";
$result = $db->sql_query($sql);
$roles = array();
while ($row = $db->sql_fetchrow($result)) {
$roles[$row['role_id']] = $row;
}
$db->sql_freeresult($result);
$cur_roles = $this->acl_role_data($user_mode, $permission_type, array_keys($hold_ary));
// Build js roles array (role data assignments)
$s_role_js_array = '';
if (sizeof($roles)) {
$s_role_js_array = array();
// Make sure every role (even if empty) has its array defined
foreach ($roles as $_role_id => $null) {
$s_role_js_array[$_role_id] = "\n" . 'role_options[' . $_role_id . '] = new Array();' . "\n";
}
$sql = 'SELECT r.role_id, o.auth_option, r.auth_setting
FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o
WHERE o.auth_option_id = r.auth_option_id
AND ' . $db->sql_in_set('r.role_id', array_keys($roles));
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1);
if ($flag == $row['auth_option']) {
continue;
}
$s_role_js_array[$row['role_id']] .= 'role_options[' . $row['role_id'] . '][\'' . addslashes($row['auth_option']) . '\'] = ' . $row['auth_setting'] . '; ';
}
$db->sql_freeresult($result);
$s_role_js_array = implode('', $s_role_js_array);
}
$template->assign_var('S_ROLE_JS_ARRAY', $s_role_js_array);
unset($s_role_js_array);
// Now obtain memberships
$user_groups_default = $user_groups_custom = array();
if ($user_mode == 'user' && $group_display) {
$sql = 'SELECT group_id, group_name, group_type
FROM ' . GROUPS_TABLE . '
ORDER BY group_type DESC, group_name ASC';
$result = $db->sql_query($sql);
$groups = array();
while ($row = $db->sql_fetchrow($result)) {
$groups[$row['group_id']] = $row;
//.........这里部分代码省略.........
示例7: request_var
if ($row && !$row['forum_id'] && $row['topic_type'] == POST_GLOBAL) {
$to_forum_id = request_var('to_forum_id', 0);
if ($to_forum_id) {
$sql = 'SELECT forum_type
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $to_forum_id;
$result = $db->sql_query($sql);
$forum_type = (int) $db->sql_fetchfield('forum_type');
$db->sql_freeresult($result);
if ($forum_type != FORUM_POST || !$auth->acl_get('f_post', $to_forum_id) || !$auth->acl_get('f_noapprove', $to_forum_id)) {
$to_forum_id = 0;
}
}
if (!$to_forum_id) {
include_once $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
$template->assign_vars(array('S_FORUM_SELECT' => make_forum_select(false, false, false, true, true, true), 'S_UNGLOBALISE' => true));
$submit = false;
$refresh = true;
} else {
if (!$auth->acl_get('f_post', $to_forum_id)) {
// This will only be triggered if the user tried to trick the forum.
trigger_error('NOT_AUTHORISED');
}
$forum_id = $to_forum_id;
}
}
}
if ($submit) {
// Lock/Unlock Topic
$change_topic_status = $post_data['topic_status'];
$perm_lock_unlock = $auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED ? true : false;
示例8: mcp_fork_topic
//.........这里部分代码省略.........
case ITEM_REAPPROVE:
$total_posts_unapproved++;
break;
case ITEM_DELETED:
$total_posts_softdeleted++;
break;
}
// Copy whether the topic is dotted
markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);
if (!empty($search_type)) {
$search->index($search_mode, $new_post_id, $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], $topic_row['topic_type'] == POST_GLOBAL ? 0 : $to_forum_id);
$search_mode = 'reply';
// After one we index replies
}
// Copy Attachments
if ($row['post_attachment']) {
$sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . "\n\t\t\t\t\t\tWHERE post_msg_id = {$row['post_id']}\n\t\t\t\t\t\t\tAND topic_id = {$topic_id}\n\t\t\t\t\t\t\tAND in_message = 0";
$result = $db->sql_query($sql);
$sql_ary = array();
while ($attach_row = $db->sql_fetchrow($result)) {
$sql_ary[] = array('post_msg_id' => (int) $new_post_id, 'topic_id' => (int) $new_topic_id, 'in_message' => 0, 'is_orphan' => (int) $attach_row['is_orphan'], 'poster_id' => (int) $attach_row['poster_id'], 'physical_filename' => (string) utf8_basename($attach_row['physical_filename']), 'real_filename' => (string) utf8_basename($attach_row['real_filename']), 'download_count' => (int) $attach_row['download_count'], 'attach_comment' => (string) $attach_row['attach_comment'], 'extension' => (string) $attach_row['extension'], 'mimetype' => (string) $attach_row['mimetype'], 'filesize' => (int) $attach_row['filesize'], 'filetime' => (int) $attach_row['filetime'], 'thumbnail' => (int) $attach_row['thumbnail']);
}
$db->sql_freeresult($result);
if (sizeof($sql_ary)) {
$db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary);
}
}
}
// Copy topic subscriptions to new topic
$sql = 'SELECT user_id, notify_status
FROM ' . TOPICS_WATCH_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result)) {
$sql_ary[] = array('topic_id' => (int) $new_topic_id, 'user_id' => (int) $row['user_id'], 'notify_status' => (int) $row['notify_status']);
}
$db->sql_freeresult($result);
if (sizeof($sql_ary)) {
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
}
// Copy bookmarks to new topic
$sql = 'SELECT user_id
FROM ' . BOOKMARKS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result)) {
$sql_ary[] = array('topic_id' => (int) $new_topic_id, 'user_id' => (int) $row['user_id']);
}
$db->sql_freeresult($result);
if (sizeof($sql_ary)) {
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
}
}
// Sync new topics, parent forums and board stats
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET forum_posts_approved = forum_posts_approved + ' . $total_posts . ',
forum_posts_unapproved = forum_posts_unapproved + ' . $total_posts_unapproved . ',
forum_posts_softdeleted = forum_posts_softdeleted + ' . $total_posts_softdeleted . ',
forum_topics_approved = forum_topics_approved + ' . $total_topics . ',
forum_topics_unapproved = forum_topics_unapproved + ' . $total_topics_unapproved . ',
forum_topics_softdeleted = forum_topics_softdeleted + ' . $total_topics_softdeleted . '
WHERE forum_id = ' . $to_forum_id;
$db->sql_query($sql);
if (!empty($counter)) {
// Do only one query per user and not a query per post.
foreach ($counter as $user_id => $count) {
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = user_posts + ' . (int) $count . '
WHERE user_id = ' . (int) $user_id;
$db->sql_query($sql);
}
}
sync('topic', 'topic_id', $new_topic_id_list);
sync('forum', 'forum_id', $to_forum_id);
$config->increment('num_topics', sizeof($new_topic_id_list), false);
$config->increment('num_posts', $total_posts, false);
foreach ($new_topic_id_list as $topic_id => $new_topic_id) {
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array('forum_id' => $to_forum_id, 'topic_id' => $new_topic_id, $topic_row['forum_name']));
}
$success_msg = sizeof($topic_ids) == 1 ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
} else {
$template->assign_vars(array('S_FORUM_SELECT' => make_forum_select($to_forum_id, false, false, true, true, true), 'S_CAN_LEAVE_SHADOW' => false, 'ADDITIONAL_MSG' => $additional_msg));
confirm_box(false, 'FORK_TOPIC' . (sizeof($topic_ids) == 1 ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
}
$redirect = $request->variable('redirect', "index.{$phpEx}");
$redirect = reapply_sid($redirect);
if (!$success_msg) {
redirect($redirect);
} else {
$redirect_url = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id);
meta_refresh(3, $redirect_url);
$return_link = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>');
if ($forum_id != $to_forum_id) {
$return_link .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $to_forum_id) . '">', '</a>');
}
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
}
}
示例9: main
function main($id, $mode)
{
global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
//More Complicated Parts of Script
switch ($mode) {
case 'index':
case 'view':
$this->page_title = 'View Website Settings';
$this->tpl_name = 'acp_rcms_settings';
$sql = "SELECT * FROM " . SITE_SETTINGS;
$result = $db->sql_query($sql);
$site_settings = array();
while ($row = $db->sql_fetchrow($result)) {
$site_settings[$row['setting_name']]['value'] = $row['setting_value'];
$site_settings[$row['setting_name']]['type'] = $row['setting_type'];
}
$site_settings['welcome_text']['value'] = generate_text_for_display($site_settings['welcome_text']['value'], $site_settings['welcome_bbcode_uid']['value'], $site_settings['welcome_bbcode_bitfield']['value'], $site_settings['site_bbcode_options']['value']);
$db->sql_freeresult($result);
$keys = array_keys($site_settings);
foreach ($keys as $key) {
$template->assign_vars(array(strtoupper($key) => $site_settings[$key]['type'] == 'BOOL' ? $site_settings[$key]['value'] ? true : false : $site_settings[$key]['value']));
}
$db->sql_freeresult($result);
break;
case 'edit':
$this->page_title = 'Edit Website Settings';
$this->tpl_name = 'acp_rcms_settings_edit';
$sql = "SELECT * FROM " . SITE_SETTINGS;
$result = $db->sql_query($sql);
$site_settings = array();
$vars = array();
while ($row = $db->sql_fetchrow($result)) {
$site_settings[$row['setting_name']] = array('setting_value' => $row['setting_value'], 'setting_type' => $row['setting_type']);
$vars[strtoupper($row['setting_name'])] = $row['setting_value'];
}
$db->sql_freeresult($result);
$forum_list = make_forum_select(false, false, true, true, true, false, true);
// Build forum options
$s_forum_options = '<select name="news_forum">';
foreach ($forum_list as $f_id => $f_row) {
$f_row['selected'] = $site_settings['news_forum']['setting_value'] == $f_id ? true : false;
$s_forum_options .= '<option value="' . $f_id . '"' . ($f_row['selected'] ? ' selected="selected"' : '') . ($f_row['disabled'] ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
}
$s_forum_options .= '</select>';
decode_message($site_settings['welcome_text']['setting_value'], $site_settings['welcome_bbcode_uid']['setting_value']);
$vars['WELCOME_TEXT'] = $site_settings['welcome_text']['setting_value'];
$vars += array("FORM_ACTION" => $this->u_action, "U_BACK" => append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=rayth_cms'), "NEWS_FORUM_SELECT" => $s_forum_options);
$template->assign_vars($vars);
$db->sql_freeresult($result);
$update = isset($_POST['save_settings']) ? true : false;
if ($update) {
$welcome_text = request_var('welcome_text', 'Some Text Here');
$news_forum = request_var('news_forum', 2);
$news_post_count = request_var('news_post_count', 0);
$welcome_text = utf8_normalize_nfc($welcome_text);
$uid = $bitfield = $options = '';
// will be modified by generate_text_for_storage
$allow_bbcode = $allow_urls = $allow_smilies = true;
$display_sidebar = request_var('display_sidebar', 0);
$sidebar_recent_reply_count = request_var('sidebar_recent_reply_count', 0);
generate_text_for_storage($welcome_text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value='{$uid}' WHERE setting_name='welcome_bbcode_uid';");
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value='{$bitfield}' WHERE setting_name='welcome_bbcode_bitfield';");
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$welcome_text}\" WHERE setting_name='welcome_text';");
$site_settings['welcome_text']['setting_value'] = $welcome_text;
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$news_forum}\" WHERE setting_name='news_forum';");
$site_settings['news_forum']['setting_value'] = $news_forum;
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$news_post_count}\" WHERE setting_name='news_post_count';");
$site_settings['news_post_count']['setting_value'] = $news_post_count;
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$display_sidebar}\" WHERE setting_name='display_sidebar';");
$site_settings['display_sidebar']['setting_value'] = $display_sidebar;
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$sidebar_recent_reply_count}\" WHERE setting_name='sidebar_recent_reply_count';");
$site_settings['sidebar_recent_reply_count']['setting_value'] = $sidebar_recent_reply_count;
$message = "Site Settings have been Updated.";
$message .= '<br /><br />';
trigger_error($message . adm_back_link(append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=rayth_cms')));
}
break;
case 'pages':
$this->page_title = 'Manage Pages';
$this->tpl_name = 'acp_rcms_page_list';
$sql = "SELECT * FROM " . SITE_PAGES . " WHERE parent=0 ORDER BY page_name ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$sql = "SELECT * FROM " . SITE_PAGES . " WHERE parent={$row['page_id']}";
$sub_page_result = $db->sql_query($sql);
$sql = "SELECT COUNT(*) as total_subs FROM " . SITE_PAGES . " WHERE parent={$row['page_id']}";
$sub_page_count_row = $db->sql_fetchrow($db->sql_query($sql));
$subpage_count = $sub_page_count_row['total_subs'];
if ($subpage_count > 0) {
$subpages = "<table cellspacing=\"1\">";
$subpages .= "<col class=\"col1\"/><col class=\"col2\"/><col class=\"col1\"/><col class=\"col2\"/><col class=\"col1\"/>";
$subpages .= "<th>Page Name</th><th>Identifier</th><th>Last Updated</th><th>Edit</th><th>Delete</th>";
while ($sub_row = $db->sql_fetchrow($sub_page_result)) {
$subpages .= "<tr>";
$subpages .= "<td>{$sub_row['page_name']}</td>";
$subpages .= "<td style=\"text-align: center;\">{$sub_row['page_identifier']}</td>";
$subpages .= "<td style=\"text-align: center;\">" . date($user->data['user_dateformat'], $sub_row['last_updated']) . "</td>";
$subpages .= "<td style=\"text-align: center;\"><a href=\"" . append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=rayth_cms&mode=pagemanage&act=edit&id={$sub_row['page_id']}") . "\">Edit</a></td>";
//.........这里部分代码省略.........
示例10: copy_forum_permissions
/**
* Handles copying permissions from one forum to others
*/
function copy_forum_permissions()
{
global $db, $auth, $cache, $template, $user, $request;
$user->add_lang('acp/forums');
$submit = isset($_POST['submit']) ? true : false;
if ($submit) {
$src = $request->variable('src_forum_id', 0);
$dest = $request->variable('dest_forum_ids', array(0));
if (confirm_box(true)) {
if (copy_forum_permissions($src, $dest)) {
phpbb_cache_moderators($db, $cache, $auth);
$auth->acl_clear_prefetch();
$cache->destroy('sql', FORUMS_TABLE);
trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
} else {
trigger_error($user->lang['SELECTED_FORUM_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING);
}
} else {
$s_hidden_fields = array('submit' => $submit, 'src_forum_id' => $src, 'dest_forum_ids' => $dest);
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
confirm_box(false, $user->lang['COPY_PERMISSIONS_CONFIRM'], $s_hidden_fields);
}
}
$template->assign_vars(array('S_FORUM_OPTIONS' => make_forum_select(false, false, false, false, false)));
}
示例11: make_forum_select
$result = $db->sql_query($sql);
$forum_type = (int) $db->sql_fetchfield('forum_type');
$db->sql_freeresult($result);
if ($forum_type != FORUM_POST || !$auth->acl_get('f_post', $to_forum_id) || (!$auth->acl_get('m_approve', $to_forum_id) && !$auth->acl_get('f_noapprove', $to_forum_id)))
{
$to_forum_id = 0;
}
}
if (!$to_forum_id)
{
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
$template->assign_vars(array(
'S_FORUM_SELECT' => make_forum_select(false, false, false, true, true, true),
'S_UNGLOBALISE' => true)
);
$submit = false;
$refresh = true;
}
else
{
if (!$auth->acl_get('f_post', $to_forum_id))
{
// This will only be triggered if the user tried to trick the forum.
trigger_error('NOT_AUTHORISED');
}
$forum_id = $to_forum_id;
示例12: implode
}
if (sizeof($message_parser->warn_msg)) {
$error[] = implode('<br />', $message_parser->warn_msg);
}
// Store message, sync counters
if (empty($error) && $submit) {
// Check if we want to de-globalize the topic... and ask for new forum
if ($posting_data['topic_type'] != POST_GLOBAL) {
$sql = 'SELECT topic_type, forum_id
FROM ' . FORUMS_TOPICS_TABLE . "\n\t\t\t\tWHERE topic_id = {$topic_id}";
$result = $_CLASS['core_db']->query_limit($sql, 1);
$row = $_CLASS['core_db']->fetch_row_assoc($result);
if ($row && !$row['forum_id'] && $row['topic_type'] == POST_GLOBAL) {
$to_forum_id = request_var('to_forum_id', 0);
if (!$to_forum_id) {
$_CLASS['core_template']->assign_array(array('S_FORUM_SELECT' => make_forum_select(false, false, false, true, true), 'S_UNGLOBALISE' => true));
$submit = false;
$refresh = true;
} else {
$forum_id = $to_forum_id;
}
}
}
if ($submit) {
// Lock/Unlock Topic
$change_topic_status = $posting_data['topic_status'];
$perm_lock_unlock = $_CLASS['auth']->acl_get('m_lock', $forum_id) || $_CLASS['auth']->acl_get('f_user_lock', $forum_id) && $_CLASS['core_user']->is_user && $_CLASS['core_user']->data['user_id'] == $topic_poster;
if ($posting_data['topic_status'] == ITEM_LOCKED && !$topic_lock && $perm_lock_unlock) {
$change_topic_status = ITEM_UNLOCKED;
} else {
if ($posting_data['topic_status'] == ITEM_UNLOCKED && $topic_lock && $perm_lock_unlock) {
示例13: display_mask
/**
* Display permission mask (assign to template)
*/
function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)
{
global $template, $user, $db, $phpbb_root_path, $phpEx;
// Define names for template loops, might be able to be set
$tpl_pmask = 'p_mask';
$tpl_fmask = 'f_mask';
$tpl_category = 'category';
$tpl_mask = 'mask';
$l_acl_type = isset($user->lang['ACL_TYPE_' . ($local ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)]) ? $user->lang['ACL_TYPE_' . ($local ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . ($local ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type);
// Allow trace for viewing permissions and in user mode
$show_trace = $mode == 'view' && $user_mode == 'user' ? true : false;
// Get names
if ($user_mode == 'user') {
$sql = 'SELECT user_id as ug_id, username as ug_name
FROM ' . USERS_TABLE . '
WHERE user_id IN (' . implode(', ', array_keys($hold_ary)) . ')
ORDER BY username ASC';
} else {
$sql = 'SELECT group_id as ug_id, group_name as ug_name, group_type
FROM ' . GROUPS_TABLE . '
WHERE group_id IN (' . implode(', ', array_keys($hold_ary)) . ')
ORDER BY group_type DESC, group_name ASC';
}
$result = $db->sql_query($sql);
$ug_names_ary = array();
while ($row = $db->sql_fetchrow($result)) {
$ug_names_ary[$row['ug_id']] = $user_mode == 'user' ? $row['ug_name'] : ($row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['ug_name']] : $row['ug_name']);
}
$db->sql_freeresult($result);
// Get used forums
$forum_ids = array();
foreach ($hold_ary as $ug_id => $row) {
$forum_ids = array_merge($forum_ids, array_keys($row));
}
$forum_ids = array_unique($forum_ids);
$forum_names_ary = array();
if ($local) {
$forum_names_ary = make_forum_select(false, false, true, false, false, true);
} else {
$forum_names_ary[0] = $l_acl_type;
}
// Get available roles
$sql = 'SELECT *
FROM ' . ACL_ROLES_TABLE . "\n\t\t\tWHERE role_type = '" . $db->sql_escape($permission_type) . "'\n\t\t\tORDER BY role_order ASC";
$result = $db->sql_query($sql);
$roles = array();
while ($row = $db->sql_fetchrow($result)) {
$roles[$row['role_id']] = $row;
}
$db->sql_freeresult($result);
$cur_roles = $this->acl_role_data($user_mode, $permission_type, array_keys($hold_ary));
// Build js roles array (role data assignments)
$s_role_js_array = '';
if (sizeof($roles)) {
$s_role_js_array = array();
// Make sure every role (even if empty) has its array defined
foreach ($roles as $_role_id => $null) {
$s_role_js_array[$_role_id] = "\n" . 'role_options[' . $_role_id . '] = new Array();' . "\n";
}
$sql = 'SELECT r.role_id, o.auth_option, r.auth_setting
FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o
WHERE o.auth_option_id = r.auth_option_id
AND r.role_id IN (' . implode(', ', array_keys($roles)) . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1);
if ($flag == $row['auth_option']) {
continue;
}
$s_role_js_array[$row['role_id']] .= 'role_options[' . $row['role_id'] . '][\'' . $row['auth_option'] . '\'] = ' . $row['auth_setting'] . '; ';
}
$db->sql_freeresult($result);
$s_role_js_array = implode('', $s_role_js_array);
}
$template->assign_var('S_ROLE_JS_ARRAY', $s_role_js_array);
// Now obtain memberships
$user_groups_default = $user_groups_custom = array();
if ($user_mode == 'user' && $group_display) {
$sql = 'SELECT group_id, group_name, group_type
FROM ' . GROUPS_TABLE . '
ORDER BY group_type DESC, group_name ASC';
$result = $db->sql_query($sql);
$groups = array();
while ($row = $db->sql_fetchrow($result)) {
$groups[$row['group_id']] = $row;
}
$db->sql_freeresult($result);
$memberships = group_memberships(false, array_keys($hold_ary), false);
// User is not a member of any group? Bad admin, bad bad admin...
if ($memberships) {
foreach ($memberships as $row) {
if ($groups[$row['group_id']]['group_type'] == GROUP_SPECIAL) {
$user_groups_default[$row['user_id']][] = $user->lang['G_' . $groups[$row['group_id']]['group_name']];
} else {
$user_groups_custom[$row['user_id']][] = $groups[$row['group_id']]['group_name'];
}
}
//.........这里部分代码省略.........
示例14: forum_select
/**
* forum_select() // custom forum select setup
*/
function forum_select($ignore_acl = true, $ignore_nonpost = false, $ignore_emptycat = false, $only_acl_post = false)
{
$select_ary = make_forum_select(false, false, $ignore_acl, $ignore_nonpost, $ignore_emptycat, $only_acl_post, true);
foreach ($select_ary as $f_id => $f_data) {
$select_ary[$f_id] = array('title' => $f_data['padding'] . $f_data['forum_name'], 'disabled' => $f_data['disabled']);
}
return $select_ary;
}
示例15: main
//.........这里部分代码省略.........
case 'add':
case 'edit':
if ($update) {
$forum_data['forum_flags'] = 0;
$forum_data['forum_flags'] += request_var('forum_link_track', false) ? FORUM_FLAG_LINK_TRACK : 0;
$forum_data['forum_flags'] += request_var('prune_old_polls', false) ? FORUM_FLAG_PRUNE_POLL : 0;
$forum_data['forum_flags'] += request_var('prune_announce', false) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0;
$forum_data['forum_flags'] += request_var('prune_sticky', false) ? FORUM_FLAG_PRUNE_STICKY : 0;
$forum_data['forum_flags'] += $forum_data['show_active'] ? FORUM_FLAG_ACTIVE_TOPICS : 0;
$forum_data['forum_flags'] += request_var('enable_post_review', true) ? FORUM_FLAG_POST_REVIEW : 0;
}
// Show form to create/modify a forum
if ($action == 'edit') {
$this->page_title = 'EDIT_PROJECT';
$row = $this->parent->get_forum_info($forum_id);
$old_forum_type = $row['forum_type'];
// Get the project's id name
$sql = 'SELECT project_name
FROM ' . BUGS_PROJECTS_TABLE . "\n\t\t\t\t\t\t\tWHERE forum_id = {$forum_id}";
$result = $db->sql_query($sql);
$row['project_idname'] = $db->sql_fetchfield('project_name', false, $result);
$db->sql_freeresult($result);
if (!$update) {
$forum_data = $row;
} else {
$forum_data['left_id'] = $row['left_id'];
$forum_data['right_id'] = $row['right_id'];
}
// Make sure no direct child forums are able to be selected as parents.
$exclude_forums = array();
foreach (get_forum_branch($forum_id, 'children') as $row) {
$exclude_forums[] = $row['forum_id'];
}
$parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false);
$forum_data['forum_password_confirm'] = $forum_data['forum_password'];
} else {
$this->page_title = 'CREATE_PROJECT';
$forum_id = BUGS_FORUM_ID;
// Fill forum data with default values
if (!$update) {
$forum_data = array('parent_id' => BUGS_FORUM_ID, 'forum_type' => FORUM_POST, 'forum_status' => ITEM_UNLOCKED, 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), 'project_idname' => '', 'forum_link' => '', 'forum_link_track' => false, 'forum_desc' => '', 'forum_rules' => '', 'forum_rules_link' => '', 'forum_image' => '', 'forum_style' => 0, 'display_on_index' => false, 'forum_topics_per_page' => 0, 'enable_indexing' => true, 'enable_icons' => false, 'enable_prune' => false, 'prune_days' => 7, 'prune_viewed' => 7, 'prune_freq' => 1, 'forum_flags' => FORUM_FLAG_POST_REVIEW, 'forum_password' => '', 'forum_password_confirm' => '');
}
}
$forum_rules_data = array('text' => $forum_data['forum_rules'], 'allow_bbcode' => true, 'allow_smilies' => true, 'allow_urls' => true);
$forum_desc_data = array('text' => $forum_data['forum_desc'], 'allow_bbcode' => true, 'allow_smilies' => true, 'allow_urls' => true);
$forum_rules_preview = '';
// Parse rules if specified
if ($forum_data['forum_rules']) {
if (!isset($forum_data['forum_rules_uid'])) {
// Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
$forum_data['forum_rules_uid'] = '';
$forum_data['forum_rules_bitfield'] = '';
$forum_data['forum_rules_options'] = 0;
generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smilies', false));
}
// Generate preview content
$forum_rules_preview = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']);
// decode...
$forum_rules_data = generate_text_for_edit($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_options']);
}
// Parse desciption if specified
if ($forum_data['forum_desc']) {
if (!isset($forum_data['forum_desc_uid'])) {
// Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
$forum_data['forum_desc_uid'] = '';
$forum_data['forum_desc_bitfield'] = '';