Created
July 11, 2011 15:01
-
-
Save Tyrael/1076035 to your computer and use it in GitHub Desktop.
wiki.php.net vote group fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: /home/tyrael/checkouts/php-wiki/dokuwiki/lib/plugins/doodle/syntax.php | |
=================================================================== | |
--- /home/tyrael/checkouts/php-wiki/dokuwiki/lib/plugins/doodle/syntax.php (revision 313127) | |
+++ /home/tyrael/checkouts/php-wiki/dokuwiki/lib/plugins/doodle/syntax.php (working copy) | |
@@ -199,9 +199,14 @@ | |
} | |
//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 page, not when editing) ----- | |
$formId = 'doodle__form__'.cleanID($this->params['title']); | |
- if ($ACT == 'show' && $_REQUEST['formId'] == $formId ) { | |
+ if ($ACT == 'show' && $_REQUEST['formId'] == $formId && $can_vote) { | |
// ---- cast new vote | |
if (!empty($_REQUEST['cast__vote'])) { | |
$this->castVote(); | |
@@ -291,7 +296,7 @@ | |
} | |
// ---- 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 enginge here. | |
//debout("Template", $this->template); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment