diff options
29 files changed, 0 insertions, 9494 deletions
diff --git a/phpBB/admin/admin_ban.php b/phpBB/admin/admin_ban.php deleted file mode 100644 index 71b58cdd00..0000000000 --- a/phpBB/admin/admin_ban.php +++ /dev/null @@ -1,578 +0,0 @@ -<?php -/*************************************************************************** - * admin_ban.php - * ------------------- - * begin : Tuesday, Jul 31, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -define('IN_PHPBB', 1); - -if (!empty($setmodules)) -{ - if (!$auth->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 .= '<option value="' . $length . '">' . $text . '</option>'; -} - -// -// 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); - -?> - -<p><?php echo $user->lang['BAN_EXPLAIN']; ?></p> - -<?php - -switch ($mode) -{ - case 'user': - - $field = 'username'; - $l_ban_title = $user->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 = '<input type="submit" name="usersubmit" value="' . $user->lang['Find_username'] . '" class="liteoption" onClick="window.open(\'../memberlist.' . $phpEx . $SID . '&mode=searchuser&field=ban\', \'_phpbbsearch\', \'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740\');return false;" />'; - - $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 .= '<option' . (($row['ban_exclude']) ? ' class="sep"' : '') . ' value="' . $row['ban_id'] . '">' . $row[$field] . '</option>'; - - $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); - -?> - -<h1><?php echo $l_ban_title; ?></h1> - -<p><?php echo $l_ban_explain; ?></p> - -<script language="Javascript" type="text/javascript"> -<!-- - -var ban_length = new Array(); -<?php - - if (sizeof($ban_length)) - { - foreach ($ban_length as $ban_id => $length) - { - echo "ban_length['$ban_id'] = \"$length\";\n"; - } - } - -?> - -var ban_reason = new Array(); -<?php - - if (sizeof($ban_reasons)) - { - foreach ($ban_reasons as $ban_id => $reason) - { - echo "ban_reason['$ban_id'] = \"$reason\";\n"; - } - } -?> - -function display_details(option) -{ - document.forms[0].unbanreason.value = ban_reason[option]; - document.forms[0].unbanlength.value = ban_length[option]; -} - -//--> -</script> - -<form method="post" action="<?php echo "admin_ban.$phpEx$SID&mode=$mode"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $l_ban_title; ?></th> - </tr> - <tr> - <td class="row2" width="45%"><?php echo $l_ban_cell; ?>: </td> - <td class="row1"><textarea cols="40" rows="3" name="ban"></textarea></td> - </tr> - <tr> - <td class="row2" width="45%"><?php echo $user->lang['BAN_LENGTH']; ?>:</td> - <td class="row1"><select name="banlength"><?php echo $ban_end_options; ?></select> <input type="text" name="banlengthother" maxlength="10" size="10" /></td> - </tr> - <tr> - <td class="row2" width="45%"><?php echo $user->lang['BAN_EXCLUDE']; ?>: <br /><span class="gensmall"><?php echo $l_ban_exclude_explain;;?></span></td> - <td class="row1"><input type="radio" name="banexclude" value="1" /> <?php echo $user->lang['YES']; ?> <input type="radio" name="banexclude" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row2" width="45%"><?php echo $user->lang['BAN_REASON']; ?>:</td> - <td class="row1"><input type="text" name="banreason" maxlength="255" size="40" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"> <input type="submit" name="bansubmit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="RESET" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /> <?php echo $s_submit_extra; ?></td> - </tr> -</table> - -<h1><?php echo $l_unban_title; ?></h1> - -<p><?php echo $l_unban_explain; ?></p> - -<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $l_unban_title; ?></th> - </tr> -<?php - - if ($banned_options != '') - { - -?> - <tr> - <td class="row2" width="45%"><?php echo $l_ban_cell; ?>: <br /></td> - <td class="row1"> <select name="unban[]" multiple="multiple" size="5" onchange="display_details(this.options[this.selectedIndex].value)"><?php echo $banned_options; ?></select></td> - </tr> - <tr> - <td class="row2" width="45%"><?php echo $user->lang['BAN_REASON']; ?>:</td> - <td class="row1"><input class="row1" style="border:0px" type="text" name="unbanreason" size="40" /></td> - </tr> - <tr> - <td class="row2" width="45%"><?php echo $user->lang['BAN_LENGTH']; ?>:</td> - <td class="row1"><input class="row1" style="border:0px" type="text" name="unbanlength" size="40" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="RESET" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /></td> - </tr> -<?php - - } - else - { - -?> - <tr> - <td class="row1" colspan="2" align="center"><?php echo $l_no_ban_cell; ?></td> - </tr> -<?php - - } - -?> -</table></form> - -<?php - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_board.php b/phpBB/admin/admin_board.php deleted file mode 100644 index 4dec8bdbf5..0000000000 --- a/phpBB/admin/admin_board.php +++ /dev/null @@ -1,580 +0,0 @@ -<?php -/*************************************************************************** - * admin_board.php - * ------------------- - * begin : Thursday, Jul 12, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - $file = basename(__FILE__); - $module['GENERAL']['COOKIE_SETTINGS'] = ($auth->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]); - -?> - -<h1><?php echo $user->lang[$l_title]; ?></h1> - -<p><?php echo $user->lang[$l_title . '_EXPLAIN']; ?></p> - -<form action="<?php echo "admin_board.$phpEx$SID&mode=$mode"; ?>" method="post"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang[$l_title]; ?></th> - </tr> -<?php - -// -// Output relevant page -// -switch ($mode) -{ - case 'cookie': - - $cookie_secure_yes = ($new['cookie_secure']) ? 'checked="checked"' : ''; - $cookie_secure_no = (!$new['cookie_secure']) ? 'checked="checked"' : ''; - -?> - <tr> - <td class="row1" width="50%"><?php echo $user->lang['Cookie_domain']; ?>: </td> - <td class="row2"><input type="text" maxlength="255" name="cookie_domain" value="<?php echo $new['cookie_domain']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Cookie_name']; ?>: </td> - <td class="row2"><input type="text" maxlength="16" name="cookie_name" value="<?php echo $new['cookie_name']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Cookie_path']; ?>: </td> - <td class="row2"><input type="text" maxlength="255" name="cookie_path" value="<?php echo $new['cookie_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Cookie_secure']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Cookie_secure_explain']; ?></span></td> - <td class="row2"><input type="radio" name="cookie_secure" value="0"<?php echo $cookie_secure_no; ?> /><?php echo $user->lang['DISABLED']; ?> <input type="radio" name="cookie_secure" value="1"<?php echo $cookie_secure_yes; ?> /><?php echo $user->lang['ENABLED']; ?></td> - </tr> -<?php - - break; - - case 'avatar': - - $avatars_local_yes = ($new['allow_avatar_local']) ? 'checked="checked"' : ''; - $avatars_local_no = (!$new['allow_avatar_local']) ? 'checked="checked"' : ''; - $avatars_remote_yes = ($new['allow_avatar_remote']) ? 'checked="checked"' : ''; - $avatars_remote_no = (!$new['allow_avatar_remote']) ? 'checked="checked"' : ''; - $avatars_upload_yes = ($new['allow_avatar_upload']) ? 'checked="checked"' : ''; - $avatars_upload_no = (!$new['allow_avatar_upload']) ? 'checked="checked"' : ''; - -?> - <tr> - <td class="row1" width="50%"><?php echo $user->lang['Allow_local']; ?>: </td> - <td class="row2"><input type="radio" name="allow_avatar_local" value="1"<?php echo $avatars_local_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_avatar_local" value="0"<?php echo $avatars_local_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allow_remote']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Allow_remote_explain']; ?></span></td> - <td class="row2"><input type="radio" name="allow_avatar_remote" value="1"<?php echo $avatars_remote_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_avatar_remote" value="0"<?php echo $avatars_remote_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allow_upload']; ?>: </td> - <td class="row2"><input type="radio" name="allow_avatar_upload" value="1"<?php echo $avatars_upload_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_avatar_upload" value="0"<?php echo $avatars_upload_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Max_filesize']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Max_filesize_explain']; ?></span></td> - <td class="row2"><input type="text" size="4" maxlength="10" name="avatar_filesize" value="<?php echo $new['avatar_filesize']; ?>" /> Bytes</td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Max_avatar_size']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Max_avatar_size_explain']; ?></span></td> - <td class="row2"><input type="text" size="3" maxlength="4" name="avatar_max_height" value="<?php echo $new['avatar_max_height']; ?>" /> x <input type="text" size="3" maxlength="4" name="avatar_max_width" value="<?php echo $new['avatar_max_width']; ?>"></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Avatar_storage_path']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Avatar_storage_path_explain']; ?></span></td> - <td class="row2"><input type="text" size="20" maxlength="255" name="avatar_path" value="<?php echo $new['avatar_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Avatar_gallery_path']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Avatar_gallery_path_explain']; ?></span></td> - <td class="row2"><input type="text" size="20" maxlength="255" name="avatar_gallery_path" value="<?php echo $new['avatar_gallery_path']; ?>" /></td> - </tr> -<?php - - break; - - case 'default': - - $style_select = style_select($new['default_style'], 'default_style', '../templates'); - $lang_select = language_select($new['default_lang'], 'default_lang', '../language'); - $timezone_select = tz_select($new['board_timezone'], 'board_timezone'); - - $override_user_style_yes = ($new['override_user_style']) ? 'checked="checked"' : ''; - $override_user_style_no = (!$new['override_user_style']) ? 'checked="checked"' : ''; - - $topic_notify_yes = ($new['allow_topic_notify']) ? 'checked="checked"' : ''; - $topic_notify_no = (!$new['allow_topic_notify']) ? 'checked="checked"' : ''; - - $forum_notify_yes = ($new['allow_forum_notify']) ? 'checked="checked"' : ''; - $forum_notify_no = (!$new['allow_forum_notify']) ? 'checked="checked"' : ''; - - $html_yes = ($new['allow_html']) ? 'checked="checked"' : ''; - $html_no = (!$new['allow_html']) ? 'checked="checked"' : ''; - - $bbcode_yes = ($new['allow_bbcode']) ? 'checked="checked"' : ''; - $bbcode_no = (!$new['allow_bbcode']) ? 'checked="checked"' : ''; - - $smile_yes = ($new['allow_smilies']) ? 'checked="checked"' : ''; - $smile_no = (!$new['allow_smilies']) ? 'checked="checked"' : ''; - - $sig_yes = ($new['allow_sig']) ? 'checked="checked"' : ''; - $sig_no = (!$new['allow_sig']) ? 'checked="checked"' : ''; - - $namechange_yes = ($new['allow_namechange']) ? 'checked="checked"' : ''; - $namechange_no = (!$new['allow_namechange']) ? 'checked="checked"' : ''; - -?> - <tr> - <td class="row1" width="50%"><?php echo $user->lang['Default_style']; ?></td> - <td class="row2"><?php echo $style_select; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Override_style']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Override_style_explain']; ?></span></td> - <td class="row2"><input type="radio" name="override_user_style" value="1" <?php echo $override_user_style_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="override_user_style" value="0" <?php echo $override_user_style_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Default_language']; ?>: </td> - <td class="row2"><?php echo $lang_select; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Date_format']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Date_format_explain']; ?></span></td> - <td class="row2"><input type="text" name="default_dateformat" value="<?php echo $new['default_dateformat']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['System_timezone']; ?>: </td> - <td class="row2"><?php echo $timezone_select; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Char_limit']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Char_limit_explain']; ?></span</td> - <td class="row2"><input type="text" size="4" maxlength="4" name="max_post_chars" value="<?php echo $new['max_post_chars']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Smilies_limit']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Smilies_limit_explain']; ?></span</td> - <td class="row2"><input type="text" size="4" maxlength="4" name="max_post_smilies" value="<?php echo $new['max_post_smilies']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allow_topic_notify']; ?>: </td> - <td class="row2"><input type="radio" name="allow_topic_notify" value="1" <?php echo $topic_notify_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_topic_notify" value="0" <?php echo $topic_notify_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allow_forum_notify']; ?>: </td> - <td class="row2"><input type="radio" name="allow_forum_notify" value="1" <?php echo $forum_notify_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_forum_notify" value="0" <?php echo $forum_notify_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allow_name_change']; ?>: </td> - <td class="row2"><input type="radio" name="allow_namechange" value="1" <?php echo $namechange_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_namechange" value="0" <?php echo $namechange_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allow_HTML']; ?>: </td> - <td class="row2"><input type="radio" name="allow_html" value="1" <?php echo $html_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_html" value="0" <?php echo $html_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allowed_tags']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Allowed_tags_explain']; ?></span></td> - <td class="row2"><input type="text" size="30" maxlength="255" name="allow_html_tags" value="<?php echo $new['allow_html_tags']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allow_BBCode']; ?>: </td> - <td class="row2"><input type="radio" name="allow_bbcode" value="1" <?php echo $bbcode_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_bbcode" value="0" <?php echo $bbcode_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allow_smilies']; ?>: </td> - <td class="row2"><input type="radio" name="allow_smilies" value="1" <?php echo $smile_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_smilies" value="0" <?php echo $smile_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Allow_sig']; ?>: </td> - <td class="row2"><input type="radio" name="allow_sig" value="1" <?php echo $sig_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="allow_sig" value="0" <?php echo $sig_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Max_sig_length']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Max_sig_length_explain']; ?></span></td> - <td class="row2"><input type="text" size="5" maxlength="4" name="max_sig_chars" value="<?php echo $new['max_sig_chars']; ?>" /></td> - </tr> -<?php - - break; - - case 'setting': - - $disable_board_yes = ($new['board_disable']) ? 'checked="checked"' : ''; - $disable_board_no = (!$new['board_disable']) ? 'checked="checked"' : ''; - - $confirm_enabled = ($new['enable_confirm']) ? 'checked="checked"' : ''; - $confirm_disabled = (!$new['enable_confirm']) ? 'checked="checked"' : ''; - - $coppa_enable_yes = ($new['coppa_enable']) ? 'checked="checked"' : ''; - $coppa_enable_no = (!$new['coppa_enable']) ? 'checked="checked"' : ''; - - $activation_none = ($new['require_activation'] == USER_ACTIVATION_NONE) ? 'checked="checked"' : ''; - $activation_user = ($new['require_activation'] == USER_ACTIVATION_SELF) ? 'checked="checked"' : ''; - $activation_admin = ($new['require_activation'] == USER_ACTIVATION_ADMIN) ? 'checked="checked"' : ''; - $activation_disable = ($new['require_activation'] == USER_ACTIVATION_DISABLE) ? 'checked="checked"' : ''; - - $privmsg_on = (!$new['privmsg_disable']) ? 'checked="checked"' : ''; - $privmsg_off = ($new['privmsg_disable']) ? 'checked="checked"' : ''; - - $prune_yes = ($new['prune_enable']) ? 'checked="checked"' : ''; - $prune_no = (!$new['prune_enable']) ? 'checked="checked"' : ''; - -?> - <tr> - <td class="row1" width="50%"><?php echo $user->lang['Site_name']; ?>: </td> - <td class="row2"><input type="text" size="40" maxlength="255" name="sitename" value="<?php echo htmlentities($new['sitename']); ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Site_desc']; ?>: </td> - <td class="row2"><input type="text" size="40" maxlength="255" name="site_desc" value="<?php echo htmlentities($new['site_desc']); ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Board_disable']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Board_disable_explain']; ?></span></td> - <td class="row2"><input type="radio" name="board_disable" value="1" <?php echo $disable_board_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="board_disable" value="0" <?php echo $disable_board_no; ?> /> <?php echo $user->lang['NO']; ?><br /><input type="text" name="board_disable_msg" maxlength="255" size="40" value="<?php echo $new['board_disable_msg']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Enable_prune']; ?>: </td> - <td class="row2"><input type="radio" name="prune_enable" value="1" <?php echo $prune_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="prune_enable" value="0" <?php echo $prune_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Acct_activation']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Acct_activation_explain']; ?></span></td> - <td class="row2"><input type="radio" name="require_activation" value="<?php echo USER_ACTIVATION_NONE; ?>" <?php echo $activation_none; ?> /><?php echo $user->lang['Acc_None']; ?> <input type="radio" name="require_activation" value="<?php echo USER_ACTIVATION_SELF; ?>" <?php echo $activation_user; ?> /><?php echo $user->lang['Acc_User']; ?> <input type="radio" name="require_activation" value="<?php echo USER_ACTIVATION_ADMIN; ?>" <?php echo $activation_admin; ?> /><?php echo $user->lang['Acc_Admin']; ?> <input type="radio" name="require_activation" value="<?php echo USER_ACTIVATION_DISABLE; ?>" <?php echo $activation_disable; ?> /><?php echo $user->lang['Acc_Disable']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['VISUAL_CONFIRM']; ?>: <br /><span class="gensmall"><?php echo $user->lang['VISUAL_CONFIRM_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="enable_confirm" value="1"<?php echo $confirm_enabled ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="enable_confirm" value="0" <?php echo $confirm_disabled ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - - <tr> - <td class="row1"><?php echo $user->lang['Enable_COPPA']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Enable_COPPA_explain']; ?></span></td> - <td class="row2"><input type="radio" name="coppa_enable" value="1" <?php echo $coppa_enable_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="coppa_enable" value="0" <?php echo $coppa_enable_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['COPPA_fax']; ?>: </td> - <td class="row2"><input type="text" size="25" maxlength="100" name="coppa_fax" value="<?php echo $new['coppa_fax']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['COPPA_mail']; ?>: <br /><span class="gensmall"><?php echo $user->lang['COPPA_mail_explain']; ?></span></td> - <td class="row2"><textarea name="coppa_mail" rows="5" cols="40"><?php echo $new['coppa_mail']; ?></textarea></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Private_Messaging']; ?>: </td> - <td class="row2"><input type="radio" name="privmsg_disable" value="0" <?php echo $privmsg_on; ?> /><?php echo $user->lang['ENABLED']; ?> <input type="radio" name="privmsg_disable" value="1" <?php echo $privmsg_off; ?> /><?php echo $user->lang['DISABLED']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Boxes_max']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Boxes_max_explain']; ?></span></td> - <td class="row2"><input type="text" maxlength="4" size="4" name="pm_max_boxes" value="<?php echo $new['pm_max_boxes']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Edit_time']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Edit_time_explain']; ?></span></td> - <td class="row2"><input type="text" maxlength="3" size="3" name="edit_time" value="<?php echo $new['edit_time']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Flood_Interval']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Flood_Interval_explain']; ?></span></td> - <td class="row2"><input type="text" size="3" maxlength="4" name="flood_interval" value="<?php echo $new['flood_interval']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Search_Interval']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Search_Interval_explain']; ?></span></td> - <td class="row2"><input type="text" size="3" maxlength="4" name="search_interval" value="<?php echo $new['search_interval']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Min_search_chars']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Min_search_chars_explain']; ?></span</td> - <td class="row2"><input type="text" size="3" maxlength="3" name="min_search_chars" value="<?php echo $new['min_search_chars']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Max_search_chars']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Max_search_chars_explain']; ?></span</td> - <td class="row2"><input type="text" size="3" maxlength="3" name="max_search_chars" value="<?php echo $new['max_search_chars']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Topics_per_page']; ?>: </td> - <td class="row2"><input type="text" name="topics_per_page" size="3" maxlength="4" value="<?php echo $new['topics_per_page']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Posts_per_page']; ?>: </td> - <td class="row2"><input type="text" name="posts_per_page" size="3" maxlength="4" value="<?php echo $new['posts_per_page']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Hot_threshold']; ?>: </td> - <td class="row2"><input type="text" name="hot_threshold" size="3" maxlength="4" value="<?php echo $new['hot_threshold']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Max_poll_options']; ?>: </td> - <td class="row2"><input type="text" name="max_poll_options" size="4" maxlength="4" value="<?php echo $new['max_poll_options']; ?>" /></td> - </tr> -<?php - - break; - - case 'email': - - $email_yes = ($new['email_enable']) ? 'checked="checked"' : ''; - $email_no = (!$new['email_enable']) ? 'checked="checked"' : ''; - - $board_email_form_yes = ($new['board_email_form']) ? 'checked="checked"' : ''; - $board_email_form_no = (!$new['board_email_form']) ? 'checked="checked"' : ''; - - $smtp_yes = ($new['smtp_delivery']) ? 'checked="checked"' : ''; - $smtp_no = (!$new['smtp_delivery']) ? 'checked="checked"' : ''; - -?> - <tr> - <td class="row1"><?php echo $user->lang['Enable_email']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Enable_email_explain']; ?></span></td> - <td class="row2"><input type="radio" name="email_enable" value="1" <?php echo $email_yes; ?> /> <?php echo $user->lang['ENABLED']; ?> <input type="radio" name="email_enable" value="0" <?php echo $email_no; ?> /> <?php echo $user->lang['DISABLED']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Board_email_form']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Board_email_form_explain']; ?></span></td> - <td class="row2"><input type="radio" name="board_email_form" value="1" <?php echo $board_email_form_yes; ?> /> <?php echo $user->lang['ENABLED']; ?> <input type="radio" name="board_email_form" value="0" <?php echo $board_email_form_no; ?> /> <?php echo $user->lang['DISABLED']; ?></td> - </tr> - <tr> - <td class="row1" width="50%"><?php echo $user->lang['Admin_email']; ?>: </td> - <td class="row2"><input type="text" size="25" maxlength="100" name="board_email" value="<?php echo $new['board_email']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Email_sig']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Email_sig_explain']; ?></span></td> - <td class="row2"><textarea name="board_email_sig" rows="5" cols="30"><?php echo $new['board_email_sig']; ?></textarea></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Use_SMTP']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Use_SMTP_explain']; ?></span></td> - <td class="row2"><input type="radio" name="smtp_delivery" value="1" <?php echo $smtp_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="smtp_delivery" value="0" <?php echo $smtp_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['SMTP_server']; ?>: </td> - <td class="row2"><input type="text" name="smtp_host" value="<?php echo $new['smtp_host']; ?>" size="25" maxlength="50" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['SMTP_PORT']; ?>: <br /><span class="gensmall"><?php echo $user->lang['SMTP_PORT_EXPLAIN']; ?></span></td> - <td class="row2"><input type="text" name="smtp_port" value="<?php echo $new['smtp_port']; ?>" size="4" maxlength="5" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['SMTP_username']; ?>: <br /><span class="gensmall"><?php echo $user->lang['SMTP_username_explain']; ?></span></td> - <td class="row2"><input type="text" name="smtp_username" value="<?php echo $new['smtp_username']; ?>" size="25" maxlength="255" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['SMTP_password']; ?>: <br /><span class="gensmall"><?php echo $user->lang['SMTP_password_explain']; ?></span></td> - <td class="row2"><input type="password" name="smtp_password" value="<?php echo $new['smtp_password']; ?>" size="25" maxlength="255" /></td> - </tr> -<?php - - break; - - case 'server': - - $ip_all = ($new['ip_check'] == 4) ? 'checked="checked"' : ''; - $ip_classc = ($new['ip_check'] == 3) ? 'checked="checked"' : ''; - $ip_classb = ($new['ip_check'] == 2) ? 'checked="checked"' : ''; - $ip_none = ($new['ip_check'] == 0) ? 'checked="checked"' : ''; - - $gzip_yes = ($new['gzip_compress']) ? 'checked="checked"' : ''; - $gzip_no = (!$new['gzip_compress']) ? 'checked="checked"' : ''; -?> - <tr> - <td class="row1"><?php echo $user->lang['Server_name']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Server_name_explain']; ?></span></td> - <td class="row2"><input type="text" maxlength="255" size="40" name="server_name" value="<?php echo $new['server_name']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Server_port']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Server_port_explain']; ?></span></td> - <td class="row2"><input type="text" maxlength="5" size="5" name="server_port" value="<?php echo $new['server_port']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Script_path']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Script_path_explain']; ?></span></td> - <td class="row2"><input type="text" maxlength="255" name="script_path" value="<?php echo $new['script_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['IP_valid']; ?>: <br /><span class="gensmall"><?php echo $user->lang['IP_valid_explain']; ?></span></td> - <td class="row2"><input type="radio" name="ip_check" value="4" <?php echo $ip_all; ?> /> <?php echo $user->lang['All']; ?> <input type="radio" name="ip_check" value="3" <?php echo $ip_classc; ?> /> <?php echo $user->lang['Class_C']; ?> <input type="radio" name="ip_check" value="2" <?php echo $ip_classb; ?> /> <?php echo $user->lang['Class_B']; ?> <input type="radio" name="ip_check" value="0" <?php echo $ip_none; ?> /> <?php echo $user->lang['NONE']; ?> </td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Limit_load']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Limit_load_explain']; ?></span></td> - <td class="row2"><input type="text" size="4" maxlength="4" name="limit_load" value="<?php echo $new['limit_load']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Session_length']; ?>: </td> - <td class="row2"><input type="text" maxlength="5" size="5" name="session_length" value="<?php echo $new['session_length']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Limit_sessions']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Limit_sessions_explain']; ?></span></td> - <td class="row2"><input type="text" size="4" maxlength="4" name="active_sessions" value="<?php echo $new['active_sessions']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Enable_gzip']; ?>: </td> - <td class="row2"><input type="radio" name="gzip_compress" value="1" <?php echo $gzip_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="gzip_compress" value="0" <?php echo $gzip_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Smilies_path']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Smilies_path_explain']; ?></span></td> - <td class="row2"><input type="text" size="20" maxlength="255" name="smilies_path" value="<?php echo $new['smilies_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Icons_path']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Icons_path_explain']; ?></span></td> - <td class="row2"><input type="text" size="20" maxlength="255" name="icons_path" value="<?php echo $new['icons_path']; ?>" /></td> - </tr> -<?php - - break; - - case 'auth': - - $auth_plugins = array(); - - $dp = opendir($phpbb_root_path . 'includes/auth'); - while ($file = readdir($dp)) - { - if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) - { - $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); - } - } - - sort($auth_plugins); - - $auth_select = ''; - foreach ($auth_plugins as $method) - { - $selected = ($config['auth_method'] == $method) ? ' selected="selected"' : ''; - $auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>'; - } - -?> - <tr> - <td class="row1" width="50%"><?php echo $user->lang['Auth_method']; ?>:</td> - <td class="row2"><select name="auth_method"><?php echo $auth_select; ?></select></td> - </tr> -<?php - - foreach ($auth_plugins as $method) - { - if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) - { - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); - - $method = 'admin_' . $method; - if (function_exists($method)) - { - if ($config_fields = $method($new)) - { - // - // Check if we need to create config fields for this plugin - // - foreach($config_fields as $field) - { - if (!isset($config[$field])) - { - set_config($field, ''); - } - } - } - - unset($config_fields); - } - } - } - - break; -} - -?> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /></td> - </tr> -</table></form> - -<?php - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_database.php b/phpBB/admin/admin_database.php deleted file mode 100644 index 6c07995c5e..0000000000 --- a/phpBB/admin/admin_database.php +++ /dev/null @@ -1,1123 +0,0 @@ -<?php -/*************************************************************************** -* admin_database.php -* ------------------- -* begin : Thu May 31, 2001 -* copyright : (C) 2001 The phpBB Group -* email : support@phpbb.com -* -* $Id$ -* -****************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - $filename = basename(__FILE__); - $module['DB']['DB_BACKUP'] = ($auth->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']); - -?> - -<h1><?php echo $user->lang['DB_BACKUP']; ?></h1> - -<p><?php echo $user->lang['Backup_explain']; ?></p> - -<form method="post" action="<?php echo "admin_database.$phpEx$SID&mode=$mode"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['Backup_options']; ?></th> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Backup_type']; ?>: </td> - <td class="row2"><input type="radio" name="type" value="full" checked="checked" /> <?php echo $user->lang['Full_backup']; ?> <input type="radio" name="type" value="structure" /> <?php echo $user->lang['Structure_only']; ?> <input type="radio" name="type" value="data" /> <?php echo $user->lang['Data_only']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Include_search_index']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Include_search_index_explain']; ?></span></td> - <td class="row2"><input type="radio" name="search" value="0" /> <?php echo $user->lang['NO']; ?> <input type="radio" name="search" value="1" checked="checked" /> <?php echo $user->lang['YES']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Additional_tables']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Additional_tables_explain']; ?></span></td> - <td class="row2"><input type="text" name="tables" size="40" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Store_local']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Store_local_explain']; ?></span></td> - <td class="row2"><input type="text" name="store" size="40" /></td> - </tr> -<?php - - if (extension_loaded('zlib') || extension_loaded('bz2')) - { - -?> - <tr> - <td class="row1"><?php echo $user->lang['Compress_file']; ?>: </td> - <td class="row2"><input type="radio" name="compress" value="none" checked="checked" /> <?php echo $user->lang['NONE']; ?><?php - - if (extension_loaded('zlib')) - { - - -?> <input type="radio" name="compress" value="gzip" />.gz <input type="radio" name="compress" value="zip" />.zip<?php - - } - - if (extension_loaded('bz2')) - { - -?> <input type="radio" name="compress" value="bzip" />.bz2<?php - - } - -?></td> - </tr> -<?php - - } - -?> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="backupstart" value="<?php echo $user->lang['Start_backup']; ?>" class="mainoption" /></td> - </tr> -</table></form> - -<?php - - break; - } - else if (!isset($_POST['startdownload']) && !isset($_GET['startdownload'])) - { - $meta = "<meta http-equiv=\"refresh\" content=\"0;url=admin_database.$phpEx?mode=backup&type=$backup_type&tables=" . quotemeta($additional_tables) . "&search=$search&store=" . quotemeta($store_path) . "&compress=$compress&backupstart=1&startdownload=1\">"; - - $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']); - -?> - -<h1><?php echo $user->lang['DB_RESTORE']; ?></h1> - -<p><?php echo $user->lang['Restore_explain']; ?></p> - -<form enctype="multipart/form-data" method="post" action="<?php echo "admin_database.$phpEx$SID&mode=$mode"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <th colspan="2"><?php echo $user->lang['Select_file']; ?></th> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Upload_file']; ?>: <br /><span class="gensmall"><?php - - echo $user->lang['Supported_extensions']; - - $types = ': <u>sql</u>'; - if (extension_loaded('zlib')) - { - $types .= ', <u>sql.gz</u>'; - } - if (extension_loaded('bz2')) - { - $types .= ', <u>bz2</u>'; - } - - echo $types; - -?></span></td> - <td class="row2"><input type="file" name="backup_file" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Local_backup_file']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Local_backup_file_explain']; ?></span></td> - <td class="row2"><input type="text" name="local" size="40" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="restorestart" value="<?php echo $user->lang['Start_Restore']; ?>" class="mainoption" /></td> - </tr> -</table></form> - -<?php - - break; - - default: - trigger_error($user->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/admin/admin_disallow.php b/phpBB/admin/admin_disallow.php deleted file mode 100644 index af7c7fdf3d..0000000000 --- a/phpBB/admin/admin_disallow.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php -/*************************************************************************** - * admin_disallow.php - * ------------------- - * begin : Tuesday, Oct 05, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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 .= '<option value="' . $row['disallow_id'] . '">' . str_replace('%', '*', $row['disallow_username']) . '</option>'; - } - while ($row = $db->sql_fetchrow($result)); -} - -// Output page -page_header($user->lang['DISALLOW']); - -?> - -<h1><?php echo $user->lang['DISALLOW']; ?></h1> - -<p><?php echo $user->lang['Disallow_explain']; ?></p> - -<form method="post" action="<?php echo "admin_disallow.$phpEx$SID"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['Add_disallow_title']; ?></th> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['USERNAME']; ?><br /><span class="gensmall"><?php echo $user->lang['Add_disallow_explain']; ?></span></td> - <td class="row2"><input type="text" name="disallowed_user" size="30" /> </td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="mainoption" type="submit" name="disallow" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="liteoption" type="reset" value="<?php echo $user->lang['RESET']; ?>" /> - </tr> -</table> - -<h1><?php echo $user->lang['Delete_disallow_title']; ?></h1> - -<p><?php echo $user->lang['Delete_disallow_explain']; ?></p> - -<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['Delete_disallow_title']; ?></th> - </tr> -<?php - - if ($disallow_select != '') - { - -?> - <tr> - <td class="row1"><?php echo $user->lang['USERNAME']; ?></td> - <td class="row2"><select name="disallowed_id"><?php echo $disallow_select; ?></select></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="mainoption" type="submit" name="allow" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="liteoption" type="reset" value="<?php echo $user->lang['RESET']; ?>" /> - </tr> -<?php - - } - else - { - -?> - <tr> - <td class="row1" colspan="2" align="center"><?php echo $user->lang['No_disallowed']; ?></td> - </tr> -<?php - - } - -?> -</table></form> - -<?php - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_email.php b/phpBB/admin/admin_email.php deleted file mode 100644 index a3c3747cc5..0000000000 --- a/phpBB/admin/admin_email.php +++ /dev/null @@ -1,186 +0,0 @@ -<?php -/*************************************************************************** -* admin_email.php -* ------------------- -* begin : Thu May 31, 2001 -* copyright : (C) 2001 The phpBB Group -* email : support@phpbb.com -* -* $Id$ -* -****************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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 = '<select name = "g"><option value = "-1">' . $user->lang['All_users'] . '</option>'; -if ($row = $db->sql_fetchrow($result)) -{ - do - { - $select_list .= '<option value = "' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; - } - while ($row = $db->sql_fetchrow($result)); -} -$select_list .= '</select>'; - -page_header($user->lang['Mass_Email']); - -?> - -<h1><?php echo $user->lang['Mass_Email']; ?></h1> - -<p><?php echo $user->lang['Mass_email_explain']; ?></p> - -<form method="post" action="admin_mass_email.<?php echo $phpEx.$SID; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1"> - <tr> - <th colspan="2"><?php echo $user->lang['Compose']; ?></th> - </tr> - <tr> - <td class="row1" align="right"><b><?php echo $user->lang['Recipients']; ?></b></td> - <td class="row2" align="left"><?php echo $select_list; ?></td> - </tr> - <tr> - <td class="row1" align="right"><b><?php echo $user->lang['Subject']; ?></b></td> - <td class="row2"><span class="gen"><input type="text" name="subject" size="45" maxlength="100" tabindex="2" class="post" value="<?php echo $subject; ?>" /></span></td> - </tr> - <tr> - <td class="row1" align="right" valign="top"><span class="gen"><b><?php echo $user->lang['Message']; ?></b></span> - <td class="row2"><textarea class="post" name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3"><?php echo $message; ?></textarea></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $user->lang['Email']; ?>" name="submit" class="mainoption" /></td> - </tr> -</table></form> - -<?php - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php deleted file mode 100644 index b2594bfbe3..0000000000 --- a/phpBB/admin/admin_forums.php +++ /dev/null @@ -1,1026 +0,0 @@ -<?php -/*************************************************************************** - * admin_forums.php - * ------------------- - * begin : Thursday, Jul 12, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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']); - - $result = $db->sql_query('SELECT parent_id, left_id, right_id FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"); - if (!$row = $db->sql_fetchrow($result)) - { - trigger_error('Forum does not exist'); - } - extract($row); - $forum_info = array($forum_id => $row); - - // - // Get the adjacent forum - // - if ($mode == 'move_up') - { - $sql = 'SELECT forum_id, left_id, right_id - FROM ' . FORUMS_TABLE . " - WHERE parent_id = $parent_id AND right_id < $right_id - ORDER BY right_id DESC"; - } - else - { - $sql = 'SELECT forum_id, left_id, right_id - FROM ' . FORUMS_TABLE . " - WHERE parent_id = $parent_id 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; - } - - 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']; - - // - // I should consider using transactions here - // - $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']; - } - - $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); - break; - - case 'create': - if (!trim($_POST['forum_name'])) - { - trigger_error('Cannot create a forum without a name'); - } - - $parent_id = (!empty($_POST['parent_id'])) ? intval($_POST['parent_id']) : 0; - - if ($parent_id) - { - $result = $db->sql_query('SELECT left_id, right_id FROM ' . FORUMS_TABLE . " WHERE forum_id = $parent_id"); - if (!$row = $db->sql_fetchrow($result)) - { - trigger_error('Parent does not exist', E_USER_ERROR); - } - 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 - { - $result = $db->sql_query('SELECT MAX(right_id) AS right_id FROM ' . FORUMS_TABLE); - - $left_id = $db->sql_fetchfield('right_id', 0, $result) + 1; - $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'); - } - - $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_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']), - ); - - 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"); - - $message = $user->lang['Forums_updated'] . "<br /><br />" . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&parent_id=' . $parent_id . '">', '</a>') . '<br /><br />' . sprintf($user->lang['Click_return_admin_index'], '<a href="index.' . $phpEx . $SID . '?pane=right' . '">', '</a>'); - - trigger_error($message); - - break; - - case 'remove': - if (empty($_POST['submit'])) - { - // - // wasn't this form submitted? is anyone trying to remotely delete forums - // - // NOTE/TODO: this should not be possible because of session_id verification so this part can be removed - // - trigger_error('Did not submit', E_USER_ERROR); - } - - $action_subforums = (!empty($_POST['action_subforums'])) ? $_POST['action_subforums'] : ''; - $action_posts = (!empty($_POST['action_posts'])) ? $_POST['action_posts'] : ''; - - $row = get_forum_info($_GET['f']); - extract($row); - - if ($action_posts == 'delete') - { - delete_forum_content($forum_id); - } - elseif ($action_posts == 'move') - { - if (empty($_POST['posts_to_id'])) - { - $message = $user->lang['No_destination_forum'] . '<br /><br />' . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&mode=delete&f=' . $forum_id. '">', '</a>'); - - trigger_error($message); - } - - 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; - $db->sql_query('DELETE FROM ' . FORUMS_TABLE . ' WHERE forum_id IN (' . implode(', ', $forum_ids) . ')'); - } - elseif ($action_subforums == 'move') - { - if (empty($_POST['subforums_to_id'])) - { - $message = $user->lang['No_destination_forum'] . '<br /><br />' . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&mode=delete&f=' . $forum_id. '">', '</a>'); - - trigger_error($message); - } - - $result = $db->sql_query('SELECT forum_id FROM ' . FORUMS_TABLE . " WHERE parent_id = $forum_id"); - while ($row = $db->sql_fetchrow($result)) - { - move_forum($row['forum_id'], $_POST['subforums_to_id']); - } - $db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET parent_id = ' . $_POST['subforums_to_id'] . " WHERE parent_id = $forum_id"); - - $diff = 2; - $db->sql_query('DELETE FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"); - } - 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); - - $return_id = (!empty($_POST['subforums_to_id'])) ? $_POST['subforums_to_id'] : $parent_id; - $message = $user->lang['Forum_deleted'] . '<br /><br />' . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&parent_id=' . $return_id. '">', '</a>'); - - trigger_error($message); - 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 = '<option value="' . ITEM_UNLOCKED . '"' . $forumunlocked . '>' . $user->lang['Unlocked'] . "</option>\n"; - $statuslist .= '<option value="' . ITEM_LOCKED . '"' . $forumlocked . '>' . $user->lang['Locked'] . "</option>\n"; - - page_header($l_title); - -?> -<h1><?php echo $l_title ?></h1> - -<p><?php echo $user->lang['Forum_edit_delete_explain'] ?></p> - -<form action="<?php echo "admin_forums.$phpEx$SID" ?>" method="post"><table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['General_settings'] ?></th> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Parent'] ?></td> - <td class="row2"><select name="parent_id"><option value="0"><?php echo $user->lang['No_parent'] ?></option><?php echo $parents_list ?></select></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Forum_name']; ?></td> - <td class="row2"><input class="post" type="text" size="25" name="forum_name" value="<?php echo $forum_name ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Forum_desc'] ?></td> - <td class="row2"><textarea class="post" rows="5" cols="45" wrap="virtual" name="forum_desc"><?php echo $forum_desc ?></textarea></td> - </tr> -<?php - - if ($forum_postable && $mode == 'edit') - { - -?> - <tr> - <td class="row1"><?php echo $user->lang['FORUM_TYPE'] ?></td> - <td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td><input type="checkbox" name="set_nonpostable" /> <?php echo $user->lang['SET_NON_POSTABLE'] ?></td> - </tr> - <tr> - <td> <input type="radio" name="action" value="delete" checked="checked" /> <?php echo $user->lang['Delete_all_posts'] ?></td> - </tr> - <tr> - <td> <input type="radio" name="action" value="move" /> <?php echo $user->lang['Move_posts_to'] ?> <select name="to_forum_id"><?php echo $forums_list ?></select></td> - </tr> - </table></td> - </tr> -<?php - - } - else - { - -?> - <tr> - <td class="row1"><?php echo $user->lang['FORUM_TYPE'] ?></td> - <td class="row2"><input type="radio" name="is_postable" value="1" <?php echo $postable_checked ?>/><?php echo $user->lang['IS_POSTABLE'] ?> <input type="radio" name="is_postable" value="0" <?php echo $nonpostable_checked ?>/><?php echo $user->lang['NOT_POSTABLE'] ?></td> - </tr> -<?php - - } - -?> - <tr> - <th colspan="2"><?php echo $user->lang['Forum_settings'] ?></th> - </tr> -<?php - - if ($forum_postable || $mode == 'add') - { - -?> - <tr> - <td class="row1"><?php echo $user->lang['FORUM_STATUS'] ?></td> - <td class="row2"><select name="forum_status"><?php echo $statuslist ?></select></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['FORUM_STYLE'] ?></td> - <td class="row2"><select name="forum_style"><option value="0"><?php echo $user->lang['Default_style'] ?></option><?php echo $styles_list ?></select></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['OPTIONS'] ?></td> - <td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td><input type="checkbox" name="disable_post_count"<?php echo ((!empty($post_count_inc)) ? ' ' : 'checked="checked" ') ?>/> <?php echo $user->lang['DISABLE_POST_COUNT'] ?></td> - </tr> - <tr> - <td><input type="checkbox" name="enable_icons"<?php echo ((!empty($enable_icons)) ? 'checked="checked" ' : ' ') ?>/> <?php echo $user->lang['ENABLE_TOPIC_ICONS']; ?></td> - </tr> - <tr> - <td><input type="checkbox" name="moderated"<?php echo ((!empty($enable_moderate)) ? 'checked="checked" ' : ' ') ?>/> <?php echo $user->lang['FORUM_MODERATED']; ?></td> - </tr> -<?php - - if ($mode == 'edit' && $parent_id > 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']) - { - -?> - <tr> - <td><input type="checkbox" name="display_on_index"<?php echo ((!empty($display_on_index)) ? 'checked="checked" ' : ' ') ?>/> <?php echo $user->lang['Display_on_index'] ?></td> - </tr> -<?php - - } - } - } - -?> - </td></table> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Forum_pruning'] ?></td> - <td class="row2"><table cellspacing="0" cellpadding="1" border="0"> - <tr> - <td align="right" valign="middle"><?php echo $user->lang['Enabled'] ?></td> - <td align="left" valign="middle"><input type="checkbox" name="prune_enable" value="1" <?php echo $prune_enabled ?>/></td> - </tr> - <tr> - <td align="right" valign="middle"><?php echo $user->lang['prune_days'] ?></td> - <td align="left" valign="middle"> <input class="post" type="text" name="prune_days" value="<?php echo $prune_days ?>" size="5" /> <?php echo $user->lang['Days'] ?></td> - </tr> - <tr> - <td align="right" valign="middle"><?php echo $user->lang['prune_freq'] ?></td> - <td align="left" valign="middle"> <input class="post" type="text" name="prune_freq" value="<?php echo $prune_freq ?>" size="5" /> <?php echo $user->lang['Days'] ?></td> - </tr> - </table></td> - </tr> -<?php - - } - else - { - -?> - <tr> - <td class="row1"><?php echo $user->lang['FORUM_IMAGE']; ?></td> - <td class="row2"><input class="post" type="text" size="25" name="forum_image" value="<?php echo $forum_image ?>" /></td> - </tr> -<?php - - } - -?> - <tr> - <td class="cat" colspan="2" align="center"><input type="hidden" name="mode" value="<?php echo $newmode ?>" /><input type="hidden" name="f" value="<?php echo $forum_id ?>" /><input class="mainoption" type="submit" name="submit" value="<?php echo $buttonvalue ?>" /></td> - </tr> -</table></form> - -<br clear="all" /> - -<?php - - page_footer(); - break; - - case 'delete': - page_header($user->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); - -?> -<h1><?php echo $user->lang['Forum_delete'] ?></h1> - -<p><?php echo $user->lang['Forum_delete_explain'] ?></p> - -<form action="admin_forums.<?php echo $phpEx . $SID ?>&mode=remove&f=<?php echo $forum_id ?>" method="post"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['Forum_delete'] ?></th> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Forum_name']; ?></td> - <td class="row1"><span class="row1"><?php echo $forum_name ?></span></td> - </tr> -<?php - - if ($forum_postable) - { - -?> - <tr> - <td class="row1"><?php echo $user->lang['Action'] ?></td> - <td class="row1"><input type="radio" name="action_posts" value="delete" checked="checked" /> <?php echo $user->lang['Delete_all_posts'] ?></td> - </tr> - <tr> - <td class="row1"></td> - <td class="row1"><input type="radio" name="action_posts" value="move" /> <?php echo $user->lang['Move_posts_to'] ?> <select name="posts_to_id" ?><option value="0"></option><?php echo $move_posts_list ?></select></td> - </tr> -<?php - - } - - if ($right_id - $left_id > 1) - { - -?> - <tr> - <td class="row1"><?php echo $user->lang['Action'] ?></td> - <td class="row1"><input type="radio" name="action_subforums" value="delete" checked="checked" /> <?php echo $user->lang['Delete_subforums'] ?></td> - </tr> - <tr> - <td class="row1"></td> - <td class="row1"><input type="radio" name="action_subforums" value="move" /> <?php echo $user->lang['Move_subforums_to'] ?> <select name="subforums_to_id" ?><option value="0"></option><?php echo $forums_list ?></select></td> - </tr> -<?php - - } - -?> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['Move_and_Delete'] ?>" class="mainoption" /></td> - </tr> - </table> -</form> -<?php - - page_footer(); - - break; -} - -$forum_id = (!empty($_GET['f'])) ? intval($_GET['f']) : 0; - -if (!$forum_id) -{ - $navigation = 'Forum Index'; -} -else -{ - $navigation = '<a href="admin_forums.' . $phpEx . $SID . '">Forum Index</a>'; - - $forums_nav = get_forum_branch($forum_id, 'parents', 'descending'); - foreach ($forums_nav as $row) - { - if ($row['forum_id'] == $forum_id) - { - $navigation .= ' -> ' . htmlspecialchars($row['forum_name']); - } - else - { - $navigation .= ' -> <a href="admin_forums.' . $phpEx . $SID . '&f=' . $row['forum_id'] . '">' . htmlspecialchars($row['forum_name']) . '</a>'; - } - } -} - -// Jumpbox -$forum_box = make_forum_select($forum_id); - -// Front end -page_header($user->lang['MANAGE']); - -?> - -<h1><?php echo $user->lang['MANAGE']; ?></h1> - -<p><?php echo $user->lang['Forum_admin_explain']; ?></p> - -<form method="post" action="<?php echo "admin_forums.$phpEx$SID&mode=add" ?>"><table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> - <tr> - <td><?php echo $navigation ?></td> - </tr> -</table> - -<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0" align="center"> - <tr> - <th colspan="6"><?php echo $user->lang['Forum_admin'] ?></th> - </tr> -<?php - -$result = $db->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 = htmlspecialchars($row['forum_name']); - $forum_desc = htmlspecialchars($row['forum_desc']); - - if ($row['forum_status'] != ITEM_LOCKED) - { - if ($row['left_id'] + 1 != $row['right_id']) - { - $folder_image = '<img src="images/icon_subfolder.gif" width="46" height="25" alt="' . $user->lang['SUBFORUM'] . '" alt="' . $user->lang['SUBFORUM'] . '" />'; - } - else - { - $folder_image = '<img src="images/icon_folder.gif" width="46" height="25" alt="' . $user->lang['FOLDER'] . '" alt="' . $user->lang['FOLDER'] . '" />'; - } - } - else - { - $folder_image = '<img src="images/icon_folder_lock.gif" width="46" height="25" alt="' . $user->lang['LOCKED'] . '" alt="' . $user->lang['LOCKED'] . '" />'; - } - - $url = $phpEx . $SID . '&f=' . $forum_id . '&this_f=' . $row['forum_id']; - - $forum_title = '<a href="admin_forums.' . $phpEx . $SID . '&f=' . $row['forum_id'] . '">' . $forum_title . '</a>'; - -?> - <tr> - <td class="row1" width="5%"><?php echo $folder_image; ?></td> - <td class="row2" width="50%"><span class="gen"><?php echo $forum_title ?></span><br /><span class="gensmall"><?php echo $forum_desc ?></span></td> - - <td class="row1" width="5%" align="center" valign="middle" title="<?php echo $user->lang['TOPICS']; ?>"><span class="gen"><?php echo $row['forum_topics'] ?></span></td> - <td class="row2" width="5%" align="center" valign="middle" title="<?php echo $user->lang['POSTS']; ?>"><span class="gen"><?php echo $row['forum_posts'] ?></span></td> - - <td class="row2" width="15%" align="center" valign="middle" nowrap="nowrap"><span class="gen"><a href="admin_forums.<?php echo $url ?>&mode=move_up"><?php echo $user->lang['MOVE_UP'] ?></a> <br /> <a href="admin_forums.<?php echo $url ?>&mode=move_down"><?php echo $user->lang['MOVE_DOWN'] ?></a></span></td> - - <td class="row2" width="20%" align="center" valign="middle" nowrap="nowrap"> <span class="gen"><a href="admin_forums.<?php echo $url ?>&mode=edit"><?php echo $user->lang['EDIT'] ?></a> | <a href="admin_forums.<?php echo $url ?>&mode=delete"><?php echo $user->lang['DELETE'] ?></a> | <a href="admin_forums.<?php echo $url ?>&mode=sync"><?php echo $user->lang['Resync'] ?></a></span> </td> - </tr> -<?php - -} - -?> - <tr> - <td width="100%" colspan="6" class="cat"><input type="hidden" name="mode" value="add" /><input type="hidden" name="parent_id" value="<? echo $forum_id ?>" /><input type="text" name="forum_name" /> <input class="liteoption" type="submit" name="submit" value="<?php echo $user->lang['Create_forum'] ?>" /></td> - </tr> -</table></form> - -<form method="get" action="admin_forums.<?php echo $phpEx,$SID ?>"><table width="100%" cellpadding="1" cellspacing="1" border="0"> - <tr> - <td align="right"><?php echo $user->lang['Select_forum']; ?>: <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit() }"><?php echo $forum_box; ?></select> <input class="liteoption" type="submit" value="<?php echo $user->lang['Go']; ?>" /><input type="hidden" name="sid" value="<?php echo $user->session_id; ?>" /></td> - </tr> -</table></form> - -<?php - -page_footer(); - -// -// END -// - -// ------------------ -// Begin function block -// - -function get_forum_info($forum_id) -{ - global $db; - - $sql = 'SELECT * - FROM ' . FORUMS_TABLE . " - WHERE forum_id = $forum_id"; - $result = $db->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 .= "<option value=\"-1\"> </option>\n"; - } - - $list .= '<option value="' . $row['forum_id'] . '"'; - $list .= ($row['forum_id'] == $selected_id) ? ' selected="selected">' : '>'; - $list .= str_repeat('--', $current_indent) . (($indent) ? ' ' : '') . htmlspecialchars($row['forum_name']) . "</option>\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 .= '<option value="' . $row['style_id'] . '"' . (($row['style_id'] == $selected_id) ? ' selected="selected">' : '>') . htmlspecialchars($row['style_name']) . "</option>\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/admin/admin_groups.php b/phpBB/admin/admin_groups.php deleted file mode 100644 index 5874679552..0000000000 --- a/phpBB/admin/admin_groups.php +++ /dev/null @@ -1,894 +0,0 @@ -<?php -/*************************************************************************** - * admin_groups.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules) ) -{ - if (!$auth->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 != '') ? '<br />' : '') . (($group_name == '') ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG']); - } - if (strlen($group_description) > 255) - { - $error .= (($error != '') ? '<br />' : '') . $user->lang['GROUP_ERR_DESC_LONG']; - } - if ($group_type < GROUP_OPEN || $group_type > GROUP_FREE) - { - $error .= (($error != '') ? '<br />' : '') . $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']); - } - } - -?> - -<h1><?php echo $user->lang['MANAGE'] . ' : <i>' . $group_name . '</i>'; ?></h1> - -<p><?php echo $user->lang['GROUP_EDIT_EXPLAIN']; ?></p> - -<?php - - $sql = "SELECT * - FROM " . RANKS_TABLE . " - WHERE rank_special = 1 - ORDER BY rank_title"; - $result = $db->sql_query($sql); - - $rank_options = '<option value="-1"' . ((empty($group_rank)) ? 'selected="selected" ' : '') . '>' . $user->lang['USER_DEFAULT'] . '</option>'; - if ($row = $db->sql_fetchrow($result)) - { - do - { - $selected = (!empty($group_rank) && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; - $rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>'; - } - 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"' : ''; - -?> - -<script language="javascript" type="text/javascript"> -<!-- - -function swatch() -{ - window.open('./swatch.php?form=settings&name=group_colour', '_swatch', 'HEIGHT=115,resizable=yes,scrollbars=no,WIDTH=636'); - return false; -} - -//--> -</script> - -<form name="settings" method="post" action="admin_groups.<?php echo "$phpEx$SID&action=$action&g=$group_id"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['GROUP_DETAILS']; ?></th> - </tr> -<?php - - if ($error != '') - { - -?> - <tr> - <td class="row1" colspan="2" align="center"><span style="color:red"><?php echo $error; ?></span></td> - </tr> -<?php - - } - -?> - <tr> - <td class="row2"><?php echo $user->lang['GROUP_NAME']; ?>:</td> - <td class="row1"><?php - - if ($group_type != GROUP_SPECIAL) - { - -?><input type="text" name="group_name" value="<?php echo (!empty($group_name)) ? $group_name : ''; ?>" size="40" maxlength="40" /><?php - - } - else - { - -?><b><?php echo (!empty($user->lang['G_' . $group_name])) ? $user->lang['G_' . $group_name] : $group_name; ?></b><?php - - } - -?></td> - </tr> - <tr> - <td class="row2"><?php echo $user->lang['GROUP_DESC']; ?>:</td> - <td class="row1"><input type="text" name="group_description" value="<?php echo (!empty($group_description)) ? $group_description : ''; ?>" size="40" maxlength="255" /></td> - </tr> -<?php - - if ($group_type != GROUP_SPECIAL) - { - -?> - <tr> - <td class="row2"><?php echo $user->lang['GROUP_TYPE']; ?>:<br /><span class="gensmall"><?php echo $user->lang['GROUP_TYPE_EXPLAIN']; ?></span></td> - <td class="row1" nowrap="nowrap"><input type="radio" name="group_type" value="<?php echo GROUP_FREE . '"' . $type_free; ?> /> <?php echo $user->lang['GROUP_OPEN']; ?> <input type="radio" name="group_type" value="<?php echo GROUP_OPEN . '"' . $type_open; ?> /> <?php echo $user->lang['GROUP_REQUEST']; ?> <input type="radio" name="group_type" value="<?php echo GROUP_CLOSED . '"' . $type_closed; ?> /> <?php echo $user->lang['GROUP_CLOSED']; ?> <input type="radio" name="group_type" value="<?php echo GROUP_HIDDEN . '"' . $type_hidden; ?> /> <?php echo $user->lang['GROUP_HIDDEN']; ?></td> - </tr> -<?php - - } - -?> - <tr> - <th colspan="2"><?php echo $user->lang['GROUP_SETTINGS_SAVE']; ?></th> - </tr> - <tr> - <td class="row2"><?php echo $user->lang['GROUP_COLOR']; ?>:<br /><span class="gensmall"><?php echo sprintf($user->lang['GROUP_COLOR_EXPLAIN'], '<a href="swatch.html" onclick="swatch();return false" target="_swatch">', '</a>'); ?></span></td> - <td class="row1" nowrap="nowrap"><input type="text" name="group_colour" value="<?php echo (!empty($group_colour)) ? $group_colour : ''; ?>" size="6" maxlength="6" /></td> - </tr> - <tr> - <td class="row2"><?php echo $user->lang['GROUP_RANK']; ?>:</td> - <td class="row1"><select name="group_rank"><?php echo $rank_options; ?></select></td> - </tr> - <!-- tr> - <td class="row2"><?php echo $user->lang['GROUP_AVATAR']; ?>:<br /><span class="gensmall"><?php echo $user->lang['GROUP_AVATAR_EXPLAIN']; ?></span></td> - <td class="row1"> </td> - </tr --> - <tr> - <td class="cat" colspan="2" align="center"><input class="mainoption" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="liteoption" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> - </tr> -</table></form> - -<?php - - if ($action != 'addgroup') - { - -?> -<h1><?php echo $user->lang['GROUP_SETTINGS']; ?></h1> - -<p><?php echo $user->lang['GROUP_SETTINGS_EXPLAIN']; ?></p> - -<form method="post" action="admin_groups.<?php echo "$phpEx$SID&action=edit&g=$group_id"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['GROUP_SETTINGS']; ?></th> - </tr> - <tr> - <td class="row2"><?php echo $user->lang['GROUP_LANG']; ?>:</td> - <td class="row1"><select name="user_lang"><?php echo '<option value="-1" selected="selected">' . $user->lang['USER_DEFAULT'] . '</option>' . language_select(); ?></select></td> - </tr> - <tr> - <td class="row2"><?php echo $user->lang['GROUP_TIMEZONE']; ?>:</td> - <td class="row1"><select name="user_tz"><?php echo '<option value="-14" selected="selected">' . $user->lang['USER_DEFAULT'] . '</option>' . tz_select(); ?></select></td> - </tr> - <tr> - <td class="row2"><?php echo $user->lang['GROUP_DST']; ?>:</td> - <td class="row1" nowrap="nowrap"><input type="radio" name="user_dst" value="0" /> <?php echo $user->lang['DISABLED']; ?> <input type="radio" name="user_dst" value="1" /> <?php echo $user->lang['ENABLED']; ?> <input type="radio" name="user_dst" value="-1" checked="checked" /> <?php echo $user->lang['USER_DEFAULT']; ?></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="mainoption" type="submit" name="submitprefs" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="liteoption" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> - </tr> -</table></form> - -<?php - - } - - break; - - case 'deletegroup': - - break; - - case 'add': - - if (empty($_POST['usernames'])) - { - trigger_error($user->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); - - // 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': - - 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); - -?> - -<h1><?php echo $user->lang['GROUP_MEMBERS']; ?></h1> - -<p><?php echo $user->lang['GROUP_MEMBERS_EXPLAIN']; ?></p> - -<?php - - if ($group_type != GROUP_SPECIAL) - { - -?> -<h1><?php echo $user->lang['GROUP_MODS']; ?></h1> - -<p><?php echo $user->lang['GROUP_MODS_EXPLAIN']; ?></p> - -<form name="mod" method="post" action="admin_groups.<?php echo "$phpEx$SID&g=$group_id"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['USERNAME']; ?></th> - <th><?php echo $user->lang['JOINED']; ?></th> - <th><?php echo $user->lang['POSTS']; ?></th> - <th width="2%"><?php echo $user->lang['MARK']; ?></th> - </tr> -<?php - - // Group moderators - $sql = "SELECT COUNT(user_id) AS total_members - FROM " . GROUPS_MODERATOR_TABLE . " - WHERE group_id = $group_id"; - $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, " . 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'; - -?> - <tr> - <td class="<?php echo $row_class; ?>"><a href="../ucp.<?php echo "$phpEx$SID&mode=viewprofile&u=" . $row['user_id']; ?>" target="_profile"><?php echo $row['username']; ?></a></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['user_posts']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><input type="checkbox" name="mark[<?php echo $row['user_id']; ?>]" /></td> - </tr> -<?php - - } - while ($row = $db->sql_fetchrow($result) ); - -?> - -<?php - - } - else - { - -?> - <tr> - <td class="row3" colspan="4" align="center"><?php echo $user->lang['GROUPS_NO_MODS']; ?></td> - </tr> -<?php - - } - -?> - <tr> - <td class="cat" colspan="4" align="right"><input type="hidden" name="mode" value="mod" /><input class="liteoption" type="submit" name="delete" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> </td> - </tr> - <tr> - <th colspan="4"><?php echo $user->lang['ADD_USERS']; ?></th> - </tr> - <tr> - <td class="row1" colspan="4" align="center"><textarea name="usernames" cols="40" rows="5"></textarea></td> - </tr> - <tr> - <td class="cat" colspan="4" align="center"><input class="mainoption" type="submit" name="add" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="liteoption" type="submit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&mode=searchuser&form=mod&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /></td> - </tr> -</table> - -<table width="80%" cellspacing="1" cellpadding="0" border="0" align="center"> - <tr> - <td valign="top"><?php echo on_page($total_members, $config['topics_per_page'], $start_mod); ?></td> - <td align="right"><b><span class="gensmall"><a href="javascript:marklist('mod', true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('mod', false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b> <br /><span class="nav"><?php echo generate_pagination("admin_groups.$phpEx$SID&action=list&mode=mod&g=$group_id", $total_members, $config['topics_per_page'], $start); ?></span></td> - </tr> -</table></form> - -<?php - - // Pending users - $sql = "SELECT COUNT(user_id) AS total_members - FROM " . USER_GROUP_TABLE . " - WHERE group_id = $group_id - AND user_pending = 1"; - $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 = 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) ) - { - -?> -<h1><?php echo $user->lang['GROUP_PENDING']; ?></h1> - -<p><?php echo $user->lang['GROUP_PENDING_EXPLAIN']; ?></p> - -<form name="pend" method="post" action="admin_groups.<?php echo "$phpEx$SID&g=$group_id"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['USERNAME']; ?></th> - <th><?php echo $user->lang['JOINED']; ?></th> - <th><?php echo $user->lang['POSTS']; ?></th> - <th width="2%"><?php echo $user->lang['MARK']; ?></th> - </tr> -<?php - - do - { - - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - -?> - <tr> - <td class="<?php echo $row_class; ?>"><a href="../ucp.<?php echo "$phpEx$SID&mode=viewprofile&u=" . $row['user_id']; ?>" target="_profile"><?php echo $row['username']; ?></a></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['user_posts']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><input type="checkbox" name="mark[<?php echo $row['user_id']; ?>]" /></td> - </tr> -<?php - - } - while ($row = $db->sql_fetchrow($result) ); - -?> - <tr> - <td class="cat" colspan="4" align="right"><input type="hidden" name="mode" value="pend" /><input class="liteoption" type="submit" name="delete" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> </td> - </tr> - <tr> - <th colspan="4"><?php echo $user->lang['ADD_USERS']; ?></th> - </tr> - <tr> - <td class="row1" colspan="4" align="center"><textarea name="usernames" cols="40" rows="5"></textarea></td> - </tr> - <tr> - <td class="cat" colspan="4" align="center"><input class="mainoption" type="submit" name="add" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="liteoption" type="submit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&mode=searchuser&form=pend&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /></td> - </tr> -</table> - -<table width="80%" cellspacing="1" cellpadding="0" border="0" align="center"> - <tr> - <td valign="top"><?php echo on_page($total_members, $config['topics_per_page'], $start_mod); ?></td> - <td align="right"><b><span class="gensmall"><a href="javascript:marklist('pend', true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('pend', false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b> <br /><span class="nav"><?php echo generate_pagination("admin_groups.$phpEx$SID&action=list&mode=pend&g=$group_id", $total_members, $config['topics_per_page'], $start); ?></span></td> - </tr> -</table></form> - -<?php - - } - $db->sql_freeresult($result); - } - - // Existing members - $sql = "SELECT COUNT(user_id) AS total_members - FROM " . USER_GROUP_TABLE . " - WHERE group_id = $group_id - AND user_pending = 0"; - $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 - ORDER BY u.username - LIMIT $start, " . $config['topics_per_page']; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result) ) - { - -?> -<h1><?php echo $user->lang['GROUP_LIST']; ?></h1> - -<p><?php echo $user->lang['GROUP_LIST_EXPLAIN']; ?></p> - -<?php - -?> -<form name="list" method="post" action="admin_groups.<?php echo "$phpEx$SID&g=$group_id"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['USERNAME']; ?></th> - <th><?php echo $user->lang['JOINED']; ?></th> - <th><?php echo $user->lang['POSTS']; ?></th> - <th width="2%"><?php echo $user->lang['MARK']; ?></th> - </tr> -<?php - - do - { - - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - -?> - <tr> - <td class="<?php echo $row_class; ?>"><a href="../ucp.<?php echo "$phpEx$SID&mode=viewprofile&u=" . $row['user_id']; ?>" target="_profile"><?php echo $row['username']; ?></a></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['user_posts']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><input type="checkbox" name="mark[<?php echo $row['user_id']; ?>]" /></td> - </tr> -<?php - - } - while ($row = $db->sql_fetchrow($result)); - -?> - <tr> - <td class="cat" colspan="4" align="right"><input type="hidden" name="mode" value="members" /><input class="liteoption" type="submit" name="delete" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> </td> - </tr> - <tr> - <th colspan="4"><?php echo $user->lang['ADD_USERS']; ?></th> - </tr> - <tr> - <td class="row1" colspan="4" align="center"><textarea name="usernames" cols="40" rows="5"></textarea><br /><?php echo $user->lang['USER_GETS_GROUP_SET']; ?> <input type="radio" name="settings" value="1" checked="checked" /> <?php echo $user->lang['YES']; ?> <input type="radio" name="settings" value="0" /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="cat" colspan="4" align="center"><input class="mainoption" type="submit" name="add" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="liteoption" type="submit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&mode=searchuser&form=list&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /></td> - </tr> -</table> - -<table width="80%" cellspacing="1" cellpadding="0" border="0" align="center"> - <tr> - <td valign="top"><?php echo on_page($total_members, $config['topics_per_page'], $start); ?></td> - <td align="right"><b><span class="gensmall"><a href="javascript:marklist('list', true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('list', false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b> <br /><span class="nav"><?php echo generate_pagination("admin_groups.$phpEx$SID&action=list&mode=member&g=$group_id", $total_members, $config['topics_per_page'], $start); ?></span></td> - </tr> -</table></form> - -<?php - - } - $db->sql_freeresult($result); - - break; - - default: - - // Default mangement page - -?> - -<h1><?php echo $user->lang['MANAGE']; ?></h1> - -<p><?php echo $user->lang['GROUP_MANAGE_EXPLAIN']; ?></p> - -<h1><?php echo $user->lang['USER_DEF_GROUPS']; ?></h1> - -<p><?php echo $user->lang['USER_DEF_GROUPS_EXPLAIN']; ?></p> - -<form method="post" action="admin_groups.<?php echo "$phpEx$SID"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th width="95%"><?php echo $user->lang['MANAGE']; ?></th> - <th><?php echo $user->lang['ACTION']; ?></th> - </tr> -<?php - - $sql = "SELECT group_id, group_name, group_type - FROM " . GROUPS_TABLE . " - ORDER BY group_type ASC, group_name"; - $result = $db->sql_query($sql); - - $special_toggle = false; - if ($row = $db->sql_fetchrow($result) ) - { - do - { - - if ($row['group_type'] == GROUP_SPECIAL && !$special_toggle) - { - $special_toggle = true; - -?> - <tr> - <td class="cat" colspan="2" align="center"><input class="mainoption" type="submit" name="addgroup" value="<?php echo $user->lang['ADD_NEW_GROUP']; ?>" /></td> - </tr> -</table> - -<h1><?php echo $user->lang['SPECIAL_GROUPS']; ?></h1> - -<p><?php echo $user->lang['SPECIAL_GROUPS_EXPLAIN']; ?></p> - -<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th width="95%"><?php echo $user->lang['MANAGE']; ?></th> - <th><?php echo $user->lang['ACTION']; ?></th> - </tr> -<?php - - } - - $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; - - $group_id = $row['group_id']; - $group_name = (!empty($user->lang['G_' . $row['group_name']]))? $user->lang['G_' . $row['group_name']] : $row['group_name']; - -?> - <tr> - <td class="<?php echo $row_class; ?>"><a href="admin_groups.<?php echo "$phpEx$SID&action=list&g=$group_id"; ?>"><?php echo $group_name;?></a></td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"> <a href="admin_groups.<?php echo "$phpEx$SID&action=add&g=$group_id"; ?>"><?php echo $user->lang['ADD']; ?></a> | <a href="admin_groups.<?php echo "$phpEx$SID&action=edit&g=$group_id"; ?>"><?php echo $user->lang['EDIT']; ?></a><?php - - if (!$special_toggle) - { - -?> | <a href="admin_groups.<?php echo "$phpEx$SID&action=delete&g=$group_id"; ?>"><?php echo $user->lang['DELETE']; ?></a><?php - - } - -?> </td> - </tr> -<?php - - if (is_array($pending[$group_id]) ) - { - foreach ($pending[$group_id] as $pending_ary ) - { - $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; - -?> - <tr> - <td class="<?php echo $row_class; ?>"><?php echo $pending_ary['username'];?></td> - <td class="<?php echo $row_class; ?>" align="center"><input class="liteoption" type="submit" name="approve[<?php echo $pending_ary['user_id']; ?>]" value="<?php echo $user->lang['Approve_selected'];?>" /> <input class="liteoption" type="submit" name="decline[<?php echo $pending_ary['user_id']; ?>]" value="<?php echo $user->lang['Deny_selected'];?>" /></td> - </tr> -<?php - - } - } - } - while ($row = $db->sql_fetchrow($result) ); - } - $db->sql_freeresult($result); - -?> - <tr> - <td class="cat" colspan="2"> </td> - </tr> -</table></form> - -<?php - - break; - -} - -?> - -<script language="Javascript" type="text/javascript"> -<!-- -function marklist(match, status) -{ - len = eval('document.' + match + '.length'); - for (i = 0; i < len; i++) - { - eval('document.' + match + '.elements[i].checked = ' + status); - } -} -//--> -</script> - -<?php - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_icons.php b/phpBB/admin/admin_icons.php deleted file mode 100644 index 023b66a8e3..0000000000 --- a/phpBB/admin/admin_icons.php +++ /dev/null @@ -1,757 +0,0 @@ -<?php -/*************************************************************************** -* admin_icons.php -* ------------------- -* begin : Thu May 31, 2001 -* copyright : (C) 2001 The phpBB Group -* email : support@phpbb.com -* -* $Id$ -* -****************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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 = '<option value="' . ($row[$fields . '_order']) . '"' . $selected . '>' . sprintf($user->lang['AFTER_' . $lang], ' -> ' . htmlspecialchars($after_txt)) . '</option>' . $order_list; - } - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - - $order_list = '<option value="1"' . ((!isset($after)) ? ' selected="selected"' : '') . '>' . $user->lang['FIRST'] . '</option>' . $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 .= '<option value="' . $img . '"' . htmlspecialchars($img) . $selected . '>' . $img . '</option>'; - } - } - unset($existing_imgs); - unset($imglist); - - page_header($user->lang[$lang]); - -?> - -<h1><?php echo $user->lang[$lang]; ?></h1> - -<p><?php echo $user->lang[$lang .'_EXPLAIN']; ?></p> - -<script language="javascript" type="text/javascript" defer="defer"> -<!-- - -function update_image(newimage) -{ - document.image.src = "<?php echo $phpbb_root_path . $img_path ?>/" + newimage; -} - -function update_image_dimensions() -{ - if (document.image.height) - { - document.forms[0].height.value = document.image.height; - document.forms[0].width.value = document.image.width; - } -} - -//--> -</script> - -<form method="post" action="admin_icons.<?php echo $phpEx . $SID . "&mode=$mode&action=" . (($action == 'add') ? 'create' : 'modify'); ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th class="th" colspan="2"><?php echo $user->lang[$lang . '_CONFIG'] ?></th> - </tr> - <tr> - <td class="row1"><?php echo $user->lang[$lang . '_URL'] ?></td> - <td class="row1"><select name="img" onChange="update_image(this.options[selectedIndex].value);"><?php echo $filename_list ?></select> <img src="<?php echo $phpbb_root_path . $img_path . '/' . $edit_img ?>" name="image" border="0" alt="" title="" onload="update_image_dimensions()" /> </td> - </tr> -<?php - - if ($mode == 'emoticons') - { - -?> - <tr> - <td class="row2"><?php echo $user->lang[$lang . '_CODE'] ?></td> - <td class="row2"><input type="text" name="code" value="<?php echo (!empty($data['code'])) ? $data['code'] : '' ?>" /></td> - </tr> - <tr> - <td class="row2"><?php echo $user->lang[$lang . '_EMOTION'] ?></td> - <td class="row2"><input type="text" name="emotion" value="<?php echo (!empty($data['emoticon'])) ? $data['emoticon'] : '' ?>" /></td> - </tr> -<?php - - } - -?> - <tr> - <td class="row1"><?php echo $user->lang[$lang . '_WIDTH'] ?></td> - <td class="row1"><input type="text" size="3" name="width" value="<?php echo (!empty($data[$fields .'_width'])) ? $data[$fields .'_width'] : '' ?>" /></td> - </tr> - <tr> - <td class="row2"><?php echo $user->lang[$lang . '_HEIGHT'] ?></td> - <td class="row2"><input type="text" size="3" name="height" value="<?php echo (!empty($data[$fields .'_height'])) ? $data[$fields .'_height'] : '' ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['DISPLAY_ON_POSTING'] ?></td> - <td class="row1"><input type="checkbox" name="display_on_posting" <?php echo (!empty($data['display_on_posting']) || !isset($data)) ? ' checked="checked"' : '' ?>/></td> - </tr> - <tr> - <td class="row2"><?php echo $user->lang[$lang . '_ORDER'] ?></td> - <td class="row2"><select name="order"><?php echo $order_list ?></select></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><?php - - if (!empty($data)) - { - -?><input type="hidden" name="id" value="<?php echo $data[$fields . '_id'] ?>" /><?php - - } - -?><input class="mainoption" type="submit" value="<?php echo $user->lang['SUBMIT'] ?>" /></td> - </tr> -</table></form> -<?php - - page_footer(); - break; - - case 'create': - case 'modify': - - $image_id = intval($_POST['id']); - $img = stripslashes($_POST['img']); - $image_order = intval($_POST['order']); - $image_width = intval($_POST['width']); - $image_height = intval($_POST['height']); - - if ($image_width == 0 || $image_height == 0) - { - $img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $img); - $smile_width = $img_size[0]; - $smile_height = $img_size[1]; - } - - $img_sql = array( - $fields . '_url' => $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 .= '<option>' . htmlspecialchars($pak) . '</option>'; - } - } - - page_header($user->lang[$lang]); - -?> -<h1><?php echo $user->lang[$lang] ?></h1> - -<p><?php echo $user->lang[$lang .'_EXPLAIN'] ?></p> - -<form method="post" action="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode . '&action=import'; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang[$lang . '_IMPORT'] ?></th> - </tr> -<?php - - if ($pak_options == '') - { - -?> - <tr> - <td class="row1" colspan="2"><?php echo $user->lang['NO_' . $lang . '_PAK']; ?></td> - </tr> -<?php - - } - else - { - -?> - <tr> - <td class="row2"><?php echo $user->lang['SELECT_PACKAGE'] ?></td> - <td class="row1"><select name="pak"><?php echo $pak_options ?></select></td> - </tr> - <tr> - <td class="row2"><?php echo $user->lang['CURRENT_' . $lang] ?><br /><span class="gensmall"><?php echo $user->lang['CURRENT_' . $lang . '_EXPLAIN'] ?></span></td> - <td class="row1"><input type="radio" name="current" value="keep" checked="checked" /> <?php echo $user->lang['KEEP_ALL'] ?> <input type="radio" name="current" value="replace" /> <?php echo $user->lang['REPLACE_MATCHES'] ?> <input type="radio" name="current" value="delete" /> <?php echo $user->lang['DELETE_ALL'] ?> </td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="mainoption" name="import" type="submit" value="<?php echo $user->lang['IMPORT_' . $lang] ?>" /></td> - </tr> -<?php - - } - -?> -</table></form> -<?php - page_footer(); - - } - break; - - case 'export': - - page_header($user->lang['EXPORT_' . $lang]); - trigger_error(sprintf($user->lang['EXPORT_' . $lang . '_EXPLAIN'], '<a href="admin_icons.' . $phpEx . $SID . '&mode=' . $mode . '&action=send">', '</a>')); - 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]); - -?> - -<h1><?php echo $user->lang[$lang]; ?></h1> - -<p><?php echo $user->lang[$lang .'_EXPLAIN']; ?></p> - -<form method="post" action="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode ?>"><table cellspacing="1" cellpadding="0" border="0" align="center"> - <tr> - <td align="right"> <a href="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode . '&action=import'; ?>"><?php echo $user->lang['IMPORT_' . $lang]; ?></a> | <a href="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode . '&action=export'; ?>"><?php echo $user->lang['EXPORT_' . $lang]; ?></a></td> - </tr> - <tr> - <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang[$lang]; ?></th> -<?php - - if ($mode == 'emoticons') - { - -?> - <th><?php echo $user->lang['CODE']; ?></th> - <th><?php echo $user->lang['EMOTION']; ?></th> -<?php - - } - -?> - <th><?php echo $user->lang['ACTION']; ?></th> - <th><?php echo $user->lang['REORDER']; ?></th> - </tr> -<?php - - $spacer = FALSE; - - $sql = 'SELECT * - FROM ' . $table . ' - ORDER BY display_on_posting DESC, ' . $fields . '_order ASC'; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if (!$spacer && !$row['display_on_posting']) - { - $spacer = TRUE; -?> - <tr> - <td class="row3" colspan="<?php echo ($mode == 'emoticons') ? 5 : 3; ?>" align="center"><?php echo $user->lang[$lang . '_NOT_DISPLAYED'] ?></td> - </tr> -<?php - } - - $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; - - $alt_text = ($mode == 'emoticon') ? htmlspecialchars($row['code']) : ''; - -?> - <tr> - <td class="<?php echo $row_class; ?>" align="center"><img src="<?php echo './../' . $img_path . '/' . $row[$fields . '_url']; ?>" width="<?php echo $row[$fields . '_width']; ?>" height="<?php echo $row[$fields . '_height']; ?>" alt="<?php echo $alt_text; ?>" title="<?php echo $alt_text; ?>" /></td> -<?php - - if ($mode == 'emoticons') - { - -?> - <td class="<?php echo $row_class; ?>" align="center"><?php echo htmlspecialchars($row['code']); ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['emoticon']; ?></td> -<?php - - } - -?> - <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=edit&id=" . $row[$fields . '_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> | <a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=delete&id=" . $row[$fields . '_id']; ?>"><?php echo $user->lang['DELETE']; ?></a></td> - <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=move_up&order=" . $row[$fields . '_order']; ?>"><?php echo $user->lang['MOVE_UP']; ?></a> <br /> <a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=move_down&order=" . $row[$fields . '_order']; ?>"><?php echo $user->lang['MOVE_DOWN']; ?></a></td> - </tr> -<?php - - } - $db->sql_freeresult($result); - -?> - <tr> - <td class="cat" colspan="<?php echo ($mode == 'emoticons') ? 5 : 3; ?>" align="center"><input type="submit" name="add" value="<?php echo $user->lang['ADD_' . $lang]; ?>" class="mainoption" /></td> - </tr> - </table></td> - </tr> -</table></form> - -<?php - - page_footer(); - - break; -} - -// --------- -// FUNCTIONS -// -function filelist($rootdir, $dir = '', $type = 'gif|jpg|png') -{ - static $images = array(); - - $dh = opendir($rootdir . $dir); - - while ($fname = readdir($dh)) - { - if (is_file($rootdir . $dir . '/' . $fname) && - preg_match('#\.' . $type . '$#i', $fname) && - filesize($rootdir . $dir . '/' . $fname)) - { - $images[] = array('path' => $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/admin/admin_permissions.php b/phpBB/admin/admin_permissions.php deleted file mode 100644 index 0b0f3c2f05..0000000000 --- a/phpBB/admin/admin_permissions.php +++ /dev/null @@ -1,962 +0,0 @@ -<?php -/*************************************************************************** - * admin_permissions.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - $filename = basename(__FILE__); - $module['FORUM']['PERMISSIONS'] = ($auth->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 .= ' : <i>' . $forum_info['forum_name'] . '</i>'; - } - 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 .= ' : <i>' . $username . '</i>'; - } - 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 .= ' : <i>' . $row['group_name'] . '</i>'; - } - - - - - // Generate header - page_header($l_title); - -?> - -<h1><?php echo $l_title; ?></h1> - -<?php - - - - - switch ($mode) - { - case 'forums': - case 'moderators': - $forum_sql = "AND a.forum_id = $forum_id"; - break; - - case 'supermoderators': - case 'administrators': - case 'users': - case 'groups': - $forum_sql = 'AND a.forum_id = 0'; - break; - } - - - - - if (!empty($entries)) - { - - - - // Founder only operations ... these operations can - // only be altered by someone with founder status - $founder_sql = (!$userdata['user_founder']) ? ' AND founder_only <> 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 = '<input type="hidden" name="entries[]" value="' . $row['id'] . '" />'; - $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 = '<input type="hidden" name="entries[]" value="' . $row['id'] . '" />'; - $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 .= '<option value="preset_0">' . $user->lang['INHERIT_PARENT'] . '</option>'; - $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 .= '<option value="' . $row['preset_id'] . '">' . $row['preset_name'] . '</option>'; - $preset_options .= '<option value="preset_' . $row['preset_id'] . '">' . $row['preset_name'] . '</option>'; - - $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); - - - -?> - -<script language="Javascript" type="text/javascript"> -<!-- - - var presets = new Array(); -<?php - - echo $preset_js; - -?> - - function preset_obj(allow, deny, inherit) - { - this.allow = allow; - this.deny = deny; - this.inherit = inherit; - } - - function use_preset(option) - { - if (option) - { - document.acl.set.selectedIndex = 0; - var expr = new RegExp(/\d+/); - for (i = 0; i < document.acl.length; i++) - { - var elem = document.acl.elements[i]; - if (elem.name.indexOf('option') == 0) - { - switch (option) - { - case 'all_allow': - if (elem.value == <?php echo ACL_ALLOW; ?>) - elem.checked = true; - break; - case 'all_deny': - if (elem.value == <?php echo ACL_DENY; ?>) - elem.checked = true; - break; - case 'all_inherit': - if (elem.value == <?php echo ACL_INHERIT; ?>) - elem.checked = true; - break; - default: - option_name = elem.name.substr(7, elem.name.length - 8); - - if (presets[option].allow.indexOf(option_name + ',') != -1 && elem.value == <?php echo ACL_ALLOW; ?>) - elem.checked = true; - else if (presets[option].deny.indexOf(option_name + ',') != -1 && elem.value == <?php echo ACL_DENY; ?>) - elem.checked = true; - else if (presets[option].inherit.indexOf(option_name + ',') != -1 && elem.value == <?php echo ACL_INHERIT; ?>) - elem.checked = true; - break; - } - } - } - } - } - - function marklist(match, status) - { - for (i = 0; i < document.acl.length; i++) - { - if (document.acl.elements[i].name.indexOf(match) == 0) - document.acl.elements[i].checked = status; - } - } -//--> -</script> - -<p><?php echo $user->lang['ACL_EXPLAIN']; ?></p> - -<form method="post" name="acl" action="<?php echo "admin_permissions.$phpEx$SID&mode=$mode"; ?>"><table cellspacing="2" cellpadding="0" border="0" align="center"> - <tr> - <td align="right"><?php echo $user->lang['PRESETS']; ?>: <select name="set" onchange="use_preset(this.options[this.selectedIndex].value);"><option class="sep"><?php echo $user->lang['SELECT'] . ' ->'; ?></option><option value="all_allow"><?php echo $user->lang['ALL_ALLOW']; ?></option><option value="all_deny"><?php echo $user->lang['ALL_DENY']; ?></option><option value="all_inherit"><?php echo $user->lang['ALL_INHERIT']; ?></option><?php - - echo ($preset_options) ? '<option class="sep">' . $user->lang['USER_PRESETS'] . ' ->' . '</option>' . $preset_options : ''; - -?></select></td> - </tr> - <tr> - <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th> <?php echo $user->lang['Option']; ?> </th> - <th> <?php echo $user->lang['Allow']; ?> </th> - <th> <?php echo $user->lang['Deny']; ?> </th> - <th> <?php echo $user->lang['Inherit']; ?> </th> - </tr> -<?php - - for($i = 0; $i < sizeof($auth_options); $i++) - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - - $l_can_cell = (!empty($user->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"' : ''; - } - -?> - <tr> - <td class="<?php echo $row_class; ?>"><?php echo $l_can_cell; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="option[<?php echo $auth_options[$i]['auth_value']; ?>]" value="<?php echo ACL_ALLOW; ?>"<?php echo $allow_type; ?> /></td> - <td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="option[<?php echo $auth_options[$i]['auth_value']; ?>]" value="<?php echo ACL_DENY; ?>"<?php echo $deny_type; ?> /></td> - <td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="option[<?php echo $auth_options[$i]['auth_value']; ?>]" value="<?php echo ACL_INHERIT; ?>"<?php echo $inherit_type; ?> /></td> - </tr> -<?php - - } - - if ($type_sql == 'f' || $type_sql == 'm') - { - $children = get_forum_branch($forum_id, 'children', 'descending', false); - - if (!empty($children)) - { -?> - <tr> - <th colspan="4"><?php echo $user->lang['Inheritance']; ?></th> - </tr> - <tr> - <td class="row1" colspan="4"><table width="100%" cellspacing="1" cellpadding="0" border="0"> - <tr> - <td colspan="4" height="16"><span class="gensmall"><?php echo $user->lang['Inheritance_explain']; ?></span></td> - </tr> -<?php - foreach ($children as $row) - { - -?> - <tr> - <td><input type="checkbox" name="inherit[]" value="<?php echo $row['forum_id']; ?>" /> <?php echo $row['forum_name']; ?></td> - </tr> -<?php - - } - -?> - <tr> - <td height="16" align="center"><a class="gensmall" href="javascript:marklist('inherit', true);"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('inherit', false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></td> - </tr> - </table></td> - </tr> -<?php - - } - } - - - - - - if ($auth->acl_gets('a_events', 'a_cron')) - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - -?> - <tr> - <th colspan="4"><?php echo $user->lang['RUN_HOW']; ?></th> - </tr> - <tr> - <td class="<?php echo $row_class; ?>" colspan="4" align="center"><input type="radio" name="runas" value="now" checked="checked" /> <?php echo $user->lang['RUN_AS_NOW']; ?><?php - - if ($auth->acl_get('a_events')) - { - -?> <input type="radio" name="runas" value="evt" /> <?php - - echo $user->lang['RUN_AS_EVT']; - } - if ($auth->acl_get('a_cron')) - { - -?> <input type="radio" name="runas" value="crn" /> <?php - - echo $user->lang['RUN_AS_CRN']; - - } - -?></td> - </tr> -<?php - - } - - - - - -?> - <tr> - <td class="cat" colspan="4" align="center"><input class="mainoption" type="submit" name="update" value="<?php echo $user->lang['Update']; ?>" /> <input class="liteoption" type="submit" name="cancel" value="<?php echo $user->lang['CANCEL']; ?>" /><input type="hidden" name="f" value="<?php echo $forum_id; ?>" /><input type="hidden" name="type" value="<?php echo $_POST['type']; ?>" /><?php echo $ug_hidden; ?></td> - </tr> -</table> - -<br clear="all" /> - -<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="4"><?php echo $user->lang['PRESETS']; ?></th> - </tr> - <tr> - <td class="row1" colspan="4"><table width="100%" cellspacing="1" cellpadding="0" border="0"> - <tr> - <td colspan="2" height="16"><span class="gensmall"><?php echo $user->lang['PRESETS_EXPLAIN']; ?></span></td> - </tr> - <tr> - <td nowrap="nowrap"><?php echo $user->lang['SELECT_PRESET']; ?>: </td> - <td><select name="presetoption"><option class="sep" value="-1"><?php echo $user->lang['SELECT'] . ' ->'; ?></option><?php - - echo $preset_update_options; - -?></select></td> - </tr> - <tr> - <td nowrap="nowrap"><?php echo $user->lang['PRESET_NAME']; ?>: </td> - <td><input type="text" name="presetname" maxlength="25" /> </td> - </tr> - </table></td> - </tr> - <tr> - <td class="cat" colspan="4" align="center"><input class="liteoption" type="submit" name="presetsave" value="<?php echo $user->lang['SAVE']; ?>" /> <input class="liteoption" type="submit" name="presetdel" value="<?php echo $user->lang['DELETE']; ?>" /><input type="hidden" name="advanced" value="true" /></td> - </tr> -</table></td> - </tr> -</table></form> - -<?php - - page_footer(); - } - - - - - - -?> - -<p><?php echo $l_title_explain; ?></p> - -<table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td align="center"><h1><?php echo $user->lang['Users']; ?></h1></td> - <td align="center"><h1><?php echo $user->lang['Groups']; ?></h1></td> - </tr> - <tr> - - <td><form method="post" action="<?php echo "admin_permissions.$phpEx$SID&mode=$mode"; ?>"><table width="90%" class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> -<?php - - $sql = "SELECT DISTINCT u.user_id, u.username - 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 - ORDER BY u.username, u.user_regdate ASC"; - $result = $db->sql_query($sql); - - $users = ''; - while ($row = $db->sql_fetchrow($result)) - { - $users .= '<option value="' . $row['user_id'] . '">' . $row['username'] . '</option>'; - } - $db->sql_freeresult($result); - -?> - <tr> - <th><?php echo $user->lang['Manage_users']; ?></th> - </tr> - <tr> - <td class="row1" align="center"><select style="width:280px" name="entries[]" multiple="multiple" size="5"><?php echo $users; ?></select></td> - </tr> - <tr> - <td class="cat" align="center"><input class="liteoption" type="submit" name="delete" value="<?php echo $user->lang['Remove_selected']; ?>" /> <input class="liteoption" type="submit" name="advanced" value="<?php echo $user->lang['Advanced']; ?>" /><input type="hidden" name="type" value="user" /><input type="hidden" name="f" value="<?php echo $forum_id; ?>" /><input type="hidden" name="option" value="<?php echo $type_sql; ?>" /></td> - </tr> - </table></form></td> - - <td align="center"><form method="post" name="admingroups" action="<?php echo "admin_permissions.$phpEx$SID&mode=$mode"; ?>"><table width="90%" class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> -<?php - - $sql = "SELECT DISTINCT g.group_id, g.group_name - FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o - WHERE o.auth_value LIKE '" . $type_sql . "_%' - $forum_sql - AND a.auth_option_id = o.auth_option_id - AND g.group_id = a.group_id - ORDER BY g.group_type DESC, g.group_name ASC"; - $result = $db->sql_query($sql); - - $groups = ''; - while ($row = $db->sql_fetchrow($result)) - { - $groups .= '<option value="' . $row['group_id'] . '">' . ((!empty($user->lang['G_' . $row['group_name']])) ? '* ' . $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; - } - $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 .= '<option value="' . $row['group_id'] . '">' . ((!empty($user->lang['G_' . $row['group_name']])) ? '* ' . $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; - } - $db->sql_freeresult($result); - -?> - <tr> - <th><?php echo $user->lang['Manage_groups']; ?></th> - </tr> - <tr> - <td class="row1" align="center"><select style="width:280px" name="entries[]" multiple="multiple" size="5"><?php echo $groups; ?></select></td> - </tr> - <tr> - <td class="cat" align="center"><input class="liteoption" type="submit" name="delete" value="<?php echo $user->lang['Remove_selected']; ?>" /> <input class="liteoption" type="submit" name="advanced" value="<?php echo $user->lang['Advanced']; ?>" /><input type="hidden" name="type" value="group" /><input type="hidden" name="f" value="<?php echo $forum_id; ?>" /><input type="hidden" name="option" value="<?php echo $type_sql; ?>" /></td> - </tr> - </table></form></td> - - </tr> - <tr> - - <td><form method="post" action="<?php echo "admin_permissions.$phpEx$SID&mode=$mode"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['Add_users']; ?></th> - </tr> - <tr> - <td class="row1" align="center"><textarea cols="40" rows="4" name="entries"></textarea></td> - </tr> - <tr> - <td class="cat" align="center"> <input type="submit" name="add" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /> <input type="submit" name="usersubmit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&mode=searchuser&form=2&field=entries', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /><input type="hidden" name="type" value="user" /><input type="hidden" name="advanced" value="1" /><input type="hidden" name="new" value="1" /><input type="hidden" name="f" value="<?php echo $forum_id; ?>" /></td> - </tr> - </table></form></td> - - <td><form method="post" action="<?php echo "admin_permissions.$phpEx$SID&mode=$mode"; ?>"><table width="90%" class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['Add_groups']; ?></th> - </tr> - <tr> - <td class="row1" align="center"><select name="entries[]" multiple="multiple" size="4"><?php echo $group_list; ?></select></td> - </tr> - <tr> - <td class="cat" align="center"> <input type="submit" name="add" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /><input type="hidden" name="type" value="group" /><input type="hidden" name="advanced" value="1" /><input type="hidden" name="new" value="1" /><input type="hidden" name="f" value="<?php echo $forum_id; ?>" /></td> - </tr> - </table></form></td> - - </tr> -</table> - -<?php - - page_footer(); - -} - - - - -// Output appropriate front end page; forums, user or group selector -page_header($l_title); - -?> - -<h1><?php echo $l_title; ?></h1> - -<p><?php echo $l_title_explain ?></p> - -<form method="post" action="<?php echo "admin_permissions.$phpEx$SID&mode=$mode"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> -<?php - -// Mode specific markup -switch ($mode) -{ - case 'forums': - case 'moderators': - $select_list = make_forum_select(false, false, false); - -?> - <tr> - <th align="center"><?php echo $user->lang['LOOK_UP_FORUM']; ?></th> - </tr> - <tr> - <td class="row1" align="center"> <select name="f"><?php echo $select_list; ?></select> <input type="submit" value="<?php echo $user->lang['LOOK_UP_FORUM']; ?>" class="mainoption" /> </td> - </tr> -<?php - - break; - - case 'users': -?> - <tr> - <th align="center"><?php echo $user->lang['Select_a_User']; ?></th> - </tr> - <tr> - <td class="row1" align="center"><input type="text" class="post" name="username" maxlength="50" size="20" /> <input type="submit" name="submituser" value="<?php echo $user->lang['Look_up_user']; ?>" class="mainoption" /> <input type="submit" name="usersubmit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onClick="window.open('<?php echo "../memberlist.$phpEx$SID&mode=searchuser&field=username"; ?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /><input type="hidden" name="type" value="user" /></td> - </tr> -<?php - break; - - case 'groups': - // Generate list of groups - $sql = "SELECT group_id, group_name - FROM " . GROUPS_TABLE . " - ORDER BY group_type DESC"; - $result = $db->sql_query($sql); - - $group_options = ''; - if ($row = $db->sql_fetchrow($result)) - { - do - { - $group_options .= (($group_options != '') ? ', ' : '') . '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - -?> - <tr> - <th align="center"><?php echo $user->lang['SELECT_A_GROUP']; ?></th> - </tr> - <tr> - <td class="row1" align="center"> <select name="g"><?php echo $group_options; ?></select> <input type="submit" value="<?php echo $user->lang['LOOK_UP_GROUP']; ?>" class="mainoption" /><input type="hidden" name="type" value="group" /> </td> - </tr> -<?php - break; - -} - -?> -</table></form> - -<?php - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_prune.php b/phpBB/admin/admin_prune.php deleted file mode 100644 index 5b0f5c48c9..0000000000 --- a/phpBB/admin/admin_prune.php +++ /dev/null @@ -1,203 +0,0 @@ -<?php -/*************************************************************************** -* admin_prune.php -* ------------------- -* begin : Mon Jul 31, 2001 -* copyright : (C) 2001 The phpBB Group -* email : support@phpbb.com -* -* $Id$ -* -****************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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']); - -?> - -<h1><?php echo $user->lang['PRUNE']; ?></h1> - -<p><?php echo $user->lang['PRUNE_SUCCESS']; ?></p> - -<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['FORUM']; ?></th> - <th><?php echo $user->lang['TOPICS_PRUNED']; ?></th> - <th><?php echo $user->lang['POSTS_PRUNED']; ?></th> - </tr> -<?php - - // Get a list of forum's or the data for the forum that we are pruning. - $sql = "SELECT forum_id, forum_name - FROM " . FORUMS_TABLE . " - ORDER BY left_id ASC"; - $result = $db->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'; - -?> - <tr> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['forum_name']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $p_result['topics']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $p_result['posts']; ?></td> - </tr> -<?php - - $log_data .= (($log_data != '') ? ', ' : '') . $forum_rows[$i]['forum_name']; - } - while($row = $db->sql_fetchrow($result)); - - add_log('admin', 'log_prune', $log_data); - - } - else - { - -?> - <tr> - <td class="row1" align="center"><?php echo $user->lang['NO_PRUNE']; ?></td> - </tr> -<?php - - } - $db->sql_freeresult($result); - -?> -</table> - -<br clear="all" /> - -<?php - - page_footer(); - -} - -page_header($user->lang['PRUNE']); - -?> - -<h1><?php echo $user->lang['PRUNE']; ?></h1> - -<p><?php echo $user->lang['FORUM_PRUNE_EXPLAIN']; ?></p> - -<?php - -// If they haven't selected a forum for pruning yet then -// display a select box to use for pruning. -if (empty($forum_id)) -{ - - // Output a selection table if no forum id has been specified. - $select_list = '<option value="-1">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select(false, false, false); - -?> - -<form method="post" action="admin_prune.<?php echo $phpEx . $SID; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th align="center"><?php echo $user->lang['SELECT_FORUM']; ?></th> - </tr> - <tr> - <td class="row1" align="center"> <select name="f"><?php echo $select_list; ?></select> <input type="submit" value="<?php echo $user->lang['LOOK_UP_FORUM']; ?>" class="mainoption" /> </td> - </tr> -</table></form> - -<?php - -} -else -{ - $sql = "SELECT forum_name - FROM " . FORUMS_TABLE . " - WHERE forum_id = $forum_id"; - $result = $db->sql_query($sql); - - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $forum_name = ($forum_id == -1) ? $user->lang['ALL_FORUMS'] : $row['forum_name']; - -?> - -<h2><?php echo $user->lang['FORUM'] . ': <i>' . $forum_name; ?></i></h2> - -<form method="post" action="admin_prune.<?php echo $phpEx . $SID; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th class="th"><?php echo $user->lang['FORUM_PRUNE']; ?></th> - </tr> - <tr> - <td class="row1"><?php echo sprintf($user->lang['PRUNE_NOT_POSTED'], '<input type="text" name="prunedays" size="4" />'); ?></td> - </tr> - <tr> - <td class="cat" align="center"><input type="hidden" name="f" value="<?php echo $forum_id; ?>" /><input type="submit" name="doprune" value="<?php echo $user->lang['DO_PRUNE']; ?>" class="mainoption"></td> - </tr> -</table></form> - -<?php - -} - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_prune_users.php b/phpBB/admin/admin_prune_users.php deleted file mode 100644 index ef466b1be5..0000000000 --- a/phpBB/admin/admin_prune_users.php +++ /dev/null @@ -1,260 +0,0 @@ -<?php -/*************************************************************************** - * admin_prune_users.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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 = '<form method="post" action="admin_prune_users.' . $phpEx . $SID . '">' . $user->lang['Confirm_prune_users'] . '<br /><br /><input class="liteoption" type="submit" name="confirm" value="' . $user->lang['Yes'] . '" /> <input class="liteoption" type="submit" name="cancel" value="' . $user->lang['No'] . '" />'; - - foreach ($values as $field) - { - $l_message .= (!empty($_POST[$field])) ? '<input type="hidden" name="' . $field . '" value="' . urlencode($_POST[$field]) . '" />' : ''; - } - - $l_message .= '</form>'; - - page_header($user->lang['Prune_users']); - -?> - -<h1><?php echo $user->lang['PRUNE_USERS']; ?></h1> - -<p><?php echo $user->lang['PRUNE_USERS_EXPLAIN']; ?></p> - -<?php - - page_message($user->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 .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; -} - -$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 .= '<option value="' . $key . '">' . $value . '</option>'; -} -$s_find_active_time = ''; -foreach ($find_time as $key => $value) -{ - $s_find_active_time .= '<option value="' . $key . '">' . $value . '</option>'; -} - -// -// -// -page_header($user->lang['Prune_users']); - -?> - -<h1><?php echo $user->lang['Prune_users']; ?></h1> - -<p><?php echo $user->lang['Prune_users_explain']; ?></p> - -<form method="post" name="post" action="<?php echo "admin_prune_users.$phpEx$SID"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['Prune_users']; ?></th> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['USERNAME']; ?>: </td> - <td class="row2"><input class="post" type="text" name="username" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Email']; ?>: </td> - <td class="row2"><input class="post" type="text" name="email" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Joined']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Joined_explain']; ?></span></td> - <td class="row2"><select name="joined_select"><?php echo $s_find_join_time; ?></select> <input class="post" type="text" name="joined" maxlength="10" size="10" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Last_active']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Last_active_explain']; ?></span></td> - <td class="row2"><select name="active_select"><?php echo $s_find_active_time; ?></select> <input class="post" type="text" name="active" maxlength="10" size="10" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Posts']; ?>: </td> - <td class="row2"><select name="count_select"><?php echo $s_find_count; ?></select> <input class="post" type="text" name="count" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Prune_users']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Select_users_explain']; ?></span></td> - <td class="row2"><textarea name="users" cols="40" rows="5"></textarea></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['Delete_user_posts']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Delete_user_posts_explain']; ?></span></td> - <td class="row2"><input type="radio" name="deleteposts" value="1" /> <?php echo $user->lang['Yes']; ?> <input type="radio" name="deleteposts" value="0" checked="checked" /> <?php echo $user->lang['No']; ?></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="liteoption" type="submit" name="delete" value="<?php echo $user->lang['Prune_users']; ?>" /> <input class="liteoption" type="submit" name="deactivate" value="<?php echo $user->lang['Deactivate']; ?>" /> <input type="submit" name="usersubmit" value="<?php echo $user->lang['Find_username']; ?>" class="liteoption" onClick="window.open('<?php echo "../search.$phpEx$SID&mode=searchuser&field=users"; ?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" /><input type="hidden" name="prune" value="1" /></td> - </tr> -</table></form> - -<?php - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_ranks.php b/phpBB/admin/admin_ranks.php deleted file mode 100644 index 26f9dabff8..0000000000 --- a/phpBB/admin/admin_ranks.php +++ /dev/null @@ -1,270 +0,0 @@ -<?php -/*************************************************************************** - * admin_ranks.php - * ------------------- - * begin : Thursday, Jul 12, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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 = '<input type="hidden" name="mode" value="save" />'; - - 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 .= '<input type="hidden" name="id" value="' . $rank_id . '" />'; - - } - else - { - $rank_info['rank_special'] = 0; - } - - page_header($user->lang['RANKS']); - -?> - -<h1><?php echo $user->lang['RANKS']; ?></h1> - -<p><?php echo $user->lang['RANKS_EXPLAIN']; ?></p> - -<form method="post" action="<?php echo "admin_ranks.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['RANKS']; ?></th> - </tr> - <tr> - <td class="row1" width="40%" nowrap="nowrap"><?php echo $user->lang['RANK_TITLE']; ?>: </td> - <td class="row2"><input type="text" name="title" size="35" maxlength="40" value="<?php echo $rank_info['rank_title']; ?>" /></td> - </tr> - <tr> - <td class="row1" width="40%" nowrap="nowrap"><?php echo $user->lang['RANK_SPECIAL']; ?>: </td> - <td class="row2"><input type="radio" name="special_rank" value="1"<?php echo ($rank_info['rank_special']) ? ' checked="checked"' : ''; ?> /><?php echo $user->lang['YES']; ?> <input type="radio" name="special_rank" value="0"<?php echo (!$rank_info['rank_special']) ? ' checked="checked"' : ''; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1" width="40%" nowrap="nowrap"><?php echo $user->lang['RANK_MINIMUM']; ?>: </td> - <td class="row2"><input type="text" name="min_posts" size="5" maxlength="10" value="<?php echo ($rank_info['rank_special']) ? '' : $rank_info['rank_min']; ?>" /></td> - </tr> - <tr> - <td class="row1" width="40%"><?php echo $user->lang['RANK_IMAGE']; ?>: <br /><span class="gensmall"><?php echo $user->lang['RANK_IMAGE_EXPLAIN']; ?></span></td> - <td class="row2" valign="middle"><input type="text" name="rank_image" size="40" maxlength="255" value="<?php echo ($rank_info['rank_image'] != '') ? $rank_info['rank_image'] : ''; ?>" /> <?php echo ($rank_info['rank_image'] != '') ? '<img src="../' . $rank_info['rank_image'] . '" />' : ''; ?></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /></td> - </tr> -</table></form> - -<?php - - page_footer(); - - } - else if ($mode == 'save') - { - // - // Ok, they sent us our info, let's update it. - // - - $rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : 0; - $rank_title = (isset($_POST['title'])) ? trim($_POST['title']) : ''; - $special_rank = (!empty($_POST['special_rank'])) ? 1 : 0; - $min_posts = (isset($_POST['min_posts'])) ? intval($_POST['min_posts']) : -1; - $rank_image = (isset($_POST['rank_image'])) ? trim($_POST['rank_image']) : ''; - - if ($rank_title == '') - { - trigger_error($user->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']); - -?> - -<h1><?php echo $user->lang['RANKS']; ?></h1> - -<p><?php echo $user->lang['RANKS_EXPLAIN']; ?></p> - -<form method="post" action="<?php echo "admin_ranks.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['RANK_IMAGE']; ?></th> - <th><?php echo $user->lang['RANK_TITLE']; ?></th> - <th><?php echo $user->lang['RANK_MINIMUM']; ?></th> - <th><?php echo $user->lang['ACTION']; ?></th> - </tr> -<?php - -// -// Show the default page -// -$sql = "SELECT * FROM " . RANKS_TABLE . " - ORDER BY rank_min ASC, rank_special ASC"; -$result = $db->sql_query($sql); - -if ($row = $db->sql_fetchrow($result)) -{ - do - { - $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; -?> - <tr> - <td class="<?php echo $row_class; ?>" align="center"><img src="../<?php echo $row['rank_image']; ?>"" border="0" alt="<?php echo $row['rank_title']; ?>" title="<?php echo $row['rank_title']; ?>" /></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['rank_title']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo ($row['rank_special']) ? '-' : $row['rank_min']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"> <a href="<?php echo "admin_ranks.$phpEx$SID&mode=edit&id=" . $row['rank_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> | <a href="<?php echo "admin_ranks.$phpEx$SID&mode=delete&id=" . $row['rank_id']; ?>"><?php echo $user->lang['DELETE']; ?></a> </td> - </tr> -<?php - - } - while ($row = $db->sql_fetchrow($result)); -} - -?> - <tr> - <td class="cat" colspan="5" align="center"><input type="submit" class="mainoption" name="add" value="<?php echo $user->lang['ADD_RANK']; ?>" /></td> - </tr> -</table></form> - -<?php - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_search.php b/phpBB/admin/admin_search.php deleted file mode 100644 index 70f4d752a2..0000000000 --- a/phpBB/admin/admin_search.php +++ /dev/null @@ -1,327 +0,0 @@ -<?php -/*************************************************************************** - * admin_search.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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']); - -?> - -<h1><?php echo $user->lang['SEARCH_INDEX']; ?></h1> - -<p><?php echo $user->lang['SEARCH_INDEX_COMPLETE']; ?></p> - -<?php - - page_footer(); - - } - - exit; - -} -else if (isset($_POST['cancel'])) -{ - set_config('board_disable', 0); - page_header($user->lang['SEARCH_INDEX']); - -?> - -<h1><?php echo $user->lang['SEARCH_INDEX']; ?></h1> - -<p><?php echo $user->lang['SEARCH_INDEX_CANCEL']; ?></p> - -<?php - - page_footer(); - -} -else -{ - page_header($user->lang['Search_index']); - -?> - -<h1><?php echo $user->lang['SEARCH_INDEX']; ?></h1> - -<p><?php echo $user->lang['SEARCH_INDEX_EXPLAIN']; ?></p> - -<form method="post" action="<?php echo "admin_search.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1"> - <tr> - <td class="cat" height="28" align="center"> <input type="submit" name="start" value="<?php echo $user->lang['START']; ?>" class="mainoption" /> <input type="submit" name="cancel" value="<?php echo $user->lang['CANCEL']; ?>" class="mainoption" /> </td> - </tr> -</table></form> - -<?php - - page_footer(); - -} - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_styles.php b/phpBB/admin/admin_styles.php deleted file mode 100644 index 0035c9f7fe..0000000000 --- a/phpBB/admin/admin_styles.php +++ /dev/null @@ -1,361 +0,0 @@ -<?php - -if ( !empty($setmodules) ) -{ - if ( !$auth->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 .= '<option name="' . $file . '"' . $selected . '>' . $file . '</option>'; - } -} -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 .= '<option name="' . $row['imageset_path'] . '"' . $selected . '>' . $row['imageset_path'] . '</option>'; - } - - $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 .= '<option value="' . $file . '"' . $selected . '>' . $file . '</option>'; - } - } - closedir($dp); - - // Output page - page_header($user->lang['Edit_Imageset']); - -?> - -<form method="post" action="admin_styles.<?php echo $phpEx . $SID; ?>&mode=editimageset"> - -<h2>Edit Imageset</h2> - -<p>Template set: <select name="imgroot"><?php echo $imgroot_options; ?></select> <input class="liteoption" type="submit" name="img_root" value="Select set" /> <input class="liteoption" type="submit" name="create" value="Create new set" /></p> - -<p>Here you can create, edit, delete and download imagesets.</p> - -<?php - - if (isset($_POST['img_root'])) - { - $sql = "SELECT * - FROM " . STYLES_IMAGE_TABLE . " - WHERE imageset_path LIKE '" . $_POST['imgroot'] . "'"; - $result = $db->sql_query($sql); - - $images = $db->sql_fetchrow($result); - -?> -<table class="bg" cellspacing="1" cellpadding="2" border="0" align="center"> - <tr> - <th height="25">Image</th><th>Graphic</th><th> </th> - </tr> -<?php - - for($i = 1; $i < count($imageset); $i++) - { - $row_class = (!($i%2)) ? 'row1' : 'row2'; - - $img = (!empty($images[$imageset[$i]])) ? '<img src=' . $images[$imageset[$i]] . ' />' : ''; - $img = str_replace('"imagesets/', '"../imagesets/', $img); - $img = str_replace('{LANG}', $user->img_lang, $img); - $img = str_replace('{RATE}', 3, $img); -?> - <tr> - <td class="<?php echo $row_class; ?>" height="25"><span class="gen"><?php echo ucfirst(str_replace('_', ' ', $imageset[$i])); ?></span></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $img; ?></td> - <td class="<?php echo $row_class; ?>" align="center"> <input class="liteoption" type="submit" value="Edit" /></td> - </tr> -<?php - - } - -?> - <tr> - <td class="cat" colspan="3" height="28" align="center"> <input class="liteoption" type="submit" name="download" value="Download set" <input class="liteoption" type="submit" name="img_delete" value="Delete set" /> </td> - </tr> -</table></form> - -<?php - - } - - page_footer(); - - break; - - case 'edittemplate': - - $tplcols = (isset($_POST['tplcols'])) ? max(60, intval($_POST['tplcols'])) : 90; - $tplrows = (isset($_POST['tplrows'])) ? max(4, intval($_POST['tplrows'])) : 30; - $tplname = (isset($_POST['tplname'])) ? $_POST['tplname'] : ''; - $tplroot = (isset($_POST['tplroot'])) ? $_POST['tplroot'] : 'subSilver'; - - $str = ''; - if (isset($_POST['tpl_compile']) && !empty($_POST['decompile'])) - { - $str = "<?php\n" . $template->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 .= '<option value="' . $tpl . '"' . $selected . '>' . $tpl . '</option>'; - } - } - closedir($dp); - - // - page_header($user->lang['Edit_template']); - -?> - -<h2><?php echo $user->lang['Edit_template']; ?></h2> - -<p><?php echo $user->lang['Edit_template_explain']; ?></p> - -<form method="post" action="<?php echo "admin_styles.$phpEx$SID&mode=edittemplate"; ?>"> - -<p><?php echo $user->lang['Select_template']; ?>: <select name="tplroot"><?php echo $tplroot_options; ?></select> <input class="liteoption" type="submit" name="tpl_root" value="Select" /></p> - -<table class="bg" width="95%" cellspacing="1" cellpadding="0" border="0" align="center"> - <tr> - <td class="cat"><table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td> Template: <select name="tplname"><?php echo $tplname_options; ?></select> <input class="liteoption" type="submit" name="tpl_name" value="Select" /></td> - - <td align="right">Columns: <input type="text" name="tplcols" size="3" maxlength="3" value="<?php echo $tplcols; ?>" /> Rows: <input type="text" name="tplrows" size="3" maxlength="3" value="<?php echo $tplrows; ?>" /> <input class="liteoption" type="submit" name="tpl_layout" value="Update" /> </td> - </tr> - </table></td> - </tr> - <tr> - <td colspan="2" align="center"><textarea class="edit" style="background-color:#DEE3E7" cols="<?php echo $tplcols; ?>" rows="<?php echo $tplrows; ?>" name="decompile"><?php echo htmlentities($str); ?></textarea></td> - </tr> - <tr> - <td class="cat" colspan="2" height="28" align="center"><input class="liteoption" type="submit" name="tpl_compile" value="Recompile" /> <input class="liteoption" type="submit" name="tpl_download" value="Download" /> <input class="liteoption" type="reset" value="Undo" /></td> - </tr> -</table></form> - -<?php - - page_footer(); - break; - - case 'edittheme': - - $theme_id = (isset($_POST['themeroot'])) ? $_POST['themeroot'] : ''; - - if (isset($_POST['update'])) - { - $sql = "SELECT theme_id, theme_name - FROM " . STYLES_CSS_TABLE . " - WHERE theme_id = $theme_id"; - $result = $db->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 != '') ? ', ' : '') . '<option value="' . $row['theme_id'] . '">' . $row['theme_name'] . '</option>'; - } - 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']; - } - } - -?> - -<form method="post" action="<?php echo "admin_styles.$phpEx$SID&mode=$mode"; ?>"> - -<h2><?php echo $user->lang['Edit_theme']; ?></h2> - -<p><?php echo $user->lang['Edit_theme_explain']; ?></p> - -<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <td class="cat" colspan="2" align="center"><?php echo $user->lang['Select_theme']; ?>: <select name="themeroot"><?php echo $theme_options; ?></select> <input class="liteoption" type="submit" name="tpl_root" value="<?php echo $user->lang['Select']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['CSS_data']; ?>: <br /><span class="gensmall"><?php echo $user->lang['CSS_data_explain']; ?></td> - <td class="row2"><textarea class="edit" cols="65" rows="15" name="css_data"><?php echo htmlentities($css_data); ?></textarea></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['CSS_sheet']; ?>: </td> - <td class="row2"><input type="text" name="css_external" maxlength="60" size="60" value="<?php echo $css_external; ?>" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="liteoption" type="submit" name="update" value="<?php echo $user->lang['Update']; ?>" /> <input class="liteoption" type="reset" value="<?php echo $user->lang['Reset']; ?>" /></td> - </tr> -</table></form> - -<?php - - page_footer(); - - break; -} - - -// -function get_templates($tplroot = '') -{ - global $db; - - $sql = "SELECT template_name, template_path - FROM " . STYLES_TPL_TABLE . " - ORDER BY template_name"; - $result = $db->sql_query($sql); - - $tplroot_options = ''; - while ($row = $db->sql_fetchrow($result)) - { - $selected = ($tplroot == $row['template_path']) ? ' selected="selected"' : ''; - $tplroot_options .= '<option value="' . $row['template_path'] . '"' . $selected . '>' . $row['template_path'] . '</option>'; - } - - return $tplroot_options; -} - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_users.php b/phpBB/admin/admin_users.php deleted file mode 100644 index 84e14d4c10..0000000000 --- a/phpBB/admin/admin_users.php +++ /dev/null @@ -1,361 +0,0 @@ -<?php -/*************************************************************************** - * admin_users.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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($_GET['u']) || isset($_POST['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_id_specified']); - } - } - else - { - if(!$userdata = get_userdata($_POST['username'])) - { - trigger_error($user->lang['No_user_id_specified']); - } - } - - // 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']); - -?> - -<form method="post" action="admin_users.<?php echo $phpEx . $SID; ?>&mode=<?php echo $mode; ?>&u=<?php echo $userdata['user_id']; ?>"><table width="90%" cellspacing="3" cellpadding="0" border="0" align="center"> - <tr> - <td align="right"><b>Main</b> | <a href="admin_users.<?php echo $phpEx . $SID; ?>&u=<?php echo $userdata['user_id']; ?>&mode=profile">Profile</a> | <a href="admin_users.<?php echo $phpEx . $SID; ?>&u=<?php echo $userdata['user_id']; ?>&mode=pref">Preferences</a> | <a href="admin_users.<?php echo $phpEx . $SID; ?>&u=<?php echo $userdata['user_id']; ?>&mode=avatar">Avatar</a> | <a href="admin_users.<?php echo $phpEx . $SID; ?>&u=<?php echo $userdata['user_id']; ?>&mode=permissions">Permissions</a></td> - </tr> -<?php - - switch ($mode) - { - case 'main': - -?> - <tr> - <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"> - <tr> - <td class="row1">Username: <br /><span class="gensmall">Click profile to edit</span></td> - <td class="row2"><?php echo $userdata['username']; ?> [ <a href="admin_ban.<?php echo $phpEx . $SID; ?>&mode=user&ban=<?php echo $userdata['username']; ?>&bansubmit=true">Ban</a> ]</td> - </tr> - <tr> - <td class="row1">Registered: </td> - <td class="row2"><?php echo $user->format_date($userdata['user_regdate']); ?></td> - </tr> - <tr> - <td class="row1">Registered from IP: </td> - <td class="row2"><?php if ($userdata['user_ip']) { echo $userdata['user_ip']; ?> [ <a href="admin_users.<?php echo $phpEx . $SID; ?>&u=<?php echo $userdata['user_id']; ?>&mode=main&do=iplookup">Lookup</a> | <a href="admin_ban.<?php echo $phpEx . $SID; ?>&mode=ip&ban=<?php echo $userdata['user_ip']; ?>&bansubmit=true">Ban</a> ] <?php } else { echo 'Unknown'; } ?></td> - </tr> -<?php - - if (isset($_GET['do']) && $_GET['do'] == 'iplookup') - { - if ($userdata['user_ip'] != '' && $domain = gethostbyaddr($userdata['user_ip'])) - { -?> - <tr> - <th colspan="2">IP whois for <?php echo $domain; ?></th> - </tr> - <tr> - <td class="row1" colspan="2"><?php - - if ($ipwhois = ipwhois($userdata['user_ip'])) - { - echo '<br /><pre align="left">' . trim($ipwhois) . '</pre>'; - } -?></td> - </tr> -<?php - - } - } - -?> - <tr> - <td class="row1">Total/Average posts by this user: </td> - <td class="row2"></td> - </tr> - <tr> - <td class="row1"></td> - <td class="row2"></td> - </tr> - </table></td> - </tr> -</table></form> - -<?php - - break; - - case 'permissions': - - $userauth = new auth(); - $userauth->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']); - } - } - -?> - <tr> - <td colspan="2"><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <td class="cat" colspan="3" align="right">Select permission set: <select name="acl_type"><?php - - $acl_types = '<option>Global Settings</option><option>---------------</option>'; - $acl_types .= '<option value="a">' . $user->lang['ADMINISTRATOR'] . '</option><option value="u">' . $user->lang['USER'] . '</option>'; - $acl_types .= '<option>Forum Settings</option><option>---------------</option>'; - $acl_types .= make_forum_select(false, false, false); - - echo $acl_types; - -?></select> </td> - </tr> - <tr> - <th> <?php echo $user->lang['Option']; ?> </th> - <th> <?php echo $user->lang['Allow']; ?> </th> - <th> <?php echo $user->lang['Deny']; ?> </th> - </tr> -<?php - - foreach ($global as $type => $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"' : ''; -?> - <tr> - <td class="<?php echo $row_class; ?>"><?php echo $l_can_cell; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><input type="radio"<?php echo $allow_type; ?> /></td> - <td class="<?php echo $row_class; ?>" align="center"><input type="radio"<?php echo $deny_type; ?> /></td> - </tr> -<?php - } - } - } - -?> - </table></td> - </tr> - <tr> -<?php - - foreach ($local as $forum_id => $auth_ary) - { - -?> - <td class="row1"><?php echo $forum_data[$forum_id]; ?></td> - <td><table cellspacing="1" cellpadding="0" border="0"> -<?php - - foreach ($auth_ary as $option => $allow) - { - echo '<tr><td>' . $user->lang['acl_' . $option] . ' => ' . (($allow) ? 'Allowed' : 'Denied') . '</td></tr>'; - } - -?> - </table></td> - </tr> -<?php - - } - - break; - - } - - page_footer(); - -} - -// Do we have permission? -if (!$auth->acl_get('a_user')) -{ - trigger_error($user->lang['No_admin']); -} - -page_header($user->lang['Manage']); - -?> - -<h1><?php echo $user->lang['User_admin']; ?></h1> - -<p><?php echo $user->lang['User_admin_explain']; ?></p> - -<form method="post" name="post" action="admin_users.<?php echo $phpEx.$SID; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th align="center"><?php echo $user->lang['Select_a_User']; ?></th> - </tr> - <tr> - <td class="row1" align="center"><input type="text" class="post" name="username" maxlength="50" size="20" /> <input type="submit" name="submituser" value="<?php echo $user->lang['Look_up_user']; ?>" class="mainoption" /> <input type="submit" name="usersubmit" value="<?php echo $user->lang['Find_username']; ?>" class="liteoption" onClick="window.open('<?php echo "../memberlist.$phpEx$SID&mode=searchuser&field=username"; ?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /></td> - </tr> -</table></form> - -<?php - - -page_footer(); - -// --------- -// FUNCTIONS -function ipwhois($ip) -{ - $ipwhois = ''; - - $match = array( - '#RIPE\.NET#is' => '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/admin/admin_viewlogs.php b/phpBB/admin/admin_viewlogs.php deleted file mode 100644 index e544fd144a..0000000000 --- a/phpBB/admin/admin_viewlogs.php +++ /dev/null @@ -1,254 +0,0 @@ -<?php -/*************************************************************************** - * admin_viewlogs.php - * ------------------- - * begin : Friday, May 11, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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 .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>'; -} - -$sort_key_options = ''; -foreach ($sort_by_text as $key => $text) -{ - $selected = ($sort_key == $key) ? ' selected="selected"' : ''; - $sort_key_options .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>'; -} - -$sort_order_options = ($sort_dir == 'a') ? '<option value="a" selected="selected">' . $user->lang['SORT_ASCENDING'] . '</option><option value="d">' . $user->lang['SORT_DESCENDING'] . '</option>' : '<option value="a">' . $user->lang['SORT_ASCENDING'] . '</option><option value="d" selected="selected">' . $user->lang['SORT_DESCENDING'] . '</option>'; - -$sort_sql = $sort_by[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); - -// Output page -page_header($l_title); - -?> - -<h1><?php echo $l_title; ?></h1> - -<p><?php echo $l_title_explain; ?></p> - -<form method="post" action="<?php echo "admin_viewlogs.$phpEx$SID&mode=$mode"; ?>"> -<?php - -// Define forum list if we're looking @ mod logs -if ($mode == 'mod') -{ - - $forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id, false, false); - -?> -<table width="100%" cellpadding="1" cellspacing="1" border="0"> - <tr> - <td align="right"><?php echo $user->lang['SELECT_FORUM']; ?>: <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit() }"><?php echo $forum_box; ?></select> <input class="liteoption" type="submit" value="<?php echo $user->lang['GO']; ?>" /></td> - </tr> -</table> -<?php - -} - -?> - -<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0"> - <tr> - <td class="cat" colspan="5" height="28" align="center"><span class="gensmall"><?php echo $user->lang['DISPLAY_LOG']; ?>: <select name="sort_days"><?php echo $sort_day_options; ?></select> <?php echo $user->lang['SORT_BY']; ?> <select name="sort_key"><?php echo $sort_key_options; ?></select> <select name="sort_dir"><?php echo $sort_order_options; ?></select> <input class="liteoption" type="submit" value="<?php echo $user->lang['GO']; ?>" name="sort" /></span></td> - </tr> - <tr> - <th width="15%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th> - <th width="15%" nowrap="nowrap"><?php echo $user->lang['IP']; ?></th> - <th width="20%" nowrap="nowrap"><?php echo $user->lang['TIME']; ?></th> - <th width="45%" nowrap="nowrap"><?php echo $user->lang['ACTION']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th> - </tr> -<?php - -// -// Grab log data -// -$log_data = array(); -$log_count = 0; -view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, $where_sql, $sort_sql); - -if ($log_count) -{ - for($i = 0; $i < sizeof($log_data); $i++) - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - -?> - <tr> - <td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $log_data[$i]['username']; ?></td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $log_data[$i]['ip']; ?></td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $user->format_date($log_data[$i]['time']); ?></td> - <td class="<?php echo $row_class; ?>"><?php echo $log_data[$i]['action']; ?></td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><input type="checkbox" name="mark[]" value="<?php echo $log_data[$i]['id']; ?>" /></td> - </tr> -<?php - - } - - if ($auth->acl_get('a_clearlogs')) - { - -?> - <tr> - <td class="cat" colspan="5" height="28" align="right"><input class="liteoption" type="submit" name="delmarked" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> <input class="liteoption" type="submit" name="delall" value="<?php echo $user->lang['DELETE_ALL']; ?>" /> </td> - </tr> -<?php - - } -} -else -{ -?> - <tr> - <td class="row1" colspan="5" align="center" nowrap="nowrap"><?php echo $user->lang['NO_ENTRIES']; ?></td> - </tr> -<?php - -} - -?> -</table> - -<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> - <tr> - <td align="left" valign="top"> <span class="nav"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></span></td> - <td align="right" valign="top" nowrap="nowrap"><?php - - if ($auth->acl_get('a_clearlogs')) - { - - -?><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b> <br /><br /><?php - - } - - $pagination = generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&sort_days=$sort_days&sort_key=$sort_key&sort_dir=$sort_dir", $log_count, $config['topics_per_page'], $start); - - ?><span class="nav"><?php echo $pagination; ?></span></td> - </tr> -</table></form> - -<script language="Javascript" type="text/javascript"> -<!-- -function marklist(status) -{ - for (i = 0; i < document.log.length; i++) - { - document.log.elements[i].checked = status; - } -} -//--> -</script> - -<?php - -page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_words.php b/phpBB/admin/admin_words.php deleted file mode 100644 index e8880e86d6..0000000000 --- a/phpBB/admin/admin_words.php +++ /dev/null @@ -1,229 +0,0 @@ -<?php -/*************************************************************************** - * admin_words.php - * ------------------- - * begin : Thursday, Jul 12, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!empty($setmodules)) -{ - if (!$auth->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 .= '<input type="hidden" name="id" value="' . $word_id . '" />'; - } - - page_header($user->lang['WORDS_TITLE']); - -?> - -<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1> - -<p><?php echo $user->lang['WORDS_EXPLAIN']; ?></p> - -<form method="post" action="<?php echo "admin_words.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['EDIT_WORD']; ?></th> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['WORD']; ?></td> - <td class="row2"><input type="text" name="word" value="<?php echo $word_info['word']; ?>" /></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['REPLACEMENT']; ?></td> - <td class="row2"><input type="text" name="replacement" value="<?php echo $word_info['replacement']; ?>" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input class="mainoption" type="submit" name="save" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> - </tr> -</table></form> - -<?php - - page_footer(); - break; - - case 'save': - $word_id = (isset($_POST['id'])) ? intval($_POST['id']) : 0; - $word = (isset($_POST['word'])) ? trim($_POST['word']) : ''; - $replacement = (isset($_POST['replacement'])) ? trim($_POST['replacement']) : ''; - - if ($word == '' || $replacement == '') - { - trigger_error($user->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']); - -?> - -<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1> - -<p><?php echo $user->lang['WORDS_EXPLAIN']; ?></p> - -<form method="post" action="admin_words.<?php echo $phpEx . $SID; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['WORD']; ?></th> - <th><?php echo $user->lang['REPLACEMENT']; ?></th> - <th colspan="2"><?php echo $user->lang['ACTION']; ?></th> - </tr> - -<?php - - $sql = "SELECT * - FROM " . WORDS_TABLE . " - ORDER BY word"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - do - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - -?> - <tr> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['word']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['replacement']; ?></td> - <td class="<?php echo $row_class; ?>"> <a href="<?php echo "admin_words.$phpEx$SID&mode=edit&id=" . $row['word_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> </td> - <td class="<?php echo $row_class; ?>"> <a href="<?php echo "admin_words.$phpEx$SID&mode=delete&id=" . $row['word_id']; ?>"><?php echo $user->lang['DELETE']; ?></a> </td> - </tr> -<?php - - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - -?> - <tr> - <td class="cat" colspan="5" height="28" align="center"><?php echo $s_hidden_fields; ?><input class="mainoption" type="submit" name="add" value="<?php echo $user->lang['ADD_WORD']; ?>" /></td> - </tr> -</table></form> - -<?php - - page_footer(); - -} - -?>
\ No newline at end of file diff --git a/phpBB/admin/forms.css b/phpBB/admin/forms.css deleted file mode 100644 index ff9c6dc922..0000000000 --- a/phpBB/admin/forms.css +++ /dev/null @@ -1,13 +0,0 @@ -/* Fancy form styles for IE */ - -input, textarea, select { - border-width: 1px; -} - -input { - text-indent: 2px; -} - -.postbody { - line-height: 18px -} diff --git a/phpBB/admin/images/cellpic1.gif b/phpBB/admin/images/cellpic1.gif Binary files differdeleted file mode 100644 index 715b8d4aa8..0000000000 --- a/phpBB/admin/images/cellpic1.gif +++ /dev/null diff --git a/phpBB/admin/images/cellpic3.gif b/phpBB/admin/images/cellpic3.gif Binary files differdeleted file mode 100644 index ecf70e1fd1..0000000000 --- a/phpBB/admin/images/cellpic3.gif +++ /dev/null diff --git a/phpBB/admin/images/header_bg.jpg b/phpBB/admin/images/header_bg.jpg Binary files differdeleted file mode 100644 index 5ecec5360b..0000000000 --- a/phpBB/admin/images/header_bg.jpg +++ /dev/null diff --git a/phpBB/admin/images/header_left.jpg b/phpBB/admin/images/header_left.jpg Binary files differdeleted file mode 100644 index aaebf33c7a..0000000000 --- a/phpBB/admin/images/header_left.jpg +++ /dev/null diff --git a/phpBB/admin/images/icon_folder.gif b/phpBB/admin/images/icon_folder.gif Binary files differdeleted file mode 100644 index 9b2bc47c67..0000000000 --- a/phpBB/admin/images/icon_folder.gif +++ /dev/null diff --git a/phpBB/admin/images/icon_folder_lock.gif b/phpBB/admin/images/icon_folder_lock.gif Binary files differdeleted file mode 100644 index 436f3d21c8..0000000000 --- a/phpBB/admin/images/icon_folder_lock.gif +++ /dev/null diff --git a/phpBB/admin/images/icon_subfolder.gif b/phpBB/admin/images/icon_subfolder.gif Binary files differdeleted file mode 100644 index c29bb43f49..0000000000 --- a/phpBB/admin/images/icon_subfolder.gif +++ /dev/null diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php deleted file mode 100644 index 2f285ca04a..0000000000 --- a/phpBB/admin/index.php +++ /dev/null @@ -1,521 +0,0 @@ -<?php -/*************************************************************************** - * index.php [ admin/ ] - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -// Define some vars -$pane = (isset($_GET['pane'])) ? $_GET['pane'] : ''; -$update = ($pane == 'right') ? true : false; - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Do we have any admin permissions at all? -if (!$auth->acl_get('a_')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Generate relevant output -if (isset($_GET['pane']) && $_GET['pane'] == 'top') -{ - page_header('', '', false); - -?> - -<table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td><a href="../index.<?php echo $phpEx . $SID; ?>" target="_top"><img src="images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td> - <td width="100%" background="images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $user->lang['ADMIN_TITLE']; ?></span> </td> - </tr> -</table> - -<?php - - page_footer(false); - -} -else if (isset($_GET['pane']) && $_GET['pane'] == 'left') -{ - // Cheat and use the meta tag to change some stylesheet info - page_header('', '<style type="text/css">body {background-color: #98AAB1}</style>', 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); - -?> - -<table width="100%" cellpadding="0" cellspacing="0" border="0"> - <tr> - <td width="100%"><table width="100%" cellpadding="4" cellspacing="1" border="0"> - <tr> - <th class="menu" height="25">» <?php echo $user->lang['RETURN_TO']; ?></th> - </tr> - <tr> - <td class="row1"><a class="genmed" href="index.<?php echo $phpEx . $SID; ?>&pane=right" target="main"><?php echo $user->lang['ADMIN_INDEX']; ?></a></td> - </tr> - <tr> - <td class="row2"><a class="genmed" href="../index.<?php echo $phpEx . $SID; ?>" target="_top"><?php echo $user->lang['FORUM_INDEX']; ?></a></td> - </tr> -<?php - - if (is_array($module)) - { - @ksort($module); - foreach ($module as $cat => $action_ary) - { - $cat = (!empty($user->lang[$cat . '_CAT'])) ? $user->lang[$cat . '_CAT'] : preg_replace('#_#', ' ', $cat); - -?> - <tr> - <th class="menu" height="25">» <?php echo $cat; ?></th> - </tr> -<?php - - @ksort($action_ary); - - foreach ($action_ary as $action => $file) - { - if (!empty($file)) - { - $action = (!empty($user->lang[$action])) ? $user->lang[$action] : preg_replace('/_/', ' ', $action); - - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; -?> - <tr> - <td class="<?php echo $row_class; ?>"><a class="genmed" href="<?php echo $file; ?>" target="main"><?php echo $action; ?></a></td> - </tr> -<?php - - } - } - } - } - -?> - </table></td> - </tr> -</table> -</body> -</html> -<?php - - // Output footer but don't include copyright info - page_footer(false); - -} -elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') -{ - if ((isset($_POST['activate']) || isset($_POST['delete'])) && !empty($_POST['mark'])) - { - if (!$auth->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']); - -?> - -<script language="Javascript" type="text/javascript"> -<!-- - function marklist(status) - { - for (i = 0; i < document.inactive.length; i++) - { - document.inactive.elements[i].checked = status; - } - } -//--> -</script> - -<h1><?php echo $user->lang['WELCOME_PHPBB']; ?></h1> - -<p><?php echo $user->lang['ADMIN_INTRO']; ?></p> - -<h1><?php echo $user->lang['FORUM_STATS']; ?></h1> - -<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0"> - <tr> - <th width="25%" nowrap="nowrap" height="25"><?php echo $user->lang['STATISTIC']; ?></th> - <th width="25%"><?php echo $user->lang['VALUE']; ?></th> - <th width="25%" nowrap="nowrap"><?php echo $user->lang['STATISTIC']; ?></th> - <th width="25%"><?php echo $user->lang['VALUE']; ?></th> - </tr> - <tr> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['NUMBER_POSTS']; ?>:</td> - <td class="row2"><b><?php echo $total_posts; ?></b></td> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['POSTS_PER_DAY']; ?>:</td> - <td class="row2"><b><?php echo $posts_per_day; ?></b></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['NUMBER_TOPICS']; ?>:</td> - <td class="row2"><b><?php echo $total_topics; ?></b></td> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['TOPICS_PER_DAY']; ?>:</td> - <td class="row2"><b><?php echo $topics_per_day; ?></b></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['NUMBER_USERS']; ?>:</td> - <td class="row2"><b><?php echo $total_users; ?></b></td> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['USERS_PER_DAY']; ?>:</td> - <td class="row2"><b><?php echo $users_per_day; ?></b></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['BOARD_STARTED']; ?>:</td> - <td class="row2"><b><?php echo $start_date; ?></b></td> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['AVATAR_DIR_SIZE']; ?>:</td> - <td class="row2"><b><?php echo $avatar_dir_size; ?></b></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['DATABASE_SIZE']; ?>:</td> - <td class="row2"><b><?php echo $dbsize; ?></b></td> - <td class="row1" nowrap="nowrap"><?php echo $user->lang['GZIP_COMPRESSION']; ?>:</td> - <td class="row2"><b><?php echo ($config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF']; ?></b></td> - </tr> - <!-- tr> - <td class="row1" colspan="4"><?php echo sprintf($user->lang['Record_online_users'], $config['record_online_users'], $user->format_date($config['record_online_date'])); ?></td> - </tr --> -</table> - -<h1><?php echo $user->lang['ADMIN_LOG']; ?></h1> - -<p><?php echo $user->lang['ADMIN_LOG_INDEX_EXPLAIN']; ?></p> - -<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0"> - <tr> - <th width="15%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th> - <th width="15%"><?php echo $user->lang['IP']; ?></th> - <th width="20%"><?php echo $user->lang['TIME']; ?></th> - <th width="45%" nowrap="nowrap"><?php echo $user->lang['ACTION']; ?></th> - </tr> -<?php - - view_log('admin', $log_data, $log_count, 5); - - for($i = 0; $i < sizeof($log_data); $i++) - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - -?> - <tr> - <td class="<?php echo $row_class; ?>"><?php echo $log_data[$i]['username']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $log_data[$i]['ip']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $user->format_date($log_data[$i]['time']); ?></td> - <td class="<?php echo $row_class; ?>"><?php echo $log_data[$i]['action']; ?></td> - </tr> -<?php - - } - - if ($auth->acl_get('a_user')) - { - -?> -</table> - -<h1><?php echo $user->lang['INACTIVE_USERS']; ?></h1> - -<p><?php echo $user->lang['INACTIVE_USERS_EXPLAIN']; ?></p> - -<form method="post" name="inactive" action="<?php echo "index.$phpEx$SID&pane=right"; ?>"><table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0"> - <tr> - <th width="45%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th> - <th width="45%"><?php echo $user->lang['JOINED']; ?></th> - <th width="5%" nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th> - </tr> -<?php - - $sql = "SELECT user_id, username, user_regdate - FROM " . USERS_TABLE . " - WHERE user_active = 0 - AND user_id <> " . 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'; - -?> - <tr> - <td class="<?php echo $row_class; ?>"><a href="<?php echo 'admin_users.' . $phpEx . $SID . '&u=' . $row['user_id']; ?>"><?php echo $row['username']; ?></a></td> - <td class="<?php echo $row_class; ?>"><?php echo $user->format_date($row['user_regdate']); ?></td> - <td class="<?php echo $row_class; ?>"> <input type="checkbox" name="mark[]" value="<?php echo $row['user_id']; ?>" /> </td> - </tr> -<?php - - } - while ($row = $db->sql_fetchrow($result)); - -?> - <tr> - <td class="cat" colspan="3" height="28" align="right"><input class="liteoption" type="submit" name="activate" value="<?php echo $user->lang['ACTIVATE']; ?>" /> <input class="liteoption" type="submit" name="remind" value="<?php echo $user->lang['REMIND']; ?>" /> <input class="liteoption" type="submit" name="delete" value="<?php echo $user->lang['DELETE']; ?>" /> </td> - </tr> -<?php - - } - else - { - -?> - <tr> - <td class="row1" colspan="3" align="center"><?php echo $user->lang['NO_INACTIVE_USERS']; ?></td> - </tr> -<?php - - } - -?> -</table> - -<table width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <td align="right" valign="top" nowrap="nowrap"><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b></td> - </tr> -</table></form> - -<?php - - } - - page_footer(); - -} -else -{ - // - // Output the frameset ... - // - header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Content-type: text/html; charset=" . $user->lang['ENCODING']); - -?> -<html> -<head> -<title><?php echo $user->lang['Admin_title']; ?></title> -</head> - -<frameset rows="60, *" border="0" framespacing="0" frameborder="NO"> - <frame src="<?php echo "index.$phpEx$SID&pane=top"; ?>" name="title" noresize marginwidth="0" marginheight="0" scrolling="NO"> - <frameset cols="155,*" rows="*" border="2" framespacing="0" frameborder="yes"> - <frame src="<?php echo "index.$phpEx$SID&pane=left"; ?>" name="nav" marginwidth="3" marginheight="3" scrolling="yes"> - <frame src="<?php echo "index.$phpEx$SID&pane=right"; ?>" name="main" marginwidth="0" marginheight="0" scrolling="auto"> - </frameset> -</frameset> - -<noframes> - <body bgcolor="white" text="#000000"> - <p><?php echo $user->lang['No_frames']; ?></p> - </body> -</noframes> -</html> -<?php - - exit; -} - -?>
\ No newline at end of file diff --git a/phpBB/admin/pagestart.php b/phpBB/admin/pagestart.php deleted file mode 100644 index 752a3bbfe7..0000000000 --- a/phpBB/admin/pagestart.php +++ /dev/null @@ -1,181 +0,0 @@ -<?php -/*************************************************************************** - * pagestart.php - * ------------------- - * begin : Thursday, Aug 2, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ - -if (!defined('IN_PHPBB')) -{ - die('Hacking attempt'); -} - -define('IN_ADMIN', true); -define('NEED_SID', true); -require($phpbb_root_path . 'common.'.$phpEx); -require_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx); - -// Start session management -$user->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']); - -?> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $user->lang['ENCODING']; ?>"> -<meta http-equiv="Content-Style-Type" content="text/css"> -<link rel="stylesheet" href="subSilver.css" type="text/css"> -<?php - - echo $meta; - -?> -<style type="text/css"> -<!-- -th { background-image: url('images/cellpic3.gif') } -td.cat { background-image: url('images/cellpic1.gif') } -//--> -</style> -<title><?php echo $config['sitename'] . ' - ' . $page_title; ?></title> -</head> -<body> - -<?php - - if ($table_html) - { - -?> -<a name="top"></a> - -<table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td colspan="2" height="25" align="right" nowrap="nowrap"><span class="subtitle">» <i><?php echo $sub_title; ?></i></span> </td> - </tr> -</table> - -<table width="95%" cellspacing="0" cellpadding="0" border="0" align="center"> - <tr> - <td><br clear="all" /> - -<?php - - } - -} - -function page_footer($copyright_html = true) -{ - global $cache, $config, $db, $phpEx; - - // Close our DB connection. - $db->sql_close(); - -?> - - </td> - </tr> -</table> -<?php - - if ($copyright_html) - { - -?> - -<div align="center"><span class="copyright">Powered by phpBB <?php echo $config['version']; ?> © 2002 <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a></span></div> - -<br clear="all" /> - -</body> -</html> -<?php - - } - - if (!empty($cache)) - { - $cache->unload(); - } - - exit; -} - -function page_message($title, $message, $show_header = false) -{ - global $phpEx, $SID, $user; - - if ($show_header) - { - -?> - -<table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td><a href="../index.<?php echo $phpEx . $SID; ?>"><img src="images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td> - <td width="100%" background="images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $user->lang['ADMIN_TITLE']; ?></span> </td> - </tr> -</table> - -<?php - - } - -?> - -<br /><br /> - -<table class="bg" width="80%" cellpadding="4" cellspacing="1" border="0" align="center"> - <tr> - <th><?php echo $title; ?></th> - </tr> - <tr> - <td class="row1" align="center"><?php echo $message; ?></td> - </tr> -</table> - -<br /> - -<?php - -} -// End Functions -// ----------------------------- - -?>
\ No newline at end of file diff --git a/phpBB/admin/subSilver.css b/phpBB/admin/subSilver.css deleted file mode 100644 index 4d1c250ed6..0000000000 --- a/phpBB/admin/subSilver.css +++ /dev/null @@ -1,187 +0,0 @@ -/* - $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/admin/swatch.php b/phpBB/admin/swatch.php deleted file mode 100644 index ddfa63e5a8..0000000000 --- a/phpBB/admin/swatch.php +++ /dev/null @@ -1,56 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<title>phpBB 2.2 Color Swatch</title> -<style type="text/css"> - -td { - border: solid 1px #333333; -} - -.over { - border-color: white; -} - -.out { - border-color: #333333; -} - -</style> -<body bgcolor="#404040" text="#FFFFFF"> -<script language="javascript" type="text/javascript"> -<!-- - var r = 0, g = 0, b = 0; - var numberList = new Array(6); - numberList[0] = "00"; - numberList[1] = "33"; - numberList[2] = "66"; - numberList[3] = "99"; - numberList[4] = "CC"; - numberList[5] = "FF"; - document.writeln('<table cellspacing="0" cellpadding="0" border="0">'); - for(r = 0; r < 6; r++) - { - document.writeln('<tr>'); - for(g = 0; g < 6; g++) - { - for(b = 0; b < 6; b++) - { - color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); - document.write('<td bgcolor="#' + color + '" onmouseover="this.className=\'over\'" onmouseout="this.className=\'out\'">'); - document.write('<a href="javascript:cell(\'' + color + '\');"><img src="../images/spacer.gif" width="15" height="12" border="0" alt="#' + color + '" title="#' + color + '" /></a>'); - document.writeln('</td>'); - } - } - document.writeln('</tr>'); - } - document.writeln('</table>'); - -function cell(color) -{ - opener.document.forms['<?php echo $_GET['form']; ?>'].<?php echo $_GET['name']; ?>.value=color; -} -//--> -</script> - -</body> -</html>
\ No newline at end of file |