updated imce, colorbox, admin_menu_source, honey_pot

This commit is contained in:
Bachir Soussi Chiadmi
2016-11-05 16:33:10 +01:00
parent 2e0abeed03
commit 7aeabebddf
28 changed files with 455 additions and 123 deletions

View File

@@ -87,7 +87,7 @@ INTEGRATION BY URL
When IMCE is opened using an url that contains &app=applicationName|fileProperty1@FieldId1|fileProperty2@FieldId2|...
the specified fields are filled with the specified properties of the selected file.
Avaliable file properties are: url, name, size(formatted), width, height, date(formatted), bytes(integer size in bytes), time(integer date timestamp), id(file id for newly uploaded files, 0 or integer), relpath(rawurlencoded path relative to file directory path.)
Available file properties are: url, name, size(formatted), width, height, date(formatted), bytes(integer size in bytes), time(integer date timestamp), id(file id for newly uploaded files, 0 or integer), relpath(rawurlencoded path relative to file directory path.)
In our CASE, we should open IMCE using this URL: /imce?app=myApp|url@urlField which contains our application name and our url field id
@@ -177,5 +177,5 @@ imce.setMessage(msg, type): logs a message of the type(status, warning, error)
NOTES:
- All URL strings in the examples start with "/" considering the base path is "/".
In case your drupal is running on a sub directory e.g, http://localhost/drupal, these URLs should start with "/drupal/".
There is a safer solution that does not require manual URL fixing: If the Drupal javascript object is avaliable in your page you can use Drupal.settings.basePath at the beginning of URLs (Drupal.settings.basePath+'?q=imce....'). Note that, this won't work with multilingual paths with language prefixes.
There is a safer solution that does not require manual URL fixing: If the Drupal javascript object is available in your page you can use Drupal.settings.basePath at the beginning of URLs (Drupal.settings.basePath+'?q=imce....'). Note that, this won't work with multilingual paths with language prefixes.
- file and directory ids(names) used in imce.js are url encoded forms of original names. They are decoded using imce.decode and displayed in the lists.

View File

@@ -4,9 +4,9 @@ core = "7.x"
package = "Media"
configure = "admin/config/media/imce"
; Information added by Drupal.org packaging script on 2014-05-16
version = "7.x-1.9"
; Information added by Drupal.org packaging script on 2016-03-30
version = "7.x-1.10"
core = "7.x"
project = "imce"
datestamp = "1400275428"
datestamp = "1459346870"

View File

@@ -247,14 +247,14 @@ function imce_profile_form($form, &$form_state, $pid = 0) {
'#type' => 'textfield',
'#title' => t('Maximum file size per upload'),
'#default_value' => $profile['filesize'],
'#description' => t('Set to 0 to use the maximum value avaliable.') . ' ' . t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))),
'#description' => t('Set to 0 to use the maximum value available.') . ' ' . t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))),
'#field_suffix' => t('MB'),
);
$form['quota'] = array(
'#type' => 'textfield',
'#title' => t('Directory quota'),
'#default_value' => $profile['quota'],
'#description' => t('Define the upload quota per directory.') . ' ' . t('Set to 0 to use the maximum value avaliable.'),
'#description' => t('Define the upload quota per directory.') . ' ' . t('Set to 0 to use the maximum value available.'),
'#field_suffix' => t('MB'),
);
$form['tuquota'] = array(

View File

@@ -12,7 +12,7 @@ function imce_js_navigate(&$imce) {
return array(
'files' => theme('imce_file_list', array('imce_ref' => array('imce' => &$imce))),
'dirsize' => format_size($imce['dirsize']),
'subdirectories' => array_map('rawurlencode', $imce['subdirectories']),
'subdirectories' => array_map('rawurlencode', array_values($imce['subdirectories'])),
'perm' => $imce['perm']
);
}

View File

@@ -297,7 +297,7 @@ function imce_upload_submit($form, &$form_state) {
//core bug #54223.
if ($replace == FILE_EXISTS_RENAME) {
$name = basename($file->uri);
$name = drupal_basename($file->uri);
if ($name != $file->filename) {
$file->filename = $name;
drupal_set_message(t('The file has been renamed to %filename.', array('%filename' => $file->filename)));
@@ -494,7 +494,7 @@ function imce_resize_image($filename, &$imce, $width, $height, $copy = TRUE, $de
if (!$destname || $destname == $filename) {
$file->uri = $copy ? file_create_filename($filename, $destdir) : $imguri;
}
$file->filename = basename($file->uri);
$file->filename = drupal_basename($file->uri);
//check if a file having the same properties exists already.
if (isset($imce['files'][$file->filename])) {
@@ -807,7 +807,7 @@ function imce_process_directories(&$imce, $user) {
}
/**
* Return an avaliable directory for the profile.
* Return an available directory for the profile.
*/
function imce_working_directory(&$imce) {
//Do not use session if there is only one directory assigned.
@@ -923,7 +923,10 @@ function imce_subdirectories_accessible(&$imce) {
return TRUE;
}
//checking only the first one is sufficient.
$dirname = ($imce['dir'] == '.' ? '' : $imce['dir'] . '/') . $imce['subdirectories'][0];
$dirname = reset($imce['subdirectories']);
if ($imce['dir'] !== '.') {
$dirname = $imce['dir'] . '/' . $dirname;
}
//check if any setting is applicable for this subdirectory through any directory in the list.
foreach ($imce['directories'] as $name => $info) {
@@ -1082,7 +1085,15 @@ function imce_dir_uri($imce, $dir = NULL) {
if (!isset($dir)) {
$dir = $imce['dir'];
}
return $imce['scheme'] . '://' . ($dir == '.' ? '' : $dir . '/');
$target = $dir === '.' ? '' : $dir;
$uri = $imce['scheme'] . '://' . $target;
// Uri is already normalized. Call alterers.
drupal_alter('file_stream_wrapper_uri_normalize', $uri, $imce['scheme'], $target);
// Add the slash
if (substr($uri, -1) !== '/') {
$uri .= '/';
}
return $uri;
}
/**

View File

@@ -161,19 +161,26 @@ fileRemove: function(fid) {
//return a file object containing all properties.
fileGet: function (fid) {
var file = imce.fileProps(fid);
if (file) {
file.name = imce.decode(fid);
file.url = imce.getURL(fid);
file.relpath = imce.getRelpath(fid);
file.id = imce.urlId[file.url] || 0; //file id for newly uploaded files
}
return file;
},
//return file properties embedded in html.
fileProps: function (fid) {
var row = imce.fids[fid];
var url = imce.getURL(fid);
return row ? {
name: imce.decode(fid),
url: url,
size: row.cells[1].innerHTML,
bytes: row.cells[1].id * 1,
width: row.cells[2].innerHTML * 1,
height: row.cells[3].innerHTML * 1,
date: row.cells[4].innerHTML,
time: row.cells[4].id * 1,
id: imce.urlId[url] || 0, //file id for newly uploaded files
relpath: (imce.conf.dir == '.' ? '' : imce.conf.dir +'/') + fid //rawurlencoded path relative to file directory path.
time: row.cells[4].id * 1
} : null;
},
@@ -514,7 +521,8 @@ fopSettings: function (fop) {
fopLoading: function(fop, state) {
var el = imce.el('edit-'+ fop), func = state ? 'addClass' : 'removeClass';
if (el) {
$(el)[func]('loading').attr('disabled', state);
$(el)[func]('loading');
el.disabled = state;
}
else {
$(imce.ops[fop].li)[func]('loading');
@@ -626,7 +634,7 @@ resMsgs: function (msgs) {
//return img markup
imgHtml: function (fid, width, height) {
return '<img src="'+ imce.getURL(fid) +'" width="'+ width +'" height="'+ height +'" alt="'+ imce.decodePlain(fid) +'">';
return '<img src="'+ imce.getURL(fid, true) +'" width="'+ width +'" height="'+ height +'" alt="'+ imce.decodePlain(fid) +'">';
},
//check if the file is an image
@@ -675,9 +683,23 @@ serialNames: function () {
},
//get file url. re-encode & and # for mod rewrite
getURL: function (fid) {
var path = (imce.conf.dir == '.' ? '' : imce.conf.dir +'/') + fid;
return imce.conf.furl + (imce.conf.modfix ? path.replace(/%(23|26)/g, '%25$1') : path);
getURL: function (fid, uncached) {
var url = imce.getRelpath(fid);
if (imce.conf.modfix) {
url = url.replace(/%(23|26)/g, '%25$1');
}
url = imce.conf.furl + url;
if (uncached) {
var file = imce.fileProps(fid);
url += (url.indexOf('?') === -1 ? '?' : '&') + 's' + file.bytes + 'd' + file.time;
}
return url;
},
//get encoded file path relative to root.
getRelpath: function (fid) {
var dir = imce.conf.dir;
return (dir === '.' ? '' : dir + '/') + fid;
},
//el. by id

View File

@@ -2,7 +2,7 @@
$imce =& $imce_ref['imce'];//keep this line.
/*
* Although the file list table here is avaliable for theming,
* Although the file list table here is available for theming,
* it is not recommended to change the table structure, because
* it is read and manipulated by javascript assuming this is the deafult structure.
* You can always change the data created by format functions