Skip to content

Commit

Permalink
MINOR moved File validation to the model (from r92044) (from r96815)
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102677 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
chillu committed Apr 13, 2010
1 parent caed94d commit bfef132
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions code/AssetTableField.php
Expand Up @@ -343,30 +343,6 @@ public function movemarked($request) {
);
}
}
function handleItem($request) {
return new AssetTableField_ItemRequest($this, $request->param('ID'));
}
}

class AssetTableField_ItemRequest extends ComplexTableField_ItemRequest {
function saveComplexTableField($data, $form, $request) {

if(!AssetAdmin::$apply_restrictions_to_admin && Permission::check('ADMIN')) {
if(!in_array(strtolower(pathinfo($data['Name'], PATHINFO_EXTENSION)), AssetAdmin::$allowed_extensions)) {
$form->sessionMessage(sprintf(
_t(
'File.INVALIDEXTENSION',
'Extension is not allowed (valid: %s)',
PR_MEDIUM,
'Argument 1: Comma-separated list of valid extensions'
),
implode(',',AssetAdmin::$allowed_extensions)
), 'bad');
Director::redirectBack();
return;
}
}
return parent::saveComplexTableField($data, $form, $request);
}
}
?>

0 comments on commit bfef132

Please sign in to comment.