typo and unescaped assoc arrays

maulwuff - May 12, 2008 - 14:39
Project:GB Comment Revisions
Version:5.x-0.1-beta1
Component:Code
Category:bug report
Priority:normal
Assigned:LasseP
Status:closed
Description

I found several little problems in the code, one was a variable naming problem.

find a patch attached.

Index: /home/maulwurf/htdocs/vexdrupal/sites/all/modules/comment_revisions/comment_revisions.module
===================================================================
--- /home/maulwurf/htdocs/vexdrupal/sites/all/modules/comment_revisions/comment_revisions.module (revision 2)
+++ /home/maulwurf/htdocs/vexdrupal/sites/all/modules/comment_revisions/comment_revisions.module (working copy)
@@ -150,7 +150,7 @@
   switch($op) {
     case 'update':

-      if($user->uid == $a1[uid] and !user_access('willful create own')) {
+      if($user->uid == $a1['uid'] and !user_access('willful create own')) {
           $isUserRevision = TRUE;
         } else {
           $isUserRevision = FALSE;
@@ -156,12 +156,12 @@
           $isUserRevision = FALSE;
         }

-        if($a1[create_revision]) {
+        if($a1['create_revision']) {
           $queryInfo = array();
-          $queryInfo['cid'] =                    $a1[cid];
-          $queryInfo['comment'] =         $a1[comment];
-          $queryInfo['subject'] =             $a1[subject];
-          $queryInfo['log_message'] =   $a1[log_message];
+          $queryInfo['cid'] =                    $a1['cid'];
+          $queryInfo['comment'] =         $a1['comment'];
+          $queryInfo['subject'] =             $a1['subject'];
+          $queryInfo['log_message'] =   $a1['log_message'];
           $queryInfo['createdOn'] = time();
           $queryInfo['createdBy'] = $user->uid;
           $queryInfo['isUsrRev'] = $isUserRevision ? '1' : '0';
@@ -236,7 +236,7 @@
         '#type' => 'textarea',
         '#title' => t('Log Message'),
       );
-    } else if(user_access('force revision') && $isUsrCmt && !user_access('except from force')){
+    } else if(user_access('force revision') && $isUserCmt && !user_access('except from force')){
       /* if user is forced to create a revision on edit, and it is his own comment and not excepted from beeing forced */
       $form["revisions"]["create_revision"] = array(
         '#type' => 'value',

#1

LasseP - June 11, 2008 - 17:28
Assigned to:Anonymous» LasseP

applied the patch.

Now some testing will be needed :)

#2

LasseP - June 29, 2008 - 09:12
Status:active» fixed

#3

Anonymous (not verified) - July 13, 2008 - 09:14
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.