summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.18/sites/all/modules/imce
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.18/sites/all/modules/imce')
-rwxr-xr-x[-rw-r--r--]kolab.org/www/drupal-7.18/sites/all/modules/imce/LICENSE.txt0
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.install2
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.module90
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.admin.inc9
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.page.inc32
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce.js13
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce_extras.js19
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/imce/tpl/imce-page.tpl.php1
9 files changed, 71 insertions, 101 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/imce/LICENSE.txt b/kolab.org/www/drupal-7.18/sites/all/modules/imce/LICENSE.txt
index d159169..d159169 100644..100755
--- a/kolab.org/www/drupal-7.18/sites/all/modules/imce/LICENSE.txt
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/imce/LICENSE.txt
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.info b/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.info
index 6394ad4..e8699c8 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.info
@@ -4,9 +4,9 @@ core = "7.x"
package = "Media"
configure = "admin/config/media/imce"
-; Information added by drupal.org packaging script on 2011-10-20
-version = "7.x-1.5"
+; Information added by Drupal.org packaging script on 2013-12-17
+version = "7.x-1.8"
core = "7.x"
project = "imce"
-datestamp = "1319104232"
+datestamp = "1387302359"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.install b/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.install
index 8d3e420..688c6b5 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.install
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.install
@@ -11,13 +11,13 @@
function imce_install() {
module_load_include('inc', 'imce', 'inc/imce.core.profiles');
imce_install_profiles();
- drupal_set_message(st('!module has been installed.', array('!module' => l(st('IMCE'), 'admin/config/media/imce'))));
}
/**
* Implements hook_uninstall().
*/
function imce_uninstall() {
+ db_delete('file_usage')->condition('module', 'imce')->execute();
variable_del('imce_profiles');
variable_del('imce_roles_profiles');
variable_del('imce_settings_textarea');
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.module b/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.module
index fe93a12..f3dc4bf 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.module
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/imce/imce.module
@@ -15,6 +15,7 @@ function imce_menu() {
'title' => 'File browser',
'page callback' => 'imce',
'access callback' => 'imce_access',
+ 'access arguments' => array(FALSE, 1),
'file' => 'inc/imce.page.inc',
'type' => MENU_CALLBACK,
);
@@ -118,7 +119,7 @@ function imce_textarea($element) {
if (!isset($regexp)) {
$regexp = FALSE;
if (imce_access() && $regexp = str_replace(' ', '', variable_get('imce_settings_textarea', ''))) {
- $regexp = '@^' . str_replace(',', '|', implode('.*', array_map('preg_quote', explode('*', $regexp)))) . '$@';
+ $regexp = '@^(' . str_replace(',', '|', implode('.*', array_map('preg_quote', explode('*', $regexp)))) . ')$@';
}
}
if ($regexp && preg_match($regexp, $element['#id'])) {
@@ -132,58 +133,39 @@ function imce_textarea($element) {
* Returns the configuration profile assigned to a user for a specific file scheme.
*/
function imce_user_profile($user, $scheme = NULL) {
- $profiles = variable_get('imce_profiles', array());
- $swrappers = file_get_stream_wrappers();
- $default_scheme = variable_get('file_default_scheme', 'public');
+ static $ups = array();
- //handle user#1 separately
- if ($user->uid == 1) {
- $scheme = empty($scheme) ? $default_scheme : $scheme;
- if (isset($profiles[1]) && isset($swrappers[$scheme])) {
- return $profiles[1] + array('scheme' => $scheme);
- }
- return FALSE;
+ // Set scheme
+ if (empty($scheme)) {
+ $scheme = variable_get('file_default_scheme', 'public');
}
- //handle regular users
- $roles_profiles = variable_get('imce_roles_profiles', array());
- //store assigned configuration
- $conf = array();
- foreach ($roles_profiles as $rid => $role) {
- if (isset($user->roles[$rid])) {
- $conf = $role;
- break;
- }
+ // Return from cache.
+ if (isset($ups[$scheme][$user->uid])) {
+ return $ups[$scheme][$user->uid];
}
+ $ups[$scheme][$user->uid] = FALSE;
- //no scheme-profile assignment
- if (empty($conf)) {
+ // Check scheme
+ $swrappers = file_get_stream_wrappers();
+ if (!isset($swrappers[$scheme])) {
return FALSE;
}
- //return the profile for the specified scheme
- if (!empty($scheme)) {
- $key = $scheme . '_pid';
- if (isset($conf[$key]) && isset($profiles[$conf[$key]]) && isset($swrappers[$scheme])) {
- return $profiles[$conf[$key]] + array('scheme' => $scheme);
- }
- return FALSE;
- }
+ $profiles = variable_get('imce_profiles', array());
+ $scinfo = array('scheme' => $scheme);
- //no scheme specified. check the default
- $scheme = $default_scheme;
- $key = $scheme . '_pid';
- if (isset($conf[$key]) && isset($profiles[$conf[$key]]) && isset($swrappers[$scheme])) {
- return $profiles[$conf[$key]] + array('scheme' => $scheme);
+ // Handle user#1 separately
+ if ($user->uid == 1) {
+ return $ups[$scheme][$user->uid] = isset($profiles[1]) ? $profiles[1] + $scinfo : FALSE;
}
- //check if any of the schemes has a profile assigned.
- foreach ($conf as $key => $pid) {
- if (substr($key, -4) == '_pid' && isset($profiles[$pid])) {
- $scheme = substr($key, 0, -4);
- if (isset($swrappers[$scheme])) {
- return $profiles[$pid] + array('scheme' => $scheme);
- }
+ // Handle regular users.
+ $roles_profiles = variable_get('imce_roles_profiles', array());
+ $sckey = $scheme . '_pid';
+ foreach ($roles_profiles as $rid => $conf) {
+ if (isset($user->roles[$rid]) && isset($conf[$sckey]) && isset($profiles[$conf[$sckey]])) {
+ return $ups[$scheme][$user->uid] = $profiles[$conf[$sckey]] + $scinfo;
}
}
@@ -194,28 +176,11 @@ function imce_user_profile($user, $scheme = NULL) {
* Checks if the user is assigned an imce profile.
* A more detailed assignment check is performed before imce loads.
*/
-function imce_access($user = FALSE) {
+function imce_access($user = FALSE, $scheme = NULL) {
if ($user === FALSE) {
global $user;
}
-
- if ($user->uid == 1) {
- return TRUE;
- }
-
- $roles_profiles = variable_get('imce_roles_profiles', array());
- foreach ($roles_profiles as $rid => $role) {
- if (isset($user->roles[$rid])) {
- foreach ($role as $key => $pid) {
- if (substr($key, -4) == '_pid' && $pid) {
- return TRUE;
- }
- }
- break;
- }
- }
-
- return FALSE;
+ return imce_user_profile($user, $scheme) ? TRUE : FALSE;
}
/**
@@ -225,7 +190,6 @@ function imce_user_page_access($account, $user = FALSE) {
if ($user === FALSE) {
global $user;
}
-
return ($user->uid == 1 || $account->uid == $user->uid) && ($profile = imce_user_profile($account)) && $profile['usertab'];
}
@@ -233,5 +197,5 @@ function imce_user_page_access($account, $user = FALSE) {
* Check if the directory name is regular.
*/
function imce_reg_dir($dirname) {
- return $dirname == '.' || (is_string($dirname) && $dirname != '' && !preg_match('@(^\s)|(^/)|(^\./)|(\s$)|(/$)|(/\.$)|(\.\.)|(//)|(\\\\)|(/\./)@', $dirname));
+ return $dirname == '.' || is_int($dirname) || (is_string($dirname) && $dirname != '' && !preg_match('@(^\s)|(^/)|(^\./)|(\s$)|(/$)|(/\.$)|(\.\.)|(//)|(\\\\)|(/\./)@', $dirname));
} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.admin.inc b/kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.admin.inc
index 4ff3077..d88cd28 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.admin.inc
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.admin.inc
@@ -16,7 +16,8 @@ function imce_admin() {
$rows = array();
foreach ($profiles as $pid => $profile) {
- $rows[] = array($profile['name'],
+ $rows[] = array(
+ check_plain($profile['name']),
l(t('Edit'), 'admin/config/media/imce/profile/edit/' . $pid),
$pid == 1 ? '' : l(t('Delete'), 'admin/config/media/imce/profile/delete/' . $pid),
);
@@ -116,7 +117,7 @@ function imce_admin_theme($variables) {
$swrappers = file_get_stream_wrappers(STREAM_WRAPPERS_VISIBLE);
foreach ($swrappers as $scheme => $info) {
$header[] = l($info['name'], 'imce/' . $scheme);
- $rows[0][] = $profile1['name'];
+ $rows[0][] = check_plain($profile1['name']);
$keys[] = $scheme . '_pid';
}
@@ -249,7 +250,7 @@ function imce_profile_form($form, &$form_state, $pid = 0) {
);
$form['dimensions'] = array(
'#type' => 'textfield',
- '#title' => t('Maximum image resolution'),
+ '#title' => t('Maximum image dimensions'),
'#default_value' => $profile['dimensions'],
'#description' => t('The maximum allowed image size (e.g. 640x480). Set to 0 for no restriction. If an <a href="!image-toolkit-link">image toolkit</a> is installed, files exceeding this value will be scaled down to fit.', array('!image-toolkit-link' => url('admin/config/media/image-toolkit'))),
'#field_suffix' => '<kbd>' . t('WIDTHxHEIGHT') . '</kbd>',
@@ -482,7 +483,7 @@ function imce_thumbnails_theme($variables) {
*/
function imce_role_form($role, $weight = TRUE, $core = TRUE) {
$form['name'] = array(
- '#markup' => $role['name'],
+ '#markup' => check_plain($role['name']),
);
if ($weight) {
$form['weight'] = $core ? array(
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.page.inc b/kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.page.inc
index 27b27ad..bcb00b2 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.page.inc
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.page.inc
@@ -11,6 +11,7 @@
function imce($scheme = NULL) {
module_invoke('admin_menu', 'suppress');//suppress admin_menu
$jsop = isset($_GET['jsop']) ? $_GET['jsop'] : NULL;
+ drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
print imce_page($GLOBALS['user'], $scheme, $jsop);
exit();
}
@@ -258,7 +259,7 @@ function imce_fileop_form_validate($form, &$form_state) {
return form_error($form['filenames'], t('Please select a file.'));
}
- //filenames come seperated by colon
+ //filenames come separated by colon
$filenames = explode(':', $form_state['values']['filenames']);
$cnt = count($filenames);
//check the number of files.
@@ -359,7 +360,7 @@ function imce_resize_submit($form, &$form_state) {
//check dimensions
$width = (int) $form_state['values']['width'];
$height = (int) $form_state['values']['height'];
- list($maxw, $maxh) = explode('x', $imce['dimensions']);
+ list($maxw, $maxh) = $imce['dimensions'] ? explode('x', $imce['dimensions']) : array(0, 0);
if ($width < 1 || $height < 1 || ($maxw && ($width > $maxw || $height > $maxh))) {
drupal_set_message(t('Please specify dimensions within the allowed range that is from 1x1 to @dimensions.', array('@dimensions' => $imce['dimensions'] ? $imce['dimensions'] : t('unlimited'))), 'error');
return;
@@ -424,10 +425,6 @@ function imce_delete_filepath($uri) {
if (!file_delete($file, TRUE)) {
return FALSE;
}
- // Remove imce usage
- if ($is_imce) {
- file_usage_delete($file, 'imce');
- }
}
// Not in db. Probably loaded via ftp.
elseif (!file_unmanaged_delete($uri)) {
@@ -676,13 +673,25 @@ function imce_validate_quotas($file, &$imce, $add = 0) {
}
/**
- * Check if the file is an image and return info.
+ * Checks if the file is an image and returns info.
+ * There are two switchable versions that use image_get_info() and getimagesize()
*/
-function imce_image_info($file) {
- if (is_file($file) && ($dot = strrpos($file, '.')) && in_array(strtolower(substr($file, $dot+1)), array('jpg', 'jpeg', 'gif', 'png')) && ($info = @getimagesize($file)) && in_array($info[2], array(IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG)) ) {
- return array('width' => $info[0], 'height' => $info[1], 'type' => $info[2], 'mime' => $info['mime']);
+if (variable_get('imce_image_get_info', 0)) {
+ function imce_image_info($file) {
+ $mimes = array('image/jpeg' => IMAGETYPE_JPEG, 'image/gif' => IMAGETYPE_GIF, 'image/png' => IMAGETYPE_PNG);
+ if (is_file($file) && ($dot = strrpos($file, '.')) && in_array(strtolower(substr($file, $dot+1)), array('jpg', 'jpeg', 'gif', 'png')) && ($info = @image_get_info($file)) && isset($mimes[$info['mime_type']]) ) {
+ return array('width' => $info['width'], 'height' => $info['height'], 'type' => $mimes[$info['mime_type']], 'mime' => $info['mime_type']);
+ }
+ return FALSE;
+ }
+}
+else {
+ function imce_image_info($file) {
+ if (is_file($file) && ($dot = strrpos($file, '.')) && in_array(strtolower(substr($file, $dot+1)), array('jpg', 'jpeg', 'gif', 'png')) && ($info = @getimagesize($file)) && in_array($info[2], array(IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG)) ) {
+ return array('width' => $info[0], 'height' => $info[1], 'type' => $info[2], 'mime' => $info['mime']);
+ }
+ return FALSE;
}
- return FALSE;
}
/**
@@ -838,6 +847,7 @@ function imce_working_directory(&$imce) {
//or the whole list.
foreach ($imce['directories'] as $dirname => $info) {
+ $dirname = (string) $dirname;
if (imce_check_directory($dirname, $imce)) {
if ($sess) {
$_SESSION['imce_directory'] = rawurlencode($dirname);
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce.js b/kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce.js
index 2a2f9b4..2e97b4a 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce.js
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce.js
@@ -1,4 +1,3 @@
-
(function($) {
//Global container.
window.imce = {tree: {}, findex: [], fids: {}, selected: {}, selcount: 0, ops: {}, cache: {}, urlId: {},
@@ -8,6 +7,7 @@ hooks: {load: [], list: [], navigate: [], cache: []},
//initiate imce.
initiate: function() {
imce.conf = Drupal.settings.imce || {};
+ imce.ie = (navigator.userAgent.match(/msie (\d+)/i) || ['', 0])[1] * 1;
if (imce.conf.error != false) return;
imce.FLW = imce.el('file-list-wrapper'), imce.SBW = imce.el('sub-browse-wrapper');
imce.NW = imce.el('navigation-wrapper'), imce.BW = imce.el('browse-wrapper');
@@ -79,7 +79,7 @@ dirCollapsible: function (branch) {
if (branch.ul) {
$(branch.ul).toggle();
$(branch.li).toggleClass('expanded');
- $.browser.msie && $('#navigation-header').css('top', imce.NW.scrollTop);
+ imce.ie && $('#navigation-header').css('top', imce.NW.scrollTop);
}
else if (branch.clkbl){
$(branch.a).click();
@@ -424,7 +424,7 @@ navCache: function (dir, newdir) {
//validate upload form
uploadValidate: function (data, form, options) {
- var path = data[0].value;
+ var path = $('#edit-imce').val();
if (!path) return false;
if (imce.conf.extensions != '*') {
var ext = path.substr(path.lastIndexOf('.') + 1);
@@ -432,7 +432,6 @@ uploadValidate: function (data, form, options) {
return imce.setMessage(Drupal.t('Only files with the following extensions are allowed: %files-allowed.', {'%files-allowed': imce.conf.extensions}), 'error');
}
}
- var sep = path.indexOf('/') == -1 ? '\\' : '/';
options.url = imce.ajaxURL('upload');//make url contain current dir.
imce.fopLoading('upload', true);
return true;
@@ -487,12 +486,12 @@ commonSubmit: function(fop) {
//settings for default file operations
fopSettings: function (fop) {
- return {url: imce.ajaxURL(fop), type: 'POST', dataType: 'json', success: imce.processResponse, complete: function (response) {imce.fopLoading(fop, false);}, data: imce.vars.opform +'&filenames='+ imce.serialNames() +'&jsop='+ fop + (imce.ops[fop].div ? '&'+ $('input, select, textarea', imce.ops[fop].div).serialize() : '')};
+ return {url: imce.ajaxURL(fop), type: 'POST', dataType: 'json', success: imce.processResponse, complete: function (response) {imce.fopLoading(fop, false);}, data: imce.vars.opform +'&filenames='+ escape(imce.serialNames()) +'&jsop='+ fop + (imce.ops[fop].div ? '&'+ $('input, select, textarea', imce.ops[fop].div).serialize() : '')};
},
//toggle loading state
fopLoading: function(fop, state) {
- var el = imce.el('edit-'+ fop), func = state ? 'addClass' : 'removeClass'
+ var el = imce.el('edit-'+ fop), func = state ? 'addClass' : 'removeClass';
if (el) {
$(el)[func]('loading').attr('disabled', state);
}
@@ -789,7 +788,7 @@ updateUI: function() {
imce.opAdd({name: 'help', title: $('#help-box-title').remove().text(), content: $('#help-box').show()});
});
//add ie classes
- $.browser.msie && $('html').addClass('ie') && parseFloat($.browser.version) < 8 && $('html').addClass('ie-7');
+ imce.ie && $('html').addClass('ie') && imce.ie < 8 && $('html').addClass('ie-7');
// enable box view for file list
imce.vars.boxW && imce.boxView();
//scrolling file list
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce_extras.js b/kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce_extras.js
index 349de2d..f5cff02 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce_extras.js
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/imce/js/imce_extras.js
@@ -117,15 +117,10 @@ imce.firstSort = function() {
//sort file list according to column index.
imce.columnSort = function(cid, dsc) {
if (imce.findex.length < 2) return;
- if (cid == imce.vars.cid && dsc != imce.vars.dsc) {
- imce.findex.reverse();
- }
- else {
- var func = 'sort'+ (cid == 0 ? 'Str' : 'Num') + (dsc ? 'Dsc' : 'Asc');
- var prop = cid == 2 || cid == 3 ? 'innerHTML' : 'id';
- //sort rows
- imce.findex.sort(cid ? function(r1, r2) {return imce[func](r1.cells[cid][prop], r2.cells[cid][prop])} : function(r1, r2) {return imce[func](r1.id, r2.id)});
- }
+ var func = 'sort'+ (cid == 0 ? 'Str' : 'Num') + (dsc ? 'Dsc' : 'Asc');
+ var prop = cid == 2 || cid == 3 ? 'innerHTML' : 'id';
+ //sort rows
+ imce.findex.sort(cid ? function(r1, r2) {return imce[func](r1.cells[cid][prop], r2.cells[cid][prop])} : function(r1, r2) {return imce[func](r1.id, r2.id)});
//insert sorted rows
for (var row, i=0; row = imce.findex[i]; i++) {
imce.tbody.appendChild(row);
@@ -197,7 +192,7 @@ imce.recallDimensions = function() {
//set row heights with respect to window height
imce.recallHeights = function(bwFixedHeight) {
//window & body dimensions
- var winHeight = $.browser.opera ? window.innerHeight : $(window).height();
+ var winHeight = window.opera ? window.innerHeight : $(window).height();
var bodyHeight = $(document.body).outerHeight(true);
var diff = winHeight - bodyHeight;
var bwHeight = $(imce.BW).height(), pwHeight = $(imce.PW).height();
@@ -264,12 +259,12 @@ imce.imagestyleURL = function (url, stylename) {
// replace table view with box view for file list
imce.boxView = function () {
var w = imce.vars.boxW, h = imce.vars.boxH;
- if (!w || !h || $.browser.msie && parseFloat($.browser.version) < 8) return;
+ if (!w || !h || imce.ie && imce.ie < 8) return;
var $body = $(document.body);
var toggle = function() {
$body.toggleClass('box-view');
// refresh dom. required by all except FF.
- !$.browser.mozilla && $('#file-list').appendTo(imce.FW).appendTo(imce.FLW);
+ $('#file-list').appendTo(imce.FW).appendTo(imce.FLW);
};
$body.append('<style type="text/css">.box-view #file-list td.name {width: ' + w + 'px;height: ' + h + 'px;} .box-view #file-list td.name span {width: ' + w + 'px;word-wrap: normal;text-overflow: ellipsis;}</style>');
imce.hooks.load.push(function() {
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/imce/tpl/imce-page.tpl.php b/kolab.org/www/drupal-7.18/sites/all/modules/imce/tpl/imce-page.tpl.php
index 197858a..cfe2185 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/imce/tpl/imce-page.tpl.php
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/imce/tpl/imce-page.tpl.php
@@ -4,6 +4,7 @@
<head>
<title><?php print t('File Browser'); ?></title>
+ <meta name="robots" content="noindex,nofollow" />
<?php if (isset($_GET['app'])): drupal_add_js(drupal_get_path('module', 'imce') .'/js/imce_set_app.js'); endif;?>
<?php print drupal_get_html_head(); ?>
<?php print drupal_get_css(); ?>