From 8bb5de9861e30160bac90ae8ba78497fe2c207de Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Thu, 13 Mar 2003 12:14:48 +0000 Subject: [PATCH] New directory name git-svn-id: file:///svn/phpbb/trunk@3646 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_ban.php | 578 +++++++++++++ phpBB/adm/admin_board.php | 580 +++++++++++++ phpBB/adm/admin_database.php | 1123 +++++++++++++++++++++++++ phpBB/adm/admin_disallow.php | 165 ++++ phpBB/adm/admin_email.php | 186 ++++ phpBB/adm/admin_forums.php | 1038 +++++++++++++++++++++++ phpBB/adm/admin_groups.php | 911 ++++++++++++++++++++ phpBB/adm/admin_icons.php | 757 +++++++++++++++++ phpBB/adm/admin_permissions.php | 962 +++++++++++++++++++++ phpBB/adm/admin_prune.php | 203 +++++ phpBB/adm/admin_prune_users.php | 260 ++++++ phpBB/adm/admin_ranks.php | 270 ++++++ phpBB/adm/admin_search.php | 327 +++++++ phpBB/adm/admin_styles.php | 361 ++++++++ phpBB/adm/admin_users.php | 361 ++++++++ phpBB/adm/admin_viewlogs.php | 254 ++++++ phpBB/adm/admin_words.php | 229 +++++ phpBB/adm/forms.css | 13 + phpBB/adm/images/cellpic1.gif | Bin 0 -> 246 bytes phpBB/adm/images/cellpic3.gif | Bin 0 -> 257 bytes phpBB/adm/images/header_bg.jpg | Bin 0 -> 385 bytes phpBB/adm/images/header_left.jpg | Bin 0 -> 6741 bytes phpBB/adm/images/icon_folder.gif | Bin 0 -> 677 bytes phpBB/adm/images/icon_folder_lock.gif | Bin 0 -> 673 bytes phpBB/adm/images/icon_subfolder.gif | Bin 0 -> 1410 bytes phpBB/adm/index.php | 521 ++++++++++++ phpBB/adm/pagestart.php | 181 ++++ phpBB/adm/subSilver.css | 187 ++++ phpBB/adm/swatch.php | 56 ++ 29 files changed, 9523 insertions(+) create mode 100644 phpBB/adm/admin_ban.php create mode 100644 phpBB/adm/admin_board.php create mode 100644 phpBB/adm/admin_database.php create mode 100644 phpBB/adm/admin_disallow.php create mode 100644 phpBB/adm/admin_email.php create mode 100644 phpBB/adm/admin_forums.php create mode 100644 phpBB/adm/admin_groups.php create mode 100644 phpBB/adm/admin_icons.php create mode 100644 phpBB/adm/admin_permissions.php create mode 100644 phpBB/adm/admin_prune.php create mode 100644 phpBB/adm/admin_prune_users.php create mode 100644 phpBB/adm/admin_ranks.php create mode 100644 phpBB/adm/admin_search.php create mode 100644 phpBB/adm/admin_styles.php create mode 100644 phpBB/adm/admin_users.php create mode 100644 phpBB/adm/admin_viewlogs.php create mode 100644 phpBB/adm/admin_words.php create mode 100644 phpBB/adm/forms.css create mode 100644 phpBB/adm/images/cellpic1.gif create mode 100644 phpBB/adm/images/cellpic3.gif create mode 100644 phpBB/adm/images/header_bg.jpg create mode 100644 phpBB/adm/images/header_left.jpg create mode 100644 phpBB/adm/images/icon_folder.gif create mode 100644 phpBB/adm/images/icon_folder_lock.gif create mode 100644 phpBB/adm/images/icon_subfolder.gif create mode 100644 phpBB/adm/index.php create mode 100644 phpBB/adm/pagestart.php create mode 100644 phpBB/adm/subSilver.css create mode 100644 phpBB/adm/swatch.php diff --git a/phpBB/adm/admin_ban.php b/phpBB/adm/admin_ban.php new file mode 100644 index 0000000000..71b58cdd00 --- /dev/null +++ b/phpBB/adm/admin_ban.php @@ -0,0 +1,578 @@ +acl_get('a_ban')) + { + return; + } + + $filename = basename(__FILE__); + $module['USER']['BAN_USERS'] = $filename . "$SID&mode=user"; + $module['USER']['BAN_EMAILS'] = $filename . "$SID&mode=email"; + $module['USER']['BAN_IPS'] = $filename . "$SID&mode=ip"; + + return; +} + +// Load default header +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Do we have ban permissions? +if (!$auth->acl_get('a_ban')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Mode setting +if (isset($_POST['mode']) || isset($_GET['mode'])) +{ + $mode = (isset($_POST['mode'])) ? $_POST['mode'] : $_GET['mode']; +} +else +{ + $mode = ''; +} + +$current_time = time(); + +// Start program +if (isset($_POST['bansubmit']) || isset($_GET['bansubmit'])) +{ + $ban = (!empty($_POST['ban'])) ? $_POST['ban'] : $_GET['ban']; + $ban_list = array_unique(explode("\n", $ban)); + $ban_list_log = implode(', ', $ban_list); + + $ban_exclude = (!empty($_POST['banexclude'])) ? 1 : 0; + $ban_reason = (isset($_POST['banreason'])) ? $_POST['banreason'] : ''; + + if (!empty($_POST['banlength'])) + { + if ($_POST['banlength'] != -1 || empty($_POST['banlengthother'])) + { + $ban_end = max($current_time, $current_time + (intval($_POST['banlength']) * 60)); + } + else + { + $ban_other = explode('-', $_POST['banlengthother']); + $ban_end = max($current_time, gmmktime(0, 0, 0, $ban_other[1], $ban_other[2], $ban_other[0])); + } + } + else + { + $ban_end = 0; + } + + $banlist = array(); + + switch ($mode) + { + case 'user': + $type = 'ban_userid'; + + $banlist_tmp = array(); + for($i = 0; $i < count($ban_list); $i++) + { + if (trim($ban_list[$i]) != '') + { + $banlist_tmp[] = '\'' . trim($ban_list[$i]) . '\''; + } + } + + $sql = "SELECT user_id + FROM " . USERS_TABLE . " + WHERE username IN (" . implode(', ', $banlist_tmp) . ")"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $banlist[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + } + unset($banlist_tmp); + break; + + case 'ip': + $type = 'ban_ip'; + + for($i = 0; $i < count($ban_list); $i++) + { + if (preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ban_list[$i]), $ip_range_explode)) + { + // Don't ask about all this, just don't ask ... ! + $ip_1_counter = $ip_range_explode[1]; + $ip_1_end = $ip_range_explode[5]; + + while ($ip_1_counter <= $ip_1_end) + { + $ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0; + $ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6]; + + if($ip_2_counter == 0 && $ip_2_end == 254) + { + $ip_2_counter = 256; + $ip_2_fragment = 256; + + $banlist[] = "'$ip_1_counter.*'"; + } + + while ($ip_2_counter <= $ip_2_end) + { + $ip_3_counter = ($ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[3] : 0; + $ip_3_end = ($ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[7]; + + if ($ip_3_counter == 0 && $ip_3_end == 254) + { + $ip_3_counter = 256; + $ip_3_fragment = 256; + + $banlist[] = "'$ip_1_counter.$ip_2_counter.*'"; + } + + while ($ip_3_counter <= $ip_3_end) + { + $ip_4_counter = ($ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[4] : 0; + $ip_4_end = ($ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end) ? 254 : $ip_range_explode[8]; + + if ($ip_4_counter == 0 && $ip_4_end == 254) + { + $ip_4_counter = 256; + $ip_4_fragment = 256; + + $banlist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.*'"; + } + + while ($ip_4_counter <= $ip_4_end) + { + $banlist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter'"; + $ip_4_counter++; + } + $ip_3_counter++; + } + $ip_2_counter++; + } + $ip_1_counter++; + } + } + else if (preg_match('/^([\w\-_]\.?){2,}$/is', trim($ban_list[$i]))) + { + $ip = gethostbynamel(trim($ban_list[$i])); + + for($j = 0; $j < count($ip); $j++) + { + if (!empty($ip[$j])) + { + $banlist[] = '\'' . $ip[$j] . '\''; + } + } + } + else if (preg_match('/^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$/', trim($ban_list[$i])) || preg_match('/^[a-f0-9:]+\*?$/i', trim($ban_list[$i]))) + { + $banlist[] = '\'' . trim($ban_list[$i]) . '\''; + } + } + break; + + case 'email': + $type = 'ban_email'; + + for($i = 0; $i < count($ban_list); $i++) + { + // This ereg match is based on one by php@unreelpro.com + // contained in the annotated php manual at php.com (ereg + // section) + if (eregi('^(([[:alnum:]\*]+([-_.][[:alnum:]\*]+)*\.?)|(\*))@([[:alnum:]]+([-_]?[[:alnum:]]+)*\.){1,3}([[:alnum:]]{2,6})$', trim($ban_list[$i]))) + { + $banlist[] = '\'' . trim($ban_list[$i]) . '\''; + } + } + break; + } + + $sql = "SELECT $type + FROM " . BANLIST_TABLE . " + WHERE $type <> '' + AND ban_exclude = $ban_exclude"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $banlist_tmp = array(); + do + { + switch ($mode) + { + case 'user': + $banlist_tmp[] = $row['ban_userid']; + break; + + case 'ip': + $banlist_tmp[] = '\'' . $row['ban_ip'] . '\''; + break; + + case 'email': + $banlist_tmp[] = '\'' . $row['ban_email'] . '\''; + break; + } + } + while ($row = $db->sql_fetchrow($result)); + + $banlist = array_unique(array_diff($banlist, $banlist_tmp)); + unset($banlist_tmp); + } + + if (sizeof($banlist)) + { + for($i = 0; $i < count($banlist); $i++) + { + $sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason) + VALUES (" . $banlist[$i] . ", $current_time, $ban_end, $ban_exclude, '$ban_reason')"; + $db->sql_query($sql); + } + + if (!$ban_exclude) + { + $sql = ''; + switch ($mode) + { + case 'user': + $sql = "WHERE session_user_id IN (" . implode(', ', $banlist) . ")"; + break; + + case 'ip': + $sql = "WHERE session_ip IN (" . implode(', ', $banlist) . ")"; + break; + + case 'email': + $sql = "SELECT user_id + FROM " . USERS_TABLE . " + WHERE user_email IN (" . implode(', ', $banlist) . ")"; + $result = $db->sql_query($sql); + + $sql = ''; + if ($row = $db->sql_fetchrow($result)) + { + do + { + $sql .= (($sql != '') ? ', ' : '') . $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $sql = "WHERE session_user_id IN (" . str_replace('*', '%', $sql) . ")"; + } + break; + } + + if ($sql != '') + { + $sql = "DELETE FROM " . SESSIONS_TABLE . " + $sql"; + $db->sql_query($sql); + } + } + + // Update log + $log_entry = ($ban_exclude) ? 'LOG_BAN_EXCLUDE_' : 'log_ban_'; + add_log('admin', $log_entry . $mode, $ban_reason, $ban_list_log); + } + + trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']); + +} +else if (isset($_POST['unbansubmit'])) +{ + $unban_sql = ''; + for($i = 0; $i < count($_POST['unban']); $i++) + { + $unban_sql .= (($unban_sql != '') ? ', ' : '') . intval($_POST['unban'][$i]); + } + + if ($unban_sql != '') + { + $sql = "DELETE FROM " . BANLIST_TABLE . " + WHERE ban_id IN ($unban_sql)"; + $db->sql_query($sql); + + add_log('admin', 'log_unban_' . $mode, sizeof($_POST['unban'])); + } + + trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']); +} + +// +// Output relevant entry page +// + +// +// Remove timed out bans +// +$sql = "DELETE FROM " . BANLIST_TABLE . " + WHERE ban_end < " . time() . " + AND ban_end <> 0"; +$db->sql_query($sql); + +// +// Ban length options +// +$ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['OTHER'] . ' -> '); + +$ban_end_options = ''; +foreach ($ban_end_text as $length => $text) +{ + $ban_end_options .= ''; +} + +// +// Title +// +switch ($mode) +{ + case 'user': + $l_title = $user->lang['BAN_USERS']; + break; + case 'email': + $l_title = $user->lang['BAN_EMAILS']; + break; + case 'ip': + $l_title = $user->lang['BAN_IPS']; + break; +} + +// +// Output page +// +page_header($l_title); + +?> + +

lang['BAN_EXPLAIN']; ?>

+ +lang['BAN_USERS']; + $l_ban_explain = $user->lang['BAN_USERNAME_EXPLAIN']; + $l_ban_exclude_explain = $user->lang['BAN_USER_EXCLUDE_EXPLAIN']; + $l_unban_title = $user->lang['UNBAN_USERNAME']; + $l_unban_explain = $user->lang['UNBAN_USERNAME_EXPLAIN']; + $l_ban_cell = $user->lang['USERNAME']; + $l_no_ban_cell = $user->lang['NO_BANNED_USERS']; + $s_submit_extra = ''; + + $sql = "SELECT b.*, u.user_id, u.username + FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u + WHERE (b.ban_end >= " . time() . " + OR b.ban_end = 0) + AND u.user_id = b.ban_userid + AND b.ban_userid <> 0 + AND u.user_id <> " . ANONYMOUS . " + ORDER BY u.user_id ASC"; + break; + + case 'ip': + + $field = 'ban_ip'; + $l_ban_title = $user->lang['BAN_IPS']; + $l_ban_explain = $user->lang['BAN_IP_EXPLAIN']; + $l_ban_exclude_explain = $user->lang['BAN_IP_EXCLUDE_EXPLAIN']; + $l_unban_title = $user->lang['UNBAN_IP']; + $l_unban_explain = $user->lang['UNBAN_IP_EXPLAIN']; + $l_ban_cell = $user->lang['IP_HOSTNAME']; + $l_no_ban_cell = $user->lang['NO_BANNED_IP']; + $s_submit_extra = ''; + + $sql = "SELECT * + FROM " . BANLIST_TABLE . " + WHERE (ban_end >= " . time() . " + OR ban_end = 0) + AND ban_ip <> ''"; + break; + + case 'email': + + $field = 'ban_email'; + $l_ban_title = $user->lang['BAN_EMAILS']; + $l_ban_explain = $user->lang['BAN_EMAIL_EXPLAIN']; + $l_ban_exclude_explain = $user->lang['BAN_EMAIL_EXCLUDE_EXPLAIN']; + $l_unban_title = $user->lang['UNBAN_EMAIL']; + $l_unban_explain = $user->lang['UNBAN_EMAIL_EXPLAIN']; + $l_ban_cell = $user->lang['EMAIL_ADDRESS']; + $l_no_ban_cell = $user->lang['NO_BANNED_EMAIL']; + $s_submit_extra = ''; + + $sql = "SELECT * + FROM " . BANLIST_TABLE . " + WHERE (ban_end >= " . time() . " + OR ban_end = 0) + AND ban_email <> ''"; + break; +} +$result = $db->sql_query($sql); + +$banned_options = ''; +$ban_length = $ban_reasons = array(); +if ($row = $db->sql_fetchrow($result)) +{ + do + { + + $banned_options .= '' . $row[$field] . ''; + + $time_length = (!empty($row['ban_end'])) ? ($row['ban_end'] - $row['ban_start']) / 60 : 0; + $ban_length[$row['ban_id']] = (!empty($ban_end_text[$time_length])) ? $ban_end_text[$time_length] : $user->lang['OTHER'] . ' -> ' . gmdate('Y-m-d', $row['ban_end']); + + $ban_reasons[$row['ban_id']] = addslashes($row['ban_reason']); + } + while ($row = $db->sql_fetchrow($result)); +} +$db->sql_freeresult($result); + +?> + +

+ +

+ + + +
"> + + + + + + + + + + + + + + + + + + + + + + +
:
lang['BAN_LENGTH']; ?>: 
lang['BAN_EXCLUDE']; ?>:
lang['YES']; ?>   lang['NO']; ?>
lang['BAN_REASON']; ?>:
   
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
:
lang['BAN_REASON']; ?>:
lang['BAN_LENGTH']; ?>:
 
+ + \ No newline at end of file diff --git a/phpBB/adm/admin_board.php b/phpBB/adm/admin_board.php new file mode 100644 index 0000000000..4dec8bdbf5 --- /dev/null +++ b/phpBB/adm/admin_board.php @@ -0,0 +1,580 @@ +acl_get('a_cookies')) ? "$file$SID&mode=cookie" : ''; + $module['GENERAL']['BOARD_DEFAULTS'] = ($auth->acl_get('a_defaults')) ? "$file$SID&mode=default" : ''; + $module['GENERAL']['BOARD_SETTINGS'] = ($auth->acl_get('a_board')) ? "$file$SID&mode=setting" : ''; + $module['GENERAL']['AVATAR_SETTINGS'] = ($auth->acl_get('a_board')) ? "$file$SID&mode=avatar" : ''; + $module['GENERAL']['EMAIL_SETTINGS'] = ($auth->acl_get('a_server')) ? "$file$SID&mode=email" : ''; + $module['GENERAL']['SERVER_SETTINGS'] = ($auth->acl_get('a_server')) ? "$file$SID&mode=server" : ''; + $module['GENERAL']['AUTH_SETTINGS'] = ($auth->acl_get('a_server')) ? "$file$SID&mode=auth" : ''; + return; +} + +define('IN_PHPBB', 1); +// Load default header +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Get mode +$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; + +// Check permissions/set title +switch ($mode) +{ + case 'cookie': + $l_title = 'COOKIE_SETTINGS'; + $which_auth = 'a_cookies'; + break; + case 'default': + $l_title = 'BOARD_DEFAULTS'; + $which_auth = 'a_defaults'; + break; + case 'avatar': + $l_title = 'AVATAR_SETTINGS'; + $which_auth = 'a_board'; + break; + case 'setting': + $l_title = 'BOARD_SETTINGS'; + $which_auth = 'a_board'; + break; + case 'email': + $l_title = 'EMAIL_SETTINGS'; + $which_auth = 'a_server'; + break; + case 'server': + $l_title = 'SERVER_SETTINGS'; + $which_auth = 'a_server'; + break; + case 'auth': + $l_title = 'AUTH_SETTINGS'; + $which_auth = 'a_server'; + break; + default: + return; +} + +// Check permissions +if (!$auth->acl_get($which_acl)) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Pull all config data +$sql = "SELECT * + FROM " . CONFIG_TABLE; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $config_name = $row['config_name']; + $config_value = $row['config_value']; + + $default_config[$config_name] = $config_value; + $new[$config_name] = (isset($_POST[$config_name])) ? $_POST[$config_name] : $default_config[$config_name]; + + if (isset($_POST['submit'])) + { + set_config($config_name, stripslashes($new[$config_name])); + } +} + +if (isset($_POST['submit'])) +{ + add_log('admin', 'log_' . $mode . '_config'); + trigger_error($user->lang['Config_updated']); +} + +page_header($user->lang[$l_title]); + +?> + +

lang[$l_title]; ?>

+ +

lang[$l_title . '_EXPLAIN']; ?>

+ +
" method="post"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +' . ucfirst($method) . ''; + } + +?> + + + + + + + + +
lang[$l_title]; ?>
lang['Cookie_domain']; ?>:
lang['Cookie_name']; ?>:
lang['Cookie_path']; ?>:
lang['Cookie_secure']; ?>:
lang['Cookie_secure_explain']; ?>
/>lang['DISABLED']; ?>    />lang['ENABLED']; ?>
lang['Allow_local']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Allow_remote']; ?>:
lang['Allow_remote_explain']; ?>
/> lang['YES']; ?>   /> lang['NO']; ?>
lang['Allow_upload']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Max_filesize']; ?>:
lang['Max_filesize_explain']; ?>
Bytes
lang['Max_avatar_size']; ?>:
lang['Max_avatar_size_explain']; ?>
x
lang['Avatar_storage_path']; ?>:
lang['Avatar_storage_path_explain']; ?>
lang['Avatar_gallery_path']; ?>:
lang['Avatar_gallery_path_explain']; ?>
lang['Default_style']; ?>
lang['Override_style']; ?>:
lang['Override_style_explain']; ?>
/> lang['YES']; ?>   /> lang['NO']; ?>
lang['Default_language']; ?>:
lang['Date_format']; ?>:
lang['Date_format_explain']; ?>
lang['System_timezone']; ?>:
lang['Char_limit']; ?>:
lang['Char_limit_explain']; ?> +
lang['Smilies_limit']; ?>:
lang['Smilies_limit_explain']; ?> +
lang['Allow_topic_notify']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Allow_forum_notify']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Allow_name_change']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Allow_HTML']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Allowed_tags']; ?>:
lang['Allowed_tags_explain']; ?>
lang['Allow_BBCode']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Allow_smilies']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Allow_sig']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Max_sig_length']; ?>:
lang['Max_sig_length_explain']; ?>
lang['Site_name']; ?>:
lang['Site_desc']; ?>:
lang['Board_disable']; ?>:
lang['Board_disable_explain']; ?>
/> lang['YES']; ?>   /> lang['NO']; ?>
lang['Enable_prune']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Acct_activation']; ?>:
lang['Acct_activation_explain']; ?>
/>lang['Acc_None']; ?>    />lang['Acc_User']; ?>    />lang['Acc_Admin']; ?>    />lang['Acc_Disable']; ?>
lang['VISUAL_CONFIRM']; ?>:
lang['VISUAL_CONFIRM_EXPLAIN']; ?>
/>lang['YES'] ?>    /> lang['NO']; ?>
lang['Enable_COPPA']; ?>:
lang['Enable_COPPA_explain']; ?>
/> lang['YES']; ?>   /> lang['NO']; ?>
lang['COPPA_fax']; ?>:
lang['COPPA_mail']; ?>:
lang['COPPA_mail_explain']; ?>
lang['Private_Messaging']; ?>: />lang['ENABLED']; ?>    />lang['DISABLED']; ?>
lang['Boxes_max']; ?>:
lang['Boxes_max_explain']; ?>
lang['Edit_time']; ?>:
lang['Edit_time_explain']; ?>
lang['Flood_Interval']; ?>:
lang['Flood_Interval_explain']; ?>
lang['Search_Interval']; ?>:
lang['Search_Interval_explain']; ?>
lang['Min_search_chars']; ?>:
lang['Min_search_chars_explain']; ?> +
lang['Max_search_chars']; ?>:
lang['Max_search_chars_explain']; ?> +
lang['Topics_per_page']; ?>:
lang['Posts_per_page']; ?>:
lang['Hot_threshold']; ?>:
lang['Max_poll_options']; ?>:
lang['Enable_email']; ?>:
lang['Enable_email_explain']; ?>
/> lang['ENABLED']; ?>   /> lang['DISABLED']; ?>
lang['Board_email_form']; ?>:
lang['Board_email_form_explain']; ?>
/> lang['ENABLED']; ?>   /> lang['DISABLED']; ?>
lang['Admin_email']; ?>:
lang['Email_sig']; ?>:
lang['Email_sig_explain']; ?>
lang['Use_SMTP']; ?>:
lang['Use_SMTP_explain']; ?>
/> lang['YES']; ?>   /> lang['NO']; ?>
lang['SMTP_server']; ?>:
lang['SMTP_PORT']; ?>:
lang['SMTP_PORT_EXPLAIN']; ?>
lang['SMTP_username']; ?>:
lang['SMTP_username_explain']; ?>
lang['SMTP_password']; ?>:
lang['SMTP_password_explain']; ?>
lang['Server_name']; ?>:
lang['Server_name_explain']; ?>
lang['Server_port']; ?>:
lang['Server_port_explain']; ?>
lang['Script_path']; ?>:
lang['Script_path_explain']; ?>
lang['IP_valid']; ?>:
lang['IP_valid_explain']; ?>
/> lang['All']; ?>   /> lang['Class_C']; ?>   /> lang['Class_B']; ?>   /> lang['NONE']; ?>  
lang['Limit_load']; ?>:
lang['Limit_load_explain']; ?>
lang['Session_length']; ?>:
lang['Limit_sessions']; ?>:
lang['Limit_sessions_explain']; ?>
lang['Enable_gzip']; ?>: /> lang['YES']; ?>   /> lang['NO']; ?>
lang['Smilies_path']; ?>:
lang['Smilies_path_explain']; ?>
lang['Icons_path']; ?>:
lang['Icons_path_explain']; ?>
lang['Auth_method']; ?>:
  
+ + \ No newline at end of file diff --git a/phpBB/adm/admin_database.php b/phpBB/adm/admin_database.php new file mode 100644 index 0000000000..6c07995c5e --- /dev/null +++ b/phpBB/adm/admin_database.php @@ -0,0 +1,1123 @@ +acl_get('a_backup')) ? $filename . "$SID&mode=backup" : ''; + + $file_uploads = @ini_get('file_uploads'); + if (!empty($file_uploads) && $file_uploads !== 0 && strtolower($file_uploads) != 'off' && $auth->acl_get('a_restore')) + { + $module['DB']['DB_RESTORE'] = $filename . "$SID&mode=restore"; + } + + return; +} + +define('IN_PHPBB', 1); +// Load default header +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +$mode = (isset($_GET['mode'])) ? $_GET['mode'] : ''; + +// Increase maximum execution time, but don't complain about it if it isn't +// allowed. +@set_time_limit(1200); + +// Begin program proper +switch($mode) +{ + case 'backup': + if (!$auth->acl_get('a_backup')) + { + trigger_error($user->lang['NO_ADMIN']); + } + + if (SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql') + { + switch (SQL_LAYER) + { + case 'oracle': + $db_type = 'Oracle'; + break; + case 'odbc': + $db_type = 'ODBC'; + break; + case 'mssql': + $db_type = 'MSSQL'; + break; + } + + trigger_error($user->lang['Backups_not_supported']); + break; + } + + $additional_tables = (isset($_POST['tables'])) ? $_POST['tables'] : ((isset($_GET['tables'])) ? $_GET['tables'] : ''); + $backup_type = (isset($_POST['type'])) ? $_POST['type'] : ((isset($_GET['type'])) ? $_GET['type'] : ''); + $search = (!empty($_POST['search'])) ? intval($_POST['search']) : ((!empty($_GET['search'])) ? intval($_GET['search']) : 0); + $store_path = (isset($_POST['store'])) ? $_POST['store'] : ((isset($_GET['store'])) ? $_GET['store'] : ''); + $compress = (!empty($_POST['compress'])) ? $_POST['compress'] : ((!empty($_GET['compress'])) ? $_GET['compress'] : 'none'); + + if (!isset($_POST['backupstart']) && !isset($_GET['backupstart'])) + { + page_header($user->lang['DB_BACKUP']); + +?> + +

lang['DB_BACKUP']; ?>

+ +

lang['Backup_explain']; ?>

+ +
"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
lang['Backup_options']; ?>
lang['Backup_type']; ?>: lang['Full_backup']; ?>   lang['Structure_only']; ?>   lang['Data_only']; ?>
lang['Include_search_index']; ?>:
lang['Include_search_index_explain']; ?>
lang['NO']; ?>   lang['YES']; ?>
lang['Additional_tables']; ?>:
lang['Additional_tables_explain']; ?>
lang['Store_local']; ?>:
lang['Store_local_explain']; ?>
lang['Compress_file']; ?>: lang['NONE']; ?>  .gz  .zip  .bz2
+ +"; + + $message = (empty($store_path)) ? $user->lang['Backup_download'] : $user->lang['Backup_writing']; + + page_header($user->lang['DB_Backup'], $meta); + page_message($user->lang['DB_Backup'], $message); + page_footer(); + } + + $tables = (SQL_LAYER != 'postgresql') ? mysql_get_tables() : pg_get_tables(); + @sort($tables); + + if (!empty($additional_tables)) + { + $additional_tables = explode(',', $additional_tables); + + for($i = 0; $i < count($additional_tables); $i++) + { + $tables[] = trim($additional_tables[$i]); + } + unset($additional_tables); + } + + // + // Enable output buffering + // + @ob_start(); + @ob_implicit_flush(0); + + // + // Build the sql script file... + // + echo "#\n"; + echo "# phpBB Backup Script\n"; + echo "# Dump of tables for $dbname\n"; + echo "#\n# DATE : " . gmdate("d-m-Y H:i:s", time()) . " GMT\n"; + echo "#\n"; + + if (SQL_LAYER == 'postgresql') + { + echo "\n" . pg_get_sequences("\n", $backup_type); + } + + for($i = 0; $i < count($tables); $i++) + { + $table_name = $tables[$i]; + + if (SQL_LAYER != 'mysql4') + { + $table_def_function = "get_table_def_" . SQL_LAYER; + $table_content_function = "get_table_content_" . SQL_LAYER; + } + else + { + $table_def_function = "get_table_def_mysql"; + $table_content_function = "get_table_content_mysql"; + } + + if ($backup_type != 'data') + { + echo "#\n# TABLE: " . $table_name . "\n#\n"; + echo $table_def_function($table_name, "\n") . "\n"; + } + + if ($backup_type != 'structure') + { + // + // Skip search table data? + // + if ($search || (!$search && !preg_match('/search_word/', $table_name))) + { + $table_content_function($table_name, "output_table_content"); + } + } + } + + // + // Flush the buffer, send the file + // + switch ($compress) + { + case 'gzip': + $extension = 'sql.gz'; + $contents = gzencode(ob_get_contents()); + ob_end_clean(); + break; + + case 'zip': + $extension = 'zip'; + $zip = new zipfile; + $zip->add_file(ob_get_contents(), "phpbb_db_backup.sql", time()); + ob_end_clean(); + $contents = $zip->file(); + break; + + case 'bzip': + $extension = 'bz2'; + $contents = bzcompress(ob_get_contents()); + ob_end_clean(); + break; + + default: + $extension = 'sql'; + $contents = ob_get_contents(); + ob_end_clean(); + } + + add_log('admin', 'log_db_backup'); + + if (empty($store_path)) + { + header("Pragma: no-cache"); + header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.$extension\""); + header("Content-disposition: attachment; filename=phpbb_db_backup.$extension"); + + echo $contents; + unset($contents); + } + else + { + if (!($fp = fopen('./../' . $store_path . "/phpbb_db_backup.$extension", 'wb'))) + { + message_die(ERROR, 'Could not open backup file'); + } + + if (!fwrite($fp, $contents)) + { + message_die(ERROR, 'Could not write backup file content'); + } + + fclose($fp); + unset($contents); + + trigger_error($user->lang['Backup_success']); + } + + exit; + break; + + case 'restore': + if (!$auth->acl_get('a_restore')) + { + trigger_error($user->lang['No_admin']); + } + + if (isset($_POST['restorestart'])) + { + // + // Handle the file upload .... + // If no file was uploaded report an error... + // + if (!empty($_POST['local'])) + { + $file_tmpname = './../' . str_replace('\\\\', '/', $_POST['local']); + $filename = substr($file_tmpname, strrpos($file_tmpname, '/')); + } + else + { + $filename = (!empty($HTTP_POST_FILES['backup_file']['name'])) ? $HTTP_POST_FILES['backup_file']['name'] : ''; + $file_tmpname = ($HTTP_POST_FILES['backup_file']['tmp_name'] != 'none') ? $HTTP_POST_FILES['backup_file']['tmp_name'] : ''; + } + + if ($file_tmpname == '' || $filename == '' || !file_exists($file_tmpname)) + { + trigger_error($user->lang['Restore_Error_no_file']); + } + + $ext = substr($filename, strrpos($filename, '.') + 1); + + if (!preg_match('/^(sql|gz|bz2)$/', $ext)) + { + trigger_error($user->lang['Restore_Error_filename']); + } + + if ((!extension_loaded('zlib') && $ext == 'gz') || (!extension_loaded('zip') && $ext == 'zip') || ($ext == 'bz2' && !extension_loaded('bz2'))) + { + trigger_error($user->lang['Compress_unsupported']); + } + + $sql_query = ''; + switch ($ext) + { + case 'gz': + $fp = gzopen($file_tmpname, 'rb'); + while (!gzeof($fp)) + { + $sql_query .= gzgets($fp, 100000); + } + gzclose($fp); + break; + + case 'bz2': + $sql_query = bzdecompress(fread(fopen($file_tmpname, 'rb'), filesize($file_tmpname))); + break; + + case 'zip': + + + default; + $sql_query = fread(fopen($file_tmpname, 'r'), filesize($file_tmpname)); + } + + if ($sql_query != '') + { + // Strip out sql comments... + $sql_query = remove_remarks($sql_query); + $pieces = split_sql_file($sql_query, ';'); + + $sql_count = count($pieces); + for($i = 0; $i < $sql_count; $i++) + { + $sql = trim($pieces[$i]); + + if (!empty($sql) && $sql[0] != '#') + { + $db->sql_query($sql); + } + } + } + + add_log('admin', 'log_db_restore'); + + trigger_error($user->lang['Restore_success']); + } + + // + // Restore page + // + page_header($user->lang['DB_RESTORE']); + +?> + +

lang['DB_RESTORE']; ?>

+ +

lang['Restore_explain']; ?>

+ +
"> + + + + + + + + + + + + + +
lang['Select_file']; ?>
lang['Upload_file']; ?>:
lang['Supported_extensions']; + + $types = ': sql'; + if (extension_loaded('zlib')) + { + $types .= ', sql.gz'; + } + if (extension_loaded('bz2')) + { + $types .= ', bz2'; + } + + echo $types; + +?>
lang['Local_backup_file']; ?>:
lang['Local_backup_file_explain']; ?>
+ +lang['No_admin']); + exit; + +} + +page_footer(); + +// ----------------------------------------------- +// Begin Functions +// + +// +// Table defns (not from phpMyAdmin) +// +function mysql_get_tables() +{ + global $db, $table_prefix; + + $tables = array(); + + $result = mysql_list_tables($db->dbname, $db->db_connect_id); + if ($row = $db->sql_fetchrow($result)) + { + do + { + if (preg_match('/^' . $table_prefix . '/', $row[0])) + { + $tables[] = $row[0]; + } + } + while ($row = $db->sql_fetchrow($result)); + } + + return $tables; +} + +// +// The following functions are adapted from phpMyAdmin and upgrade_20.php +// +// This function is used for grabbing the sequences for postgres... +// +function pg_get_sequences($crlf, $backup_type) +{ + global $db; + + $get_seq_sql = "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' + AND relkind = 'S' ORDER BY relname"; + + $seq = $db->sql_query($get_seq_sql); + + if (!$num_seq = $db->sql_numrows($seq)) + { + + $return_val = "# No Sequences Found $crlf"; + + } + else + { + $return_val = "# Sequences $crlf"; + $i_seq = 0; + + while($i_seq < $num_seq) + { + $row = $db->sql_fetchrow($seq); + $sequence = $row['relname']; + + $get_props_sql = "SELECT * FROM $sequence"; + $seq_props = $db->sql_query($get_props_sql); + + if ($db->sql_numrows($seq_props) > 0) + { + $row1 = $db->sql_fetchrow($seq_props); + + if ($backup_type == 'structure') + { + $row['last_value'] = 1; + } + + $return_val .= "CREATE SEQUENCE $sequence start " . $row['last_value'] . ' increment ' . $row['increment_by'] . ' maxvalue ' . $row['max_value'] . ' minvalue ' . $row['min_value'] . ' cache ' . $row['cache_value'] . "; $crlf"; + + } // End if numrows > 0 + + if (($row['last_value'] > 1) && ($backup_type != 'structure')) + { + $return_val .= "SELECT NEXTVALE('$sequence'); $crlf"; + unset($row['last_value']); + } + + $i_seq++; + + } // End while.. + + } // End else... + + return $returnval; + +} // End function... + +// +// The following functions will return the "CREATE TABLE syntax for the +// varying DBMS's +// +// This function returns, will return the table def's for postgres... +// +function get_table_def_postgresql($table, $crlf) +{ + global $db; + + $schema_create = ""; + // + // Get a listing of the fields, with their associated types, etc. + // + + $field_query = "SELECT a.attnum, a.attname AS field, t.typname as type, a.attlen AS length, a.atttypmod as lengthvar, a.attnotnull as notnull + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum"; + $result = $db->sql_query($field_query); + + if (!$result) + { + message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $field_query); + } // end if.. + + $schema_create .= "DROP TABLE $table;$crlf"; + + // + // Ok now we actually start building the SQL statements to restore the tables + // + + $schema_create .= "CREATE TABLE $table($crlf"; + + while ($row = $db->sql_fetchrow($result)) + { + // + // Get the data from the table + // + $sql_get_default = "SELECT d.adsrc AS rowdefault + FROM pg_attrdef d, pg_class c + WHERE (c.relname = '$table') + AND (c.oid = d.adrelid) + AND d.adnum = " . $row['attnum']; + $def_res = $db->sql_query($sql_get_default); + + if (!$def_res) + { + unset($row['rowdefault']); + } + else + { + $row['rowdefault'] = @pg_result($def_res, 0, 'rowdefault'); + } + + if ($row['type'] == 'bpchar') + { + // Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement. + $row['type'] = 'char'; + } + + $schema_create .= ' ' . $row['field'] . ' ' . $row['type']; + + if (eregi('char', $row['type'])) + { + if ($row['lengthvar'] > 0) + { + $schema_create .= '(' . ($row['lengthvar'] -4) . ')'; + } + } + + if (eregi('numeric', $row['type'])) + { + $schema_create .= '('; + $schema_create .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff)); + $schema_create .= ')'; + } + + if (!empty($row['rowdefault'])) + { + $schema_create .= ' DEFAULT ' . $row['rowdefault']; + } + + if ($row['notnull'] == 't') + { + $schema_create .= ' NOT NULL'; + } + + $schema_create .= ",$crlf"; + + } + // + // Get the listing of primary keys. + // + + $sql_pri_keys = "SELECT ic.relname AS index_name, bc.relname AS tab_name, ta.attname AS column_name, i.indisunique AS unique_key, i.indisprimary AS primary_key + FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (ia.attrelid = i.indexrelid) + AND (ta.attrelid = bc.oid) + AND (bc.relname = '$table') + AND (ta.attrelid = i.indrelid) + AND (ta.attnum = i.indkey[ia.attnum-1]) + ORDER BY index_name, tab_name, column_name "; + $result = $db->sql_query($sql_pri_keys); + + if (!$result) + { + message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_pri_keys); + } + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['primary_key'] == 't') + { + if (!empty($primary_key)) + { + $primary_key .= ', '; + } + + $primary_key .= $row['column_name']; + $primary_key_name = $row['index_name']; + + } + else + { + // + // We have to store this all this info because it is possible to have a multi-column key... + // we can loop through it again and build the statement + // + $index_rows[$row['index_name']]['table'] = $table; + $index_rows[$row['index_name']]['unique'] = ($row['unique_key'] == 't') ? ' UNIQUE ' : ''; + $index_rows[$row['index_name']]['column_names'] .= $row['column_name'] . ', '; + } + } + + if (!empty($index_rows)) + { + while(list($idx_name, $props) = each($index_rows)) + { + $props['column_names'] = ereg_replace(", $", "" , $props['column_names']); + $index_create .= 'CREATE ' . $props['unique'] . " INDEX $idx_name ON $table (" . $props['column_names'] . ");$crlf"; + } + } + + if (!empty($primary_key)) + { + $schema_create .= " CONSTRAINT $primary_key_name PRIMARY KEY ($primary_key),$crlf"; + } + + // + // Generate constraint clauses for CHECK constraints + // + $sql_checks = "SELECT rcname as index_name, rcsrc + FROM pg_relcheck, pg_class bc + WHERE rcrelid = bc.oid + AND bc.relname = '$table' + AND NOT EXISTS ( + SELECT * + FROM pg_relcheck as c, pg_inherits as i + WHERE i.inhrelid = pg_relcheck.rcrelid + AND c.rcname = pg_relcheck.rcname + AND c.rcsrc = pg_relcheck.rcsrc + AND c.rcrelid = i.inhparent + )"; + $result = $db->sql_query($sql_checks); + + if (!$result) + { + message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_checks); + } + + // + // Add the constraints to the sql file. + // + while ($row = $db->sql_fetchrow($result)) + { + $schema_create .= ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['rcsrc'] . ",$crlf"; + } + + $schema_create = ereg_replace(',' . $crlf . '$', '', $schema_create); + $index_create = ereg_replace(',' . $crlf . '$', '', $index_create); + + $schema_create .= "$crlf);$crlf"; + + if (!empty($index_create)) + { + $schema_create .= $index_create; + } + + // + // Ok now we've built all the sql return it to the calling function. + // + return (stripslashes($schema_create)); + +} + +// +// This function returns the "CREATE TABLE" syntax for mysql dbms... +// +function get_table_def_mysql($table, $crlf) +{ + global $db; + + $schema_create = ""; + $field_query = "SHOW FIELDS FROM $table"; + $key_query = "SHOW KEYS FROM $table"; + + // If the user has selected to drop existing tables when doing a restore. + // Then we add the statement to drop the tables.... + $schema_create .= "DROP TABLE IF EXISTS $table;$crlf"; + $schema_create .= "CREATE TABLE $table($crlf"; + + // Ok lets grab the fields... + $result = $db->sql_query($field_query); + + while ($row = $db->sql_fetchrow($result)) + { + $schema_create .= ' ' . $row['Field'] . ' ' . $row['Type']; + + if (!empty($row['Default'])) + { + $schema_create .= ' DEFAULT \'' . $row['Default'] . '\''; + } + + if ($row['Null'] != "YES") + { + $schema_create .= ' NOT NULL'; + } + + if ($row['Extra'] != "") + { + $schema_create .= ' ' . $row['Extra']; + } + + $schema_create .= ",$crlf"; + } + // + // Drop the last ',$crlf' off ;) + // + $schema_create = ereg_replace(',' . $crlf . '$', "", $schema_create); + + // + // Get any Indexed fields from the database... + // + $result = $db->sql_query($key_query); + + while($row = $db->sql_fetchrow($result)) + { + $kname = $row['Key_name']; + + if (($kname != 'PRIMARY') && ($row['Non_unique'] == 0)) + { + $kname = "UNIQUE|$kname"; + } + + if (!is_array($index[$kname])) + { + $index[$kname] = array(); + } + + $index[$kname][] = $row['Column_name']; + } + + foreach ($index as $x => $columns) + { + $schema_create .= ", $crlf"; + + if ($x == 'PRIMARY') + { + $schema_create .= ' PRIMARY KEY (' . implode($columns, ', ') . ')'; + } + elseif (substr($x,0,6) == 'UNIQUE') + { + $schema_create .= ' UNIQUE ' . substr($x,7) . ' (' . implode($columns, ', ') . ')'; + } + else + { + $schema_create .= " KEY $x (" . implode($columns, ', ') . ')'; + } + } + + $schema_create .= "$crlf);"; + + if (get_magic_quotes_runtime()) + { + return(stripslashes($schema_create)); + } + else + { + return($schema_create); + } + +} // End get_table_def_mysql + + +// +// This fuction will return a tables create definition to be used as an sql +// statement. +// +// +// The following functions Get the data from the tables and format it as a +// series of INSERT statements, for each different DBMS... +// After every row a custom callback function $handler gets called. +// $handler must accept one parameter ($sql_insert); +// +// +// Here is the function for postgres... +// +function get_table_content_postgresql($table, $handler) +{ + global $db; + + // Grab all of the data from current table. + $result = $db->sql_query("SELECT * FROM $table"); + + $i_num_fields = $db->sql_numfields($result); + + for ($i = 0; $i < $i_num_fields; $i++) + { + $aryType[] = $db->sql_fieldtype($i, $result); + $aryName[] = $db->sql_fieldname($i, $result); + } + + $iRec = 0; + + while ($row = $db->sql_fetchrow($result)) + { + unset($schema_vals); + unset($schema_fields); + unset($schema_insert); + + // Build the SQL statement to recreate the data. + for($i = 0; $i < $i_num_fields; $i++) + { + $strVal = $row[$aryName[$i]]; + if (preg_match('#char|text|bool#i', $aryType[$i])) + { + $strQuote = "'"; + $strEmpty = ""; + $strVal = addslashes($strVal); + } + elseif (preg_match('#date|timestamp#i', $aryType[$i])) + { + if ($empty($strVal)) + { + $strQuote = ""; + } + else + { + $strQuote = "'"; + } + } + else + { + $strQuote = ""; + $strEmpty = "NULL"; + } + + if (empty($strVal) && $strVal != "0") + { + $strVal = $strEmpty; + } + + $schema_vals .= " $strQuote$strVal$strQuote,"; + $schema_fields .= " $aryName[$i],"; + } + + $schema_vals = preg_replace('#,$#', '', $schema_vals); + $schema_vals = preg_replace('#^ #', '', $schema_vals); + $schema_fields = preg_replace('#,$#', '', $schema_fields); + $schema_fields = preg_replace('#^ #', '', $schema_fields); + + // Take the ordered fields and their associated data and build it + // into a valid sql statement to recreate that field in the data. + $schema_insert = "INSERT INTO $table ($schema_fields) VALUES($schema_vals);"; + + $handler(trim($schema_insert)); + } + + return(true); + +}// end function get_table_content_postgres... + +// +// This function is for getting the data from a mysql table. +// + +function get_table_content_mysql($table, $handler) +{ + global $db; + + // Grab the data from the table. + $result = $db->sql_query("SELECT * FROM $table"); + + // Loop through the resulting rows and build the sql statement. + $schema_insert = ""; + if ($row = $db->sql_fetchrow($result)) + { + $schema_insert = "\n#\n# Table Data for $table\n#\n"; + + $handler($schema_insert); + + do + { + $table_list = '('; + $num_fields = $db->sql_numfields($result); + // + // Grab the list of field names. + // + for ($j = 0; $j < $num_fields; $j++) + { + $table_list .= $db->sql_fieldname($j, $result) . ', '; + } + // + // Get rid of the last comma + // + $table_list = preg_replace('#, $#', '', $table_list); + $table_list .= ')'; + // + // Start building the SQL statement. + // + $schema_insert = "INSERT INTO $table $table_list VALUES("; + // + // Loop through the rows and fill in data for each column + // + for ($j = 0; $j < $num_fields; $j++) + { + if (!isset($row[$j])) + { + // + // If there is no data for the column set it to null. + // There was a problem here with an extra space causing the + // sql file not to reimport if the last column was null in + // any table. Should be fixed now :) JLH + // + $schema_insert .= ' NULL,'; + } + elseif ($row[$j] != '') + { + $schema_insert .= ' \'' . addslashes($row[$j]) . '\','; + } + else + { + $schema_insert .= '\'\','; + } + } + // + // Get rid of the the last comma. + // + $schema_insert = preg_replace('#,$#', '', $schema_insert); + $schema_insert .= ');'; + // + // Go ahead and send the insert statement to the handler function. + // + $handler(trim($schema_insert)); + } + while ($row = $db->sql_fetchrow($result)); + } + + return true; +} + +function output_table_content($content) +{ + global $tempfile; + + //fwrite($tempfile, $content . "\n"); + //$backup_sql .= $content . "\n"; + echo $content ."\n"; + return; +} + + +// +// Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux, Marc Delisle +// http://www.phpmyadmin.net/ +// +// Based on work by Eric Mueller and Denis125 +// Official ZIP file format: http://www.pkware.com/appnote.txt +// +class zipfile +{ + var $datasec = array(); + var $ctrl_dir = array(); + var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; + var $old_offset = 0; + + function unix_to_dos_time($unixtime = 0) + { + $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); + + if ($timearray['year'] < 1980) + { + $timearray['year'] = 1980; + $timearray['mon'] = 1; + $timearray['mday'] = 1; + $timearray['hours'] = 0; + $timearray['minutes'] = 0; + $timearray['seconds'] = 0; + } + + return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | + ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); + } + + function add_file($data, $name, $time = 0) + { + $name = str_replace('\\', '/', $name); + + $dtime = dechex($this->unix_to_dos_time($time)); + $hexdtime = '\x' . $dtime[6] . $dtime[7] + . '\x' . $dtime[4] . $dtime[5] + . '\x' . $dtime[2] . $dtime[3] + . '\x' . $dtime[0] . $dtime[1]; + eval('$hexdtime = "' . $hexdtime . '";'); + + $fr = "\x50\x4b\x03\x04"; + $fr .= "\x14\x00"; // ver needed to extract + $fr .= "\x00\x00"; // gen purpose bit flag + $fr .= "\x08\x00"; // compression method + $fr .= $hexdtime; // last mod time and date + + $unc_len = strlen($data); + $crc = crc32($data); + $zdata = gzcompress($data); + $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug + $c_len = strlen($zdata); + $fr .= pack('V', $crc); // crc32 + $fr .= pack('V', $c_len); // compressed filesize + $fr .= pack('V', $unc_len); // uncompressed filesize + $fr .= pack('v', strlen($name)); // length of filename + $fr .= pack('v', 0); // extra field length + $fr .= $name; + + // "file data" segment + $fr .= $zdata; + + // "data descriptor" segment (optional but necessary if archive is not + // served as file) + $fr .= pack('V', $crc); // crc32 + $fr .= pack('V', $c_len); // compressed filesize + $fr .= pack('V', $unc_len); // uncompressed filesize + + // add this entry to array + $this -> datasec[] = $fr; + $new_offset = strlen(implode('', $this->datasec)); + + // now add to central directory record + $cdrec = "\x50\x4b\x01\x02"; + $cdrec .= "\x00\x00"; // version made by + $cdrec .= "\x14\x00"; // version needed to extract + $cdrec .= "\x00\x00"; // gen purpose bit flag + $cdrec .= "\x08\x00"; // compression method + $cdrec .= $hexdtime; // last mod time & date + $cdrec .= pack('V', $crc); // crc32 + $cdrec .= pack('V', $c_len); // compressed filesize + $cdrec .= pack('V', $unc_len); // uncompressed filesize + $cdrec .= pack('v', strlen($name)); // length of filename + $cdrec .= pack('v', 0); // extra field length + $cdrec .= pack('v', 0); // file comment length + $cdrec .= pack('v', 0); // disk number start + $cdrec .= pack('v', 0); // internal file attributes + $cdrec .= pack('V', 32); // external file attributes - 'archive' bit set + + $cdrec .= pack('V', $this -> old_offset); // relative offset of local header + $this -> old_offset = $new_offset; + + $cdrec .= $name; + + // optional extra field, file comment goes here + // save to central directory + $this -> ctrl_dir[] = $cdrec; + } + + function file() + { + $data = implode('', $this -> datasec); + $ctrldir = implode('', $this -> ctrl_dir); + + return $data . $ctrldir . $this -> eof_ctrl_dir . + pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk" + pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall + pack('V', strlen($ctrldir)) . // size of central dir + pack('V', strlen($data)) . // offset to start of central dir + "\x00\x00"; // .zip file comment length + } +} + +// +// End Functions +// ----------------------------------------------- + +?> \ No newline at end of file diff --git a/phpBB/adm/admin_disallow.php b/phpBB/adm/admin_disallow.php new file mode 100644 index 0000000000..af7c7fdf3d --- /dev/null +++ b/phpBB/adm/admin_disallow.php @@ -0,0 +1,165 @@ +acl_get('a_names')) + { + return; + } + + $module['USER']['DISALLOW'] = basename(__FILE__) . $SID; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Check permissions +if (!$auth->acl_get('a_names')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +if (isset($_POST['disallow'])) +{ + $disallowed_user = (isset($_REQUEST['disallowed_user'])) ? $_REQUEST['disallowed_user'] : ''; + $disallowed_user = str_replace('*', '%', $disallowed_user); + + if (validate_username($disallowed_user)) + { + $message = $user->lang['Disallowed_already']; + } + else + { + $sql = "INSERT INTO " . DISALLOW_TABLE . " (disallow_username) + VALUES('" . str_replace("\'", "''", $disallowed_user) . "')"; + $result = $db->sql_query($sql); + + $message = $user->lang['Disallow_successful']; + } + + add_log('admin', 'log_disallow_add', str_replace('%', '*', $disallowed_user)); + + trigger_error($message); +} +else if (isset($_POST['allow'])) +{ + $disallowed_id = (isset($_REQUEST['disallowed_id'])) ? intval($_REQUEST['disallowed_id']) : ''; + + if (empty($disallowed_id)) + { + trigger_error($user->lang['No_user_selected']); + } + + $sql = "DELETE FROM " . DISALLOW_TABLE . " + WHERE disallow_id = $disallowed_id"; + $db->sql_query($sql); + + add_log('admin', 'log_disallow_delete'); + + trigger_error($user->lang['Disallowed_deleted']); +} + +// Grab the current list of disallowed usernames... +$sql = "SELECT * + FROM " . DISALLOW_TABLE; +$result = $db->sql_query($sql); + +$disallow_select = ''; +if ($row = $db->sql_fetchrow($result)) +{ + do + { + $disallow_select .= ''; + } + while ($row = $db->sql_fetchrow($result)); +} + +// Output page +page_header($user->lang['DISALLOW']); + +?> + +

lang['DISALLOW']; ?>

+ +

lang['Disallow_explain']; ?>

+ +
"> + + + + + + + + + +
lang['Add_disallow_title']; ?>
lang['USERNAME']; ?>
lang['Add_disallow_explain']; ?>
 
   +
+ +

lang['Delete_disallow_title']; ?>

+ +

lang['Delete_disallow_explain']; ?>

+ + + + + + + + + + + + + + + + + +
lang['Delete_disallow_title']; ?>
lang['USERNAME']; ?>
   +
lang['No_disallowed']; ?>
+ + \ No newline at end of file diff --git a/phpBB/adm/admin_email.php b/phpBB/adm/admin_email.php new file mode 100644 index 0000000000..a3c3747cc5 --- /dev/null +++ b/phpBB/adm/admin_email.php @@ -0,0 +1,186 @@ +acl_get('a_email')) + { + return; + } + + $module['GENERAL']['MASS_EMAIL'] = basename(__FILE__) . $SID; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Check permissions +if (!$auth->acl_get('a_email')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// +// Set some vars +// +$message = ''; +$subject = ''; + +// +// Do the job ... +// +if (isset($_POST['submit'])) +{ + // + // Increase maximum execution time in case of a lot of users, but don't complain about it if it isn't + // allowed. + // + @set_time_limit(1200); + + $group_id = intval($_POST['g']); + + $sql = ($group_id != -1) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE; + $result = $db->sql_query($sql); + + if (!($email_list = $db->sql_fetchrowset($g_result))) + { + // + // Output a relevant GENERAL_MESSAGE about users/group + // not existing + // + } + + $subject = stripslashes($_POST['subject']); + $message = stripslashes($_POST['message']); + + // + // Error checking needs to go here ... if no subject and/or + // no message then skip over the send and return to the form + // + $error = FALSE; + + if (!$error) + { + include($phpbb_root_path . 'includes/emailer.'.$phpEx); + // + // Let's do some checking to make sure that mass mail functions + // are working in win32 versions of php. + // + if (preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$config['smtp_delivery']) + { + // We are running on windows, force delivery to use + // our smtp functions since php's are broken by default + $config['smtp_delivery'] = 1; + $config['smtp_host'] = get_cfg_var('SMTP'); + } + $emailer = new emailer($config['smtp_delivery']); + + $email_headers = 'From: ' . $config['board_email'] . "\n"; + + $bcc_list = ''; + for($i = 0; $i < count($email_list); $i++) + { + $bcc_list .= (($bcc_list != '') ? ', ' : '') . $email_list[$i]['user_email']; + } + $email_headers .= "Bcc: $bcc_list\n"; + + $email_headers .= 'Return-Path: ' . $userdata['board_email'] . "\n"; + $email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\n"; + $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n"; + $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n"; + $email_headers .= 'X-AntiAbuse: User IP - ' . $user_ip . "\n"; + + $emailer->use_template('admin_send_email'); + $emailer->email_address($config['board_email']); + $emailer->set_subject($subject); + $emailer->extra_headers($email_headers); + + $emailer->assign_vars(array( + 'SITENAME' => $config['sitename'], + 'BOARD_EMAIL' => $config['board_email'], + 'MESSAGE' => $message) + ); + + $emailer->send(); + $emailer->reset(); + + message_die(MESSAGE, $user->lang['Email_sent']); + } +} + +// +// Initial selection +// + +$sql = "SELECT group_id, group_name + FROM ".GROUPS_TABLE; +$result = $db->sql_query($sql); + +$select_list = ''; + +page_header($user->lang['Mass_Email']); + +?> + +

lang['Mass_Email']; ?>

+ +

lang['Mass_email_explain']; ?>

+ +
+ + + + + + + + + + + + + + + + + +
lang['Compose']; ?>
lang['Recipients']; ?>
lang['Subject']; ?>
lang['Message']; ?> +
+ + \ No newline at end of file diff --git a/phpBB/adm/admin_forums.php b/phpBB/adm/admin_forums.php new file mode 100644 index 0000000000..bff5b818a8 --- /dev/null +++ b/phpBB/adm/admin_forums.php @@ -0,0 +1,1038 @@ +acl_gets('a_forum', 'a_forumadd', 'a_forumdel')) + { + return; + } + + $module['FORUM']['MANAGE'] = basename(__FILE__) . $SID; + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Get mode +$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; + +// Do we have permissions? +switch ($mode) +{ + case 'add': + if (!$auth->acl_get('a_forumadd')) + { + trigger_error($user->lang['NO_ADMIN']); + } + case 'del': + if (!$auth->acl_get('a_forumdel')) + { + trigger_error($user->lang['NO_ADMIN']); + } + + default: + if (!$auth->acl_get('a_forum')) + { + trigger_error($user->lang['NO_ADMIN']); + } +} + +// Major routines +switch ($mode) +{ + case 'move_up': + case 'move_down': + $show_index = TRUE; + $forum_id = intval($_GET['this_f']); + + $sql = 'SELECT parent_id, left_id, right_id + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) + { + trigger_error($user->lang['NO_FORUM']); + } + $db->sql_freeresult($result); + + extract($row); + + $forum_info = array($forum_id => $row); + + // Get the adjacent forum + $sql = 'SELECT forum_id, left_id, right_id + FROM ' . FORUMS_TABLE . " + WHERE parent_id = $parent_id"; + $sql .= ($mode == 'move_up') ? " AND right_id < $right_id ORDER BY right_id DESC" : " AND left_id > $left_id ORDER BY left_id ASC"; + $result = $db->sql_query_limit($sql, 1); + + if (!($row = $db->sql_fetchrow($result))) + { + // already on top or at bottom + break; + } + $db->sql_freeresult($result); + + if ($mode == 'move_up') + { + $up_id = $forum_id; + $down_id = $row['forum_id']; + } + else + { + $up_id = $row['forum_id']; + $down_id = $forum_id; + } + + $forum_info[$row['forum_id']] = $row; + $diff_up = $forum_info[$up_id]['right_id'] - $forum_info[$up_id]['left_id']; + $diff_down = $forum_info[$down_id]['right_id'] - $forum_info[$down_id]['left_id']; + + $forum_ids = array(); + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE left_id > ' . $forum_info[$up_id]['left_id'] . ' + AND right_id < ' . $forum_info[$up_id]['right_id']; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + // Start transaction + $db->sql_transaction(); + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET left_id = left_id + ' . ($diff_up + 1) . ', right_id = right_id + ' . ($diff_up + 1) . ' + WHERE left_id > ' . $forum_info[$down_id]['left_id'] . ' + AND right_id < ' . $forum_info[$down_id]['right_id']; + $db->sql_query($sql); + + if (count($forum_ids)) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET left_id = left_id - ' . ($diff_down + 1) . ', right_id = right_id - ' . ($diff_down + 1) . ' + WHERE forum_id IN (' . implode(', ', $forum_ids) . ')'; + $db->sql_query($sql); + } + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET left_id = ' . $forum_info[$down_id]['left_id'] . ', right_id = ' . ($forum_info[$down_id]['left_id'] + $diff_up) . ' + WHERE forum_id = ' . $up_id; + $db->sql_query($sql); + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET left_id = ' . ($forum_info[$up_id]['right_id'] - $diff_down) . ', right_id = ' . $forum_info[$up_id]['right_id'] . ' + WHERE forum_id = ' . $down_id; + $db->sql_query($sql); + + $db->sql_transaction('commit'); + break; + + case 'create': + if (!trim($_POST['forum_name'])) + { + trigger_error('Cannot create a forum without a name'); // Needs to be a lang string + } + + $parent_id = (!empty($_POST['parent_id'])) ? intval($_POST['parent_id']) : 0; + + if ($parent_id) + { + $sql = 'SELECT left_id, right_id + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $parent_id"; + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) + { + trigger_error('Parent does not exist', E_USER_ERROR); + } + $db->sql_freeresult($result); + + extract($row); + + $db->sql_query('UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id + 2, right_id = right_id + 2 + WHERE left_id > $right_id"); + + $db->sql_query('UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id + 2 + WHERE $left_id BETWEEN left_id AND right_id"); + + $left_id = $right_id; + ++$right_id; + } + else + { + $sql = 'SELECT MAX(right_id) AS right_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + + $left_id = $db->sql_fetchfield('right_id', 0, $result) + 1; + $db->sql_freeresult($result); + + $right_id = $left_id + 1; + } + + $sql = array( + 'parent_id' => $parent_id, + 'left_id' => $left_id, + 'right_id' => $right_id, + 'forum_status' => intval($_POST['forum_status']), + 'forum_postable' => (!empty($_POST['forum_postable'])) ? 1 : 0, + 'forum_name' => $_POST['forum_name'], + 'forum_desc' => $_POST['forum_desc'], + 'forum_style' => (!empty($_POST['forum_style'])) ? intval($_POST['forum_style']) : 'NULL', + 'enable_post_count' => (!empty($_POST['disable_post_count'])) ? 0 : 1, + 'enable_icons' => (!empty($_POST['enable_icons'])) ? 1 : 0, + 'enable_moderate' => (!empty($_POST['moderated'])) ? 1 : 0, + 'enable_prune' => (!empty($_POST['prune_enable'])) ? 1 : 0, + 'prune_days' => intval($_POST['prune_days']), + 'prune_freq' => intval($_POST['prune_freq']) + ); + $db->sql_query('INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql)); + + $forum_id = $db->sql_nextid(); + + // Redirect to permissions + redirect('admin/admin_permissions.' . $phpEx . $SID . '&mode=forums&f=' . $forum_id); + + break; + + case 'modify': + if (!($forum_id = intval($_POST['f']))) + { + trigger_error('No forum specified'); // lang string + } + + $row = get_forum_info($forum_id); + $parent_id = intval($_POST['parent_id']); + $action = (!empty($_POST['action'])) ? $_POST['action'] : ''; + + if (($row['parent_id'] != $parent_id) && ($parent_id != -1)) + { + move_forum($forum_id, $parent_id); + } + elseif ($row['forum_name'] != $_POST['forum_name']) + { + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_parents = '' + WHERE left_id > " . $row['left_id'] . ' + AND right_id < ' . $row['right_id']; + $db->sql_query($sql); + } + + $sql = array( + 'parent_id' => $parent_id, + 'forum_name' => (!empty($_POST['forum_name'])) ? $_POST['forum_name'] : $row['forum_name'], + 'forum_desc' => (!empty($_POST['forum_desc'])) ? $_POST['forum_desc'] : $row['forum_desc'], + 'forum_status' => intval($_POST['forum_status']), + 'forum_postable' => (!empty($_POST['is_postable'])) ? 1 : 0, + 'forum_style' => (!empty($_POST['forum_style'])) ? $_POST['forum_style'] : NULL, + 'forum_image' => (!empty($_POST['forum_image'])) ? $_POST['forum_image'] : '', + 'display_on_index' => (!empty($_POST['display_on_index'])) ? 1 : 0, + 'enable_icons' => (!empty($_POST['enable_icons'])) ? 1 : 0, + 'enable_moderate' => (!empty($_POST['moderated'])) ? 1 : 0, + 'enable_prune' => (!empty($_POST['prune_enable'])) ? 1 : 0, + 'prune_days' => intval($_POST['prune_days']), + 'prune_freq' => intval($_POST['prune_freq']), + ); + + if (!empty($_POST['set_nonpostable']) && $action) + { + if ($action == 'move' && $_POST['to_forum_id']) + { + move_forum_content($forum_id, $_POST['to_forum_id']); + } + elseif ($action == 'delete') + { + delete_forum_content($forum_id); + } + + $sql['forum_posts'] = 0; + $sql['forum_topics'] = 0; + } + + $db->sql_query('UPDATE ' . FORUMS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql) . " + WHERE forum_id = $forum_id"); + + trigger_error($user->lang['Forums_updated']); + + break; + + case 'remove': + + $action_subforums = (!empty($_POST['action_subforums'])) ? $_POST['action_subforums'] : ''; + $action_posts = (!empty($_POST['action_posts'])) ? $_POST['action_posts'] : ''; + + $row = get_forum_info(intval($_GET['f'])); + extract($row); + + if ($action_posts == 'delete') + { + delete_forum_content($forum_id); + } + elseif ($action_posts == 'move') + { + if (empty($_POST['posts_to_id'])) + { + trigger_error($user->lang['No_destination_forum']); + } + + move_forum_content($forum_id, $_POST['posts_to_id']); + } + + if ($action_subforums == 'delete') + { + $forum_ids = array($forum_id); + $rows = get_forum_branch($forum_id, 'children', 'descending', FALSE); + + foreach ($rows as $row) + { + $forum_ids[] = $row['forum_id']; + delete_forum_content($row['forum_id']); + } + + $diff = count($forum_ids) * 2; + + $sql = 'DELETE FROM ' . FORUMS_TABLE . ' + WHERE forum_id IN (' . implode(', ', $forum_ids) . ')'; + $db->sql_query($sql); + } + elseif ($action_subforums == 'move') + { + if (empty($_POST['subforums_to_id'])) + { + trigger_error($user->lang['No_destination_forum']); + } + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . " + WHERE parent_id = $forum_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + move_forum($row['forum_id'], $_POST['subforums_to_id']); + } + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET parent_id = ' . $_POST['subforums_to_id'] . " + WHERE parent_id = $forum_id"; + $db->sql_query($sql); + + $diff = 2; + + $sql = 'DELETE FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + } + else + { + $diff = 2; + $db->sql_query('DELETE FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"); + } + + // Resync tree + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id - $diff + WHERE left_id < $right_id AND right_id > $right_id"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id - $diff, right_id = right_id - $diff + WHERE left_id > $right_id"; + $db->sql_query($sql); + + trigger_error($user->lang['Forum_deleted']); + break; + + case 'sync': + sync('forum', intval($_GET['this_f'])); + break; + + case 'add': + case 'edit': + // Show form to create/modify a forum + if ($mode == 'edit') + { + $forum_id = intval($_GET['this_f']); + + $row = get_forum_info($forum_id); + extract($row); + + $subforums_id = array(); + $subforums = get_forum_branch($forum_id, 'children'); + foreach ($subforums as $row) + { + $subforums_id[] = $row['forum_id']; + } + + $parents_list = make_forums_list('all', $parent_id, $subforums_id); + + $l_title = $user->lang['Edit_forum']; + $newmode = 'modify'; + $buttonvalue = $user->lang['Update']; + $prune_enabled = ($prune_enable) ? 'checked="checked" ' : ''; + + $forums_list = make_forums_list('forums', 0, $forum_id); + } + else + { + $parent_id = (!empty($_POST['parent_id'])) ? $_POST['parent_id'] : 0; + $parents_list = make_forums_list('all', $parent_id); + + $l_title = $user->lang['Create_forum']; + $newmode = 'create'; + $buttonvalue = $user->lang['Create_forum']; + + $forum_id = $parent_id; + $forum_desc = ''; + $forum_style = ''; + $forum_status = ITEM_UNLOCKED; + $forum_name = (!empty($_POST['forum_name'])) ? htmlspecialchars($_POST['forum_name']) : ''; + + $post_count_inc = TRUE; + $moderated = FALSE; + $enable_icons = TRUE; + + $prune_enabled = ''; + $prune_days = 7; + $prune_freq = 1; + } + + $styles_list = make_styles_list($forum_style); + + $forumlocked = ($forum_status == ITEM_LOCKED) ? ' selected="selected"' : ''; + $forumunlocked = ($forum_status == ITEM_UNLOCKED) ? ' selected="selected"' : ''; + + $postable_checked = ($forum_postable) ? 'checked="checked" ' : ''; + $nonpostable_checked = (!$forum_postable) ? 'checked="checked" ' : ''; + + $statuslist = '\n"; + $statuslist .= '\n"; + + page_header($l_title); + +?> +

+ +

lang['Forum_edit_delete_explain'] ?>

+ +
" method="post"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
lang['General_settings'] ?>
lang['Parent'] ?>
lang['Forum_name']; ?>
lang['Forum_desc'] ?>
lang['FORUM_TYPE'] ?> + + + + + + + + + +
lang['SET_NON_POSTABLE'] ?>
      lang['Delete_all_posts'] ?>
      lang['Move_posts_to'] ?>
lang['FORUM_TYPE'] ?>/>lang['IS_POSTABLE'] ?>   />lang['NOT_POSTABLE'] ?>
lang['Forum_settings'] ?>
lang['FORUM_STATUS'] ?>
lang['FORUM_STYLE'] ?>
lang['OPTIONS'] ?> + + + + + + + + + + 0) + { + // if this forum is a subforum put the "display on index" checkbox + if ($parent_info = get_forum_info($parent_id)) + { + if ($parent_info['parent_id'] > 0 || !$parent_info['forum_postable']) + { + +?> + + + + +
/> lang['DISABLE_POST_COUNT'] ?>
/> lang['ENABLE_TOPIC_ICONS']; ?>
/> lang['FORUM_MODERATED']; ?>
/> lang['Display_on_index'] ?>
+
lang['Forum_pruning'] ?> + + + + + + + + + + + + +
lang['Enabled'] ?>/>
lang['prune_days'] ?>  lang['Days'] ?>
lang['prune_freq'] ?>  lang['Days'] ?>
lang['FORUM_IMAGE']; ?>
+ +
+ +lang['Forum_delete']); + extract(get_forum_info(intval($_GET['this_f']))); + + $subforums_id = array(); + $subforums = get_forum_branch($forum_id, 'children'); + foreach ($subforums as $row) + { + $subforums_id[] = $row['forum_id']; + } + + $forums_list = make_forums_list('all', $parent_id, $subforums_id); + $move_posts_list = make_forums_list('forums', $parent_id, $subforums_id); + +?> +

lang['Forum_delete'] ?>

+ +

lang['Forum_delete_explain'] ?>

+ +
+ + + + + + + + + + + + + + + + + 1) + { + +?> + + + + + + + + + + + + +
lang['Forum_delete'] ?>
lang['Forum_name']; ?>
lang['Action'] ?> lang['Delete_all_posts'] ?>
lang['Move_posts_to'] ?>
lang['Action'] ?> lang['Delete_subforums'] ?>
lang['Move_subforums_to'] ?>
+
+lang['INDEX']; +} +else +{ + $navigation = '' . $user->lang['INDEX'] . ''; + + $forums_nav = get_forum_branch($forum_id, 'parents', 'descending'); + foreach ($forums_nav as $row) + { + if ($row['forum_id'] == $forum_id) + { + $navigation .= ' -> ' . $row['forum_name']; + } + else + { + $navigation .= ' -> ' . $row['forum_name'] . ''; + } + } +} + +// Jumpbox +$forum_box = make_forum_select($forum_id); + +// Front end +page_header($user->lang['MANAGE']); + +?> + +

lang['MANAGE']; ?>

+ +

lang['Forum_admin_explain']; ?>

+ +
"> + + + +
+ + + + + +sql_query('SELECT * FROM ' . FORUMS_TABLE . " WHERE parent_id = $forum_id ORDER BY left_id"); + +while ($row = $db->sql_fetchrow($result)) +{ + // DEBUG + $parent_id = $row['parent_id']; + $forum_title = $row['forum_name']; + $forum_desc = $row['forum_desc']; + + if ($row['forum_status'] != ITEM_LOCKED) + { + if ($row['left_id'] + 1 != $row['right_id']) + { + $folder_image = '' . $user->lang['SUBFORUM'] . ''; + } + else + { + $folder_image = '' . $user->lang['FOLDER'] . ''; + } + } + else + { + $folder_image = '' . $user->lang['LOCKED'] . ''; + } + + $url = $phpEx . $SID . '&f=' . $forum_id . '&this_f=' . $row['forum_id']; + + $forum_title = '' . $forum_title . ''; + +?> + + + + + + + + + + + + + + + +
lang['Forum_admin'] ?>

lang['MOVE_UP'] ?>
lang['MOVE_DOWN'] ?>
 lang['EDIT'] ?> | lang['DELETE'] ?> | lang['Resync'] ?> 
+ +
+ + + +
lang['Select_forum']; ?>:
+ +sql_query($sql); + + if (!$row = $db->sql_fetchrow($result)) + { + trigger_error("Forum #$forum_id does not exist", E_USER_ERROR); + } + + return $row; +} + +function make_forums_list($mode = 'all', $selected_id = 0, $exclude_id = array()) +{ + global $db; + + if (!is_array($exclude_id)) + { + $exclude_id = array($exclude_id); + } + + $sql = 'SELECT f2.* + FROM ' . FORUMS_TABLE . ' f1, ' . FORUMS_TABLE . ' f2 + WHERE f1.parent_id = 0 + AND f2.left_id BETWEEN f1.left_id AND f1.right_id + ORDER BY f2.left_id'; + $result = $db->sql_query($sql); + + $list = ''; + $indent = array(); + $current_indent = 0; + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['parent_id'] == 0) + { + $current_indent = 0; + } + elseif (!isset($indent[$row['parent_id']])) + { + ++$current_indent; + $indent[$row['parent_id']] = $current_indent; + } + else + { + $current_indent = $indent[$row['parent_id']]; + } + + if (($mode == 'forums' && !$row['forum_postable']) + || ($mode == 'categories' && $row['forum_postable']) + || (in_array($row['forum_id'], $exclude_id))) + { + continue; + } + + if ($mode == 'all' && !$row['parent_id']) + { + $list .= "\n"; + } + + $list .= '\n"; + } + + return $list; +} + +function make_styles_list($selected_id = 0) +{ + global $db; + + $list = ''; + $result = $db->sql_query('SELECT style_id, style_name FROM ' . STYLES_TABLE . ' ORDER BY style_name'); + + while ($row = $db->sql_fetchrow($result)) + { + $list .= '\n"; + } + return $list; +} + +function move_forum($from_id, $to_id) +{ + global $db; + + $moved_forums = get_forum_branch($from_id, 'children', 'descending'); + $from_data = $moved_forums[0]; + $diff = count($moved_forums) * 2; + + $moved_ids = array(); + for ($i = 0; $i < count($moved_forums); ++$i) + { + $moved_ids[] = $moved_forums[$i]['forum_id']; + } + + // Resync parents + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id - $diff, forum_parents = '' + WHERE left_id < " . $from_data['right_id'] . " + AND right_id > " . $from_data['right_id']; + $db->sql_query($sql); + + // Resync righthand side of tree + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id - $diff, right_id = right_id - $diff, forum_parents = '' + WHERE left_id > " . $from_data['right_id']; + $db->sql_query($sql); + + if ($to_id > 0) + { + $to_data = get_forum_info($to_id); + + // Resync new parents + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id + $diff, forum_parents = '' + WHERE " . $to_data['right_id'] . ' BETWEEN left_id AND right_id + AND forum_id NOT IN (' . implode(', ', $moved_ids) . ')'; + $db->sql_query($sql); + + // Resync the righthand side of the tree + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id + $diff, right_id = right_id + $diff, forum_parents = '' + WHERE left_id > " . $to_data['right_id'] . ' + AND forum_id NOT IN (' . implode(', ', $moved_ids) . ')'; + $db->sql_query($sql); + + // Resync moved branch + $to_data['right_id'] += $diff; + if ($to_data['right_id'] > $from_data['right_id']) + { + $diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1); + } + else + { + $diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1); + } + } + else + { + $result = $db->sql_query('SELECT MAX(right_id) AS right_id FROM ' . FORUMS_TABLE . ' WHERE forum_id NOT IN (' . implode(', ', $moved_ids) . ')'); + $right_id = $db->sql_fetchfield('right_id', 0, $result); + + $diff = '+ ' . ($right_id - $from_data['left_id'] + 1); + } + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = '' + WHERE forum_id IN (" . implode(', ', $moved_ids) . ')'; + $db->sql_query($sql); +} + +function move_forum_content($from_id, $to_id) +{ + global $db; + + $db->sql_query('UPDATE ' . ACL_GROUPS_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); + $db->sql_query('UPDATE ' . MODERATOR_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); + $db->sql_query('UPDATE ' . LOG_MOD_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); + $db->sql_query('UPDATE ' . POSTS_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); + $db->sql_query('UPDATE ' . TOPICS_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); + + // + // TODO: untested yet + // + $sql = 'SELECT t1.topic_id + FROM ' .TOPICS_TABLE . ' t1 + LEFT JOIN ' . TOPICS_TABLE . " t2 ON t1.topic_moved_id = t2.topic_id AND t1.forum_id = t2.forum_id + WHERE t1.forum_id = $to_id"; + $result = $db->sql_query($result); + + $topic_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = $row['topic_id']; + } + if (count($topic_ids)) + { + $db->sql_query('DELETE FROM ' . TOPICS_TABLE . ' WHERE topic_id IN (' . implode(', ', $topic_ids) . ')'); + } + sync('forum', $to_id); + + // + // TODO: there might be conflicts in ACL tables =\ + // make sure that the query that retrieves shadow topics uses the correct index (topic_type or topic_moved_id) + // +} + +function delete_forum_content($forum_id) +{ + global $db; + + $db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . " WHERE forum_id = $forum_id"); + $db->sql_query('DELETE FROM ' . MODERATOR_TABLE . " WHERE forum_id = $forum_id"); + $db->sql_query('DELETE FROM ' . LOG_MOD_TABLE . " WHERE forum_id = $forum_id"); + $db->sql_query('DELETE FROM ' . FORUMS_WATCH_TABLE . " WHERE forum_id = $forum_id"); + + $ids = array(); + $result = $db->sql_query('SELECT post_id FROM ' . POSTS_TABLE . " WHERE forum_id = $forum_id"); + + while ($row = $db->sql_fetchrow($result)) + { + $ids[] = $row['post_id']; + } + $ids = implode(',', $ids); + $db->sql_freeresult(); + + if ($ids) + { + $db->sql_query('DELETE FROM ' . SEARCH_MATCH_TABLE . " WHERE post_id IN ($ids)"); + $db->sql_query('DELETE FROM ' . POSTS_TABLE . " WHERE forum_id = $forum_id"); + $db->sql_query('DELETE FROM ' . POSTS_TEXT_TABLE . " WHERE post_id IN ($ids)"); + } + + $ids = array(); + $result = $db->sql_query('SELECT topic_id FROM ' . TOPICS_TABLE . " WHERE forum_id = $forum_id"); + + while ($row = $db->sql_fetchrow($result)) + { + $ids[] = $row['topic_id']; + } + $ids = implode(',', $ids); + $db->sql_freeresult(); + + if ($ids) + { + $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . " WHERE topic_id IN ($ids)"); + $db->sql_query('DELETE FROM ' . TOPICS_TABLE . " WHERE forum_id = $forum_id"); + $db->sql_query('DELETE FROM ' . TOPICS_TABLE . " WHERE topic_moved_id IN ($ids)"); + } + + // + // TODO: delete attachments + // delete polls + // OPTIMIZE / VACUUM table ? + // +} + +// +// End function block +// ------------------ + +?> \ No newline at end of file diff --git a/phpBB/adm/admin_groups.php b/phpBB/adm/admin_groups.php new file mode 100644 index 0000000000..308b0df9ad --- /dev/null +++ b/phpBB/adm/admin_groups.php @@ -0,0 +1,911 @@ +acl_get('a_group') ) + { + return; + } + + $module['GROUP']['MANAGE'] = basename(__FILE__) . "$SID"; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Do we have general permissions? +if (!$auth->acl_get('a_group') ) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Check and set some common vars +$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; +if (isset($_POST['addgroup'])) +{ + $action = 'addgroup'; +} +else if (isset($_POST['delete'])) +{ + $action = 'delete'; +} +else if (isset($_POST['add'])) +{ + $action = 'add'; +} +else +{ + $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : ''; +} +$group_id = (isset($_REQUEST['g'])) ? intval($_REQUEST['g']) : ''; + +$start = (isset($_GET['start']) && $mode == 'member') ? intval($_GET['start']) : 0; +$start_mod = (isset($_GET['start']) && $mode == 'mod') ? intval($_GET['start']) : 0; +$start_pend = (isset($_GET['start']) && $mode == 'pend') ? intval($_GET['start']) : 0; + +// Grab basic data for group, if group_id is set since it's used +// in several places below +if (!empty($group_id)) +{ + $sql = "SELECT * + FROM " . GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + + if (!extract($db->sql_fetchrow($result))) + { + trigger_error($user->lang['NO_GROUP']); + } + $db->sql_freeresult($result); +} + +// Page header +page_header($user->lang['MANAGE']); + +// Which page? +switch ($action) +{ + case 'edit': + case 'addgroup': + + $error = ''; + + // Did we submit? + if (isset($_POST['submit']) || isset($_POST['submitprefs'])) + { + if (isset($_POST['submit'])) + { + if ($group_type != GROUP_SPECIAL) + { + $group_name = (!empty($_POST['group_name'])) ? htmlspecialchars($_POST['group_name']) : ''; + $group_type = (!empty($_POST['group_type'])) ? intval($_POST['group_type']) : ''; + } + $group_description = (!empty($_POST['group_description'])) ? htmlspecialchars($_POST['group_description']) : ''; + $group_colour = (!empty($_POST['group_colour'])) ? htmlspecialchars($_POST['group_colour']) : ''; + $group_rank = (isset($_POST['group_rank'])) ? intval($_POST['group_rank']) : ''; + $group_avatar = (!empty($_POST['group_avatar'])) ? htmlspecialchars($_POST['group_avatar']) : ''; + + // Check data + if ($group_name == '' || strlen($group_name) > 40) + { + $error .= (($error != '') ? '
' : '') . (($group_name == '') ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG']); + } + if (strlen($group_description) > 255) + { + $error .= (($error != '') ? '
' : '') . $user->lang['GROUP_ERR_DESC_LONG']; + } + if ($group_type < GROUP_OPEN || $group_type > GROUP_FREE) + { + $error .= (($error != '') ? '
' : '') . $user->lang['GROUP_ERR_TYPE']; + } + } + else + { + $user_lang = (!empty($_POST['user_lang'])) ? htmlspecialchars($_POST['user_lang']) : ''; + $user_tz = (isset($_POST['user_tz'])) ? doubleval($_POST['user_tz']) : ''; + $user_dst = (isset($_POST['user_dst'])) ? intval($_POST['user_dst']) : ''; + } + + // Update DB + if (!$error) + { + // Update group preferences + $sql = "UPDATE " . GROUPS_TABLE . " + SET group_name = '$group_name', group_description = '$group_description', group_type = $group_type, group_rank = $group_rank, group_colour = '$group_colour' + WHERE group_id = $group_id"; + $db->sql_query($sql); + + $user_sql = ''; + $user_sql .= (isset($_POST['submit'])) ? ((($user_sql != '') ? ', ' : '') . "user_colour = '$group_colour'") : ''; + $user_sql .= (isset($_POST['submit']) && $group_rank != -1) ? ((($user_sql != '') ? ', ' : '') . "user_rank = $group_rank") : ''; + $user_sql .= (isset($_POST['submitprefs']) && $user_lang != -1) ? ((($user_sql != '') ? ', ' : '') . "user_lang = '$user_lang'") : ''; + $user_sql .= (isset($_POST['submitprefs']) && $user_tz != -14) ? ((($user_sql != '') ? ', ' : '') . "user_timezone = $user_tz") : ''; + $user_sql .= (isset($_POST['submitprefs']) && $user_dst != -1) ? ((($user_sql != '') ? ', ' : '') . "user_dst = $user_dst") : ''; + + // Update group members preferences + switch (SQL_LAYER) + { + case 'mysql': + case 'mysql4': + // batchwise? 500 at a time or so maybe? try to reduce memory useage + $more = true; + $start = 0; + do + { + $sql = "SELECT user_id + FROM " . USER_GROUP_TABLE . " + WHERE group_id = $group_id + LIMIT $start, 500"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $user_count = 0; + $user_id_sql = ''; + do + { + $user_id_sql .= (($user_id_sql != '') ? ', ' : '') . $row['user_id']; + $user_count++; + } + while ($row = $db->sql_fetchrow($result)); + + $sql = "UPDATE " . USERS_TABLE . " + SET $user_sql + WHERE user_id IN ($user_id_sql)"; + $db->sql_query($sql); + + if ($user_count == 500) + { + $start += 500; + } + else + { + $more = false; + } + } + else + { + $more = false; + } + $db->sql_freeresult($result); + unset($user_id_sql); + } + while ($more); + + break; + + default: + $sql = "UPDATE " . USERS_TABLE . " + SET $user_sql + WHERE user_id IN ( + SELECT user_id + FROM " . USER_GROUP_TABLE . " + WHERE group_id = $group_id)"; + $db->sql_query($sql); + } + + trigger_error($user->lang['GROUP_UPDATED']); + } + } + +?> + +

lang['MANAGE'] . ' : ' . $group_name . ''; ?>

+ +

lang['GROUP_EDIT_EXPLAIN']; ?>

+ +sql_query($sql); + + $rank_options = ''; + if ($row = $db->sql_fetchrow($result)) + { + do + { + $selected = (!empty($group_rank) && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; + $rank_options .= ''; + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + $type_open = ($group_type == GROUP_OPEN) ? ' checked="checked"' : ''; + $type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : ''; + $type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : ''; + $type_free = ($group_type == GROUP_FREE) ? ' checked="checked"' : ''; + +?> + + + +
"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
lang['GROUP_DETAILS']; ?>
lang['GROUP_NAME']; ?>:lang['G_' . $group_name])) ? $user->lang['G_' . $group_name] : $group_name; ?>
lang['GROUP_DESC']; ?>:
lang['GROUP_TYPE']; ?>:
lang['GROUP_TYPE_EXPLAIN']; ?>
/> lang['GROUP_OPEN']; ?>   /> lang['GROUP_REQUEST']; ?>   /> lang['GROUP_CLOSED']; ?>   /> lang['GROUP_HIDDEN']; ?>
lang['GROUP_SETTINGS_SAVE']; ?>
lang['GROUP_COLOR']; ?>:
lang['GROUP_COLOR_EXPLAIN'], '', ''); ?>
lang['GROUP_RANK']; ?>:
 
+ + +

lang['GROUP_SETTINGS']; ?>

+ +

lang['GROUP_SETTINGS_EXPLAIN']; ?>

+ +
"> + + + + + + + + + + + + + + + + + + +
lang['GROUP_SETTINGS']; ?>
lang['GROUP_LANG']; ?>:
lang['GROUP_TIMEZONE']; ?>:
lang['GROUP_DST']; ?>: lang['DISABLED']; ?>   lang['ENABLED']; ?>   lang['USER_DEFAULT']; ?>
 
+ +lang['NO_USERS']); + } + $users = explode("\n", $_POST['usernames']); + + $table_sql = ($mode == 'mod' ) ? GROUPS_MODERATOR_TABLE : USER_GROUP_TABLE; + + // Grab the user ids + $sql = "SELECT user_id + FROM " . USERS_TABLE . " + WHERE username IN (" . implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#', "'\\1'", $users)) . ")"; + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) + { + trigger_error($user->lang['NO_USERS']); + } + + $user_id_ary = array(); + do + { + $user_id_ary[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + $db->sql_freeresult($result); + + // Remove users who are already members of this group + $sql = "SELECT user_id + FROM $table_sql + WHERE user_id IN (" . implode(', ', $user_id_ary) . ") + AND group_id = $group_id"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $old_user_id_ary = array(); + do + { + $old_user_id_ary[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $user_id_ary = array_diff($user_id_ary, $old_user_id_ary); + } + $db->sql_freeresult($result); + + if (!sizeof($user_id_ary)) + { + trigger_error($user->lang['GROUP_ERR_USERS_EXIST']); + } + + // Insert the new users + switch (SQL_LAYER) + { + case 'postgresql': + case 'msaccess': + case 'mssql-odbc': + case 'oracle': + case 'db2': + foreach ($user_id_ary as $user_id) + { + $sql = "INSERT INTO $table_sql (user_id, group_id) + VALUES ($user_id, $group_id)"; + $db->sql_query($sql); + } + + break; + + case 'mysql': + case 'mysql4': + $sql = "INSERT INTO $table_sql (user_id, group_id) + VALUES " . implode(', ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id)", $user_id_ary)); + $db->sql_query($sql); + break; + + case 'mssql': + $sql = "INSERT INTO $table_sql (user_id, group_id) + VALUES " . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id)", $user_id_ary)); + $db->sql_query($sql); + break; + } + + // Update user settings (color, rank) if applicable + if (!empty($_POST['settings'])) + { + $sql = "UPDATE " . USERS_TABLE ." + SET user_colour = '$group_colour', user_rank = " . intval($group_rank) . " + WHERE user_id IN (" . implode(', ', $user_id_ary) . ")"; + $db->sql_query($sql); + } + +// add_log(); + + $message = ($mode == 'mod') ? 'GROUP_MODS_ADDED' : 'GROUP_USERS_ADDED'; + trigger_error($user->lang[$message]); + + break; + + case 'delete': + + // TODO: + // Need to offer ability to demote moderators or remove from group + + break; + + case 'approve': + + break; + + case 'list': + + $sql = "SELECT * + FROM " . GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + + if (!extract($db->sql_fetchrow($result))) + { + trigger_error($user->lang['NO_GROUP']); + } + $db->sql_freeresult($result); + +?> + +

lang['GROUP_MEMBERS']; ?>

+ +

lang['GROUP_MEMBERS_EXPLAIN']; ?>

+ + +

lang['GROUP_MODS']; ?>

+ +

lang['GROUP_MODS_EXPLAIN']; ?>

+ +
"> + + + + + + +sql_query($sql); + + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $total_members = $row['total_members']; + + $sql = "SELECT u.user_id, u.username, u.user_regdate, u.user_posts + FROM " . USERS_TABLE . " u, " . GROUPS_MODERATOR_TABLE . " gm + WHERE gm.group_id = $group_id + AND u.user_id = gm.user_id + ORDER BY u.username + LIMIT $start_mod, " . $config['topics_per_page']; + $result = $db->sql_query($sql); + + $db->sql_freeresult($result); + + if ($row = $db->sql_fetchrow($result) ) + { + do + { + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; + + $group_mod_ary[] = $row['user_id']; + +?> + + + + + + +sql_fetchrow($result) ); + +?> + + + + + + + + + + + + + + + + + + +
lang['USERNAME']; ?>lang['JOINED']; ?>lang['POSTS']; ?>lang['MARK']; ?>
" target="_profile">format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?>
lang['GROUPS_NO_MODS']; ?>
lang['ADD_USERS']; ?>
  &mode=searchuser&form=mod&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" />
+ + + + + + +
lang['MARK_ALL']; ?> :: lang['UNMARK_ALL']; ?> 
+ +sql_query($sql); + + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $total_members = $row['total_members']; + + $sql = "SELECT u.user_id, u.username, u.user_regdate, u.user_posts + FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug + WHERE ug.group_id = $group_id + AND ug.user_pending = 1 + AND u.user_id = ug.user_id + ORDER BY u.username + LIMIT $start_pend, " . $config['topics_per_page']; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result) ) + { + +?> +

lang['GROUP_PENDING']; ?>

+ +

lang['GROUP_PENDING_EXPLAIN']; ?>

+ +
"> + + + + + + + + + + + + + +sql_fetchrow($result) ); + +?> + + + + + + + + + + + + +
lang['USERNAME']; ?>lang['JOINED']; ?>lang['POSTS']; ?>lang['MARK']; ?>
" target="_profile">format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?>
lang['ADD_USERS']; ?>
  &mode=searchuser&form=pend&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" />
+ + + + + + +
lang['MARK_ALL']; ?> :: lang['UNMARK_ALL']; ?> 
+ +sql_freeresult($result); + } + + // Existing members + $skip_user_sql = (sizeof($group_mod_ary)) ? ' AND ug.user_id NOT IN (' . implode(', ', $group_mod_ary) . ')' : ''; + $sql = "SELECT COUNT(ug.user_id) AS total_members + FROM " . USER_GROUP_TABLE . " ug + WHERE ug.group_id = $group_id + AND ug.user_pending = 0 + $skip_user_sql"; + $result = $db->sql_query($sql); + + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $total_members = $row['total_members']; + + $sql = "SELECT u.user_id, u.username, u.user_regdate, u.user_posts + FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug + WHERE ug.group_id = $group_id + AND ug.user_pending = 0 + AND u.user_id = ug.user_id + $skip_user_sql + ORDER BY u.username + LIMIT $start, " . $config['topics_per_page']; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result) ) + { + +?> +

lang['GROUP_LIST']; ?>

+ +

lang['GROUP_LIST_EXPLAIN']; ?>

+ + +
"> + + + + + + + + + + + + + +sql_fetchrow($result)); + +?> + + + + + + + + + + + + +
lang['USERNAME']; ?>lang['JOINED']; ?>lang['POSTS']; ?>lang['MARK']; ?>
" target="_profile">format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?>
lang['ADD_USERS']; ?>

lang['USER_GETS_GROUP_SET']; ?> lang['YES']; ?>   lang['NO']; ?>
  &mode=searchuser&form=list&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" />
+ + + + + + +
lang['MARK_ALL']; ?> :: lang['UNMARK_ALL']; ?> 
+ +sql_freeresult($result); + + break; + + default: + + // Default mangement page + +?> + +

lang['MANAGE']; ?>

+ +

lang['GROUP_MANAGE_EXPLAIN']; ?>

+ +

lang['USER_DEF_GROUPS']; ?>

+ +

lang['USER_DEF_GROUPS_EXPLAIN']; ?>

+ +
"> + + + + +sql_query($sql); + + $special_toggle = false; + if ($row = $db->sql_fetchrow($result) ) + { + do + { + + if ($row['group_type'] == GROUP_SPECIAL && !$special_toggle) + { + $special_toggle = true; + +?> + + + +
lang['MANAGE']; ?>lang['ACTION']; ?>
+ +

lang['SPECIAL_GROUPS']; ?>

+ +

lang['SPECIAL_GROUPS_EXPLAIN']; ?>

+ + + + + + +lang['G_' . $row['group_name']]))? $user->lang['G_' . $row['group_name']] : $row['group_name']; + +?> + + + + + + + + + +sql_fetchrow($result) ); + } + $db->sql_freeresult($result); + +?> + + + +
lang['MANAGE']; ?>lang['ACTION']; ?>
"> ">lang['ADD']; ?> | ">lang['EDIT']; ?> | ">lang['DELETE']; ?> 
 
 
+ + + + + + \ No newline at end of file diff --git a/phpBB/adm/admin_icons.php b/phpBB/adm/admin_icons.php new file mode 100644 index 0000000000..023b66a8e3 --- /dev/null +++ b/phpBB/adm/admin_icons.php @@ -0,0 +1,757 @@ +acl_get('a_icons')) + { + return; + } + + $filename = basename(__FILE__); + $module['POST']['SMILE'] = $filename . $SID . '&mode=emoticons'; + $module['POST']['ICONS'] = $filename . $SID . '&mode=icons'; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Do we have general permissions? +if (!$auth->acl_get('a_icons')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Grab some basic parameters +$mode = (!empty($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; +$action = (!empty($_REQUEST['action'])) ? $_REQUEST['action'] : ((isset($_POST['add'])) ? 'add' : ''); +$id = (isset($_GET['id'])) ? intval($_GET['id']) : false; + +// What are we working on? +switch ($mode) +{ + case 'emoticons': + $table = SMILIES_TABLE; + $lang = 'SMILE'; + $fields = 'smile'; + $img_path = $config['smilies_path']; + break; + + case 'icons': + $table = ICONS_TABLE; + $lang = 'ICONS'; + $fields = 'icons'; + $img_path = $config['icons_path']; + break; +} + +// Clear some arrays +$_images = $_paks = array(); + + + +// Grab file list of paks and images +if ($action == 'edit' || $action == 'add' || $action == 'import') +{ + $dir = @opendir($phpbb_root_path . $img_path); + while ($file = @readdir($dir)) + { + if (is_file($phpbb_root_path . $img_path . '/' . $file)) + { + $img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $file); + + if (preg_match('#\.(gif|png|jpg)$#i', $file) || (!empty($img_size[0]) && !empty($img_size[1]))) + { + $_images[] = $file; + } + elseif (preg_match('#\.pak$#i', $file)) + { + $_paks[] = $file; + } + } + } + @closedir($dir); +} + + +// What shall we do today? Oops, I believe that's trademarked ... +switch ($action) +{ + case 'delete': + + $db->sql_query('DELETE FROM ' . $table . ' + WHERE ' . $fields . '_id = ' . intval($_GET['id'])); + + switch ($mode) + { + case 'emoticons': + break; + + case 'icons': + // Reset appropriate icon_ids + $db->sql_query('UPDATE ' . TOPICS_TABLE . ' + SET icon_id = 0 + WHERE icon_id = ' . intval($_GET['id'])); + $db->sql_query('UPDATE ' . POSTS_TABLE . ' + SET icon_id = 0 + WHERE icon_id = ' . intval($_GET['id'])); + break; + } + + trigger_error($user->lang[$lang . '_DELETED']); + break; + + case 'edit': + case 'add': + + $order_list = ''; + $existing_imgs = array(); + $result = $db->sql_query('SELECT * + FROM ' . $table . ' + ORDER BY ' . $fields . '_order DESC'); + if ($row = $db->sql_fetchrow($result)) + { + do + { + $existing_imgs[] = $row[$fields . '_url']; + + if ($row[$fields . '_id'] == $id) + { + $after = TRUE; + $data = $row; + } + else + { + $selected = ''; + if (!empty($after)) + { + $selected = ' selected="selected"'; + $after = FALSE; + } + + $after_txt = ($mode == 'emoticons') ? $row['code'] : $row['icons_url']; + $order_list = '' . $order_list; + } + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + $order_list = '' . $order_list; + + $imglist = filelist($phpbb_root_path . $img_path, ''); + + $filename_list = ''; + foreach ($imglist as $img) + { + $img = substr($img['path'], 1) . (($img['path'] != '') ? '/' : '') . $img['file']; + + if (!in_array($img, $existing_imgs) || $action == 'edit') + { + if ((isset($data) && $img == $data[$fields . '_url']) || + (!isset($data) && !isset($edit_img))) + { + $selected = ' selected="selected"'; + $edit_img = $img; + } + else + { + $selected = ''; + } + + $filename_list .= ''; + } + } + unset($existing_imgs); + unset($imglist); + + page_header($user->lang[$lang]); + +?> + +

lang[$lang]; ?>

+ +

lang[$lang .'_EXPLAIN']; ?>

+ + + +
"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
lang[$lang . '_CONFIG'] ?>
lang[$lang . '_URL'] ?>    
lang[$lang . '_CODE'] ?>
lang[$lang . '_EMOTION'] ?>
lang[$lang . '_WIDTH'] ?>
lang[$lang . '_HEIGHT'] ?>
lang['DISPLAY_ON_POSTING'] ?>/>
lang[$lang . '_ORDER'] ?>
+ $img, + $fields . '_width' => $image_width, + $fields . '_height' => $image_height, + $fields . '_order' => $image_order, + 'display_on_posting'=> (!empty($_POST['display_on_posting'])) ? 1 : 0 + ); + if ($mode == 'emoticons') + { + $img_sql = array_merge($sql, array( + 'emoticon' => stripslashes($_POST['emotion']), + 'code' => htmlspecialchars(stripslashes($_POST['code'])) + )); + } + + if ($action == 'modify') + { + $result = $db->sql_query('SELECT ' . $fields . '_order + FROM ' . $table . ' + WHERE ' . $fields . "_id = $image_id"); + $order_old = $db->sql_fetchfield($fields . '_order', 0, $result); + + if ($order_old == $smile_order) + { + $no_update = TRUE; + } + + if ($order_old > $smile_order) + { + $sign = '+'; + $where = $fields . "_order >= $image_order AND " . $fields . "_order < $order_old"; + } + else + { + $sign = '-'; + $where = $fields . "_order > $order_old AND " . $fields . "_order < $image_order"; + $sql[$fields . '_order'] = $smile_order - 1; + } + } + else + { + $sign = '+'; + $where = $fields . "_order > $image_order"; + } + + if (empty($no_update)) + { + $sql = 'UPDATE ' . $table . ' + SET ' . $fields . '_order = ' . $fields . "_order $sign 1 + WHERE $where"; + $db->sql_query($sql); + } + + if ($action == 'modify') + { + $db->sql_query('UPDATE ' . $table . ' + SET ' . $db->sql_build_array('UPDATE', $img_sql) . " + WHERE " . $fields . "_id = $image_id"); + $cache->destroy('icons'); + + trigger_error($user->lang[$lang . '_EDITED']); + } + else + { + $db->sql_query('INSERT INTO ' . $table . ' ' . $db->sql_build_array('INSERT', $img_sql)); + $cache->destroy('icons'); + + trigger_error($user->lang[$lang . '_ADDED']); + } + break; + + case 'import': + + if (!empty($_POST['pak'])) + { + $order = 0; + + // The user has already selected a smilies_pak file + if ($_POST['current'] == 'delete') + { + $db->sql_query('TRUNCATE ' . $table); + + switch ($mode) + { + case 'emoticons': + break; + + case 'icons': + // Reset all icon_ids + $db->sql_query('UPDATE ' . TOPICS_TABLE . ' + SET icon_id = 0'); + $db->sql_query('UPDATE ' . POSTS_TABLE . ' + SET icon_id = 0'); + break; + } + } + else + { + $cur_img = array(); + + $field_sql = ($mode == 'emoticons') ? 'code' : 'icons_url'; + $result = $db->sql_query('SELECT ' . $field_sql . ' + FROM ' . $table); + if ($row = $db->sql_fetchrow($result)) + { + do + { + ++$order; + $cur_img[$row[$field_sql]] = 1; + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + } + + if (!($pak_ary = @file($phpbb_root_path . $img_path . '/'. stripslashes($_POST['pak'])))) + { + trigger_error('Could not read smiley pak file', E_USER_ERROR); + } + + foreach ($pak_ary as $pak_entry) + { + $data = array(); + if (preg_match_all("#'(.*?)', #", $pak_entry, $data)) + { + if ((sizeof($data[1]) == 5 && $mode == 'icons') || + (sizeof($data[1]) != 5 && $mode == 'emoticons')) + { + trigger_error($user->lang['WRONG_PAK_TYPE']); + } + + $img = stripslashes($data[1][0]); + $width = stripslashes($data[1][1]); + $height = stripslashes($data[1][2]); + if (isset($data[1][3]) && isset($data[1][4])) + { + $emotion = stripslashes($data[1][3]); + $code = htmlentities(stripslashes($data[1][4])); + } + + if ($_POST['current'] == 'replace' && + (($mode == 'emoticons' && !empty($cur_img[$code])) || + ($mode == 'icons' && !empty($cur_img[$img])))) + { + $replace_sql = ($mode == 'emoticons') ? $code : $img; + $sql = array( + $fields . '_url' => $img, + $fields . '_height' => intval($height), + $fields . '_width' => intval($width), + ); + if ($mode == 'emoticons') + { + $sql = array_merge($sql, array( + 'emoticon' => $emotion + )); + } + + $db->sql_query("UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . " + WHERE $field_sql = '" . $db->sql_escape($replace_sql) . "'"); + } + else + { + ++$order; + + $sql = array( + $fields . '_url' => $img, + $fields . '_height' => intval($height), + $fields . '_width' => intval($width), + $fields . '_order' => intval($order), + ); + if ($mode == 'emoticons') + { + $sql = array_merge($sql, array( + 'code' => $code, + 'emoticon' => $emotion + )); + } + $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql)); + } + + } + } + + $cache->destroy('icons'); + + trigger_error($user->lang[$lang . '_IMPORT_SUCCESS']); + } + else + { + $paklist = filelist($phpbb_root_path . $img_path, '', 'pak'); + + $pak_options = ''; + if (count($paklist)) + { + foreach ($paklist as $pak) + { + $pak = substr($pak['path'], 1) . (($pak['path'] != '') ? '/' : '') . $pak['file']; + + $pak_options .= ''; + } + } + + page_header($user->lang[$lang]); + +?> +

lang[$lang] ?>

+ +

lang[$lang .'_EXPLAIN'] ?>

+ +
+ + + + + + + + + + + + + + + + + + + + +
lang[$lang . '_IMPORT'] ?>
lang['NO_' . $lang . '_PAK']; ?>
lang['SELECT_PACKAGE'] ?>
lang['CURRENT_' . $lang] ?>
lang['CURRENT_' . $lang . '_EXPLAIN'] ?>
lang['KEEP_ALL'] ?>    lang['REPLACE_MATCHES'] ?>    lang['DELETE_ALL'] ?> 
+lang['EXPORT_' . $lang]); + trigger_error(sprintf($user->lang['EXPORT_' . $lang . '_EXPLAIN'], '', '')); + break; + + case 'send': + + $result = $db->sql_query('SELECT * + FROM ' . $table . " + ORDER BY {$fields}_order"); + if ($row = $db->sql_fetchrow($result)) + { + do + { + $pak .= "'" . addslashes($row[$fields . '_url']) . "', "; + $pak .= "'" . addslashes($row[$fields . '_height']) . "', "; + $pak .= "'" . addslashes($row[$fields . '_width']) . "', "; + if ($mode == 'emoticons') + { + $pak .= "'" . addslashes($row['emoticon']) . "', "; + $pak .= "'" . addslashes($row['code']) . "', "; + } + $pak .= "\n"; + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + if ($pak != '') + { + $db->sql_close(); + + header('Content-Type: text/x-delimtext; name="' . $fields . '.pak"'); + header('Content-disposition: attachment; filename=' . $fields . '.pak"'); + echo $pak; + exit; + } + else + { + trigger_error($user->lang['NO_' . $fields . '_EXPORT']); + } + break; + + case 'move_up': + case 'move_down': + $image_order = intval($_GET['order']); + $order_total = $image_order * 2 + (($action == 'move_up') ? -1 : 1); + + $sql = 'UPDATE ' . $table . ' + SET ' . $fields . "_order = $order_total - " . $fields . '_order + WHERE ' . $fields . "_order IN ($image_order, " . (($action == 'move_up') ? $image_order - 1 : $image_order + 1) . ')'; + $db->sql_query($sql); + + $cache->destroy('icons'); + + // No break; here, display the smilies admin back + + default: + + // By default, check that smile_order is valid and fix it if necessary + $result = $db->sql_query('SELECT * FROM ' . $table . ' ORDER BY ' . $fields . '_order'); + if ($row = $db->sql_fetchrow($result)) + { + $order = 0; + do + { + ++$order; + if ($row[$fields . '_order'] != $order) + { + $db->sql_query('UPDATE ' . $table . ' + SET ' . $fields . '_order = ' . $order . ' + WHERE ' . $fields . '_id = ' . $row[$fields . '_id']); + } + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + // Output the page + page_header($user->lang[$lang]); + +?> + +

lang[$lang]; ?>

+ +

lang[$lang .'_EXPLAIN']; ?>

+ +
+ + + + + + +
   lang['IMPORT_' . $lang]; ?> | lang['EXPORT_' . $lang]; ?>
+ + + + + + + + + +sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$spacer && !$row['display_on_posting']) + { + $spacer = TRUE; +?> + + + + + + + + + + + + + +sql_freeresult($result); + +?> + + + +
lang[$lang]; ?>lang['CODE']; ?>lang['EMOTION']; ?>lang['ACTION']; ?>lang['REORDER']; ?>
lang[$lang . '_NOT_DISPLAYED'] ?>
<?php echo $alt_text; ?>">lang['EDIT']; ?> | ">lang['DELETE']; ?>">lang['MOVE_UP']; ?>
">lang['MOVE_DOWN']; ?>
+ + $dir, 'file' => $fname); + } + else if ($fname != '.' && $fname != '..' && + !is_file($rootdir . $dir . '/' . $fname) && + !is_link($rootdir . $dir . '/' . $fname)) + { + filelist($rootdir, $dir . '/'. $fname, $type); + } + } + + closedir($dh); + + return $images; +} +// +// FUNCTIONS +// --------- + +?> \ No newline at end of file diff --git a/phpBB/adm/admin_permissions.php b/phpBB/adm/admin_permissions.php new file mode 100644 index 0000000000..0b0f3c2f05 --- /dev/null +++ b/phpBB/adm/admin_permissions.php @@ -0,0 +1,962 @@ +acl_get('a_auth')) ? $filename . $SID . '&mode=forums' : ''; + $module['FORUM']['MODERATORS'] = ($auth->acl_get('a_authmods')) ? $filename . $SID . '&mode=moderators' : ''; + $module['FORUM']['SUPER_MODERATORS'] = ($auth->acl_get('a_authmods')) ? $filename . $SID . '&mode=supermoderators' : ''; + $module['GENERAL']['ADMINISTRATORS'] = ($auth->acl_get('a_authadmins')) ? $filename . $SID . '&mode=administrators' : ''; + $module['USER']['PERMISSIONS'] = ($auth->acl_get('a_authusers')) ? $filename . $SID . '&mode=users' : ''; + $module['GROUP']['PERMISSIONS'] = ($auth->acl_get('a_authgroups')) ? $filename . $SID . '&mode=groups' : ''; + + return; +} + +define('IN_PHPBB', 1); + +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Define some vars +$forum_id = 0; +$forum_sql = ''; +if (isset($_REQUEST['f'])) +{ + $forum_id = intval($_REQUEST['f']); + $forum_sql = " WHERE forum_id = $forum_id"; +} + +$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; +$username = (isset($_REQUEST['username'])) ? $_REQUEST['username'] : ''; +$group_id = (isset($_REQUEST['g'])) ? intval($_REQUEST['g']) : ''; +$entries = (isset($_POST['entries'])) ? $_POST['entries'] : ''; + + + +// Start program proper +switch ($mode) +{ + case 'forums': + $l_title = $user->lang['PERMISSIONS']; + $l_title_explain = $user->lang['PERMISSIONS_EXPLAIN']; + $which_acl = 'a_auth'; + $type_sql = 'f'; + break; + + case 'moderators': + $l_title = $user->lang['MODERATORS']; + $l_title_explain = $user->lang['MODERATORS_EXPLAIN']; + $which_acl = 'a_authmods'; + $type_sql = 'm'; + break; + + case 'supermoderators': + $l_title = $user->lang['SUPER_MODERATORS']; + $l_title_explain = $user->lang['SUPER_MODERATORS_EXPLAIN']; + $which_acl = 'a_authmods'; + $type_sql = 'm'; + break; + + case 'administrators': + $l_title = $user->lang['ADMINISTRATORS']; + $l_title_explain = $user->lang['ADMINISTRATORS_EXPLAIN']; + $which_acl = 'a_authadmins'; + $type_sql = 'a'; + break; + + case 'users': + $l_title = $user->lang['USER_PERMISSIONS']; + $l_title_explain = $user->lang['USER_PERMISSIONS_EXPLAIN']; + $which_acl = 'a_authusers'; + $type_sql = 'u'; + break; + + case 'groups': + $l_title = $user->lang['GROUP_PERMISSIONS']; + $l_title_explain = $user->lang['GROUP_PERMISSIONS_EXPLAIN']; + $which_acl = 'a_authgroups'; + $type_sql = 'u'; + break; + +} + +// Permission check +if (!$auth->acl_get($which_acl)) +{ + trigger_error($user->lang['NO_ADMIN']); +} + + + + +// Call update or delete, both can take multiple user/group +// ids. Additionally inheritance is handled (by the auth API) +switch ($_POST['runas']) +{ + case 'now': + if (isset($_POST['update'])) + { + $auth_admin = new auth_admin(); + + // Admin wants subforums to inherit permissions ... so handle this + if (!empty($_POST['inherit'])) + { + array_push($_POST['inherit'], $forum_id); + $forum_id = $_POST['inherit']; + } + + foreach ($_POST['entries'] as $id) + { + $auth_admin->acl_set($_POST['type'], $forum_id, $id, $_POST['option']); + } + + cache_moderators(); + + trigger_error('Permissions updated successfully'); + } + else if (isset($_POST['delete'])) + { + $auth_admin = new auth_admin(); + + $option_ids = false; + if (!empty($_POST['option'])) + { + $sql = "SELECT auth_option_id + FROM " . ACL_OPTIONS_TABLE . " + WHERE auth_value LIKE '" . $_POST['option'] . "_%'"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $option_ids = array(); + do + { + $option_ids[] = $row['auth_option_id']; + } + while($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + } + + foreach ($_POST['entries'] as $id) + { + $auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids); + } + + cache_moderators(); + + trigger_error('Permissions updated successfully'); + } + else if (isset($_POST['presetsave'])) + { + $holding_ary = array(); + foreach ($_POST['option'] as $acl_option => $allow_deny) + { + switch ($allow_deny) + { + case ACL_ALLOW: + $holding_ary['allow'][] = $acl_option; + break; + case ACL_DENY: + $holding_ary['deny'][] = $acl_option; + break; + case ACL_INHERIT: + $holding_ary['inherit'][] = $acl_option; + break; + } + } + + $sql = array( + 'preset_user_id' => $user->data['user_id'], + 'preset_type' => $type_sql, + 'preset_data' => $db->sql_escape(serialize($holding_ary)) + ); + + if (!empty($_POST['presetname'])) + { + $sql['preset_name'] = $db->sql_escape($_POST['presetname']); + } + + if (!empty($_POST['presetname']) || $_POST['presetoption'] != -1) + { + $sql = ($_POST['presetoption'] == -1) ? 'INSERT INTO ' . ACL_PRESETS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql) : 'UPDATE ' . ACL_PRESETS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . ' WHERE preset_id =' . $_POST['presetoption']; + $db->sql_query($sql); + } + } + else if (isset($_POST['presetdel'])) + { + if (!empty($_POST['presetoption'])) + { + $sql = "DELETE FROM " . ACL_PRESETS_TABLE . " + WHERE preset_id = " . intval($_POST['presetoption']); + $db->sql_query($sql); + } + } + break; + + case 'evt': + if (isset($_POST['submit'])) + { + // user_ids are returned in user_id_ary, a simple array + $evt_code = "\$auth_admin = new auth_admin(); if (!empty(\$evt_inherit)){ array_push(\$evt_inherit, intval(\$evt_f)); } foreach (\$user_id_ary as \$id) { \$auth_admin->acl_set('user', \$evt_inherit, intval(\$id), \$evt_option); } cache_moderators();"; + + // event_code, type (user or group), id's (of users/groups), ... other data ... + event_create($evt_code, $_POST['type'], $_POST['entries'], array('mode' => $_POST['mode']), array('f' => $_POST['forum_id']), array('entries' => $_POST['entries']), array('inherit' => $_POST['inherit']), array('type' => $_POST['type']), array('option' => $_POST['option'])); + } + + // form submit page, ... associative data ... + event_define('admin_permissions', array('mode' => $mode), array('forum_id' => $forum_id), array('inherit' => $_POST['inherit']), array('entries' => $_POST['entries']), array('type' => $_POST['type']), array('option' => $_POST['option'])); + break; + + case 'crn': + break; +} + + + + + + + + + +// Get required information, either all forums if no id was +// specified or just the requsted if it was +if (!empty($forum_id) || !empty($group_id) || !empty($username) || + $mode == 'administrators' || $mode == 'supermoderators') +{ + // Clear some vars, grab some info if relevant ... + $s_hidden_fields = ''; + + + if (!empty($forum_id)) + { + $sql = "SELECT forum_name, parent_id + FROM " . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + + $forum_info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $l_title .= ' : ' . $forum_info['forum_name'] . ''; + } + else if (!empty($username)) + { + $sql = "SELECT user_id + FROM " . USERS_TABLE . " + WHERE username IN ('$username')"; + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) + { + trigger_error($user->lang['No_such_user']); + } + $db->sql_freeresult($result); + + $entries = array($row['user_id']); + $l_title .= ' : ' . $username . ''; + } + else if (!empty($group_id)) + { + $sql = "SELECT group_name + FROM " . GROUPS_TABLE . " + WHERE group_id IN ($group_id)"; + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) + { + trigger_error($user->lang['No_such_group']); + } + $db->sql_freeresult($result); + + $entries = array($group_id); + $l_title .= ' : ' . $row['group_name'] . ''; + } + + + + + // Generate header + page_header($l_title); + +?> + +

+ + 1' : ''; + + $sql = "SELECT auth_option_id, auth_value + FROM " . ACL_OPTIONS_TABLE . " + WHERE auth_value LIKE '" . $type_sql . "_%' + AND auth_value <> '" . $type_sql . "_' + $founder_sql"; + $result = $db->sql_query($sql); + + $auth_options = array(); + while ($row = $db->sql_fetchrow($result)) + { + $auth_options[] = $row; + } + $db->sql_freeresult($result); + + if ($_POST['type'] == 'user' && !empty($_POST['new'])) + { + $entries = explode("\n", $entries); + } + + $where_sql = ''; + foreach ($entries as $value) + { + $where_sql .= (($where_sql != '') ? ', ' : '') . (($_POST['type'] == 'user' && !empty($_POST['new'])) ? '\'' . $value . '\'' : intval($value)); + } + + + + + $ug = '';; + $ug_hidden = ''; + $auth_values = array(); + + switch ($_POST['type']) + { + case 'group': + $l_type = 'Group'; + + $sql = "SELECT g.group_id AS id, g.group_name AS name, o.auth_value, a.auth_allow_deny FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id $forum_sql AND g.group_id = a.group_id AND g.group_id IN ($where_sql) ORDER BY g.group_name ASC"; + break; + + case 'user': + $l_type = 'User'; + + $sql = "SELECT u.user_id AS id, u.username AS name, u.user_founder, o.auth_value, a.auth_allow_deny FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND u.user_id IN ($where_sql) ORDER BY u.username, u.user_regdate ASC"; break; + } + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $ug_test = (!empty($user->lang[$row['name']])) ? $user->lang[$row['name']] : $row['name']; + $ug .= (!strstr($ug, $ug_test)) ? $ug_test . "\n" : ''; + + $ug_test = ''; + $ug_hidden .= (!strstr($ug_hidden, $ug_test)) ? $ug_test : ''; + + $auth_values[$row['auth_value']] = (isset($auth_group[$row['auth_value']])) ? min($auth_group[$row['auth_value']], $row['auth_allow_deny']) : $row['auth_allow_deny']; + } + while ($row = $db->sql_fetchrow($result)); + } + else + { + $db->sql_freeresult($result); + + $sql = ($_POST['type'] == 'group') ? "SELECT group_id AS id, group_name AS name, group_type FROM " . GROUPS_TABLE . " WHERE group_id IN ($where_sql) ORDER BY group_name ASC" : "SELECT user_id AS id, username AS name, user_founder FROM " . USERS_TABLE . " WHERE username IN ($where_sql) ORDER BY username, user_regdate ASC"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + + do + { + $ug_test = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang[$row['name']] : $row['name']; + $ug .= (!strstr($ug, $ug_test)) ? $ug_test . "\n" : ''; + + $ug_test = ''; + $ug_hidden .= (!strstr($ug_hidden, $ug_test)) ? $ug_test : ''; + + $auth_values[$row['auth_value']] = (isset($auth_group[$row['auth_value']])) ? min($auth_group[$row['auth_value']], $row['auth_allow_deny']) : $row['auth_allow_deny']; + } + while ($row = $db->sql_fetchrow($result)); + } + else + { + } + } + $db->sql_freeresult($result); + + // Now we'll build a list of preset options ... + $preset_options = $preset_js = $preset_update_options = ''; + $holding = array(); + + // Do we have a parent forum? If so offer option + // to inherit from that + if ($forum_info['parent_id'] != 0) + { + switch ($_POST['type']) + { + case 'group': + $sql = "SELECT o.auth_value, a.auth_allow_deny FROM " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id AND a.forum_id = " . $forum_info['parent_id'] . " AND a.group_id IN ($where_sql)"; + break; + + case 'user': + $sql = "SELECT o.auth_value, a.auth_allow_deny FROM " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id AND a.forum_id = " . $forum_info['parent_id'] . " AND a.user_id IN ($where_sql)"; + break; + } + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + switch ($row['auth_allow_deny']) + { + case ACL_ALLOW: + $holding['allow'] .= $row['auth_value'] . ', '; + break; + + case ACL_DENY: + $holding['deny'] .= $row['auth_value'] . ', '; + break; + + case ACL_INHERIT: + $holding['inherit'] .= $row['auth_value'] . ', '; + break; + } + } + while ($row = $db->sql_fetchrow($result)); + + $preset_options .= ''; + $preset_js .= "\tpresets['preset_0'] = new Array();" . "\n"; + $preset_js .= "\tpresets['preset_0'] = new preset_obj('" . $holding['allow'] . "', '" . $holding['deny'] . "', '" . $holding['inherit'] . "');\n"; + } + $db->sql_freeresult($result); + } + + // Look for custom presets + $sql = "SELECT preset_id, preset_name, preset_data + FROM " . ACL_PRESETS_TABLE . " + WHERE preset_type = '$type_sql' + ORDER BY preset_id ASC"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $preset_update_options .= ''; + $preset_options .= ''; + + $preset_data = unserialize($row['preset_data']); + + foreach ($preset_data as $preset_type => $preset_type_ary) + { + $holding[$preset_type] = ''; + foreach ($preset_type_ary as $preset_option) + { + $holding[$preset_type] .= "$preset_option, "; + } + } + + $preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new Array();" . "\n"; + $preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new preset_obj('" . $holding['allow'] . "', '" . $holding['deny'] . "', '" . $holding['inherit'] . "');\n"; + } + while ($row = $db->sql_fetchrow($result)); + } + unset($holding); + + + +?> + + + +

lang['ACL_EXPLAIN']; ?>

+ +
"> + + + + + + +
lang['PRESETS']; ?>:
+ + + + + + +lang['acl_' . $auth_options[$i]['auth_value']])) ? $user->lang['acl_' . $auth_options[$i]['auth_value']] : ucfirst(preg_replace('#.*?_#', '', $auth_options[$i]['auth_value'])); + + if (!empty($_POST['presetsave']) || !empty($_POST['presetdel'])) + { + $allow_type = ($_POST['option'][$auth_options[$i]['auth_value']] == ACL_ALLOW) ? ' checked="checked"' : ''; + $deny_type = ($_POST['option'][$auth_options[$i]['auth_value']] == ACL_DENY) ? ' checked="checked"' : ''; + $inherit_type = ($_POST['option'][$auth_options[$i]['auth_value']] == ACL_INHERIT) ? ' checked="checked"' : ''; + } + else + { + $allow_type = ($auth_values[$auth_options[$i]['auth_value']] == ACL_ALLOW) ? ' checked="checked"' : ''; + $deny_type = ($auth_values[$auth_options[$i]['auth_value']] == ACL_DENY) ? ' checked="checked"' : ''; + $inherit_type = ($auth_values[$auth_options[$i]['auth_value']] == ACL_INHERIT) ? ' checked="checked"' : ''; + } + +?> + + + + + + + + + + + + + +acl_gets('a_events', 'a_cron')) + { + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; + +?> + + + + + + + + + + +
 lang['Option']; ?>  lang['Allow']; ?>  lang['Deny']; ?>  lang['Inherit']; ?> 
/> /> />
lang['Inheritance']; ?>
+ + + + + + + + + + + +
lang['Inheritance_explain']; ?>
lang['MARK_ALL']; ?> :: lang['UNMARK_ALL']; ?>
lang['RUN_HOW']; ?>
lang['RUN_AS_NOW']; ?>acl_get('a_events')) + { + +?>   lang['RUN_AS_EVT']; + } + if ($auth->acl_get('a_cron')) + { + +?>   lang['RUN_AS_CRN']; + + } + +?>
  
+ +
+ + + + + + + + + + + +
lang['PRESETS']; ?>
+ + + + + + + + + + + +
lang['PRESETS_EXPLAIN']; ?>
lang['SELECT_PRESET']; ?>:
lang['PRESET_NAME']; ?>:
 
+ + + +

+ + + + + + + + + + + + + + + + + + + + +

lang['Users']; ?>

lang['Groups']; ?>

"> +sql_query($sql); + + $users = ''; + while ($row = $db->sql_fetchrow($result)) + { + $users .= ''; + } + $db->sql_freeresult($result); + +?> + + + + + + + + + +
lang['Manage_users']; ?>
 
"> +sql_query($sql); + + $groups = ''; + while ($row = $db->sql_fetchrow($result)) + { + $groups .= ''; + } + $db->sql_freeresult($result); + + $sql = "SELECT group_id, group_name + FROM " . GROUPS_TABLE . " + ORDER BY group_type DESC, group_name"; + $result = $db->sql_query($sql); + + $group_list = ''; + while ($row = $db->sql_fetchrow($result)) + { + $group_list .= ''; + } + $db->sql_freeresult($result); + +?> + + + + + + + + + +
lang['Manage_groups']; ?>
 
"> + + + + + + + + + +
lang['Add_users']; ?>
    &mode=searchuser&form=2&field=entries', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" />
"> + + + + + + + + + +
lang['Add_groups']; ?>
 
+ + + +

+ +

+ +
"> + + + + + + + + + + + + + + +sql_query($sql); + + $group_options = ''; + if ($row = $db->sql_fetchrow($result)) + { + do + { + $group_options .= (($group_options != '') ? ', ' : '') . ''; + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + +?> + + + + + + + +
lang['LOOK_UP_FORUM']; ?>
    
lang['Select_a_User']; ?>
', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" />
lang['SELECT_A_GROUP']; ?>
    
+ + \ No newline at end of file diff --git a/phpBB/adm/admin_prune.php b/phpBB/adm/admin_prune.php new file mode 100644 index 0000000000..5b0f5c48c9 --- /dev/null +++ b/phpBB/adm/admin_prune.php @@ -0,0 +1,203 @@ +acl_get('a_prune')) + { + return; + } + + $module['FORUM']['PRUNE'] = basename(__FILE__) . $SID . '&mode=forums'; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Do we have permission? +if (!$auth->acl_get('a_prune')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Get the forum ID for pruning +if (isset($_REQUEST['f'])) +{ + $forum_id = intval($_REQUEST['f']); + $forum_sql = ($forum_id == -1) ? '' : "AND forum_id = $forum_id"; +} +else +{ + $forum_id = ''; + $forum_sql = ''; +} + + +// Check for submit to be equal to Prune. If so then proceed with the pruning. +if (isset($_POST['doprune'])) +{ + $prunedays = (isset($_POST['prunedays'])) ? intval($_POST['prunedays']) : 0; + + // Convert days to seconds for timestamp functions... + $prunedate = time() - ($prunedays * 86400); + + page_header($user->lang['PRUNE']); + +?> + +

lang['PRUNE']; ?>

+ +

lang['PRUNE_SUCCESS']; ?>

+ + + + + + + +sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $log_data = ''; + do + { + $p_result = prune($forum_rows[$i]['forum_id'], $prunedate); + sync('forum', $forum_rows[$i]['forum_id']); + + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; + +?> + + + + + +sql_fetchrow($result)); + + add_log('admin', 'log_prune', $log_data); + + } + else + { + +?> + + + +sql_freeresult($result); + +?> +
lang['FORUM']; ?>lang['TOPICS_PRUNED']; ?>lang['POSTS_PRUNED']; ?>
lang['NO_PRUNE']; ?>
+ +
+ +lang['PRUNE']); + +?> + +

lang['PRUNE']; ?>

+ +

lang['FORUM_PRUNE_EXPLAIN']; ?>

+ +' . $user->lang['ALL_FORUMS'] . '' . make_forum_select(false, false, false); + +?> + +
+ + + + + + +
lang['SELECT_FORUM']; ?>
    
+ +sql_query($sql); + + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $forum_name = ($forum_id == -1) ? $user->lang['ALL_FORUMS'] : $row['forum_name']; + +?> + +

lang['FORUM'] . ': ' . $forum_name; ?>

+ +
+ + + + + + + + + +
lang['FORUM_PRUNE']; ?>
lang['PRUNE_NOT_POSTED'], ''); ?>
+ + \ No newline at end of file diff --git a/phpBB/adm/admin_prune_users.php b/phpBB/adm/admin_prune_users.php new file mode 100644 index 0000000000..ef466b1be5 --- /dev/null +++ b/phpBB/adm/admin_prune_users.php @@ -0,0 +1,260 @@ +acl_get('a_userdel')) + { + return; + } + + $module['USER']['PRUNE_USERS'] = basename(__FILE__) . $SID; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Do we have forum admin permissions? +if (!$auth->acl_get('a_userdel')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Set mode +$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; + +// Do prune +if (isset($_POST['prune'])) +{ + if (empty($_POST['confirm'])) + { + $values = array('prune', 'deactivate', 'delete', 'users', 'username', 'email', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'deleteposts'); + + $l_message = '
' . $user->lang['Confirm_prune_users'] . '

  '; + + foreach ($values as $field) + { + $l_message .= (!empty($_POST[$field])) ? '' : ''; + } + + $l_message .= '
'; + + page_header($user->lang['Prune_users']); + +?> + +

lang['PRUNE_USERS']; ?>

+ +

lang['PRUNE_USERS_EXPLAIN']; ?>

+ +lang['CONFIRM'], $l_message, false); + page_footer(); + + } + else if (isset($_POST['confirm'])) + { + if (!empty($_POST['users'])) + { + $users = explode("\n", urldecode($_POST['users'])); + + $where_sql = ''; + foreach ($users as $username) + { + $where_sql .= (($where_sql != '') ? ', ' : '') . '\'' . trim($username) . '\''; + } + $where_sql = " AND username IN ($where_sql)"; + } + else + { + $username = (!empty($_POST['username'])) ? urldecode($_POST['username']) : ''; + $email = (!empty($_POST['email'])) ? urldecode($_POST['email']) : ''; + + $joined_select = (!empty($_POST['joined_select'])) ? $_POST['joined_select'] : 'lt'; + $active_select = (!empty($_POST['active_select'])) ? $_POST['active_select'] :'lt'; + $count_select = (!empty($_POST['count_select'])) ? $_POST['count_select'] : 'eq'; + $joined = (!empty($_POST['joined'])) ? explode('-', $_POST['joined']) : array(); + $active = (!empty($_POST['active'])) ? explode('-', $_POST['active']) :array(); + $count = (!empty($_POST['count'])) ? intval($_POST['count']) : ''; + + $key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); + $sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit'); + + $where_sql = ''; + $where_sql .= ($username) ? " AND username LIKE '" . str_replace('*', '%', $username) ."'" : ''; + $where_sql .= ($email) ? " AND user_email LIKE '" . str_replace('*', '%', $email) ."' " : ''; + $where_sql .= ($joined) ? " AND user_regdate " . $key_match[$joined_select] . " " . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : ''; + $where_sql .= ($count) ? " AND user_posts " . $key_match[$count_select] . " $count " : ''; + $where_sql .= ($active) ? " AND user_lastvisit " . $key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : ''; + } + + $sql = "SELECT username, user_id FROM " . USERS_TABLE . " + WHERE user_id <> " . ANONYMOUS . " + $where_sql"; + $result = $db->sql_query($sql); + + $where_sql = ''; + $user_ids = array(); + $usernames = array(); + if ($row = $db->sql_fetchrow($result)) + { + do + { + $where_sql .= (($where_sql != '') ? ', ' : '') . $row['user_id']; + $user_ids[] = $row['user_id']; + $usernames[] = $row['username']; + } + while ($row = $db->sql_fetchrow($result)); + + $where_sql = " AND user_id IN ($where_sql)"; + } + $db->sql_freeresult($result); + + if ($where_sql != '') + { + $sql = ''; + if (!empty($_POST['delete'])) + { + if (!empty($_POST['deleteposts'])) + { + $l_admin_log = 'log_prune_user_del_del'; + + // + // Call unified post deletion routine? + // + } + else + { + $l_admin_log = 'log_prune_user_del_anon'; + + for($i = 0; $i < sizeof($user_ids); $i++) + { + $sql = "UPDATE " . POSTS_TABLE . " + SET poster_id = " . ANONYMOUS . ", post_username = '" . $usernames[$i] . "' + WHERE user_id = " . $userids[$i]; +// $db->sql_query($sql); + } + } + + $sql = "DELETE FROM " . USERS_TABLE; + } + else if (!empty($_POST['deactivate'])) + { + $l_admin_log = 'log_prune_user_deac'; + + $sql = "UPDATE " . USERS_TABLE . " SET user_active = 0"; + } + $sql .= " WHERE user_id <> " . ANONYMOUS . " + $where_sql"; +// $db->sql_query($sql); + + add_log('admin', $l_admin_log, implode(', ', $usernames)); + + unset($user_ids); + unset($usernames); + } + + message_die(MESSAGE, $user->lang['Success_user_prune']); + } +} + +// +// +// +$find_count = array('lt' => $user->lang['Less_than'], 'eq' => $user->lang['Equal_to'], 'gt' => $user->lang['More_than']); +$s_find_count = ''; +foreach ($find_count as $key => $value) +{ + $selected = ($key == 'eq') ? ' selected="selected"' : ''; + $s_find_count .= ''; +} + +$find_time = array('lt' => $user->lang['Before'], 'gt' => $user->lang['After']); +$s_find_join_time = ''; +foreach ($find_time as $key => $value) +{ + $s_find_join_time .= ''; +} +$s_find_active_time = ''; +foreach ($find_time as $key => $value) +{ + $s_find_active_time .= ''; +} + +// +// +// +page_header($user->lang['Prune_users']); + +?> + +

lang['Prune_users']; ?>

+ +

lang['Prune_users_explain']; ?>

+ +
"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
lang['Prune_users']; ?>
lang['USERNAME']; ?>:
lang['Email']; ?>:
lang['Joined']; ?>:
lang['Joined_explain']; ?>
lang['Last_active']; ?>:
lang['Last_active_explain']; ?>
lang['Posts']; ?>:
lang['Prune_users']; ?>:
lang['Select_users_explain']; ?>
lang['Delete_user_posts']; ?>:
lang['Delete_user_posts_explain']; ?>
lang['Yes']; ?>    lang['No']; ?>
    ', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" />
+ + \ No newline at end of file diff --git a/phpBB/adm/admin_ranks.php b/phpBB/adm/admin_ranks.php new file mode 100644 index 0000000000..26f9dabff8 --- /dev/null +++ b/phpBB/adm/admin_ranks.php @@ -0,0 +1,270 @@ +acl_get('a_ranks')) + { + return; + } + + $module['USER']['RANKS'] = basename(__FILE__) . $SID; + return; +} + +define('IN_PHPBB', 1); +// Let's set the root dir for phpBB +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Do we have permission? +if (!$auth->acl_get('a_ranks')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Check mode +if (isset($_REQUEST['mode'])) +{ + $mode = $_REQUEST['mode']; +} +else +{ + // These could be entered via a form button + if (isset($_POST['add'])) + { + $mode = 'add'; + } + else if (isset($_POST['save'])) + { + $mode = 'save'; + } + else + { + $mode = ''; + } +} + +// Process mode +if ($mode != '') +{ + if ($mode == 'edit' || $mode == 'add') + { + // + // They want to add a new rank, show the form. + // + $rank_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0; + + $s_hidden_fields = ''; + + if ($mode == 'edit') + { + if (empty($rank_id)) + { + trigger_error($user->lang['Must_select_rank']); + } + + $sql = "SELECT * FROM " . RANKS_TABLE . " + WHERE rank_id = $rank_id"; + $result = $db->sql_query($sql); + + $rank_info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $s_hidden_fields .= ''; + + } + else + { + $rank_info['rank_special'] = 0; + } + + page_header($user->lang['RANKS']); + +?> + +

lang['RANKS']; ?>

+ +

lang['RANKS_EXPLAIN']; ?>

+ +
"> + + + + + + + + + + + + + + + + + + + + + + +
lang['RANKS']; ?>
lang['RANK_TITLE']; ?>:
lang['RANK_SPECIAL']; ?>: />lang['YES']; ?>    /> lang['NO']; ?>
lang['RANK_MINIMUM']; ?>:
lang['RANK_IMAGE']; ?>:
lang['RANK_IMAGE_EXPLAIN']; ?>
  ' : ''; ?>
  
+ +lang['MUST_SELECT_RANK']); + } + + if ($special_rank == 1) + { + $min_posts = -1; + } + + // + // The rank image has to be a jpg, gif or png + // + if ($rank_image != '') + { + if (!preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#is', $rank_image)) + { + $rank_image = ''; + } + } + + if ($rank_id) + { + $sql = "UPDATE " . RANKS_TABLE . " + SET rank_title = '" . $db->sql_escape($rank_title) . "', rank_special = $special_rank, rank_min = $min_posts, rank_image = '" . $db->sql_escape($rank_image) . "' + WHERE rank_id = $rank_id"; + + $message = $user->lang['RANK_UPDATED']; + } + else + { + $sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_special, rank_min, rank_image) + VALUES ('" . $db->sql_escape($rank_title) . "', $special_rank, $min_posts, '" . $db->sql_escape($rank_image) . "')"; + + $message = $user->lang['RANK_ADDED']; + } + $db->sql_query($sql); + + trigger_error($message); + + } + else if ($mode == 'delete') + { + // Ok, they want to delete their rank + $rank_id = (isset($_REQUEST['id'])) ? intval($_REQUEST['id']) : 0; + + if ($rank_id) + { + $sql = "DELETE FROM " . RANKS_TABLE . " + WHERE rank_id = $rank_id"; + $db->sql_query($sql); + + $sql = "UPDATE " . USERS_TABLE . " + SET user_rank = 0 + WHERE user_rank = $rank_id"; + $db->sql_query($sql); + + trigger_error($user->lang['RANK_REMOVED']); + + } + else + { + trigger_error($user->lang['MUST_SELECT_RANK']); + } + } +} + +page_header($user->lang['RANKS']); + +?> + +

lang['RANKS']; ?>

+ +

lang['RANKS_EXPLAIN']; ?>

+ +
"> + + + + + + +sql_query($sql); + +if ($row = $db->sql_fetchrow($result)) +{ + do + { + $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; +?> + + + + + + +sql_fetchrow($result)); +} + +?> + + + +
lang['RANK_IMAGE']; ?>lang['RANK_TITLE']; ?>lang['RANK_MINIMUM']; ?>lang['ACTION']; ?>
<?php echo $row['rank_title']; ?> ">lang['EDIT']; ?> | ">lang['DELETE']; ?> 
+ + \ No newline at end of file diff --git a/phpBB/adm/admin_search.php b/phpBB/adm/admin_search.php new file mode 100644 index 0000000000..70f4d752a2 --- /dev/null +++ b/phpBB/adm/admin_search.php @@ -0,0 +1,327 @@ +acl_get('a_search')) + { + return; + } + + $module['DB']['SEARCH_INDEX'] = basename(__FILE__) . $SID; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); +include($phpbb_root_path . 'includes/functions_posting.'.$phpEx); + +// Check permissions +if (!$auth->acl_get('a_search')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Start indexing +if (isset($_POST['start']) || isset($_GET['batchstart'])) +{ + $batchsize = 200; // Process this many posts per batch + $batchstart = (!isset($_GET['batchstart'])) ? $row['min_post_id'] : $_GET['batchstart']; + $batchcount = (!isset($_GET['batchcount'])) ? 1 : $_GET['batchcount']; + $loopcount = 0; + $batchend = $batchstart + $batchsize; + + // Search re-indexing is tough on the server ... so we'll check the load + // each loop and if we're on a 1min load of 3 or more we'll re-load the page + // and try again. No idea how well this will work in practice so we'll see ... + if (file_exists('/proc/loadavg')) + { + if ($load = @file('/proc/loadavg')) + { + list($load) = explode(' ', $load[0]); + + if ($load > 3) + { + redirect("admin_search.$phpEx$SID&batchstart=$batchstart&batchcount=$batch_count"); + } + } + } + + // Try and load stopword and synonym files + $stopword_array = array(); + $synonym_array = array(); + + $dir = opendir($phpbb_root_path . 'language/'); + while ($file = readdir($dir)) + { + if (preg_match('#^lang_#', $file) && !is_file($phpbb_root_path . 'language/' . $file) && !is_link($phpbb_root_path . 'language/' . $file)) + { + unset($tmp_array); + $tmp_array = @file($phpbb_root_path . 'language/' . $file . '/search_stopwords.txt'); + if (is_array($tmp_array)) + { + $stopword_array = array_unique(array_merge($stopword_array, $tmp_array)); + } + + unset($tmp_array); + $tmp_array = @file($phpbb_root_path . 'language/' . $file . '/search_synonyms.txt'); + if (is_array($tmp_array)) + { + $synonym_array = array_unique(array_merge($synonym_array, $tmp_array)); + } + } + } + + closedir($dir); + + if (!isset($_GET['batchstart'])) + { + // Take board offline + set_config('board_disable', 1); + + // Empty existing tables + $db->sql_query("TRUNCATE " . SEARCH_TABLE); + $db->sql_query("TRUNCATE " . SEARCH_WORD_TABLE); + $db->sql_query("TRUNCATE " . SEARCH_MATCH_TABLE); + } + + // Fetch a batch of posts_text entries + $sql = "SELECT COUNT(*) AS total, MAX(post_id) AS max_post_id, MIN(post_id) AS min_post_id + FROM " . POSTS_TEXT_TABLE; + $result = $db->sql_query($sql); + + $row = $db->sql_fetchrow($result); + $totalposts = $row['total']; + $max_post_id = $row['max_post_id']; + + $db->sql_freeresult($result); + + $sql = "SELECT * + FROM " . POSTS_TEXT_TABLE . " + WHERE post_id + BETWEEN $batchstart + AND $batchend"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $post_id = $row['post_id']; + + $search_raw_words = array(); + $search_raw_words['text'] = split_words(clean_words('post', $row['post_text'], $stopword_array, $synonym_array)); + $search_raw_words['title'] = split_words(clean_words('post', $row['post_subject'], $stopword_array, $synonym_array)); + + $word = array(); + $word_insert_sql = array(); + foreach ($search_raw_words as $word_in => $search_matches) + { + $word_insert_sql[$word_in] = ''; + if (!empty($search_matches)) + { + for ($i = 0; $i < count($search_matches); $i++) + { + $search_matches[$i] = trim($search_matches[$i]); + + if ($search_matches[$i] != '') + { + $word[] = $search_matches[$i]; + $word_insert_sql[$word_in] .= ($word_insert_sql[$word_in] != '') ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'"; + } + } + } + } + + if (count($word)) + { + $word_text_sql = ''; + $word = array_unique($word); + + for($i = 0; $i < count($word); $i++) + { + $word_text_sql .= (($word_text_sql != '') ? ', ' : '') . "'" . $word[$i] . "'"; + } + + $check_words = array(); + switch(SQL_LAYER) + { + case 'postgresql': + case 'msaccess': + case 'mssql-odbc': + case 'oracle': + case 'db2': + $sql = "SELECT word_id, word_text + FROM " . SEARCH_WORD_TABLE . " + WHERE word_text IN ($word_text_sql)"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $check_words[$row['word_text']] = $row['word_id']; + } + break; + } + + $value_sql = ''; + $match_word = array(); + for ($i = 0; $i < count($word); $i++) + { + $new_match = true; + if (isset($check_words[$word[$i]])) + { + $new_match = false; + } + + if ($new_match) + { + switch(SQL_LAYER) + { + case 'mysql': + case 'mysql4': + $value_sql .= (($value_sql != '') ? ', ' : '') . '(\'' . $word[$i] . '\')'; + break; + case 'mssql': + $value_sql .= (($value_sql != '') ? ' UNION ALL ' : '') . "SELECT '" . $word[$i] . "'"; + break; + default: + $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) + VALUES ('" . $word[$i] . "')"; + $db->sql_query($sql); + break; + } + } + } + + if ($value_sql != '') + { + switch (SQL_LAYER) + { + case 'mysql': + case 'mysql4': + $sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text) + VALUES $value_sql"; + break; + case 'mssql': + $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) + $value_sql"; + break; + } + + $db->sql_query($sql); + } + } + + foreach ($word_insert_sql as $word_in => $match_sql) + { + $title_match = ($word_in == 'title') ? 1 : 0; + + if ($match_sql != '') + { + $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) + SELECT $post_id, word_id, $title_match + FROM " . SEARCH_WORD_TABLE . " + WHERE word_text IN ($match_sql)"; + $db->sql_query($sql); + } + } + + } + while ($row = $db->sql_fetchrow($result)); + } + + $db->sql_freeresult($result); + + // Remove common words after the first 2 batches and after every 4th batch after that. + if ($batchcount % 4 == 3) + { +// remove_common('global', $config['common_search']); + } + + $batchcount++; + + if (($batchstart + $batchsize) < $max_post_id) + { + redirect("Location: admin_search.$phpEx$SID&batchstart=" . ($batchstart + $batchsize) . "&batchcount=$batch_count"); + } + else + { + set_config('board_disable', 0); + page_header($user->lang['SEARCH_INDEX']); + +?> + +

lang['SEARCH_INDEX']; ?>

+ +

lang['SEARCH_INDEX_COMPLETE']; ?>

+ +lang['SEARCH_INDEX']); + +?> + +

lang['SEARCH_INDEX']; ?>

+ +

lang['SEARCH_INDEX_CANCEL']; ?>

+ +lang['Search_index']); + +?> + +

lang['SEARCH_INDEX']; ?>

+ +

lang['SEARCH_INDEX_EXPLAIN']; ?>

+ +
"> + + + +
     
+ + \ No newline at end of file diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php new file mode 100644 index 0000000000..0035c9f7fe --- /dev/null +++ b/phpBB/adm/admin_styles.php @@ -0,0 +1,361 @@ +acl_get('a_styles') ) + { + return; + } + + $filename = basename(__FILE__); + $module['STYLE']['EDIT_STYLE'] = $filename . "$SID&mode=newstyle"; + $module['STYLE']['EDIT_TEMPLATE'] = $filename . "$SID&mode=edittemplate"; + $module['STYLE']['EDIT_THEME'] = $filename . "$SID&mode=edittheme"; + $module['STYLE']['EDIT_IMAGESET'] = $filename . "$SID&mode=editimageset"; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Do we have styles admin permissions? +if (!$auth->acl_get('a_styles')) +{ + trigger_error($user->lang['No_admin']); +} + +/* +$dp = opendir($phpbb_root_path . 'templates/cache/'); +while ($file = readdir($dp)) +{ + if (!is_file($phpbb_root_path . 'templates/cache/' . $file) && !is_link($phpbb_root_path . 'templates/cache/' . $file) && $file != '.' && $file != '..') + { + $selected = ($tplroot == $file) ? ' selected="selected"' : ''; + $tplroot_options .= ''; + } +} +closedir($dp); +*/ + +// +$mode = (isset($_GET['mode'])) ? $_GET['mode'] : $_POST['mode']; + +switch ($mode) +{ + case 'editimageset': + $imgroot = (isset($_POST['imgroot'])) ? $_POST['imgroot'] : $config['default_style']; + + if (isset($_POST['img_addconfig'])) + { + } + else if (isset($_POST['img_addlocal'])) + { + } + + $imageset = array('imageset_path', 'post_new', 'post_locked', 'post_pm', 'reply_new', 'reply_pm', 'reply_locked', 'icon_profile', 'icon_pm', 'icon_delete', 'icon_ip', 'icon_quote', 'icon_search', 'icon_edit', 'icon_email', 'icon_www', 'icon_icq', 'icon_aim', 'icon_yim', 'icon_msnm', 'icon_no_email', 'icon_no_www', 'icon_no_icq', 'icon_no_aim', 'icon_no_yim', 'icon_no_msnm', 'goto_post', 'goto_post_new', 'goto_post_latest', 'goto_post_newest', 'forum', 'forum_new', 'forum_locked', 'sub_forum', 'sub_forum_new', 'folder', 'folder_new', 'folder_hot', 'folder_hot_new', 'folder_locked', 'folder_locked_new', 'folder_sticky', 'folder_sticky_new', 'folder_announce', 'folder_announce_new', 'topic_watch', 'topic_unwatch', 'poll_left', 'poll_center', 'poll_right', 'rating'); + + $sql = "SELECT imageset_name, imageset_path + FROM " . STYLES_IMAGE_TABLE . " + ORDER BY imageset_name"; + $result = $db->sql_query($sql); + + $imgroot_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($imgroot == $row['imageset_path']) ? ' selected="selected"' : ''; + $imgroot_options .= ''; + } + + $imgname_options = ''; + $dp = opendir($phpbb_root_path . 'imagesets/' . $imgroot . '/'); + while ($file = readdir($dp)) + { + if (preg_match('#\.(gif|png|jpg|jpeg)$#', $file) && is_file($phpbb_root_path . 'imagesets/' . $imgroot . '/' . $file)) + { + $selected = ($imgname == $file) ? ' selected="selected"' : ''; + $imgname_options .= ''; + } + } + closedir($dp); + + // Output page + page_header($user->lang['Edit_Imageset']); + +?> + +
+ +

Edit Imageset

+ +

Template set:    

+ +

Here you can create, edit, delete and download imagesets.

+ +sql_query($sql); + + $images = $db->sql_fetchrow($result); + +?> + + + + +' : ''; + $img = str_replace('"imagesets/', '"../imagesets/', $img); + $img = str_replace('{LANG}', $user->img_lang, $img); + $img = str_replace('{RATE}', 3, $img); +?> + + + + + + + + + +
ImageGraphic 
 
+ +compile(stripslashes($_POST['decompile'])) . "\n?".">"; + + $fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'w+'); + fwrite ($fp, $str); + fclose($fp); + + @chmod($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 0644); + + add_log('admin', 'log_template_edit', $tplname, $tplroot); + + exit; + } + else if (!empty($tplname) && isset($_POST['tpl_name'])) + { + $fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r'); + while (!feof($fp)) + { + $str .= fread($fp, 4096); + } + @fclose($fp); + + $template->decompile($str); + } + else + { + $str = (!empty($_POST['decompile'])) ? stripslashes($_POST['decompile']) : ''; + } + + if (isset($_POST['tpl_download'])) + { + header("Content-Type: text/html; name=\"" . $tplname . ".html\""); + header("Content-disposition: attachment; filename=" . $tplname . ".html"); + echo $str; + exit; + + } + + $tplroot_options = get_templates($tplroot); + + $tplname_options = ''; + $dp = @opendir($phpbb_root_path . 'templates/cache/' . $tplroot . '/'); + while ($file = readdir($dp)) + { + if (strstr($file, '.html.' . $phpEx) && is_file($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $file)) + { + $tpl = substr($file, 0, strpos($file, '.')); + $selected = ($tplname == $tpl) ? ' selected="selected"' : ''; + $tplname_options .= ''; + } + } + closedir($dp); + + // + page_header($user->lang['Edit_template']); + +?> + +

lang['Edit_template']; ?>

+ +

lang['Edit_template_explain']; ?>

+ +
"> + +

lang['Select_template']; ?>:  

+ + + + + + + + + + + +
+ + + + + +
 Template:   Columns:  Rows:    
   
+ +sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $theme_name = $row['theme_name']; + + $css_data = (!empty($_POST['css_data'])) ? htmlentities($_POST['css_data']) : ''; + $css_external = (!empty($_POST['css_data'])) ? $_POST['css_data'] : ''; + + $sql = "UPDATE " > STYLES_CSS_TABLE . " + SET css_data = '$css_data', css_external = '$css_external' + WHERE theme_id = $theme_id"; + $db->sql_query($sql); + + add_log('admin', 'log_theme_edit', $theme_name); + + message_die(MESSAGE, $user->lang['Success_theme_update']); + } + } + + page_header($user->lang['Edit_theme']); + + $sql = "SELECT theme_id, theme_name + FROM " . STYLES_CSS_TABLE; + $result = $db->sql_query($sql); + + $theme_options = ''; + if ($row = $db->sql_fetchrow($result)) + { + do + { + $theme_options .= (($theme_options != '') ? ', ' : '') . ''; + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + $css_data = ''; + $css_external = ''; + if ($theme_id) + { + $sql = "SELECT css_data, css_external + FROM " . STYLES_CSS_TABLE . " + WHERE theme_id = $theme_id"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $css_data = preg_replace('/\t{1,}/i', ' ', $row['css_data']); + $css_external = $row['css_external']; + } + } + +?> + +
"> + +

lang['Edit_theme']; ?>

+ +

lang['Edit_theme_explain']; ?>

+ + + + + + + + + + + + + + + + +
lang['Select_theme']; ?>:  
lang['CSS_data']; ?>:
lang['CSS_data_explain']; ?>
lang['CSS_sheet']; ?>:
  
+ +sql_query($sql); + + $tplroot_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($tplroot == $row['template_path']) ? ' selected="selected"' : ''; + $tplroot_options .= ''; + } + + return $tplroot_options; +} + +?> \ No newline at end of file diff --git a/phpBB/adm/admin_users.php b/phpBB/adm/admin_users.php new file mode 100644 index 0000000000..b09102e77d --- /dev/null +++ b/phpBB/adm/admin_users.php @@ -0,0 +1,361 @@ +acl_gets('a_user', 'a_useradd', 'a_userdel')) + { + return; + } + + $module['USER']['MANAGE'] = basename(__FILE__) . $SID; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Set mode +$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'main'; + +// Begin program +if (isset($_POST['username']) || isset($_REQUEST['u'])) +{ + // Grab relevant userdata + if(isset($_REQUEST['u'])) + { + $user_id = intval($_REQUEST['u']); + + if(!($userdata = get_userdata($user_id))) + { + trigger_error($user->lang['NO_USER']); + } + } + else + { + if(!$userdata = get_userdata($_POST['username'])) + { + trigger_error($user->lang['NO_USER']); + } + } + + // Update entry in DB + if ($_POST['deleteuser'] && !$userdata['user_founder']) + { + if (!$auth->acl_get('a_userdel')) + { + trigger_error($user->lang['NO_ADMIN']); + } + + $db->sql_transaction(); + + $sql = "UPDATE " . POSTS_TABLE . " + SET poster_id = " . ANONYMOUS . ", post_username = '$username' + WHERE poster_id = $user_id"; + $db->sql_query($sql); + + $sql = "UPDATE " . TOPICS_TABLE . " + SET topic_poster = " . ANONYMOUS . " + WHERE topic_poster = $user_id"; + $db->sql_query($sql); + + $sql = "DELETE FROM " . USERS_TABLE . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + $sql = "DELETE FROM " . USER_GROUP_TABLE . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + $sql = "DELETE FROM " . FORUMS_WATCH_TABLE . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + $sql = "DELETE FROM " . ACL_USERS_TABLE . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + $db->sql_transaction('commit'); + + trigger_error($user->lang['User_deleted']); + } + + + // Output relevant page + page_header($user->lang['MANAGE']); + +?> + +
+ + + + + + + +
Main | Profile | Preferences | Avatar | Permissions
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Username:
Click profile to edit
[ Ban ]
Registered: format_date($userdata['user_regdate']); ?>
Registered from IP: [ Lookup | Ban ]
IP whois for
' . trim($ipwhois) . '
'; + } +?>
Total/Average posts by this user:
+ +acl($userdata); + + foreach ($acl_options['global'] as $option_name => $option_id) + { + $type = substr($option_name, 0, strpos('_', $option_name) +1); + $global[$type][$option_name] = $userauth->acl_get($option_name); + } + + $sql = "SELECT forum_id, forum_name + FROM " . FORUMS_TABLE . " + ORDER BY left_id"; + $result = $db->sql_query($sql); + + $permissions = array(); + while($row = $db->sql_fetchrow($result)) + { + $forum_data[$row['forum_id']] = $row['forum_name']; + + foreach ($acl_options['local'] as $option_name => $option_id) + { + $local[$row['forum_id']][$option_name] = $userauth->acl_get($option_name, $row['forum_id']); + } + } + +?> + + + + + + + + + + + $auth_ary) + { + foreach ($auth_ary as $option => $allow) + { + if ($option != $type .'_') + { + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; + + $l_can_cell = (!empty($user->lang['acl_' . $option])) ? $user->lang['acl_' . $option] : ucfirst(preg_replace('#.*?_#', '', $option)); + + $allow_type = ($allow == ACL_ALLOW) ? ' checked="checked"' : ''; + $deny_type = ($allow == ACL_DENY) ? ' checked="checked"' : ''; +?> + + + + + + +
Select permission set:  
 lang['Option']; ?>  lang['Allow']; ?>  lang['Deny']; ?> 
/> />
+ + + $auth_ary) + { + +?> + + + $allow) + { + echo ''; + } + +?> +
' . $user->lang['acl_' . $option] . ' => ' . (($allow) ? 'Allowed' : 'Denied') . '
+ +acl_get('a_user')) +{ + trigger_error($user->lang['No_admin']); +} + +page_header($user->lang['Manage']); + +?> + +

lang['User_admin']; ?>

+ +

lang['User_admin_explain']; ?>

+ +
+ + + + + + +
lang['Select_a_User']; ?>
', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" />
+ + 'whois.ripe.net', + '#whois\.apnic\.net#is' => 'whois.apnic.net', + '#nic\.ad\.jp#is' => 'whois.nic.ad.jp', + '#whois\.registro\.br#is' => 'whois.registro.br' + ); + + if (($fsk = fsockopen('whois.arin.net', 43))) + { + @fputs($fsk, "$ip\n"); + while (!feof($fsk)) + { + $ipwhois .= fgets($fsk, 1024); + } + fclose($fsk); + } + + foreach (array_keys($match) as $server) + { + if (preg_match($server, $ipwhois)) + { + $ipwhois = ''; + if (($fsk = fsockopen($match[$server], 43))) + { + @fputs($fsk, "$ip\n"); + while (!feof($fsk)) + { + $ipwhois .= fgets($fsk, 1024); + } + fclose($fsk); + } + break; + } + } + + return $ipwhois; +} +// FUNCTIONS +// --------- + +?> \ No newline at end of file diff --git a/phpBB/adm/admin_viewlogs.php b/phpBB/adm/admin_viewlogs.php new file mode 100644 index 0000000000..e544fd144a --- /dev/null +++ b/phpBB/adm/admin_viewlogs.php @@ -0,0 +1,254 @@ +acl_get('a_general')) + { + return; + } + + $filename = basename(__FILE__); + $module['LOG']['ADMIN_LOGS'] = $filename . "$SID&mode=admin"; + $module['LOG']['MOD_LOGS'] = $filename . "$SID&mode=mod"; + + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Do we have styles admin permissions? +if (!$auth->acl_get('a_general')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Set some variables +$forum_id = (isset($_REQUEST['f'])) ? intval($_REQUEST['f']) : 0; +$start = (isset($_GET['start'])) ? intval($_GET['start']) : 0; +$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'admin'; + +// Define some vars depending on which logs we're looking at +$log_table_sql = ($mode == 'admin') ? LOG_ADMIN_TABLE : LOG_MOD_TABLE; +$l_title = ($mode == 'admin') ? $user->lang['ADMIN_LOGS'] : $user->lang['MOD_LOGS']; +$l_title_explain = ($mode == 'admin') ? $user->lang['ADMIN_LOGS_EXPLAIN'] : $user->lang['MOD_LOGS_EXPLAIN']; + +// Delete entries if requested and able +if ((isset($_POST['delmarked']) || isset($_POST['delall'])) && $auth->acl_get('a_clearlogs')) +{ + $where_sql = ''; + if (isset($_POST['delmarked']) && isset($_POST['mark'])) + { + foreach ($_POST['mark'] as $marked) + { + $where_sql .= (($where_sql != '') ? ', ' : '') . intval($marked); + } + $where_sql = "WHERE log_id IN ($where_sql)"; + } + + $sql = "DELETE FROM $table_sql + $where_sql"; + $db->sql_query($sql); + + add_log('admin', 'log_' . $mode . '_clear'); +} + +// Sorting ... this could become a function +if (isset($_POST['sort']) || $start) +{ + if (!empty($_POST['sort_days'])) + { + $sort_days = intval($_POST['sort_days']); + $where_sql = time() - ($sort_days * 86400); + } + else + { + $where_sql = 0; + } + + $sort_key = (isset($_POST['sort_key'])) ? $_POST['sort_key'] : ''; + $sort_dir = (isset($_POST['sort_dir'])) ? $_POST['sort_dir'] : ''; +} +else +{ + $where_sql = 0; + + $sort_days = 0; + $sort_key = 't'; + $sort_dir = 'd'; +} + + + +$previous_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'], 364 => $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 = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); + +$sort_day_options = ''; +foreach ($previous_days as $day => $text) +{ + $selected = ($sort_days == $day) ? ' selected="selected"' : ''; + $sort_day_options .= ''; +} + +$sort_key_options = ''; +foreach ($sort_by_text as $key => $text) +{ + $selected = ($sort_key == $key) ? ' selected="selected"' : ''; + $sort_key_options .= ''; +} + +$sort_order_options = ($sort_dir == 'a') ? '' : ''; + +$sort_sql = $sort_by[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + +// Output page +page_header($l_title); + +?> + +

+ +

+ +
"> +' . $user->lang['ALL_FORUMS'] . '' . make_forum_select($forum_id, false, false); + +?> + + + + +
lang['SELECT_FORUM']; ?>:
+ + + + + + + + + + + + + + + + + + + + + +acl_get('a_clearlogs')) + { + +?> + + + + + + + + +
lang['DISPLAY_LOG']; ?>:   lang['SORT_BY']; ?>  
lang['USERNAME']; ?>lang['IP']; ?>lang['TIME']; ?>lang['ACTION']; ?>lang['MARK']; ?>
format_date($log_data[$i]['time']); ?>
   
lang['NO_ENTRIES']; ?>
+ + + + + + +
 acl_get('a_clearlogs')) + { + + +?>lang['MARK_ALL']; ?> :: lang['UNMARK_ALL']; ?> 

+ + + + \ No newline at end of file diff --git a/phpBB/adm/admin_words.php b/phpBB/adm/admin_words.php new file mode 100644 index 0000000000..e8880e86d6 --- /dev/null +++ b/phpBB/adm/admin_words.php @@ -0,0 +1,229 @@ +acl_get('a_words')) + { + return; + } + + $module['POST']['WORD_CENSOR'] = basename(__FILE__) . $SID; + return; +} + +define('IN_PHPBB', 1); +// Include files +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// Do we have forum admin permissions? +if (!$auth->acl_get('a_words')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// What do we want to do? +if (isset($_REQUEST['mode'])) +{ + $mode = $_REQUEST['mode']; +} +else +{ + // These could be entered via a form button + if (isset($_POST['add'])) + { + $mode = 'add'; + } + else if (isset($_POST['save'])) + { + $mode = 'save'; + } + else + { + $mode = ''; + } +} + +if ($mode != '') +{ + switch ($mode) + { + case 'edit': + case 'add': + $word_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0; + + $s_hidden_fields = ''; + if ($mode == 'edit') + { + if (!$word_id) + { + trigger_error($user->lang['NO_WORD']); + } + + $sql = "SELECT * + FROM " . WORDS_TABLE . " + WHERE word_id = $word_id"; + $result = $db->sql_query($sql); + + $word_info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $s_hidden_fields .= ''; + } + + page_header($user->lang['WORDS_TITLE']); + +?> + +

lang['WORDS_TITLE']; ?>

+ +

lang['WORDS_EXPLAIN']; ?>

+ +
"> + + + + + + + + + + + + + + +
lang['EDIT_WORD']; ?>
lang['WORD']; ?>
lang['REPLACEMENT']; ?>
+ +lang['ENTER_WORD']); + } + + $sql = ($word_id) ? "UPDATE " . WORDS_TABLE . " SET word = '" . $db->sql_escape($word) . "', replacement = '" . $db->sql_escape($replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . $db->sql_escape($word) . "', '" . $db->sql_escape($replacement) . "')"; + $db->sql_query($sql); + + $cache->destroy('word_censors'); + + $log_action = ($word_id) ? 'log_edit_word' : 'log_add_word'; + add_log('admin', $log_action, stripslashes($word)); + + $message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED']; + break; + + case 'delete': + + if (isset($_POST['id']) || isset($_GET['id'])) + { + $word_id = (isset($_POST['id'])) ? intval($_POST['id']) : intval($_GET['id']); + } + else + { + trigger_error($user->lang['NO_WORD']); + } + + $sql = "DELETE FROM " . WORDS_TABLE . " + WHERE word_id = $word_id"; + $db->sql_query($sql); + + $cache->destroy('word_censors'); + + add_log('admin', 'log_delete_word'); + + $message = $user->lang['WORD_REMOVE']; + break; + + } + + trigger_error($message); + +} +else +{ + + page_header($user->lang['WORDS_TITLE']); + +?> + +

lang['WORDS_TITLE']; ?>

+ +

lang['WORDS_EXPLAIN']; ?>

+ +
+ + + + + + +sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; + +?> + + + + + + +sql_fetchrow($result)); + } + $db->sql_freeresult($result); + +?> + + + +
lang['WORD']; ?>lang['REPLACEMENT']; ?>lang['ACTION']; ?>
 ">lang['EDIT']; ?>  ">lang['DELETE']; ?> 
+ + \ No newline at end of file diff --git a/phpBB/adm/forms.css b/phpBB/adm/forms.css new file mode 100644 index 0000000000..ff9c6dc922 --- /dev/null +++ b/phpBB/adm/forms.css @@ -0,0 +1,13 @@ +/* Fancy form styles for IE */ + +input, textarea, select { + border-width: 1px; +} + +input { + text-indent: 2px; +} + +.postbody { + line-height: 18px +} diff --git a/phpBB/adm/images/cellpic1.gif b/phpBB/adm/images/cellpic1.gif new file mode 100644 index 0000000000000000000000000000000000000000..715b8d4aa8b8752fc3e2ff6deb214cd424ad413f GIT binary patch literal 246 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 literal 0 HcmV?d00001 diff --git a/phpBB/adm/images/icon_folder.gif b/phpBB/adm/images/icon_folder.gif new file mode 100644 index 0000000000000000000000000000000000000000..9b2bc47c67aa83051fcf1a312a739046b9976b8e GIT binary patch literal 677 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 b>!qVc=I$d>1W(ixfTAPf`U7Dw=<9z03;}cD literal 0 HcmV?d00001 diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php new file mode 100644 index 0000000000..2f285ca04a --- /dev/null +++ b/phpBB/adm/index.php @@ -0,0 +1,521 @@ +acl_get('a_')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Generate relevant output +if (isset($_GET['pane']) && $_GET['pane'] == 'top') +{ + page_header('', '', false); + +?> + + + + + + +
phpBB Logolang['ADMIN_TITLE']; ?>      
+ +body {background-color: #98AAB1}', false); + + // Grab module information using Bart's "neat-o-module" system (tm) + $dir = @opendir('.'); + + $setmodules = 1; + while ($file = @readdir($dir)) + { + if (preg_match('#^admin_(.*?)\.' . $phpEx . '$#', $file)) + { + include($file); + } + } + + @closedir($dir); + + unset($setmodules); + +?> + + + + + +
+ + + + + + + + + + $action_ary) + { + $cat = (!empty($user->lang[$cat . '_CAT'])) ? $user->lang[$cat . '_CAT'] : preg_replace('#_#', ' ', $cat); + +?> + + + + $file) + { + if (!empty($file)) + { + $action = (!empty($user->lang[$action])) ? $user->lang[$action] : preg_replace('/_/', ' ', $action); + + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; +?> + + + + +
» lang['RETURN_TO']; ?>
lang['ADMIN_INDEX']; ?>
lang['FORUM_INDEX']; ?>
»
+ + +acl_get('a_user')) + { + trigger_error($user->lang['NO_ADMIN']); + } + + if (is_array($_POST['mark'])) + { + $in_sql = ''; + foreach ($_POST['mark'] as $user_id) + { + $in_sql .= (($in_sql != '') ? ', ' : '') . intval($user_id); + } + + if ($in_sql != '') + { + $sql = (isset($_POST['activate'])) ? "UPDATE " . USERS_TABLE . " SET user_active = 1 WHERE user_id IN ($in_sql)" : "DELETE FROM " . USERS_TABLE . " WHERE user_id IN ($in_sql)"; + $db->sql_query($sql); + + if (isset($_POST['delete'])) + { + $sql = "UPDATE " . CONFIG_TABLE . " + SET config_value = config_value - " . sizeof($_POST['mark']) . " + WHERE config_name = 'num_users'"; + $db->sql_query($sql); + } + + $log_action = (isset($_POST['activate'])) ? 'log_index_activate' : 'log_index_delete'; + add_admin_log($log_action, sizeof($_POST['mark'])); + } + } + } + else if (isset($_POST['remind'])) + { + if (!$auth->acl_get('a_user')) + { + trigger_error($user->lang['NO_ADMIN']); + } + + } + else if (isset($_POST['resetonline'])) + { + + } + + // Get forum statistics + $total_posts = $config['num_posts']; + $total_topics = $config['num_topics']; + $total_users = $config['num_users']; + + $start_date = $user->format_date($config['board_startdate']); + + $boarddays = (time() - $config['board_startdate']) / 86400; + + $posts_per_day = sprintf('%.2f', $total_posts / $boarddays); + $topics_per_day = sprintf('%.2f', $total_topics / $boarddays); + $users_per_day = sprintf('%.2f', $total_users / $boarddays); + + $avatar_dir_size = 0; + + if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path'])) + { + while ($file = @readdir($avatar_dir)) + { + if ($file != '.' && $file != '..') + { + $avatar_dir_size += @filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file); + } + } + @closedir($avatar_dir); + + // This bit of code translates the avatar directory size into human readable format + // Borrowed the code from the PHP.net annoted manual, origanally written by: + // Jesse (jesse@jess.on.ca) + if ($avatar_dir_size >= 1048576) + { + $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . ' MB'; + } + else if ($avatar_dir_size >= 1024) + { + $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . ' KB'; + } + else + { + $avatar_dir_size = $avatar_dir_size . ' Bytes'; + } + + } + else + { + // Couldn't open Avatar dir. + $avatar_dir_size = $user->lang['Not_available']; + } + + if ($posts_per_day > $total_posts) + { + $posts_per_day = $total_posts; + } + + if ($topics_per_day > $total_topics) + { + $topics_per_day = $total_topics; + } + + if ($users_per_day > $total_users) + { + $users_per_day = $total_users; + } + + // DB size ... MySQL only + // This code is heavily influenced by a similar routine + // in phpMyAdmin 2.2.0 + if (preg_match('/^mysql/', SQL_LAYER)) + { + $result = $db->sql_query('SELECT VERSION() AS mysql_version'); + + if ($row = $db->sql_fetchrow($result)) + { + $version = $row['mysql_version']; + + if (preg_match('#^(3\.23|4\.)#', $version)) + { + $db_name = (preg_match('#^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)#', $version)) ? "`$dbname`" : $dbname; + + $sql = "SHOW TABLE STATUS + FROM " . $db_name; + $result = $db->sql_query($sql); + + $dbsize = 0; + while ($row = $db->sql_fetchrow($result)) + { + if ($row['Type'] != 'MRG_MyISAM') + { + if ($table_prefix != '') + { + if (strstr($row['Name'], $table_prefix)) + { + $dbsize += $row['Data_length'] + $row['Index_length']; + } + } + else + { + $dbsize += $row['Data_length'] + $row['Index_length']; + } + } + } + } + else + { + $dbsize = $user->lang['Not_available']; + } + } + else + { + $dbsize = $user->lang['Not_available']; + } + } + else if (preg_match('#^mssql#', SQL_LAYER)) + { + $sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize + FROM sysfiles"; + $result = $db->sql_query($sql); + + $dbsize = ($row = $db->sql_fetchrow($result)) ? intval($row['dbsize']) : $user->lang['Not_available']; + } + else + { + $dbsize = $user->lang['Not_available']; + } + + if (is_int($dbsize)) + { + $dbsize = ($dbsize >= 1048576) ? sprintf('%.2f MB', ($dbsize / 1048576)) : (($dbsize >= 1024) ? sprintf('%.2f KB', ($dbsize / 1024)) : sprintf('%.2f Bytes', $dbsize)); + } + + page_header($user->lang['ADMIN_INDEX']); + +?> + + + +

lang['WELCOME_PHPBB']; ?>

+ +

lang['ADMIN_INTRO']; ?>

+ +

lang['FORUM_STATS']; ?>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
lang['STATISTIC']; ?>lang['VALUE']; ?>lang['STATISTIC']; ?>lang['VALUE']; ?>
lang['NUMBER_POSTS']; ?>:lang['POSTS_PER_DAY']; ?>:
lang['NUMBER_TOPICS']; ?>:lang['TOPICS_PER_DAY']; ?>:
lang['NUMBER_USERS']; ?>:lang['USERS_PER_DAY']; ?>:
lang['BOARD_STARTED']; ?>:lang['AVATAR_DIR_SIZE']; ?>:
lang['DATABASE_SIZE']; ?>:lang['GZIP_COMPRESSION']; ?>:lang['ON'] : $user->lang['OFF']; ?>
+ +

lang['ADMIN_LOG']; ?>

+ +

lang['ADMIN_LOG_INDEX_EXPLAIN']; ?>

+ + + + + + + + + + + + + + + +acl_get('a_user')) + { + +?> +
lang['USERNAME']; ?>lang['IP']; ?>lang['TIME']; ?>lang['ACTION']; ?>
format_date($log_data[$i]['time']); ?>
+ +

lang['INACTIVE_USERS']; ?>

+ +

lang['INACTIVE_USERS_EXPLAIN']; ?>

+ +
"> + + + + + + " . ANONYMOUS . " + ORDER BY user_regdate ASC"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; + +?> + + + + + +sql_fetchrow($result)); + +?> + + + + + + + + +
lang['USERNAME']; ?>lang['JOINED']; ?>lang['MARK']; ?>
format_date($row['user_regdate']); ?>  
     
lang['NO_INACTIVE_USERS']; ?>
+ + + + + +
lang['MARK_ALL']; ?> :: lang['UNMARK_ALL']; ?>
+ +lang['ENCODING']); + +?> + + +<?php echo $user->lang['Admin_title']; ?> + + + + " name="title" noresize marginwidth="0" marginheight="0" scrolling="NO"> + + " name="nav" marginwidth="3" marginheight="3" scrolling="yes"> + " name="main" marginwidth="0" marginheight="0" scrolling="auto"> + + + + + <body bgcolor="white" text="#000000"> + <p><?php echo $user->lang['No_frames']; ?></p> + </body> + + + \ No newline at end of file diff --git a/phpBB/adm/pagestart.php b/phpBB/adm/pagestart.php new file mode 100644 index 0000000000..752a3bbfe7 --- /dev/null +++ b/phpBB/adm/pagestart.php @@ -0,0 +1,181 @@ +start($update); +$user->setup(); +$auth->acl($user->data); +// End session management + +// ----------------------------- +// Functions +function page_header($sub_title, $meta = '', $table_html = true) +{ + global $config, $db, $user, $phpEx; + + define('HEADER_INC', true); + + // gzip_compression + if ($config['gzip_compress']) + { + if (extension_loaded('zlib') && !headers_sent()) + { + ob_start('ob_gzhandler'); + } + } + + header("Content-type: text/html; charset=" . $user->lang['ENCODING']); + +?> + + + + + + + + +<?php echo $config['sitename'] . ' - ' . $page_title; ?> + + + + + + + + + + +
»   
+ + + + + +

+ +sql_close(); + +?> + +
+ + +
Powered by phpBB © 2002 phpBB Group
+ +
+ + + +unload(); + } + + exit; +} + +function page_message($title, $message, $show_header = false) +{ + global $phpEx, $SID, $user; + + if ($show_header) + { + +?> + + + + + + +
phpBB Logolang['ADMIN_TITLE']; ?>      
+ + + +

+ + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/phpBB/adm/subSilver.css b/phpBB/adm/subSilver.css new file mode 100644 index 0000000000..4d1c250ed6 --- /dev/null +++ b/phpBB/adm/subSilver.css @@ -0,0 +1,187 @@ +/* + $Id$ + + The original "subSilver" theme for phpBB2 + Created by subBlue design :: http://www.subBlue.com + Copyright (c) 2002 phpBB Group +*/ + +body { + background-color: white; + font-family: Verdana, Arial, Helvetica, sans-serif; + margin: 0px; + border: 0px; + padding: 0px; + + scrollbar-face-color: #DEE3E7; + scrollbar-highlight-color: white; + scrollbar-shadow-color: #DEE3E7; + scrollbar-3dlight-color: #D1D7DC; + scrollbar-arrow-color: #006699; + scrollbar-track-color: #EFEFEF; + scrollbar-darkshadow-color: #98AAB1; +} + +p { + font-size: 8pt; +} + +.maintitle, h1, h2 { + font: bold 18pt 'Trebuchet MS', Verdana,sans-serif; + text-decoration:none; + line-height: 120%; +} + +.maintitle { + color: #12749B +} + +.subtitle { + font: bold 12pt Arial, Helvetica, sans-serif; +} + +/* + Anchors +*/ +a:link, a:active, a:visited { + color: #006699; +} +a.gen, a.genmed, a.gensmall { + color: #006699; + text-decoration: none; +} +a.nav { + color: #006699; + text-decoration: none; +} +a.copyright { + color: #444444; + text-decoration: none; +} + +a.gen:hover, a.genmed:hover, a.gensmall:hover { + color: #DD6900; + text-decoration: underline; +} +a:hover { + color: #DD6900; + text-decoration: underline; +} +a.nav:hover { + text-decoration: underline; +} +a.copyright:hover { + color: #DD6900; + text-decoration: underline; +} + +/* + Non-tag specific +*/ +.gen, .gensmall { + color: black; +} +.gen { + font-size: 8pt; +} +.gensmall { + font-size: 7pt; +} +.nav { + color: black; + font: bold 11px; +} +.name { + color: black; + font-size: 11px; +} +.postdetails { + color: black; + font-size: 10px; +} +.copyright { + color: #444444; + font: 8pt Verdana, Arial, Helvetica, sans-serif; + letter-spacing: -1px; +} + +/* + Tables +*/ +table.bg { + background-color: #ACBBC6 +} + +th, td { + font: 8pt Verdana, Arial, Helvetica, sans-serif; +} + +th { + height: 25px; + background-color: #006699; + color: #FFA34F; + font: bold 11px; +} + +th.menu { + text-align: left; +} + +td.cat { + height: 28px; + background-color: #D1D7DC; +} + +.row1 { + background-color: #EFEFEF; +} +.row2 { + background-color: #DEE3E7; +} +.row3 { + background-color: #D1D7DC; +} + +/* + Misc +*/ +hr { + height: 0px; + border: solid #D1D7DC 0px; + border-top-width: 1px; +} + +/* + Forms +*/ +input, textarea, select { + color: black; + font: normal 8pt Verdana, Arial, Helvetica, sans-serif; + border-color: black; +} + +input.text { + font-family: 'Courier New', courier; +} + +option.sep { + background-color: #EFEFEF; +} + +textarea.edit { + font: 9pt 'Courier New', courier; + line-height:125%; +} + +input.mainoption { + background-color: #FAFAFA; + font-weight: bold; +} + +input.liteoption { + background-color: #FAFAFA; + font-weight: normal; +} + +/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */ +@import url("forms.css"); diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php new file mode 100644 index 0000000000..ddfa63e5a8 --- /dev/null +++ b/phpBB/adm/swatch.php @@ -0,0 +1,56 @@ + + +phpBB 2.2 Color Swatch + + + + + + \ No newline at end of file