Index: trunk/phpwiki/fpw/specialPages.php |
— | — | @@ -85,11 +85,15 @@ |
86 | 86 | $action = "" ; |
87 | 87 | $ret = $vpage->getHeader() ; |
88 | 88 | $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 | + |
90 | 95 | $action = "" ; |
91 | 96 | $ret .= $vpage->getFooter() ; |
92 | 97 | $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\">" ; |
94 | 98 | return $ret ; |
95 | 99 | } |
96 | 100 | |
— | — | @@ -162,7 +166,7 @@ |
163 | 167 | } |
164 | 168 | if ( $user->options["rememberPassword"] == "on" ) $check = "checked" ; |
165 | 169 | $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" ; |
167 | 171 | $s .= "Your user name : <INPUT TABINDEX=1 TYPE=text NAME=USERNAME VALUE=\"$user->name\" SIZE=20><br>\n" ; |
168 | 172 | $s .= "Your password : <INPUT TABINDEX=2 TYPE=password NAME=USERPASSWORD VALUE=\"$user->password\" SIZE=20><br>\n" ; |
169 | 173 | $s .= "Retype password : <INPUT TABINDEX=2 TYPE=password NAME=RETYPE VALUE=\"\" SIZE=20> (new users only)<br>\n" ; |
— | — | @@ -212,7 +216,7 @@ |
213 | 217 | $ret .= "<b>You are logged in as [[user:$user->name|$user->name]]. "; |
214 | 218 | $ret .= "Your internal ID is $user->id.</b><br>\n"; |
215 | 219 | $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>" ; |
217 | 221 | $ret .= "<table border=1 bordercolor=".$user->options["borderColor"]." cellspacing=0 cellpadding=2>" ; |
218 | 222 | |
219 | 223 | # QuickBar options |
— | — | @@ -458,15 +462,15 @@ |
459 | 463 | $s .= "<nowiki>" ; |
460 | 464 | $last = $startat-$perpage ; |
461 | 465 | $next = $startat+$perpage ; |
462 | | - if ( $startat != 1 ) $s .= "<a href=\"$PHP_SELF?search=$search&startat=".$last."\"><<</a> | "; |
| 466 | + if ( $startat != 1 ) $s .= "<a href=\"$THESCRIPT?search=$search&startat=".$last."\"><<</a> | "; |
463 | 467 | for ( $a = 1 ; $a <= $totalcnt ; $a += $perpage ) { |
464 | 468 | 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\">"; |
466 | 470 | $s .= "$a-" ; |
467 | 471 | $s .= $a+$perpage-1 ; |
468 | 472 | if ( $a != $startat ) $s .= "</a>" ; |
469 | 473 | } |
470 | | - if ( $startat != $a-$perpage ) $s .= " | <a href=\"$PHP_SELF?search=$search&startat=".$next."\">>></a>"; |
| 474 | + if ( $startat != $a-$perpage ) $s .= " | <a href=\"$THESCRIPT?search=$search&startat=".$next."\">>></a>"; |
471 | 475 | $s .= "</nowiki>" ; |
472 | 476 | } |
473 | 477 | } |
— | — | @@ -513,9 +517,9 @@ |
514 | 518 | |
515 | 519 | $ret .= "<nowiki>" ; |
516 | 520 | $before = $startat - $perpage ; $fin = $before + $perpage - 1 ; |
517 | | - if ( $startat > 1 ) $ret .= "<a href=\"$PHP_SELF?title=special:UserList&startat=$before\">$before-$fin<<</a> " ; |
| 521 | + if ( $startat > 1 ) $ret .= "<a href=\"$THESCRIPT?title=special:UserList&startat=$before\">$before-$fin<<</a> " ; |
518 | 522 | $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\">>>$after-$fin</a>" ; |
| 523 | + if ( $after-1 < $total ) $ret .= "<a href=\"$THESCRIPT?title=special:UserList&startat=$after\">>>$after-$fin</a>" ; |
520 | 524 | $ret .= "</nowiki>" ; |
521 | 525 | mysql_free_result ( $result ) ; |
522 | 526 | mysql_close ( $connection ) ; |
— | — | @@ -541,7 +545,7 @@ |
542 | 546 | } |
543 | 547 | $thelink = $s->cur_title ; |
544 | 548 | $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\">" ; |
546 | 550 | mysql_free_result ( $result ) ; |
547 | 551 | mysql_close ( $connection ) ; |
548 | 552 | |
— | — | @@ -568,10 +572,10 @@ |
569 | 573 | |
570 | 574 | $ret = "<nowiki>" ; |
571 | 575 | $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> " ; |
576 | 580 | $ret .= "changes.<br></nowiki>" ; |
577 | 581 | $arr = array () ; |
578 | 582 | |
— | — | @@ -597,7 +601,7 @@ |
598 | 602 | $ret = " (<b>Legend :</b> ".$editTypes["1"]."=Minor edit ; ".$editTypes["2"]."=New article.)" ; |
599 | 603 | if ( $user->options["changesLayout"] == "table" ) $ret .= "<table width=100% border=0 cellpadding=2 cellspacing=0>\n" ; |
600 | 604 | else $ret .= "<ul>\n" ; |
601 | | - $dummy = "$PHP_SELF?x=y" ; |
| 605 | + $dummy = "$THESCRIPT?x=y" ; |
602 | 606 | foreach ( $arr as $s ) { |
603 | 607 | $nt = $xyz->getNiceTitle ( $s->cur_title ) ; |
604 | 608 | $day = date ( "l, F d, Y" , tsc ( $s->cur_timestamp ) ) ; |
— | — | @@ -612,7 +616,7 @@ |
613 | 617 | if ( $s->cur_user != 0 ) { |
614 | 618 | $xyz->title = $u ; |
615 | 619 | $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>" ; |
617 | 621 | } |
618 | 622 | $comment = trim($s->cur_comment) ; |
619 | 623 | if ( $comment == "*" ) $comment = "" ; |
— | — | @@ -622,16 +626,16 @@ |
623 | 627 | if ( $user->options["changesLayout"] == "table" ) $t = "<tr><td$color valign=top width=0%>" ; |
624 | 628 | else $t = "<li>" ; |
625 | 629 | |
626 | | - if ( $s->version == "current" ) $t .= "<a href=\"$PHP_SELF?title=$s->cur_title&diff=yes\">(diff)</a> " ; |
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> " ; |
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> " ; |
| 631 | + else if ( $s->version != "" ) $t .= "<a href=\"$THESCRIPT?title=$s->cur_title&oldID=$s->old_id&version=$s->version&diff=yes\">(diff)</a> " ; |
| 632 | + else $t .= "<a href=\"$THESCRIPT?title=$s->cur_title&diff=yes\">(diff)</a>" ; |
629 | 633 | |
630 | 634 | if ( $user->options["changesLayout"] == "table" ) $t .= "</td><td$color valign=top>" ; |
631 | 635 | else $t .= " " ; |
632 | 636 | |
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>" ; |
636 | 640 | |
637 | 641 | if ( $user->options["changesLayout"] == "table" ) $t .= "<td$color valign=top width=0% nowrap>$time</td>" ; |
638 | 642 | else $t = str_replace ( "</td>" , "; " , $t ) . " ($time) " ; |
— | — | @@ -640,8 +644,8 @@ |
641 | 645 | $v->title = $s->cur_user_text ; |
642 | 646 | $v->makeSecureTitle () ; |
643 | 647 | 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>" ; |
646 | 650 | if ( $user->options["changesLayout"] == "table" ) $t .= "</td>" ; |
647 | 651 | else $t .= "; " ; |
648 | 652 | } |
— | — | @@ -689,7 +693,7 @@ |
690 | 694 | setMySQL ( "user" , "user_watch" , $a , "user_id=$user->id" ) ; |
691 | 695 | |
692 | 696 | $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'\">" ; |
694 | 698 | return $ret ; |
695 | 699 | } |
696 | 700 | |
— | — | @@ -741,7 +745,7 @@ |
742 | 746 | mysql_free_result ( $result ) ; |
743 | 747 | |
744 | 748 | # /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:%\"" ; |
746 | 750 | $result = mysql_query ( $sql , $connection ) ; |
747 | 751 | $s = mysql_fetch_object ( $result ) ; |
748 | 752 | $talkPages = $s->number ; |
— | — | @@ -749,7 +753,7 @@ |
750 | 754 | mysql_free_result ( $result ) ; |
751 | 755 | |
752 | 756 | # , 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 \"%,%\"" ; |
754 | 758 | $result = mysql_query ( $sql , $connection ) ; |
755 | 759 | $s = mysql_fetch_object ( $result ) ; |
756 | 760 | $commaPages = $s->number ; |
— | — | @@ -757,7 +761,7 @@ |
758 | 762 | mysql_free_result ( $result ) ; |
759 | 763 | |
760 | 764 | # 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%\"" ; |
762 | 766 | $result = mysql_query ( $sql , $connection ) ; |
763 | 767 | $s = mysql_fetch_object ( $result ) ; |
764 | 768 | $wikiPages = $s->number ; |
— | — | @@ -784,7 +788,7 @@ |
785 | 789 | $sql = "SELECT COUNT(*) as number FROM old" ; |
786 | 790 | $result = mysql_query ( $sql , $connection ) ; |
787 | 791 | $s = mysql_fetch_object ( $result ) ; |
788 | | - $oldPages = $s->number - $talkPages; |
| 792 | +# $oldPages = $s->number - $talkPages; |
789 | 793 | $p = round ( $oldPages / $totalPages , 2 ) ; |
790 | 794 | $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>" ; |
791 | 795 | mysql_free_result ( $result ) ; |
— | — | @@ -819,7 +823,7 @@ |
820 | 824 | global $user , $vpage ; |
821 | 825 | $vpage->special ( "Upload Page" ) ; |
822 | 826 | |
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>" ; |
824 | 828 | |
825 | 829 | # $rights = ",".getUserSetting ( $USERNAME , "user_rights" )."," ; |
826 | 830 | # if ( strstr ( $rights , ",is_editor," ) or strstr ( $rights , ",is_sysop" ) ) $isEditor = true ; |
— | — | @@ -833,12 +837,12 @@ |
834 | 838 | $message = "" ; |
835 | 839 | |
836 | 840 | 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>" ; |
838 | 842 | if (is_file("upload/$removeFile") ) unlink ("./upload/$removeFile"); |
839 | 843 | $message = "File <b>$removeFile</b> deleted!" ; |
840 | 844 | unset ( $removeFile ) ; |
841 | 845 | } 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>" ; |
843 | 847 | $Upload_name = ereg_replace(" ", "_", $Upload_name); |
844 | 848 | $abc = split("\.", $Upload_name); |
845 | 849 | |
— | — | @@ -880,7 +884,7 @@ |
881 | 885 | $ret .= "<li>You can upload as many files you like. Please don't try to crash our server, ha ha.</li>\n"; |
882 | 886 | $ret .= "</ul>\n"; |
883 | 887 | |
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"; |
885 | 889 | $ret .= " <input type=hidden name=max value=20096>\n"; |
886 | 890 | $ret .= " <input name=Upload type=\"file\"><br>\n"; |
887 | 891 | $ret .= " <input type=hidden name=update value=1>\n"; |
— | — | @@ -912,7 +916,7 @@ |
913 | 917 | $ret .= "<a href=upload/$entry>$entry</a></td>"; |
914 | 918 | $ret .= "<td align=center>".filesize("upload/$entry")." bytes</td>"; |
915 | 919 | # 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>" ; |
917 | 921 | $ret .= "</tr>" ; |
918 | 922 | $i++; |
919 | 923 | } |
— | — | @@ -969,7 +973,7 @@ |
970 | 974 | } |
971 | 975 | |
972 | 976 | $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 ; |
974 | 978 | |
975 | 979 | $ret = $vpage->getHeader() ; |
976 | 980 | $ret .= $vpage->getMiddle($t) ; |
— | — | @@ -1022,9 +1026,9 @@ |
1023 | 1027 | |
1024 | 1028 | $ret .= "<nowiki>" ; |
1025 | 1029 | $before = $startat - $perpage ; $fin = $before + $perpage - 1 ; |
1026 | | - if ( $startat > 1 ) $ret .= "<a href=\"$PHP_SELF?title=special:ShortPages&startat=$before\">$before-$fin<<</a> " ; |
| 1030 | + if ( $startat > 1 ) $ret .= "<a href=\"$THESCRIPT?title=special:ShortPages&startat=$before\">$before-$fin<<</a> " ; |
1027 | 1031 | $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\">>>$after-$fin</a>" ; |
| 1032 | + if ( $after-1 < $total ) $ret .= "<a href=\"$THESCRIPT?title=special:ShortPages&startat=$after\">>>$after-$fin</a>" ; |
1029 | 1033 | $ret .= "</nowiki>" ; |
1030 | 1034 | mysql_free_result ( $result ) ; |
1031 | 1035 | mysql_close ( $connection ) ; |
Index: trunk/phpwiki/fpw/wiki.phtml |
— | — | @@ -1,4 +1,5 @@ |
2 | 2 | <? |
| 3 | +$THESCRIPT = "wiki.phtml" ; |
3 | 4 | include ( "./specialPages.php" ) ; |
4 | 5 | include ( "./databaseFunctions.php" ) ; |
5 | 6 | include ( "./wikiTitle.php" ) ; |
Index: trunk/phpwiki/fpw/wikiPage.php |
— | — | @@ -10,21 +10,7 @@ |
11 | 11 | $this->isSpecialPage = false ; |
12 | 12 | $this->revision = "current" ; |
13 | 13 | 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") ; |
29 | 15 | $call = $this->mainTitle ; |
30 | 16 | if ( !in_array ( strtolower ( $call ) , $allowed ) ) { |
31 | 17 | $this->isSpecialPage = true ; |
— | — | @@ -47,7 +33,7 @@ |
48 | 34 | $this->title=$s->old_title ; |
49 | 35 | $this->makeSecureTitle () ; |
50 | 36 | $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>" ; |
52 | 38 | } |
53 | 39 | else $this->contents = "Describe the new page here." ; |
54 | 40 | } else { |
— | — | @@ -90,7 +76,7 @@ |
91 | 77 | $u = new WikiTitle ; |
92 | 78 | while ( $s = mysql_fetch_object ( $result ) ) { |
93 | 79 | $t = strstr ( $s->cur_title , "/" ) ; |
94 | | - $t = $u->getNiceTitle ( $t ) ; |
| 80 | + $z = explode ( ":" , $t , 2 ) ; |
95 | 81 | $t = "[[$t]]" ; |
96 | 82 | array_push ( $a , $t ) ; |
97 | 83 | } |
— | — | @@ -102,7 +88,7 @@ |
103 | 89 | function getOtherNamespaces () { |
104 | 90 | $a = array () ; |
105 | 91 | if ( $this->isSpecialPage ) return $a ; |
106 | | - $n = explode ( ":" , $this->secureTitle ) ; |
| 92 | + $n = explode ( ":" , $this->title ) ; |
107 | 93 | if ( count ( $n ) == 1 ) $n = $n[0] ; |
108 | 94 | else $n = $n[1] ; |
109 | 95 | $connection = getDBconnection () ; |
— | — | @@ -114,14 +100,15 @@ |
115 | 101 | $dummy = new wikiTitle ; |
116 | 102 | $dummy->setTitle ( $n ) ; |
117 | 103 | 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>" ) ; |
119 | 105 | } |
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>" ) ; |
121 | 108 | while ( $s = mysql_fetch_object ( $result ) ) { |
122 | 109 | $t = explode ( ":" , $s->cur_title ) ; |
123 | 110 | $t = $u->getNiceTitle ( $t[0] ) ; |
124 | 111 | 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>" ) ; |
126 | 113 | } |
127 | 114 | if ( $result != "" ) mysql_free_result ( $result ) ; |
128 | 115 | mysql_close ( $connection ) ; |
— | — | @@ -195,11 +182,10 @@ |
196 | 183 | if ( count ( $c ) == 1 ) array_push ( $c , $topic->getMainTitle() ) ; |
197 | 184 | $text = $c[1] ; |
198 | 185 | |
199 | | - |
200 | 186 | if ( $topic->doesTopicExist( $connection ) ) { |
201 | 187 | $linkedLinks[$topic->secureTitle]++ ; |
202 | 188 | 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>" ; |
204 | 190 | } else { |
205 | 191 | $unlinkedLinks[$link]++ ; |
206 | 192 | $text2 = $text ; |
— | — | @@ -208,10 +194,10 @@ |
209 | 195 | if ( substr_count ( $text2 , " " ) > 0 ) $text2 = "[$text2]" ; |
210 | 196 | if ( $user->options["underlineLinks"] == "no" ) { $text = $text2 ; $style = ";text-decoration:none" ; } |
211 | 197 | 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>" ; |
213 | 199 | 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>" ; |
216 | 202 | } |
217 | 203 | $s .= $b[1] ; |
218 | 204 | } |
— | — | @@ -250,7 +236,7 @@ |
251 | 237 | } |
252 | 238 | } |
253 | 239 | |
254 | | - $o = "A-Za-z0-9/\.:?&=~%-@^" ; |
| 240 | + $o = "A-Za-z0-9/\.:?&=_~%-@^" ; |
255 | 241 | $s = eregi_replace ( "([^~])http://([$o]+)([^$o])" , "\\1<a href=\"http://\\2\">http://\\2</a>\\3" , $s ) ; |
256 | 242 | $s = str_replace ( "~http://" , "http://" , $s ) ; |
257 | 243 | |
— | — | @@ -407,7 +393,10 @@ |
408 | 394 | |
409 | 395 | # Header and footer section |
410 | 396 | 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>" ; |
412 | 401 | |
413 | 402 | $spl = $this->getSubpageList () ; |
414 | 403 | if ( count ( $spl ) > 0 and $this->subpageTitle != "" ) { |
— | — | @@ -417,11 +406,11 @@ |
418 | 407 | $ret .= " | ".$zz ; |
419 | 408 | } |
420 | 409 | |
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>" ; |
426 | 415 | return $ret ; |
427 | 416 | } |
428 | 417 | function getHeader () { |
— | — | @@ -438,47 +427,51 @@ |
439 | 428 | if ( $this->isSpecialPage ) { |
440 | 429 | if ( $action == "edit" ) { |
441 | 430 | $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>." ; |
443 | 432 | } else $ret .= "<font size=+3>".$t."</font>" ; |
444 | 433 | } 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>" ; |
446 | 435 | if ( $user->isLoggedIn ) { |
447 | 436 | 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>" ; |
450 | 439 | } |
451 | 440 | } |
452 | 441 | $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>" ; |
456 | 445 | $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" ; |
458 | 447 | $ret .= "<tr><td valign=bottom>".$this->getLinkBar()."</td></tr></table>" ; |
459 | 448 | return $ret ; |
460 | 449 | } |
461 | 450 | function getQuickBar () { |
462 | | - global $user ; |
| 451 | + global $user , $oldID , $version ; |
| 452 | + $editOldVersion = "" ; |
| 453 | + if ( $oldID != "" ) $editOldVersion="&oldID=$oldID&version=$version" ; |
463 | 454 | $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 | + |
467 | 459 | # 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" ; |
473 | 466 | $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>" ; |
481 | 474 | 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>" ; |
483 | 476 | } |
484 | 477 | $a = $this->getOtherNamespaces () ; |
485 | 478 | if ( count ( $a ) > 0 ) $column .= "<hr>".implode ( "<br>\n" , $a ) ; |
— | — | @@ -513,7 +506,7 @@ |
514 | 507 | if ( stristr ( $HTTP_USER_AGENT , "MSIE" ) ) $border = "border=1 frame=above rules=none" ; |
515 | 508 | else $border = "border=0" ; |
516 | 509 | $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> " ; |
518 | 511 | $a = $this->getOtherNamespaces () ; |
519 | 512 | if ( count ( $a ) > 0 ) $ret .= "Other namespaces : ".implode ( " | " , $a ) ; |
520 | 513 | $ret .= "<FORM>Search: <INPUT TYPE=text NAME=search SIZE=20></FORM>" ; |
Index: trunk/phpwiki/fpw/wikiTitle.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | # User rights |
9 | 9 | function canEdit () { |
10 | 10 | global $action ; |
11 | | - global $oldID ; if ( isset ( $oldID ) ) return false ; |
| 11 | +# global $oldID ; if ( isset ( $oldID ) ) return false ; |
12 | 12 | if ( !$this->validateTitle() ) return false ; |
13 | 13 | if ( $this->isSpecialPage and $action != "edit" ) return false ; |
14 | 14 | if ( $this->namespace == "special" ) return false ; |
— | — | @@ -101,8 +101,8 @@ |
102 | 102 | function setTitle ( $t ) { $this->title = $t ; $this->makeAll() ; } |
103 | 103 | function getMainTitle () { |
104 | 104 | $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 ; |
107 | 107 | return $r ; |
108 | 108 | } |
109 | 109 | function doesTopicExist ( $conn = "" ) { |