Index: trunk/phpwiki/fpw/basicFunctions.php |
— | — | @@ -60,10 +60,17 @@ |
61 | 61 | return strtr ( $str , $wikiUpperChars , $wikiLowerChars ); |
62 | 62 | } |
63 | 63 | |
| 64 | +function isBlockedIP () { |
| 65 | + $ip = getenv ( REMOTE_ADDR ) ; |
| 66 | + $list = getMySQL ( "cur" , "cur_text" , "cur_title=\"Wikipedia:Blocked_IPs\"" ) ; |
| 67 | + $list = explode ( "*$ip (" , $list ) ; # The most memory-wasting substring search ever! |
| 68 | + if ( count ( $list ) > 1 ) return true ; |
| 69 | + return false ; |
| 70 | + } |
64 | 71 | |
65 | 72 | # Called when editing/saving a page |
66 | 73 | function edit ( $title ) { |
67 | | - global $EditBox , $SaveButton , $PreviewButton , $MinorEdit , $FromEditForm ; |
| 74 | + global $EditBox , $SaveButton , $PreviewButton , $MinorEdit , $FromEditForm , $wikiIPblocked ; |
68 | 75 | global $user , $CommentBox , $vpage , $EditTime , $wikiDescribePage , $wikiUser ; |
69 | 76 | global $wikiCannotEditPage , $wikiEditConflictMessage , $wikiPreviewAppend , $wikiEditHelp , $wikiRecodeInput ; |
70 | 77 | global $wikiSummary , $wikiMinorEdit , $wikiCopyrightNotice , $wikiSave , $wikiPreview , $wikiDontSaveChanges ; |
— | — | @@ -101,12 +108,10 @@ |
102 | 109 | $editConflict = true ; |
103 | 110 | } |
104 | 111 | } |
105 | | - if ( $doSave ) { |
| 112 | + if ( $doSave ) { # Actually saving the article! |
106 | 113 | $text = $EditBox ; |
107 | 114 | $text = str_replace ( "\\'" , "'" , $text ) ; |
108 | 115 | $text = str_replace ( "\\\"" , "\"" , $text ) ; |
109 | | -# $text = urldecode ( $text ) ; |
110 | | -# $text = str_replace ( "&" , "&" , $text ) ; |
111 | 116 | if ( $user->isLoggedIn ) $text = str_replace ( "~~~" , "[[$wikiUser:$user->name|$user->name]]" , $text ) ; |
112 | 117 | else $text = str_replace ( "~~~" , $user->getLink() , $text ) ; |
113 | 118 | $title = str_replace ( "\\'" , "'" , $title ) ; |
— | — | @@ -116,6 +121,10 @@ |
117 | 122 | $npage->makeAll () ; |
118 | 123 | if ( $npage->doesTopicExist() ) $npage->backup() ; |
119 | 124 | else { $MinorEdit = 2 ; $npage->ensureExistence () ; } |
| 125 | + |
| 126 | + # Checking for blocked IP |
| 127 | + if ( isBlockedIP() ) return $wikiIPblocked ; |
| 128 | + |
120 | 129 | if ( !$user->isLoggedIn ) $npage->setEntry ( $text , $CommentBox , 0 , $user->getLink() , $MinorEdit*1 ) ; |
121 | 130 | else $npage->setEntry ( $text , $CommentBox , $user->id , $user->name , $MinorEdit*1 ) ; |
122 | 131 | global $wasSaved ; |
Index: trunk/phpwiki/fpw/wikiTextEn.php |
— | — | @@ -95,6 +95,7 @@ |
96 | 96 | $wikiCounter = "This page has been accessed $1 times." ; |
97 | 97 | $wikiBlockIPTitle = "Block an IP (sysops only)" ; |
98 | 98 | $wikiBlockIPText = "IP $1 was blocked by $2" ; |
| 99 | +$wikiIPblocked = "<font color=red size='+1'>Your IP has been blocked! Your edits will not be saved. Please contact a sysop to have the block removed, or try again later.</font>" ; |
99 | 100 | |
100 | 101 | # Interwiki links |
101 | 102 | $wikiInterwiki = array ( "w"=>"http://www.wikipedia.com/wiki/$1" , "m"=>"http://meta.wikipedia.com/wiki.phtml?title=$1" ) ; |