From f2ffe4f62f7a3d189e995c6b147e5ea0d32c660d Mon Sep 17 00:00:00 2001 From: Erik Moeller Date: Mon, 30 Jun 2003 02:15:17 +0000 Subject: [PATCH] 1) Hide section edit links for protected pages 2) Hide section edit links for old revisions 3) Changed layout of section edit links 4) added info to editing screen when you are editing a section 5) removed toc from main page --- includes/Article.php | 2 ++ includes/OutputPage.php | 13 +++++++++---- includes/Skin.php | 8 +++++--- languages/Language.php | 11 +++++------ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index cf242dfa21..2afda776dc 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -466,6 +466,8 @@ class Article { } else { $s = str_replace( "$1", $wgTitle->getPrefixedText(), wfMsg( "editing" ) ); + + if($section!="") { $s.=wfMsg("sectionedit");} $wgOut->setPageTitle( $s ); if ( $oldid ) { $this->setOldSubtitle(); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index cae5c291f4..0db1eadf2a 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1214,6 +1214,7 @@ class OutputPage { $nh=$wgUser->getOption( "numberheadings" ); $st=$wgUser->getOption( "showtoc" ); $es=$wgUser->getID() && $wgUser->getOption( "editsection" ); + if($wgTitle->getPrefixedText()==wfMsg("mainpage")) {$st=0;} $sk=$wgUser->getSkin(); preg_match_all("/)(.*?)<\/H[1-6]>/i",$text,$matches); @@ -1270,6 +1271,9 @@ class OutputPage { if($st) { $toc.=$sk->tocLine($anchor,$tocline); } + if($es && !isset($wpPreview)) { + $head[$c].=$sk->editSectionLink($c+1); + } $head[$c].="" .$headline @@ -1295,12 +1299,13 @@ class OutputPage { $blocks=preg_split("/.*?<\/H[1-6]>/i",$text); $i=0; - foreach($blocks as $block) { - $full.=$block; - if($es && $c>0 && !isset($wpPreview)) { - $full.=$sk->editSectionLink($i); + + foreach($blocks as $block) { + if($es && !isset($wpPreview) && $c>0 && $i==0) { + $full.=$sk->editSectionLink(0); } + $full.=$block; $full.=$head[$i]; $i++; } diff --git a/includes/Skin.php b/includes/Skin.php index 4022e53233..4767090f12 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1685,10 +1685,12 @@ class Skin { function editSectionLink($section) { - global $wgTitle; - $editurl="§ion={$section}"; + global $wgTitle,$wgUser,$oldid; + if($wgTitle->isProtected() && !$wgUser->isSysop()) return ""; + if($oldid) return ""; + $editurl="§ion={$section}"; $url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl); - return "

[".$url."]

"; + return "
[".$url."]
"; } } diff --git a/languages/Language.php b/languages/Language.php index b857533988..6ecf19693d 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -498,6 +498,7 @@ If you are here by mistake, just click your browser's '''back''' button.", "previewconflict" => "This preview reflects the text in the upper text editing area as it will appear if you choose to save.", "editing" => "Editing $1", +"sectionedit" => " (section)", "editconflict" => "Edit conflict: $1", "explainconflict" => "Someone else has changed this page since you started editing it. @@ -600,9 +601,7 @@ $2 List redirects   Search for $3 $9", wfLocalUrl( "Special:Userlogin" ) . "\">logged in to set user preferences.", "prefslogintext" => "You are logged in as \"$1\". -Your internal ID number is $2. - -See [[Wikipedia:User preferences help]] for help deciphering the options.", +Your internal ID number is $2.", "prefsreset" => "Preferences have been reset from storage.", "qbsettings" => "Quickbar settings", "changepassword" => "Change password", @@ -1189,11 +1188,11 @@ class Language { } if ( 0 == $diff ) { return $ts; } - $t = gmmktime( ( (int)substr( $ts, 8, 2) ) + $diff, + $t = mktime( ( (int)substr( $ts, 8, 2) ) + $diff, (int)substr( $ts, 10, 2 ), (int)substr( $ts, 12, 2 ), (int)substr( $ts, 4, 2 ), (int)substr( $ts, 6, 2 ), (int)substr( $ts, 0, 4 ) ); - return gmdate( "YmdHis", $t ); + return date( "YmdHis", $t ); } function date( $ts, $adj = false ) @@ -1228,7 +1227,7 @@ class Language { function rfc1123( $ts ) { - return gmdate( "D, d M Y H:i:s T", $ts ); + return date( "D, d M Y H:i:s T", $ts ); } function getValidSpecialPages() -- 2.20.1