r417 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r416‎ | r417 | r418 >
Date:23:43, 22 May 2002
Author:lcrocker
Status:old
Tags:
Comment:
Updated namespace fields to integer.
Modified paths:
  • /trunk/phpwiki/newcodebase/Article.php (modified) (history)
  • /trunk/phpwiki/newcodebase/GlobalFunctions.php (modified) (history)
  • /trunk/phpwiki/newcodebase/Language.php (modified) (history)
  • /trunk/phpwiki/newcodebase/LocalSettings.php (modified) (history)
  • /trunk/phpwiki/newcodebase/OutputPage.php (modified) (history)
  • /trunk/phpwiki/newcodebase/Skin.php (modified) (history)
  • /trunk/phpwiki/newcodebase/SpecialUserlogin.php (modified) (history)
  • /trunk/phpwiki/newcodebase/SpecialUserlogout.php (modified) (history)
  • /trunk/phpwiki/newcodebase/Title.php (modified) (history)
  • /trunk/phpwiki/newcodebase/User.php (modified) (history)
  • /trunk/phpwiki/newcodebase/sql/buildtables.sql (modified) (history)
  • /trunk/phpwiki/newcodebase/sql/convertdb.php (modified) (history)
  • /trunk/phpwiki/newcodebase/wiki.phtml (modified) (history)

Diff [purge]

Index: trunk/phpwiki/newcodebase/GlobalFunctions.php
@@ -48,10 +48,12 @@
4949
5050 function wfDebug( $text )
5151 {
52 - global $wgOut;
 52+ global $wgOut, $wgDebugLogFile;
5353 $wgOut->debug( $text );
5454
55 - error_log( $text, 3, "/var/www/html/newwiki/logfile" );
 55+ if ( "" != $wgDebugLogFile ) {
 56+ error_log( $text, 3, $wgDebugLogFile );
 57+ }
5658 }
5759
5860 function wfMsg( $key )
Index: trunk/phpwiki/newcodebase/Skin.php
@@ -48,7 +48,7 @@
4949 {
5050 global $wgTitle, $wgNamespaceBackgrounds;
5151
52 - $ns = $wgTitle->getNamespace();
 52+ $ns = Namespace::getName( $wgTitle->getNamespace() );
5353
5454 if ( "" != $ns && key_exists( $ns, $wgNamespaceBackgrounds ) ) {
5555 return array( "bgcolor" => $wgNamespaceBackgrounds[$ns] );
@@ -376,34 +376,25 @@
377377 {
378378 global $wgTitle;
379379
380 - $ns = $wgTitle->getNamespace();
 380+ $tns = $wgTitle->getNamespace();
 381+ if ( -1 == $tns ) { return ""; }
 382+
381383 $pn = $wgTitle->getText();
382384 $tp = wfMsg( "talkpage" );
383385 $sp = wfMsg( "subjectpage" );
384386
385 - if ( "" == $ns ) {
386 - $link = "Talk:$pn";
387 - $text = $tp;
388 - } else if ( "Talk" == $ns ) {
389 - $link = $pn;
 387+ if ( Namespace::isTalk( $tns ) ) {
 388+ $lns = Namespace::getSubject( $tns );
390389 $text = $sp;
391390 } else {
392 - $tail = substr( $ns, -5 );
393 - if ( "_talk" == $tail ) {
394 - $n = substr( $ns, 0, strlen( $ns ) - 5 );
395 - $link = "$n:$pn";
396 - $text = $sp;
397 - } else {
398 - $link = "{$ns}_talk:$pn";
399 - $text = $tp;
400 - }
 391+ $lns = Namespace::getTalk( $tns );
 392+ $text = $tp;
401393 }
402 - $nt = Title::newFromText( $link );
403 - if ( 0 == $nt->getArticleID() ) {
404 - $s = $this->makeBrokenLink( $link, $text );
405 - } else {
406 - $s = $this->makeLink( $link, $text );
407 - }
 394+ $n = Namespace::getName( $lns );
 395+ if ( "" == $n ) { $link = $pn; }
 396+ else { $link = "$n:$pn"; }
 397+
 398+ $s = $this->makeInternalLink( $link, $text );
408399 return $s;
409400 }
410401
@@ -415,12 +406,11 @@
416407 return $text;
417408 }
418409
419 - function makeInternalLink( $title, $text= "", $action = "", $target = "",
420 - $trail = "" )
 410+ function makeInternalLink( $title, $text= "", $query = "", $trail = "" )
421411 {
422412 $nt = Title::newFromText( $title );
423 - if ( "Special" == $nt->getNamespace() ) {
424 - return $this->makeLink( $title, $text );
 413+ if ( -1 == $nt->getNamespace() ) {
 414+ return $this->makeLink( $title, $text, $query, $trail );
425415 }
426416 if ( 0 == $nt->getArticleID() ) {
427417 return $this->makeBrokenLink( $title, $text ) . $trail;
Index: trunk/phpwiki/newcodebase/sql/buildtables.sql
@@ -7,7 +7,7 @@
88
99 CREATE TABLE cur (
1010 cur_id mediumint(8) unsigned NOT NULL auto_increment,
11 - cur_namespace varchar(20) binary NOT NULL default '',
 11+ cur_namespace tinyint(2) unsigned NOT NULL default '0',
1212 cur_title varchar(255) binary NOT NULL default '',
1313 cur_text mediumtext,
1414 cur_comment tinyblob,
@@ -21,6 +21,7 @@
2222 cur_counter bigint(20) unsigned default '0',
2323 cur_cache mediumtext,
2424 cur_ind_title varchar(255) default NULL,
 25+ INDEX cur_namespace (cur_namespace),
2526 INDEX cur_title (cur_title),
2627 UNIQUE KEY cur_id (cur_id),
2728 INDEX timeind (cur_timestamp),
@@ -45,7 +46,7 @@
4647
4748 CREATE TABLE old (
4849 old_id mediumint(8) unsigned NOT NULL auto_increment,
49 - old_namespace varchar(20) binary NOT NULL default '',
 50+ old_namespace tinyint(2) unsigned NOT NULL default '0',
5051 old_title varchar(255) binary NOT NULL default '',
5152 old_text mediumtext,
5253 old_comment tinyblob,
Index: trunk/phpwiki/newcodebase/sql/convertdb.php
@@ -3,6 +3,8 @@
44 # database into the format for the "newwiki" software.
55 # Intended to be run from the php command line.
66 #
 7+include_once( "../Namespace.php" );
 8+
79 $DBserver = "127.0.0.1";
810 $DBname = "wikidb";
911 $DBuser = "wikiuser";
@@ -19,6 +21,7 @@
2022
2123 set_time_limit(0);
2224
 25+
2326 # USER
2427 #
2528 print "Converting USER table.\n";
@@ -38,6 +41,8 @@
3942 } else {
4043 fwrite( $outf, "," );
4144 }
 45+ # Need to do some tweaking of options here
 46+ #
4247 $ops = strencode(urldecode($row->user_options));
4348 $name = strencode($row->user_name);
4449 $rights = strencode($row->user_rights);
@@ -53,10 +58,9 @@
5459 fwrite( $outf, ";\n" );
5560 p_end();
5661
57 -
5862 # CUR
5963 #
60 -/*
 64+
6165 print "Converting CUR table.\n";
6266 $sql = "SELECT * FROM cur";
6367 $res = mysql_query( $sql, $conn );
@@ -84,7 +88,7 @@
8589 $ns = "";
8690 $t = $row->cur_title;
8791 }
88 - $namespace = strencode( $ns );
 92+ $namespace = Namespace::getIndex( $ns );
8993 $title = strencode( $t );
9094 $text = strencode( $row->cur_text );
9195 $com = strencode( $row->cur_comment );
@@ -93,7 +97,7 @@
9498 $cp = strencode( $row->cur_params );
9599 $cit = strencode( $row->cur_ind_title );
96100
97 - fwrite( $outf, "({$row->cur_id},'$namespace','$title','$text'," .
 101+ fwrite( $outf, "({$row->cur_id},$namespace,'$title','$text'," .
98102 "'$com',{$row->cur_user},'$cut',{$row->cur_old_version}," .
99103 "'{$row->cur_timestamp}',{$row->cur_minor_edit},'$cr','$cp'," .
100104 "{$row->cur_counter},'$cit')" );
@@ -102,8 +106,52 @@
103107 mysql_free_result( $res );
104108 fwrite( $outf, ";\n" );
105109 p_end();
106 -*/
107110
 111+# OLD
 112+#
 113+
 114+print "Converting OLD table.\n";
 115+$sql = "SELECT * FROM old";
 116+$res = mysql_query( $sql, $conn );
 117+if ( ! $res ) die( "Can't open \"old\" table." );
 118+
 119+p_start();
 120+while ( $row = mysql_fetch_object( $res ) ) {
 121+
 122+ if ( 0 == ( $progressCount % 100 ) ) {
 123+ if ( 0 != $progressCount ) { fwrite( $outf, ";\n" ) ; }
 124+
 125+ fwrite( $outf, "INSERT INTO old (old_id,old_namespace," .
 126+ "old_title,old_text,old_comment,old_user,old_user_text," .
 127+ "old_old_version,old_timestamp,old_minor_edit) VALUES " );
 128+ } else {
 129+ fwrite( $outf, "," );
 130+ }
 131+ if ( preg_match( "/^([A-Za-z][A-Za-z0-9 _]*):(.*)$/",
 132+ $row->old_title, $m ) ) {
 133+ $ns = $m[1];
 134+ $t = $m[2];
 135+ } else {
 136+ $ns = "";
 137+ $t = $row->old_title;
 138+ }
 139+ $namespace = Namespace::getIndex( $ns );
 140+ $title = strencode( $t );
 141+ $text = strencode( $row->old_text );
 142+ $com = strencode( $row->old_comment );
 143+ $cut = strencode( $row->old_user_text );
 144+
 145+ fwrite( $outf, "({$row->old_id},$namespace,'$title','$text'," .
 146+ "'$com',{$row->old_user},'$cut',{$row->old_old_version}," .
 147+ "'{$row->old_timestamp}',{$row->old_minor_edit} )" );
 148+ progress();
 149+}
 150+mysql_free_result( $res );
 151+fwrite( $outf, ";\n" );
 152+p_end();
 153+
 154+
 155+
108156 fclose( $outf );
109157
110158 # All done
Index: trunk/phpwiki/newcodebase/SpecialUserlogout.php
@@ -8,14 +8,7 @@
99 $wgOut->setPageTitle( wfMsg( "userlogout" ) );
1010 $wgOut->setRobotpolicy( "noindex,nofollow" );
1111 $wgOut->addHTML( wfMsg( "logouttext" ) . "\n<p>" );
12 -
13 - if ( "" == $returnto ) {
14 - $r = wfMsg( "returntomain" );
15 - } else {
16 - $r = str_replace( "$1", $returnto, wfMsg( "returnto" ) );
17 - $wgOut->addMeta( "http:Refresh", "5;url=" . wfLocalLink( $returnto ) );
18 - }
19 - $wgOut->addWikiText( $r );
 12+ $wgOut->returnToMain();
2013 }
2114
2215 ?>
Index: trunk/phpwiki/newcodebase/User.php
@@ -65,26 +65,19 @@
6666
6767 $remaddr = getenv( "REMOTE_ADDR" );
6868 $conn = wfGetDB();
69 - $sql = "SELECT ipb_by,ipb_reason FROM ipblocks WHERE " .
70 - "ipb_address='$remaddr'";
 69+ if ( 0 == $this->mId ) {
 70+ $sql = "SELECT ipb_by,ipb_reason FROM ipblocks WHERE " .
 71+ "ipb_address='$remaddr'";
 72+ } else {
 73+ $sql = "SELECT ipb_by,ipb_reason FROM ipblocks WHERE " .
 74+ "(ipb_address='$remaddr' OR ipb_user={$this->mId})";
 75+ }
7176 wfDebug( "User: 5: $sql\n" );
7277
7378 $res = mysql_query( $sql, $conn );
7479 if ( ( false === $res ) || ( 0 == mysql_num_rows( $res ) ) ) {
75 - if ( 0 == $this->mId ) {
76 - $this->mBlockedby = 0;
77 - return;
78 - }
79 - $conn = wfGetDB();
80 - $sql = "SELECT ipb_by,ipb_reason FROM ipblocks WHERE " .
81 - "ipb_user={$this->mId}";
82 - wfDebug( "User: 6: $sql\n" );
83 -
84 - $res = mysql_query( $sql, $conn );
85 - if ( ( false === $res ) || ( 0 == mysql_num_rows( $res ) ) ) {
86 - $this->mBlockedby = 0;
87 - return;
88 - }
 80+ $this->mBlockedby = 0;
 81+ return;
8982 }
9083 $s = mysql_fetch_object( $res );
9184 $this->mBlockedby = $s->ipb_by;
Index: trunk/phpwiki/newcodebase/Language.php
@@ -72,6 +72,10 @@
7373 "noconnect" => "Could not connect to DB on $1",
7474 "nodb" => "Could not select database $1",
7575 "updatingarticle" => "updating an article",
 76+"readonly" => "Database locked",
 77+"readonlytext" => "The Wikipedia database is currently locked to
 78+new entries, probably because of database maintenance.
 79+Please try again later.\n",
7680
7781 # Login and logout pages
7882 #
Index: trunk/phpwiki/newcodebase/OutputPage.php
@@ -108,7 +108,7 @@
109109
110110 $this->mBodytext = "";
111111 $this->addHTML( "<p>" . wfMsg( $msg ) . "\n" );
112 - $this->addWikiText( "\n" . wfMsg( "returntomain" ) . "\n" );
 112+ $this->returnToMain();
113113 }
114114
115115 function databaseError( $op )
@@ -119,9 +119,23 @@
120120 $this->setRobotpolicy( "noindex,nofollow" );
121121
122122 $this->mBodytext = str_replace( "$1", $op, wfMsg( "dberrortext" ) );
123 - $this->addWikiText( "\n" . wfMsg( "returntomain" ) . "\n" );
 123+ $this->returnToMain();
124124 }
125125
 126+ function returnToMain()
 127+ {
 128+ global $wgOut, $returnto;
 129+
 130+ if ( "" == $returnto ) {
 131+ $r = wfMsg( "returntomain" );
 132+ } else {
 133+ $r = str_replace( "$1", $returnto, wfMsg( "returnto" ) );
 134+ $wgOut->addMeta( "http:Refresh", "10;url=" .
 135+ wfLocalLink( $returnto ) );
 136+ }
 137+ $wgOut->addWikiText( "\n<p>$r\n" );
 138+ }
 139+
126140 # Well, OK, it's actually about 14 passes. But since all the
127141 # hard lifting is done inside PHP's regex code, it probably
128142 # wouldn't speed things up much to add a real parser.
@@ -307,14 +321,14 @@
308322 $l = $wgLang->getLanguageName( $pre );
309323 if ( "" == $l ) {
310324 $s .= $sk->makeInternalLink( $link, $text,
311 - "", "", $trail );
 325+ "", $trail );
312326 } else {
313327 array_push( $this->mLanguageLinks, "$pre:$suf" );
314328 $s .= $trail;
315329 }
316330 }
317331 } else {
318 - $s .= $sk->makeInternalLink( $link, $text, "", "", $trail );
 332+ $s .= $sk->makeInternalLink( $link, $text, "", $trail );
319333 }
320334 }
321335 return $s;
@@ -423,7 +437,7 @@
424438
425439 if ( ";" == substr( $pref, -1 ) ) {
426440 $cpos = strpos( $t, ":" );
427 - if ( ! false === $cpos ) {
 441+ if ( ! ( false === $cpos ) ) {
428442 $term = substr( $t, 0, $cpos );
429443 $text .= $term . "</dt><dd>";
430444 $t = substr( $t, $cpos + 1 );
@@ -443,7 +457,7 @@
444458
445459 if ( ";" == $char ) {
446460 $cpos = strpos( $t, ":" );
447 - if ( ! false === $cpos ) {
 461+ if ( ! ( false === $cpos ) ) {
448462 $term = substr( $t, 0, $cpos );
449463 $text .= $term . "</dt><dd>";
450464 $t = substr( $t, $cpos + 1 );
Index: trunk/phpwiki/newcodebase/wiki.phtml
@@ -7,6 +7,7 @@
88 include_once( "./LocalSettings.php" );
99 include_once( "./GlobalFunctions.php" );
1010 include_once( "./InterText.php" );
 11+include_once( "./Namespace.php" );
1112 include_once( "./Skin.php" );
1213 include_once( "./OutputPage.php" );
1314 include_once( "./User.php" );
@@ -34,7 +35,7 @@
3536 if ( "" == $title ) { $title = wfMsg( "mainpage" ); }
3637
3738 $wgTitle = Title::newFromURL( $title );
38 -if ( 0 == strcmp( "Special", $wgTitle->getNamespace() ) ) {
 39+if ( -1 == $wgTitle->getNamespace() ) {
3940 wfSpecialPage();
4041 } else if ( "" != $search ) { wfSearch( $search ); }
4142 else {
Index: trunk/phpwiki/newcodebase/SpecialUserlogin.php
@@ -122,14 +122,7 @@
123123 $wgOut->setPageTitle( wfMsg( "loginsuccesstitle" ) );
124124 $wgOut->setRobotpolicy( "noindex,nofollow" );
125125 $wgOut->addHTML( $msg . "\n<p>" );
126 -
127 - if ( "" == $returnto ) {
128 - $r = wfMsg( "returntomain" );
129 - } else {
130 - $r = str_replace( "$1", $returnto, wfMsg( "returnto" ) );
131 - $wgOut->addMeta( "http:Refresh", "5;url=" . wfLocalLink( $returnto ) );
132 - }
133 - $wgOut->addWikiText( $r );
 126+ $wgOut->returnToMain();
134127 }
135128
136129 /* private */ function mainLoginForm( $err )
Index: trunk/phpwiki/newcodebase/LocalSettings.php
@@ -26,13 +26,14 @@
2727
2828 # Turn this on to get HTML debug comments
2929 #
30 -$wgDebugComments = true;
 30+$wgDebugComments = true;
 31+$wgDebugLogFile = "";
3132
3233 # Which interwiki prefix represents _this_ wiki? This
3334 # only needs to be set when installing the software on
3435 # on of the sites recognized as an interwiki.
3536 #
3637 $wgLocalInterwiki = "w";
37 -#$wgLanguageCode = "en";
 38+#$wgLanguageCode = "en";
3839
3940 ?>
Index: trunk/phpwiki/newcodebase/Title.php
@@ -34,15 +34,15 @@
3535 /* private */ var $mTextform, $mUrlform, $mDbkeyform;
3636 /* private */ var $mNamespace, $mInterwiki;
3737 /* private */ var $mArticleID, $mRestrictions, $mRestrictionsLoaded;
38 - /* private */ var $mOtherNamespaces, $mNamespacesLoaded;
 38+ /* private */ var $mNamespacesLoaded;
3939
4040 /* private */ function Title()
4141 {
42 - $this->mInterwiki = $this->mNamespace =
43 - $this->mUrlform = $this->mTextform = $this->mDbkeyform = "";
 42+ $this->mInterwiki = $this->mUrlform =
 43+ $this->mTextform = $this->mDbkeyform = "";
4444 $this->mArticleID = -1;
 45+ $this->mNamespace = 0;
4546 $this->mNamespacesLoaded = $this->mRestrictionsLoaded = false;
46 - $this->mOtherNamespaces = array();
4747 $this->mRestrictions = array();
4848 }
4949
@@ -118,7 +118,8 @@
119119 } else {
120120 $p = $wgValidInterwikis[$this->mInterwiki];
121121 }
122 - if ( "" != $this->mNamespace ) { $n = $this->mNamespace . "%3a"; }
 122+ $n = Namespace::getName( $this->mNamespace );
 123+ if ( "" != $n ) { $n .= "$3a"; }
123124 return str_replace( "$1", $n . $this->mUrlform, $p );
124125 }
125126
@@ -139,9 +140,7 @@
140141 {
141142 global $wgUser;
142143
143 - if ( 0 == strcmp( "Special", $this->mNamespace ) ) {
144 - return false;
145 - }
 144+ if ( -1 == $this->mNamespace ) { return false; }
146145 $ur = $wgUser->getRights();
147146 foreach ( $this->getRestrictions() as $r ) {
148147 if ( "" != $r && ( ! in_array( $r, $ur ) ) ) {
@@ -151,31 +150,6 @@
152151 return true;
153152 }
154153
155 - function getOtherNamespaces()
156 - {
157 - if ( ! $this->mNamespacesLoaded ) {
158 - $conn = wfGetDB();
159 - $sql = "SELECT cur_namespace,cur_id FROM cur " .
160 - "WHERE cur_title='{$this->mDbkeyform}'";
161 - wfDebug( "Title: 2: $sql\n" );
162 -
163 - $res = mysql_query( $sql, $conn );
164 - if ( ( false === $res ) || 0 == mysql_num_rows( $res ) ) {
165 - return $this->mOtherNamespaces;
166 - }
167 -
168 - while ( $row = mysql_fetch_object( $res ) ) {
169 - $ns = $row->cur_namespace;
170 - if ( 0 != strcmp( $this->mNamespace, $ns ) ) {
171 - array_push( $this->mOtherNamspaces, $ns );
172 - }
173 - }
174 - $this->mNamespacesLoaded = true;
175 - mysql_free_result( $res );
176 - }
177 - return $this->mOtherNamespaces;
178 - }
179 -
180154 function getRestrictions()
181155 {
182156 $id = $this->getArticleID();
@@ -198,8 +172,8 @@
199173 $this->mArticleID = $wgArticleIDcache[$pt];
200174 } else {
201175 $conn = wfGetDB();
202 - $sql = "SELECT cur_id FROM cur WHERE cur_namespace=" .
203 - "'{$this->mNamespace}' AND cur_title='{$this->mDbkeyform}'";
 176+ $sql = "SELECT cur_id FROM cur WHERE (cur_namespace=" .
 177+ "{$this->mNamespace} AND cur_title='{$this->mDbkeyform}')";
204178 # wfDebug( "Title: 1: $sql\n" );
205179 $res = mysql_query( $sql, $conn );
206180
@@ -221,8 +195,10 @@
222196 if ( "" != $this->mInterwiki ) {
223197 $p = $this->mInterwiki . ":";
224198 }
225 - if ( "" != $this->mNamespace ) {
226 - $p .= $this->mNamespace . ":";
 199+ if ( -1 == $this->mNamespace ) {
 200+ $p .= "Special:";
 201+ } else if ( 0 != $this->mNamespace ) {
 202+ $p .= Namespace::getName( $this->mNamespace ) . ":";
227203 }
228204 return $p . $name;
229205 }
@@ -238,14 +214,15 @@
239215 global $wgLang, $wgValidInterwikis, $wgLocalInterwiki;
240216
241217 $validNamespaces = $wgLang->getNamespaces();
242 - $this->mInterwiki = $this->mNamespace = "";
 218+ $this->mInterwiki = "";
 219+ $this->mNamespace = 0;
243220
244221 $done = false;
245222 $t = trim( $this->mDbkeyform );
246223 if ( ":" == $t{0} ) {
247224 $r = substr( $t, 1 );
248225 } else {
249 - if ( preg_match( "/^([A-Za-z][A-Za-z0-9 _]*):(.*)$/", $t, $m ) ) {
 226+ if ( preg_match( "/^([A-Za-z][A-Za-z0-9 _]*):(.*)$/", $t, $m ) ) {
250227 $p = strtolower( $m[1] );
251228 if ( key_exists( $p, $wgValidInterwikis ) ) {
252229 $t = $m[2];
@@ -262,7 +239,8 @@
263240 $p = ucfirst( $p );
264241 if ( in_array( $p, $validNamespaces ) ) {
265242 $t = $m[2];
266 - $this->mNamespace = str_replace( " ", "_", $p );
 243+ $this->mNamespace = Namespace::getIndex(
 244+ str_replace( " ", "_", $p ) );
267245 }
268246 }
269247 }
@@ -273,7 +251,7 @@
274252 }
275253 # We already know that some pages won't be in the database!
276254 #
277 - if ( "" != $this->mInterwiki || "Special" == $this->mNamespace ) {
 255+ if ( "" != $this->mInterwiki || -1 == $this->mNamespace ) {
278256 $this->mArticleID = 0;
279257 }
280258 # Strip illegal characters. Note that since many troublesome
Index: trunk/phpwiki/newcodebase/Article.php
@@ -115,7 +115,7 @@
116116
117117 function edit()
118118 {
119 - global $wgOut, $wgUser, $wgTitle;
 119+ global $wgOut, $wgUser, $wgTitle, $wgReadOnly;
120120 global $wpTextbox1, $wpSummary, $wpSave, $wpPreview;
121121 global $wpMinoredit, $wpEdittime, $wpTextbox2;
122122
@@ -123,6 +123,14 @@
124124 $this->view();
125125 return;
126126 }
 127+ if ( $wgUser->isBlocked() ) {
 128+ $this->blockedIPpage();
 129+ return;
 130+ }
 131+ if ( $wgReadOnly ) {
 132+ $this->readOnlyPage();
 133+ return;
 134+ }
127135 if ( isset( $wpSave ) ) {
128136 $this->editForm( "save" );
129137 } else if ( isset( $wpPreview ) ) {
@@ -351,6 +359,7 @@
352360 global $wgOut, $wgUser;
353361
354362 $wgOut->setPageTitle( wfMsg( "blockedtitle" ) );
 363+ $wgOut->setRobotpolicy( "noindex,nofollow" );
355364 $id = $wgUser->blockedBy();
356365 $reason = $wgUser->blockedFor();
357366
@@ -360,7 +369,18 @@
361370 $text = str_replace( "$1", $link, wfMsg( "blockedtext" ) );
362371 $text = str_replace( "$2", $reason, $text );
363372 $wgOut->addWikiText( $text );
 373+ $wgOut->returnToMain();
364374 }
 375+
 376+ function readOnlyPage()
 377+ {
 378+ global $wgOut, $wgUser;
 379+
 380+ $wgOut->setPageTitle( wfMsg( "readonly" ) );
 381+ $wgOut->setRobotpolicy( "noindex,nofollow" );
 382+ $wgOut->addWikiText( wfMsg( "readonlytext" ) );
 383+ $wgOut->returnToMain();
 384+ }
365385 }
366386
367387 ?>

Status & tagging log