Index: trunk/phpwiki/fpw/wikiTitle.php |
— | — | @@ -81,8 +81,8 @@ |
82 | 82 | } |
83 | 83 | |
84 | 84 | # Converts a secure title back to a nice-looking one |
85 | | - function getNiceTitle ( $s ) { |
86 | | - if ( !isset ( $s ) ) $s = $this->secureTitle ; |
| 85 | + function getNiceTitle ( $s = "" ) { |
| 86 | + if ( $s == "" ) $s = $this->secureTitle ; |
87 | 87 | $s = str_replace ( "_" , " " , $s ) ; |
88 | 88 | $s = str_replace ( "\\'" , "'" , $s ) ; |
89 | 89 | $s = str_replace ( "\\\\" , "\\" , $s ) ; |
Index: trunk/phpwiki/fpw/basicFunctions.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | function error ( $error ) { |
5 | 5 | $page = new WikiPage ; |
6 | 6 | $page->special ( "Yikes! An error!" ) ; |
7 | | - $page->contents = "<h2>$error!</h2>Return to the [[:HomePage|HomePage]]!" ; |
| 7 | + $page->contents = "<h2>$error!</h2>Return to the [[:Main Page|Main Page]]!" ; |
8 | 8 | return $page->renderPage () ; |
9 | 9 | } |
10 | 10 | |
— | — | @@ -21,42 +21,60 @@ |
22 | 22 | # Called when editing/saving a page |
23 | 23 | function edit ( $title ) { |
24 | 24 | global $EditBox , $SaveButton , $PreviewButton , $MinorEdit ; |
25 | | - global $user , $CommentBox , $vpage , $EditTime ; |
| 25 | + global $user , $CommentBox , $vpage , $EditTime , $THESCRIPT ; |
26 | 26 | $npage = new WikiPage ; |
27 | 27 | $npage->title = $title ; |
28 | 28 | $npage->makeAll () ; |
29 | 29 | $ret = "" ; |
30 | 30 | if ( !$vpage->canEdit() ) return "<h3>You cannot edit this page!</h3>" ; # Check for allowance |
31 | | - |
32 | 31 | if ( $EditTime == "" ) $EditTime = date ( "YmdHis" ) ; # Stored for edit conflict detection |
| 32 | + $editConflict = false ; |
33 | 33 | |
34 | 34 | if ( isset ( $SaveButton ) ) { # The edit is finished, someone pressed the "Save" button |
35 | 35 | unset ( $SaveButton ) ; |
| 36 | + $doSave = true ; |
36 | 37 | if ( $vpage->doesTopicExist() ) { |
37 | 38 | $lastTime = getMySQL ( "cur" , "cur_timestamp" , "cur_title=\"$vpage->secureTitle\"" ) ; |
38 | | - if ( tsc($EditTime) < tsc($lastTime) ) return "<h1>While you were typing, someone saved another version of this article!</h1>" ; |
| 39 | + if ( tsc($EditTime) < tsc($lastTime) ) { |
| 40 | + $doSave = false ; |
| 41 | + $ret .= "<h1>Edit conflict!</h1>\n" ; |
| 42 | + $ret .= "<b>Someone saved this page after you started editing. The top textbox contains the saved text. " ; |
| 43 | + $ret .= "Only the text in the top textbox will be saved.</b><br>\n" ; |
| 44 | + $ret .= "Scroll down to see your edited text.<br>\n" ; |
| 45 | + $oldSubmittedText = $EditBox ; |
| 46 | + $oldSubmittedText = str_replace ( "\\'" , "'" , $oldSubmittedText ) ; |
| 47 | + $oldSubmittedText = str_replace ( "\\\"" , "\"" , $oldSubmittedText ) ; |
| 48 | + $EditTime = date ( "YmdHis" ) ; # reset time counter |
| 49 | + $npage->load ( $npage->title ) ; |
| 50 | + $text = $npage->contents ; |
| 51 | + $editConflict = true ; |
| 52 | + } |
39 | 53 | } |
40 | | - $text = $EditBox ; |
41 | | - $text = str_replace ( "\\'" , "'" , $text ) ; |
42 | | - $text = str_replace ( "\\\"" , "\"" , $text ) ; |
43 | | - if ( $user->isLoggedIn ) $text = str_replace ( "~~~" , "[[user:$user->name|$user->name]]" , $text ) ; |
44 | | - else $text = str_replace ( "~~~" , $user->getLink() , $text ) ; |
45 | | - $title = str_replace ( "\\'" , "'" , $title ) ; |
46 | | - $title = str_replace ( "\\\"" , "\"" , $title ) ; |
47 | | - $npage->title = $title ; |
48 | | - $npage->makeAll () ; |
49 | | - if ( $npage->doesTopicExist() ) $npage->backup() ; |
50 | | - else { $MinorEdit = 2 ; $npage->ensureExistence () ; } |
51 | | - if ( !$user->isLoggedIn ) $npage->setEntry ( $text , $CommentBox , 0 , $user->getLink() , $MinorEdit*1 ) ; |
52 | | - else $npage->setEntry ( $text , $CommentBox , $user->id , $user->name , $MinorEdit*1 ) ; |
53 | | - global $wasSaved ; |
54 | | - $wasSaved = true ; |
55 | | - return "" ; |
| 54 | + if ( $doSave ) { |
| 55 | + $text = $EditBox ; |
| 56 | + $text = str_replace ( "\\'" , "'" , $text ) ; |
| 57 | + $text = str_replace ( "\\\"" , "\"" , $text ) ; |
| 58 | + $text = str_replace ( "&" , "&" , $text ) ; |
| 59 | + if ( $user->isLoggedIn ) $text = str_replace ( "~~~" , "[[user:$user->name|$user->name]]" , $text ) ; |
| 60 | + else $text = str_replace ( "~~~" , $user->getLink() , $text ) ; |
| 61 | + $title = str_replace ( "\\'" , "'" , $title ) ; |
| 62 | + $title = str_replace ( "\\\"" , "\"" , $title ) ; |
| 63 | + $npage->title = $title ; |
| 64 | + $npage->makeAll () ; |
| 65 | + if ( $npage->doesTopicExist() ) $npage->backup() ; |
| 66 | + else { $MinorEdit = 2 ; $npage->ensureExistence () ; } |
| 67 | + if ( !$user->isLoggedIn ) $npage->setEntry ( $text , $CommentBox , 0 , $user->getLink() , $MinorEdit*1 ) ; |
| 68 | + else $npage->setEntry ( $text , $CommentBox , $user->id , $user->name , $MinorEdit*1 ) ; |
| 69 | + global $wasSaved ; |
| 70 | + $wasSaved = true ; |
| 71 | + return "" ; |
| 72 | + } |
56 | 73 | } else if ( isset ( $PreviewButton ) ) { # Generating a preview to append to the page |
57 | 74 | unset ( $PreviewButton ) ; |
58 | 75 | $text = $EditBox ; |
59 | 76 | $text = str_replace ( "\\'" , "'" , $text ) ; |
60 | 77 | $text = str_replace ( "\\\"" , "\"" , $text ) ; |
| 78 | + $text = str_replace ( "&" , "&" , $text ) ; |
61 | 79 | $append = "<hr>\n<h2>Preview :</h2>\n".$npage->parseContents($text)."<hr><h3>Remember, this is only a preview and not yet saved!</h3>" ; |
62 | 80 | } else if ( $npage->doesTopicExist() ) { # The initial edit request for an existing page |
63 | 81 | $npage->load ( $npage->title ) ; |
— | — | @@ -69,21 +87,25 @@ |
70 | 88 | else $checked = "" ; |
71 | 89 | if ( $CommentBox == "" ) $CommentBox = "*" ; |
72 | 90 | |
73 | | - |
74 | 91 | # Just trying to set the initial keyboard focus to the edit window; doesn't work, though... |
75 | 92 | global $bodyOptions , $headerScript ; |
76 | 93 | $headerScript = "<script> <!-- function setfocus() { document.f.EditBox.focus(); } --> </script>" ; |
77 | 94 | $bodyOptions = " onLoad=setfocus()" ; |
78 | 95 | |
79 | 96 | $ret .= "<form method=POST name=f>" ; |
80 | | - $ret .= "<textarea tabindex=1 name=EditBox rows=".$user->options["rows"]." cols=".$user->options["cols"]." STYLE=\"width:100%\" WRAP=virtual>$text</textarea><br>\n" ; |
| 97 | + $ret .= "<textarea tabindex=1 name=EditBox rows=".$user->options["rows"]." cols=".$user->options["cols"]." STYLE=\"width:100%\" WRAP=virtual>".$text."</textarea><br>\n" ; |
81 | 98 | $ret .= "Summary:<input tabindex=2 type=text value=\"$CommentBox\" name=CommentBox size=50 maxlength=200> \n" ; |
82 | 99 | $ret .= "<input tabindex=3 type=checkbox name=MinorEdit $checked value=1>This is a minor edit \n" ; |
83 | 100 | $ret .= "<input tabindex=4 type=submit value=Save name=SaveButton> \n" ; |
84 | 101 | $ret .= "<input tabindex=5 type=submit value=Preview name=PreviewButton>\n" ; |
85 | 102 | $ret .= "<input type=hidden value=\"$EditTime\" name=EditTime>\n" ; |
86 | | - $ret .= "</form>" ; |
87 | 103 | |
| 104 | + if ( $editConflict ) { |
| 105 | + $ret .= "<br><hr><br><b>This is the text you submitted :</b><br>\n" ; |
| 106 | + $ret .= "<textarea name=NotIMPORTANT rows=".$user->options["rows"]." cols=".$user->options["cols"]." STYLE=\"width:100%\" WRAP=virtual>$oldSubmittedText</textarea><br>\n" ; |
| 107 | + } |
| 108 | + $ret .= " <a href=\"$THESCRIPT?title=$vpage->secureTitle\"><i>Return without saving changes</i></a></form>" ; |
| 109 | + |
88 | 110 | return $ret.$append ; |
89 | 111 | } |
90 | 112 | |
— | — | @@ -104,7 +126,7 @@ |
105 | 127 | $ti = new wikiTitle ; |
106 | 128 | $ti->setTitle ( $title ) ; |
107 | 129 | $theMiddle = "<h1>Your page <a href=\"$THESCRIPT?title=$ti->secureTitle\">$title</a> was successfully saved!</h1>" ; |
108 | | - $theMiddle .= "(If this page doesn't forward automatically, you have a really lame browser...)" ; |
| 130 | + $theMiddle .= "(If this page doesn't forward automatically, please click on the link above)" ; |
109 | 131 | $headerScript .= "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$THESCRIPT?title=$vpage->secureTitle\">"; |
110 | 132 | } |
111 | 133 | $ret .= $vpage->getMiddle ( $theMiddle ) ; |
Index: trunk/phpwiki/fpw/databaseFunctions.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <? |
3 | 3 | function getDBconnection () { |
4 | 4 | $server="127.0.0.1" ; |
5 | | - $user="root" ; |
6 | | - $passwd="" ; |
| 5 | + $user="manske" ; |
| 6 | + $passwd="KMnO4" ; |
7 | 7 | $connection=mysql_connect ( $server , $user , $passwd ) ; |
8 | 8 | return $connection ; |
9 | 9 | } |
Index: trunk/phpwiki/fpw/specialPages.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | global $ButtonSave ; |
101 | 101 | global $vpage , $user ; |
102 | 102 | $vpage->title = "User Settings" ; |
103 | | - if ( !$user->isLoggedIn ) return "You are not logged in! [[special:userLogin|Log in]] or go to the [[:HomePage|Home Page]]" ; |
| 103 | + if ( !$user->isLoggedIn ) return "You are not logged in! [[special:userLogin|Log in]] or go to the [[:Main Page|Main Page]]" ; |
104 | 104 | $ret = "" ; |
105 | 105 | |
106 | 106 | if ( isset ( $ButtonSave ) ) { |
— | — | @@ -240,7 +240,7 @@ |
241 | 241 | $vpage->special ( "The Most Wanted Pages" ) ; |
242 | 242 | $vpage->namespace = "" ; |
243 | 243 | $allPages = array () ; |
244 | | - $ret = "'''These articles don't exist, but other articles link to them!''' (the top 50)\n\n" ; |
| 244 | + $ret = "'''These articles don't exist, but other articles link to them!''' (the top 50)<br>\n" ; |
245 | 245 | |
246 | 246 | $connection = getDBconnection () ; |
247 | 247 | mysql_select_db ( "wikipedia" , $connection ) ; |
— | — | @@ -248,7 +248,6 @@ |
249 | 249 | $result = mysql_query ( $sql , $connection ) ; |
250 | 250 | while ( $s = mysql_fetch_object ( $result ) ) { |
251 | 251 | $allPages[$s->cur_title] = -999999999999 ; # Effectively removing existing topics from list |
252 | | - $u = explode ( "\n" , $s->cur_linked_links ) ; foreach ( $u as $x ) $allPages[$x] += 1 ; |
253 | 252 | $u = explode ( "\n" , $s->cur_unlinked_links ) ; foreach ( $u as $x ) $allPages[$x] += 1 ; |
254 | 253 | } |
255 | 254 | mysql_free_result ( $result ) ; |
— | — | @@ -256,12 +255,20 @@ |
257 | 256 | |
258 | 257 | |
259 | 258 | arsort ( $allPages ) ; |
260 | | - array_shift ( $allPages ) ; # Removing blank "link" |
| 259 | + $allPages = array_slice ( $allPages , 0 , 200 ) ; # Reducing needed memory |
| 260 | + $ti = new wikiTitle ; |
261 | 261 | $k = array_keys ( $allPages ) ; |
262 | | - for ( $a = 0 ; $a < 50 ; $a++ ) { |
| 262 | + |
| 263 | + $a = 0 ; |
| 264 | + $o = array () ; |
| 265 | + while ( count ( $o ) < 50 ) { |
263 | 266 | $x = $k[$a] ; |
264 | | - $ret .= "[[$x|".$vpage->getNiceTitle($x)."]] is wanted by ".$allPages[$x]." articles.<br>\n" ; |
| 267 | + $a++ ; |
| 268 | + $ti->setTitle ( $x ) ; |
| 269 | + if ( $x != "" and !$ti->doesTopicExist() ) |
| 270 | + array_push ( $o , "<li><a href=\"$THESCRIPT?action=edit&title=$x\">".$ti->getNiceTitle($x)."</a> is wanted by ".$allPages[$x]." articles.</li>\n" ) ; |
265 | 271 | } |
| 272 | + $ret .= "<nowiki><ol>".implode ( "" , $o )."</ol></nowiki>" ; |
266 | 273 | return $ret ; |
267 | 274 | } |
268 | 275 | |
— | — | @@ -271,7 +278,7 @@ |
272 | 279 | $vpage->special ( "The Orphans" ) ; |
273 | 280 | $vpage->namespace = "" ; |
274 | 281 | $allPages = array () ; |
275 | | - $ret = "'''These articles exist, but no articles link to them!'''\n\n" ; |
| 282 | + $ret = "'''These articles exist, but no articles link to them!''' (the first 50)\n\n" ; |
276 | 283 | |
277 | 284 | $connection = getDBconnection () ; |
278 | 285 | mysql_select_db ( "wikipedia" , $connection ) ; |
— | — | @@ -284,7 +291,10 @@ |
285 | 292 | } |
286 | 293 | mysql_free_result ( $result ) ; |
287 | 294 | mysql_close ( $connection ) ; |
288 | | - |
| 295 | + |
| 296 | + asort ( $allPages ) ; |
| 297 | + $allPages = array_slice ( $allPages , 0 , 50 ) ; |
| 298 | + |
289 | 299 | $orphans = array () ; |
290 | 300 | $v = array_keys ( $allPages ) ; |
291 | 301 | foreach ( $v as $x ) { |
— | — | @@ -825,7 +835,7 @@ |
826 | 836 | $message = "File <b>$removeFile</b> deleted!" ; |
827 | 837 | unset ( $removeFile ) ; |
828 | 838 | } else if (isset($Upload_name) or isset($Upload)) { |
829 | | - 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>" ; |
| 839 | + if ( $no_copyright != "AFFIRMED" ) return "<nowiki>You need to affirm that the file is not violating copygights. Return to the <a href=\"$THESCRIPT?title=special:upload\">Upload page</a></nowiki>" ; |
830 | 840 | $Upload_name = ereg_replace(" ", "_", $Upload_name); |
831 | 841 | $abc = split("\.", $Upload_name); |
832 | 842 | |
Index: trunk/phpwiki/fpw/wiki.phtml |
— | — | @@ -11,6 +11,18 @@ |
12 | 12 | include_once ( "./wikiPage.php" ) ; |
13 | 13 | include_once ( "./wikiUser.php" ) ; |
14 | 14 | |
| 15 | +# Checking for talk subpage |
| 16 | +function fixTalk ( $title ) { |
| 17 | + $sp = explode ( "/" , $title ) ; |
| 18 | + $ns = explode ( ":" , $title ) ; |
| 19 | + $lsp = array_pop ( $sp ) ; |
| 20 | + if ( strtolower ( $lsp ) == "talk" and count ( $sp ) > 0 ) { |
| 21 | + if ( count ( $ns ) == 1 or strtolower ( $ns[0] ) == "talk" ) |
| 22 | + $title = "talk:".implode ( "/" , $sp ) ; |
| 23 | + } |
| 24 | + return $title ; |
| 25 | + } |
| 26 | + |
15 | 27 | # Main program |
16 | 28 | global $action , $title , $pageTitle ; |
17 | 29 | global $user , $search , $expiration ; |
— | — | @@ -24,8 +36,9 @@ |
25 | 37 | |
26 | 38 | # Default settings |
27 | 39 | if ( $action == "" ) $action = "view" ; |
28 | | - if ( $title == "" ) $title = "HomePage" ; |
29 | | - |
| 40 | + if ( $title == "" ) $title = "Main Page" ; |
| 41 | + |
| 42 | + $title = fixTalk ( $title ) ; |
30 | 43 | $theTitle = new wikiTitle ; |
31 | 44 | $theTitle->title = urldecode ( $title ) ; |
32 | 45 | $theTitle->makeSecureTitle () ; |
Index: trunk/phpwiki/fpw/wikiPage.php |
— | — | @@ -4,6 +4,7 @@ |
5 | 5 | |
6 | 6 | class WikiPage extends WikiTitle { |
7 | 7 | var $contents ; # The actual article body |
| 8 | + var $backLink ; # For redirects |
8 | 9 | var $knownLinkedLinks , $knownUnlinkedLinks ; # Used for faster display |
9 | 10 | |
10 | 11 | #### Database management functions |
— | — | @@ -11,6 +12,7 @@ |
12 | 13 | # This loads an article from the database, or calls a special function instead (all pages with "special:" namespace) |
13 | 14 | function load ( $t , $doRedirect = true ) { |
14 | 15 | global $action , $user ; |
| 16 | + if ( $doRedirect ) $this->backLink = "" ; |
15 | 17 | $this->knownLinkedLinks = array () ; |
16 | 18 | $this->knownUnlinkedLinks = array () ; |
17 | 19 | $this->title = $t ; |
— | — | @@ -65,11 +67,13 @@ |
66 | 68 | $this->makeURL () ; |
67 | 69 | $this->splitTitle () ; |
68 | 70 | if ( strtolower ( substr ( $this->contents , 0 , 9 ) ) == "#redirect" and $doRedirect and $action != "edit" ) { # #REDIRECT |
| 71 | + $this->backLink = "(redirected from <a href=\"$THESCRIPT?action=edit&title=$this->secureTitle\">".$this->getNiceTitle()."</a>)" ; |
69 | 72 | $z = $this->contents ; |
70 | | - $z = strstr ( $z , "[[" ) ; |
71 | | - $z = str_replace ( "[[" , "" , $z ) ; |
72 | | - $z = str_replace ( "]]" , "" , $z ) ; |
73 | | - $this->load ( trim($z) , false ) ; |
| 73 | +# $z = strstr ( $z , "[[" ) ; |
| 74 | + $z = substr ( $z , 10 ) ; |
| 75 | + $z = str_replace ( "[" , "" , $z ) ; |
| 76 | + $z = str_replace ( "]" , "" , $z ) ; |
| 77 | + $this->load ( trim($z) , false , $backLink ) ; |
74 | 78 | } |
75 | 79 | } |
76 | 80 | |
— | — | @@ -199,7 +203,7 @@ |
200 | 204 | } |
201 | 205 | |
202 | 206 | #### Rendering functions |
203 | | - # This function converts wiki-style internal links like [[HomePage]] with the appropriate HTML code |
| 207 | + # This function converts wiki-style internal links like [[Main Page]] with the appropriate HTML code |
204 | 208 | # It has to handle namespaces, subpages, and alternate names (as in [[namespace:page/subpage name]]) |
205 | 209 | function replaceInternalLinks ( $s ) { |
206 | 210 | global $THESCRIPT ; |
— | — | @@ -253,7 +257,7 @@ |
254 | 258 | |
255 | 259 | # This function replaces wiki-style image links with the HTML code to display them |
256 | 260 | function parseImages ( $s ) { |
257 | | - $s = ereg_replace ( "http://([a-zA-Z0-9_/:.]*)\.(png|jpg|jpeg|tif|tiff|gif)" , "<img src=\"http://\\1.\\2\">" , $s ) ; |
| 261 | + $s = ereg_replace ( "([^[])http://([a-zA-Z0-9_/:.\-]*)\.(png|jpg|jpeg|tif|tiff|gif)" , "\\1<img src=\"http://\\2.\\3\">" , $s ) ; |
258 | 262 | return $s ; |
259 | 263 | } |
260 | 264 | |
— | — | @@ -264,7 +268,8 @@ |
265 | 269 | $a = explode ( "[http://" , " ".$s ) ; |
266 | 270 | $s = array_shift ( $a ) ; |
267 | 271 | $s = substr ( $s , 1 ) ; |
268 | | - $image = "<img src=earth_small.png valign=center border=0>" ; # Remove or set to blank for no image |
| 272 | + $image = "" ; # with an <img tag, this will be displayed before external links |
| 273 | + $linkStyle = "style=\"color:#3333BB;text-decoration:none\"" ; |
269 | 274 | foreach ( $a as $t ) { |
270 | 275 | $b = spliti ( "]" , $t , 2 ) ; |
271 | 276 | if ( count($b) < 2 ) $s .= "Illegal link : ?$b[0]?" ; |
— | — | @@ -281,13 +286,13 @@ |
282 | 287 | if ( substr_count ( $b[1] , "<hr>" ) > 0 ) $cnt = 1 ; |
283 | 288 | $link = "~http://".$link ; |
284 | 289 | if ( $user->options["showHover"] == "yes" ) $hover = "title=\"$link\"" ; |
285 | | - $s .= "<a href=\"$link\" $hover>$image$text</a>" ; |
286 | | - $s .= $b[1] ; |
| 290 | + $theLink = "<a href=\"$link\" $linkStyle $hover>$image$text</a>" ; |
| 291 | + $s .= $theLink.$b[1] ; |
287 | 292 | } |
288 | 293 | } |
289 | 294 | |
290 | 295 | $o = "A-Za-z0-9/\.:?&=_~%-@^" ; |
291 | | - $s = eregi_replace ( "([^~\"])http://([$o]+)([^$o])" , "\\1<a href=\"http://\\2\">".$image."http://\\2</a>\\3" , $s ) ; |
| 296 | + $s = eregi_replace ( "([^~\"])http://([$o]+)([^$o])" , "\\1<a href=\"http://\\2\" $linkStyle>".$image."http://\\2</a>\\3" , $s ) ; |
292 | 297 | $s = str_replace ( "~http://" , "http://" , $s ) ; |
293 | 298 | |
294 | 299 | return $s ; |
— | — | @@ -325,16 +330,23 @@ |
326 | 331 | |
327 | 332 | # This function is called to replace wiki-style tags with HTML, e.g., the first occurrence of ''' with <b>, the second with </b> |
328 | 333 | function pingPongReplace ( $f , $r1 , $r2 , $s ) { |
329 | | - $a = explode ( $f , " ".$s ) ; |
330 | | - if ( count ( $a ) == 1 ) return $s ; |
331 | | - $s = substr ( array_shift ( $a ) , 1 ) ; |
332 | | - $r = $r1 ; |
333 | | - foreach ( $a as $t ) { |
334 | | - $s .= $r.$t ; |
335 | | - if ( $r == $r1 ) $r = $r2 ; |
336 | | - else $r = $r1 ; |
| 334 | + $ret = "" ; |
| 335 | + $lines = explode ( "\n" , $s ) ; |
| 336 | + foreach ( $lines as $s ) { |
| 337 | + $a = explode ( $f , " ".$s ) ; |
| 338 | + $app = "" ; |
| 339 | + $s = substr ( array_shift ( $a ) , 1 ) ; |
| 340 | + $r = $r1 ; |
| 341 | + if ( count ( $a ) % 2 != 0 ) $app = $f.array_pop ( $a ) ; |
| 342 | + foreach ( $a as $t ) { |
| 343 | + $s .= $r.$t ; |
| 344 | + if ( $r == $r1 ) $r = $r2 ; |
| 345 | + else $r = $r1 ; |
| 346 | + } |
| 347 | + if ( $ret != "" ) $ret .= "\n" ; |
| 348 | + $ret .= $s.$app ; |
337 | 349 | } |
338 | | - return $s ; |
| 350 | + return $ret ; |
339 | 351 | } |
340 | 352 | |
341 | 353 | # This function organizes the <nowiki> parts and calls subPageContents() for the wiki parts |
— | — | @@ -355,7 +367,7 @@ |
356 | 368 | if ( count ( $c ) == 2 ) { |
357 | 369 | array_push ( $b , $c[0] ) ; |
358 | 370 | $s .= $d.$c[1] ; |
359 | | - } else $s .= "<nowiki>".$x ; |
| 371 | + } else $s .= "<nowiki>".$x ; |
360 | 372 | } |
361 | 373 | |
362 | 374 | # If called from setEntry(), only parse internal links and return dummy entry |
— | — | @@ -399,9 +411,10 @@ |
400 | 412 | $s = $this->pingPongReplace ( "''" , "<i>" , "</i>" , $s ) ; |
401 | 413 | $s = $this->pingPongReplace ( "====" , "<h4>" , "</h4>" , $s ) ; |
402 | 414 | $s = $this->pingPongReplace ( "===" , "<h3>" , "</h3>" , $s ) ; |
| 415 | + $s = $this->pingPongReplace ( "==" , "<h2>" , "</h2>" , $s ) ; |
403 | 416 | |
404 | 417 | # Automatic links to subpages (e.g., /Talk -> [[/Talk]] |
405 | | - $s = ereg_replace ( "([\n| ])/([a-zA-Z0-9_]*)" , "\\1[[/\\2|/\\2]]" , $s ) ; |
| 418 | + $s = ereg_replace ( "([\n| ])/([a-zA-Z0-9]+)" , "\\1[[/\\2|/\\2]]" , $s ) ; |
406 | 419 | |
407 | 420 | # Parsing through the text line by line |
408 | 421 | # The main thing happening here is handling of lines starting with * # : etc. |
— | — | @@ -491,7 +504,7 @@ |
492 | 505 | global $user , $oldID , $version ; |
493 | 506 | $editOldVersion = "" ; |
494 | 507 | if ( $oldID != "" ) $editOldVersion="&oldID=$oldID&version=$version" ; |
495 | | - $ret = "<a href=\"$THESCRIPT\">Homepage</a>" ; |
| 508 | + $ret = "<a href=\"$THESCRIPT\">Main Page</a>" ; |
496 | 509 | |
497 | 510 | $spl = $this->getSubpageList () ; |
498 | 511 | if ( count ( $spl ) > 0 and $this->subpageTitle != "" ) { |
— | — | @@ -532,11 +545,12 @@ |
533 | 546 | $subText = array () ; |
534 | 547 | if ( $user->isLoggedIn ) { |
535 | 548 | if ( $user->doWatch($this->title) ) |
536 | | - array_push($subText,"<br><a href=\"$THESCRIPT?action=watch&title=$this->secureTitle&mode=no\">Stop watching this article for me</a>"); |
537 | | - else array_push($subText,"<br><a href=\"$THESCRIPT?action=watch&title=$this->secureTitle&mode=yes\">Watch this article for me</a>") ; |
| 549 | + array_push($subText,"<a href=\"$THESCRIPT?action=watch&title=$this->secureTitle&mode=no\">Stop watching this article for me</a>"); |
| 550 | + else array_push($subText,"<a href=\"$THESCRIPT?action=watch&title=$this->secureTitle&mode=yes\">Watch this article for me</a>") ; |
538 | 551 | } |
539 | 552 | if ( $action == "view" and !$this->isSpecialPage ) array_push ( $subText , "<a href=\"$THESCRIPT?action=print&title=$this->secureTitle\">Printable version</a>" ) ; |
540 | | - $ret .= implode ( " | " , $subText ) ; |
| 553 | + if ( $this->backLink != "" ) array_push ( $subText , $this->backLink ) ; |
| 554 | + $ret .= "<br>".implode ( " | " , $subText ) ; |
541 | 555 | } |
542 | 556 | $ret .= "</td>\n<td valign=top width=200 rowspan=2 nowrap>".$user->getLink()."<br>" ; |
543 | 557 | if ( $user->isLoggedIn ) $ret .= "<a href=\"$THESCRIPT?title=special:userLogout\">Log out</a> | <a href=\"$THESCRIPT?title=special:editUserSettings\">Preferences</a>" ; |
— | — | @@ -555,7 +569,7 @@ |
556 | 570 | $editOldVersion = "" ; |
557 | 571 | if ( $oldID != "" ) $editOldVersion="&oldID=$oldID&version=$version" ; |
558 | 572 | $column = "<nowiki>" ; |
559 | | - $column .= "<a href=\"$THESCRIPT?title=HomePage\">HomePage</a>\n" ; |
| 573 | + $column .= "<a href=\"$THESCRIPT\">Main Page</a>\n" ; |
560 | 574 | $column .= "<br><a href=\"$THESCRIPT?title=special:RecentChanges\">Recent Changes</a>\n" ; |
561 | 575 | if ( $this->canEdit() ) $column .= "<br><a href=\"$THESCRIPT?action=edit&title=$this->url$editOldVersion\">Edit this page</a>\n" ; |
562 | 576 | |