]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix parsing of url
authorMartin T. H. Sandsmark <sandsmark@samfundet.no>
Sat, 24 Jul 2010 22:06:10 +0000 (00:06 +0200)
committerMartin T. H. Sandsmark <sandsmark@samfundet.no>
Sat, 24 Jul 2010 22:06:10 +0000 (00:06 +0200)
inc/lib_ocs.php

index 891ca192c0bd5f604c331df7a4d5356e4b41bf04..708500d4094c3f4f2055af9d6b33dc6819385068 100644 (file)
@@ -135,12 +135,12 @@ class OC_OCS {
 
     // PRIVATEDATA
     // get - GET DATA
-    }elseif(($method=='get') and (strtolower($ex[$paracount-3])=='v1.php')and (strtolower($ex[$paracount-2])=='privatedata')){
+    }elseif(($method=='get') and (strtolower($ex[$paracount-5])=='v1.php')and (strtolower($ex[$paracount-3])=='privatedata')){
       $key=OC_OCS::readdata('key','text');
       OC_OCS::privateDataGet($key);
 
     // set - POST DATA
-    }elseif(($method=='post') and (strtolower($ex[$paracount-3])=='v1.php')and (strtolower($ex[$paracount-2])=='privatedata')){
+    }elseif(($method=='post') and (strtolower($ex[$paracount-5])=='v1.php')and (strtolower($ex[$paracount-3])=='privatedata')){
       $key=OC_OCS::readdata('key','text');
       $value=OC_OCS::readdata('key','text');
       OC_OCS::privatedataset($key, $value);
@@ -468,12 +468,14 @@ 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();
-    $existing=$entry['co'];
+    $result=OC_DB::query("select count(*) as co from {$CONFIG_DBTABLEPREFIX}privatedata where key = '".$key."'");
+//    $entry=$result->fetchRow();
+    //$totalcount=$entry['co'];
+    $totalcount=$result['co'];
+    die($totalcount);
     OC_DB::free_result($result);
 
-    if ($existing != 0) {
+    if ($totalcount != 0) {
         $result = OC_DB::query("update {$CONFIG_DBTABLEPREFIX}privatedata set value='".addslashes($value)."', timestamp = now() where key = '".addslashes($key)."'");
     } else {
         $result = OC_DB::query("insert into {$CONFIG_DBTABLEPREFIX}privatedata(key, value, timestamp) values('".addslashes($key)."', '".addslashes($value)."', now())");