no longer rely on PEAR::isError since we can use PDO now

This commit is contained in:
Robin Appelman 2011-11-03 12:47:12 +01:00
parent 7b3ae2edd4
commit e2907eb99d
1 changed files with 0 additions and 24 deletions

View File

@ -4,12 +4,6 @@ class OC_remoteStorage {
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");
$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();
while($row=$result->fetchRow()){
$ret[$row['token']]=$userAddress;
@ -21,12 +15,6 @@ class OC_remoteStorage {
$user=OC_User::getUser();
$query=OC_DB::prepare("SELECT token,appUrl,userAddress,dataScope FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
$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();
while($row=$result->fetchRow()){
$ret[$row['token']] = array(
@ -42,23 +30,11 @@ class OC_remoteStorage {
$user=OC_User::getUser();
$query=OC_DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND 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){
$user=OC_User::getUser();
$query=OC_DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`userAddress`,`dataScope`) VALUES(?,?,?,?,?)");
$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){
$token=uniqid();