diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-11-29 16:48:12 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-11-29 16:48:12 +0000 |
commit | 73809f0c1dd345e572b2cea9503454f3a1bb2a12 (patch) | |
tree | cd53bb3ae4354a313880cddc12c94d79c2006685 | |
parent | 56fa0e31ad67ea337fd8c575ddf6e80094454eb8 (diff) | |
download | ampache-73809f0c1dd345e572b2cea9503454f3a1bb2a12.tar.gz ampache-73809f0c1dd345e572b2cea9503454f3a1bb2a12.tar.bz2 ampache-73809f0c1dd345e572b2cea9503454f3a1bb2a12.zip |
improved error messages for api, includes additional information on handshake failure, also translate the errors
-rw-r--r-- | lib/class/api.class.php | 4 | ||||
-rw-r--r-- | lib/class/xmldata.class.php | 1 | ||||
-rw-r--r-- | server/xml.server.php | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/lib/class/api.class.php b/lib/class/api.class.php index 9e1f8f46..7da358f5 100644 --- a/lib/class/api.class.php +++ b/lib/class/api.class.php @@ -49,12 +49,14 @@ class Api { if (intval($version) < self::$version) { debug_event('API','Login Failed version too old','1'); + Error::add('api','Login Failed versoin too old'); return false; } // If the timestamp is over 2hr old sucks to be them if ($timestamp < (time() - 14400)) { debug_event('API','Login Failed, timestamp too old','1'); + Error::add('api','Login Failed, timestamp too old'); return false; } @@ -93,6 +95,7 @@ class Api { if (!$row['password']) { debug_event('API','Unable to find user with username of ' . $user_id,'1'); + Error::add('api','Invalid Username/Password'); return false; } @@ -137,6 +140,7 @@ class Api { } // end while debug_event('API','Login Failed, unable to match passphrase','1'); + Error::add('api','Invalid Username/Password'); return false; } // handhsake diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php index a22805c8..5a1e89bb 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -71,7 +71,6 @@ class xmlData { * nothing fancy here... */ public static function error($code,$string) { - $string = self::_header() . "\t<error code=\"$code\"><![CDATA[$string]]></error>" . self::_footer(); return $string; diff --git a/server/xml.server.php b/server/xml.server.php index bf6b8387..74be6b2b 100644 --- a/server/xml.server.php +++ b/server/xml.server.php @@ -82,7 +82,7 @@ switch ($_REQUEST['action']) { if (!$token) { ob_end_clean(); - echo xmlData::error('401','Error Invalid Handshake, attempt logged'); + echo xmlData::error('401',_('Error Invalid Handshake - ') . Error::get('api')); } else { ob_end_clean(); @@ -311,7 +311,7 @@ switch ($_REQUEST['action']) { break; default: ob_end_clean(); - echo xmlData::error('405','Invalid Request'); + echo xmlData::error('405',_('Invalid Request')); break; } // end switch action ?> |