[Pkg-owncloud-commits] [owncloud] 29/66: fixing undefined index in delete()

David Prévot taffit at moszumanska.debian.org
Fri Apr 18 22:49:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v5.0.15
in repository owncloud.

commit ddc14ae8ee12044ee5ebb96a4fef17937078a47c
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Thu Oct 31 10:24:28 2013 +0100

    fixing undefined index in delete()
---
 lib/ocs/privatedata.php | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/ocs/privatedata.php b/lib/ocs/privatedata.php
index f2c6ec7..2c53d57 100644
--- a/lib/ocs/privatedata.php
+++ b/lib/ocs/privatedata.php
@@ -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 ));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list