]> source.dussan.org Git - nextcloud-server.git/commitdiff
fixing undefined index in delete()
authorThomas Müller <thomas.mueller@tmit.eu>
Thu, 31 Oct 2013 09:24:28 +0000 (10:24 +0100)
committertomneedham <tom@owncloud.com>
Tue, 18 Feb 2014 17:20:04 +0000 (17:20 +0000)
lib/ocs/privatedata.php

index f2c6ec7fecda8eb8f5ef769eacb98b720d254585..2c53d576092cfcf645300c042e63b74e1149d479 100644 (file)
@@ -35,7 +35,7 @@ class OC_OCS_Privatedata {
        public static function get($parameters) {
                $user = OC_User::getUser();
                $app = addslashes(strip_tags($parameters['app']));
-               $key = isset($parameters['key']) ?addslashes(strip_tags($parameters['key'])) : null;
+               $key = isset($parameters['key']) ? addslashes(strip_tags($parameters['key'])) : null;
                
                if(empty($key)) {
                        $query = \OCP\DB::prepare('SELECT `key`, `app`, `value`  FROM `*PREFIX*privatedata` WHERE `user` = ? AND `app` = ? ');
@@ -94,12 +94,14 @@ class OC_OCS_Privatedata {
         */
        public static function delete($parameters) {
                $user = OC_User::getUser();
+               if (!isset($parameters['app']) or !isset($parameters['key'])) {
+                       //key and app are NOT optional here
+                       return new OC_OCS_Result(null, 101);
+               }
+
                $app = addslashes(strip_tags($parameters['app']));
                $key = addslashes(strip_tags($parameters['key']));
-               if($key==="" or $app==="") {
-                       return new OC_OCS_Result(null, 101); //key and app are NOT optional here
-               }
-               
+
                // delete in DB
                $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*privatedata`  WHERE `user` = ? AND `app` = ? AND `key` = ? ');
                $query->execute(array($user, $app, $key ));