Difference between revisions of "IMCE Fix"
Jump to navigation
Jump to search
(5 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
<pre> | <pre> | ||
//$temp = tempnam(realpath(file_directory_temp()), 'imc'); | //$temp = tempnam(realpath(file_directory_temp()), 'imc'); | ||
− | $temp = tempnam(file_directory_temp(), 'imc'); //WOLFTECH CHANGES MADE | + | $temp = @tempnam(file_directory_temp(), 'imc'); //WOLFTECH CHANGES MADE |
</pre> | </pre> | ||
+ | |||
+ | In includes/image.inc (line 117), | ||
+ | |||
+ | change: | ||
+ | <pre> | ||
+ | if (!is_file($file)) { | ||
+ | </pre> | ||
+ | |||
+ | to: | ||
+ | <pre> | ||
+ | if (!is_uploaded_file($file) && !is_file($file)) { | ||
+ | </pre> | ||
+ | |||
+ | In includes/file.inc (line 572), | ||
+ | |||
+ | change: | ||
+ | <pre> | ||
+ | if (!move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) { | ||
+ | </pre> | ||
+ | |||
+ | to: | ||
+ | <pre> | ||
+ | if (!@move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) { | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | ==Altering the Theme to work with IMCE== | ||
+ | |||
+ | *add this function to your current theme's template.php file.(create it if you don't have it. make sure it has <?php at the beginning.) | ||
+ | <pre> | ||
+ | <?php | ||
+ | function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) { | ||
+ | static $access, $integrated; | ||
+ | |||
+ | if (!isset($access)) { | ||
+ | $access = function_exists('imce_access') && imce_access(); | ||
+ | } | ||
+ | |||
+ | $init = theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running); | ||
+ | |||
+ | if ($init && $access) { | ||
+ | $init['file_browser_callback'] = 'imceImageBrowser'; | ||
+ | if (!isset($integrated)) { | ||
+ | $integrated = TRUE; | ||
+ | drupal_add_js("function imceImageBrowser(fid, url, type, win) {win.open(Drupal.settings.basePath +'?q=imce&app=TinyMCE|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline'); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return $init; | ||
+ | } | ||
+ | ?> | ||
+ | </pre> | ||
+ | *Go to admin/settings/performance and Clear cached data (at the bottom). | ||
+ | *Make sure your users have access to IMCE (admin/settings/imce) | ||
+ | *Clear your browser's cache and start testing. | ||
+ | *In case of a failure, try alternative themes or browsers and report back with details. | ||
+ | ==Fix for IMCEIMAGE== | ||
+ | http://drupal.org/node/832242#comment-3290472 |
Latest revision as of 15:09, 31 May 2011
To allow IMCE to work on Drupal 6 on the Engineering Servers, you need to replace the following in modules/imce/inc/page.inc (line 467):
$temp = tempnam(realpath(file_directory_temp()), 'imc');
with:
//$temp = tempnam(realpath(file_directory_temp()), 'imc'); $temp = @tempnam(file_directory_temp(), 'imc'); //WOLFTECH CHANGES MADE
In includes/image.inc (line 117),
change:
if (!is_file($file)) {
to:
if (!is_uploaded_file($file) && !is_file($file)) {
In includes/file.inc (line 572),
change:
if (!move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) {
to:
if (!@move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) {
Altering the Theme to work with IMCE
- add this function to your current theme's template.php file.(create it if you don't have it. make sure it has <?php at the beginning.)
<?php function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) { static $access, $integrated; if (!isset($access)) { $access = function_exists('imce_access') && imce_access(); } $init = theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running); if ($init && $access) { $init['file_browser_callback'] = 'imceImageBrowser'; if (!isset($integrated)) { $integrated = TRUE; drupal_add_js("function imceImageBrowser(fid, url, type, win) {win.open(Drupal.settings.basePath +'?q=imce&app=TinyMCE|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline'); } } return $init; } ?>
- Go to admin/settings/performance and Clear cached data (at the bottom).
- Make sure your users have access to IMCE (admin/settings/imce)
- Clear your browser's cache and start testing.
- In case of a failure, try alternative themes or browsers and report back with details.