diff options
author | Florian Pritz <bluewind@xinu.at> | 2015-02-15 11:11:49 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-02-15 11:11:49 +0100 |
commit | 45c16c802720faf9de6c3028ba41753c5edba974 (patch) | |
tree | e20148091cf0f9b6ff11efe65a76cfe1d1bad24c /application/libraries | |
parent | 9535ede862e01d834ebdd553184b1f6544b06d2c (diff) | |
parent | 01226a9afd760a920e9cb3377913ee296f0ab2ca (diff) |
Merge branch 'api-rework' into working
Diffstat (limited to 'application/libraries')
6 files changed, 8 insertions, 8 deletions
diff --git a/application/libraries/Ddownload/drivers/Ddownload_lighttpd.php b/application/libraries/Ddownload/drivers/Ddownload_lighttpd.php index 780f60838..fbdb04b02 100644 --- a/application/libraries/Ddownload/drivers/Ddownload_lighttpd.php +++ b/application/libraries/Ddownload/drivers/Ddownload_lighttpd.php @@ -15,7 +15,7 @@ class Ddownload_lighttpd extends Ddownload_Driver { $upload_path = $CI->config->item('upload_path'); if (strpos($file, $upload_path) !== 0) { - show_error('Invalid file path'); + throw new \exceptions\ApiException("libraries/ddownload/lighttpd/invalid-file-path", 'Invalid file path'); } header('Content-disposition: inline; filename="'.$filename."\"\n"); diff --git a/application/libraries/Ddownload/drivers/Ddownload_nginx.php b/application/libraries/Ddownload/drivers/Ddownload_nginx.php index 2410df4d4..58c7502a7 100644 --- a/application/libraries/Ddownload/drivers/Ddownload_nginx.php +++ b/application/libraries/Ddownload/drivers/Ddownload_nginx.php @@ -18,7 +18,7 @@ class Ddownload_nginx extends Ddownload_Driver { if (strpos($file, $upload_path) === 0) { $file_path = substr($file, strlen($upload_path)); } else { - show_error('Invalid file path'); + throw new \exceptions\ApiException("libraries/ddownload/nginx/invalid-file-path", 'Invalid file path'); } header('Content-disposition: inline; filename="'.$filename."\"\n"); diff --git a/application/libraries/Duser/Duser.php b/application/libraries/Duser/Duser.php index 07a16190c..bf765d690 100644 --- a/application/libraries/Duser/Duser.php +++ b/application/libraries/Duser/Duser.php @@ -62,7 +62,7 @@ class Duser extends CI_Driver_Library { // require an optional function to be implemented public function require_implemented($function) { if (!$this->is_implemented($function)) { - show_error("" + throw new \exceptions\PublicApiException("libraries/duser/optional-function-not-implemented", "" ."Optional function '".$function."' not implemented in user adapter '".$this->_adapter."'. " ."Requested functionally unavailable."); } diff --git a/application/libraries/Duser/drivers/Duser_db.php b/application/libraries/Duser/drivers/Duser_db.php index 258de1820..157a91395 100644 --- a/application/libraries/Duser/drivers/Duser_db.php +++ b/application/libraries/Duser/drivers/Duser_db.php @@ -67,7 +67,7 @@ class Duser_db extends Duser_Driver { ->get()->row_array(); if (empty($query)) { - show_error("Failed to get email address from db"); + throw new \exceptions\ApiException("libraries/duser/db/get_email-failed", "Failed to get email address from db"); } return $query["email"]; diff --git a/application/libraries/Duser/drivers/Duser_ldap.php b/application/libraries/Duser/drivers/Duser_ldap.php index 1f1581620..b80385fe0 100644 --- a/application/libraries/Duser/drivers/Duser_ldap.php +++ b/application/libraries/Duser/drivers/Duser_ldap.php @@ -37,7 +37,7 @@ class Duser_ldap extends Duser_Driver { $r = ldap_search($ds, $config['basedn'], $config["username_field"].'='.$username); break; default: - show_error("Invalid LDAP scope"); + throw new \exceptions\ApiException("libraries/duser/ldap/invalid-ldap-scope", "Invalid LDAP scope"); } if ($r === false) { return false; diff --git a/application/libraries/Image.php b/application/libraries/Image.php index 32c4717e9..0f920358a 100644 --- a/application/libraries/Image.php +++ b/application/libraries/Image.php @@ -35,7 +35,7 @@ class Image { { $img = imagecreatefromstring(file_get_contents($file)); if ($img === false) { - show_error("Unsupported image type"); + throw new \exceptions\ApiException("libraries/Image/unsupported-image-type", "Unsupported image type"); } $this->set_img_object($img); $this->fix_alpha(); @@ -93,8 +93,8 @@ class Image { } $result = ob_get_clean(); - if (!$ret) { - show_error("Failed to create thumbnail"); + if (!$ret || $result === false) { + throw new \exceptions\ApiException("libraries/Image/thumbnail-creation-failed", "Failed to create thumbnail"); } return $result; |