1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Banner management/menu config ready;

Banlist administration - work in progress
This commit is contained in:
secretr
2008-12-22 16:50:07 +00:00
parent ee43f9d4b6
commit dc74e96e97
8 changed files with 1425 additions and 1083 deletions

View File

@@ -1,41 +1,49 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/banlist.php,v $
| $Revision: 1.11 $
| $Date: 2008-11-22 12:57:25 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Ban List Management
*
* $Source: /cvs_backup/e107_0.8/e107_admin/banlist.php,v $
* $Revision: 1.12 $
* $Date: 2008-12-22 16:50:07 $
* $Author: secretr $
*
*/
/*
* [SecretR] WORK IN PROGRESS!
*
*/
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_MANUAL', 1); // Manually entered bans
define('BAN_TYPE_IMPORTED', 5); // Imported bans
define('BAN_TYPE_TEMPORARY', 9); // Used during CSV import
define('BAN_TYPE_WHITELIST', 100); // Entry for whitelist
require_once ("../class2.php");
if(! getperms("4"))
{
header("location:" . e_BASE . "index.php");
exit;
exit();
}
$e_sub_cat = 'banlist';
require_once ("auth.php");
require_once (e_HANDLER . "form_handler.php");
$rs = new form;
$rs = new form();
$frm = new e_form(true);
$action = 'list';
if(e_QUERY)
@@ -43,7 +51,8 @@ if (e_QUERY)
$tmp = explode("-", e_QUERY); // Use '-' instead of '.' to avoid confusion with IP addresses
$action = $tmp[0];
$sub_action = varset($tmp[1], '');
if ($sub_action) $sub_action = preg_replace("/[^\w@\.]*/",'',urldecode($sub_action));
if($sub_action)
$sub_action = preg_replace("/[^\w@\.]*/", '', urldecode($sub_action));
$id = intval(varset($tmp[2], 0));
unset($tmp);
}
@@ -71,8 +80,6 @@ if (isset($_POST['update_ban_prefs']))
$ns->tablerender(BANLAN_9, "<div style='text-align:center'>" . BANLAN_33 . '</div>');
}
if(isset($_POST['ban_ip']))
{
$_POST['ban_ip'] = trim($_POST['ban_ip']);
@@ -100,11 +107,14 @@ if (isset($_POST['ban_ip']))
if(isset($_POST['add_ban']))
{
$new_vals['banlist_datestamp'] = time();
if ($_POST['entry_intent'] == 'add') $new_vals['banlist_bantype'] = BAN_TYPE_MANUAL; // Manual ban
if ($_POST['entry_intent'] == 'whadd') $new_vals['banlist_bantype'] = BAN_TYPE_WHITELIST;
if($_POST['entry_intent'] == 'add')
$new_vals['banlist_bantype'] = BAN_TYPE_MANUAL; // Manual ban
if($_POST['entry_intent'] == 'whadd')
$new_vals['banlist_bantype'] = BAN_TYPE_WHITELIST;
}
$new_vals['banlist_admin'] = ADMINID;
if (varsettrue($_POST['ban_reason'])) $new_vals['banlist_reason'] =$tp->toDB($_POST['ban_reason']);
if(varsettrue($_POST['ban_reason']))
$new_vals['banlist_reason'] = $tp->toDB($_POST['ban_reason']);
$new_vals['banlist_notes'] = $tp->toDB($_POST['ban_notes']);
if(isset($_POST['ban_time']) && is_numeric($_POST['ban_time']) && ($_POST['entry_intent'] == 'edit' || $_POST['entry_intent'] == 'add'))
{
@@ -164,7 +174,6 @@ if (($action == "remove" || $action == "whremove") && isset($_POST['ban_secure']
}
}
// Update the ban expiry time/date - timed from now (only done on banlist)
if($action == 'newtime')
{
@@ -174,7 +183,6 @@ if ($action == 'newtime')
$action = 'list';
}
// Edit modes - get existing entry
if($action == "edit" || $action == "whedit")
{
@@ -191,7 +199,6 @@ else
}
}
function ban_time_dropdown($click_js = '', $zero_text = BANLAN_21, $curval = -1, $drop_name = 'ban_time')
{
$intervals = array(0, 1, 2, 3, 6, 8, 12, 24, 36, 48, 72, 96, 120, 168, 336, 672);
@@ -218,19 +225,18 @@ function ban_time_dropdown($click_js = '', $zero_text=BANLAN_21, $curval=-1,$dro
return $ret;
}
// Character options for import & export
$separator_char = array(1 => ',', 2 => '|');
$quote_char = array(1 => '(none)', 2 => "'", 3 => '"');
function select_box($name, $data, $curval = FALSE)
{
$ret = "<select class='tbox' name='{$name}'>\n";
foreach($data as $k => $v)
{
$selected = '';
if (($curval !== FALSE) && ($curval == $k)) $selected = " selected='selected'";
if(($curval !== FALSE) && ($curval == $k))
$selected = " selected='selected'";
$ret .= "<option value='{$k}'{$selected}>{$v}</option>\n";
}
$ret .= "</select>\n";
@@ -243,7 +249,7 @@ $text = "";
function drop_box($box_name, $curval)
{
$opts = array(50, 100, 150, 200, 250, 300, 400, 500);
$ret = "<select class='tbox' name={$box_name}>\n";
$ret = "<select class='tbox' name='{$box_name}'>\n";
foreach($opts as $o)
{
$sel = ($curval == $o) ? " selected='selected'" : '';
@@ -253,11 +259,11 @@ function drop_box($box_name,$curval)
return $ret;
}
switch($action)
{
case 'options':
if(!getperms("0")) exit;
if(! getperms("0"))
exit();
if(isset($_POST['update_ban_options']))
{
$pref['enable_rdns'] = intval($_POST['ban_rdns_on_access']);
@@ -274,79 +280,77 @@ switch ($action)
list($ban_access_guest, $ban_access_member) = explode(',', varset($pref['ban_max_online_access'], '100,200'));
$ban_access_member = max($ban_access_guest, $ban_access_member);
$text = "<div style='text-align:center'>
$text = "
<form method='post' action='" . e_SELF . "?options'>
<table style='".ADMIN_WIDTH."' class='fborder'>
<colgroup>
<col style='width:40%' />
<col style='width:20%' />
<col style='width:40%' />
<fieldset id='core-banlist-options'>
<legend>" . BANLAN_72 . "</legend>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tbody>
<tr>
<td class='forumheader3'>".BANLAN_63."</td>
<td class='forumheader3'>
<td class='label'>" . BANLAN_63 . "</td>
<td class='control'>
<input type='checkbox' name='ban_rdns_on_access' value='1'" . ($pref['enable_rdns'] == 1 ? " checked='checked'" : '') . " />
<div class='field-help'>" . BANLAN_65 . "</div>
</td>
<td class='forumheader3'><span style='smalltext'>".BANLAN_65."</span></td>
</tr>
<tr>
<td class='forumheader3'>".BANLAN_64."</td>
<td class='forumheader3'>
<td class='label'>" . BANLAN_64 . "</td>
<td class='control'>
<input type='checkbox' name='ban_rdns_on_ban' value='1'" . ($pref['enable_rdns_on_ban'] == 1 ? " checked='checked'" : '') . " />
<div class='field-help'>" . BANLAN_66 . "</div>
</td>
<td class='forumheader3'><span style='smalltext'>".BANLAN_66."</span></td>
</tr>
<tr>
<td class='forumheader3'>".BANLAN_67."</td>
<td class='forumheader3'>".drop_box('ban_access_guest',$ban_access_guest).BANLAN_70.'<br />'.
drop_box('ban_access_member',$ban_access_member).BANLAN_69."
<td class='label'>" . BANLAN_67 . "</td>
<td class='control'>
<div class='field-spacer'>" . drop_box('ban_access_guest', $ban_access_guest) . BANLAN_70 . "</div>
<div class='field-spacer'>" . drop_box('ban_access_member', $ban_access_member) . BANLAN_69 . "</div>
<div class='field-help'>" . BANLAN_68 . "</div>
</td>
<td class='forumheader3'>".BANLAN_68."</td>
</tr>
<tr>
<td class='forumheader3'>".BANLAN_71."</td>
<td class='forumheader3'>
<td class='label'>" . BANLAN_71 . "</td>
<td class='control'>
<input type='checkbox' name='ban_retrigger' value='1'" . ($pref['ban_retrigger'] == 1 ? " checked='checked'" : '') . " />
<div class='field-help'>" . BANLAN_73 . "</div>
</td>
<td class='forumheader3'><span style='smalltext'>".BANLAN_73."</span></td>
</tr>
";
$text .= "<tr><td class='forumheader3' colspan='3' style='text-align:center'>
<input class='button' type='submit' name='update_ban_options' value='".LAN_UPDATE."' /></td>
</tr>
</table>\n
</form>
</div><br />";
$ns->tablerender(BANLAN_72, $text);
$text = "<div style='text-align:center'>
<form method='post' action='".e_SELF."?options'>
<table style='".ADMIN_WIDTH."' class='fborder'>
<colgroup>
<col style='width:75%' />
<col style='width:25%' />
</tbody>
</table>
<div class='buttons-bar center'>
" . $frm->admin_button('update_ban_options', LAN_UPDATE, 'update', LAN_UPDATE) . "
</div>
</fieldset>
<fieldset id='core-banlist-options-ban'>
<legend>" . BANLAN_74 . "</legend>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tbody>
<tr>
<td class='forumheader3'>".BANLAN_75."</td>
<td class='forumheader3'>
<input class='button' type='submit' name='remove_expired_bans' value='".BANLAN_76."' /></td>
<td class='label'>" . BANLAN_75 . "</td>
<td class='control'>
" . $frm->admin_button('remove_expired_bans', BANLAN_76, 'delete', BANLAN_76) . "
</td>
</tr>
</table>\n
</tbody>
</table>
</fieldset>
</form>
</div><br />";
$ns->tablerender(BANLAN_74, $text);
";
$ns->tablerender(BANLAN_72, $text);
break;
case 'times':
if(!getperms("0")) exit;
if(! getperms("0"))
exit();
$text = '';
if((! isset($pref['ban_messages'])) || ! is_array($pref['ban_messages']))
{
$pref['ban_messages'] = array_fill(0, BAN_REASON_COUNT - 1, '');
@@ -355,39 +359,60 @@ switch ($action)
{
$pref['ban_durations'] = array_fill(0, BAN_REASON_COUNT - 1, 0);
}
$text = $rs->form_open("post", e_SELF.'?'.e_QUERY, "ban_options")."<div style='text-align:center'>";
if(! $ban_total = $sql->db_Select("banlist", "*", "ORDER BY banlist_ip", "nowhere"))
{
$text .= "<div style='text-align:center'>".BANLAN_2."</div>";
$text .= "<div class='center'>" . BANLAN_2 . "</div>";
}
else
{
$text .= "<table class='fborder' style='".ADMIN_WIDTH."'>
<colgroup>
<col style='width:20%' />
<col style='width:70%' />
<col style='width:10%' />
//XXX Lan - Messages/Ban Periods
$text .= "
<form method='post' action='" . e_SELF . '?' . e_QUERY . "' id='ban_options'>
<fieldset id='core-banlist-times'>
<legend class='e-hideme'>Messages/Ban Periods</legend>
<table cellpadding='0' cellspacing='0' class='adminlist'>
<colgroup span='3'>
<col style='width: 20%'></col>
<col style='width: 65%'></col>
<col style='width: 15%'></col>
</colgroup>
<thead>
<tr>
<td class='fcaption'>".BANLAN_28."</td>
<td class='fcaption' style='text-align:center'>".BANLAN_29."<br /><span class='smallblacktext'>".BANLAN_31."</span></td>
<td class='fcaption'>".BANLAN_30."</td>
</tr>";
<th>" . BANLAN_28 . "</th>
<th>" . BANLAN_29 . "<br />" . BANLAN_31 . "</th>
<th class='center last'>" . BANLAN_30 . "</th>
</tr>
</thead>
<tbody>
";
for($i = 0; $i < BAN_REASON_COUNT; $i ++)
{
$text .= "<tr>
<td class='forumheader3'><a title='".constant('BANLAN_11'.$i)."'>".constant('BANLAN_10'.$i)."</a></td>
<td class='forumheader3'>
<textarea class='tbox' name='ban_text[]' cols='50' rows='4'>{$pref['ban_messages'][$i]}</textarea>
$text .= "
<tr>
<td>
<strong>" . constant('BANLAN_10' . $i) . "</strong>
<div class='field-help'>" . constant('BANLAN_11' . $i) . "</div>
</td>
<td class='forumheader3'>".ban_time_dropdown('',BANLAN_32,$pref['ban_durations'][$i],'ban_time[]')."</td>
</tr>";
<td class='center'>
<textarea class='tbox textarea' name='ban_text[]' cols='50' rows='4'>{$pref['ban_messages'][$i]}</textarea>
</td>
<td class='center'>" . ban_time_dropdown('', BANLAN_32, $pref['ban_durations'][$i], 'ban_time[]') . "</td>
</tr>
";
}
$text .= "<tr><td class='forumheader3' colspan='3' style='text-align:center'><input class='button' type='submit' name='update_ban_prefs' value='".LAN_UPDATE."' /></td></tr>
</table>\n";
$text .= "
</tbody>
</table>
<div class='buttons-bar center'>
" . $frm->admin_button('update_ban_prefs', LAN_UPDATE, 'update', LAN_UPDATE) . "
</div>
</fieldset>
</form>
";
}
$text .= "</div>".$rs->form_close();
$ns->tablerender(BANLAN_3, $text);
//XXX Lan - Messages/Ban Periods
$ns->tablerender("Messages/Ban Periods", $text);
break;
case 'edit':
@@ -395,86 +420,115 @@ switch ($action)
case 'whedit':
case 'whadd':
$page_title = array('edit' => BANLAN_60, 'add' => BANLAN_9, 'whedit' => BANLAN_59, 'whadd' => BANLAN_58);
$rdns_warn = varsettrue($pref['enable_rdns']) ? '' : '<br />'.BANLAN_12;
$rdns_warn = varsettrue($pref['enable_rdns']) ? '' : '<div class="field-help error">' . BANLAN_12 . '</div>';
$next = ($action == 'whedit' || $action == 'whadd') ? '?white' : '?list';
// Edit/add form first
$text .= "<div style='text-align:center'>
$text .= "
<form method='post' action='" . e_SELF . $next . "'>
<table style='".ADMIN_WIDTH."' class='fborder'>
<fieldset id='core-banlist-edit'>
<legend class='e-hideme'>" . $page_title[$action] . "</legend>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tbody>
<tr>
<td style='width:30%' class='forumheader3'><input type='hidden' name='entry_intent' value='{$action}' />".BANLAN_5.": </td>
<td style='width:70%' class='forumheader3'>
<input class='tbox' type='text' name='ban_ip' size='40' value='".$e107->ipDecode($banlist_ip)."' maxlength='200' />{$rdns_warn}
<td class='label'><input type='hidden' name='entry_intent' value='{$action}' />" . BANLAN_5 . ": </td>
<td class='control'>
<input class='tbox input-text' type='text' name='ban_ip' size='40' value='" . $e107->ipDecode($banlist_ip) . "' maxlength='200' />
{$rdns_warn}
</td>
</tr>";
</tr>
";
if(($action == 'add') || ($action == 'whadd') || ($banlist_bantype <= 1) || ($banlist_bantype >= BAN_TYPE_WHITELIST))
{ // Its a manual or unknown entry - only allow edit of reason on those
$text .= "
<tr>
<td style='width:20%' class='forumheader3'>".BANLAN_7.": </td>
<td style='width:80%' class='forumheader3'>
<textarea class='tbox' name='ban_reason' cols='50' rows='4'>{$banlist_reason}</textarea>
<td class='label'>" . BANLAN_7 . ": </td>
<td class='control'>
<textarea class='tbox textarea' name='ban_reason' cols='50' rows='4'>{$banlist_reason}</textarea>
</td>
</tr>";
</tr>
";
}
elseif($action == 'edit')
{
$text .= "
<tr>
<td style='width:20%' class='forumheader3'>".BANLAN_7.": </td>
<td style='width:80%' class='forumheader3'>{$banlist_reason}</td>
</tr>";
<td class='label'>" . BANLAN_7 . ": </td>
<td class='control'>{$banlist_reason}</td>
</tr>
";
}
if($action == 'edit')
{
$text .= "
<tr>
<td style='width:20%' class='forumheader3'>".BANLAN_28.": </td>
<td style='width:80%' class='forumheader3'>".constant('BANLAN_10'.$banlist_bantype)." - ".constant('BANLAN_11'.$banlist_bantype)."</td>
</tr>";
<td class='label'>" . BANLAN_28 . ": </td>
<td class='control'>" . constant('BANLAN_10' . $banlist_bantype) . " - " . constant('BANLAN_11' . $banlist_bantype) . "</td>
</tr>
";
}
$text .= "
<tr>
<td style='width:20%' class='forumheader3'>".BANLAN_19.": </td>
<td style='width:80%' class='forumheader3'>
<textarea class='tbox' name='ban_notes' cols='50' rows='4'>{$banlist_notes}</textarea>
<td class='label'>" . BANLAN_19 . ": </td>
<td class='control'>
<textarea class='tbox textarea' name='ban_notes' cols='50' rows='4'>{$banlist_notes}</textarea>
</td>
</tr>";
</tr>
";
if($action == 'edit' || $action == 'add')
{
$text .= "<tr>
<td style='width:20%' class='forumheader3'>".BANLAN_18.": </td>
<td style='width:80%' class='forumheader3'>".ban_time_dropdown().
(($action == 'edit') ? '&nbsp;&nbsp;&nbsp;('.BANLAN_26.($banlist_banexpires ? strftime(BAN_TIME_FORMAT,$banlist_banexpires) : BANLAN_21).')' : '').
"</td>
</tr>";
$text .= "
<tr>
<td class='label'>" . BANLAN_18 . ": </td>
<td class='control'>" . ban_time_dropdown() . (($action == 'edit') ? '&nbsp;&nbsp;&nbsp;(' . BANLAN_26 . ($banlist_banexpires ? strftime(BAN_TIME_FORMAT, $banlist_banexpires) : BANLAN_21) . ')' : '') . "</td>
</tr>
";
}
$text .= "
<tr style='vertical-align:top'>
<td colspan='2' style='text-align:center' class='forumheader'>";
</tbody>
</table>
<div class='buttons-bar center'>
";
if($action == "edit" || $action == "whedit")
{
$text .= "<input type='hidden' name='old_ip' value='{$banlist_ip}' /><input class='button' type='submit' name='update_ban' value='".LAN_UPDATE."' />";
$text .= "
<input type='hidden' name='old_ip' value='{$banlist_ip}' />
" . $frm->admin_button('update_ban', LAN_UPDATE, 'update', LAN_UPDATE) . "
";
}
else
{
$text .= "<input class='button' type='submit' name='add_ban' value='".($action == 'add' ? BANLAN_8 : BANLAN_53)."' />";
$text .= "
" . $frm->admin_button('add_ban', ($action == 'add' ? BANLAN_8 : BANLAN_53), 'submit', ($action == 'add' ? BANLAN_8 : BANLAN_53)) . "
";
}
$text .= "</td>
</tr>
</table>
</form>
</div>";
$text .= "<div style='text-align:center'><br />".BANLAN_13."<a href='".e_ADMIN."users.php'><img src='".$images_path."users_16.png' alt='' /></a></div>";
$text .= "
</div>
</fieldset>
</form>
";
//FIXME - Put this notes somewhere
$text .= "
<div style='text-align:center'>
" . BANLAN_13 . "<a href='" . e_ADMIN . "users.php'><img src='" . $images_path . "users_16.png' alt='' /></a>
</div>
";
if(! varsettrue($pref['enable_rdns']))
{
$text .= "<div style='text-align:center'><br />".BANLAN_12."</div>";
$text .= "
<div style='text-align:center'><br />" . BANLAN_12 . "</div>
";
}
$ns->tablerender($page_title[$action], $text);
break; // End of 'Add' and 'Edit'
@@ -489,99 +543,172 @@ switch ($action)
{ // Invalid file
$message = BANLAN_47;
}
if (!$message && $files[0]['error']) $message = $files[0]['message'];
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))]);
$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))]);
banlist_adminlog("07", 'File: ' . e_FILE . "public/" . $files[0]['name'] . '<br />' . $message);
}
}
if ($message) $ns->tablerender(BANLAN_48, "<div style='text-align:center; font-weight:bold'>{$message}</div>");
if($message)
$ns->tablerender(BANLAN_48, "<div style='text-align:center; font-weight:bold'>{$message}</div>");
$text = "<div style='text-align:center'>
$text = "
<form method='post' action='" . e_ADMIN . "banlist_export.php' id='ban_export_form' >
<table>
<colgroup>
<fieldset id='core-banlist-transfer-export'>
<legend>" . BANLAN_40 . "</legend>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col style='width:70%' />
<col style='width:30%' />
</colgroup>
<tr><td class='fcaption'>".BANLAN_36."</td><td class='fcaption'>".BANLAN_15."</td></tr>";
$text .= "<tr><td class='forumheader3' rowspan='3'>\n";
$spacer = '';
<tbody>
<tr>
<th>" . BANLAN_36 . "</th>
<th>" . BANLAN_15 . "</th>
</tr>
<tr>
<td class='forumheader3' rowspan='2'>
";
for($i = 0; $i < BAN_REASON_COUNT; $i ++)
{
$text .= $spacer."<input type='checkbox' name='ban_types[{$i}]' value='".($i)."' />&nbsp;".constant('BANLAN_10'.$i)." - ".constant('BANLAN_11'.$i);
$spacer = "<br />\n";
$text .= "
<div class='field-spacer'>
<input type='checkbox' name='ban_types[{$i}]' value='" . ($i) . "' />&nbsp;" . constant('BANLAN_10' . $i) . " - " . constant('BANLAN_11' . $i) . "
</div>
";
}
$text .= "</td><td class='forumheader3'>".select_box('ban_separator',$separator_char).' '.BANLAN_37;
$text .= "</td></tr><tr><td class='forumheader3'>".select_box('ban_quote',$quote_char).' '.BANLAN_38."</td></tr><tr><td class='forumheader3' style='text-align:right'>";
$text .= "<input class='button' type='submit' name='ban_export' value='".BANLAN_39."' />
</td></tr>";
$text .= "</table></form><br /><br /></div>";
$ns->tablerender(BANLAN_40, $text);
$text .= "
</td>
<td class='forumheader3'>
<div class='field-spacer'>" . select_box('ban_separator', $separator_char) . ' ' . BANLAN_37 . "</div>
<div class='field-spacer'>" . select_box('ban_quote', $quote_char) . ' ' . BANLAN_38 . "</div>
</td>
</tr>
<tr>
<td class='bottom' style='text-align:right'>
" . $frm->admin_button('ban_export', BANLAN_39, 'submit', BANLAN_39) . "
</td>
</tr>
</tbody>
</table>
</fieldset>
</form>
";
// Now do the import options
$text = "<div style='text-align:center'>
<form enctype=\"multipart/form-data\" method='post' action='".e_SELF."?transfer' id='ban_import_form' >
<table>
<colgroup>
$text .= "
<form enctype='multipart/form-data' method='post' action='" . e_SELF . "?transfer' id='ban_import_form' >
<fieldset id='core-banlist-transfer-import'>
<legend>" . BANLAN_41 . "</legend>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col style='width:70%' />
<col style='width:30%' />
</colgroup>
<tr><td class='fcaption'>".BANLAN_42."</td><td class='fcaption'>".BANLAN_15."</td></tr>";
$text .= "<tr><td class='forumheader3' rowspan='2'>\n";
$text .= "<input type='checkbox' name='ban_over_import' value='1' />&nbsp;".BANLAN_43.'<br />';
$text .= "<input type='checkbox' name='ban_over_expiry' value='1' />&nbsp;".BANLAN_44;
<tbody>
<tr>
<th>" . BANLAN_42 . "</th>
<th>" . BANLAN_15 . "</th>
</tr>
<tr>
<td class='forumheader3'>
<input type='checkbox' name='ban_over_import' value='1' />&nbsp;" . BANLAN_43 . "<br />
<input type='checkbox' name='ban_over_expiry' value='1' />&nbsp;" . BANLAN_44 . "
</td>
<td class='forumheader3'>
<div class='field-spacer'>" . select_box('ban_separator', $separator_char) . ' ' . BANLAN_37 . "</div>
<div class='field-spacer'>" . select_box('ban_quote', $quote_char) . ' ' . BANLAN_38 . "</div>
</td>
</tr>
<tr>
<td class='forumheader3'>
<input class='tbox' type='file' name='file_userfile[]' style='width:90%' size='50' />
</td>
<td class='forumheader3' style='text-align:right'>
" . $frm->admin_button('ban_import', BANLAN_45, 'submit', BANLAN_45) . "
</td>
</tr>
</tbody>
</table>
</fieldset>
</form>
";
$text .= "</td><td class='forumheader3'>".select_box('ban_separator',$separator_char).' '.BANLAN_37;
$text .= "</td></tr><tr><td class='forumheader3'>".select_box('ban_quote',$quote_char).' '.BANLAN_38."</td></tr>
<tr><td class='forumheader3'><input class='tbox' type='file' name='file_userfile[]' style='width:90%' size='50' /></td>
<td class='forumheader3' style='text-align:right'>";
$text .= "<input class='button' type='submit' name='ban_import' value='".BANLAN_45."' />
</td></tr>";
$text .= "</table></form><br /><br /></div>";
$ns->tablerender(BANLAN_41, $text);
//XXX LAN - Import/Export
$ns->tablerender("Import/Export", $text);
break;
case 'list':
case 'white':
default:
if (($action != 'list') && ($action != 'white')) $action = 'list';
if(($action != 'list') && ($action != 'white'))
$action = 'list';
$edit_action = ($action == 'list' ? 'edit' : 'whedit');
$del_action = ($action == 'list' ? 'remove' : 'whremove');
$col_widths = array('list' => array(10, 5, 35, 30, 10, 10), 'white' => array(15, 40, 35, 10));
$col_titles = array('list' => array(BANLAN_17,BANLAN_20,BANLAN_10,BANLAN_19,BANLAN_18,LAN_OPTIONS),
'white' => array(BANLAN_55,BANLAN_56,BANLAN_19,LAN_OPTIONS));
$col_titles = array('list' => array(BANLAN_17, BANLAN_20, BANLAN_10, BANLAN_19, BANLAN_18, LAN_OPTIONS), 'white' => array(BANLAN_55, BANLAN_56, BANLAN_19, LAN_OPTIONS));
$no_values = array('list' => BANLAN_2, 'white' => BANLAN_54);
$col_defs = array('list' => array('banlist_datestamp'=>0,'banlist_bantype'=>0,'ip_reason'=>BANLAN_7,'banlist_notes'=>0,'banlist_banexpires'=>0,'ban_options'=>0),
'white' => array('banlist_datestamp'=>0,'ip_reason'=>BANLAN_57,'banlist_notes'=>0,'ban_options'=>0));
$col_defs = array('list' => array('banlist_datestamp' => 0, 'banlist_bantype' => 0, 'ip_reason' => BANLAN_7, 'banlist_notes' => 0, 'banlist_banexpires' => 0, 'ban_options' => 0), 'white' => array('banlist_datestamp' => 0, 'ip_reason' => BANLAN_57, 'banlist_notes' => 0, 'ban_options' => 0));
$text = "
<form method='post' action='" . e_SELF . '?' . $action . "' id='ban_form'>
<fieldset id='core-banlist'>
<legend class='e-hideme'>" . ($action == 'list' ? BANLAN_3 : BANLAN_61) . "</legend>
" . $frm->hidden("ban_secure", "1") . "
";
$text = $rs->form_open("post", e_SELF.'?'.$action, "ban_form")."<div style='text-align:center'>".$rs->form_hidden("ban_secure", "1");
$filter = ($action == 'white') ? 'banlist_bantype=' . BAN_TYPE_WHITELIST : 'banlist_bantype!=' . BAN_TYPE_WHITELIST;
if(! $ban_total = $sql->db_Select("banlist", "*", $filter . " ORDER BY banlist_ip"))
{
$text .= "<div style='text-align:center'>" . $no_values[$action] . "</div>";
}
else
{
$text .= "<table class='fborder' style='".ADMIN_WIDTH."'><colgroup>";
foreach($col_widths[$action] as $fw) $text .= "<col style='width:{$fw}%' />\n";
$text .= "</colgroup>\n<tr>";
foreach ($col_titles[$action] as $ct) $text .= "<td class='fcaption'>{$ct}</td>";
$text .= "</tr>";
$text .= "
<table cellpadding='0' cellspacing='0' class='adminlist'>
<colgroup span='" . count($col_widths[$action]) . "'>
";
foreach($col_widths[$action] as $fw)
{
$text .= "
<col style='width:{$fw}%' />
";
}
$text .= "
</colgroup>
<thead>
<tr>
";
$cnt = 0;
foreach($col_titles[$action] as $ct)
{
$cnt ++;
$text .= "
<th" . (($cnt == count($col_widths[$action])) ? " class='center last'" : "") . ">{$ct}</th>
";
}
$text .= "
</tr>
</thead>
<tbody>
";
while($row = $sql->db_Fetch())
{
extract($row);
$banlist_reason = str_replace("LAN_LOGIN_18", BANLAN_11, $banlist_reason);
$text .= "<tr>";
$text .= "
<tr>
";
foreach($col_defs[$action] as $cd => $fv)
{
$row_class = '';
switch($cd)
{
case 'banlist_datestamp':
@@ -594,11 +721,12 @@ switch ($action)
$val = $e107->ipDecode($banlist_ip) . "<br />" . $fv . ": " . $banlist_reason;
break;
case 'banlist_banexpires':
$val = ($banlist_banexpires ? strftime(BAN_TIME_FORMAT,$banlist_banexpires).(($banlist_banexpires < time()) ? ' ('.BANLAN_34.')' : '')
: BANLAN_21)."<br />".ban_time_dropdown("onchange=\"urljump('".e_SELF."?newtime-{$banlist_ip}-'+this.value)\"");
$val = ($banlist_banexpires ? strftime(BAN_TIME_FORMAT, $banlist_banexpires) . (($banlist_banexpires < time()) ? ' (' . BANLAN_34 . ')' : '') : BANLAN_21) . "<br />" . ban_time_dropdown("onchange=\"urljump('" . e_SELF . "?newtime-{$banlist_ip}-'+this.value)\"");
break;
case 'ban_options':
$val = "<a href='".e_SELF."?{$edit_action}-{$banlist_ip}'><img src='".$images_path."edit_16.png' alt='".LAN_EDIT."' title='".LAN_EDIT."' style='border:0px' /></a>
$row_class = ' class="center"';
$val = "
<a href='" . e_SELF . "?{$edit_action}-{$banlist_ip}'><img src='" . $images_path . "edit_16.png' alt='" . LAN_EDIT . "' title='" . LAN_EDIT . "' style='border:0px' /></a>
<input name='delete_ban_entry' type='image' src='" . $images_path . "delete_16.png' alt='" . LAN_DELETE . "' title='" . LAN_DELETE . "' style='border:0px'
onclick=\" var r = jsconfirm('" . $tp->toJS(LAN_CONFIRMDEL . " [" . $e107->ipDecode($banlist_ip) . "]") . "');
if (r) { document.getElementById('ban_form').action='" . e_SELF . "?{$del_action}-{$banlist_ip}'; } return r; \" />";
@@ -607,13 +735,25 @@ switch ($action)
default:
$val = $row[$cd];
}
$text .= "<td class='forumheader3'>{$val}</td>";
$text .= "
<td{$row_class}>{$val}</td>
";
}
$text .= '</tr>';
$text .= '
</tr>
';
}
$text .= "</table>\n";
$text .= "
</tbody>
</table>
";
}
$text .= "</div>".$rs->form_close();
$text .= "
</fieldset>
</form>
";
$ns->tablerender(($action == 'list' ? BANLAN_3 : BANLAN_61), $text);
// End of case 'list' and the default case
} // End switch ($action)
@@ -621,7 +761,6 @@ switch ($action)
require_once ("footer.php");
function banlist_adminmenu()
{
$action = (e_QUERY) ? e_QUERY : "list";
@@ -656,19 +795,17 @@ function banlist_adminmenu()
$var['options']['link'] = e_SELF . "?options";
$var['options']['perm'] = "0";
}
show_admin_menu(BANLAN_16, $action, $var);
e_admin_menu(BANLAN_16, $action, $var);
}
// Parse the date string used by the import/export - YYYYMMDD_HHMMSS
function parse_date($instr)
{
if (strlen($instr) != 15) return 0;
if(strlen($instr) != 15)
return 0;
return mktime(substr($instr, 9, 2), substr($instr, 11, 2), substr($instr, 13, 2), substr($instr, 4, 2), substr($instr, 6, 2), substr($instr, 0, 4));
}
// Process the imported CSV file, update the database, delete the file.
// Return a message
function process_csv($filename, $override_imports, $override_expiry, $separator = ',', $quote = '"')
@@ -676,7 +813,8 @@ function process_csv($filename, $override_imports, $override_expiry, $separator
global $sql, $pref, $e107;
// echo "Read CSV: {$filename} separator: {$separator}, quote: {$quote} override imports: {$override_imports} override expiry: {$override_expiry}<br />";
// Renumber imported bans
if ($override_imports) $sql->db_Update('banlist', "`banlist_bantype`=".BAN_TYPE_TEMPORARY." WHERE `banlist_bantype` = ".BAN_TYPE_IMPORTED);
if($override_imports)
$sql->db_Update('banlist', "`banlist_bantype`=" . BAN_TYPE_TEMPORARY . " WHERE `banlist_bantype` = " . BAN_TYPE_IMPORTED);
$temp = file($filename);
$line_num = 0;
foreach($temp as $line)
@@ -742,12 +880,12 @@ function process_csv($filename, $override_imports, $override_expiry, $separator
}
}
// Success here - may need to delete old imported bans
if ($override_imports) $sql->db_Delete('banlist', "`banlist_bantype` = ".BAN_TYPE_TEMPORARY);
if($override_imports)
$sql->db_Delete('banlist', "`banlist_bantype` = " . BAN_TYPE_TEMPORARY);
@unlink($filename); // Delete file once done
return str_replace('--NUM--', $line_num, BANLAN_51) . $filename;
}
// Log event to admin log
function banlist_adminlog($msg_num = '00', $woffle = '')
{

File diff suppressed because it is too large Load Diff

View File

@@ -9,8 +9,8 @@
* URL Management
*
* $Source: /cvs_backup/e107_0.8/e107_admin/eurl.php,v $
* $Revision: 1.6 $
* $Date: 2008-12-20 12:30:18 $
* $Revision: 1.7 $
* $Date: 2008-12-22 16:50:07 $
* $Author: secretr $
*/
@@ -215,7 +215,7 @@ class admin_url_config {
if($custom) $checked_profile = ' disabled="disabled"';
$config_profiles .= "
<input type='radio' class='radio' id='{$section['path']}-profile-{$config_profile}' name='cprofile[{$section['path']}]' value='{$profile_id}'{$checked_profile} /><label for='{$section['path']}-profile-{$config_profile}'>".LAN_EURL_PROFILE." [".varsettrue($profile_info['title'], $config_profile)."]</label>
<a href='#{$section['path']}-profile-{$config_profile}-info' class='e-expandit' title='".LAN_EURL_INFOALT."'><img src='".e_IMAGE_ABS."admin_images/docs_16.png' alt='' /></a>
<a href='#{$section['path']}-profile-{$config_profile}-info' class='e-expandit' title='".LAN_EURL_INFOALT."'><img class='icon action' src='".e_IMAGE_ABS."admin_images/docs_16.png' alt='' /></a>
<div class='e-hideme' id='{$section['path']}-profile-{$config_profile}-info'>
<div class='indent'>
".(varsettrue($profile_info['title']) ? '<strong>'.$profile_info['title'].'</strong><br /><br />' : '')."

View File

@@ -8,8 +8,8 @@
* e107 Admin Helper
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/admin.js,v $
* $Revision: 1.8 $
* $Date: 2008-12-21 11:47:29 $
* $Revision: 1.9 $
* $Date: 2008-12-22 16:50:07 $
* $Author: secretr $
*
*/
@@ -46,8 +46,11 @@ e107Admin.Helper = {
element.select('button.action[name=check_all]').invoke('observe', 'click', this.allCheckedEventHandler);
element.select('button.action[name=uncheck_all]').invoke('observe', 'click', this.allUncheckedEventHandler);
element.select('button.delete', 'input.delete[type=image]', 'a.delete').invoke('observe', 'click', function(e) {
if(e.element().hasClassName('no-confirm') || (e.element().readAttribute('rel') && e.element().readAttribute('rel').toLowerCase == 'no-confirm')) return;
var msg = e.element().readAttribute('title') || e107.getModLan('delete_confirm');
var el = e.findElement('a.delete');
if(!el) el = e.element();
if(!el) return;
if(el.hasClassName('no-confirm') || (el.readAttribute('rel') && el.readAttribute('rel').toLowerCase() == 'no-confirm')) return;
var msg = el.readAttribute('title') || e107.getModLan('delete_confirm');
if( !e107Helper.confirm(msg) ) e.stop();
});
},

View File

@@ -1,7 +1,7 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: lan_admin.php,v 1.14 2008-12-21 12:59:56 e107steved Exp $
* $Id: lan_admin.php,v 1.15 2008-12-22 16:50:07 secretr Exp $
*
* Admin Language File
*/
@@ -216,7 +216,7 @@ define("LAN_SAVE","Save");
define("LAN_SAVED","Saved");
define("LAN_SETSAVED","Your settings have been saved");
define("LAN_CONFIRMDEL","Please confirm you wish to delete");
define("LAN_JSCONFIRM","Please confirm you wish to delete");
define("LAN_JSCONFIRM","Are you sure?");
define("LAN_OPTIONS","Options");
define("LAN_PREFS","Preferences");
define("LAN_DELETED","Successfully deleted");

View File

@@ -1,15 +1,12 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_banner.php,v $
| $Revision: 1.2 $
| $Date: 2008-08-26 19:45:22 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: lan_banner.php,v 1.3 2008-12-22 16:50:07 secretr Exp $
*
* Administration Language File
*
*/
define("BNRLAN_1", "Banner deleted.");
define("BNRLAN_1", "Banner #%d deleted.");
define("BNRLAN_2", "Please confirm you wish to delete this banner - once deleted it cannot be retrieved");
define("BNRLAN_5", "Confirm Delete Banner");
define("BNRLAN_6", "Delete cancelled.");
@@ -27,11 +24,9 @@ define("BNRLAN_21", "Ends");
define("BNRLAN_22", "Update Banner");
define("BNRLAN_23", "Add New Banner");
define("BNRLAN_24", "Campaign");
define("BNRLAN_25", "choose existing campaign");
define("BNRLAN_26", "enter new campaign");
define("BNRLAN_27", "Client");
define("BNRLAN_28", "choose existing client");
define("BNRLAN_29", "enter new client");
define("BNRLAN_30", "Client Login");
define("BNRLAN_31", "Client Password");
define("BNRLAN_32", "Banner Image");
@@ -48,26 +43,38 @@ define("BNRLAN_42", "Banner Rotation System");
define("BNRLAN_43", "Choose banner image");
define("BNRLAN_45", "Starts");
define("BNRLAN_46", "Code");
define("BNRLAN_58", "banner front page");
define("BNRLAN_59", "create new banner");
define("BNRLAN_58", "Banner front page");
define("BNRLAN_59", "Create new banner");
define("BNRLAN_60", "campaigns");
define("BNRLAN_61", "banner menu ");
define("BNRLAN_62", "banner options");
define("BNRLAN_61", "Banner menu");
define("BNRLAN_62", "Banner Options");
define("BNRLAN_63", "Banner Created");
define("BNRLAN_64", "Banner Updated");
define("BANNER_MENU_L1", "Advertisement");
define("BANNER_MENU_L2", "Banner menu configuration saved");
define("BANNER_MENU_L3", "Caption");
define("BANNER_MENU_L5", "Banner Configuration");
//define("BANNER_MENU_L5", "Banner Configuration");
define("BANNER_MENU_L6", "choose campaigns to show in menu");
define("BANNER_MENU_L7", "available campaigns");
define("BANNER_MENU_L8", "selected campaigns");
define("BANNER_MENU_L9", "remove selection");
//define("BANNER_MENU_L7", "available campaigns");
//define("BANNER_MENU_L8", "selected campaigns");
//define("BANNER_MENU_L9", "remove selection");
define("BANNER_MENU_L10", "Render type");
//define("BANNER_MENU_L12", "plain");
//define("BANNER_MENU_L13", "in captioned box");
define("BANNER_MENU_L18", "Update Menu Settings");
define("BANNER_MENU_L19", "number of banners to show:<br />this is only used when multiple campaigns are selected");
define("BNRLAN_25", "add new or choose existing campaign");
define("BNRLAN_26", "enter new campaign");
define("BNRLAN_26a", "New Campaign");
define("BNRLAN_28", "add new or choose existing client");
define("BNRLAN_29", "enter new client");
define("BNRLAN_29a", "New Client");
define("BNRLAN_65", "Stats");
define("BNRLAN_66", "N/A");
define("BNRLAN_67", "No campaigns yet.");
define("BNRLAN_68", "Banner Menu Configuration");
?>

View File

@@ -1,23 +1,29 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/banner_menu/config.php,v $
| $Revision: 1.3 $
| $Date: 2008-12-08 22:23:53 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Banner Menu Configuration (OLD - redirects to e107_admin/banner.php)
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/banner_menu/config.php,v $
* $Revision: 1.4 $
* $Date: 2008-12-22 16:50:07 $
* $Author: secretr $
*
*/
$eplug_admin = TRUE;
require_once("../../class2.php");
/*
* The same, cleaned up code is already part of banner.php
* FIXME - we should be able to combine all core menus in a nice way... somehow
*/
header('Location:'.e_ADMIN_ABS.'banner.php?menu');
exit;
if (!getperms("1")) // Access to those who can change prefs, theme etc
{
header("location:".e_BASE."index.php");

View File

@@ -328,7 +328,6 @@ input.action.edit {}
.admin-page-body { padding: 20px 15px 0; }
.admin-footer {}
legend { font-size: 14px; font-weight: bold; padding: 5px; }
.admin-help p { margin-bottom: 10px } /* help side menu */
/******** Layout */
.main-table { width: 100%; border: 0 none; }