Skip to content

Commit

Permalink
Implement AttachmentsPathInvalid exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed Aug 20, 2011
1 parent f2ab921 commit 93c90a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
namespace MantisBT\Exception\Attachment;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class AttachmentsPathInvalid extends ExceptionAbstract {
public function __construct() {
$errorMessage = lang_get(ERROR_INVALID_UPLOAD_PATH, null, false);
parent::__construct(ERROR_INVALID_UPLOAD_PATH, $errorMessage, null);
$this->responseCode = 500;
}
}
3 changes: 2 additions & 1 deletion application/core/file_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use MantisBT\Exception\Attachment\AttachmentDuplicate;
use MantisBT\Exception\Attachment\AttachmentFileTypeDisallowed;
use MantisBT\Exception\Attachment\AttachmentOversized;
use MantisBT\Exception\Attachment\AttachmentsPathInvalid;

require_api( 'access_api.php' );
require_api( 'authentication_api.php' );
Expand Down Expand Up @@ -799,7 +800,7 @@ function file_allow_bug_upload( $p_bug_id = null, $p_user_id = null ) {
# checks whether the specified upload path exists and is writable
function file_ensure_valid_upload_path( $p_upload_path ) {
if( !file_exists( $p_upload_path ) || !is_dir( $p_upload_path ) || !is_writable( $p_upload_path ) || !is_readable( $p_upload_path ) ) {
trigger_error( ERROR_FILE_INVALID_UPLOAD_PATH, ERROR );
throw new AttachmentsPathInvalid();
}
}

Expand Down

0 comments on commit 93c90a5

Please sign in to comment.