r180 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r179‎ | r180 | r181 >
Date:21:05, 20 February 2002
Author:magnus_manske
Status:old
Tags:
Comment:
blocking IPs, part 2 of 3
Modified paths:
  • /trunk/phpwiki/fpw/special_blockip.php (added) (history)
  • /trunk/phpwiki/fpw/wikiPage.php (modified) (history)
  • /trunk/phpwiki/fpw/wikiTextEn.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/fpw/wikiPage.php
@@ -28,7 +28,10 @@
2929 $this->revision = "current" ;
3030 if ( $this->namespace == "special" ) { # Special page, calling appropriate function
3131 $allowed = $wikiAllowedSpecialPages ; # List of allowed special pages
32 - if ( in_array ( "is_sysop" , $user->rights ) ) array_push ( $allowed , "asksql" ) ; # Another function just for sysops
 32+ if ( in_array ( "is_sysop" , $user->rights ) ) { # Functions just for sysops
 33+ array_push ( $allowed , "asksql" ) ;
 34+ array_push ( $allowed , "blockip" ) ;
 35+ }
3336 $call = $this->mainTitle ;
3437 if ( !in_array ( strtolower ( $call ) , $allowed ) ) {
3538 $this->isSpecialPage = true ;
Index: trunk/phpwiki/fpw/wikiTextEn.php
@@ -93,6 +93,8 @@
9494 $wikiCategories = "<b>Categories :</b> " ;
9595 $wikiThisCategory = "Articles in this category" ;
9696 $wikiCounter = "This page has been accessed $1 times." ;
 97+$wikiBlockIPTitle = "Block an IP (sysops only)" ;
 98+$wikiBlockIPText = "IP $1 was blocked by $2" ;
9799
98100 # Interwiki links
99101 $wikiInterwiki = array ( "w"=>"http://www.wikipedia.com/wiki/$1" , "m"=>"http://meta.wikipedia.com/wiki.phtml?title=$1" ) ;
Index: trunk/phpwiki/fpw/special_blockip.php
@@ -0,0 +1,19 @@
 2+<?
 3+include_once ( "special_makelog.php" ) ;
 4+
 5+function blockIP () {
 6+ global $target , $vpage , $wikiBlockIPTitle ,
 7+ $wikiBlockIPText , $user ;
 8+ $vpage->special ( $wikiBlockIPTitle ) ;
 9+
 10+ global $REMODE_ADDR ;
 11+# $now = date ( "Y-m-d H:i:s" , time () ) ;
 12+# $userText = "[[$wikiUser:$user->name|$user->name]]" ;
 13+ $logText = "$target (".time().")" ;
 14+ $line = str_replace ( array("$1","$2") ,
 15+ array($target,$user->name) , $wikiBlockIPText ) ;
 16+ makeLog ( "wikipedia:Blocked IPs" , "*$logText : $line\n" , $line ) ;
 17+
 18+ return "<font size='+3' color=red>$line</font>" ;
 19+ }
 20+?>
Property changes on: trunk/phpwiki/fpw/special_blockip.php
___________________________________________________________________
Added: svn:eol-style
121 + native
Added: svn:keywords
222 + Author Date Id Revision

Status & tagging log