Index: trunk/phpwiki/fpw/specialPages.php |
— | — | @@ -32,7 +32,6 @@ |
33 | 33 | global $wasSaved ; |
34 | 34 | $wasSaved = true ; |
35 | 35 | return "" ; |
36 | | -# return "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL='$PHP_SELF?title=$title'\">" ; |
37 | 36 | } else if ( isset ( $PreviewButton ) ) { |
38 | 37 | unset ( $PreviewButton ) ; |
39 | 38 | $text = $EditBox ; |
— | — | @@ -884,4 +883,13 @@ |
885 | 884 | $ret .= $vpage->getFooter() ; |
886 | 885 | return $ret ; |
887 | 886 | } |
| 887 | + |
| 888 | +function special_pages () { |
| 889 | + global $vpage , $user ; |
| 890 | + $vpage->special ( "Special Pages" ) ; |
| 891 | + $ret = "<b>This is a list of special pages.</b><br>" ; |
| 892 | + $ret .= "Some of them are only available if you are logged in. If you are logged in, you can have this list automatically displayed on the right or left of each page as a QuickBar.<br><br>" ; |
| 893 | + $ret .= $vpage->getQuickBar () ; |
| 894 | + return $ret ; |
| 895 | + } |
888 | 896 | ?> |
\ No newline at end of file |
Index: trunk/phpwiki/fpw/wikiPage.php |
— | — | @@ -3,7 +3,8 @@ |
4 | 4 | var $contents ; |
5 | 5 | |
6 | 6 | #Functions |
7 | | - function load ( $t ) { |
| 7 | + function load ( $t , $doRedirect = true ) { |
| 8 | + global $action ; |
8 | 9 | $this->title = $t ; |
9 | 10 | $this->makeSecureTitle () ; |
10 | 11 | $this->isSpecialPage = false ; |
— | — | @@ -41,6 +42,13 @@ |
42 | 43 | mysql_close ( $connection ) ; |
43 | 44 | $this->makeURL () ; |
44 | 45 | $this->splitTitle () ; |
| 46 | + if ( strtolower ( substr ( $this->contents , 0 , 9 ) ) == "#redirect" and $doRedirect and $action != "edit" ) { |
| 47 | + $z = $this->contents ; |
| 48 | + $z = strstr ( $z , "[[" ) ; |
| 49 | + $z = str_replace ( "[[" , "" , $z ) ; |
| 50 | + $z = str_replace ( "]]" , "" , $z ) ; |
| 51 | + $this->load ( trim($z) , false ) ; |
| 52 | + } |
45 | 53 | } |
46 | 54 | function special ( $t ) { |
47 | 55 | $this->title = $t ; |
— | — | @@ -340,14 +348,15 @@ |
341 | 349 | $spl = $this->getSubpageList () ; |
342 | 350 | if ( count ( $spl ) > 0 and $this->subpageTitle != "" ) { |
343 | 351 | $zz = trim ( $this->parseContents ( $spl[0] ) ) ; |
344 | | - $zz = str_replace ( "<p " , "<something " , $zz ) ; |
| 352 | + $zz = strstr ( $zz , "<a" ) ; |
| 353 | + $zz = str_replace ( "</p>" , "" , $zz ) ; |
345 | 354 | $ret .= " | ".$zz ; |
346 | | -# $ret .= " | <a href=\"".$spl[0]."\">".$spl[0]."</a>" ; |
347 | 355 | } |
348 | 356 | |
349 | 357 | $ret .= " | <a href=\"$PHP_SELF?title=special:RecentChanges\">Recent Changes</a>" ; |
350 | 358 | if ( $this->canEdit() ) $ret .= " | <a href=\"$PHP_SELF?action=edit&title=$this->url\">Edit this page</a>" ; |
351 | 359 | $ret .= " | <a href=\"$PHP_SELF?title=special:RandomPage\">Random Page</a>" ; |
| 360 | + $ret .= " | <a href=\"$PHP_SELF?title=special:Special_pages\">Special Pages</a>" ; |
352 | 361 | return $ret ; |
353 | 362 | } |
354 | 363 | function getHeader () { |
— | — | @@ -380,29 +389,34 @@ |
381 | 390 | $ret .= "<tr><td valign=bottom>".$this->getLinkBar()."</td></tr></table>" ; |
382 | 391 | return $ret ; |
383 | 392 | } |
| 393 | + function getQuickBar () { |
| 394 | + global $user ; |
| 395 | + $column = "<nowiki>" ; |
| 396 | + $column .= "<a href=\"$PHP_SELF?title=HomePage\">HomePage</a>\n" ; |
| 397 | + $column .= "<br><a href=\"$PHP_SELF?title=special:RecentChanges\">Recent Changes</a>\n" ; |
| 398 | + if ( $this->canEdit() ) $column .= "<br><a href=\"$PHP_SELF?action=edit&title=$this->url\">Edit this page</a>\n" ; |
| 399 | + if ( $this->canDelete() ) $column .= "<br><a href=\"$PHP_SELF?action=deletepage&title=$this->url\">Delete this page</a>\n" ; |
| 400 | + if ( $this->canProtect() ) $column .= "<br><a href=\"$PHP_SELF?action=protectpage&title=$this->url\">Protect this page</a>\n" ; |
| 401 | + if ( $this->canAdvance() ) $column .= "<br><a href=\"$PHP_SELF?title=special:Advance&topic=$this->safeTitle\">Advance</a>\n" ; |
| 402 | + if ( !$this->isSpecialPage ) $column .= "<br><a href=\"$PHP_SELF?action=history&title=$this->url\">History</a>\n" ; |
| 403 | + $column .= "<br><a href=\"$PHP_SELF?title=special:Upload\">Upload files</a>\n" ; |
| 404 | + $column .= "<hr>" ; |
| 405 | + $column .= "<a href=\"$PHP_SELF?title=special:Statistics\">Statistics</a>" ; |
| 406 | + $column .= "<br>\n<a href=\"$PHP_SELF?title=special:LonelyPages\">Lonely pages</a>" ; |
| 407 | + $column .= "<br>\n<a href=\"$PHP_SELF?title=special:WantedPages\">Most wanted</a>" ; |
| 408 | + $column .= "<br>\n<a href=\"$PHP_SELF?title=special:AllPages\">All pages</a>" ; |
| 409 | + $column .= "<br>\n<a href=\"$PHP_SELF?title=special:RandomPage\">Random Page</a>" ; |
| 410 | + if ( $user->isLoggedIn ) { |
| 411 | + $column .= "<br>\n<a href=\"$PHP_SELF?title=special:WatchList\">My watchlist</a>" ; |
| 412 | + } |
| 413 | + return $column."</nowiki>" ; |
| 414 | + } |
384 | 415 | function getMiddle ( $ret ) { |
385 | 416 | global $user , $action ; |
386 | 417 | $oaction = $action ; |
387 | 418 | if ( $action == "edit" ) $action = "" ; |
388 | 419 | if ( $user->options["quickBar"] == "right" or $user->options["quickBar"] == "left" or $user->options["forceQuickBar"] != "" ) { |
389 | | - $column .= "<a href=\"$PHP_SELF?title=HomePage\">HomePage</a>\n" ; |
390 | | - $column .= "<br><a href=\"$PHP_SELF?title=special:RecentChanges\">Recent Changes</a>\n" ; |
391 | | - if ( $this->canEdit() ) $column .= "<br><a href=\"$PHP_SELF?action=edit&title=$this->url\">Edit this page</a>\n" ; |
392 | | - if ( $this->canDelete() ) $column .= "<br><a href=\"$PHP_SELF?action=deletepage&title=$this->url\">Delete this page</a>\n" ; |
393 | | - if ( $this->canProtect() ) $column .= "<br><a href=\"$PHP_SELF?action=protectpage&title=$this->url\">Protect this page</a>\n" ; |
394 | | - if ( $this->canAdvance() ) $column .= "<br><a href=\"$PHP_SELF?title=special:Advance&topic=$this->safeTitle\">Advance</a>\n" ; |
395 | | - if ( !$this->isSpecialPage ) $column .= "<br><a href=\"$PHP_SELF?action=history&title=$this->url\">History</a>\n" ; |
396 | | - $column .= "<br><a href=\"$PHP_SELF?title=special:Upload\">Upload files</a>\n" ; |
397 | | - $column .= "<hr>" ; |
398 | | - $column .= "<a href=\"$PHP_SELF?title=special:Statistics\">Statistics</a>" ; |
399 | | - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:LonelyPages\">Lonely pages</a>" ; |
400 | | - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:WantedPages\">Most wanted</a>" ; |
401 | | - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:AllPages\">All pages</a>" ; |
402 | | - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:RandomPage\">Random Page</a>" ; |
403 | | - if ( $user->isLoggedIn ) { |
404 | | - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:WatchList\">My watchlist</a>" ; |
405 | | - } |
406 | | - |
| 420 | + $column = $this->getQuickBar(); |
407 | 421 | $spl = $this->getSubpageList () ; |
408 | 422 | if ( count ( $spl ) > 0 ) $column .= "<font size=-1>".$this->parseContents ( "<hr>".implode ( "<br>\n" , $spl ) )."</font>" ; |
409 | 423 | |
Index: trunk/phpwiki/fpw/wikiTitle.php |
— | — | @@ -46,6 +46,7 @@ |
47 | 47 | $s .= ucfirst ( trim ( $this->mainTitle ) ) ; |
48 | 48 | if ( trim ( $this->subpageTitle ) != "" ) $s .= "/".trim($this->subpageTitle) ; |
49 | 49 | $s = str_replace ( "\"" , "_" , $s ) ; |
| 50 | + $s = str_replace ( "\\'" , "'" , $s ) ; |
50 | 51 | |
51 | 52 | # Make it compatible with old wiki |
52 | 53 | $s = str_replace ( "'" , "" , $s ) ; |
— | — | @@ -59,6 +60,8 @@ |
60 | 61 | function getNiceTitle ( $s ) { |
61 | 62 | if ( !isset ( $s ) ) $s = $this->secureTitle ; |
62 | 63 | $s = str_replace ( "_" , " " , $s ) ; |
| 64 | + $s = str_replace ( "\\'" , "'" , $s ) ; |
| 65 | + $s = str_replace ( "\\\"" , "\"" , $s ) ; |
63 | 66 | return ucfirst ( $s ) ; |
64 | 67 | } |
65 | 68 | function splitTitle () { |