aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-01-22 13:06:13 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-01-22 13:06:13 +0000
commitec959d00014ba92466b676e0a32d662e629825e5 (patch)
tree2b8c6998576ff33af61c5263c6f5a2cab43697f6 /phpBB/includes/functions_admin.php
parent0650bd4d0d62343b1c137c865bcb8f91468a33d0 (diff)
downloadforums-ec959d00014ba92466b676e0a32d662e629825e5.tar
forums-ec959d00014ba92466b676e0a32d662e629825e5.tar.gz
forums-ec959d00014ba92466b676e0a32d662e629825e5.tar.bz2
forums-ec959d00014ba92466b676e0a32d662e629825e5.tar.xz
forums-ec959d00014ba92466b676e0a32d662e629825e5.zip
- size select fix
- introduced function for building group options (acp) - fixed acl_getf if negated option needs to be retrieved - only using one function for updating post informations - fixing module display if module is disabled - if user is having a non-existent style do not print out error message, instead fix the users value and load the default style git-svn-id: file:///svn/phpbb/trunk@5486 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php115
1 files changed, 27 insertions, 88 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 980880874d..73869dcb88 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -178,24 +178,45 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl =
/**
* Generate size select form
*/
-function size_select($select_name, $size_compare)
+function size_select_options($size_compare)
{
global $user;
$size_types_text = array($user->lang['BYTES'], $user->lang['KB'], $user->lang['MB']);
$size_types = array('b', 'kb', 'mb');
- $select_field = '<select name="' . $select_name . '">';
-
+ $s_size_options = '';
+
for ($i = 0, $size = sizeof($size_types_text); $i < $size; $i++)
{
$selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : '';
- $select_field .= '<option value="' . $size_types[$i] . '"' . $selected . '>' . $size_types_text[$i] . '</option>';
+ $s_size_options .= '<option value="' . $size_types[$i] . '"' . $selected . '>' . $size_types_text[$i] . '</option>';
}
- $select_field .= '</select>';
+ return $s_size_options;
+}
+
+/**
+* Generate list of groups
+*/
+function group_select_options($group_id)
+{
+ global $db, $user;
- return ($select_field);
+ $sql = 'SELECT group_id, group_name, group_type
+ FROM ' . GROUPS_TABLE . '
+ ORDER BY group_type DESC, group_name ASC';
+ $result = $db->sql_query($sql);
+
+ $s_group_options = '';
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $selected = ($row['group_id'] == $group_id) ? ' selected="selected"' : '';
+ $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
+ }
+ $db->sql_freeresult($result);
+
+ return $s_group_options;
}
/**
@@ -2061,88 +2082,6 @@ function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limi
}
/**
-* Update Post Informations (First/Last Post in topic/forum)
-* Should be used instead of sync() if only the last post informations are out of sync... faster
-*/
-function update_post_information($type, $ids)
-{
- global $db;
-
- if (!is_array($ids))
- {
- $ids = array($ids);
- }
-
- $update_sql = $empty_forums = array();
-
- $sql = 'SELECT ' . $type . '_id, MAX(post_id) as last_post_id
- FROM ' . POSTS_TABLE . "
- WHERE post_approved = 1
- AND {$type}_id IN (" . implode(', ', $ids) . ")
- GROUP BY {$type}_id";
- $result = $db->sql_query($sql);
-
- $last_post_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- if ($type == 'forum')
- {
- $empty_forums[] = $row['forum_id'];
- }
-
- $last_post_ids[] = $row['last_post_id'];
- }
- $db->sql_freeresult($result);
-
- if ($type == 'forum')
- {
- $empty_forums = array_diff($ids, $empty_forums);
-
- foreach ($empty_forums as $void => $forum_id)
- {
- $update_sql[$forum_id][] = 'forum_last_post_id = 0';
- $update_sql[$forum_id][] = 'forum_last_post_time = 0';
- $update_sql[$forum_id][] = 'forum_last_poster_id = 0';
- $update_sql[$forum_id][] = "forum_last_poster_name = ''";
- }
- }
-
- if (sizeof($last_post_ids))
- {
- $sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_time, p.poster_id, p.post_username, u.user_id, u.username
- FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
- WHERE p.poster_id = u.user_id
- AND p.post_id IN (' . implode(', ', $last_post_ids) . ')';
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $update_sql[$row["{$type}_id"]][] = $type . '_last_post_id = ' . (int) $row['post_id'];
- $update_sql[$row["{$type}_id"]][] = $type . '_last_post_time = ' . (int) $row['post_time'];
- $update_sql[$row["{$type}_id"]][] = $type . '_last_poster_id = ' . (int) $row['poster_id'];
- $update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'";
- }
- $db->sql_freeresult($result);
- }
- unset($empty_forums, $ids, $last_post_ids);
-
- if (!sizeof($update_sql))
- {
- return;
- }
-
- $table = ($type == 'forum') ? FORUMS_TABLE : TOPICS_TABLE;
-
- foreach ($update_sql as $update_id => $update_sql_ary)
- {
- $sql = "UPDATE $table
- SET " . implode(', ', $update_sql_ary) . "
- WHERE {$type}_id = $update_id";
- $db->sql_query($sql);
- }
-}
-
-/**
* Get database size
* Currently only mysql and mssql are supported
*/