no longer rely on PEAR::isError since we can use PDO now
This commit is contained in:
parent
7b3ae2edd4
commit
e2907eb99d
|
@ -4,12 +4,6 @@ class OC_remoteStorage {
|
||||||
public static function getValidTokens($ownCloudUser, $userAddress, $dataScope) {
|
public static function getValidTokens($ownCloudUser, $userAddress, $dataScope) {
|
||||||
$query=OC_DB::prepare("SELECT token,appUrl FROM *PREFIX*authtoken WHERE user=? AND userAddress=? AND dataScope=? LIMIT 100");
|
$query=OC_DB::prepare("SELECT token,appUrl FROM *PREFIX*authtoken WHERE user=? AND userAddress=? AND dataScope=? LIMIT 100");
|
||||||
$result=$query->execute(array($ownCloudUser,$userAddress,$dataScope));
|
$result=$query->execute(array($ownCloudUser,$userAddress,$dataScope));
|
||||||
if( PEAR::isError($result)) {
|
|
||||||
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
|
|
||||||
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
|
|
||||||
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
|
|
||||||
die( $entry );
|
|
||||||
}
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
while($row=$result->fetchRow()){
|
while($row=$result->fetchRow()){
|
||||||
$ret[$row['token']]=$userAddress;
|
$ret[$row['token']]=$userAddress;
|
||||||
|
@ -21,12 +15,6 @@ class OC_remoteStorage {
|
||||||
$user=OC_User::getUser();
|
$user=OC_User::getUser();
|
||||||
$query=OC_DB::prepare("SELECT token,appUrl,userAddress,dataScope FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
|
$query=OC_DB::prepare("SELECT token,appUrl,userAddress,dataScope FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
|
||||||
$result=$query->execute(array($user));
|
$result=$query->execute(array($user));
|
||||||
if( PEAR::isError($result)) {
|
|
||||||
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
|
|
||||||
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
|
|
||||||
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
|
|
||||||
die( $entry );
|
|
||||||
}
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
while($row=$result->fetchRow()){
|
while($row=$result->fetchRow()){
|
||||||
$ret[$row['token']] = array(
|
$ret[$row['token']] = array(
|
||||||
|
@ -42,23 +30,11 @@ class OC_remoteStorage {
|
||||||
$user=OC_User::getUser();
|
$user=OC_User::getUser();
|
||||||
$query=OC_DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?");
|
$query=OC_DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?");
|
||||||
$result=$query->execute(array($token,$user));
|
$result=$query->execute(array($token,$user));
|
||||||
if( PEAR::isError($result)) {
|
|
||||||
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
|
|
||||||
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
|
|
||||||
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
|
|
||||||
die( $entry );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private static function addToken($token, $appUrl, $userAddress, $dataScope){
|
private static function addToken($token, $appUrl, $userAddress, $dataScope){
|
||||||
$user=OC_User::getUser();
|
$user=OC_User::getUser();
|
||||||
$query=OC_DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`userAddress`,`dataScope`) VALUES(?,?,?,?,?)");
|
$query=OC_DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`userAddress`,`dataScope`) VALUES(?,?,?,?,?)");
|
||||||
$result=$query->execute(array($token,$appUrl,$user,$userAddress,$dataScope));
|
$result=$query->execute(array($token,$appUrl,$user,$userAddress,$dataScope));
|
||||||
if( PEAR::isError($result)) {
|
|
||||||
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
|
|
||||||
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
|
|
||||||
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
|
|
||||||
die( $entry );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public static function createDataScope($appUrl, $userAddress, $dataScope){
|
public static function createDataScope($appUrl, $userAddress, $dataScope){
|
||||||
$token=uniqid();
|
$token=uniqid();
|
||||||
|
|
Loading…
Reference in New Issue