From: Martin T. H. Sandsmark Date: Sun, 25 Jul 2010 00:38:35 +0000 (+0200) Subject: fix some, do not enjoy php X-Git-Tag: v3.0~338 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c2504f54adaafa4a07048e5bb75615e0d1c1291f;p=nextcloud-server.git fix some, do not enjoy php --- diff --git a/inc/lib_base.php b/inc/lib_base.php index 5b80055ad83..65387471b2b 100644 --- a/inc/lib_base.php +++ b/inc/lib_base.php @@ -391,6 +391,7 @@ class OC_DB { if (PEAR::isError($result)) { $entry='DB Error: "'.$result->getMessage().'"
'; $entry.='Offending command was: '.$cmd.'
'; + error_log($entry); die($entry); }else{ self::$affected=$result; diff --git a/inc/lib_ocs.php b/inc/lib_ocs.php index a4d9534bb30..a6d128a3970 100644 --- a/inc/lib_ocs.php +++ b/inc/lib_ocs.php @@ -135,15 +135,17 @@ class OC_OCS { // PRIVATEDATA // get - GET DATA - }elseif(($method=='get') and (strtolower($ex[$paracount-4])=='v1.php')and (strtolower($ex[$paracount-3])=='privatedata')){ - $key=OC_OCS::readdata('key','text'); + }elseif(($method=='get') and (strtolower($ex[$paracount-4])=='v1.php')and (strtolower($ex[$paracount-2])=='getattribute')){ + OC_OCS::privateDataGet(""); + + }elseif(($method=='get') and (strtolower($ex[$paracount-5])=='v1.php')and (strtolower($ex[$paracount-3])=='getattribute')){ + $key=$ex[$paracount-2]; OC_OCS::privateDataGet($key); // set - POST DATA - }elseif(($method=='post') and (strtolower($ex[$paracount-4])=='v1.php')and (strtolower($ex[$paracount-3])=='privatedata')){ - $key=OC_OCS::readdata('key','text'); + }elseif(($method=='post') and (strtolower($ex[$paracount-5])=='v1.php')and (strtolower($ex[$paracount-3])=='setattribute')){ + $key=$ex[$paracount-2]; $value=OC_OCS::readdata('value','text'); - error_log("key: '$key', value: '$value'"); OC_OCS::privatedataset($key, $value); }else{ @@ -442,7 +444,11 @@ class OC_OCS { $user=OC_OCS::checkpassword(); - $result = OC_DB::select("select key,value,timestamp from {$CONFIG_DBTABLEPREFIX}privatedata where key like'% ".addslashes($key)."%' order by timestamp desc"); + if (!trim($key)) { + $result = OC_DB::select("select key,value,timestamp from {$CONFIG_DBTABLEPREFIX}privatedata order by timestamp desc"); + } else { + $result = OC_DB::select("select key,value,timestamp from {$CONFIG_DBTABLEPREFIX}privatedata where key like'% ".addslashes($key)."%' order by timestamp desc"); + } $itemscount=count($result); $xml=array(); @@ -453,7 +459,7 @@ class OC_OCS { } - $txt=OC_OCS::generatexml($format,'ok',100,'',$xml,'activity','full',2,$totalcount,$pagesize); + $txt=OC_OCS::generatexml($format,'ok',100,'',$xml,'privatedata','full',2,$totalcount,$pagesize); echo($txt); } @@ -469,10 +475,10 @@ class OC_OCS { //TODO: prepared statements, locking tables, fancy stuff, error checking/handling $user=OC_OCS::checkpassword(); - $result=OC_DB::query("select count(*) as co from {$CONFIG_DBTABLEPREFIX}privatedata where key = '".$key."'"); -// $entry=$result->fetchRow(); - //$totalcount=$entry['co']; - $totalcount=(integer)$result['co']; + $result=OC_DB::select("select count(*) as co from {$CONFIG_DBTABLEPREFIX}privatedata where key = '".$key."'"); + $entry=$result->fetchRow(); + $totalcount=$entry['co']; + //$totalcount=(integer)$result['co']; OC_DB::free_result($result); error_log($totalcount);