[Openupload-svn-update] SF.net SVN: openupload:[63] trunk
Status: Beta
Brought to you by:
tsdogs
|
From: <ts...@us...> - 2008-10-23 10:34:22
|
Revision: 63
http://openupload.svn.sourceforge.net/openupload/?rev=63&view=rev
Author: tsdogs
Date: 2008-10-23 10:30:01 +0000 (Thu, 23 Oct 2008)
Log Message:
-----------
remove banned plugin
Modified Paths:
--------------
trunk/www/config.inc.php.example
Added Paths:
-----------
trunk/www/templates/default/img/admin/banned.png
trunk/www/templates/default/img/admin/tadd.png
Removed Paths:
-------------
trunk/plugins/banned.inc.php
trunk/templates/default/plugins/banned/
Deleted: trunk/plugins/banned.inc.php
===================================================================
--- trunk/plugins/banned.inc.php 2008-10-23 10:29:08 UTC (rev 62)
+++ trunk/plugins/banned.inc.php 2008-10-23 10:30:01 UTC (rev 63)
@@ -1,109 +0,0 @@
-<?php
-
-
-class BannedPlugin extends OpenUploadPlugin {
-
- function BannedPlugin() {
- }
-
- function init() {
- global $_SERVER;
-
- $this->banned = app()->db->read('banned',array(),array('priority'));
- /* now check if the ip has been banned display the banned template */
- foreach ($this->banned as $row) {
- if ($this->matchIP($_SERVER['REMOTE_ADDR'],$row['ip'])) {
- if ($row['access']!='allow') {
- $this->banned();
- } else {
- return;
- }
- }
- }
- /* no match has been found */
- $this->banned();
- }
-
- function banned() {
-
- $this->display('banned');
- app()->page['content'] = $this->pluginHTML;
- app()->page['title']= tr('IP Banned');
- app()->tpl->assign('page',app()->page);
- app()->display(app()->mainPage);
- exit;
- }
-
- function convertSubnet($val) {
- $sub = array();
- if ($val<0) $val = 0;
- if ($val>32) $val = 32;
- for ($i=0; $i<4; $i++) {
- $x = 0; /* could be done with a for... */
- if ($val>0) $x += 128;
- if ($val>1) $x += 64;
- if ($val>2) $x += 32;
- if ($val>3) $x += 16;
- if ($val>4) $x += 8;
- if ($val>5) $x += 4;
- if ($val>6) $x += 2;
- if ($val>7) $x += 1;
- $sub[$i] = $x;
- $val = $val - 8;
- }
- return $sub;
- }
-
- function matchIP($sip,$exp) {
- if (strpos($exp,'/')!==FALSE) {
- $x = explode('/',$exp);
- $net = $x[0];
- $sub = $x[1];
- if (strpos($sub,'.')===FALSE) {
- /* it's a single number convert to subnet mask*/
- $sub = $this->convertSubnet($sub);
- } else {
- $sub = explode('.',$sub);
- }
- } else { /* single ip */
- $net = $exp;
- $sub = array(255,255,255,255);
- }
- $ip = explode('.',$sip);
- $net = explode('.',$net);
-
- /* now do the match */
- $mip[0] = $ip[0] & $sub[0];
- $mip[1] = $ip[1] & $sub[1];
- $mip[2] = $ip[2] & $sub[2];
- $mip[3] = $ip[3] & $sub[3];
- $dip[0] = $net[0] & $sub[0];
- $dip[1] = $net[1] & $sub[1];
- $dip[2] = $net[2] & $sub[2];
- $dip[3] = $net[3] & $sub[3];
- if (($mip[0] == $dip[0]) and ($mip[1] == $dip[1]) and
- ($mip[2] == $dip[2]) and ($mip[3] == $dip[3]))
- return true;
- else
- return false;
- }
-
- function fileaction() {
- global $_GET;
- if (isset($_GET['ip'])) {
- $ban = app()->db->read('banned',array('ip' => $_GET['ip']));
- $ban = $ban[0];
- if ($ban['ip']!=$_GET['ip']) {
- $ban['id']='';
- $ban['priority']='1'; /* maybe a bigger one is better */
- $ban['ip']=$_GET['ip'];
- $ban['access']='deny';
- app()->db->insertRecord('banned',$ban);
- app()->message(tr('IP %1 has been banned!',$_GET['ip']));
- } else {
- app()->error(tr('IP %1 was already in state: %2!',$_GET['ip'],$ban['access']));
- }
- }
- }
-}
-?>
\ No newline at end of file
Modified: trunk/www/config.inc.php.example
===================================================================
--- trunk/www/config.inc.php.example 2008-10-23 10:29:08 UTC (rev 62)
+++ trunk/www/config.inc.php.example 2008-10-23 10:30:01 UTC (rev 63)
@@ -43,7 +43,6 @@
* they will need to enable the functionality
* on a group basis
*/
-$CONFIG['plugins'][] = 'banned';
$CONFIG['plugins'][] = 'mimetypes';
$CONFIG['plugins'][] = 'email';
$CONFIG['plugins'][] = 'password';
Added: trunk/www/templates/default/img/admin/banned.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/banned.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/tadd.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/tadd.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|