Author: jablko
Date: Tue Sep 15 10:18:57 2009
New Revision: 3305

Log:
Guard against actually deleting anything unless the request method is DELETE, 
like revision 2956

Modified:
   trunk/apps/qubit/modules/actor/actions/deleteAction.class.php
   trunk/apps/qubit/modules/repository/actions/deleteAction.class.php

Modified: trunk/apps/qubit/modules/actor/actions/deleteAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/actor/actions/deleteAction.class.php       Tue Sep 
15 10:13:51 2009        (r3304)
+++ trunk/apps/qubit/modules/actor/actions/deleteAction.class.php       Tue Sep 
15 10:18:57 2009        (r3305)
@@ -28,22 +28,25 @@
       $this->forward404();
     }
 
-    foreach ($actor->events as $event)
+    if ($request->isMethod('delete'))
     {
-      if (isset($event->informationObject) && isset($event->type))
+      foreach ($actor->events as $event)
       {
-        unset($event->actor);
+        if (isset($event->informationObject) && isset($event->type))
+        {
+          unset($event->actor);
 
-        $event->save();
+          $event->save();
+        }
+        else
+        {
+          $event->delete();
+        }
       }
-      else
-      {
-        $event->delete();
-      }
-    }
 
-    $actor->delete();
+      $actor->delete();
 
-    return $this->redirect(array('module' => 'actor', 'action' => 'list'));
+      return $this->redirect(array('module' => 'actor', 'action' => 'list'));
+    }
   }
 }

Modified: trunk/apps/qubit/modules/repository/actions/deleteAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/deleteAction.class.php  Tue Sep 
15 10:13:51 2009        (r3304)
+++ trunk/apps/qubit/modules/repository/actions/deleteAction.class.php  Tue Sep 
15 10:18:57 2009        (r3305)
@@ -28,15 +28,18 @@
       $this->forward404();
     }
 
-    foreach ($repository->informationObjects as $informationObject)
+    if ($request->isMethod('delete'))
     {
-      unset($informationObject->repository);
+      foreach ($repository->informationObjects as $informationObject)
+      {
+        unset($informationObject->repository);
 
-      $informationObject->save();
-    }
+        $informationObject->save();
+      }
 
-    $repository->delete();
+      $repository->delete();
 
-    return $this->redirect(array('module' => 'repository', 'action' => 
'list'));
+      return $this->redirect(array('module' => 'repository', 'action' => 
'list'));
+    }
   }
 }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to