com web/wiki: Hopefully fix voting: dokuwiki/lib/plugins/doodle/syntax.php

From: Date: Tue, 17 Dec 2013 01:47:38 +0000
Subject: com web/wiki: Hopefully fix voting: dokuwiki/lib/plugins/doodle/syntax.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-17689@lists.php.net to get a copy of this message
Commit: b522e6bcae20a67daf8b46c995ca5b58a9f918f6 Author: Hannes Magnusson <bjori@mongodb.com> Mon, 16 Dec 2013 17:47:38 -0800 Parents: 6db526161bb46d359092df2828e7f4e68263360c Branches: master Link: http://git.php.net/?p=web/wiki.git;a=commitdiff;h=b522e6bcae20a67daf8b46c995ca5b58a9f918f6 Log: Hopefully fix voting Changed paths: M dokuwiki/lib/plugins/doodle/syntax.php Diff: diff --git a/dokuwiki/lib/plugins/doodle/syntax.php b/dokuwiki/lib/plugins/doodle/syntax.php index eb75dba..050d10d 100755 --- a/dokuwiki/lib/plugins/doodle/syntax.php +++ b/dokuwiki/lib/plugins/doodle/syntax.php @@ -222,9 +222,13 @@ class syntax_plugin_doodle extends DokuWiki_Syntax_Plugin //FIXME: count($choices) may be different from number of choices in $doodle data! + $can_vote = false; + if (count(array_intersect(array('admin', 'phpcvs', 'voting'), $INFO['userinfo']['grps'])) > 0) { + $can_vote = true; + } // ----- FORM ACTIONS (only allowed when showing the most recent version of the page, not when editing) ----- $formId = 'doodle__form__'.cleanID($this->params['title']); - if ($ACT == 'show' && $_REQUEST['formId'] == $formId && $REV == false) { + if ($ACT == 'show' && $_REQUEST['formId'] == $formId && $can_vote) { // ---- cast new vote if (!empty($_REQUEST['cast__vote'])) { $this->castVote(); @@ -317,7 +321,7 @@ class syntax_plugin_doodle extends DokuWiki_Syntax_Plugin } // ---- calculates if user is allowed to vote - $this->template['inputTR'] = $this->getInputTR(); + $this->template['inputTR'] = ($can_vote?$this->getInputTR():''); // ----- I am using PHP as a templating engine here. //debout("Template", $this->template);

« previous php.webmaster (#17689) next »