diff --git a/e107_admin/banlist.php b/e107_admin/banlist.php index 07c5a2ccf..01a8b953f 100644 --- a/e107_admin/banlist.php +++ b/e107_admin/banlist.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/banlist.php,v $ -| $Revision: 1.3 $ -| $Date: 2007-12-09 16:42:22 $ +| $Revision: 1.4 $ +| $Date: 2007-12-11 22:48:36 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -20,6 +20,9 @@ define('BAN_TIME_FORMAT',"%d-%m-%Y %H:%M"); define('BAN_REASON_COUNT',7); // Update as more ban reasons added (max 10 supported) +define('BAN_TYPE_IMPORTED',5); // Imported bans +define('BAN_TYPE_TEMPORARY',9); // Used during CSV import + require_once("../class2.php"); if (!getperms("4")) { @@ -173,6 +176,24 @@ function ban_time_dropdown($click_js = '', $zero_text=BANLAN_21, $curval=-1,$dro } +// Character options for import & export +$separator_char = array(1 => ',', 2 => '|'); +$quote_char = array(1 => '', 2 => "'", 3 => '"'); + + +function select_box($name, $data, $curval = FALSE) +{ + $ret = "\n"; + return $ret; +} + $text = ""; @@ -298,6 +319,74 @@ switch ($action) $ns->tablerender(BANLAN_9, $text); break; // End of 'Add' and 'Edit' + + case 'transfer' : + $message = ''; + if (isset($_POST['ban_import'])) + { // Got a file to import + require_once(e_HANDLER.'upload_handler.php'); + if (($files = process_uploaded_files(e_FILE."public/",FALSE,array('overwrite'=>TRUE, 'max_file_count' => 1, 'file_mask'=> 'csv'))) === FALSE) + { // Invalid file + $message = BANLAN_47; + } + if (!$message && $files[0]['error']) $message = $files[0]['message']; + if (!$message) + { // Got a file of some sort + $message = process_csv(e_FILE."public/".$files[0]['name'], + intval(varset($_POST['ban_over_import'],0)), + intval(varset($_POST['ban_over_expiry'],0)), + $separator_char[intval(varset($_POST['ban_separator'],1))], + $quote_char[intval(varset($_POST['ban_quote'],3))]); + } + + } + if ($message) $ns->tablerender(BANLAN_48, "