r17 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r16‎ | r17 | r18 >
Date:11:53, 1 October 2001
Author:magnus_manske
Status:old
Tags:
Comment:
*** empty log message ***
Modified paths:
  • /trunk/phpwiki/fpw/specialPages.php (modified) (history)
  • /trunk/phpwiki/fpw/wikiPage.php (modified) (history)
  • /trunk/phpwiki/fpw/wikiTitle.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/fpw/specialPages.php
@@ -32,7 +32,6 @@
3333 global $wasSaved ;
3434 $wasSaved = true ;
3535 return "" ;
36 -# return "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL='$PHP_SELF?title=$title'\">" ;
3736 } else if ( isset ( $PreviewButton ) ) {
3837 unset ( $PreviewButton ) ;
3938 $text = $EditBox ;
@@ -884,4 +883,13 @@
885884 $ret .= $vpage->getFooter() ;
886885 return $ret ;
887886 }
 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+ }
888896 ?>
\ No newline at end of file
Index: trunk/phpwiki/fpw/wikiPage.php
@@ -3,7 +3,8 @@
44 var $contents ;
55
66 #Functions
7 - function load ( $t ) {
 7+ function load ( $t , $doRedirect = true ) {
 8+ global $action ;
89 $this->title = $t ;
910 $this->makeSecureTitle () ;
1011 $this->isSpecialPage = false ;
@@ -41,6 +42,13 @@
4243 mysql_close ( $connection ) ;
4344 $this->makeURL () ;
4445 $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+ }
4553 }
4654 function special ( $t ) {
4755 $this->title = $t ;
@@ -340,14 +348,15 @@
341349 $spl = $this->getSubpageList () ;
342350 if ( count ( $spl ) > 0 and $this->subpageTitle != "" ) {
343351 $zz = trim ( $this->parseContents ( $spl[0] ) ) ;
344 - $zz = str_replace ( "<p " , "<something " , $zz ) ;
 352+ $zz = strstr ( $zz , "<a" ) ;
 353+ $zz = str_replace ( "</p>" , "" , $zz ) ;
345354 $ret .= " | ".$zz ;
346 -# $ret .= " | <a href=\"".$spl[0]."\">".$spl[0]."</a>" ;
347355 }
348356
349357 $ret .= " | <a href=\"$PHP_SELF?title=special:RecentChanges\">Recent Changes</a>" ;
350358 if ( $this->canEdit() ) $ret .= " | <a href=\"$PHP_SELF?action=edit&title=$this->url\">Edit this page</a>" ;
351359 $ret .= " | <a href=\"$PHP_SELF?title=special:RandomPage\">Random Page</a>" ;
 360+ $ret .= " | <a href=\"$PHP_SELF?title=special:Special_pages\">Special Pages</a>" ;
352361 return $ret ;
353362 }
354363 function getHeader () {
@@ -380,29 +389,34 @@
381390 $ret .= "<tr><td valign=bottom>".$this->getLinkBar()."</td></tr></table>" ;
382391 return $ret ;
383392 }
 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+ }
384415 function getMiddle ( $ret ) {
385416 global $user , $action ;
386417 $oaction = $action ;
387418 if ( $action == "edit" ) $action = "" ;
388419 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();
407421 $spl = $this->getSubpageList () ;
408422 if ( count ( $spl ) > 0 ) $column .= "<font size=-1>".$this->parseContents ( "<hr>".implode ( "<br>\n" , $spl ) )."</font>" ;
409423
Index: trunk/phpwiki/fpw/wikiTitle.php
@@ -46,6 +46,7 @@
4747 $s .= ucfirst ( trim ( $this->mainTitle ) ) ;
4848 if ( trim ( $this->subpageTitle ) != "" ) $s .= "/".trim($this->subpageTitle) ;
4949 $s = str_replace ( "\"" , "_" , $s ) ;
 50+ $s = str_replace ( "\\'" , "'" , $s ) ;
5051
5152 # Make it compatible with old wiki
5253 $s = str_replace ( "'" , "" , $s ) ;
@@ -59,6 +60,8 @@
6061 function getNiceTitle ( $s ) {
6162 if ( !isset ( $s ) ) $s = $this->secureTitle ;
6263 $s = str_replace ( "_" , " " , $s ) ;
 64+ $s = str_replace ( "\\'" , "'" , $s ) ;
 65+ $s = str_replace ( "\\\"" , "\"" , $s ) ;
6366 return ucfirst ( $s ) ;
6467 }
6568 function splitTitle () {

Status & tagging log