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 @@ -acl_get('a_ban')) - { - return; - } - - $filename = basename(__FILE__); - $module['USER']['BAN_USERS'] = $filename . "$SID&mode=user"; - $module['USER']['BAN_EMAILS'] = $filename . "$SID&mode=email"; - $module['USER']['BAN_IPS'] = $filename . "$SID&mode=ip"; - - return; -} - -// Load default header -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Do we have ban permissions? -if (!$auth->acl_get('a_ban')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Mode setting -if (isset($_POST['mode']) || isset($_GET['mode'])) -{ - $mode = (isset($_POST['mode'])) ? $_POST['mode'] : $_GET['mode']; -} -else -{ - $mode = ''; -} - -$current_time = time(); - -// Start program -if (isset($_POST['bansubmit']) || isset($_GET['bansubmit'])) -{ - $ban = (!empty($_POST['ban'])) ? $_POST['ban'] : $_GET['ban']; - $ban_list = array_unique(explode("\n", $ban)); - $ban_list_log = implode(', ', $ban_list); - - $ban_exclude = (!empty($_POST['banexclude'])) ? 1 : 0; - $ban_reason = (isset($_POST['banreason'])) ? $_POST['banreason'] : ''; - - if (!empty($_POST['banlength'])) - { - if ($_POST['banlength'] != -1 || empty($_POST['banlengthother'])) - { - $ban_end = max($current_time, $current_time + (intval($_POST['banlength']) * 60)); - } - else - { - $ban_other = explode('-', $_POST['banlengthother']); - $ban_end = max($current_time, gmmktime(0, 0, 0, $ban_other[1], $ban_other[2], $ban_other[0])); - } - } - else - { - $ban_end = 0; - } - - $banlist = array(); - - switch ($mode) - { - case 'user': - $type = 'ban_userid'; - - $banlist_tmp = array(); - for($i = 0; $i < count($ban_list); $i++) - { - if (trim($ban_list[$i]) != '') - { - $banlist_tmp[] = '\'' . trim($ban_list[$i]) . '\''; - } - } - - $sql = "SELECT user_id - FROM " . USERS_TABLE . " - WHERE username IN (" . implode(', ', $banlist_tmp) . ")"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - do - { - $banlist[] = $row['user_id']; - } - while ($row = $db->sql_fetchrow($result)); - } - unset($banlist_tmp); - break; - - case 'ip': - $type = 'ban_ip'; - - for($i = 0; $i < count($ban_list); $i++) - { - if (preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ban_list[$i]), $ip_range_explode)) - { - // Don't ask about all this, just don't ask ... ! - $ip_1_counter = $ip_range_explode[1]; - $ip_1_end = $ip_range_explode[5]; - - while ($ip_1_counter <= $ip_1_end) - { - $ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0; - $ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6]; - - if($ip_2_counter == 0 && $ip_2_end == 254) - { - $ip_2_counter = 256; - $ip_2_fragment = 256; - - $banlist[] = "'$ip_1_counter.*'"; - } - - while ($ip_2_counter <= $ip_2_end) - { - $ip_3_counter = ($ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[3] : 0; - $ip_3_end = ($ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[7]; - - if ($ip_3_counter == 0 && $ip_3_end == 254) - { - $ip_3_counter = 256; - $ip_3_fragment = 256; - - $banlist[] = "'$ip_1_counter.$ip_2_counter.*'"; - } - - while ($ip_3_counter <= $ip_3_end) - { - $ip_4_counter = ($ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[4] : 0; - $ip_4_end = ($ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end) ? 254 : $ip_range_explode[8]; - - if ($ip_4_counter == 0 && $ip_4_end == 254) - { - $ip_4_counter = 256; - $ip_4_fragment = 256; - - $banlist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.*'"; - } - - while ($ip_4_counter <= $ip_4_end) - { - $banlist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter'"; - $ip_4_counter++; - } - $ip_3_counter++; - } - $ip_2_counter++; - } - $ip_1_counter++; - } - } - else if (preg_match('/^([\w\-_]\.?){2,}$/is', trim($ban_list[$i]))) - { - $ip = gethostbynamel(trim($ban_list[$i])); - - for($j = 0; $j < count($ip); $j++) - { - if (!empty($ip[$j])) - { - $banlist[] = '\'' . $ip[$j] . '\''; - } - } - } - else if (preg_match('/^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$/', trim($ban_list[$i])) || preg_match('/^[a-f0-9:]+\*?$/i', trim($ban_list[$i]))) - { - $banlist[] = '\'' . trim($ban_list[$i]) . '\''; - } - } - break; - - case 'email': - $type = 'ban_email'; - - for($i = 0; $i < count($ban_list); $i++) - { - // This ereg match is based on one by php@unreelpro.com - // contained in the annotated php manual at php.com (ereg - // section) - if (eregi('^(([[:alnum:]\*]+([-_.][[:alnum:]\*]+)*\.?)|(\*))@([[:alnum:]]+([-_]?[[:alnum:]]+)*\.){1,3}([[:alnum:]]{2,6})$', trim($ban_list[$i]))) - { - $banlist[] = '\'' . trim($ban_list[$i]) . '\''; - } - } - break; - } - - $sql = "SELECT $type - FROM " . BANLIST_TABLE . " - WHERE $type <> '' - AND ban_exclude = $ban_exclude"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $banlist_tmp = array(); - do - { - switch ($mode) - { - case 'user': - $banlist_tmp[] = $row['ban_userid']; - break; - - case 'ip': - $banlist_tmp[] = '\'' . $row['ban_ip'] . '\''; - break; - - case 'email': - $banlist_tmp[] = '\'' . $row['ban_email'] . '\''; - break; - } - } - while ($row = $db->sql_fetchrow($result)); - - $banlist = array_unique(array_diff($banlist, $banlist_tmp)); - unset($banlist_tmp); - } - - if (sizeof($banlist)) - { - for($i = 0; $i < count($banlist); $i++) - { - $sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason) - VALUES (" . $banlist[$i] . ", $current_time, $ban_end, $ban_exclude, '$ban_reason')"; - $db->sql_query($sql); - } - - if (!$ban_exclude) - { - $sql = ''; - switch ($mode) - { - case 'user': - $sql = "WHERE session_user_id IN (" . implode(', ', $banlist) . ")"; - break; - - case 'ip': - $sql = "WHERE session_ip IN (" . implode(', ', $banlist) . ")"; - break; - - case 'email': - $sql = "SELECT user_id - FROM " . USERS_TABLE . " - WHERE user_email IN (" . implode(', ', $banlist) . ")"; - $result = $db->sql_query($sql); - - $sql = ''; - if ($row = $db->sql_fetchrow($result)) - { - do - { - $sql .= (($sql != '') ? ', ' : '') . $row['user_id']; - } - while ($row = $db->sql_fetchrow($result)); - - $sql = "WHERE session_user_id IN (" . str_replace('*', '%', $sql) . ")"; - } - break; - } - - if ($sql != '') - { - $sql = "DELETE FROM " . SESSIONS_TABLE . " - $sql"; - $db->sql_query($sql); - } - } - - // Update log - $log_entry = ($ban_exclude) ? 'LOG_BAN_EXCLUDE_' : 'log_ban_'; - add_log('admin', $log_entry . $mode, $ban_reason, $ban_list_log); - } - - trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']); - -} -else if (isset($_POST['unbansubmit'])) -{ - $unban_sql = ''; - for($i = 0; $i < count($_POST['unban']); $i++) - { - $unban_sql .= (($unban_sql != '') ? ', ' : '') . intval($_POST['unban'][$i]); - } - - if ($unban_sql != '') - { - $sql = "DELETE FROM " . BANLIST_TABLE . " - WHERE ban_id IN ($unban_sql)"; - $db->sql_query($sql); - - add_log('admin', 'log_unban_' . $mode, sizeof($_POST['unban'])); - } - - trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']); -} - -// -// Output relevant entry page -// - -// -// Remove timed out bans -// -$sql = "DELETE FROM " . BANLIST_TABLE . " - WHERE ban_end < " . time() . " - AND ban_end <> 0"; -$db->sql_query($sql); - -// -// Ban length options -// -$ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['OTHER'] . ' -> '); - -$ban_end_options = ''; -foreach ($ban_end_text as $length => $text) -{ - $ban_end_options .= ''; -} - -// -// Title -// -switch ($mode) -{ - case 'user': - $l_title = $user->lang['BAN_USERS']; - break; - case 'email': - $l_title = $user->lang['BAN_EMAILS']; - break; - case 'ip': - $l_title = $user->lang['BAN_IPS']; - break; -} - -// -// Output page -// -page_header($l_title); - -?> - -
lang['BAN_EXPLAIN']; ?>
- -lang['BAN_USERS']; - $l_ban_explain = $user->lang['BAN_USERNAME_EXPLAIN']; - $l_ban_exclude_explain = $user->lang['BAN_USER_EXCLUDE_EXPLAIN']; - $l_unban_title = $user->lang['UNBAN_USERNAME']; - $l_unban_explain = $user->lang['UNBAN_USERNAME_EXPLAIN']; - $l_ban_cell = $user->lang['USERNAME']; - $l_no_ban_cell = $user->lang['NO_BANNED_USERS']; - $s_submit_extra = ''; - - $sql = "SELECT b.*, u.user_id, u.username - FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u - WHERE (b.ban_end >= " . time() . " - OR b.ban_end = 0) - AND u.user_id = b.ban_userid - AND b.ban_userid <> 0 - AND u.user_id <> " . ANONYMOUS . " - ORDER BY u.user_id ASC"; - break; - - case 'ip': - - $field = 'ban_ip'; - $l_ban_title = $user->lang['BAN_IPS']; - $l_ban_explain = $user->lang['BAN_IP_EXPLAIN']; - $l_ban_exclude_explain = $user->lang['BAN_IP_EXCLUDE_EXPLAIN']; - $l_unban_title = $user->lang['UNBAN_IP']; - $l_unban_explain = $user->lang['UNBAN_IP_EXPLAIN']; - $l_ban_cell = $user->lang['IP_HOSTNAME']; - $l_no_ban_cell = $user->lang['NO_BANNED_IP']; - $s_submit_extra = ''; - - $sql = "SELECT * - FROM " . BANLIST_TABLE . " - WHERE (ban_end >= " . time() . " - OR ban_end = 0) - AND ban_ip <> ''"; - break; - - case 'email': - - $field = 'ban_email'; - $l_ban_title = $user->lang['BAN_EMAILS']; - $l_ban_explain = $user->lang['BAN_EMAIL_EXPLAIN']; - $l_ban_exclude_explain = $user->lang['BAN_EMAIL_EXCLUDE_EXPLAIN']; - $l_unban_title = $user->lang['UNBAN_EMAIL']; - $l_unban_explain = $user->lang['UNBAN_EMAIL_EXPLAIN']; - $l_ban_cell = $user->lang['EMAIL_ADDRESS']; - $l_no_ban_cell = $user->lang['NO_BANNED_EMAIL']; - $s_submit_extra = ''; - - $sql = "SELECT * - FROM " . BANLIST_TABLE . " - WHERE (ban_end >= " . time() . " - OR ban_end = 0) - AND ban_email <> ''"; - break; -} -$result = $db->sql_query($sql); - -$banned_options = ''; -$ban_length = $ban_reasons = array(); -if ($row = $db->sql_fetchrow($result)) -{ - do - { - - $banned_options .= ''; - - $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); - -?> - - - - - - - - - - \ 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 @@ -acl_get('a_cookies')) ? "$file$SID&mode=cookie" : ''; - $module['GENERAL']['BOARD_DEFAULTS'] = ($auth->acl_get('a_defaults')) ? "$file$SID&mode=default" : ''; - $module['GENERAL']['BOARD_SETTINGS'] = ($auth->acl_get('a_board')) ? "$file$SID&mode=setting" : ''; - $module['GENERAL']['AVATAR_SETTINGS'] = ($auth->acl_get('a_board')) ? "$file$SID&mode=avatar" : ''; - $module['GENERAL']['EMAIL_SETTINGS'] = ($auth->acl_get('a_server')) ? "$file$SID&mode=email" : ''; - $module['GENERAL']['SERVER_SETTINGS'] = ($auth->acl_get('a_server')) ? "$file$SID&mode=server" : ''; - $module['GENERAL']['AUTH_SETTINGS'] = ($auth->acl_get('a_server')) ? "$file$SID&mode=auth" : ''; - return; -} - -define('IN_PHPBB', 1); -// Load default header -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Get mode -$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; - -// Check permissions/set title -switch ($mode) -{ - case 'cookie': - $l_title = 'COOKIE_SETTINGS'; - $which_auth = 'a_cookies'; - break; - case 'default': - $l_title = 'BOARD_DEFAULTS'; - $which_auth = 'a_defaults'; - break; - case 'avatar': - $l_title = 'AVATAR_SETTINGS'; - $which_auth = 'a_board'; - break; - case 'setting': - $l_title = 'BOARD_SETTINGS'; - $which_auth = 'a_board'; - break; - case 'email': - $l_title = 'EMAIL_SETTINGS'; - $which_auth = 'a_server'; - break; - case 'server': - $l_title = 'SERVER_SETTINGS'; - $which_auth = 'a_server'; - break; - case 'auth': - $l_title = 'AUTH_SETTINGS'; - $which_auth = 'a_server'; - break; - default: - return; -} - -// Check permissions -if (!$auth->acl_get($which_acl)) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Pull all config data -$sql = "SELECT * - FROM " . CONFIG_TABLE; -$result = $db->sql_query($sql); - -while ($row = $db->sql_fetchrow($result)) -{ - $config_name = $row['config_name']; - $config_value = $row['config_value']; - - $default_config[$config_name] = $config_value; - $new[$config_name] = (isset($_POST[$config_name])) ? $_POST[$config_name] : $default_config[$config_name]; - - if (isset($_POST['submit'])) - { - set_config($config_name, stripslashes($new[$config_name])); - } -} - -if (isset($_POST['submit'])) -{ - add_log('admin', 'log_' . $mode . '_config'); - trigger_error($user->lang['Config_updated']); -} - -page_header($user->lang[$l_title]); - -?> - -lang[$l_title . '_EXPLAIN']; ?>
- - - - \ 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 @@ -acl_get('a_backup')) ? $filename . "$SID&mode=backup" : ''; - - $file_uploads = @ini_get('file_uploads'); - if (!empty($file_uploads) && $file_uploads !== 0 && strtolower($file_uploads) != 'off' && $auth->acl_get('a_restore')) - { - $module['DB']['DB_RESTORE'] = $filename . "$SID&mode=restore"; - } - - return; -} - -define('IN_PHPBB', 1); -// Load default header -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -$mode = (isset($_GET['mode'])) ? $_GET['mode'] : ''; - -// Increase maximum execution time, but don't complain about it if it isn't -// allowed. -@set_time_limit(1200); - -// Begin program proper -switch($mode) -{ - case 'backup': - if (!$auth->acl_get('a_backup')) - { - trigger_error($user->lang['NO_ADMIN']); - } - - if (SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql') - { - switch (SQL_LAYER) - { - case 'oracle': - $db_type = 'Oracle'; - break; - case 'odbc': - $db_type = 'ODBC'; - break; - case 'mssql': - $db_type = 'MSSQL'; - break; - } - - trigger_error($user->lang['Backups_not_supported']); - break; - } - - $additional_tables = (isset($_POST['tables'])) ? $_POST['tables'] : ((isset($_GET['tables'])) ? $_GET['tables'] : ''); - $backup_type = (isset($_POST['type'])) ? $_POST['type'] : ((isset($_GET['type'])) ? $_GET['type'] : ''); - $search = (!empty($_POST['search'])) ? intval($_POST['search']) : ((!empty($_GET['search'])) ? intval($_GET['search']) : 0); - $store_path = (isset($_POST['store'])) ? $_POST['store'] : ((isset($_GET['store'])) ? $_GET['store'] : ''); - $compress = (!empty($_POST['compress'])) ? $_POST['compress'] : ((!empty($_GET['compress'])) ? $_GET['compress'] : 'none'); - - if (!isset($_POST['backupstart']) && !isset($_GET['backupstart'])) - { - page_header($user->lang['DB_BACKUP']); - -?> - -lang['Backup_explain']; ?>
- - - -"; - - $message = (empty($store_path)) ? $user->lang['Backup_download'] : $user->lang['Backup_writing']; - - page_header($user->lang['DB_Backup'], $meta); - page_message($user->lang['DB_Backup'], $message); - page_footer(); - } - - $tables = (SQL_LAYER != 'postgresql') ? mysql_get_tables() : pg_get_tables(); - @sort($tables); - - if (!empty($additional_tables)) - { - $additional_tables = explode(',', $additional_tables); - - for($i = 0; $i < count($additional_tables); $i++) - { - $tables[] = trim($additional_tables[$i]); - } - unset($additional_tables); - } - - // - // Enable output buffering - // - @ob_start(); - @ob_implicit_flush(0); - - // - // Build the sql script file... - // - echo "#\n"; - echo "# phpBB Backup Script\n"; - echo "# Dump of tables for $dbname\n"; - echo "#\n# DATE : " . gmdate("d-m-Y H:i:s", time()) . " GMT\n"; - echo "#\n"; - - if (SQL_LAYER == 'postgresql') - { - echo "\n" . pg_get_sequences("\n", $backup_type); - } - - for($i = 0; $i < count($tables); $i++) - { - $table_name = $tables[$i]; - - if (SQL_LAYER != 'mysql4') - { - $table_def_function = "get_table_def_" . SQL_LAYER; - $table_content_function = "get_table_content_" . SQL_LAYER; - } - else - { - $table_def_function = "get_table_def_mysql"; - $table_content_function = "get_table_content_mysql"; - } - - if ($backup_type != 'data') - { - echo "#\n# TABLE: " . $table_name . "\n#\n"; - echo $table_def_function($table_name, "\n") . "\n"; - } - - if ($backup_type != 'structure') - { - // - // Skip search table data? - // - if ($search || (!$search && !preg_match('/search_word/', $table_name))) - { - $table_content_function($table_name, "output_table_content"); - } - } - } - - // - // Flush the buffer, send the file - // - switch ($compress) - { - case 'gzip': - $extension = 'sql.gz'; - $contents = gzencode(ob_get_contents()); - ob_end_clean(); - break; - - case 'zip': - $extension = 'zip'; - $zip = new zipfile; - $zip->add_file(ob_get_contents(), "phpbb_db_backup.sql", time()); - ob_end_clean(); - $contents = $zip->file(); - break; - - case 'bzip': - $extension = 'bz2'; - $contents = bzcompress(ob_get_contents()); - ob_end_clean(); - break; - - default: - $extension = 'sql'; - $contents = ob_get_contents(); - ob_end_clean(); - } - - add_log('admin', 'log_db_backup'); - - if (empty($store_path)) - { - header("Pragma: no-cache"); - header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.$extension\""); - header("Content-disposition: attachment; filename=phpbb_db_backup.$extension"); - - echo $contents; - unset($contents); - } - else - { - if (!($fp = fopen('./../' . $store_path . "/phpbb_db_backup.$extension", 'wb'))) - { - message_die(ERROR, 'Could not open backup file'); - } - - if (!fwrite($fp, $contents)) - { - message_die(ERROR, 'Could not write backup file content'); - } - - fclose($fp); - unset($contents); - - trigger_error($user->lang['Backup_success']); - } - - exit; - break; - - case 'restore': - if (!$auth->acl_get('a_restore')) - { - trigger_error($user->lang['No_admin']); - } - - if (isset($_POST['restorestart'])) - { - // - // Handle the file upload .... - // If no file was uploaded report an error... - // - if (!empty($_POST['local'])) - { - $file_tmpname = './../' . str_replace('\\\\', '/', $_POST['local']); - $filename = substr($file_tmpname, strrpos($file_tmpname, '/')); - } - else - { - $filename = (!empty($HTTP_POST_FILES['backup_file']['name'])) ? $HTTP_POST_FILES['backup_file']['name'] : ''; - $file_tmpname = ($HTTP_POST_FILES['backup_file']['tmp_name'] != 'none') ? $HTTP_POST_FILES['backup_file']['tmp_name'] : ''; - } - - if ($file_tmpname == '' || $filename == '' || !file_exists($file_tmpname)) - { - trigger_error($user->lang['Restore_Error_no_file']); - } - - $ext = substr($filename, strrpos($filename, '.') + 1); - - if (!preg_match('/^(sql|gz|bz2)$/', $ext)) - { - trigger_error($user->lang['Restore_Error_filename']); - } - - if ((!extension_loaded('zlib') && $ext == 'gz') || (!extension_loaded('zip') && $ext == 'zip') || ($ext == 'bz2' && !extension_loaded('bz2'))) - { - trigger_error($user->lang['Compress_unsupported']); - } - - $sql_query = ''; - switch ($ext) - { - case 'gz': - $fp = gzopen($file_tmpname, 'rb'); - while (!gzeof($fp)) - { - $sql_query .= gzgets($fp, 100000); - } - gzclose($fp); - break; - - case 'bz2': - $sql_query = bzdecompress(fread(fopen($file_tmpname, 'rb'), filesize($file_tmpname))); - break; - - case 'zip': - - - default; - $sql_query = fread(fopen($file_tmpname, 'r'), filesize($file_tmpname)); - } - - if ($sql_query != '') - { - // Strip out sql comments... - $sql_query = remove_remarks($sql_query); - $pieces = split_sql_file($sql_query, ';'); - - $sql_count = count($pieces); - for($i = 0; $i < $sql_count; $i++) - { - $sql = trim($pieces[$i]); - - if (!empty($sql) && $sql[0] != '#') - { - $db->sql_query($sql); - } - } - } - - add_log('admin', 'log_db_restore'); - - trigger_error($user->lang['Restore_success']); - } - - // - // Restore page - // - page_header($user->lang['DB_RESTORE']); - -?> - -lang['Restore_explain']; ?>
- - - -lang['No_admin']); - exit; - -} - -page_footer(); - -// ----------------------------------------------- -// Begin Functions -// - -// -// Table defns (not from phpMyAdmin) -// -function mysql_get_tables() -{ - global $db, $table_prefix; - - $tables = array(); - - $result = mysql_list_tables($db->dbname, $db->db_connect_id); - if ($row = $db->sql_fetchrow($result)) - { - do - { - if (preg_match('/^' . $table_prefix . '/', $row[0])) - { - $tables[] = $row[0]; - } - } - while ($row = $db->sql_fetchrow($result)); - } - - return $tables; -} - -// -// The following functions are adapted from phpMyAdmin and upgrade_20.php -// -// This function is used for grabbing the sequences for postgres... -// -function pg_get_sequences($crlf, $backup_type) -{ - global $db; - - $get_seq_sql = "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' - AND relkind = 'S' ORDER BY relname"; - - $seq = $db->sql_query($get_seq_sql); - - if (!$num_seq = $db->sql_numrows($seq)) - { - - $return_val = "# No Sequences Found $crlf"; - - } - else - { - $return_val = "# Sequences $crlf"; - $i_seq = 0; - - while($i_seq < $num_seq) - { - $row = $db->sql_fetchrow($seq); - $sequence = $row['relname']; - - $get_props_sql = "SELECT * FROM $sequence"; - $seq_props = $db->sql_query($get_props_sql); - - if ($db->sql_numrows($seq_props) > 0) - { - $row1 = $db->sql_fetchrow($seq_props); - - if ($backup_type == 'structure') - { - $row['last_value'] = 1; - } - - $return_val .= "CREATE SEQUENCE $sequence start " . $row['last_value'] . ' increment ' . $row['increment_by'] . ' maxvalue ' . $row['max_value'] . ' minvalue ' . $row['min_value'] . ' cache ' . $row['cache_value'] . "; $crlf"; - - } // End if numrows > 0 - - if (($row['last_value'] > 1) && ($backup_type != 'structure')) - { - $return_val .= "SELECT NEXTVALE('$sequence'); $crlf"; - unset($row['last_value']); - } - - $i_seq++; - - } // End while.. - - } // End else... - - return $returnval; - -} // End function... - -// -// The following functions will return the "CREATE TABLE syntax for the -// varying DBMS's -// -// This function returns, will return the table def's for postgres... -// -function get_table_def_postgresql($table, $crlf) -{ - global $db; - - $schema_create = ""; - // - // Get a listing of the fields, with their associated types, etc. - // - - $field_query = "SELECT a.attnum, a.attname AS field, t.typname as type, a.attlen AS length, a.atttypmod as lengthvar, a.attnotnull as notnull - FROM pg_class c, pg_attribute a, pg_type t - WHERE c.relname = '$table' - AND a.attnum > 0 - AND a.attrelid = c.oid - AND a.atttypid = t.oid - ORDER BY a.attnum"; - $result = $db->sql_query($field_query); - - if (!$result) - { - message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $field_query); - } // end if.. - - $schema_create .= "DROP TABLE $table;$crlf"; - - // - // Ok now we actually start building the SQL statements to restore the tables - // - - $schema_create .= "CREATE TABLE $table($crlf"; - - while ($row = $db->sql_fetchrow($result)) - { - // - // Get the data from the table - // - $sql_get_default = "SELECT d.adsrc AS rowdefault - FROM pg_attrdef d, pg_class c - WHERE (c.relname = '$table') - AND (c.oid = d.adrelid) - AND d.adnum = " . $row['attnum']; - $def_res = $db->sql_query($sql_get_default); - - if (!$def_res) - { - unset($row['rowdefault']); - } - else - { - $row['rowdefault'] = @pg_result($def_res, 0, 'rowdefault'); - } - - if ($row['type'] == 'bpchar') - { - // Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement. - $row['type'] = 'char'; - } - - $schema_create .= ' ' . $row['field'] . ' ' . $row['type']; - - if (eregi('char', $row['type'])) - { - if ($row['lengthvar'] > 0) - { - $schema_create .= '(' . ($row['lengthvar'] -4) . ')'; - } - } - - if (eregi('numeric', $row['type'])) - { - $schema_create .= '('; - $schema_create .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff)); - $schema_create .= ')'; - } - - if (!empty($row['rowdefault'])) - { - $schema_create .= ' DEFAULT ' . $row['rowdefault']; - } - - if ($row['notnull'] == 't') - { - $schema_create .= ' NOT NULL'; - } - - $schema_create .= ",$crlf"; - - } - // - // Get the listing of primary keys. - // - - $sql_pri_keys = "SELECT ic.relname AS index_name, bc.relname AS tab_name, ta.attname AS column_name, i.indisunique AS unique_key, i.indisprimary AS primary_key - FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia - WHERE (bc.oid = i.indrelid) - AND (ic.oid = i.indexrelid) - AND (ia.attrelid = i.indexrelid) - AND (ta.attrelid = bc.oid) - AND (bc.relname = '$table') - AND (ta.attrelid = i.indrelid) - AND (ta.attnum = i.indkey[ia.attnum-1]) - ORDER BY index_name, tab_name, column_name "; - $result = $db->sql_query($sql_pri_keys); - - if (!$result) - { - message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_pri_keys); - } - - while ($row = $db->sql_fetchrow($result)) - { - if ($row['primary_key'] == 't') - { - if (!empty($primary_key)) - { - $primary_key .= ', '; - } - - $primary_key .= $row['column_name']; - $primary_key_name = $row['index_name']; - - } - else - { - // - // We have to store this all this info because it is possible to have a multi-column key... - // we can loop through it again and build the statement - // - $index_rows[$row['index_name']]['table'] = $table; - $index_rows[$row['index_name']]['unique'] = ($row['unique_key'] == 't') ? ' UNIQUE ' : ''; - $index_rows[$row['index_name']]['column_names'] .= $row['column_name'] . ', '; - } - } - - if (!empty($index_rows)) - { - while(list($idx_name, $props) = each($index_rows)) - { - $props['column_names'] = ereg_replace(", $", "" , $props['column_names']); - $index_create .= 'CREATE ' . $props['unique'] . " INDEX $idx_name ON $table (" . $props['column_names'] . ");$crlf"; - } - } - - if (!empty($primary_key)) - { - $schema_create .= " CONSTRAINT $primary_key_name PRIMARY KEY ($primary_key),$crlf"; - } - - // - // Generate constraint clauses for CHECK constraints - // - $sql_checks = "SELECT rcname as index_name, rcsrc - FROM pg_relcheck, pg_class bc - WHERE rcrelid = bc.oid - AND bc.relname = '$table' - AND NOT EXISTS ( - SELECT * - FROM pg_relcheck as c, pg_inherits as i - WHERE i.inhrelid = pg_relcheck.rcrelid - AND c.rcname = pg_relcheck.rcname - AND c.rcsrc = pg_relcheck.rcsrc - AND c.rcrelid = i.inhparent - )"; - $result = $db->sql_query($sql_checks); - - if (!$result) - { - message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_checks); - } - - // - // Add the constraints to the sql file. - // - while ($row = $db->sql_fetchrow($result)) - { - $schema_create .= ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['rcsrc'] . ",$crlf"; - } - - $schema_create = ereg_replace(',' . $crlf . '$', '', $schema_create); - $index_create = ereg_replace(',' . $crlf . '$', '', $index_create); - - $schema_create .= "$crlf);$crlf"; - - if (!empty($index_create)) - { - $schema_create .= $index_create; - } - - // - // Ok now we've built all the sql return it to the calling function. - // - return (stripslashes($schema_create)); - -} - -// -// This function returns the "CREATE TABLE" syntax for mysql dbms... -// -function get_table_def_mysql($table, $crlf) -{ - global $db; - - $schema_create = ""; - $field_query = "SHOW FIELDS FROM $table"; - $key_query = "SHOW KEYS FROM $table"; - - // If the user has selected to drop existing tables when doing a restore. - // Then we add the statement to drop the tables.... - $schema_create .= "DROP TABLE IF EXISTS $table;$crlf"; - $schema_create .= "CREATE TABLE $table($crlf"; - - // Ok lets grab the fields... - $result = $db->sql_query($field_query); - - while ($row = $db->sql_fetchrow($result)) - { - $schema_create .= ' ' . $row['Field'] . ' ' . $row['Type']; - - if (!empty($row['Default'])) - { - $schema_create .= ' DEFAULT \'' . $row['Default'] . '\''; - } - - if ($row['Null'] != "YES") - { - $schema_create .= ' NOT NULL'; - } - - if ($row['Extra'] != "") - { - $schema_create .= ' ' . $row['Extra']; - } - - $schema_create .= ",$crlf"; - } - // - // Drop the last ',$crlf' off ;) - // - $schema_create = ereg_replace(',' . $crlf . '$', "", $schema_create); - - // - // Get any Indexed fields from the database... - // - $result = $db->sql_query($key_query); - - while($row = $db->sql_fetchrow($result)) - { - $kname = $row['Key_name']; - - if (($kname != 'PRIMARY') && ($row['Non_unique'] == 0)) - { - $kname = "UNIQUE|$kname"; - } - - if (!is_array($index[$kname])) - { - $index[$kname] = array(); - } - - $index[$kname][] = $row['Column_name']; - } - - foreach ($index as $x => $columns) - { - $schema_create .= ", $crlf"; - - if ($x == 'PRIMARY') - { - $schema_create .= ' PRIMARY KEY (' . implode($columns, ', ') . ')'; - } - elseif (substr($x,0,6) == 'UNIQUE') - { - $schema_create .= ' UNIQUE ' . substr($x,7) . ' (' . implode($columns, ', ') . ')'; - } - else - { - $schema_create .= " KEY $x (" . implode($columns, ', ') . ')'; - } - } - - $schema_create .= "$crlf);"; - - if (get_magic_quotes_runtime()) - { - return(stripslashes($schema_create)); - } - else - { - return($schema_create); - } - -} // End get_table_def_mysql - - -// -// This fuction will return a tables create definition to be used as an sql -// statement. -// -// -// The following functions Get the data from the tables and format it as a -// series of INSERT statements, for each different DBMS... -// After every row a custom callback function $handler gets called. -// $handler must accept one parameter ($sql_insert); -// -// -// Here is the function for postgres... -// -function get_table_content_postgresql($table, $handler) -{ - global $db; - - // Grab all of the data from current table. - $result = $db->sql_query("SELECT * FROM $table"); - - $i_num_fields = $db->sql_numfields($result); - - for ($i = 0; $i < $i_num_fields; $i++) - { - $aryType[] = $db->sql_fieldtype($i, $result); - $aryName[] = $db->sql_fieldname($i, $result); - } - - $iRec = 0; - - while ($row = $db->sql_fetchrow($result)) - { - unset($schema_vals); - unset($schema_fields); - unset($schema_insert); - - // Build the SQL statement to recreate the data. - for($i = 0; $i < $i_num_fields; $i++) - { - $strVal = $row[$aryName[$i]]; - if (preg_match('#char|text|bool#i', $aryType[$i])) - { - $strQuote = "'"; - $strEmpty = ""; - $strVal = addslashes($strVal); - } - elseif (preg_match('#date|timestamp#i', $aryType[$i])) - { - if ($empty($strVal)) - { - $strQuote = ""; - } - else - { - $strQuote = "'"; - } - } - else - { - $strQuote = ""; - $strEmpty = "NULL"; - } - - if (empty($strVal) && $strVal != "0") - { - $strVal = $strEmpty; - } - - $schema_vals .= " $strQuote$strVal$strQuote,"; - $schema_fields .= " $aryName[$i],"; - } - - $schema_vals = preg_replace('#,$#', '', $schema_vals); - $schema_vals = preg_replace('#^ #', '', $schema_vals); - $schema_fields = preg_replace('#,$#', '', $schema_fields); - $schema_fields = preg_replace('#^ #', '', $schema_fields); - - // Take the ordered fields and their associated data and build it - // into a valid sql statement to recreate that field in the data. - $schema_insert = "INSERT INTO $table ($schema_fields) VALUES($schema_vals);"; - - $handler(trim($schema_insert)); - } - - return(true); - -}// end function get_table_content_postgres... - -// -// This function is for getting the data from a mysql table. -// - -function get_table_content_mysql($table, $handler) -{ - global $db; - - // Grab the data from the table. - $result = $db->sql_query("SELECT * FROM $table"); - - // Loop through the resulting rows and build the sql statement. - $schema_insert = ""; - if ($row = $db->sql_fetchrow($result)) - { - $schema_insert = "\n#\n# Table Data for $table\n#\n"; - - $handler($schema_insert); - - do - { - $table_list = '('; - $num_fields = $db->sql_numfields($result); - // - // Grab the list of field names. - // - for ($j = 0; $j < $num_fields; $j++) - { - $table_list .= $db->sql_fieldname($j, $result) . ', '; - } - // - // Get rid of the last comma - // - $table_list = preg_replace('#, $#', '', $table_list); - $table_list .= ')'; - // - // Start building the SQL statement. - // - $schema_insert = "INSERT INTO $table $table_list VALUES("; - // - // Loop through the rows and fill in data for each column - // - for ($j = 0; $j < $num_fields; $j++) - { - if (!isset($row[$j])) - { - // - // If there is no data for the column set it to null. - // There was a problem here with an extra space causing the - // sql file not to reimport if the last column was null in - // any table. Should be fixed now :) JLH - // - $schema_insert .= ' NULL,'; - } - elseif ($row[$j] != '') - { - $schema_insert .= ' \'' . addslashes($row[$j]) . '\','; - } - else - { - $schema_insert .= '\'\','; - } - } - // - // Get rid of the the last comma. - // - $schema_insert = preg_replace('#,$#', '', $schema_insert); - $schema_insert .= ');'; - // - // Go ahead and send the insert statement to the handler function. - // - $handler(trim($schema_insert)); - } - while ($row = $db->sql_fetchrow($result)); - } - - return true; -} - -function output_table_content($content) -{ - global $tempfile; - - //fwrite($tempfile, $content . "\n"); - //$backup_sql .= $content . "\n"; - echo $content ."\n"; - return; -} - - -// -// Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux, Marc Delisle -// http://www.phpmyadmin.net/ -// -// Based on work by Eric Mueller and Denis125 -// Official ZIP file format: http://www.pkware.com/appnote.txt -// -class zipfile -{ - var $datasec = array(); - var $ctrl_dir = array(); - var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; - var $old_offset = 0; - - function unix_to_dos_time($unixtime = 0) - { - $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); - - if ($timearray['year'] < 1980) - { - $timearray['year'] = 1980; - $timearray['mon'] = 1; - $timearray['mday'] = 1; - $timearray['hours'] = 0; - $timearray['minutes'] = 0; - $timearray['seconds'] = 0; - } - - return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | - ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); - } - - function add_file($data, $name, $time = 0) - { - $name = str_replace('\\', '/', $name); - - $dtime = dechex($this->unix_to_dos_time($time)); - $hexdtime = '\x' . $dtime[6] . $dtime[7] - . '\x' . $dtime[4] . $dtime[5] - . '\x' . $dtime[2] . $dtime[3] - . '\x' . $dtime[0] . $dtime[1]; - eval('$hexdtime = "' . $hexdtime . '";'); - - $fr = "\x50\x4b\x03\x04"; - $fr .= "\x14\x00"; // ver needed to extract - $fr .= "\x00\x00"; // gen purpose bit flag - $fr .= "\x08\x00"; // compression method - $fr .= $hexdtime; // last mod time and date - - $unc_len = strlen($data); - $crc = crc32($data); - $zdata = gzcompress($data); - $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug - $c_len = strlen($zdata); - $fr .= pack('V', $crc); // crc32 - $fr .= pack('V', $c_len); // compressed filesize - $fr .= pack('V', $unc_len); // uncompressed filesize - $fr .= pack('v', strlen($name)); // length of filename - $fr .= pack('v', 0); // extra field length - $fr .= $name; - - // "file data" segment - $fr .= $zdata; - - // "data descriptor" segment (optional but necessary if archive is not - // served as file) - $fr .= pack('V', $crc); // crc32 - $fr .= pack('V', $c_len); // compressed filesize - $fr .= pack('V', $unc_len); // uncompressed filesize - - // add this entry to array - $this -> datasec[] = $fr; - $new_offset = strlen(implode('', $this->datasec)); - - // now add to central directory record - $cdrec = "\x50\x4b\x01\x02"; - $cdrec .= "\x00\x00"; // version made by - $cdrec .= "\x14\x00"; // version needed to extract - $cdrec .= "\x00\x00"; // gen purpose bit flag - $cdrec .= "\x08\x00"; // compression method - $cdrec .= $hexdtime; // last mod time & date - $cdrec .= pack('V', $crc); // crc32 - $cdrec .= pack('V', $c_len); // compressed filesize - $cdrec .= pack('V', $unc_len); // uncompressed filesize - $cdrec .= pack('v', strlen($name)); // length of filename - $cdrec .= pack('v', 0); // extra field length - $cdrec .= pack('v', 0); // file comment length - $cdrec .= pack('v', 0); // disk number start - $cdrec .= pack('v', 0); // internal file attributes - $cdrec .= pack('V', 32); // external file attributes - 'archive' bit set - - $cdrec .= pack('V', $this -> old_offset); // relative offset of local header - $this -> old_offset = $new_offset; - - $cdrec .= $name; - - // optional extra field, file comment goes here - // save to central directory - $this -> ctrl_dir[] = $cdrec; - } - - function file() - { - $data = implode('', $this -> datasec); - $ctrldir = implode('', $this -> ctrl_dir); - - return $data . $ctrldir . $this -> eof_ctrl_dir . - pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk" - pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall - pack('V', strlen($ctrldir)) . // size of central dir - pack('V', strlen($data)) . // offset to start of central dir - "\x00\x00"; // .zip file comment length - } -} - -// -// End Functions -// ----------------------------------------------- - -?> \ No newline at end of file diff --git a/phpBB/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 @@ -acl_get('a_names')) - { - return; - } - - $module['USER']['DISALLOW'] = basename(__FILE__) . $SID; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Check permissions -if (!$auth->acl_get('a_names')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -if (isset($_POST['disallow'])) -{ - $disallowed_user = (isset($_REQUEST['disallowed_user'])) ? $_REQUEST['disallowed_user'] : ''; - $disallowed_user = str_replace('*', '%', $disallowed_user); - - if (validate_username($disallowed_user)) - { - $message = $user->lang['Disallowed_already']; - } - else - { - $sql = "INSERT INTO " . DISALLOW_TABLE . " (disallow_username) - VALUES('" . str_replace("\'", "''", $disallowed_user) . "')"; - $result = $db->sql_query($sql); - - $message = $user->lang['Disallow_successful']; - } - - add_log('admin', 'log_disallow_add', str_replace('%', '*', $disallowed_user)); - - trigger_error($message); -} -else if (isset($_POST['allow'])) -{ - $disallowed_id = (isset($_REQUEST['disallowed_id'])) ? intval($_REQUEST['disallowed_id']) : ''; - - if (empty($disallowed_id)) - { - trigger_error($user->lang['No_user_selected']); - } - - $sql = "DELETE FROM " . DISALLOW_TABLE . " - WHERE disallow_id = $disallowed_id"; - $db->sql_query($sql); - - add_log('admin', 'log_disallow_delete'); - - trigger_error($user->lang['Disallowed_deleted']); -} - -// Grab the current list of disallowed usernames... -$sql = "SELECT * - FROM " . DISALLOW_TABLE; -$result = $db->sql_query($sql); - -$disallow_select = ''; -if ($row = $db->sql_fetchrow($result)) -{ - do - { - $disallow_select .= ''; - } - while ($row = $db->sql_fetchrow($result)); -} - -// Output page -page_header($user->lang['DISALLOW']); - -?> - -lang['Disallow_explain']; ?>
- - - - \ 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 @@ -acl_get('a_email')) - { - return; - } - - $module['GENERAL']['MASS_EMAIL'] = basename(__FILE__) . $SID; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Check permissions -if (!$auth->acl_get('a_email')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// -// Set some vars -// -$message = ''; -$subject = ''; - -// -// Do the job ... -// -if (isset($_POST['submit'])) -{ - // - // Increase maximum execution time in case of a lot of users, but don't complain about it if it isn't - // allowed. - // - @set_time_limit(1200); - - $group_id = intval($_POST['g']); - - $sql = ($group_id != -1) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE; - $result = $db->sql_query($sql); - - if (!($email_list = $db->sql_fetchrowset($g_result))) - { - // - // Output a relevant GENERAL_MESSAGE about users/group - // not existing - // - } - - $subject = stripslashes($_POST['subject']); - $message = stripslashes($_POST['message']); - - // - // Error checking needs to go here ... if no subject and/or - // no message then skip over the send and return to the form - // - $error = FALSE; - - if (!$error) - { - include($phpbb_root_path . 'includes/emailer.'.$phpEx); - // - // Let's do some checking to make sure that mass mail functions - // are working in win32 versions of php. - // - if (preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$config['smtp_delivery']) - { - // We are running on windows, force delivery to use - // our smtp functions since php's are broken by default - $config['smtp_delivery'] = 1; - $config['smtp_host'] = get_cfg_var('SMTP'); - } - $emailer = new emailer($config['smtp_delivery']); - - $email_headers = 'From: ' . $config['board_email'] . "\n"; - - $bcc_list = ''; - for($i = 0; $i < count($email_list); $i++) - { - $bcc_list .= (($bcc_list != '') ? ', ' : '') . $email_list[$i]['user_email']; - } - $email_headers .= "Bcc: $bcc_list\n"; - - $email_headers .= 'Return-Path: ' . $userdata['board_email'] . "\n"; - $email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\n"; - $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n"; - $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n"; - $email_headers .= 'X-AntiAbuse: User IP - ' . $user_ip . "\n"; - - $emailer->use_template('admin_send_email'); - $emailer->email_address($config['board_email']); - $emailer->set_subject($subject); - $emailer->extra_headers($email_headers); - - $emailer->assign_vars(array( - 'SITENAME' => $config['sitename'], - 'BOARD_EMAIL' => $config['board_email'], - 'MESSAGE' => $message) - ); - - $emailer->send(); - $emailer->reset(); - - message_die(MESSAGE, $user->lang['Email_sent']); - } -} - -// -// Initial selection -// - -$sql = "SELECT group_id, group_name - FROM ".GROUPS_TABLE; -$result = $db->sql_query($sql); - -$select_list = ''; - -page_header($user->lang['Mass_Email']); - -?> - -lang['Mass_email_explain']; ?>
- - - - \ 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 @@ -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'] . "lang['Forum_edit_delete_explain'] ?>
- - - -lang['Forum_delete_explain'] ?>
- - -Forum Index'; - - $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 .= ' -> ' . htmlspecialchars($row['forum_name']) . ''; - } - } -} - -// Jumpbox -$forum_box = make_forum_select($forum_id); - -// Front end -page_header($user->lang['MANAGE']); - -?> - -lang['Forum_admin_explain']; ?>
- - - - - -sql_query($sql); - - if (!$row = $db->sql_fetchrow($result)) - { - trigger_error("Forum #$forum_id does not exist", E_USER_ERROR); - } - - return $row; -} - -function make_forums_list($mode = 'all', $selected_id = 0, $exclude_id = array()) -{ - global $db; - - if (!is_array($exclude_id)) - { - $exclude_id = array($exclude_id); - } - - $sql = 'SELECT f2.* - FROM ' . FORUMS_TABLE . ' f1, ' . FORUMS_TABLE . ' f2 - WHERE f1.parent_id = 0 - AND f2.left_id BETWEEN f1.left_id AND f1.right_id - ORDER BY f2.left_id'; - $result = $db->sql_query($sql); - - $list = ''; - $indent = array(); - $current_indent = 0; - - while ($row = $db->sql_fetchrow($result)) - { - if ($row['parent_id'] == 0) - { - $current_indent = 0; - } - elseif (!isset($indent[$row['parent_id']])) - { - ++$current_indent; - $indent[$row['parent_id']] = $current_indent; - } - else - { - $current_indent = $indent[$row['parent_id']]; - } - - if (($mode == 'forums' && !$row['forum_postable']) - || ($mode == 'categories' && $row['forum_postable']) - || (in_array($row['forum_id'], $exclude_id))) - { - continue; - } - - if ($mode == 'all' && !$row['parent_id']) - { - $list .= "\n"; - } - - $list .= '\n"; - } - - return $list; -} - -function make_styles_list($selected_id = 0) -{ - global $db; - - $list = ''; - $result = $db->sql_query('SELECT style_id, style_name FROM ' . STYLES_TABLE . ' ORDER BY style_name'); - - while ($row = $db->sql_fetchrow($result)) - { - $list .= '\n"; - } - return $list; -} - -function move_forum($from_id, $to_id) -{ - global $db; - - $moved_forums = get_forum_branch($from_id, 'children', 'descending'); - $from_data = $moved_forums[0]; - $diff = count($moved_forums) * 2; - - $moved_ids = array(); - for ($i = 0; $i < count($moved_forums); ++$i) - { - $moved_ids[] = $moved_forums[$i]['forum_id']; - } - - // Resync parents - $sql = 'UPDATE ' . FORUMS_TABLE . " - SET right_id = right_id - $diff, forum_parents = '' - WHERE left_id < " . $from_data['right_id'] . " AND right_id > " . $from_data['right_id']; - $db->sql_query($sql); - - // Resync righthand side of tree - $sql = 'UPDATE ' . FORUMS_TABLE . " - SET left_id = left_id - $diff, right_id = right_id - $diff, forum_parents = '' - WHERE left_id > " . $from_data['right_id']; - $db->sql_query($sql); - - if ($to_id > 0) - { - $to_data = get_forum_info($to_id); - - // Resync new parents - $sql = 'UPDATE ' . FORUMS_TABLE . " - SET right_id = right_id + $diff, forum_parents = '' - WHERE " . $to_data['right_id'] . ' BETWEEN left_id AND right_id - AND forum_id NOT IN (' . implode(', ', $moved_ids) . ')'; - $db->sql_query($sql); - - // Resync the righthand side of the tree - $sql = 'UPDATE ' . FORUMS_TABLE . " - SET left_id = left_id + $diff, right_id = right_id + $diff, forum_parents = '' - WHERE left_id > " . $to_data['right_id'] . ' - AND forum_id NOT IN (' . implode(', ', $moved_ids) . ')'; - $db->sql_query($sql); - - // Resync moved branch - $to_data['right_id'] += $diff; - if ($to_data['right_id'] > $from_data['right_id']) - { - $diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1); - } - else - { - $diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1); - } - } - else - { - $result = $db->sql_query('SELECT MAX(right_id) AS right_id FROM ' . FORUMS_TABLE . ' WHERE forum_id NOT IN (' . implode(', ', $moved_ids) . ')'); - $right_id = $db->sql_fetchfield('right_id', 0, $result); - - $diff = '+ ' . ($right_id - $from_data['left_id'] + 1); - } - - $sql = 'UPDATE ' . FORUMS_TABLE . " - SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = '' - WHERE forum_id IN (" . implode(', ', $moved_ids) . ')'; - $db->sql_query($sql); -} - -function move_forum_content($from_id, $to_id) -{ - global $db; - - $db->sql_query('UPDATE ' . ACL_GROUPS_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); - $db->sql_query('UPDATE ' . MODERATOR_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); - $db->sql_query('UPDATE ' . LOG_MOD_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); - $db->sql_query('UPDATE ' . POSTS_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); - $db->sql_query('UPDATE ' . TOPICS_TABLE . " SET forum_id = $to_id WHERE forum_id = $from_id"); - - // - // TODO: untested yet - // - $sql = 'SELECT t1.topic_id - FROM ' .TOPICS_TABLE . ' t1 - LEFT JOIN ' . TOPICS_TABLE . " t2 ON t1.topic_moved_id = t2.topic_id AND t1.forum_id = t2.forum_id - WHERE t1.forum_id = $to_id"; - $result = $db->sql_query($result); - - $topic_ids = array(); - while ($row = $db->sql_fetchrow($result)) - { - $topic_ids[] = $row['topic_id']; - } - if (count($topic_ids)) - { - $db->sql_query('DELETE FROM ' . TOPICS_TABLE . ' WHERE topic_id IN (' . implode(', ', $topic_ids) . ')'); - } - sync('forum', $to_id); - - // - // TODO: there might be conflicts in ACL tables =\ - // make sure that the query that retrieves shadow topics uses the correct index (topic_type or topic_moved_id) - // -} - -function delete_forum_content($forum_id) -{ - global $db; - - $db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . " WHERE forum_id = $forum_id"); - $db->sql_query('DELETE FROM ' . MODERATOR_TABLE . " WHERE forum_id = $forum_id"); - $db->sql_query('DELETE FROM ' . LOG_MOD_TABLE . " WHERE forum_id = $forum_id"); - $db->sql_query('DELETE FROM ' . FORUMS_WATCH_TABLE . " WHERE forum_id = $forum_id"); - - $ids = array(); - $result = $db->sql_query('SELECT post_id FROM ' . POSTS_TABLE . " WHERE forum_id = $forum_id"); - - while ($row = $db->sql_fetchrow($result)) - { - $ids[] = $row['post_id']; - } - $ids = implode(',', $ids); - $db->sql_freeresult(); - - if ($ids) - { - $db->sql_query('DELETE FROM ' . SEARCH_MATCH_TABLE . " WHERE post_id IN ($ids)"); - $db->sql_query('DELETE FROM ' . POSTS_TABLE . " WHERE forum_id = $forum_id"); - $db->sql_query('DELETE FROM ' . POSTS_TEXT_TABLE . " WHERE post_id IN ($ids)"); - } - - $ids = array(); - $result = $db->sql_query('SELECT topic_id FROM ' . TOPICS_TABLE . " WHERE forum_id = $forum_id"); - - while ($row = $db->sql_fetchrow($result)) - { - $ids[] = $row['topic_id']; - } - $ids = implode(',', $ids); - $db->sql_freeresult(); - - if ($ids) - { - $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . " WHERE topic_id IN ($ids)"); - $db->sql_query('DELETE FROM ' . TOPICS_TABLE . " WHERE forum_id = $forum_id"); - $db->sql_query('DELETE FROM ' . TOPICS_TABLE . " WHERE topic_moved_id IN ($ids)"); - } - - // - // TODO: delete attachments - // delete polls - // OPTIMIZE / VACUUM table ? - // -} - -// -// End function block -// ------------------ - -?> \ No newline at end of file diff --git a/phpBB/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 @@ -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 != '') ? 'lang['GROUP_EDIT_EXPLAIN']; ?>
- -sql_query($sql); - - $rank_options = ''; - if ($row = $db->sql_fetchrow($result)) - { - do - { - $selected = (!empty($group_rank) && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; - $rank_options .= ''; - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - - $type_open = ($group_type == GROUP_OPEN) ? ' checked="checked"' : ''; - $type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : ''; - $type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : ''; - $type_free = ($group_type == GROUP_FREE) ? ' checked="checked"' : ''; - -?> - - - - - - -lang['GROUP_SETTINGS_EXPLAIN']; ?>
- - - -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); - -?> - -lang['GROUP_MEMBERS_EXPLAIN']; ?>
- - -lang['GROUP_MODS_EXPLAIN']; ?>
- - - -sql_query($sql); - - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - $total_members = $row['total_members']; - - $sql = "SELECT u.user_id, u.username, u.user_regdate, u.user_posts - FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug - WHERE ug.group_id = $group_id - AND ug.user_pending = 1 - AND u.user_id = ug.user_id - ORDER BY u.username - LIMIT $start_pend, " . $config['topics_per_page']; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result) ) - { - -?> -lang['GROUP_PENDING_EXPLAIN']; ?>
- - - -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) ) - { - -?> -lang['GROUP_LIST_EXPLAIN']; ?>
- - - - -sql_freeresult($result); - - break; - - default: - - // Default mangement page - -?> - -lang['GROUP_MANAGE_EXPLAIN']; ?>
- -lang['USER_DEF_GROUPS_EXPLAIN']; ?>
- - - - - - - - \ 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 @@ -acl_get('a_icons')) - { - return; - } - - $filename = basename(__FILE__); - $module['POST']['SMILE'] = $filename . $SID . '&mode=emoticons'; - $module['POST']['ICONS'] = $filename . $SID . '&mode=icons'; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Do we have general permissions? -if (!$auth->acl_get('a_icons')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Grab some basic parameters -$mode = (!empty($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; -$action = (!empty($_REQUEST['action'])) ? $_REQUEST['action'] : ((isset($_POST['add'])) ? 'add' : ''); -$id = (isset($_GET['id'])) ? intval($_GET['id']) : false; - -// What are we working on? -switch ($mode) -{ - case 'emoticons': - $table = SMILIES_TABLE; - $lang = 'SMILE'; - $fields = 'smile'; - $img_path = $config['smilies_path']; - break; - - case 'icons': - $table = ICONS_TABLE; - $lang = 'ICONS'; - $fields = 'icons'; - $img_path = $config['icons_path']; - break; -} - -// Clear some arrays -$_images = $_paks = array(); - - - -// Grab file list of paks and images -if ($action == 'edit' || $action == 'add' || $action == 'import') -{ - $dir = @opendir($phpbb_root_path . $img_path); - while ($file = @readdir($dir)) - { - if (is_file($phpbb_root_path . $img_path . '/' . $file)) - { - $img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $file); - - if (preg_match('#\.(gif|png|jpg)$#i', $file) || (!empty($img_size[0]) && !empty($img_size[1]))) - { - $_images[] = $file; - } - elseif (preg_match('#\.pak$#i', $file)) - { - $_paks[] = $file; - } - } - } - @closedir($dir); -} - - -// What shall we do today? Oops, I believe that's trademarked ... -switch ($action) -{ - case 'delete': - - $db->sql_query('DELETE FROM ' . $table . ' - WHERE ' . $fields . '_id = ' . intval($_GET['id'])); - - switch ($mode) - { - case 'emoticons': - break; - - case 'icons': - // Reset appropriate icon_ids - $db->sql_query('UPDATE ' . TOPICS_TABLE . ' - SET icon_id = 0 - WHERE icon_id = ' . intval($_GET['id'])); - $db->sql_query('UPDATE ' . POSTS_TABLE . ' - SET icon_id = 0 - WHERE icon_id = ' . intval($_GET['id'])); - break; - } - - trigger_error($user->lang[$lang . '_DELETED']); - break; - - case 'edit': - case 'add': - - $order_list = ''; - $existing_imgs = array(); - $result = $db->sql_query('SELECT * - FROM ' . $table . ' - ORDER BY ' . $fields . '_order DESC'); - if ($row = $db->sql_fetchrow($result)) - { - do - { - $existing_imgs[] = $row[$fields . '_url']; - - if ($row[$fields . '_id'] == $id) - { - $after = TRUE; - $data = $row; - } - else - { - $selected = ''; - if (!empty($after)) - { - $selected = ' selected="selected"'; - $after = FALSE; - } - - $after_txt = ($mode == 'emoticons') ? $row['code'] : $row['icons_url']; - $order_list = '' . $order_list; - } - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - - $order_list = '' . $order_list; - - $imglist = filelist($phpbb_root_path . $img_path, ''); - - $filename_list = ''; - foreach ($imglist as $img) - { - $img = substr($img['path'], 1) . (($img['path'] != '') ? '/' : '') . $img['file']; - - if (!in_array($img, $existing_imgs) || $action == 'edit') - { - if ((isset($data) && $img == $data[$fields . '_url']) || - (!isset($data) && !isset($edit_img))) - { - $selected = ' selected="selected"'; - $edit_img = $img; - } - else - { - $selected = ''; - } - - $filename_list .= ''; - } - } - unset($existing_imgs); - unset($imglist); - - page_header($user->lang[$lang]); - -?> - -lang[$lang .'_EXPLAIN']; ?>
- - - - - $img, - $fields . '_width' => $image_width, - $fields . '_height' => $image_height, - $fields . '_order' => $image_order, - 'display_on_posting'=> (!empty($_POST['display_on_posting'])) ? 1 : 0 - ); - if ($mode == 'emoticons') - { - $img_sql = array_merge($sql, array( - 'emoticon' => stripslashes($_POST['emotion']), - 'code' => htmlspecialchars(stripslashes($_POST['code'])) - )); - } - - if ($action == 'modify') - { - $result = $db->sql_query('SELECT ' . $fields . '_order - FROM ' . $table . ' - WHERE ' . $fields . "_id = $image_id"); - $order_old = $db->sql_fetchfield($fields . '_order', 0, $result); - - if ($order_old == $smile_order) - { - $no_update = TRUE; - } - - if ($order_old > $smile_order) - { - $sign = '+'; - $where = $fields . "_order >= $image_order AND " . $fields . "_order < $order_old"; - } - else - { - $sign = '-'; - $where = $fields . "_order > $order_old AND " . $fields . "_order < $image_order"; - $sql[$fields . '_order'] = $smile_order - 1; - } - } - else - { - $sign = '+'; - $where = $fields . "_order > $image_order"; - } - - if (empty($no_update)) - { - $sql = 'UPDATE ' . $table . ' - SET ' . $fields . '_order = ' . $fields . "_order $sign 1 - WHERE $where"; - $db->sql_query($sql); - } - - if ($action == 'modify') - { - $db->sql_query('UPDATE ' . $table . ' - SET ' . $db->sql_build_array('UPDATE', $img_sql) . " - WHERE " . $fields . "_id = $image_id"); - $cache->destroy('icons'); - - trigger_error($user->lang[$lang . '_EDITED']); - } - else - { - $db->sql_query('INSERT INTO ' . $table . ' ' . $db->sql_build_array('INSERT', $img_sql)); - $cache->destroy('icons'); - - trigger_error($user->lang[$lang . '_ADDED']); - } - break; - - case 'import': - - if (!empty($_POST['pak'])) - { - $order = 0; - - // The user has already selected a smilies_pak file - if ($_POST['current'] == 'delete') - { - $db->sql_query('TRUNCATE ' . $table); - - switch ($mode) - { - case 'emoticons': - break; - - case 'icons': - // Reset all icon_ids - $db->sql_query('UPDATE ' . TOPICS_TABLE . ' - SET icon_id = 0'); - $db->sql_query('UPDATE ' . POSTS_TABLE . ' - SET icon_id = 0'); - break; - } - } - else - { - $cur_img = array(); - - $field_sql = ($mode == 'emoticons') ? 'code' : 'icons_url'; - $result = $db->sql_query('SELECT ' . $field_sql . ' - FROM ' . $table); - if ($row = $db->sql_fetchrow($result)) - { - do - { - ++$order; - $cur_img[$row[$field_sql]] = 1; - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - } - - if (!($pak_ary = @file($phpbb_root_path . $img_path . '/'. stripslashes($_POST['pak'])))) - { - trigger_error('Could not read smiley pak file', E_USER_ERROR); - } - - foreach ($pak_ary as $pak_entry) - { - $data = array(); - if (preg_match_all("#'(.*?)', #", $pak_entry, $data)) - { - if ((sizeof($data[1]) == 5 && $mode == 'icons') || - (sizeof($data[1]) != 5 && $mode == 'emoticons')) - { - trigger_error($user->lang['WRONG_PAK_TYPE']); - } - - $img = stripslashes($data[1][0]); - $width = stripslashes($data[1][1]); - $height = stripslashes($data[1][2]); - if (isset($data[1][3]) && isset($data[1][4])) - { - $emotion = stripslashes($data[1][3]); - $code = htmlentities(stripslashes($data[1][4])); - } - - if ($_POST['current'] == 'replace' && - (($mode == 'emoticons' && !empty($cur_img[$code])) || - ($mode == 'icons' && !empty($cur_img[$img])))) - { - $replace_sql = ($mode == 'emoticons') ? $code : $img; - $sql = array( - $fields . '_url' => $img, - $fields . '_height' => intval($height), - $fields . '_width' => intval($width), - ); - if ($mode == 'emoticons') - { - $sql = array_merge($sql, array( - 'emoticon' => $emotion - )); - } - - $db->sql_query("UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . " - WHERE $field_sql = '" . $db->sql_escape($replace_sql) . "'"); - } - else - { - ++$order; - - $sql = array( - $fields . '_url' => $img, - $fields . '_height' => intval($height), - $fields . '_width' => intval($width), - $fields . '_order' => intval($order), - ); - if ($mode == 'emoticons') - { - $sql = array_merge($sql, array( - 'code' => $code, - 'emoticon' => $emotion - )); - } - $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql)); - } - - } - } - - $cache->destroy('icons'); - - trigger_error($user->lang[$lang . '_IMPORT_SUCCESS']); - } - else - { - $paklist = filelist($phpbb_root_path . $img_path, '', 'pak'); - - $pak_options = ''; - if (count($paklist)) - { - foreach ($paklist as $pak) - { - $pak = substr($pak['path'], 1) . (($pak['path'] != '') ? '/' : '') . $pak['file']; - - $pak_options .= ''; - } - } - - page_header($user->lang[$lang]); - -?> -lang[$lang .'_EXPLAIN'] ?>
- - -lang['EXPORT_' . $lang]); - trigger_error(sprintf($user->lang['EXPORT_' . $lang . '_EXPLAIN'], '', '')); - break; - - case 'send': - - $result = $db->sql_query('SELECT * - FROM ' . $table . " - ORDER BY {$fields}_order"); - if ($row = $db->sql_fetchrow($result)) - { - do - { - $pak .= "'" . addslashes($row[$fields . '_url']) . "', "; - $pak .= "'" . addslashes($row[$fields . '_height']) . "', "; - $pak .= "'" . addslashes($row[$fields . '_width']) . "', "; - if ($mode == 'emoticons') - { - $pak .= "'" . addslashes($row['emoticon']) . "', "; - $pak .= "'" . addslashes($row['code']) . "', "; - } - $pak .= "\n"; - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - - if ($pak != '') - { - $db->sql_close(); - - header('Content-Type: text/x-delimtext; name="' . $fields . '.pak"'); - header('Content-disposition: attachment; filename=' . $fields . '.pak"'); - echo $pak; - exit; - } - else - { - trigger_error($user->lang['NO_' . $fields . '_EXPORT']); - } - break; - - case 'move_up': - case 'move_down': - $image_order = intval($_GET['order']); - $order_total = $image_order * 2 + (($action == 'move_up') ? -1 : 1); - - $sql = 'UPDATE ' . $table . ' - SET ' . $fields . "_order = $order_total - " . $fields . '_order - WHERE ' . $fields . "_order IN ($image_order, " . (($action == 'move_up') ? $image_order - 1 : $image_order + 1) . ')'; - $db->sql_query($sql); - - $cache->destroy('icons'); - - // No break; here, display the smilies admin back - - default: - - // By default, check that smile_order is valid and fix it if necessary - $result = $db->sql_query('SELECT * FROM ' . $table . ' ORDER BY ' . $fields . '_order'); - if ($row = $db->sql_fetchrow($result)) - { - $order = 0; - do - { - ++$order; - if ($row[$fields . '_order'] != $order) - { - $db->sql_query('UPDATE ' . $table . ' - SET ' . $fields . '_order = ' . $order . ' - WHERE ' . $fields . '_id = ' . $row[$fields . '_id']); - } - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - - // Output the page - page_header($user->lang[$lang]); - -?> - -lang[$lang .'_EXPLAIN']; ?>
- - - - $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 @@ -acl_get('a_auth')) ? $filename . $SID . '&mode=forums' : ''; - $module['FORUM']['MODERATORS'] = ($auth->acl_get('a_authmods')) ? $filename . $SID . '&mode=moderators' : ''; - $module['FORUM']['SUPER_MODERATORS'] = ($auth->acl_get('a_authmods')) ? $filename . $SID . '&mode=supermoderators' : ''; - $module['GENERAL']['ADMINISTRATORS'] = ($auth->acl_get('a_authadmins')) ? $filename . $SID . '&mode=administrators' : ''; - $module['USER']['PERMISSIONS'] = ($auth->acl_get('a_authusers')) ? $filename . $SID . '&mode=users' : ''; - $module['GROUP']['PERMISSIONS'] = ($auth->acl_get('a_authgroups')) ? $filename . $SID . '&mode=groups' : ''; - - return; -} - -define('IN_PHPBB', 1); - -// Include files -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Define some vars -$forum_id = 0; -$forum_sql = ''; -if (isset($_REQUEST['f'])) -{ - $forum_id = intval($_REQUEST['f']); - $forum_sql = " WHERE forum_id = $forum_id"; -} - -$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; -$username = (isset($_REQUEST['username'])) ? $_REQUEST['username'] : ''; -$group_id = (isset($_REQUEST['g'])) ? intval($_REQUEST['g']) : ''; -$entries = (isset($_POST['entries'])) ? $_POST['entries'] : ''; - - - -// Start program proper -switch ($mode) -{ - case 'forums': - $l_title = $user->lang['PERMISSIONS']; - $l_title_explain = $user->lang['PERMISSIONS_EXPLAIN']; - $which_acl = 'a_auth'; - $type_sql = 'f'; - break; - - case 'moderators': - $l_title = $user->lang['MODERATORS']; - $l_title_explain = $user->lang['MODERATORS_EXPLAIN']; - $which_acl = 'a_authmods'; - $type_sql = 'm'; - break; - - case 'supermoderators': - $l_title = $user->lang['SUPER_MODERATORS']; - $l_title_explain = $user->lang['SUPER_MODERATORS_EXPLAIN']; - $which_acl = 'a_authmods'; - $type_sql = 'm'; - break; - - case 'administrators': - $l_title = $user->lang['ADMINISTRATORS']; - $l_title_explain = $user->lang['ADMINISTRATORS_EXPLAIN']; - $which_acl = 'a_authadmins'; - $type_sql = 'a'; - break; - - case 'users': - $l_title = $user->lang['USER_PERMISSIONS']; - $l_title_explain = $user->lang['USER_PERMISSIONS_EXPLAIN']; - $which_acl = 'a_authusers'; - $type_sql = 'u'; - break; - - case 'groups': - $l_title = $user->lang['GROUP_PERMISSIONS']; - $l_title_explain = $user->lang['GROUP_PERMISSIONS_EXPLAIN']; - $which_acl = 'a_authgroups'; - $type_sql = 'u'; - break; - -} - -// Permission check -if (!$auth->acl_get($which_acl)) -{ - trigger_error($user->lang['NO_ADMIN']); -} - - - - -// Call update or delete, both can take multiple user/group -// ids. Additionally inheritance is handled (by the auth API) -switch ($_POST['runas']) -{ - case 'now': - if (isset($_POST['update'])) - { - $auth_admin = new auth_admin(); - - // Admin wants subforums to inherit permissions ... so handle this - if (!empty($_POST['inherit'])) - { - array_push($_POST['inherit'], $forum_id); - $forum_id = $_POST['inherit']; - } - - foreach ($_POST['entries'] as $id) - { - $auth_admin->acl_set($_POST['type'], $forum_id, $id, $_POST['option']); - } - - cache_moderators(); - - trigger_error('Permissions updated successfully'); - } - else if (isset($_POST['delete'])) - { - $auth_admin = new auth_admin(); - - $option_ids = false; - if (!empty($_POST['option'])) - { - $sql = "SELECT auth_option_id - FROM " . ACL_OPTIONS_TABLE . " - WHERE auth_value LIKE '" . $_POST['option'] . "_%'"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $option_ids = array(); - do - { - $option_ids[] = $row['auth_option_id']; - } - while($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - } - - foreach ($_POST['entries'] as $id) - { - $auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids); - } - - cache_moderators(); - - trigger_error('Permissions updated successfully'); - } - else if (isset($_POST['presetsave'])) - { - $holding_ary = array(); - foreach ($_POST['option'] as $acl_option => $allow_deny) - { - switch ($allow_deny) - { - case ACL_ALLOW: - $holding_ary['allow'][] = $acl_option; - break; - case ACL_DENY: - $holding_ary['deny'][] = $acl_option; - break; - case ACL_INHERIT: - $holding_ary['inherit'][] = $acl_option; - break; - } - } - - $sql = array( - 'preset_user_id' => $user->data['user_id'], - 'preset_type' => $type_sql, - 'preset_data' => $db->sql_escape(serialize($holding_ary)) - ); - - if (!empty($_POST['presetname'])) - { - $sql['preset_name'] = $db->sql_escape($_POST['presetname']); - } - - if (!empty($_POST['presetname']) || $_POST['presetoption'] != -1) - { - $sql = ($_POST['presetoption'] == -1) ? 'INSERT INTO ' . ACL_PRESETS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql) : 'UPDATE ' . ACL_PRESETS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . ' WHERE preset_id =' . $_POST['presetoption']; - $db->sql_query($sql); - } - } - else if (isset($_POST['presetdel'])) - { - if (!empty($_POST['presetoption'])) - { - $sql = "DELETE FROM " . ACL_PRESETS_TABLE . " - WHERE preset_id = " . intval($_POST['presetoption']); - $db->sql_query($sql); - } - } - break; - - case 'evt': - if (isset($_POST['submit'])) - { - // user_ids are returned in user_id_ary, a simple array - $evt_code = "\$auth_admin = new auth_admin(); if (!empty(\$evt_inherit)){ array_push(\$evt_inherit, intval(\$evt_f)); } foreach (\$user_id_ary as \$id) { \$auth_admin->acl_set('user', \$evt_inherit, intval(\$id), \$evt_option); } cache_moderators();"; - - // event_code, type (user or group), id's (of users/groups), ... other data ... - event_create($evt_code, $_POST['type'], $_POST['entries'], array('mode' => $_POST['mode']), array('f' => $_POST['forum_id']), array('entries' => $_POST['entries']), array('inherit' => $_POST['inherit']), array('type' => $_POST['type']), array('option' => $_POST['option'])); - } - - // form submit page, ... associative data ... - event_define('admin_permissions', array('mode' => $mode), array('forum_id' => $forum_id), array('inherit' => $_POST['inherit']), array('entries' => $_POST['entries']), array('type' => $_POST['type']), array('option' => $_POST['option'])); - break; - - case 'crn': - break; -} - - - - - - - - - -// Get required information, either all forums if no id was -// specified or just the requsted if it was -if (!empty($forum_id) || !empty($group_id) || !empty($username) || - $mode == 'administrators' || $mode == 'supermoderators') -{ - // Clear some vars, grab some info if relevant ... - $s_hidden_fields = ''; - - - if (!empty($forum_id)) - { - $sql = "SELECT forum_name, parent_id - FROM " . FORUMS_TABLE . " - WHERE forum_id = $forum_id"; - $result = $db->sql_query($sql); - - $forum_info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $l_title .= ' : ' . $forum_info['forum_name'] . ''; - } - else if (!empty($username)) - { - $sql = "SELECT user_id - FROM " . USERS_TABLE . " - WHERE username IN ('$username')"; - $result = $db->sql_query($sql); - - if (!($row = $db->sql_fetchrow($result))) - { - trigger_error($user->lang['No_such_user']); - } - $db->sql_freeresult($result); - - $entries = array($row['user_id']); - $l_title .= ' : ' . $username . ''; - } - else if (!empty($group_id)) - { - $sql = "SELECT group_name - FROM " . GROUPS_TABLE . " - WHERE group_id IN ($group_id)"; - $result = $db->sql_query($sql); - - if (!($row = $db->sql_fetchrow($result))) - { - trigger_error($user->lang['No_such_group']); - } - $db->sql_freeresult($result); - - $entries = array($group_id); - $l_title .= ' : ' . $row['group_name'] . ''; - } - - - - - // Generate header - page_header($l_title); - -?> - - - - 1' : ''; - - $sql = "SELECT auth_option_id, auth_value - FROM " . ACL_OPTIONS_TABLE . " - WHERE auth_value LIKE '" . $type_sql . "_%' - AND auth_value <> '" . $type_sql . "_' - $founder_sql"; - $result = $db->sql_query($sql); - - $auth_options = array(); - while ($row = $db->sql_fetchrow($result)) - { - $auth_options[] = $row; - } - $db->sql_freeresult($result); - - if ($_POST['type'] == 'user' && !empty($_POST['new'])) - { - $entries = explode("\n", $entries); - } - - $where_sql = ''; - foreach ($entries as $value) - { - $where_sql .= (($where_sql != '') ? ', ' : '') . (($_POST['type'] == 'user' && !empty($_POST['new'])) ? '\'' . $value . '\'' : intval($value)); - } - - - - - $ug = '';; - $ug_hidden = ''; - $auth_values = array(); - - switch ($_POST['type']) - { - case 'group': - $l_type = 'Group'; - - $sql = "SELECT g.group_id AS id, g.group_name AS name, o.auth_value, a.auth_allow_deny FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id $forum_sql AND g.group_id = a.group_id AND g.group_id IN ($where_sql) ORDER BY g.group_name ASC"; - break; - - case 'user': - $l_type = 'User'; - - $sql = "SELECT u.user_id AS id, u.username AS name, u.user_founder, o.auth_value, a.auth_allow_deny FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND u.user_id IN ($where_sql) ORDER BY u.username, u.user_regdate ASC"; break; - } - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - do - { - $ug_test = (!empty($user->lang[$row['name']])) ? $user->lang[$row['name']] : $row['name']; - $ug .= (!strstr($ug, $ug_test)) ? $ug_test . "\n" : ''; - - $ug_test = ''; - $ug_hidden .= (!strstr($ug_hidden, $ug_test)) ? $ug_test : ''; - - $auth_values[$row['auth_value']] = (isset($auth_group[$row['auth_value']])) ? min($auth_group[$row['auth_value']], $row['auth_allow_deny']) : $row['auth_allow_deny']; - } - while ($row = $db->sql_fetchrow($result)); - } - else - { - $db->sql_freeresult($result); - - $sql = ($_POST['type'] == 'group') ? "SELECT group_id AS id, group_name AS name, group_type FROM " . GROUPS_TABLE . " WHERE group_id IN ($where_sql) ORDER BY group_name ASC" : "SELECT user_id AS id, username AS name, user_founder FROM " . USERS_TABLE . " WHERE username IN ($where_sql) ORDER BY username, user_regdate ASC"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - - do - { - $ug_test = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang[$row['name']] : $row['name']; - $ug .= (!strstr($ug, $ug_test)) ? $ug_test . "\n" : ''; - - $ug_test = ''; - $ug_hidden .= (!strstr($ug_hidden, $ug_test)) ? $ug_test : ''; - - $auth_values[$row['auth_value']] = (isset($auth_group[$row['auth_value']])) ? min($auth_group[$row['auth_value']], $row['auth_allow_deny']) : $row['auth_allow_deny']; - } - while ($row = $db->sql_fetchrow($result)); - } - else - { - } - } - $db->sql_freeresult($result); - - // Now we'll build a list of preset options ... - $preset_options = $preset_js = $preset_update_options = ''; - $holding = array(); - - // Do we have a parent forum? If so offer option - // to inherit from that - if ($forum_info['parent_id'] != 0) - { - switch ($_POST['type']) - { - case 'group': - $sql = "SELECT o.auth_value, a.auth_allow_deny FROM " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id AND a.forum_id = " . $forum_info['parent_id'] . " AND a.group_id IN ($where_sql)"; - break; - - case 'user': - $sql = "SELECT o.auth_value, a.auth_allow_deny FROM " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_value LIKE '" . $type_sql . "_%' AND a.auth_option_id = o.auth_option_id AND a.forum_id = " . $forum_info['parent_id'] . " AND a.user_id IN ($where_sql)"; - break; - } - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - do - { - switch ($row['auth_allow_deny']) - { - case ACL_ALLOW: - $holding['allow'] .= $row['auth_value'] . ', '; - break; - - case ACL_DENY: - $holding['deny'] .= $row['auth_value'] . ', '; - break; - - case ACL_INHERIT: - $holding['inherit'] .= $row['auth_value'] . ', '; - break; - } - } - while ($row = $db->sql_fetchrow($result)); - - $preset_options .= ''; - $preset_js .= "\tpresets['preset_0'] = new Array();" . "\n"; - $preset_js .= "\tpresets['preset_0'] = new preset_obj('" . $holding['allow'] . "', '" . $holding['deny'] . "', '" . $holding['inherit'] . "');\n"; - } - $db->sql_freeresult($result); - } - - // Look for custom presets - $sql = "SELECT preset_id, preset_name, preset_data - FROM " . ACL_PRESETS_TABLE . " - WHERE preset_type = '$type_sql' - ORDER BY preset_id ASC"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - do - { - $preset_update_options .= ''; - $preset_options .= ''; - - $preset_data = unserialize($row['preset_data']); - - foreach ($preset_data as $preset_type => $preset_type_ary) - { - $holding[$preset_type] = ''; - foreach ($preset_type_ary as $preset_option) - { - $holding[$preset_type] .= "$preset_option, "; - } - } - - $preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new Array();" . "\n"; - $preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new preset_obj('" . $holding['allow'] . "', '" . $holding['deny'] . "', '" . $holding['inherit'] . "');\n"; - } - while ($row = $db->sql_fetchrow($result)); - } - unset($holding); - - - -?> - - - -lang['ACL_EXPLAIN']; ?>
- - - - - - - -lang['Users']; ?> |
- lang['Groups']; ?> |
-
- - | - - |
- - | - - |
lang['PRUNE_SUCCESS']; ?>
- -lang['FORUM']; ?> | -lang['TOPICS_PRUNED']; ?> | -lang['POSTS_PRUNED']; ?> | -
---|---|---|
- | - | - |
lang['NO_PRUNE']; ?> | -
lang['FORUM_PRUNE_EXPLAIN']; ?>
- -' . $user->lang['ALL_FORUMS'] . '' . make_forum_select(false, false, false); - -?> - - - -sql_query($sql); - - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $forum_name = ($forum_id == -1) ? $user->lang['ALL_FORUMS'] : $row['forum_name']; - -?> - -lang['PRUNE_USERS_EXPLAIN']; ?>
- -lang['CONFIRM'], $l_message, false); - page_footer(); - - } - else if (isset($_POST['confirm'])) - { - if (!empty($_POST['users'])) - { - $users = explode("\n", urldecode($_POST['users'])); - - $where_sql = ''; - foreach ($users as $username) - { - $where_sql .= (($where_sql != '') ? ', ' : '') . '\'' . trim($username) . '\''; - } - $where_sql = " AND username IN ($where_sql)"; - } - else - { - $username = (!empty($_POST['username'])) ? urldecode($_POST['username']) : ''; - $email = (!empty($_POST['email'])) ? urldecode($_POST['email']) : ''; - - $joined_select = (!empty($_POST['joined_select'])) ? $_POST['joined_select'] : 'lt'; - $active_select = (!empty($_POST['active_select'])) ? $_POST['active_select'] :'lt'; - $count_select = (!empty($_POST['count_select'])) ? $_POST['count_select'] : 'eq'; - $joined = (!empty($_POST['joined'])) ? explode('-', $_POST['joined']) : array(); - $active = (!empty($_POST['active'])) ? explode('-', $_POST['active']) :array(); - $count = (!empty($_POST['count'])) ? intval($_POST['count']) : ''; - - $key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); - $sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit'); - - $where_sql = ''; - $where_sql .= ($username) ? " AND username LIKE '" . str_replace('*', '%', $username) ."'" : ''; - $where_sql .= ($email) ? " AND user_email LIKE '" . str_replace('*', '%', $email) ."' " : ''; - $where_sql .= ($joined) ? " AND user_regdate " . $key_match[$joined_select] . " " . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : ''; - $where_sql .= ($count) ? " AND user_posts " . $key_match[$count_select] . " $count " : ''; - $where_sql .= ($active) ? " AND user_lastvisit " . $key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : ''; - } - - $sql = "SELECT username, user_id FROM " . USERS_TABLE . " - WHERE user_id <> " . ANONYMOUS . " - $where_sql"; - $result = $db->sql_query($sql); - - $where_sql = ''; - $user_ids = array(); - $usernames = array(); - if ($row = $db->sql_fetchrow($result)) - { - do - { - $where_sql .= (($where_sql != '') ? ', ' : '') . $row['user_id']; - $user_ids[] = $row['user_id']; - $usernames[] = $row['username']; - } - while ($row = $db->sql_fetchrow($result)); - - $where_sql = " AND user_id IN ($where_sql)"; - } - $db->sql_freeresult($result); - - if ($where_sql != '') - { - $sql = ''; - if (!empty($_POST['delete'])) - { - if (!empty($_POST['deleteposts'])) - { - $l_admin_log = 'log_prune_user_del_del'; - - // - // Call unified post deletion routine? - // - } - else - { - $l_admin_log = 'log_prune_user_del_anon'; - - for($i = 0; $i < sizeof($user_ids); $i++) - { - $sql = "UPDATE " . POSTS_TABLE . " - SET poster_id = " . ANONYMOUS . ", post_username = '" . $usernames[$i] . "' - WHERE user_id = " . $userids[$i]; -// $db->sql_query($sql); - } - } - - $sql = "DELETE FROM " . USERS_TABLE; - } - else if (!empty($_POST['deactivate'])) - { - $l_admin_log = 'log_prune_user_deac'; - - $sql = "UPDATE " . USERS_TABLE . " SET user_active = 0"; - } - $sql .= " WHERE user_id <> " . ANONYMOUS . " - $where_sql"; -// $db->sql_query($sql); - - add_log('admin', $l_admin_log, implode(', ', $usernames)); - - unset($user_ids); - unset($usernames); - } - - message_die(MESSAGE, $user->lang['Success_user_prune']); - } -} - -// -// -// -$find_count = array('lt' => $user->lang['Less_than'], 'eq' => $user->lang['Equal_to'], 'gt' => $user->lang['More_than']); -$s_find_count = ''; -foreach ($find_count as $key => $value) -{ - $selected = ($key == 'eq') ? ' selected="selected"' : ''; - $s_find_count .= ''; -} - -$find_time = array('lt' => $user->lang['Before'], 'gt' => $user->lang['After']); -$s_find_join_time = ''; -foreach ($find_time as $key => $value) -{ - $s_find_join_time .= ''; -} -$s_find_active_time = ''; -foreach ($find_time as $key => $value) -{ - $s_find_active_time .= ''; -} - -// -// -// -page_header($user->lang['Prune_users']); - -?> - -lang['Prune_users_explain']; ?>
- - - - \ 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 @@ -acl_get('a_ranks')) - { - return; - } - - $module['USER']['RANKS'] = basename(__FILE__) . $SID; - return; -} - -define('IN_PHPBB', 1); -// Let's set the root dir for phpBB -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Do we have permission? -if (!$auth->acl_get('a_ranks')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Check mode -if (isset($_REQUEST['mode'])) -{ - $mode = $_REQUEST['mode']; -} -else -{ - // These could be entered via a form button - if (isset($_POST['add'])) - { - $mode = 'add'; - } - else if (isset($_POST['save'])) - { - $mode = 'save'; - } - else - { - $mode = ''; - } -} - -// Process mode -if ($mode != '') -{ - if ($mode == 'edit' || $mode == 'add') - { - // - // They want to add a new rank, show the form. - // - $rank_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0; - - $s_hidden_fields = ''; - - if ($mode == 'edit') - { - if (empty($rank_id)) - { - trigger_error($user->lang['Must_select_rank']); - } - - $sql = "SELECT * FROM " . RANKS_TABLE . " - WHERE rank_id = $rank_id"; - $result = $db->sql_query($sql); - - $rank_info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $s_hidden_fields .= ''; - - } - else - { - $rank_info['rank_special'] = 0; - } - - page_header($user->lang['RANKS']); - -?> - -lang['RANKS_EXPLAIN']; ?>
- - - -lang['MUST_SELECT_RANK']); - } - - if ($special_rank == 1) - { - $min_posts = -1; - } - - // - // The rank image has to be a jpg, gif or png - // - if ($rank_image != '') - { - if (!preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#is', $rank_image)) - { - $rank_image = ''; - } - } - - if ($rank_id) - { - $sql = "UPDATE " . RANKS_TABLE . " - SET rank_title = '" . $db->sql_escape($rank_title) . "', rank_special = $special_rank, rank_min = $min_posts, rank_image = '" . $db->sql_escape($rank_image) . "' - WHERE rank_id = $rank_id"; - - $message = $user->lang['RANK_UPDATED']; - } - else - { - $sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_special, rank_min, rank_image) - VALUES ('" . $db->sql_escape($rank_title) . "', $special_rank, $min_posts, '" . $db->sql_escape($rank_image) . "')"; - - $message = $user->lang['RANK_ADDED']; - } - $db->sql_query($sql); - - trigger_error($message); - - } - else if ($mode == 'delete') - { - // Ok, they want to delete their rank - $rank_id = (isset($_REQUEST['id'])) ? intval($_REQUEST['id']) : 0; - - if ($rank_id) - { - $sql = "DELETE FROM " . RANKS_TABLE . " - WHERE rank_id = $rank_id"; - $db->sql_query($sql); - - $sql = "UPDATE " . USERS_TABLE . " - SET user_rank = 0 - WHERE user_rank = $rank_id"; - $db->sql_query($sql); - - trigger_error($user->lang['RANK_REMOVED']); - - } - else - { - trigger_error($user->lang['MUST_SELECT_RANK']); - } - } -} - -page_header($user->lang['RANKS']); - -?> - -lang['RANKS_EXPLAIN']; ?>
- - - - \ 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 @@ -acl_get('a_search')) - { - return; - } - - $module['DB']['SEARCH_INDEX'] = basename(__FILE__) . $SID; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); -include($phpbb_root_path . 'includes/functions_posting.'.$phpEx); - -// Check permissions -if (!$auth->acl_get('a_search')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Start indexing -if (isset($_POST['start']) || isset($_GET['batchstart'])) -{ - $batchsize = 200; // Process this many posts per batch - $batchstart = (!isset($_GET['batchstart'])) ? $row['min_post_id'] : $_GET['batchstart']; - $batchcount = (!isset($_GET['batchcount'])) ? 1 : $_GET['batchcount']; - $loopcount = 0; - $batchend = $batchstart + $batchsize; - - // Search re-indexing is tough on the server ... so we'll check the load - // each loop and if we're on a 1min load of 3 or more we'll re-load the page - // and try again. No idea how well this will work in practice so we'll see ... - if (file_exists('/proc/loadavg')) - { - if ($load = @file('/proc/loadavg')) - { - list($load) = explode(' ', $load[0]); - - if ($load > 3) - { - redirect("admin_search.$phpEx$SID&batchstart=$batchstart&batchcount=$batch_count"); - } - } - } - - // Try and load stopword and synonym files - $stopword_array = array(); - $synonym_array = array(); - - $dir = opendir($phpbb_root_path . 'language/'); - while ($file = readdir($dir)) - { - if (preg_match('#^lang_#', $file) && !is_file($phpbb_root_path . 'language/' . $file) && !is_link($phpbb_root_path . 'language/' . $file)) - { - unset($tmp_array); - $tmp_array = @file($phpbb_root_path . 'language/' . $file . '/search_stopwords.txt'); - if (is_array($tmp_array)) - { - $stopword_array = array_unique(array_merge($stopword_array, $tmp_array)); - } - - unset($tmp_array); - $tmp_array = @file($phpbb_root_path . 'language/' . $file . '/search_synonyms.txt'); - if (is_array($tmp_array)) - { - $synonym_array = array_unique(array_merge($synonym_array, $tmp_array)); - } - } - } - - closedir($dir); - - if (!isset($_GET['batchstart'])) - { - // Take board offline - set_config('board_disable', 1); - - // Empty existing tables - $db->sql_query("TRUNCATE " . SEARCH_TABLE); - $db->sql_query("TRUNCATE " . SEARCH_WORD_TABLE); - $db->sql_query("TRUNCATE " . SEARCH_MATCH_TABLE); - } - - // Fetch a batch of posts_text entries - $sql = "SELECT COUNT(*) AS total, MAX(post_id) AS max_post_id, MIN(post_id) AS min_post_id - FROM " . POSTS_TEXT_TABLE; - $result = $db->sql_query($sql); - - $row = $db->sql_fetchrow($result); - $totalposts = $row['total']; - $max_post_id = $row['max_post_id']; - - $db->sql_freeresult($result); - - $sql = "SELECT * - FROM " . POSTS_TEXT_TABLE . " - WHERE post_id - BETWEEN $batchstart - AND $batchend"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - do - { - $post_id = $row['post_id']; - - $search_raw_words = array(); - $search_raw_words['text'] = split_words(clean_words('post', $row['post_text'], $stopword_array, $synonym_array)); - $search_raw_words['title'] = split_words(clean_words('post', $row['post_subject'], $stopword_array, $synonym_array)); - - $word = array(); - $word_insert_sql = array(); - foreach ($search_raw_words as $word_in => $search_matches) - { - $word_insert_sql[$word_in] = ''; - if (!empty($search_matches)) - { - for ($i = 0; $i < count($search_matches); $i++) - { - $search_matches[$i] = trim($search_matches[$i]); - - if ($search_matches[$i] != '') - { - $word[] = $search_matches[$i]; - $word_insert_sql[$word_in] .= ($word_insert_sql[$word_in] != '') ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'"; - } - } - } - } - - if (count($word)) - { - $word_text_sql = ''; - $word = array_unique($word); - - for($i = 0; $i < count($word); $i++) - { - $word_text_sql .= (($word_text_sql != '') ? ', ' : '') . "'" . $word[$i] . "'"; - } - - $check_words = array(); - switch(SQL_LAYER) - { - case 'postgresql': - case 'msaccess': - case 'mssql-odbc': - case 'oracle': - case 'db2': - $sql = "SELECT word_id, word_text - FROM " . SEARCH_WORD_TABLE . " - WHERE word_text IN ($word_text_sql)"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $check_words[$row['word_text']] = $row['word_id']; - } - break; - } - - $value_sql = ''; - $match_word = array(); - for ($i = 0; $i < count($word); $i++) - { - $new_match = true; - if (isset($check_words[$word[$i]])) - { - $new_match = false; - } - - if ($new_match) - { - switch(SQL_LAYER) - { - case 'mysql': - case 'mysql4': - $value_sql .= (($value_sql != '') ? ', ' : '') . '(\'' . $word[$i] . '\')'; - break; - case 'mssql': - $value_sql .= (($value_sql != '') ? ' UNION ALL ' : '') . "SELECT '" . $word[$i] . "'"; - break; - default: - $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) - VALUES ('" . $word[$i] . "')"; - $db->sql_query($sql); - break; - } - } - } - - if ($value_sql != '') - { - switch (SQL_LAYER) - { - case 'mysql': - case 'mysql4': - $sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text) - VALUES $value_sql"; - break; - case 'mssql': - $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) - $value_sql"; - break; - } - - $db->sql_query($sql); - } - } - - foreach ($word_insert_sql as $word_in => $match_sql) - { - $title_match = ($word_in == 'title') ? 1 : 0; - - if ($match_sql != '') - { - $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) - SELECT $post_id, word_id, $title_match - FROM " . SEARCH_WORD_TABLE . " - WHERE word_text IN ($match_sql)"; - $db->sql_query($sql); - } - } - - } - while ($row = $db->sql_fetchrow($result)); - } - - $db->sql_freeresult($result); - - // Remove common words after the first 2 batches and after every 4th batch after that. - if ($batchcount % 4 == 3) - { -// remove_common('global', $config['common_search']); - } - - $batchcount++; - - if (($batchstart + $batchsize) < $max_post_id) - { - redirect("Location: admin_search.$phpEx$SID&batchstart=" . ($batchstart + $batchsize) . "&batchcount=$batch_count"); - } - else - { - set_config('board_disable', 0); - page_header($user->lang['SEARCH_INDEX']); - -?> - -lang['SEARCH_INDEX_COMPLETE']; ?>
- -lang['SEARCH_INDEX']); - -?> - -lang['SEARCH_INDEX_CANCEL']; ?>
- -lang['Search_index']); - -?> - -lang['SEARCH_INDEX_EXPLAIN']; ?>
- - - - \ 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 @@ -acl_get('a_styles') ) - { - return; - } - - $filename = basename(__FILE__); - $module['STYLE']['EDIT_STYLE'] = $filename . "$SID&mode=newstyle"; - $module['STYLE']['EDIT_TEMPLATE'] = $filename . "$SID&mode=edittemplate"; - $module['STYLE']['EDIT_THEME'] = $filename . "$SID&mode=edittheme"; - $module['STYLE']['EDIT_IMAGESET'] = $filename . "$SID&mode=editimageset"; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Do we have styles admin permissions? -if (!$auth->acl_get('a_styles')) -{ - trigger_error($user->lang['No_admin']); -} - -/* -$dp = opendir($phpbb_root_path . 'templates/cache/'); -while ($file = readdir($dp)) -{ - if (!is_file($phpbb_root_path . 'templates/cache/' . $file) && !is_link($phpbb_root_path . 'templates/cache/' . $file) && $file != '.' && $file != '..') - { - $selected = ($tplroot == $file) ? ' selected="selected"' : ''; - $tplroot_options .= ''; - } -} -closedir($dp); -*/ - -// -$mode = (isset($_GET['mode'])) ? $_GET['mode'] : $_POST['mode']; - -switch ($mode) -{ - case 'editimageset': - $imgroot = (isset($_POST['imgroot'])) ? $_POST['imgroot'] : $config['default_style']; - - if (isset($_POST['img_addconfig'])) - { - } - else if (isset($_POST['img_addlocal'])) - { - } - - $imageset = array('imageset_path', 'post_new', 'post_locked', 'post_pm', 'reply_new', 'reply_pm', 'reply_locked', 'icon_profile', 'icon_pm', 'icon_delete', 'icon_ip', 'icon_quote', 'icon_search', 'icon_edit', 'icon_email', 'icon_www', 'icon_icq', 'icon_aim', 'icon_yim', 'icon_msnm', 'icon_no_email', 'icon_no_www', 'icon_no_icq', 'icon_no_aim', 'icon_no_yim', 'icon_no_msnm', 'goto_post', 'goto_post_new', 'goto_post_latest', 'goto_post_newest', 'forum', 'forum_new', 'forum_locked', 'sub_forum', 'sub_forum_new', 'folder', 'folder_new', 'folder_hot', 'folder_hot_new', 'folder_locked', 'folder_locked_new', 'folder_sticky', 'folder_sticky_new', 'folder_announce', 'folder_announce_new', 'topic_watch', 'topic_unwatch', 'poll_left', 'poll_center', 'poll_right', 'rating'); - - $sql = "SELECT imageset_name, imageset_path - FROM " . STYLES_IMAGE_TABLE . " - ORDER BY imageset_name"; - $result = $db->sql_query($sql); - - $imgroot_options = ''; - while ($row = $db->sql_fetchrow($result)) - { - $selected = ($imgroot == $row['imageset_path']) ? ' selected="selected"' : ''; - $imgroot_options .= ''; - } - - $imgname_options = ''; - $dp = opendir($phpbb_root_path . 'imagesets/' . $imgroot . '/'); - while ($file = readdir($dp)) - { - if (preg_match('#\.(gif|png|jpg|jpeg)$#', $file) && is_file($phpbb_root_path . 'imagesets/' . $imgroot . '/' . $file)) - { - $selected = ($imgname == $file) ? ' selected="selected"' : ''; - $imgname_options .= ''; - } - } - closedir($dp); - - // Output page - page_header($user->lang['Edit_Imageset']); - -?> - - - -compile(stripslashes($_POST['decompile'])) . "\n?".">"; - - $fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'w+'); - fwrite ($fp, $str); - fclose($fp); - - @chmod($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 0644); - - add_log('admin', 'log_template_edit', $tplname, $tplroot); - - exit; - } - else if (!empty($tplname) && isset($_POST['tpl_name'])) - { - $fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r'); - while (!feof($fp)) - { - $str .= fread($fp, 4096); - } - @fclose($fp); - - $template->decompile($str); - } - else - { - $str = (!empty($_POST['decompile'])) ? stripslashes($_POST['decompile']) : ''; - } - - if (isset($_POST['tpl_download'])) - { - header("Content-Type: text/html; name=\"" . $tplname . ".html\""); - header("Content-disposition: attachment; filename=" . $tplname . ".html"); - echo $str; - exit; - - } - - $tplroot_options = get_templates($tplroot); - - $tplname_options = ''; - $dp = @opendir($phpbb_root_path . 'templates/cache/' . $tplroot . '/'); - while ($file = readdir($dp)) - { - if (strstr($file, '.html.' . $phpEx) && is_file($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $file)) - { - $tpl = substr($file, 0, strpos($file, '.')); - $selected = ($tplname == $tpl) ? ' selected="selected"' : ''; - $tplname_options .= ''; - } - } - closedir($dp); - - // - page_header($user->lang['Edit_template']); - -?> - -lang['Edit_template_explain']; ?>
- - - -sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $theme_name = $row['theme_name']; - - $css_data = (!empty($_POST['css_data'])) ? htmlentities($_POST['css_data']) : ''; - $css_external = (!empty($_POST['css_data'])) ? $_POST['css_data'] : ''; - - $sql = "UPDATE " > STYLES_CSS_TABLE . " - SET css_data = '$css_data', css_external = '$css_external' - WHERE theme_id = $theme_id"; - $db->sql_query($sql); - - add_log('admin', 'log_theme_edit', $theme_name); - - message_die(MESSAGE, $user->lang['Success_theme_update']); - } - } - - page_header($user->lang['Edit_theme']); - - $sql = "SELECT theme_id, theme_name - FROM " . STYLES_CSS_TABLE; - $result = $db->sql_query($sql); - - $theme_options = ''; - if ($row = $db->sql_fetchrow($result)) - { - do - { - $theme_options .= (($theme_options != '') ? ', ' : '') . ''; - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - - $css_data = ''; - $css_external = ''; - if ($theme_id) - { - $sql = "SELECT css_data, css_external - FROM " . STYLES_CSS_TABLE . " - WHERE theme_id = $theme_id"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $css_data = preg_replace('/\t{1,}/i', ' ', $row['css_data']); - $css_external = $row['css_external']; - } - } - -?> - - - -sql_query($sql); - - $tplroot_options = ''; - while ($row = $db->sql_fetchrow($result)) - { - $selected = ($tplroot == $row['template_path']) ? ' selected="selected"' : ''; - $tplroot_options .= ''; - } - - return $tplroot_options; -} - -?> \ No newline at end of file diff --git a/phpBB/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 @@ -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']); - -?> - - - -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']); - } - } - -?> -Select permission set: | -||
lang['Option']; ?> | -lang['Allow']; ?> | -lang['Deny']; ?> | -
---|---|---|
- | /> | -/> | -
' . $user->lang['acl_' . $option] . ' => ' . (($allow) ? 'Allowed' : 'Denied') . ' |
lang['User_admin_explain']; ?>
- - - - '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 @@ -acl_get('a_general')) - { - return; - } - - $filename = basename(__FILE__); - $module['LOG']['ADMIN_LOGS'] = $filename . "$SID&mode=admin"; - $module['LOG']['MOD_LOGS'] = $filename . "$SID&mode=mod"; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Do we have styles admin permissions? -if (!$auth->acl_get('a_general')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Set some variables -$forum_id = (isset($_REQUEST['f'])) ? intval($_REQUEST['f']) : 0; -$start = (isset($_GET['start'])) ? intval($_GET['start']) : 0; -$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'admin'; - -// Define some vars depending on which logs we're looking at -$log_table_sql = ($mode == 'admin') ? LOG_ADMIN_TABLE : LOG_MOD_TABLE; -$l_title = ($mode == 'admin') ? $user->lang['ADMIN_LOGS'] : $user->lang['MOD_LOGS']; -$l_title_explain = ($mode == 'admin') ? $user->lang['ADMIN_LOGS_EXPLAIN'] : $user->lang['MOD_LOGS_EXPLAIN']; - -// Delete entries if requested and able -if ((isset($_POST['delmarked']) || isset($_POST['delall'])) && $auth->acl_get('a_clearlogs')) -{ - $where_sql = ''; - if (isset($_POST['delmarked']) && isset($_POST['mark'])) - { - foreach ($_POST['mark'] as $marked) - { - $where_sql .= (($where_sql != '') ? ', ' : '') . intval($marked); - } - $where_sql = "WHERE log_id IN ($where_sql)"; - } - - $sql = "DELETE FROM $table_sql - $where_sql"; - $db->sql_query($sql); - - add_log('admin', 'log_' . $mode . '_clear'); -} - -// Sorting ... this could become a function -if (isset($_POST['sort']) || $start) -{ - if (!empty($_POST['sort_days'])) - { - $sort_days = intval($_POST['sort_days']); - $where_sql = time() - ($sort_days * 86400); - } - else - { - $where_sql = 0; - } - - $sort_key = (isset($_POST['sort_key'])) ? $_POST['sort_key'] : ''; - $sort_dir = (isset($_POST['sort_dir'])) ? $_POST['sort_dir'] : ''; -} -else -{ - $where_sql = 0; - - $sort_days = 0; - $sort_key = 't'; - $sort_dir = 'd'; -} - - - -$previous_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']); -$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); -$sort_by = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); - -$sort_day_options = ''; -foreach ($previous_days as $day => $text) -{ - $selected = ($sort_days == $day) ? ' selected="selected"' : ''; - $sort_day_options .= ''; -} - -$sort_key_options = ''; -foreach ($sort_by_text as $key => $text) -{ - $selected = ($sort_key == $key) ? ' selected="selected"' : ''; - $sort_key_options .= ''; -} - -$sort_order_options = ($sort_dir == 'a') ? '' : ''; - -$sort_sql = $sort_by[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); - -// Output page -page_header($l_title); - -?> - - - - - - - - - - \ 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 @@ -acl_get('a_words')) - { - return; - } - - $module['POST']['WORD_CENSOR'] = basename(__FILE__) . $SID; - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// Do we have forum admin permissions? -if (!$auth->acl_get('a_words')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// What do we want to do? -if (isset($_REQUEST['mode'])) -{ - $mode = $_REQUEST['mode']; -} -else -{ - // These could be entered via a form button - if (isset($_POST['add'])) - { - $mode = 'add'; - } - else if (isset($_POST['save'])) - { - $mode = 'save'; - } - else - { - $mode = ''; - } -} - -if ($mode != '') -{ - switch ($mode) - { - case 'edit': - case 'add': - $word_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0; - - $s_hidden_fields = ''; - if ($mode == 'edit') - { - if (!$word_id) - { - trigger_error($user->lang['NO_WORD']); - } - - $sql = "SELECT * - FROM " . WORDS_TABLE . " - WHERE word_id = $word_id"; - $result = $db->sql_query($sql); - - $word_info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $s_hidden_fields .= ''; - } - - page_header($user->lang['WORDS_TITLE']); - -?> - -lang['WORDS_EXPLAIN']; ?>
- - - -lang['ENTER_WORD']); - } - - $sql = ($word_id) ? "UPDATE " . WORDS_TABLE . " SET word = '" . $db->sql_escape($word) . "', replacement = '" . $db->sql_escape($replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . $db->sql_escape($word) . "', '" . $db->sql_escape($replacement) . "')"; - $db->sql_query($sql); - - $cache->destroy('word_censors'); - - $log_action = ($word_id) ? 'log_edit_word' : 'log_add_word'; - add_log('admin', $log_action, stripslashes($word)); - - $message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED']; - break; - - case 'delete': - - if (isset($_POST['id']) || isset($_GET['id'])) - { - $word_id = (isset($_POST['id'])) ? intval($_POST['id']) : intval($_GET['id']); - } - else - { - trigger_error($user->lang['NO_WORD']); - } - - $sql = "DELETE FROM " . WORDS_TABLE . " - WHERE word_id = $word_id"; - $db->sql_query($sql); - - $cache->destroy('word_censors'); - - add_log('admin', 'log_delete_word'); - - $message = $user->lang['WORD_REMOVE']; - break; - - } - - trigger_error($message); - -} -else -{ - - page_header($user->lang['WORDS_TITLE']); - -?> - -lang['WORDS_EXPLAIN']; ?>
- - - - \ 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 deleted file mode 100644 index 715b8d4aa8..0000000000 Binary files a/phpBB/admin/images/cellpic1.gif and /dev/null differ diff --git a/phpBB/admin/images/cellpic3.gif b/phpBB/admin/images/cellpic3.gif deleted file mode 100644 index ecf70e1fd1..0000000000 Binary files a/phpBB/admin/images/cellpic3.gif and /dev/null differ diff --git a/phpBB/admin/images/header_bg.jpg b/phpBB/admin/images/header_bg.jpg deleted file mode 100644 index 5ecec5360b..0000000000 Binary files a/phpBB/admin/images/header_bg.jpg and /dev/null differ diff --git a/phpBB/admin/images/header_left.jpg b/phpBB/admin/images/header_left.jpg deleted file mode 100644 index aaebf33c7a..0000000000 Binary files a/phpBB/admin/images/header_left.jpg and /dev/null differ diff --git a/phpBB/admin/images/icon_folder.gif b/phpBB/admin/images/icon_folder.gif deleted file mode 100644 index 9b2bc47c67..0000000000 Binary files a/phpBB/admin/images/icon_folder.gif and /dev/null differ diff --git a/phpBB/admin/images/icon_folder_lock.gif b/phpBB/admin/images/icon_folder_lock.gif deleted file mode 100644 index 436f3d21c8..0000000000 Binary files a/phpBB/admin/images/icon_folder_lock.gif and /dev/null differ diff --git a/phpBB/admin/images/icon_subfolder.gif b/phpBB/admin/images/icon_subfolder.gif deleted file mode 100644 index c29bb43f49..0000000000 Binary files a/phpBB/admin/images/icon_subfolder.gif and /dev/null differ 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 @@ -acl_get('a_')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Generate relevant output -if (isset($_GET['pane']) && $_GET['pane'] == 'top') -{ - page_header('', '', false); - -?> - -![]() |
- lang['ADMIN_TITLE']; ?> | -
|
-