Index: trunk/phpwiki/fpw/specialPages.php |
— | — | @@ -325,7 +325,7 @@ |
326 | 326 | |
327 | 327 | function LonelyPages () { |
328 | 328 | global $linkedLinks , $unlinkedLinks , $vpage ; |
329 | | - $vpage->special ( "The Lonely Pages" ) ; |
| 329 | + $vpage->special ( "The Orphans" ) ; |
330 | 330 | $vpage->namespace = "" ; |
331 | 331 | $allPages = array () ; |
332 | 332 | $linkedLinks = array () ; |
— | — | @@ -553,28 +553,30 @@ |
554 | 554 | } |
555 | 555 | |
556 | 556 | function recentchanges () { |
557 | | - global $vpage , $maxcnt , $PHP_SELF , $SERVER_NAME ; |
| 557 | + global $vpage , $maxcnt ; |
558 | 558 | $vpage->special ( "Recent Changes" ) ; |
559 | 559 | $vpage->makeSecureTitle() ; |
560 | 560 | if ( !isset ( $maxcnt ) ) $maxcnt = 100 ; |
| 561 | + $daysAgo = 3 ; |
561 | 562 | |
562 | | - $ret = "" ; |
563 | | - $ret .= "<b>These are the last $maxcnt changes made on [[Wikipedia]].</b> View the last " ; |
564 | | - $ret .= "[http://$SERVER_NAME$PHP_SELF?title=special:RecentChanges&maxcnt=50 50] / " ; |
565 | | - $ret .= "[http://$SERVER_NAME$PHP_SELF?title=special:RecentChanges&maxcnt=100 100] / " ; |
566 | | - $ret .= "[http://$SERVER_NAME$PHP_SELF?title=special:RecentChanges&maxcnt=250 250] / " ; |
567 | | - $ret .= "[http://$SERVER_NAME$PHP_SELF?title=special:RecentChanges&maxcnt=500 500] " ; |
568 | | - $ret .= "changes." ; |
| 563 | + $ret = "<nowiki>" ; |
| 564 | + $ret .= "These are the last <b>$maxcnt</b> of the changes made on Wikipedia in the last $daysAgo days. View the last " ; |
| 565 | + $ret .= "<a href=\"$PHP_SELF?title=special:RecentChanges&maxcnt=50\">50</a> / " ; |
| 566 | + $ret .= "<a href=\"$PHP_SELF?title=special:RecentChanges&maxcnt=100\">100</a> / " ; |
| 567 | + $ret .= "<a href=\"$PHP_SELF?title=special:RecentChanges&maxcnt=250\">250</a> / " ; |
| 568 | + $ret .= "<a href=\"$PHP_SELF?title=special:RecentChanges&maxcnt=500\">500</a> " ; |
| 569 | + $ret .= "changes.<br></nowiki>" ; |
569 | 570 | $arr = array () ; |
570 | 571 | |
| 572 | + $mindate = date ( "Ymd000000" , time () - $daysAgo*24*60*60 ) ; |
571 | 573 | $connection=getDBconnection() ; |
572 | 574 | mysql_select_db ( "wikipedia" , $connection ) ; |
573 | | - $sql = "SELECT * FROM cur ORDER BY cur_timestamp DESC LIMIT $maxcnt" ; |
| 575 | + $sql = "SELECT cur_timestamp,cur_title,cur_comment,cur_user,cur_user_text,cur_minor_edit FROM cur WHERE cur_timestamp>$mindate ORDER BY cur_timestamp DESC LIMIT $maxcnt" ; |
574 | 576 | $result = mysql_query ( $sql , $connection ) ; |
575 | 577 | while ( $s = mysql_fetch_object ( $result ) ) array_push ( $arr , $s ) ; |
576 | 578 | mysql_free_result ( $result ) ; |
577 | 579 | mysql_close ( $connection ) ; |
578 | | - $ret .= recentChangesLayout ( $arr ) ; |
| 580 | + $ret .= recentChangesLayout($arr) ; |
579 | 581 | return $ret ; |
580 | 582 | } |
581 | 583 | |
— | — | @@ -585,7 +587,7 @@ |
586 | 588 | $color2 = $user->options["tabLine2"] ; |
587 | 589 | $xyz = new WikiTitle ; |
588 | 590 | $editTypes = array ( "0"=>"" , "1"=>"<font color=green>M</font>" , "2"=>"<font color=red>N</font>" ) ; |
589 | | - $ret = " ('''Legend :''' ".$editTypes["1"]."=Minor edit ; ".$editTypes["2"]."=New article.)" ; |
| 591 | + $ret = " (<b>Legend :</b> ".$editTypes["1"]."=Minor edit ; ".$editTypes["2"]."=New article.)" ; |
590 | 592 | $ret .= "<table width=100% border=0 cellpadding=2 cellspacing=0>\n" ; |
591 | 593 | $dummy = "$PHP_SELF?x=y" ; |
592 | 594 | foreach ( $arr as $s ) { |
— | — | @@ -598,7 +600,11 @@ |
599 | 601 | $color = $color1 ; |
600 | 602 | } |
601 | 603 | $u = $s->cur_user_text ; |
602 | | - if ( $s->cur_user != 0 ) $u = "[[user:$u|$u]]" ; |
| 604 | + if ( $s->cur_user != 0 ) { |
| 605 | + $xyz->title = $u ; |
| 606 | + $xyz->makeSecureTitle () ; |
| 607 | + $u = "<a href=\"$PHP_SELF?title=user:$xyz->secureTitle\">$u</a>" ; |
| 608 | + } |
603 | 609 | $comment = trim($s->cur_comment) ; |
604 | 610 | if ( $comment == "*" ) $comment = "" ; |
605 | 611 | if ( $s->cur_minor_edit == 1 ) $comment = "<font size=-1><i>$comment</i></font>" ; |
— | — | @@ -606,12 +612,13 @@ |
607 | 613 | $minor = $editTypes[$s->cur_minor_edit] ; |
608 | 614 | |
609 | 615 | $t = "<tr><td$color valign=top width=0%>" ; |
610 | | - if ( $s->version == "current" ) $t .= "<a href=\"$PHP_SELF?$s->cur_title&diff=yes\">(diff)</a> " ; |
611 | | - else if ( $s->version != "" ) $t .= "<a href=\"$PHP_SELF?$s->cur_title&oldID=$s->old_id&version=$s->version&diff=yes\">(diff)</a> " ; |
| 616 | + if ( $s->version == "current" ) $t .= "<a href=\"$PHP_SELF?title=$s->cur_title&diff=yes\">(diff)</a> " ; |
| 617 | + 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 | + else $t .= "<a href=\"$PHP_SELF?title=$s->cur_title&diff=yes\">(diff)</a>" ; |
612 | 619 | $t .= "</td><td$color valign=top>" ; |
613 | 620 | if ( $s->version == "current" ) $t .= "<a href=\"$PHP_SELF?$s->cur_title\">$nt</a></td>" ; |
614 | 621 | else if ( $s->version != "" ) $t .= "<a href=\"$PHP_SELF?$s->cur_title&oldID=$s->old_id&version=$s->version\">$nt ($s->version)</a></td>" ; |
615 | | - else $t .= "[[$s->cur_title|$nt]]</td>" ; |
| 622 | + else $t .= "<a href=\"$PHP_SELF?title=$s->cur_title\">$nt</a>" ; |
616 | 623 | $t .= "<td$color valign=top width=0% nowrap>$time</td>" ; |
617 | 624 | if ( $s->version != "" ) { |
618 | 625 | $v = new wikiTitle ; |
— | — | @@ -628,7 +635,7 @@ |
629 | 636 | else $color = $color1 ; |
630 | 637 | } |
631 | 638 | $ret .= "</table>" ; |
632 | | - return $ret ; |
| 639 | + return "<nowiki>$ret</nowiki>" ; |
633 | 640 | } |
634 | 641 | |
635 | 642 | function modifyArray ( $a , $sep , $rem , $add = "" ) { |
Index: trunk/phpwiki/fpw/wikiPage.php |
— | — | @@ -99,11 +99,12 @@ |
100 | 100 | $s = mysql_fetch_object ( $result ) ; |
101 | 101 | mysql_free_result ( $result ) ; |
102 | 102 | |
| 103 | + $s->cur_text = str_replace ( "\"" , "\\\"" , $s->cur_text ) ; |
103 | 104 | $sql = "INSERT INTO old (old_title,old_old_version,old_text,old_comment,old_user,old_user_text,old_minor_edit)"; |
104 | | - $sql .= " VALUES (\"$this->secureTitle\",$oid,\"$s->cur_text\",\"$s->cur_comment\",$s->cur_user,\"$s->cur_user_text\",$s->cur_minor_edit)" ; |
| 105 | + $sql .= " VALUES (\"$this->secureTitle\",\"$oid\",\"".$s->cur_text."\",\"".$s->cur_comment."\",\"$s->cur_user\",\"$s->cur_user_text\",$s->cur_minor_edit)" ; |
105 | 106 | mysql_query ( $sql , $connection ) ; |
106 | 107 | |
107 | | - $sql = "SELECT old_id FROM old WHERE old_old_version=$oid AND old_title=\"$this->secureTitle\"" ; |
| 108 | + $sql = "SELECT old_id FROM old WHERE old_old_version=\"$oid\" AND old_title=\"$this->secureTitle\"" ; |
108 | 109 | $result = mysql_query ( $sql , $connection ) ; |
109 | 110 | $s = mysql_fetch_object ( $result ) ; |
110 | 111 | mysql_free_result ( $result ) ; |
— | — | @@ -130,6 +131,7 @@ |
131 | 132 | $a = explode ( "[[" , " ".$s ) ; |
132 | 133 | $s = array_shift ( $a ) ; |
133 | 134 | $s = substr ( $s , 1 ) ; |
| 135 | + $connection = getDBconnection () ; |
134 | 136 | foreach ( $a as $t ) { |
135 | 137 | $b = explode ( "]]" , $t , 2 ) ; |
136 | 138 | if ( count($b) < 2 ) $s .= "Illegal link : ?$b[0]?" ; |
— | — | @@ -146,7 +148,7 @@ |
147 | 149 | $text = $c[1] ; |
148 | 150 | |
149 | 151 | |
150 | | - if ( $topic->doesTopicExist() ) { |
| 152 | + if ( $topic->doesTopicExist( $connection ) ) { |
151 | 153 | $linkedLinks[$topic->secureTitle]++ ; |
152 | 154 | if ( $user->options["showHover"] == "yes" ) $hover = "title=\"$link\"" ; |
153 | 155 | $s .= "<a href=\"$PHP_SELF?title=".urlencode($link)."\" $hover>$text</a>" ; |
— | — | @@ -166,6 +168,7 @@ |
167 | 169 | $s .= $b[1] ; |
168 | 170 | } |
169 | 171 | } |
| 172 | + mysql_close ( $connection ) ; |
170 | 173 | return $s ; |
171 | 174 | } |
172 | 175 | function parseImages ( $s ) { |
— | — | @@ -203,7 +206,7 @@ |
204 | 207 | |
205 | 208 | # $o = "A-Za-z0-9/\.:?&=~%-@^" ; |
206 | 209 | # $s = eregi_replace ( "([^~])http://([$o]+)([^$o])" , "\\1<a href=\"http://\\2\">http://\\2</a>\\3" , $s ) ; |
207 | | -# $s = str_replace ( "~http://" , "http://" , $s ) ; |
| 210 | + $s = str_replace ( "~http://" , "http://" , $s ) ; |
208 | 211 | |
209 | 212 | return $s ; |
210 | 213 | } |
— | — | @@ -372,7 +375,10 @@ |
373 | 376 | global $user , $action ; |
374 | 377 | $t = $this->getNiceTitle ( $this->title ) ; |
375 | 378 | if ( substr_count ( $t , ":" ) > 0 ) $t = ucfirst ( $t ) ; |
376 | | - $ret = "<table ".$user->options["quickBarBackground"]." width=100% border=1 frame=below rules=none bordercolor=black cellspacing=0>\n<tr>" ; |
| 379 | + global $HTTP_USER_AGENT ; |
| 380 | + if ( stristr ( $HTTP_USER_AGENT , "MSIE" ) ) $border = "border=1 frame=below rules=none" ; |
| 381 | + else $border = "border=0" ; |
| 382 | + $ret = "<table ".$user->options["quickBarBackground"]." width=100% $border bordercolor=black cellspacing=0>\n<tr>" ; |
377 | 383 | if ( $user->options["leftImage"] != "" ) |
378 | 384 | $ret .= "<td width=1% rowspan=2 bgcolor=#000000><img src=\"".$user->options["leftImage"]."\"></td>" ; |
379 | 385 | $ret .= "<td valign=top height=1>" ; |
— | — | @@ -411,7 +417,7 @@ |
412 | 418 | $column .= "<br><a href=\"$PHP_SELF?title=special:Upload\">Upload files</a>\n" ; |
413 | 419 | $column .= "<hr>" ; |
414 | 420 | $column .= "<a href=\"$PHP_SELF?title=special:Statistics\">Statistics</a>" ; |
415 | | - $column .= "<br>\n<a href=\"$PHP_SELF?title=special:LonelyPages\">Lonely pages</a>" ; |
| 421 | + $column .= "<br>\n<a href=\"$PHP_SELF?title=special:LonelyPages\">Orphans</a>" ; |
416 | 422 | $column .= "<br>\n<a href=\"$PHP_SELF?title=special:WantedPages\">Most wanted</a>" ; |
417 | 423 | $column .= "<br>\n<a href=\"$PHP_SELF?title=special:AllPages\">All pages</a>" ; |
418 | 424 | $column .= "<br>\n<a href=\"$PHP_SELF?title=special:RandomPage\">Random Page</a>" ; |
— | — | @@ -433,7 +439,10 @@ |
434 | 440 | |
435 | 441 | $column = "<td ".$user->options["quickBarBackground"]." width=110 valign=top nowrap>".$column."</td>" ; |
436 | 442 | $ret = "<td valign=top>".$ret."</td>" ; |
437 | | - $table = "<table width=100% border=1 frame=void bordercolor=black rules=cols cellpadding=2 cellspacing=0><tr>" ; |
| 443 | + global $HTTP_USER_AGENT ; |
| 444 | + if ( stristr ( $HTTP_USER_AGENT , "MSIE" ) ) $border = "border=1 frame=void rules=cols" ; |
| 445 | + else $border = "border=0" ; |
| 446 | + $table = "<table width=100% $border bordercolor=black cellpadding=2 cellspacing=0><tr>" ; |
438 | 447 | $qb = $user->options["quickBar"] ; |
439 | 448 | if ( $user->options["forceQuickBar"] != "" ) $qb = $user->options["forceQuickBar"] ; |
440 | 449 | if ( $qb == "left" ) $ret = $table.$column.$ret."</tr></table>" ; |
— | — | @@ -444,7 +453,10 @@ |
445 | 454 | } |
446 | 455 | function getFooter () { |
447 | 456 | $ret = $this->getLinkBar() ; |
448 | | - $ret = "<table width=100% border=1 frame=above rules=none bordercolor=black cellspacing=0><tr><td>$ret</td></tr></table>" ; |
| 457 | + global $HTTP_USER_AGENT ; |
| 458 | + if ( stristr ( $HTTP_USER_AGENT , "MSIE" ) ) $border = "border=1 frame=above rules=none" ; |
| 459 | + else $border = "border=0" ; |
| 460 | + $ret = "<table width=100% $border bordercolor=black cellspacing=0><tr><td>$ret</td></tr></table>" ; |
449 | 461 | $ret .= "<FORM>Search: <INPUT TYPE=text NAME=search SIZE=20></FORM>" ; |
450 | 462 | return $ret ; |
451 | 463 | } |
— | — | @@ -457,7 +469,7 @@ |
458 | 470 | return $this->getHeader().$middle.$this->getFooter() ; |
459 | 471 | } |
460 | 472 | function doDiff () { |
461 | | - global $oldID , $version ; |
| 473 | + global $oldID , $version , $user ; |
462 | 474 | $ret = "<nowiki><font color=red><b>BEGIN DIFF</b></font><br>\n" ; |
463 | 475 | $connection = getDBconnection () ; |
464 | 476 | mysql_select_db ( "wikipedia" , $connection ) ; |
— | — | @@ -475,6 +487,11 @@ |
476 | 488 | $sql = "SELECT * FROM old WHERE old_id=$s->cur_old_version" ; |
477 | 489 | } |
478 | 490 | |
| 491 | + $fc = $user->options["background"] ; |
| 492 | + if ( $fc == "" ) $fc = "=white" ; |
| 493 | + $fc = substr ( $fc , strpos("=",$fc)+1 ) ; |
| 494 | + $bc = " bordercolor=".$fc ; |
| 495 | + $fc = " color=".$fc ; |
479 | 496 | $result = mysql_query ( $sql , $connection ) ; |
480 | 497 | if ( $result != "" and $s->old_old_version != 0 ) { |
481 | 498 | $s = mysql_fetch_object ( $result ) ; |
— | — | @@ -483,13 +500,13 @@ |
484 | 501 | $a2 = explode ( "\n" , $s->old_text ) ; |
485 | 502 | $nl = array () ; |
486 | 503 | $dl = array () ; |
487 | | - foreach ( $a1 as $x ) if ( !in_array ( $x , $a2 ) ) array_push ( $nl , $x ) ; |
488 | | - foreach ( $a2 as $x ) if ( !in_array ( $x , $a1 ) ) array_push ( $dl , $x ) ; |
| 504 | + foreach ( $a1 as $x ) if ( !in_array ( $x , $a2 ) ) array_push ( $nl , htmlentities ( $x ) ) ; |
| 505 | + foreach ( $a2 as $x ) if ( !in_array ( $x , $a1 ) ) array_push ( $dl , htmlentities ( $x ) ) ; |
489 | 506 | # Output |
490 | 507 | $ret .= "<font color=#0000FF>Blue text</font> was added or changed, <font color=red>red text</font> was changed or deleted." ; |
491 | | - $ret .= "<table width=100% border=1 bordercolor=white cellspacing=0 cellpadding=2>\n" ; |
492 | | - foreach ( $nl as $x ) $ret .= "<tr><td bgcolor=#0000FF><font color=white>$x</font></td></tr>\n" ; |
493 | | - foreach ( $dl as $x ) $ret .= "<tr><td bgcolor=#DD0000><font color=white>$x</font></td></tr>\n" ; |
| 508 | + $ret .= "<table width=100% border=1$bc cellspacing=0 cellpadding=2>\n" ; |
| 509 | + foreach ( $nl as $x ) $ret .= "<tr><td bgcolor=#0000FF><font$fc>$x</font></td></tr>\n" ; |
| 510 | + foreach ( $dl as $x ) $ret .= "<tr><td bgcolor=#DD0000><font$fc>$x</font></td></tr>\n" ; |
494 | 511 | $ret .= "</table>\n" ; |
495 | 512 | } 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" ; |
496 | 513 | else $ret .= "No diff possible. Reason unknown. Blame the programmer! Tell him SQL said \"$sql\"<br>\n" ; |
Index: trunk/phpwiki/fpw/wikiTitle.php |
— | — | @@ -94,17 +94,18 @@ |
95 | 95 | } |
96 | 96 | function makeAll () { $this->makeSecureTitle(); $this->makeURL(); } |
97 | 97 | function setTitle ( $t ) { $this->title = $t ; $this->makeAll() ; } |
98 | | - function doesTopicExist () { |
| 98 | + function doesTopicExist ( $conn = "" ) { |
99 | 99 | $this->makeSecureTitle () ; |
100 | 100 | if ( $this->namespace == "special" ) return true ; |
101 | | - $connection = getDBconnection () ; |
| 101 | + if ( $conn == "" ) $connection = getDBconnection () ; |
| 102 | + else $connection = $conn ; |
102 | 103 | mysql_select_db ( "wikipedia" , $connection ) ; |
103 | 104 | $sql = "SELECT cur_id FROM cur WHERE cur_title=\"$this->secureTitle\"" ; |
104 | 105 | $result = mysql_query ( $sql , $connection ) ; |
105 | 106 | if ( $result == "" ) return false ; |
106 | 107 | if ( $s = mysql_fetch_object ( $result ) ) { |
107 | 108 | mysql_free_result ( $result ) ; |
108 | | - mysql_close ( $connection ) ; |
| 109 | + if ( $conn == "" ) mysql_close ( $connection ) ; # Closing local connection |
109 | 110 | return true ; |
110 | 111 | } |
111 | 112 | return false ; |