Index: trunk/phpwiki/fpw/specialPages.php |
— | — | @@ -8,15 +8,22 @@ |
9 | 9 | |
10 | 10 | function edit ( $title ) { |
11 | 11 | global $EditBox , $SaveButton , $PreviewButton , $MinorEdit ; |
12 | | - global $user , $CommentBox , $vpage ; |
| 12 | + global $user , $CommentBox , $vpage , $EditTime ; |
13 | 13 | $npage = new WikiPage ; |
14 | 14 | $npage->title = $title ; |
15 | 15 | $npage->makeAll () ; |
16 | 16 | $ret = "" ; |
17 | 17 | if ( !$vpage->canEdit() ) return "<h3>You cannot edit this page!</h3>" ; |
18 | 18 | |
| 19 | + if ( $EditTime == "" ) $EditTime = date ( "YmdHis" ) ; |
| 20 | + |
| 21 | + |
19 | 22 | if ( isset ( $SaveButton ) ) { |
20 | 23 | unset ( $SaveButton ) ; |
| 24 | + if ( $vpage->doesTopicExist() ) { |
| 25 | + $lastTime = getMySQL ( "cur" , "cur_timestamp" , "cur_title=\"$vpage->secureTitle\"" ) ; |
| 26 | + if ( tsc($EditTime) < tsc($lastTime) ) return "<h1>While you were typing, someone saved another version of this article!</h1>" ; |
| 27 | + } |
21 | 28 | $text = $EditBox ; |
22 | 29 | $text = str_replace ( "\\'" , "'" , $text ) ; |
23 | 30 | $text = str_replace ( "\\\"" , "\"" , $text ) ; |
— | — | @@ -62,6 +69,7 @@ |
63 | 70 | $ret .= "<input tabindex=3 type=checkbox name=MinorEdit $checked value=1>This is a minor edit \n" ; |
64 | 71 | $ret .= "<input tabindex=4 type=submit value=Save name=SaveButton> \n" ; |
65 | 72 | $ret .= "<input tabindex=5 type=submit value=Preview name=PreviewButton>\n" ; |
| 73 | + $ret .= "<input type=hidden value=\"$EditTime\" name=EditTime>\n" ; |
66 | 74 | $ret .= "</form>" ; |
67 | 75 | |
68 | 76 | return $ret.$append ; |
— | — | @@ -81,7 +89,7 @@ |
82 | 90 | $action = "" ; |
83 | 91 | $ret .= $vpage->getFooter() ; |
84 | 92 | $action = "edit" ; |
85 | | - if ( $wasSaved ) return view ( $title ) ; |
| 93 | + if ( $wasSaved ) $ret .= "<h1>Your page was successfully saved!</h1><META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$PHP_SELF?title=$vpage->secureTitle\">" ; |
86 | 94 | return $ret ; |
87 | 95 | } |
88 | 96 | |
— | — | @@ -176,7 +184,7 @@ |
177 | 185 | if ( isset ( $ButtonSave ) ) { |
178 | 186 | unset ( $ButtonSave ) ; |
179 | 187 | global $QuickBar , $NewTopics , $UnderlineLinks , $AutoTalk , $ShowHover , $ROWS , $COLS , $doSkin ; |
180 | | - global $OLDPASSWORD , $NEWPASSWORD , $RETYPEPASSWORD , $EMAIL , $RESULTSPERPAGE , $doJustify ; |
| 188 | + global $OLDPASSWORD , $NEWPASSWORD , $RETYPEPASSWORD , $EMAIL , $RESULTSPERPAGE , $doJustify , $ChangesLayout ; |
181 | 189 | if ( $RESULTSPERPAGE < 2 ) $RESULTSPERPAGE = 20 ; |
182 | 190 | $user->options["quickBar"] = $QuickBar ; |
183 | 191 | $user->options["markupNewTopics"] = $NewTopics ; |
— | — | @@ -188,6 +196,7 @@ |
189 | 197 | $user->options["justify"] = $doJustify ; |
190 | 198 | $user->options["resultsPerPage"] = $RESULTSPERPAGE ; |
191 | 199 | $user->options["skin"] = $doSkin ; |
| 200 | + $user->options["changesLayout"] = $ChangesLayout ; |
192 | 201 | $user->email = $EMAIL ; |
193 | 202 | |
194 | 203 | if ( $OLDPASSWORD == $user->password ) { |
— | — | @@ -275,14 +284,12 @@ |
276 | 285 | $ret .= "<input type=radio value=None ".$sk["None"]." name=doSkin>None (Standard)<br>\n" ; |
277 | 286 | $ret .= "<input type=radio value=\"Star Trek\" ".$sk["Star Trek"]." name=doSkin>Star Trek<br>\n" ; |
278 | 287 | |
279 | | - # ?? |
280 | | - $ret .= "</td>" ; |
281 | | - $ret .= "<td></td></tr>" ; |
282 | | -# $nt[$user->options["markupNewTopics"]] = "checked" ; |
283 | | -# $ret .= "</td><td valign=top nowrap><b>New Topics :</b><br>\n" ; |
284 | | -# $ret .= "<input type=radio value=normal ".$nt["normal"]." name=NewTopics>Normal (Standard)<br>\n" ; |
285 | | -# $ret .= "<input type=radio value=red ".$nt["red"]." name=NewTopics>Red<br>\n" ; |
286 | | -# $ret .= "</td></tr>" ; |
| 288 | + # Changes layout |
| 289 | + $cl[$user->options["changesLayout"]] = "checked" ; |
| 290 | + $ret .= "</td><td valign=top nowrap><b>New Topics :</b><br>\n" ; |
| 291 | + $ret .= "<input type=radio value=classic ".$cl["classic"]." name=ChangesLayout>Classic (Standard)<br>\n" ; |
| 292 | + $ret .= "<input type=radio value=table ".$cl["table"]." name=ChangesLayout>As a table<br>\n" ; |
| 293 | + $ret .= "</td></tr>" ; |
287 | 294 | |
288 | 295 | $ret .= "<tr><td><center><input type=submit value=Save name=ButtonSave></center></td>" ; |
289 | 296 | $ret .= "<td><center><input type=reset value=Reset name=ButtonReset></center></td></tr>" ; |
— | — | @@ -588,7 +595,8 @@ |
589 | 596 | $xyz = new WikiTitle ; |
590 | 597 | $editTypes = array ( "0"=>"" , "1"=>"<font color=green>M</font>" , "2"=>"<font color=red>N</font>" ) ; |
591 | 598 | $ret = " (<b>Legend :</b> ".$editTypes["1"]."=Minor edit ; ".$editTypes["2"]."=New article.)" ; |
592 | | - $ret .= "<table width=100% border=0 cellpadding=2 cellspacing=0>\n" ; |
| 599 | + if ( $user->options["changesLayout"] == "table" ) $ret .= "<table width=100% border=0 cellpadding=2 cellspacing=0>\n" ; |
| 600 | + else $ret .= "<ul>\n" ; |
593 | 601 | $dummy = "$PHP_SELF?x=y" ; |
594 | 602 | foreach ( $arr as $s ) { |
595 | 603 | $nt = $xyz->getNiceTitle ( $s->cur_title ) ; |
— | — | @@ -596,7 +604,8 @@ |
597 | 605 | $time = date ( "H:i" , tsc ( $s->cur_timestamp ) ) ; |
598 | 606 | if ( $day != $lastDay ) { |
599 | 607 | $lastDay = $day ; |
600 | | - $ret .= "<tr><td width=100% colspan=6".$user->options["tabLine0"]."><b>$day</b></td></tr>" ; |
| 608 | + if ( $user->options["changesLayout"] == "table" ) $ret.="<tr><td width=100% colspan=6".$user->options["tabLine0"]."><b>$day</b></td></tr>"; |
| 609 | + else $ret .= "</ul><b>$day</b><ul>\n" ; |
601 | 610 | $color = $color1 ; |
602 | 611 | } |
603 | 612 | $u = $s->cur_user_text ; |
— | — | @@ -608,33 +617,53 @@ |
609 | 618 | $comment = trim($s->cur_comment) ; |
610 | 619 | if ( $comment == "*" ) $comment = "" ; |
611 | 620 | if ( $s->cur_minor_edit == 1 ) $comment = "<font size=-1><i>$comment</i></font>" ; |
612 | | - |
613 | 621 | $minor = $editTypes[$s->cur_minor_edit] ; |
614 | 622 | |
615 | | - $t = "<tr><td$color valign=top width=0%>" ; |
| 623 | + if ( $user->options["changesLayout"] == "table" ) $t = "<tr><td$color valign=top width=0%>" ; |
| 624 | + else $t = "<li>" ; |
| 625 | + |
616 | 626 | if ( $s->version == "current" ) $t .= "<a href=\"$PHP_SELF?title=$s->cur_title&diff=yes\">(diff)</a> " ; |
617 | 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> " ; |
618 | 628 | else $t .= "<a href=\"$PHP_SELF?title=$s->cur_title&diff=yes\">(diff)</a>" ; |
619 | | - $t .= "</td><td$color valign=top>" ; |
| 629 | + |
| 630 | + if ( $user->options["changesLayout"] == "table" ) $t .= "</td><td$color valign=top>" ; |
| 631 | + else $t .= " " ; |
| 632 | + |
620 | 633 | if ( $s->version == "current" ) $t .= "<a href=\"$PHP_SELF?$s->cur_title\">$nt</a></td>" ; |
621 | 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>" ; |
622 | 635 | else $t .= "<a href=\"$PHP_SELF?title=$s->cur_title\">$nt</a>" ; |
623 | | - $t .= "<td$color valign=top width=0% nowrap>$time</td>" ; |
| 636 | + |
| 637 | + if ( $user->options["changesLayout"] == "table" ) $t .= "<td$color valign=top width=0% nowrap>$time</td>" ; |
| 638 | + else $t = str_replace ( "</td>" , "; " , $t ) . " ($time) " ; |
624 | 639 | if ( $s->version != "" ) { |
625 | 640 | $v = new wikiTitle ; |
626 | 641 | $v->title = $s->cur_user_text ; |
627 | 642 | $v->makeSecureTitle () ; |
628 | | - if ( $s->cur_user == 0 ) $t .= "<td$color valign=top nowrap>$s->cur_user_text!!</td>" ; |
629 | | - else $t .= "<td$color valign=top nowrap><a href=\"$PHP_SELF?title=user:$v->secureTitle\">$s->cur_user_text</a></td>" ; |
| 643 | + 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>" ; |
| 646 | + if ( $user->options["changesLayout"] == "table" ) $t .= "</td>" ; |
| 647 | + else $t .= "; " ; |
630 | 648 | } |
631 | | - else $t .= "<td$color valign=top nowrap>$u</td>" ; |
632 | | - $t .= "<td$color valign=top>$minor</td>" ; |
633 | | - $t .= "<td$color >$comment</td>" ; |
634 | | - $ret .= $t."</tr>\n" ; |
| 649 | + else { |
| 650 | + if ( $user->options["changesLayout"] == "table" ) $t .= "<td$color valign=top nowrap>$u</td>" ; |
| 651 | + else $t .= $u ; |
| 652 | + } |
| 653 | + if ( $user->options["changesLayout"] == "table" ) $t .= "<td$color valign=top>$minor</td>" ; |
| 654 | + else $t .= " $minor" ; |
| 655 | + if ( $user->options["changesLayout"] == "table" ) $t .= "<td$color >$comment</td>" ; |
| 656 | + else $t .= " <b>$comment</b>" ; |
| 657 | + if ( $user->options["changesLayout"] == "table" ) $t .= "</tr>\n" ; |
| 658 | + else $t .= "</li>\n" ; |
| 659 | + $ret .= $t ; |
635 | 660 | if ( $color == $color1 ) $color = $color2 ; |
636 | 661 | else $color = $color1 ; |
637 | 662 | } |
638 | | - $ret .= "</table>" ; |
| 663 | + if ( $user->options["changesLayout"] == "table" ) $ret .= "</table>" ; |
| 664 | + else { |
| 665 | + $ret = "$ret</ul>\n" ; |
| 666 | + $ret = str_replace ( "</td>" , "" , $ret ) ; |
| 667 | + } |
639 | 668 | return "<nowiki>$ret</nowiki>" ; |
640 | 669 | } |
641 | 670 | |
— | — | @@ -1002,7 +1031,7 @@ |
1003 | 1032 | return $ret ; |
1004 | 1033 | } |
1005 | 1034 | |
1006 | | -# select old_id,old_title,old_timestamp,old_old_version from old order by old_timestamp desc |
| 1035 | +# A little hack; disabled; to enable, allow function call in wikiPage->load() |
1007 | 1036 | function askSQL () { |
1008 | 1037 | global $Save , $question ; |
1009 | 1038 | $ret = "" ; |
Index: trunk/phpwiki/fpw/wikiPage.php |
— | — | @@ -10,7 +10,27 @@ |
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 | 29 | $call = $this->mainTitle ; |
| 30 | + if ( !in_array ( strtolower ( $call ) , $allowed ) ) { |
| 31 | + $this->isSpecialPage = true ; |
| 32 | + $this->contents = "<h1>No such special page \"$call\"!</h1>" ; |
| 33 | + return ; |
| 34 | + } |
15 | 35 | $this->title = $call ; |
16 | 36 | $this->contents = $call () ; |
17 | 37 | $this->isSpecialPage = true ; |
— | — | @@ -79,6 +99,34 @@ |
80 | 100 | if ( count ( $a ) > 0 ) array_unshift ( $a , "[[$mother]]" ) ; |
81 | 101 | return $a ; |
82 | 102 | } |
| 103 | + function getOtherNamespaces () { |
| 104 | + $a = array () ; |
| 105 | + if ( $this->isSpecialPage ) return $a ; |
| 106 | + $n = explode ( ":" , $this->secureTitle ) ; |
| 107 | + if ( count ( $n ) == 1 ) $n = $n[0] ; |
| 108 | + else $n = $n[1] ; |
| 109 | + $connection = getDBconnection () ; |
| 110 | + mysql_select_db ( "wikipedia" , $connection ) ; |
| 111 | + $sql = "SELECT cur_title FROM cur WHERE cur_title LIKE \"%:$n\"" ; |
| 112 | + $result = mysql_query ( $sql , $connection ) ; |
| 113 | + $u = new WikiTitle ; |
| 114 | + if ( $this->namespace != "" ) { |
| 115 | + $dummy = new wikiTitle ; |
| 116 | + $dummy->setTitle ( $n ) ; |
| 117 | + if ( $dummy->doesTopicExist ( $connection ) ) |
| 118 | + array_push ( $a , "<a style=\"color:green;text-decoration:none\" href=\"$PHP_SELF?title=$n\">:".$this->getNiceTitle($n)."</a>" ) ; |
| 119 | + } |
| 120 | + if ( $this->namespace != "talk" ) array_push ( $a , "<a style=\"color:green;text-decoration:none\" href=\"$PHP_SELF?title=talk:$n\">Talk</a>" ) ; |
| 121 | + while ( $s = mysql_fetch_object ( $result ) ) { |
| 122 | + $t = explode ( ":" , $s->cur_title ) ; |
| 123 | + $t = $u->getNiceTitle ( $t[0] ) ; |
| 124 | + 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>" ) ; |
| 126 | + } |
| 127 | + if ( $result != "" ) mysql_free_result ( $result ) ; |
| 128 | + mysql_close ( $connection ) ; |
| 129 | + return $a ; |
| 130 | + } |
83 | 131 | function ensureExistence () { |
84 | 132 | $this->makeSecureTitle () ; |
85 | 133 | if ( $this->doesTopicExist() ) return ; |
— | — | @@ -144,7 +192,7 @@ |
145 | 193 | $link = $this->getLinkTo ( $topic ) ; |
146 | 194 | $topic->setTitle ( $link ) ; |
147 | 195 | |
148 | | - if ( count ( $c ) == 1 ) array_push ( $c , $topic->getNiceTitle($topic->secureTitle) ) ; |
| 196 | + if ( count ( $c ) == 1 ) array_push ( $c , $topic->getMainTitle() ) ; |
149 | 197 | $text = $c[1] ; |
150 | 198 | |
151 | 199 | |
— | — | @@ -176,8 +224,6 @@ |
177 | 225 | return $s ; |
178 | 226 | } |
179 | 227 | function replaceExternalLinks ( $s ) { |
180 | | -# $s = ereg_replace ( "\[http://([^] ]*) ([^]]*)\]" , "<a href=\"http://\\1\">\\2</a>" , $s ) ; |
181 | | -# $s = ereg_replace ( "http://([a-zA-Z0-9_/=?:.]*)\.(htm|html|cgi)" , "<a href=\"http://\\1.\\2\">\\1.\\2</a>" , $s ) ; |
182 | 228 | global $user ; |
183 | 229 | $cnt = 1 ; |
184 | 230 | $a = explode ( "[http://" , " ".$s ) ; |
— | — | @@ -204,8 +250,8 @@ |
205 | 251 | } |
206 | 252 | } |
207 | 253 | |
208 | | -# $o = "A-Za-z0-9/\.:?&=~%-@^" ; |
209 | | -# $s = eregi_replace ( "([^~])http://([$o]+)([^$o])" , "\\1<a href=\"http://\\2\">http://\\2</a>\\3" , $s ) ; |
| 254 | + $o = "A-Za-z0-9/\.:?&=~%-@^" ; |
| 255 | + $s = eregi_replace ( "([^~])http://([$o]+)([^$o])" , "\\1<a href=\"http://\\2\">http://\\2</a>\\3" , $s ) ; |
210 | 256 | $s = str_replace ( "~http://" , "http://" , $s ) ; |
211 | 257 | |
212 | 258 | return $s ; |
— | — | @@ -265,19 +311,26 @@ |
266 | 312 | } |
267 | 313 | return $s ; |
268 | 314 | } |
269 | | - function subParseContents ( $s ) { |
270 | | - global $user ; |
271 | | - $s = ereg_replace ( "([^=|\[])([a-z]*[A-Z]+[a-z]+[A-Z]+[A-Za-z]*)( |\n|\.)" , "\\1[[\\2]]\\3" , $s ) ; |
| 315 | + function removeHTMLtags ( $s ) { |
272 | 316 | $s = eregi_replace ( "<a (.*)>" , "<a \\1>" , $s ) ; |
273 | 317 | $s = eregi_replace ( "</a(.*)>" , "</a\\1>" , $s ) ; |
274 | 318 | $s = eregi_replace ( "<script(.*)>" , "<script\\1>" , $s ) ; |
275 | 319 | $s = eregi_replace ( "</script(.*)>" , "</script\\1>" , $s ) ; |
| 320 | + return $s ; |
| 321 | + } |
| 322 | + function subParseContents ( $s ) { |
| 323 | + global $user ; |
| 324 | +# Removed autoLink for mixedThings; wasn't working, anyway... |
| 325 | +# $s = ereg_replace ( "([\.|\n| )([a-z0-9]*[A-Z0-9]+[A-Za-z0-9]*)( |\n|\.)" , "\\1[[\\2]]\\3" , $s ) ; |
| 326 | + $s = $this->removeHTMLtags ( $s ) ; |
276 | 327 | $s = ereg_replace ( "-----*" , "<hr>" , $s ) ; |
277 | 328 | $s = str_replace ( "<HR>" , "<hr>" , $s ) ; |
278 | 329 | $s = $this->replaceVariables ( $s ) ; |
279 | 330 | $s = $this->pingPongReplace ( "'''" , "<b>" , "</b>" , $s ) ; |
280 | 331 | $s = $this->pingPongReplace ( "''" , "<i>" , "</i>" , $s ) ; |
281 | 332 | |
| 333 | + $s = ereg_replace ( "([\n| ])/([a-zA-Z0-9_]*)" , "\\1[[/\\2|/\\2]]" , $s ) ; |
| 334 | + |
282 | 335 | $justify = "" ; |
283 | 336 | if ( $user->options["justify"] == "yes" ) $justify = " align=justify" ; |
284 | 337 | $a = explode ( "\n" , $s ) ; |
— | — | @@ -410,9 +463,10 @@ |
411 | 464 | $column .= "<a href=\"$PHP_SELF?title=HomePage\">HomePage</a>\n" ; |
412 | 465 | $column .= "<br><a href=\"$PHP_SELF?title=special:RecentChanges\">Recent Changes</a>\n" ; |
413 | 466 | if ( $this->canEdit() ) $column .= "<br><a href=\"$PHP_SELF?action=edit&title=$this->url\">Edit this page</a>\n" ; |
414 | | - if ( $this->canDelete() ) $column .= "<br><a href=\"$PHP_SELF?action=deletepage&title=$this->url\">Delete this page</a>\n" ; |
415 | | - if ( $this->canProtect() ) $column .= "<br><a href=\"$PHP_SELF?action=protectpage&title=$this->url\">Protect this page</a>\n" ; |
416 | | - if ( $this->canAdvance() ) $column .= "<br><a href=\"$PHP_SELF?title=special:Advance&topic=$this->safeTitle\">Advance</a>\n" ; |
| 467 | +# 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" ; |
417 | 471 | if ( !$this->isSpecialPage ) $column .= "<br><a href=\"$PHP_SELF?action=history&title=$this->url\">History</a>\n" ; |
418 | 472 | $column .= "<br><a href=\"$PHP_SELF?title=special:Upload\">Upload files</a>\n" ; |
419 | 473 | $column .= "<hr>" ; |
— | — | @@ -426,6 +480,8 @@ |
427 | 481 | if ( $user->isLoggedIn ) { |
428 | 482 | $column .= "<br>\n<a href=\"$PHP_SELF?title=special:WatchList\">My watchlist</a>" ; |
429 | 483 | } |
| 484 | + $a = $this->getOtherNamespaces () ; |
| 485 | + if ( count ( $a ) > 0 ) $column .= "<hr>".implode ( "<br>\n" , $a ) ; |
430 | 486 | return $column."</nowiki>" ; |
431 | 487 | } |
432 | 488 | function getMiddle ( $ret ) { |
— | — | @@ -437,7 +493,7 @@ |
438 | 494 | $spl = $this->getSubpageList () ; |
439 | 495 | if ( count ( $spl ) > 0 ) $column .= "<font size=-1>".$this->parseContents ( "<hr>".implode ( "<br>\n" , $spl ) )."</font>" ; |
440 | 496 | |
441 | | - $column = "<td ".$user->options["quickBarBackground"]." width=110 valign=top nowrap>".$column."</td>" ; |
| 497 | + $column = "<td ".$user->options["quickBarBackground"]." width=120 valign=top nowrap>".$column."</td>" ; |
442 | 498 | $ret = "<td valign=top>".$ret."</td>" ; |
443 | 499 | global $HTTP_USER_AGENT ; |
444 | 500 | if ( stristr ( $HTTP_USER_AGENT , "MSIE" ) ) $border = "border=1 frame=void rules=cols" ; |
— | — | @@ -457,6 +513,9 @@ |
458 | 514 | if ( stristr ( $HTTP_USER_AGENT , "MSIE" ) ) $border = "border=1 frame=above rules=none" ; |
459 | 515 | else $border = "border=0" ; |
460 | 516 | $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> " ; |
| 518 | + $a = $this->getOtherNamespaces () ; |
| 519 | + if ( count ( $a ) > 0 ) $ret .= "Other namespaces : ".implode ( " | " , $a ) ; |
461 | 520 | $ret .= "<FORM>Search: <INPUT TYPE=text NAME=search SIZE=20></FORM>" ; |
462 | 521 | return $ret ; |
463 | 522 | } |
— | — | @@ -483,8 +542,8 @@ |
484 | 543 | $sql = "SELECT cur_old_version FROM cur WHERE cur_title=\"$this->secureTitle\"" ; |
485 | 544 | $result = mysql_query ( $sql , $connection ) ; |
486 | 545 | $s = mysql_fetch_object ( $result ) ; |
487 | | - $s->old_old_version = 1234567 ; #Dummy |
488 | 546 | $sql = "SELECT * FROM old WHERE old_id=$s->cur_old_version" ; |
| 547 | + $s->old_old_version = $s->cur_old_version ; |
489 | 548 | } |
490 | 549 | |
491 | 550 | $fc = $user->options["background"] ; |
— | — | @@ -509,6 +568,7 @@ |
510 | 569 | foreach ( $dl as $x ) $ret .= "<tr><td bgcolor=#DD0000><font$fc>$x</font></td></tr>\n" ; |
511 | 570 | $ret .= "</table>\n" ; |
512 | 571 | } else if ( isset ( $oldID ) and $s->old_old_version == 0 ) $ret .= "This is the first version of this article. All text is new!<br>\n" ; |
| 572 | + else if ( !isset ( $oldID ) ) $ret .= "This is the first version of this article. All text is new!<br>\n" ; |
513 | 573 | else $ret .= "No diff possible. Reason unknown. Blame the programmer! Tell him SQL said \"$sql\"<br>\n" ; |
514 | 574 | mysql_close ( $connection ) ; |
515 | 575 | |
Index: trunk/phpwiki/fpw/wikiUser.php |
— | — | @@ -69,6 +69,7 @@ |
70 | 70 | if ( $this->options["autoTalk"] == "" ) $this->options["autoTalk"] = "no" ; |
71 | 71 | if ( $this->options["cols"] == "" ) $this->options["cols"] = "60" ; |
72 | 72 | if ( $this->options["rows"] == "" ) $this->options["rows"] = "20" ; |
| 73 | + if ( $this->options["changesLayout"] == "" ) $this->options["changesLayout"] = "classic" ; |
73 | 74 | if ( $this->options["justify"] == "" ) $this->options["justify"] = "no" ; |
74 | 75 | if ( $this->options["resultsPerPage"] == "" ) $this->options["resultsPerPage"] = "20" ; |
75 | 76 | if ( $this->options["skin"] == "" ) $this->options["skin"] = "None" ; |
Index: trunk/phpwiki/fpw/wikiTitle.php |
— | — | @@ -11,6 +11,11 @@ |
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 ; |
| 15 | + |
| 16 | + # Allowing only a handful of namespaces |
| 17 | + $allowed = array ( "wikipedia" , "talk" , "user" , "" ) ; |
| 18 | + if ( !in_array ( strtolower ( $this->namespace ) , $allowed ) ) return false ; |
| 19 | + |
15 | 20 | return true ; |
16 | 21 | } |
17 | 22 | function canDelete () { |
— | — | @@ -94,6 +99,12 @@ |
95 | 100 | } |
96 | 101 | function makeAll () { $this->makeSecureTitle(); $this->makeURL(); } |
97 | 102 | function setTitle ( $t ) { $this->title = $t ; $this->makeAll() ; } |
| 103 | + function getMainTitle () { |
| 104 | + $r = $this->title ; |
| 105 | + if ( $this->hasNamespace and $this->namespace != "" ) $r = $this->namespace.":$r" ; |
| 106 | + if ( $this->subpageTitle != "" ) $r .= "/".$this->subpageTitle ; |
| 107 | + return $r ; |
| 108 | + } |
98 | 109 | function doesTopicExist ( $conn = "" ) { |
99 | 110 | $this->makeSecureTitle () ; |
100 | 111 | if ( $this->namespace == "special" ) return true ; |