r110 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109‎ | r110 | r111 >
Date:17:59, 10 February 2002
Author:magnus_manske
Status:old
Tags:
Comment:
added 'Longest Pages' (to break them down into smaller ones;)
Modified paths:
  • /trunk/phpwiki/fpw/special_longpages.php (added) (history)
  • /trunk/phpwiki/fpw/wikiPage.php (modified) (history)
  • /trunk/phpwiki/fpw/wikiTextEn.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/fpw/wikiTextEn.php
@@ -14,7 +14,7 @@
1515 $wikiMainPage = "Main Page" ; # This is actual the title of the article in the database
1616 $wikiErrorPageTitle = "Yikes! An error!" ;
1717 $wikiErrorMessage = "<h2>$1!</h2>Return to the [[:Main Page|Main Page]]!" ;
18 -$wikiAllowedSpecialPages = array("userlogin","userlogout","newpages","recentchanges","upload","statistics","lonelypages","popularpages","wantedpages","allpages","randompage","shortpages","listusers","watchlist","special_pages","editusersettings","deletepage","protectpage","contributions","whatlinkshere");
 18+$wikiAllowedSpecialPages = array("userlogin","userlogout","newpages","recentchanges","upload","statistics","lonelypages","popularpages","wantedpages","allpages","randompage","shortpages","longpages","listusers","watchlist","special_pages","editusersettings","deletepage","protectpage","contributions","whatlinkshere");
1919 $wikiRecentChangesText = "Track the most recent changes to Wikipedia on this page. [[Welcome, newcomers]]! Please have a look at these pages: [[Wikipedia FAQ]], [[Wikipedia policy]] (especially [[naming conventions]] and [[neutral point of view]]), and [[most common Wikipedia faux pas]].<br>If you want to see the Wikipedia succeed, it's very important that you don't add material restricted by others' [[copyright]]s. The legal liability could really hurt the project, so please don't do it.<br>See also the [http://meta.wikipedia.com/wiki.phtml?title=special:RecentChanges recent meta discussion]" ;
2020 $wikiMetaDescription = "$1... Read more here at wikipedia, the free encyclopedia!" ;
2121
@@ -78,6 +78,7 @@
7979 $wikiMostWanted = "Most wanted" ;
8080 $wikiAllPages = "All pages" ;
8181 $wikiStubs = "Stub articles" ;
 82+$wikiLongPages = "Long articles" ;
8283 $wikiListUsers = "List users" ;
8384 $wikiMyWatchlist = "My watchlist" ;
8485 $wikiBeginDiff = "BEGIN DIFF" ;
@@ -303,7 +304,9 @@
304305 $wikiSpecialTitle = "Special Pages" ;
305306 $wikiSpecialText = "<b>This is a list of special pages.</b> 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>" ;
306307 $wikiStubTitle = "Short 'stub' articles" ;
307 -$wikiStubText = "'''These are all the articles in the database, sorted by length.'''<br>''#REDIRECT pages and pages within a namespace (like Talk:) are '''not''' listed here!''\n\n" ;
 308+$wikiLongPagesTitle = "The longest articles" ;
 309+$wikiStubText = "'''These are all the articles in the database, sorted by length, shortest first.'''<br>''#REDIRECT pages and pages within a namespace (like Talk:) are '''not''' listed here!''\n\n" ;
 310+$wikiLongPagesText = "'''These are all the articles in the database, sorted by length, longest first.'''<br>''#REDIRECT pages and pages within a namespace (like Talk:) are '''not''' listed here!''\n\n" ;
308311 $wikiStubChars = "$1 chars" ;
309312 $wikiStubDelete = "<b>Delete this page!</b>" ;
310313 $wikiStubLinkHere = "$1 articles link here." ;
Index: trunk/phpwiki/fpw/wikiPage.php
@@ -934,7 +934,7 @@
935935
936936 # This generates the QuickBar (also used by the list of special pages function)
937937 function getQuickBar () {
938 - global $wikiMainPage , $wikiRecentChanges , $wikiRecentChangesLink , $wikiUpload , $wikiPopularPages ;
 938+ global $wikiMainPage , $wikiRecentChanges , $wikiRecentChangesLink , $wikiUpload , $wikiPopularPages , $wikiLongPages;
939939 global $user , $oldID , $version , $wikiEditThisPage , $wikiDeleteThisPage , $wikiHistory , $wikiMyWatchlist ;
940940 global $wikiStatistics , $wikiNewPages , $wikiOrphans , $wikiMostWanted , $wikiAllPages , $wikiRandomPage , $wikiStubs , $wikiListUsers ;
941941 $editOldVersion = "" ;
@@ -960,6 +960,7 @@
961961 $column .= "<br>\n<a href=\"".wikiLink("special:AllPages")."\">$wikiAllPages</a>" ;
962962 $column .= "<br>\n<a href=\"".wikiLink("special:RandomPage")."\">$wikiRandomPage</a>" ;
963963 $column .= "<br>\n<a href=\"".wikiLink("special:ShortPages")."\">$wikiStubs</a>" ;
 964+ $column .= "<br>\n<a href=\"".wikiLink("special:LongPages")."\">$wikiLongPages</a>" ;
964965 $column .= "<br>\n<a href=\"".wikiLink("special:ListUsers")."\">$wikiListUsers</a>" ;
965966 if ( $user->isLoggedIn ) {
966967 $column .= "<br>\n<a href=\"".wikiLink("special:WatchList")."\">$wikiMyWatchlist</a>" ;
Index: trunk/phpwiki/fpw/special_longpages.php
@@ -0,0 +1,78 @@
 2+<?
 3+function LongPages () {
 4+ global $THESCRIPT , $wikiSQLServer , $user , $vpage , $startat , $wikiLongPagesTitle , $wikiLongPagesText , $showLinksThere , $wikiStubShowLinks ;
 5+ if ( !isset ( $startat ) ) $startat = 1 ;
 6+ $perpage = $user->options["resultsPerPage"] ;
 7+ if ( $perpage == 0 ) $perpage = 20 ;
 8+ $vpage->special ( $wikiLongPagesTitle ) ;
 9+ $vpage->namespace = "" ;
 10+ if ( $showLinksThere == "" ) $showLinksThere = 0 ;
 11+ if ( $showLinksThere == 1 ) $sLT2 = 0 ;
 12+ else $sLT2 = 1 ;
 13+ $ret = $wikiLongPagesText ;
 14+ $ret .= str_replace ( "$1" , $sLT2 , $wikiStubShowLinks ) ;
 15+ $connection = getDBconnection () ;
 16+ mysql_select_db ( $wikiSQLServer , $connection ) ;
 17+ $sql = "SELECT COUNT(*) AS number FROM cur WHERE cur_title NOT LIKE \"%:%\" AND cur_text NOT LIKE \"#redirect%\"" ;
 18+ $result = mysql_query ( $sql , $connection ) ;
 19+ $s = mysql_fetch_object ( $result ) ;
 20+ $total = $s->number ;
 21+ $sql = "SELECT cur_title,LENGTH(cur_text) AS len FROM cur WHERE cur_title NOT LIKE \"%:%\" AND cur_title NOT LIKE \"Complete_list_of_encyclopedia_topics/%\" AND cur_text NOT LIKE \"#redirect%\" ORDER BY LENGTH(cur_text) DESC" ;
 22+ $result = mysql_query ( $sql , $connection ) ;
 23+ $cnt = 1 ;
 24+ $color1 = $user->options["tabLine1"] ;
 25+ $color2 = $user->options["tabLine2"] ;
 26+ $color = $color1 ;
 27+ $ret .= "<table width=\"100%\">\n" ;
 28+ $ar = array () ;
 29+ while ( $s = mysql_fetch_object ( $result ) and $cnt < $startat+$perpage ) {
 30+ if ( $cnt >= $startat ) {
 31+ $s->cnt = $cnt ;
 32+ array_push ( $ar , $s ) ;
 33+ }
 34+ $cnt++ ;
 35+ }
 36+ mysql_free_result ( $result ) ;
 37+
 38+ global $wikiStubChars , $wikiStubDelete , $wikiStubLinkHere ;
 39+
 40+ foreach ( $ar as $s ) {
 41+ $k = new wikiTitle ;
 42+ $k->setTitle ( $s->cur_title ) ;
 43+ $ret .= "<tr><td$color align=right valign=top nowrap>$s->cnt</td>" ;
 44+ $ret .= "<td$color align=right valign=top nowrap>(".str_replace("$1",$s->len,$wikiStubChars).")</td>\n" ;
 45+ $ret .= "<td$color nowrap valign=top>[[$s->cur_title|".$k->getNiceTitle()."]]</td>\n";
 46+ if ( in_array ( "is_sysop" , $user->rights ) )
 47+ $ret .= "<td$color valign=top nowrap><nowiki><a href=\"".wikiLink("special:deletepage&target=$k->url")."\">$wikiStubDelete</a></nowiki></td>" ;
 48+ else $ret .= "<td$color width=\"100%\" nowrap>&nbsp;</td>" ;
 49+
 50+ if ( $showLinksThere == 1 ) {
 51+ $lf = "" ;
 52+ $lh = pagesThatLinkHere($s->cur_title,$connection);
 53+ if ( count ( $lh ) <= 5 and count ( $lh ) > 0 ) {
 54+ foreach ( $lh as $ll ) {
 55+ if ( $lf == "" ) $lf = " <font size=-1>(" ;
 56+ else $lf .= " - " ;
 57+ $lf .= "[[$ll->cur_title]]" ;
 58+ }
 59+ $lf .= ")</font>" ;
 60+ }
 61+ $ret .= "<td$color width=\"100%\" valign=top>".str_replace("$1",count($lh),$wikiStubLinkHere)."$lf</td>\n";
 62+ } else $ret .= "<td$color valign=top><nowiki><a href=\"".wikiLink("special:whatlinkshere&target=$k->url")."\">Show pages that link to \"".$k->getNiceTitle()."\"</a></nowiki></td>\n" ;
 63+
 64+ $ret .= "</tr>" ;
 65+ if ( $color == $color1 ) $color = $color2 ;
 66+ else $color = $color1 ;
 67+ }
 68+ $ret .= "</table>\n" ;
 69+
 70+ $ret .= "<nowiki>" ;
 71+ $before = $startat - $perpage ; $fin = $before + $perpage - 1 ;
 72+ if ( $startat > 1 ) $ret .= "<a href=\"".wikiLink("special:LongPages&startat=$before&showLinksThere=$showLinksThere")."\">$before-$fin&lt;&lt;</a> &nbsp;";
 73+ $after = $startat + $perpage ; $fin = $after+$perpage - 1 ; if ( $fin > $total ) $fin = $total ;
 74+ if ( $after-1 < $total ) $ret .= "<a href=\"".wikiLink("special:LongPages&startat=$after&showLinksThere=$showLinksThere")."\">&gt;&gt;$after-$fin</a>" ;
 75+ $ret .= "</nowiki>" ;
 76+ #mysql_close ( $connection ) ;
 77+ return $ret ;
 78+ }
 79+?>
\ No newline at end of file
Property changes on: trunk/phpwiki/fpw/special_longpages.php
___________________________________________________________________
Added: svn:eol-style
180 + native
Added: svn:keywords
281 + Author Date Id Revision

Status & tagging log