From 6b271ae5cbd2043b924772ac892764d6b2a6edca Mon Sep 17 00:00:00 2001 From: Erik Moeller Date: Mon, 28 Jul 2003 03:57:40 +0000 Subject: [PATCH] - don't check for edit conflict when posting comments (can always append) - right click on article title instead of top [edit] link when rightclick option is enabled --- includes/Article.php | 3 ++- includes/OutputPage.php | 12 ++++++++---- includes/Skin.php | 12 ++++++------ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index e7819ef409..adfe9a4066 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -428,9 +428,10 @@ class Article { return; } # Article exists. Check for edit conflict. + # Don't check for conflict when appending a comment - this should always work $this->clear(); # Force reload of dates, etc. - if ( $this->getTimestamp() != $wpEdittime ) { $isConflict = true; } + if ( $section!="new" && ( $this->getTimestamp() != $wpEdittime ) ) { $isConflict = true; } $u = $wgUser->getID(); # Supress edit conflict with self diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e96860eab8..a1518f52ab 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1349,9 +1349,13 @@ return $r ; global $wgUser,$wgArticle,$wgTitle,$wpPreview; $nh=$wgUser->getOption( "numberheadings" ); $st=$wgUser->getOption( "showtoc" ); - $es=$wgUser->getID() && $wgUser->getOption( "editsection" ); - $esr=$wgUser->getID() && $wgUser->getOption( "editsectiononrightclick" ); - + if(!$wgTitle->userCanEdit()) { + $es=0; + $esr=0; + } else { + $es=$wgUser->getID() && $wgUser->getOption( "editsection" ); + $esr=$wgUser->getID() && $wgUser->getOption( "editsectiononrightclick" ); + } # if the string __NOTOC__ (not case-sensitive) occurs in the HTML, do not # add TOC if($st && preg_match("/__NOTOC__/i",$text)) { @@ -1451,7 +1455,7 @@ return $r ; foreach($blocks as $block) { - if(($es || $esr) && !isset($wpPreview) && $c>0 && $i==0) { + if(($es) && !isset($wpPreview) && $c>0 && $i==0) { # This is the [edit] link that appears for the top block of text when # section editing is enabled $full.=$sk->editSectionLink(0); diff --git a/includes/Skin.php b/includes/Skin.php index a82a103b97..df9bf1a34f 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -383,9 +383,10 @@ class Skin { function pageTitle() { - global $wgOut, $wgTitle; + global $wgOut, $wgTitle, $wgUser; $s = "

" . $wgOut->getPageTitle() . "

"; + if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);} return $s; } @@ -514,8 +515,7 @@ class Skin { if ( $wgOut->isArticle() ) { $s .= "" . $this->editThisPage() . ""; if ( 0 != $wgUser->getID() ) { - $s .= $sep . $this->watchThisPage() . - $sep . $this->moveThisPage(); + $s .= $sep . $this->watchThisPage(); } $s .= $sep . $this->talkLink() . $sep . $this->historyLink() @@ -540,7 +540,8 @@ class Skin { } if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) { $s .= "\n
" . $this->deleteThisPage() . - $sep . $this->protectThisPage(); + $sep . $this->protectThisPage() . + $sep . $this->moveThisPage(); } $s .= "
\n" . $this->otherLanguages(); } @@ -1735,10 +1736,10 @@ class Skin { $toc."

\n"; } + # These two do not check for permissions: check $wgTitle->userCanEdit before calling them function editSectionScript($section,$head) { global $wgTitle,$wgUser,$oldid; - if($wgTitle->isProtected() && !$wgUser->isSysop()) return $head; if($oldid) return $head; $url = wfLocalUrlE($wgTitle->getPrefixedText(),"action=edit§ion=$section"); return "{$head}"; @@ -1747,7 +1748,6 @@ class Skin { function editSectionLink($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); -- 2.20.1