mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix some, do not enjoy php
This commit is contained in:
parent
e6f6c62113
commit
c2504f54ad
2 changed files with 18 additions and 11 deletions
|
|
@ -391,6 +391,7 @@ class OC_DB {
|
|||
if (PEAR::isError($result)) {
|
||||
$entry='DB Error: "'.$result->getMessage().'"<br />';
|
||||
$entry.='Offending command was: '.$cmd.'<br />';
|
||||
error_log($entry);
|
||||
die($entry);
|
||||
}else{
|
||||
self::$affected=$result;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue