Author: Derick Rethans (derickr)
Date: 2024-05-20T10:19:09-05:00

Commit: 
https://github.com/php/web-wiki/commit/408dc3c61cdf3a26f863f63bfc26adb8c84ca4eb
Raw diff: 
https://github.com/php/web-wiki/commit/408dc3c61cdf3a26f863f63bfc26adb8c84ca4eb.diff

Fix checks in 'doodle2' plugin

Changed paths:
  M  dokuwiki/lib/plugins/doodle/doodle_template.php
  M  dokuwiki/lib/plugins/doodle/syntax.php


Diff:

diff --git a/dokuwiki/lib/plugins/doodle/doodle_template.php 
b/dokuwiki/lib/plugins/doodle/doodle_template.php
index 182df1e4..f7247e39 100755
--- a/dokuwiki/lib/plugins/doodle/doodle_template.php
+++ b/dokuwiki/lib/plugins/doodle/doodle_template.php
@@ -40,7 +40,7 @@
     <tr>
         <td class="rightalign">
           <?php $fullname = '<a href="//people.php.net/' . $fullname.'">' 
.$fullname. '</a>';?>
-          <?php echo $userData['editLinks'].$fullname.$userData['username'] ?>
+          <?php echo (array_key_exists('editLinks', $userData) ? 
$userData['editLinks'] : '') . $fullname.$userData['username'] ?>
         </td>
         <?php for ($col = 0; $col < $c; $col++) {
             echo $userData['choice'][$col];
diff --git a/dokuwiki/lib/plugins/doodle/syntax.php 
b/dokuwiki/lib/plugins/doodle/syntax.php
index 7b338e20..f45ab698 100755
--- a/dokuwiki/lib/plugins/doodle/syntax.php
+++ b/dokuwiki/lib/plugins/doodle/syntax.php
@@ -223,12 +223,12 @@ function render($mode, Doku_Renderer $renderer, $data) {
         //FIXME: count($choices) may be different from number of choices in 
$doodle data!
 
         $can_vote = false;
-        if ($INFO["userinfo"] && count(array_intersect(array('admin', 
'phpcvs', 'voting'), $INFO['userinfo']['grps'])) > 0) {
+        if (array_key_exists("userinfo", $INFO) && $INFO["userinfo"] && 
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 
&& $can_vote) {
+        if ($ACT == 'show' && array_key_exists('formId', $_REQUEST) && 
$_REQUEST['formId'] == $formId && $REV == false && $can_vote) {
             // ---- cast new vote
             if (!empty($_REQUEST['cast__vote'])) {
                 $this->castVote();
@@ -567,7 +567,7 @@ function readDoodleDataFromFile() {
             }
         }
         
-        if (strcmp($this->params['sort'], 'time') == 0) {
+        if (array_key_exists('sort', $this->params) && 
strcmp($this->params['sort'], 'time') == 0) {
             debout("sorting by time");
             uasort($doodle, 'cmpEntryByTime');
         } else {

Reply via email to