Skip to content
Snippets Groups Projects
Commit d9a6b921 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

[gh-95] Merging testing to staging (allow js uploads in imce)

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@607 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent 270eaf22
Branches
Tags
No related merge requests found
......@@ -87,7 +87,11 @@ function unl_permission() {
'unl theme settings' => array(
'title' => t('Change Theme Settings'),
'description' => t('Allow this role to change the current theme settings.'),
)
),
'unl imce javascript upload' => array(
'title' => t('Upload Javascript Files Through IMCE'),
),
);
}
......@@ -164,6 +168,20 @@ function unl_menu_alter(&$items) {
return $items;
}
/**
* Implementation of hook_file_validate()
* Fires when files are uploaded after Drupal Core sanitization but before saving to file system or db
*/
function unl_file_validate($file) {
// For IMCE uploads only, check if Drupal core just altered a *.js upload to *.js.txt and correct if permitted
if ($file->source == 'imce' && substr($file->filename, -7) == '.js.txt' && user_access('unl imce javascript upload')) {
// Chop off the .txt extesnsion that's been added
$file->destination = substr($file->destination, 0, -4);
$file->filename = substr($file->filename, 0, -4);
}
return;
}
function unl_form_alter(&$form, $form_state, $form_id) {
// Make new menu items expanded by default.
if ($form_id == 'menu_edit_item' && $form['mlid']['#value'] == 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment