190 lines
6.2 KiB
PHP
190 lines
6.2 KiB
PHP
<?php
|
|
/**
|
|
* Project: astat - simple site engine
|
|
* File: /admin/editusers.apnl.php
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
* @link http://www.astat.org SVN: $URL$
|
|
* @copyright 2009 becast.at
|
|
* @author Bernhard Jaud <bernhard at becast dot at>
|
|
* @package astat core
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
* @version $Id$
|
|
*/
|
|
If (!defined("in_BL_ADMIN")) {
|
|
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
|
|
}
|
|
$addnav["right"]=FALSE;
|
|
$session->page_begin("edituser", True);
|
|
|
|
|
|
class banips_panel extends admin_module{
|
|
|
|
function output(){
|
|
global $plugin,$session,$config,$db,$panel,$admin,$module,$root,$firephp,$lang;
|
|
if(isset($_GET['action']) && $_GET['action']=='add'){
|
|
if(isset($_POST['send']) && !empty($_POST['ip'])){
|
|
$db->query("INSERT INTO `" . $config["prefix"] . "banned_ips` (`ip`,`date`,`reason`) VALUES ('".$db->escape($_POST['ip'])."','".time()."','".$db->escape($_POST["reason"])."')");
|
|
$panel->admin_message($lang->_('SUCCESS'),$lang->_('DATASAVED'),True,"banips",3);
|
|
}
|
|
}elseif($_GET["action"]=='delete' && $_GET['id']){
|
|
$db->query("DELETE FROM `" . $config["prefix"] . "banned_ips` WHERE `id`='".intval($_GET['id'])."'");
|
|
$panel->admin_message("Ban lifted","The ban was lifted.",True,"banips",3);
|
|
}else{
|
|
|
|
$left="";
|
|
$right="";
|
|
$asmodule="";
|
|
$mainmodule="";
|
|
$result=$db->query("SELECT * FROM `" . $config["prefix"] . "banned_ips`");
|
|
while ($row = $db->fetch_array($result)){
|
|
$ips[]=$row;
|
|
}
|
|
$panel->title=$lang->_('BANNEDIPS');
|
|
$panel->content.="<table class=\"sortable\" width=\"90%\" cellspacing=\"2\">
|
|
<tr>
|
|
<th align=\"center\">".$lang->_('ID')."</th>
|
|
<th class=\"sortable-text\" align=\"center\">".$lang->_('IP')."</th>
|
|
<th align=\"center\">".$lang->_('DATE')."</th>
|
|
<th align=\"center\">".$lang->_('REASON')."</th>
|
|
<th class=\"nosort\" align=\"center\">".$lang->_('ACTION')."</th>
|
|
</tr>";
|
|
if(!empty($ips)){
|
|
foreach($ips as $i){
|
|
$panel->content.="<tr>
|
|
<td align=\"center\">".$i['id']."</td>
|
|
<td align=\"center\">".$i['ip']."</td>
|
|
<td align=\"center\">".date('d.m.Y, H:i',$i['date'])."</td>
|
|
<td align=\"center\">".$i['reason']."</td>";
|
|
$panel->content.="<td align=\"center\"><a onclick=\"return confirmLink(this, 'Delete this ban?')\" href=\"".$config["path"]."/admin/index.php?panel=banips&action=delete&id=".$i["id"]."\"><img src=\"".$config["path"]."/admin/images/icons/delete.png\" /></a></td>
|
|
</tr>";
|
|
}
|
|
}else{
|
|
$panel->content.="<tr>
|
|
<td align=\"center\" colspan=\"5\">".$lang->_('NOBANNEDIPS')."</td>
|
|
</tr>";
|
|
}
|
|
$panel->content.="</table><br />";
|
|
$panel->form(array("action"=>$config["path"]."/admin/index.php?panel=banips&action=add"));
|
|
$panel->content.="<h3>".$lang->_('IP').":</h3>";
|
|
$panel->field(array("name"=>"ip","typ"=>"text"));
|
|
$panel->content.="<h3>".$lang->_('REASON')."</h3>";
|
|
$panel->textarea(array("name"=>"reason","typ"=>"text"));
|
|
$panel->content.="<br />";
|
|
$panel->field(array("name"=>"send","typ"=>"hidden","value"=>"1"));
|
|
$panel->content.="<br />";
|
|
$panel->submit();
|
|
$panel->formClose();
|
|
$panel->parse_page();
|
|
}
|
|
}
|
|
|
|
function meta() {
|
|
global $module,$config,$db,$panel,$userinfo,$admin,$root;
|
|
$meta='<script type="text/javascript" src="'.$config["path"].'/js/scriptaculous/prototype.js"></script>
|
|
<script src="'.$config["path"].'/js/fastinit.js" type="text/javascript">
|
|
</script>
|
|
<script src="'.$config["path"].'/js/tablesort.js" type="text/javascript">
|
|
</script>
|
|
<script type="text/javascript">
|
|
function deleteItem(item) {
|
|
if(confirmLink(this, "Willst du wirklich dieses Modul deinstallieren? Alle Daten diese Moduls werden gelöscht!")==true){
|
|
name="id_"+item;
|
|
Effect.SwitchOff(name);
|
|
new Ajax.Request(\'index.php?panel=navigation\' , {
|
|
method: "post",
|
|
parameters: {delete:name}});
|
|
}
|
|
return false;
|
|
}
|
|
|
|
</script>
|
|
<style type="text/css">
|
|
.loadlayer {
|
|
position: absolute;
|
|
padding: 15px;
|
|
width: 250px;
|
|
background: #ffffff;
|
|
border: 3px solid #c90000;
|
|
text-align: center;
|
|
margin-top: 60px;
|
|
left: 50%;
|
|
margin-left: -150px;
|
|
margin-top: 100px;
|
|
font-weight: bold;
|
|
z-index:5;
|
|
}
|
|
div.section,div#createNew {
|
|
border: 1px solid #CCCCCC;
|
|
margin: 30px 5px;
|
|
padding: 0px 0px 10px 0px;
|
|
background-color: #EFEFEF;
|
|
}
|
|
|
|
div#createNew input { margin-left: 5px; }
|
|
|
|
div#createNew h3, div.section h3{
|
|
font-size: 14px;
|
|
padding: 2px 5px;
|
|
margin: 0 0 10px 0;
|
|
background-color: #CCCCCC;
|
|
display: block;
|
|
}
|
|
|
|
div.section h3 {
|
|
cursor: move;
|
|
}
|
|
|
|
div.lineitem {
|
|
margin: 3px 10px;
|
|
padding: 2px;
|
|
background-color: #FFFFFF;
|
|
cursor: move;
|
|
}
|
|
|
|
h1 {
|
|
margin-bottom: 0;
|
|
font-size: 18px;
|
|
}
|
|
</style>
|
|
<script type="text/javascript">
|
|
function confirmLink(theLink, text)
|
|
{
|
|
// Confirmation is not required in the configuration file
|
|
// or browser is Opera (crappy js implementation)
|
|
if (typeof(window.opera) != \'undefined\') {
|
|
return true;
|
|
}
|
|
|
|
var is_confirmed = confirm(text);
|
|
if (is_confirmed) {
|
|
if ( typeof(theLink.href) != \'undefined\' ) {
|
|
theLink.href += \'&is_js_confirmed=1\';
|
|
} else if ( typeof(theLink.form) != \'undefined\' ) {
|
|
theLink.form.action += \'?is_js_confirmed=1\';
|
|
}
|
|
}
|
|
|
|
return is_confirmed;
|
|
}
|
|
</script>';
|
|
return $meta;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
?>
|