Added voting restriction to 'PHP SVN users' and 'voting' groups. Almost implements rfc/voting. Patch by Ferenc Kovács (untested)

This commit is contained in:
Philip Olson
2011-07-11 16:11:49 +00:00
parent bc691d4d47
commit e3b97f0354
2 changed files with 36 additions and 2 deletions

View File

@ -199,9 +199,14 @@ 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 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 @@ 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 enginge here.
//debout("Template", $this->template);