r22 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21‎ | r22 | r23 >
Date:21:30, 10 October 2001
Author:magnus_manske
Status:old
Tags:
Comment:
minor
Modified paths:
  • /trunk/phpwiki/fpw/specialPages.php (modified) (history)
  • /trunk/phpwiki/fpw/wiki.phtml (modified) (history)
  • /trunk/phpwiki/fpw/wikiPage.php (modified) (history)
  • /trunk/phpwiki/fpw/wikiTitle.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/fpw/specialPages.php
@@ -85,11 +85,15 @@
8686 $action = "" ;
8787 $ret = $vpage->getHeader() ;
8888 $action = "edit" ;
89 - $ret .= $vpage->getMiddle(edit($title)) ;
 89+
 90+ $theMiddle = edit ( $title ) ;
 91+ if ( $wasSaved )
 92+ $theMiddle = "<h1>Your page was successfully saved!</h1><META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$THESCRIPT?title=$vpage->secureTitle\">" ;
 93+ $ret .= $vpage->getMiddle ( $theMiddle ) ;
 94+
9095 $action = "" ;
9196 $ret .= $vpage->getFooter() ;
9297 $action = "edit" ;
93 - if ( $wasSaved ) $ret .= "<h1>Your page was successfully saved!</h1><META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$PHP_SELF?title=$vpage->secureTitle\">" ;
9498 return $ret ;
9599 }
96100
@@ -162,7 +166,7 @@
163167 }
164168 if ( $user->options["rememberPassword"] == "on" ) $check = "checked" ;
165169 $s .= "If you are new to wikipedia and want to get a user account, enter a user name, type and re-type a password.<br>\n" ;
166 - $s .= "<FORM action=\"$PHP_SELF?title=special:userLogin\" method=post><font face=courier>\n" ;
 170+ $s .= "<FORM action=\"$THESCRIPT?title=special:userLogin\" method=post><font face=courier>\n" ;
167171 $s .= "Your user name&nbsp; : <INPUT TABINDEX=1 TYPE=text NAME=USERNAME VALUE=\"$user->name\" SIZE=20><br>\n" ;
168172 $s .= "Your password&nbsp;&nbsp; : <INPUT TABINDEX=2 TYPE=password NAME=USERPASSWORD VALUE=\"$user->password\" SIZE=20><br>\n" ;
169173 $s .= "Retype password : <INPUT TABINDEX=2 TYPE=password NAME=RETYPE VALUE=\"\" SIZE=20> (new users only)<br>\n" ;
@@ -212,7 +216,7 @@
213217 $ret .= "<b>You are logged in as [[user:$user->name|$user->name]]. ";
214218 $ret .= "Your internal ID is $user->id.</b><br>\n";
215219 $ret .= "You can get help [[wikipedia:Help/User preferences|here]].\n" ;
216 - $ret .= "<nowiki><FORM action=\"$PHP_SELF?title=special:editUserSettings\" method=post>" ;
 220+ $ret .= "<nowiki><FORM action=\"$THESCRIPT?title=special:editUserSettings\" method=post>" ;
217221 $ret .= "<table border=1 bordercolor=".$user->options["borderColor"]." cellspacing=0 cellpadding=2>" ;
218222
219223 # QuickBar options
@@ -458,15 +462,15 @@
459463 $s .= "<nowiki>" ;
460464 $last = $startat-$perpage ;
461465 $next = $startat+$perpage ;
462 - if ( $startat != 1 ) $s .= "<a href=\"$PHP_SELF?search=$search&startat=".$last."\">&lt;&lt;</a> | ";
 466+ if ( $startat != 1 ) $s .= "<a href=\"$THESCRIPT?search=$search&startat=".$last."\">&lt;&lt;</a> | ";
463467 for ( $a = 1 ; $a <= $totalcnt ; $a += $perpage ) {
464468 if ( $a != 1 ) $s .= " | " ;
465 - if ( $a != $startat ) $s .= "<a href=\"$PHP_SELF?search=$search&startat=$a\">";
 469+ if ( $a != $startat ) $s .= "<a href=\"$THESCRIPT?search=$search&startat=$a\">";
466470 $s .= "$a-" ;
467471 $s .= $a+$perpage-1 ;
468472 if ( $a != $startat ) $s .= "</a>" ;
469473 }
470 - if ( $startat != $a-$perpage ) $s .= " | <a href=\"$PHP_SELF?search=$search&startat=".$next."\">&gt;&gt;</a>";
 474+ if ( $startat != $a-$perpage ) $s .= " | <a href=\"$THESCRIPT?search=$search&startat=".$next."\">&gt;&gt;</a>";
471475 $s .= "</nowiki>" ;
472476 }
473477 }
@@ -513,9 +517,9 @@
514518
515519 $ret .= "<nowiki>" ;
516520 $before = $startat - $perpage ; $fin = $before + $perpage - 1 ;
517 - if ( $startat > 1 ) $ret .= "<a href=\"$PHP_SELF?title=special:UserList&startat=$before\">$before-$fin&lt;&lt;</a> &nbsp;" ;
 521+ if ( $startat > 1 ) $ret .= "<a href=\"$THESCRIPT?title=special:UserList&startat=$before\">$before-$fin&lt;&lt;</a> &nbsp;" ;
518522 $after = $startat + $perpage ; $fin = $after+$perpage - 1 ; if ( $fin > $total ) $fin = $total ;
519 - if ( $after-1 < $total ) $ret .= "<a href=\"$PHP_SELF?title=special:UserList&startat=$after\">&gt;&gt;$after-$fin</a>" ;
 523+ if ( $after-1 < $total ) $ret .= "<a href=\"$THESCRIPT?title=special:UserList&startat=$after\">&gt;&gt;$after-$fin</a>" ;
520524 $ret .= "</nowiki>" ;
521525 mysql_free_result ( $result ) ;
522526 mysql_close ( $connection ) ;
@@ -541,7 +545,7 @@
542546 }
543547 $thelink = $s->cur_title ;
544548 $ret = "<h2>Loading random page [[$thelink|".$vpage->getNiceTitle($thelink)."]]...</h2>" ;
545 - $ret .= "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$PHP_SELF?title=$thelink\">" ;
 549+ $ret .= "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$THESCRIPT?title=$thelink\">" ;
546550 mysql_free_result ( $result ) ;
547551 mysql_close ( $connection ) ;
548552
@@ -568,10 +572,10 @@
569573
570574 $ret = "<nowiki>" ;
571575 $ret .= "These are the last <b>$maxcnt</b> of the changes made on Wikipedia in the last $daysAgo days. View the last " ;
572 - $ret .= "<a href=\"$PHP_SELF?title=special:RecentChanges&maxcnt=50\">50</a> / " ;
573 - $ret .= "<a href=\"$PHP_SELF?title=special:RecentChanges&maxcnt=100\">100</a> / " ;
574 - $ret .= "<a href=\"$PHP_SELF?title=special:RecentChanges&maxcnt=250\">250</a> / " ;
575 - $ret .= "<a href=\"$PHP_SELF?title=special:RecentChanges&maxcnt=500\">500</a> " ;
 576+ $ret .= "<a href=\"$THESCRIPT?title=special:RecentChanges&maxcnt=50\">50</a> / " ;
 577+ $ret .= "<a href=\"$THESCRIPT?title=special:RecentChanges&maxcnt=100\">100</a> / " ;
 578+ $ret .= "<a href=\"$THESCRIPT?title=special:RecentChanges&maxcnt=250\">250</a> / " ;
 579+ $ret .= "<a href=\"$THESCRIPT?title=special:RecentChanges&maxcnt=500\">500</a> " ;
576580 $ret .= "changes.<br></nowiki>" ;
577581 $arr = array () ;
578582
@@ -597,7 +601,7 @@
598602 $ret = " (<b>Legend :</b> ".$editTypes["1"]."=Minor edit ; ".$editTypes["2"]."=New article.)" ;
599603 if ( $user->options["changesLayout"] == "table" ) $ret .= "<table width=100% border=0 cellpadding=2 cellspacing=0>\n" ;
600604 else $ret .= "<ul>\n" ;
601 - $dummy = "$PHP_SELF?x=y" ;
 605+ $dummy = "$THESCRIPT?x=y" ;
602606 foreach ( $arr as $s ) {
603607 $nt = $xyz->getNiceTitle ( $s->cur_title ) ;
604608 $day = date ( "l, F d, Y" , tsc ( $s->cur_timestamp ) ) ;
@@ -612,7 +616,7 @@
613617 if ( $s->cur_user != 0 ) {
614618 $xyz->title = $u ;
615619 $xyz->makeSecureTitle () ;
616 - $u = "<a href=\"$PHP_SELF?title=user:$xyz->secureTitle\">$u</a>" ;
 620+ $u = "<a href=\"$THESCRIPT?title=user:$xyz->secureTitle\">$u</a>" ;
617621 }
618622 $comment = trim($s->cur_comment) ;
619623 if ( $comment == "*" ) $comment = "" ;
@@ -622,16 +626,16 @@
623627 if ( $user->options["changesLayout"] == "table" ) $t = "<tr><td$color valign=top width=0%>" ;
624628 else $t = "<li>" ;
625629
626 - if ( $s->version == "current" ) $t .= "<a href=\"$PHP_SELF?title=$s->cur_title&diff=yes\">(diff)</a>&nbsp;" ;
627 - else if ( $s->version != "" ) $t .= "<a href=\"$PHP_SELF?title=$s->cur_title&oldID=$s->old_id&version=$s->version&diff=yes\">(diff)</a>&nbsp;" ;
628 - else $t .= "<a href=\"$PHP_SELF?title=$s->cur_title&diff=yes\">(diff)</a>" ;
 630+ if ( $s->version == "current" ) $t .= "<a href=\"$THESCRIPT?title=$s->cur_title&diff=yes\">(diff)</a>&nbsp;" ;
 631+ else if ( $s->version != "" ) $t .= "<a href=\"$THESCRIPT?title=$s->cur_title&oldID=$s->old_id&version=$s->version&diff=yes\">(diff)</a>&nbsp;" ;
 632+ else $t .= "<a href=\"$THESCRIPT?title=$s->cur_title&diff=yes\">(diff)</a>" ;
629633
630634 if ( $user->options["changesLayout"] == "table" ) $t .= "</td><td$color valign=top>" ;
631635 else $t .= " " ;
632636
633 - if ( $s->version == "current" ) $t .= "<a href=\"$PHP_SELF?$s->cur_title\">$nt</a></td>" ;
634 - else if ( $s->version != "" ) $t .= "<a href=\"$PHP_SELF?$s->cur_title&oldID=$s->old_id&version=$s->version\">$nt ($s->version)</a></td>" ;
635 - else $t .= "<a href=\"$PHP_SELF?title=$s->cur_title\">$nt</a>" ;
 637+ if ( $s->version == "current" ) $t .= "<a href=\"$THESCRIPT?title=$s->cur_title\">$nt</a></td>" ;
 638+ else if ( $s->version != "" ) $t .= "<a href=\"$THESCRIPT?title=$s->cur_title&oldID=$s->old_id&version=$s->version\">$nt ($s->version)</a></td>" ;
 639+ else $t .= "<a href=\"$THESCRIPT?title=$s->cur_title\">$nt</a>" ;
636640
637641 if ( $user->options["changesLayout"] == "table" ) $t .= "<td$color valign=top width=0% nowrap>$time</td>" ;
638642 else $t = str_replace ( "</td>" , "; " , $t ) . " ($time) " ;
@@ -640,8 +644,8 @@
641645 $v->title = $s->cur_user_text ;
642646 $v->makeSecureTitle () ;
643647 if ( $user->options["changesLayout"] == "table" ) $t .= "<td$color valign=top nowrap>" ;
644 - if ( $s->cur_user == 0 ) $t .= "$s->cur_user_text!!</td>" ;
645 - else $t .= "<a href=\"$PHP_SELF?title=user:$v->secureTitle\">$s->cur_user_text</a></td>" ;
 648+ if ( $s->cur_user == 0 ) $t .= "$s->cur_user_text</td>" ;
 649+ else $t .= "<a href=\"$THESCRIPT?title=user:$v->secureTitle\">$s->cur_user_text</a></td>" ;
646650 if ( $user->options["changesLayout"] == "table" ) $t .= "</td>" ;
647651 else $t .= "; " ;
648652 }
@@ -689,7 +693,7 @@
690694 setMySQL ( "user" , "user_watch" , $a , "user_id=$user->id" ) ;
691695
692696 $ret = "Watching $t ($m)" ;
693 - $ret .= "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL='$PHP_SELF?title=$t'\">" ;
 697+ $ret .= "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL='$THESCRIPT?title=$t'\">" ;
694698 return $ret ;
695699 }
696700
@@ -741,7 +745,7 @@
742746 mysql_free_result ( $result ) ;
743747
744748 # /TALK
745 - $sql = "SELECT COUNT(*) as number FROM cur WHERE cur_title LIKE \"%/Talk\"" ;
 749+ $sql = "SELECT COUNT(*) as number FROM cur WHERE cur_title LIKE \"%/Talk\" OR cur_title LIKE \"talk:%\"" ;
746750 $result = mysql_query ( $sql , $connection ) ;
747751 $s = mysql_fetch_object ( $result ) ;
748752 $talkPages = $s->number ;
@@ -749,7 +753,7 @@
750754 mysql_free_result ( $result ) ;
751755
752756 # , NOT /TALK
753 - $sql = "SELECT COUNT(*) as number FROM cur WHERE cur_title NOT LIKE \"%/Talk\" AND cur_text LIKE \"%,%\"" ;
 757+ $sql = "SELECT COUNT(*) as number FROM cur WHERE cur_title NOT LIKE \"%/Talk\" AND cur_title NOT LIKE \"talk:%\" AND cur_text LIKE \"%,%\"" ;
754758 $result = mysql_query ( $sql , $connection ) ;
755759 $s = mysql_fetch_object ( $result ) ;
756760 $commaPages = $s->number ;
@@ -757,7 +761,7 @@
758762 mysql_free_result ( $result ) ;
759763
760764 # WIKIPEDIA NOT /TALK
761 - $sql = "SELECT COUNT(*) as number FROM cur WHERE cur_title NOT LIKE \"%/Talk\" AND cur_title LIKE \"%ikipedia%\"" ;
 765+ $sql = "SELECT COUNT(*) as number FROM cur WHERE cur_title NOT LIKE \"%/Talk\" AND cur_title NOT LIKE \"talk:%\" AND cur_title LIKE \"%ikipedia%\"" ;
762766 $result = mysql_query ( $sql , $connection ) ;
763767 $s = mysql_fetch_object ( $result ) ;
764768 $wikiPages = $s->number ;
@@ -784,7 +788,7 @@
785789 $sql = "SELECT COUNT(*) as number FROM old" ;
786790 $result = mysql_query ( $sql , $connection ) ;
787791 $s = mysql_fetch_object ( $result ) ;
788 - $oldPages = $s->number - $talkPages;
 792+# $oldPages = $s->number - $talkPages;
789793 $p = round ( $oldPages / $totalPages , 2 ) ;
790794 $ret .= "<li>And, there are $nf1$oldPages$nf2 old page versions in the database, giving an average of $p old pages on every active page.</li>" ;
791795 mysql_free_result ( $result ) ;
@@ -819,7 +823,7 @@
820824 global $user , $vpage ;
821825 $vpage->special ( "Upload Page" ) ;
822826
823 -# if ( $USERLOGGEDIN != "YES" ) return "You are not logged in! You have to be logged in to upload a file. <a href=\"$PHP_SELF?action=login\">Log in</a> or return to the <a href=\"$PHP_SELF?no\">HomePage</a>" ;
 827+# if ( $USERLOGGEDIN != "YES" ) return "You are not logged in! You have to be logged in to upload a file. <a href=\"$THESCRIPT?action=login\">Log in</a> or return to the <a href=\"$THESCRIPT?no\">HomePage</a>" ;
824828
825829 # $rights = ",".getUserSetting ( $USERNAME , "user_rights" )."," ;
826830 # if ( strstr ( $rights , ",is_editor," ) or strstr ( $rights , ",is_sysop" ) ) $isEditor = true ;
@@ -833,12 +837,12 @@
834838 $message = "" ;
835839
836840 if (isset($removeFile)) {
837 -# if ( !$isSysop and !$isEditor ) return "You are neither an editor nor a sysop. Return to the <a href=\"$PHP_SELF?action=upload\">Upload page</a>" ;
 841+# if ( !$isSysop and !$isEditor ) return "You are neither an editor nor a sysop. Return to the <a href=\"$THESCRIPT?action=upload\">Upload page</a>" ;
838842 if (is_file("upload/$removeFile") ) unlink ("./upload/$removeFile");
839843 $message = "File <b>$removeFile</b> deleted!" ;
840844 unset ( $removeFile ) ;
841845 } else if (isset($Upload_name) or isset($Upload)) {
842 - if ( $no_copyright != "AFFIRMED" ) return "You need to affirm that the file is not violating copygights. Return to the <a href=\"$PHP_SELF?action=upload\">Upload page</a>" ;
 846+ if ( $no_copyright != "AFFIRMED" ) return "You need to affirm that the file is not violating copygights. Return to the <a href=\"$THESCRIPT?action=upload\">Upload page</a>" ;
843847 $Upload_name = ereg_replace(" ", "_", $Upload_name);
844848 $abc = split("\.", $Upload_name);
845849
@@ -880,7 +884,7 @@
881885 $ret .= "<li>You can upload as many files you like. Please don't try to crash our server, ha ha.</li>\n";
882886 $ret .= "</ul>\n";
883887
884 - $ret .= " <form enctype=\"multipart/form-data\" action=\"$PHP_SELF?title=special:upload\" method=post>\n";
 888+ $ret .= " <form enctype=\"multipart/form-data\" action=\"$THESCRIPT?title=special:upload\" method=post>\n";
885889 $ret .= " <input type=hidden name=max value=20096>\n";
886890 $ret .= " <input name=Upload type=\"file\"><br>\n";
887891 $ret .= " <input type=hidden name=update value=1>\n";
@@ -912,7 +916,7 @@
913917 $ret .= "<a href=upload/$entry>$entry</a></td>";
914918 $ret .= "<td align=center>".filesize("upload/$entry")." bytes</td>";
915919 # if ( $isSysop or $isEditor )
916 - $ret .= "<td align=center><a href=\"$PHP_SELF?title=special:upload&removeFile=$entry\">Click here to remove $entry.</a></td>" ;
 920+ $ret .= "<td align=center><a href=\"$THESCRIPT?title=special:upload&removeFile=$entry\">Click here to remove $entry.</a></td>" ;
917921 $ret .= "</tr>" ;
918922 $i++;
919923 }
@@ -969,7 +973,7 @@
970974 }
971975
972976 $t = recentChangesLayout ( $a ) ;
973 - $t = "<b>This is the history of <a href=\"$PHP_SELF?title=$title\">$title</a></b>".$t ;
 977+ $t = "<b>This is the history of <a href=\"$THESCRIPT?title=$title\">$title</a></b>".$t ;
974978
975979 $ret = $vpage->getHeader() ;
976980 $ret .= $vpage->getMiddle($t) ;
@@ -1022,9 +1026,9 @@
10231027
10241028 $ret .= "<nowiki>" ;
10251029 $before = $startat - $perpage ; $fin = $before + $perpage - 1 ;
1026 - if ( $startat > 1 ) $ret .= "<a href=\"$PHP_SELF?title=special:ShortPages&startat=$before\">$before-$fin&lt;&lt;</a> &nbsp;" ;
 1030+ if ( $startat > 1 ) $ret .= "<a href=\"$THESCRIPT?title=special:ShortPages&startat=$before\">$before-$fin&lt;&lt;</a> &nbsp;" ;
10271031 $after = $startat + $perpage ; $fin = $after+$perpage - 1 ; if ( $fin > $total ) $fin = $total ;
1028 - if ( $after-1 < $total ) $ret .= "<a href=\"$PHP_SELF?title=special:ShortPages&startat=$after\">&gt;&gt;$after-$fin</a>" ;
 1032+ if ( $after-1 < $total ) $ret .= "<a href=\"$THESCRIPT?title=special:ShortPages&startat=$after\">&gt;&gt;$after-$fin</a>" ;
10291033 $ret .= "</nowiki>" ;
10301034 mysql_free_result ( $result ) ;
10311035 mysql_close ( $connection ) ;
Index: trunk/phpwiki/fpw/wiki.phtml
@@ -1,4 +1,5 @@
22 <?
 3+$THESCRIPT = "wiki.phtml" ;
34 include ( "./specialPages.php" ) ;
45 include ( "./databaseFunctions.php" ) ;
56 include ( "./wikiTitle.php" ) ;
Index: trunk/phpwiki/fpw/wikiPage.php
@@ -10,21 +10,7 @@
1111 $this->isSpecialPage = false ;
1212 $this->revision = "current" ;
1313 if ( $this->namespace == "special" ) {
14 - $allowed = array () ; # I know this is crude, but...
15 - array_push ( $allowed , "userlogin" ) ;
16 - array_push ( $allowed , "userlogout" ) ;
17 - array_push ( $allowed , "recentchanges" ) ;
18 - array_push ( $allowed , "upload" ) ;
19 - array_push ( $allowed , "statistics" ) ;
20 - array_push ( $allowed , "lonelypages" ) ;
21 - array_push ( $allowed , "wantedpages" ) ;
22 - array_push ( $allowed , "allpages" ) ;
23 - array_push ( $allowed , "randompage" ) ;
24 - array_push ( $allowed , "shortpages" ) ;
25 - array_push ( $allowed , "listusers" ) ;
26 - array_push ( $allowed , "watchlist" ) ;
27 - array_push ( $allowed , "special_pages" ) ;
28 - array_push ( $allowed , "editusersettings" ) ;
 14+ $allowed = array("userlogin","userlogout","recentchanges","upload","statistics","lonelypages","wantedpages","allpages","randompage","shortpages","listusers","watchlist","special_pages","editusersettings","asksql") ;
2915 $call = $this->mainTitle ;
3016 if ( !in_array ( strtolower ( $call ) , $allowed ) ) {
3117 $this->isSpecialPage = true ;
@@ -47,7 +33,7 @@
4834 $this->title=$s->old_title ;
4935 $this->makeSecureTitle () ;
5036 $this->contents = $s->old_text ;
51 - $this->thisVersion = "<br><font size=-1>This is the old version #$version; see the <a href=\"$PHP_SELF?title=$this->secureTitle\">current version</a></font>" ;
 37+ $this->thisVersion = "<br><font size=-1>This is the old version #$version; see the <a href=\"$THESCRIPT?title=$this->secureTitle\">current version</a></font>" ;
5238 }
5339 else $this->contents = "Describe the new page here." ;
5440 } else {
@@ -90,7 +76,7 @@
9177 $u = new WikiTitle ;
9278 while ( $s = mysql_fetch_object ( $result ) ) {
9379 $t = strstr ( $s->cur_title , "/" ) ;
94 - $t = $u->getNiceTitle ( $t ) ;
 80+ $z = explode ( ":" , $t , 2 ) ;
9581 $t = "[[$t]]" ;
9682 array_push ( $a , $t ) ;
9783 }
@@ -102,7 +88,7 @@
10389 function getOtherNamespaces () {
10490 $a = array () ;
10591 if ( $this->isSpecialPage ) return $a ;
106 - $n = explode ( ":" , $this->secureTitle ) ;
 92+ $n = explode ( ":" , $this->title ) ;
10793 if ( count ( $n ) == 1 ) $n = $n[0] ;
10894 else $n = $n[1] ;
10995 $connection = getDBconnection () ;
@@ -114,14 +100,15 @@
115101 $dummy = new wikiTitle ;
116102 $dummy->setTitle ( $n ) ;
117103 if ( $dummy->doesTopicExist ( $connection ) )
118 - array_push ( $a , "<a style=\"color:green;text-decoration:none\" href=\"$PHP_SELF?title=$n\">:".$this->getNiceTitle($n)."</a>" ) ;
 104+ array_push ( $a , "<a style=\"color:green;text-decoration:none\" href=\"$THESCRIPT?title=$n\">:".$this->getNiceTitle($n)."</a>" ) ;
119105 }
120 - if ( $this->namespace != "talk" ) array_push ( $a , "<a style=\"color:green;text-decoration:none\" href=\"$PHP_SELF?title=talk:$n\">Talk</a>" ) ;
 106+ if ( $this->namespace == "" )
 107+ array_push ( $a , "<a style=\"color:green;text-decoration:none\" href=\"$THESCRIPT?title=talk:$n\">Talk</a>" ) ;
121108 while ( $s = mysql_fetch_object ( $result ) ) {
122109 $t = explode ( ":" , $s->cur_title ) ;
123110 $t = $u->getNiceTitle ( $t[0] ) ;
124111 if ( strtolower ( $t ) != "talk" and strtolower ( $t ) != $this->namespace )
125 - array_push ( $a , "<a style=\"color:green;text-decoration:none\" href=\"$PHP_SELF?title=$t:$n\">$t</a>" ) ;
 112+ array_push ( $a , "<a style=\"color:green;text-decoration:none\" href=\"$THESCRIPT?title=$t:$n\">$t</a>" ) ;
126113 }
127114 if ( $result != "" ) mysql_free_result ( $result ) ;
128115 mysql_close ( $connection ) ;
@@ -195,11 +182,10 @@
196183 if ( count ( $c ) == 1 ) array_push ( $c , $topic->getMainTitle() ) ;
197184 $text = $c[1] ;
198185
199 -
200186 if ( $topic->doesTopicExist( $connection ) ) {
201187 $linkedLinks[$topic->secureTitle]++ ;
202188 if ( $user->options["showHover"] == "yes" ) $hover = "title=\"$link\"" ;
203 - $s .= "<a href=\"$PHP_SELF?title=".urlencode($link)."\" $hover>$text</a>" ;
 189+ $s .= "<a href=\"$THESCRIPT?title=".urlencode($link)."\" $hover>$text</a>" ;
204190 } else {
205191 $unlinkedLinks[$link]++ ;
206192 $text2 = $text ;
@@ -208,10 +194,10 @@
209195 if ( substr_count ( $text2 , " " ) > 0 ) $text2 = "[$text2]" ;
210196 if ( $user->options["underlineLinks"] == "no" ) { $text = $text2 ; $style = ";text-decoration:none" ; }
211197 if ( $user->options["markupNewTopics"] == "red" )
212 - $s .= "<a style=\"color:red$style\" href=\"$PHP_SELF?action=edit&title=".urlencode($link)."\" $hover>$text</a>" ;
 198+ $s .= "<a style=\"color:red$style\" href=\"$THESCRIPT?action=edit&title=".urlencode($link)."\" $hover>$text</a>" ;
213199 else if ( $user->options["markupNewTopics"] == "inverse" )
214 - $s .= "<a style=\"color:white;background:blue$style\" href=\"$PHP_SELF?action=edit&title=".urlencode($link)."\" $hover>$text</a>" ;
215 - else $s .= "$text2<a href=\"$PHP_SELF?action=edit&title=".urlencode($link)."\" $hover>?</a>" ;
 200+ $s .= "<a style=\"color:white;background:blue$style\" href=\"$THESCRIPT?action=edit&title=".urlencode($link)."\" $hover>$text</a>" ;
 201+ else $s .= "$text2<a href=\"$THESCRIPT?action=edit&title=".urlencode($link)."\" $hover>?</a>" ;
216202 }
217203 $s .= $b[1] ;
218204 }
@@ -250,7 +236,7 @@
251237 }
252238 }
253239
254 - $o = "A-Za-z0-9/\.:?&=~%-@^" ;
 240+ $o = "A-Za-z0-9/\.:?&=_~%-@^" ;
255241 $s = eregi_replace ( "([^~])http://([$o]+)([^$o])" , "\\1<a href=\"http://\\2\">http://\\2</a>\\3" , $s ) ;
256242 $s = str_replace ( "~http://" , "http://" , $s ) ;
257243
@@ -407,7 +393,10 @@
408394
409395 # Header and footer section
410396 function getLinkBar () {
411 - $ret = "<a href=\"$PHP_SELF?\">HomePage</a>" ;
 397+ global $user , $oldID , $version ;
 398+ $editOldVersion = "" ;
 399+ if ( $oldID != "" ) $editOldVersion="&oldID=$oldID&version=$version" ;
 400+ $ret = "<a href=\"$THESCRIPT?\">HomePage</a>" ;
412401
413402 $spl = $this->getSubpageList () ;
414403 if ( count ( $spl ) > 0 and $this->subpageTitle != "" ) {
@@ -417,11 +406,11 @@
418407 $ret .= " | ".$zz ;
419408 }
420409
421 - $ret .= " | <a href=\"$PHP_SELF?title=special:RecentChanges\">Recent Changes</a>" ;
422 - if ( $this->canEdit() ) $ret .= " | <a href=\"$PHP_SELF?action=edit&title=$this->url\">Edit this page</a>" ;
423 - if ( !$this->isSpecialPage ) $ret .= " | <a href=\"$PHP_SELF?action=history&title=$this->url\">History</a>\n" ;
424 - $ret .= " | <a href=\"$PHP_SELF?title=special:RandomPage\">Random Page</a>" ;
425 - $ret .= " | <a href=\"$PHP_SELF?title=special:Special_pages\">Special Pages</a>" ;
 410+ $ret .= " | <a href=\"$THESCRIPT?title=special:RecentChanges\">Recent Changes</a>" ;
 411+ if ( $this->canEdit() ) $ret .= " | <a href=\"$THESCRIPT?action=edit&title=$this->url$editOldVersion\">Edit this page</a>" ;
 412+ if ( !$this->isSpecialPage ) $ret .= " | <a href=\"$THESCRIPT?action=history&title=$this->url\">History</a>\n" ;
 413+ $ret .= " | <a href=\"$THESCRIPT?title=special:RandomPage\">Random Page</a>" ;
 414+ $ret .= " | <a href=\"$THESCRIPT?title=special:Special_pages\">Special Pages</a>" ;
426415 return $ret ;
427416 }
428417 function getHeader () {
@@ -438,47 +427,51 @@
439428 if ( $this->isSpecialPage ) {
440429 if ( $action == "edit" ) {
441430 $ret .= "<font size=+3>Editing ".$t."</font><br>Your changes will not be committed until you hit the <b>Save</b> button.<br>" ;
442 - $ret .= "You can get help <a href=\"$PHP_SELF?title=wikipedia:help/edit\">here</a>." ;
 431+ $ret .= "You can get help <a href=\"$THESCRIPT?title=wikipedia:help/edit\">here</a>." ;
443432 } else $ret .= "<font size=+3>".$t."</font>" ;
444433 } else {
445 - $ret .= "<font size=+3><a href=\"$PHP_SELF?search=$this->title\">".$this->getNiceTitle($t)."</a>$this->thisVersion</font>" ;
 434+ $ret .= "<font size=+3><a href=\"$THESCRIPT?search=$this->title\">".$this->getNiceTitle($t)."</a>$this->thisVersion</font>" ;
446435 if ( $user->isLoggedIn ) {
447436 if ( $user->doWatch($this->title) )
448 - $ret.="<br><a href=\"$PHP_SELF?action=watch&title=$this->secureTitle&mode=no\">Stop watching this article for me</a>";
449 - else $ret .= "<br><a href=\"$PHP_SELF?action=watch&title=$this->secureTitle&mode=yes\">Watch this article for me</a>" ;
 437+ $ret.="<br><a href=\"$THESCRIPT?action=watch&title=$this->secureTitle&mode=no\">Stop watching this article for me</a>";
 438+ else $ret .= "<br><a href=\"$THESCRIPT?action=watch&title=$this->secureTitle&mode=yes\">Watch this article for me</a>" ;
450439 }
451440 }
452441 $ret .= "</td>\n<td valign=top width=200 rowspan=2 nowrap>".$user->getLink()."<br>" ;
453 - if ( $user->isLoggedIn ) $ret .= "<a href=\"$PHP_SELF?title=special:userLogout\">Log out</a> | <a href=\"$PHP_SELF?title=special:editUserSettings\">Preferences</a>" ;
454 - else $ret .= "<a href=\"$PHP_SELF?title=special:userLogin\">Log in</a>" ;
455 - $ret .= " | <a href=\"$PHP_SELF?title=wikipedia:Help\">Help</a>" ;
 442+ if ( $user->isLoggedIn ) $ret .= "<a href=\"$THESCRIPT?title=special:userLogout\">Log out</a> | <a href=\"$THESCRIPT?title=special:editUserSettings\">Preferences</a>" ;
 443+ else $ret .= "<a href=\"$THESCRIPT?title=special:userLogin\">Log in</a>" ;
 444+ $ret .= " | <a href=\"$THESCRIPT?title=wikipedia:Help\">Help</a>" ;
456445 $ret .= "<FORM>Search: <INPUT TYPE=text NAME=search SIZE=20></FORM>" ;
457 - $ret .= "</td>\n<td rowspan=2 width=1><a href=\"$PHP_SELF?\"><img border=0 src=\"wiki.png\"></a></td></tr>\n" ;
 446+ $ret .= "</td>\n<td rowspan=2 width=1><a href=\"$THESCRIPT?\"><img border=0 src=\"wiki.png\"></a></td></tr>\n" ;
458447 $ret .= "<tr><td valign=bottom>".$this->getLinkBar()."</td></tr></table>" ;
459448 return $ret ;
460449 }
461450 function getQuickBar () {
462 - global $user ;
 451+ global $user , $oldID , $version ;
 452+ $editOldVersion = "" ;
 453+ if ( $oldID != "" ) $editOldVersion="&oldID=$oldID&version=$version" ;
463454 $column = "<nowiki>" ;
464 - $column .= "<a href=\"$PHP_SELF?title=HomePage\">HomePage</a>\n" ;
465 - $column .= "<br><a href=\"$PHP_SELF?title=special:RecentChanges\">Recent Changes</a>\n" ;
466 - if ( $this->canEdit() ) $column .= "<br><a href=\"$PHP_SELF?action=edit&title=$this->url\">Edit this page</a>\n" ;
 455+ $column .= "<a href=\"$THESCRIPT?title=HomePage\">HomePage</a>\n" ;
 456+ $column .= "<br><a href=\"$THESCRIPT?title=special:RecentChanges\">Recent Changes</a>\n" ;
 457+ if ( $this->canEdit() ) $column .= "<br><a href=\"$THESCRIPT?action=edit&title=$this->url$editOldVersion\">Edit this page</a>\n" ;
 458+
467459 # No user management due to request of Larry
468 -# if ( $this->canDelete() ) $column .= "<br><a href=\"$PHP_SELF?action=deletepage&title=$this->url\">Delete this page</a>\n" ;
469 -# if ( $this->canProtect() ) $column .= "<br><a href=\"$PHP_SELF?action=protectpage&title=$this->url\">Protect this page</a>\n" ;
470 -# if ( $this->canAdvance() ) $column .= "<br><a href=\"$PHP_SELF?title=special:Advance&topic=$this->safeTitle\">Advance</a>\n" ;
471 - if ( !$this->isSpecialPage ) $column .= "<br><a href=\"$PHP_SELF?action=history&title=$this->url\">History</a>\n" ;
472 - $column .= "<br><a href=\"$PHP_SELF?title=special:Upload\">Upload files</a>\n" ;
 460+# if ( $this->canDelete() ) $column .= "<br><a href=\"$THESCRIPT?action=deletepage&title=$this->url\">Delete this page</a>\n" ;
 461+# if ( $this->canProtect() ) $column .= "<br><a href=\"$THESCRIPT?action=protectpage&title=$this->url\">Protect this page</a>\n" ;
 462+# if ( $this->canAdvance() ) $column .= "<br><a href=\"$THESCRIPT?title=special:Advance&topic=$this->safeTitle\">Advance</a>\n" ;
 463+
 464+ if ( !$this->isSpecialPage ) $column .= "<br><a href=\"$THESCRIPT?action=history&title=$this->url\">History</a>\n" ;
 465+ $column .= "<br><a href=\"$THESCRIPT?title=special:Upload\">Upload files</a>\n" ;
473466 $column .= "<hr>" ;
474 - $column .= "<a href=\"$PHP_SELF?title=special:Statistics\">Statistics</a>" ;
475 - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:LonelyPages\">Orphans</a>" ;
476 - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:WantedPages\">Most wanted</a>" ;
477 - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:AllPages\">All pages</a>" ;
478 - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:RandomPage\">Random Page</a>" ;
479 - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:ShortPages\">Stub articles</a>" ;
480 - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:ListUsers\">List users</a>" ;
 467+ $column .= "<a href=\"$THESCRIPT?title=special:Statistics\">Statistics</a>" ;
 468+ $column .= "<br>\n<a href=\"$THESCRIPT?title=special:LonelyPages\">Orphans</a>" ;
 469+ $column .= "<br>\n<a href=\"$THESCRIPT?title=special:WantedPages\">Most wanted</a>" ;
 470+ $column .= "<br>\n<a href=\"$THESCRIPT?title=special:AllPages\">All pages</a>" ;
 471+ $column .= "<br>\n<a href=\"$THESCRIPT?title=special:RandomPage\">Random Page</a>" ;
 472+ $column .= "<br>\n<a href=\"$THESCRIPT?title=special:ShortPages\">Stub articles</a>" ;
 473+ $column .= "<br>\n<a href=\"$THESCRIPT?title=special:ListUsers\">List users</a>" ;
481474 if ( $user->isLoggedIn ) {
482 - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:WatchList\">My watchlist</a>" ;
 475+ $column .= "<br>\n<a href=\"$THESCRIPT?title=special:WatchList\">My watchlist</a>" ;
483476 }
484477 $a = $this->getOtherNamespaces () ;
485478 if ( count ( $a ) > 0 ) $column .= "<hr>".implode ( "<br>\n" , $a ) ;
@@ -513,7 +506,7 @@
514507 if ( stristr ( $HTTP_USER_AGENT , "MSIE" ) ) $border = "border=1 frame=above rules=none" ;
515508 else $border = "border=0" ;
516509 $ret = "<table width=100% $border bordercolor=black cellspacing=0><tr><td>$ret</td></tr></table>" ;
517 - if ( !$this->isSpecialPage ) $ret .= "<a href=\"$PHP_SELF?title=$this->secureTitle&diff=yes\">(diff)</a> " ;
 510+ if ( !$this->isSpecialPage ) $ret .= "<a href=\"$THESCRIPT?title=$this->secureTitle&diff=yes\">(diff)</a> " ;
518511 $a = $this->getOtherNamespaces () ;
519512 if ( count ( $a ) > 0 ) $ret .= "Other namespaces : ".implode ( " | " , $a ) ;
520513 $ret .= "<FORM>Search: <INPUT TYPE=text NAME=search SIZE=20></FORM>" ;
Index: trunk/phpwiki/fpw/wikiTitle.php
@@ -7,7 +7,7 @@
88 # User rights
99 function canEdit () {
1010 global $action ;
11 - global $oldID ; if ( isset ( $oldID ) ) return false ;
 11+# global $oldID ; if ( isset ( $oldID ) ) return false ;
1212 if ( !$this->validateTitle() ) return false ;
1313 if ( $this->isSpecialPage and $action != "edit" ) return false ;
1414 if ( $this->namespace == "special" ) return false ;
@@ -101,8 +101,8 @@
102102 function setTitle ( $t ) { $this->title = $t ; $this->makeAll() ; }
103103 function getMainTitle () {
104104 $r = $this->title ;
105 - if ( $this->hasNamespace and $this->namespace != "" ) $r = $this->namespace.":$r" ;
106 - if ( $this->subpageTitle != "" ) $r .= "/".$this->subpageTitle ;
 105+# if ( strstr ( $r , ":" ) == false and $this->hasNamespace and $this->namespace != "" ) $r = $this->namespace.":$r" ;
 106+# if ( $this->subpageTitle != "" ) $r .= "/".$this->subpageTitle ;
107107 return $r ;
108108 }
109109 function doesTopicExist ( $conn = "" ) {

Status & tagging log