Index: ckeditor.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/ckeditor/ckeditor.install,v retrieving revision 1.2.2.7 diff -u -p -r1.2.2.7 ckeditor.install --- ckeditor.install 9 Mar 2010 15:38:01 -0000 1.2.2.7 +++ ckeditor.install 4 Jun 2010 18:16:36 -0000 @@ -351,18 +351,18 @@ function _ckeditor_requirements_getinsta */ function _ckeditor_requirements_ckfinder_config_check($profile_name) { module_load_include('module', 'ckeditor'); - $module_drupal_path = drupal_get_path('module', 'ckeditor'); - $config_path = $module_drupal_path .'/ckfinder/config.php'; + $ckfinder_drupal_path = ckeditor_path(FALSE, FALSE, 'ckfinder'); + $config_path = $ckfinder_drupal_path . '/config.php'; if (!file_exists($config_path)) { return t('!ckfinder is not installed correctly: !config not found. Make sure that you have uploaded all files or didn\'t remove that file accidentally.', array( - '!config' => $module_drupal_path .'/ckfinder/config.php', + '!config' => $ckfinder_drupal_path . '/config.php', '!ckfinder' => 'CKFinder' )); } if (!is_readable($config_path)) { - return t('CKEditor needs read permission to !config.', array('!config' => 'ckfinder/config.php')); + return t('CKEditor needs read permission to !config.', array('!config' => $config_path . '/config.php')); } $config_contents = file($config_path); Index: ckeditor.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/ckeditor/ckeditor.module,v retrieving revision 1.4.2.25 diff -u -p -r1.4.2.25 ckeditor.module --- ckeditor.module 6 May 2010 11:28:11 -0000 1.4.2.25 +++ ckeditor.module 4 Jun 2010 18:16:36 -0000 @@ -90,7 +90,7 @@ function ckeditor_user($type, $edit, &$u */ function ckeditor_perm() { $arr = array('administer ckeditor', 'access ckeditor'); - if (file_exists(drupal_get_path('module', 'ckeditor') . "/ckfinder")) { + if (file_exists(ckeditor_path(TRUE, FALSE, 'ckfinder'))) { $arr[] = 'allow CKFinder file uploads'; } return $arr; @@ -544,6 +544,8 @@ function ckeditor_process_textarea($elem $module_full_path = $host . $module_drupal_path; $editor_path = ckeditor_path(FALSE); $editor_local_path = ckeditor_path(TRUE); + $finder_path = ckeditor_path(FALSE, FALSE, 'ckfinder'); + $finder_local_path = ckeditor_path(TRUE, FALSE, 'ckfinder'); // get the default drupal files path $files_path = $host . file_directory_path(); @@ -746,12 +748,12 @@ function ckeditor_process_textarea($elem switch ($filebrowser) { case 'ckfinder': if (user_access('allow CKFinder file uploads')) { - $settings[$textarea_id]['filebrowserBrowseUrl'] = $module_full_path .'/ckfinder/ckfinder.html'; - $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $module_full_path .'/ckfinder/ckfinder.html?Type=Images'; - $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $module_full_path .'/ckfinder/ckfinder.html?Type=Flash'; - $settings[$textarea_id]['filebrowserUploadUrl'] = $module_full_path .'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files'; - $settings[$textarea_id]['filebrowserImageUploadUrl'] = $module_full_path .'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'; - $settings[$textarea_id]['filebrowserFlashUploadUrl'] = $module_full_path .'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'; + $settings[$textarea_id]['filebrowserBrowseUrl'] = $finder_local_path . '/ckfinder.html'; + $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $finder_local_path . '/ckfinder.html?Type=Images'; + $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $finder_local_path . '/ckfinder.html?Type=Flash'; + $settings[$textarea_id]['filebrowserUploadUrl'] = $finder_local_path . '/core/connector/php/connector.php?command=QuickUpload&type=Files'; + $settings[$textarea_id]['filebrowserImageUploadUrl'] = $finder_local_path . '/core/connector/php/connector.php?command=QuickUpload&type=Images'; + $settings[$textarea_id]['filebrowserFlashUploadUrl'] = $finder_local_path . '/core/connector/php/connector.php?command=QuickUpload&type=Flash'; } break; case 'imce': @@ -780,8 +782,8 @@ function ckeditor_process_textarea($elem switch ($filebrowser_image) { case 'ckfinder': if (user_access('allow CKFinder file uploads')) { - $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $module_full_path .'/ckfinder/ckfinder.html?Type=Images'; - $settings[$textarea_id]['filebrowserImageUploadUrl'] = $module_full_path .'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'; + $settings[$textarea_id]['filebrowserImageBrowseUrl'] = $finder_local_path . '/ckfinder.html?Type=Images'; + $settings[$textarea_id]['filebrowserImageUploadUrl'] = $finder_local_path . '/core/connector/php/connector.php?command=QuickUpload&type=Images'; } break; case 'imce': @@ -811,8 +813,8 @@ function ckeditor_process_textarea($elem switch ($filebrowser_flash) { case 'ckfinder': if (user_access('allow CKFinder file uploads')) { - $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $module_full_path .'/ckfinder/ckfinder.html?Type=Images'; - $settings[$textarea_id]['filebrowserFlashUploadUrl'] = $module_full_path .'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'; + $settings[$textarea_id]['filebrowserFlashBrowseUrl'] = $finder_local_path . '/ckfinder.html?Type=Images'; + $settings[$textarea_id]['filebrowserFlashUploadUrl'] = $finder_local_path . '/core/connector/php/connector.php?command=QuickUpload&type=Images'; } break; case 'imce': @@ -1004,32 +1006,32 @@ function ckeditor_process_textarea($elem } /** - * Read CKEditor path from Global profile + * Read CKEditor/CKFinder path from Global profile * * @return - * path to CKEditor folder + * path to CKEditor/CKFinder folder */ -function ckeditor_path($local = FALSE, $refresh = FALSE) { - static $cke_path; - static $cke_local_path; +function ckeditor_path($local = FALSE, $refresh = FALSE, $lib = 'ckeditor') { + static $lib_path; + static $lib_local_path; - if ($refresh || (!$cke_path)) { + if ($refresh || (!$lib_path)) { $mod_path = drupal_get_path('module', 'ckeditor'); $global_profile = ckeditor_profile_load('CKEditor Global Profile', $refresh); - //default: path to ckeditor subdirectory in the ckeditor module directory (starting from the document root) + //default: path to ckeditor/ckfinder subdirectory in the ckeditor module directory (starting from the document root) //e.g. for http://example.com/drupal it will be /drupal/sites/all/modules/ckeditor/ckeditor - $cke_path = base_path() . $mod_path .'/ckeditor'; + $lib_path = base_path() . $mod_path . '/' . $lib; - //default: path to ckeditor subdirectory in the ckeditor module directory (relative to index.php) + //default: path to ckeditor/ckfinder subdirectory in the ckeditor module directory (relative to index.php) //e.g.: sites/all/modules/ckeditor/ckeditor - $cke_local_path = $mod_path .'/ckeditor'; + $lib_local_path = $mod_path . '/' . $lib; if ($global_profile) { $gs = $global_profile->settings; - if (isset($gs['ckeditor_path'])) { - $tmp_path = $gs['ckeditor_path']; + if (isset($gs[$lib . '_path'])) { + $tmp_path = $gs[$lib . '_path']; $tmp_path = strtr($tmp_path, array("%b" => base_path(), "%m" => base_path() . $mod_path)); $tmp_path = str_replace('\\', '/', $tmp_path); $tmp_path = str_replace('//', '/', $tmp_path); @@ -1037,38 +1039,38 @@ function ckeditor_path($local = FALSE, $ if (substr($tmp_path, 0, 1) != '/') { $tmp_path = '/'. $tmp_path; //starts with '/' } - $cke_path = $tmp_path; + $lib_path = $tmp_path; - if (empty($gs['ckeditor_local_path'])) { + if (empty($gs[$lib . '_local_path'])) { //fortunately wildcards are used, we can easily get the right server path - if (FALSE !== strpos($gs['ckeditor_path'], "%m")) { - $gs['ckeditor_local_path'] = strtr($gs['ckeditor_path'], array("%m" => $mod_path)); + if (FALSE !== strpos($gs[$lib . '_path'], "%m")) { + $gs[$lib . '_local_path'] = strtr($gs[$lib . '_path'], array("%m" => $mod_path)); } - if (FALSE !== strpos($gs['ckeditor_path'], "%b")) { - $gs['ckeditor_local_path'] = strtr($gs['ckeditor_path'], array("%b" => ".")); + if (FALSE !== strpos($gs[$lib . '_path'], "%b")) { + $gs[$lib . '_local_path'] = strtr($gs[$lib . '_path'], array("%b" => ".")); } } } - //ckeditor_path is defined, but wildcards are not used, we need to try to find out where is - //the document root located and append ckeditor_path to it. - if (!empty($gs['ckeditor_local_path'])) { - $cke_local_path = $gs['ckeditor_local_path']; + //ckeditor_path/ckfinder_path is defined, but wildcards are not used, we need to try to find out where is + //the document root located and append ckeditor_path/ckfinder_path to it. + if (!empty($gs[$lib . '_local_path'])) { + $lib_local_path = $gs[$lib . '_local_path']; } - elseif (!empty($gs['ckeditor_path'])) { + elseif (!empty($gs[$lib . '_path'])) { module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); - $local_path = ckeditor_resolve_url( $gs['ckeditor_path'] ."/" ); + $local_path = ckeditor_resolve_url($gs[$lib . '_path'] . '/'); if (FALSE !== $local_path) { - $cke_local_path = $local_path; + $lib_local_path = $local_path; } } } } if ($local) { - return $cke_local_path; + return $lib_local_path; } else { - return $cke_path; + return $lib_path; } } Index: includes/ckeditor.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/ckeditor/includes/ckeditor.admin.inc,v retrieving revision 1.2.2.17 diff -u -p -r1.2.2.17 ckeditor.admin.inc --- includes/ckeditor.admin.inc 7 May 2010 09:14:50 -0000 1.2.2.17 +++ includes/ckeditor.admin.inc 4 Jun 2010 18:16:37 -0000 @@ -1037,6 +1037,17 @@ function ckeditor_admin_global_profile_f $form['common']['rank']['#description'] .= '
'. t('You haven\'t assigned the "access ckeditor" permissions yet.', array('!permissions' => url('admin/user/permissions'))); } + $form['common']['show_fieldnamehint'] = array( + '#type' => 'radios', + '#title' => t('Show field name hint below each rich text editor'), + '#default_value' => !empty($profile->settings['show_fieldnamehint']) ? $profile->settings['show_fieldnamehint'] : 't', + '#options' => array( + 't' => t('Yes'), + 'f' => t('No') + ), + '#description' => t('This only applies for users with "administer ckeditor" permissions.'), + ); + $form['ckeditor_exclude_settings'] = array( '#type' => 'fieldset', '#title' => t('Visibility settings'), @@ -1082,16 +1093,16 @@ function ckeditor_admin_global_profile_f '#wysiwyg' => FALSE, ); - $form['ckeditor_advanced_settings'] = array( + $form['ckeditor_path_settings'] = array( '#type' => 'fieldset', - '#title' => t('Advanced settings'), + '#title' => t('Path settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $module_drupal_path = drupal_get_path('module', 'ckeditor'); - $form['ckeditor_advanced_settings']['ckeditor_path'] = array( + $form['ckeditor_path_settings']['ckeditor_path'] = array( '#type' => 'textfield', '#title' => t('Path to CKEditor'), '#default_value' => !empty($profile->settings['ckeditor_path']) ? $profile->settings['ckeditor_path'] : '%m/ckeditor', @@ -1111,7 +1122,7 @@ function ckeditor_admin_global_profile_f '#required' => TRUE ); - $form['ckeditor_advanced_settings']['ckeditor_local_path'] = array( + $form['ckeditor_path_settings']['ckeditor_local_path'] = array( '#type' => 'textfield', '#title' => t('Local path to CKEditor'), '#default_value' => isset($profile->settings['ckeditor_local_path'])?$profile->settings['ckeditor_local_path']:'', @@ -1120,20 +1131,38 @@ function ckeditor_admin_global_profile_f '#description' => t('The path to the local directory (on the server) which points to the path defined above. Enter either an absolute server path or path relative to "index.php". If empty, CKEditor module will try to find the right path.
Current path: !path', array('!path' => ckeditor_path(TRUE))), ); - $form['ckeditor_advanced_settings']['show_fieldnamehint'] = array( - '#type' => 'radios', - '#title' => t('Show field name hint below each rich text editor'), - '#default_value' => !empty($profile->settings['show_fieldnamehint']) ? $profile->settings['show_fieldnamehint'] : 't', - '#options' => array( - 't' => t('Yes'), - 'f' => t('No') - ), - '#description' => t('This only applies for users with "administer ckeditor" permissions.'), + $form['ckeditor_path_settings']['ckfinder_path'] = array( + '#type' => 'textfield', + '#title' => t('Path to CKFinder'), + '#default_value' => !empty($profile->settings['ckfinder_path']) ? $profile->settings['ckfinder_path'] : '%m/ckfinder', + '#size' => 40, + '#maxlength' => 128, + '#description' => t('Path to CKFinder (the file manager, downloaded from ckfinder.com) relative to the document root.') . + '
'. + t('Available placeholders:!b - base URL path of the Drupal installation (!base).!m - base URL path where CKEditor module is stored (!files).
Current path: !path', + array( + '!b' => '
%b', + '!m' => '
%m', + '!path' => ckeditor_path(FALSE, TRUE, 'ckfinder'), + '!base' => base_path(), + '!files' => base_path() . $module_drupal_path , + '!ckfindercom' => 'http://ckfinder.com/download' + )), + '#required' => TRUE + ); + + $form['ckeditor_path_settings']['ckfinder_local_path'] = array( + '#type' => 'textfield', + '#title' => t('Local path to CKFinder'), + '#default_value' => isset($profile->settings['ckfinder_local_path'])?$profile->settings['ckfinder_local_path']:'', + '#size' => 40, + '#maxlength' => 128, + '#description' => t('The path to the local directory (on the server) which points to the path defined above. Enter either an absolute server path or path relative to "index.php". If empty, CKEditor module will try to find the right path.
Current path: !path', array('!path' => ckeditor_path(TRUE, TRUE, 'ckfinder'))), ); if (variable_get('file_downloads', '') == FILE_DOWNLOADS_PRIVATE) { $current_private_dir = !empty($profile->settings['private_dir']) ? $profile->settings['private_dir'] : ''; - $form['ckeditor_advanced_settings']['private_dir'] = array( + $form['ckeditor_path_settings']['private_dir'] = array( '#type' => 'textfield', '#title' => t('Location of files uploaded with CKEditor in the private folder'), '#default_value' => !empty($profile->settings['private_dir']) ? $profile->settings['private_dir'] : '', @@ -1143,7 +1172,7 @@ function ckeditor_admin_global_profile_f ); } if (function_exists('linktocontent_node_menu') && function_exists('pathfilter_filter')) { - $form['ckeditor_advanced_settings']['linktoc'] = array( + $form['ckeditor_path_settings']['linktoc'] = array( '#type' => 'select', '#options' => array('p' => t('Link to paths only'), 'n' => t('Link using internal: links'), 'pn' => t('Allow user to select between paths and internal links')), '#title' => t('Path Filter & Link To Content integration'), @@ -1203,10 +1232,28 @@ function ckeditor_admin_global_profile_f $edit['ckeditor_path'] = trim(rtrim($edit['ckeditor_path'], "/")); if ($edit['ckeditor_path'] && 0 !== strpos($edit['ckeditor_path'], "/") && 0 !== strpos($edit['ckeditor_path'], "%")) { //ensure that slash is at the beginning - $edit['ckeditor_path'] = "/". $edit['ckeditor_path']; + $edit['ckeditor_path'] = "/" . $edit['ckeditor_path']; + } + + //strip whitespaces + if (empty($edit['ckfinder_local_path'])) { + $edit['ckfinder_local_path'] = ''; + } + else { + $edit['ckfinder_local_path'] = trim($edit['ckfinder_local_path']); + } + + //strip slash from the end + if (empty($edit['ckfinder_path'])) { + $edit['ckfinder_path'] = ''; + } + $edit['ckfinder_path'] = trim(rtrim($edit['ckfinder_path'], "/")); + if ($edit['ckfinder_path'] && 0 !== strpos($edit['ckfinder_path'], "/") && 0 !== strpos($edit['ckfinder_path'], "%")) { + //ensure that slash is at the beginning + $edit['ckfinder_path'] = "/" . $edit['ckfinder_path']; } //no slash at the end - $edit['ckeditor_local_path'] = trim(rtrim($edit['ckeditor_local_path'], "/")); + $edit['ckfinder_local_path'] = trim(rtrim($edit['ckfinder_local_path'], "/")); $settings = ckeditor_admin_values_to_settings($edit); db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", $edit['name'], $settings);