summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.page.inc
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.page.inc')
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/imce/inc/imce.page.inc32
1 files changed, 21 insertions, 11 deletions
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);