| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * CKEditor - The text editor for the Internet - http://ckeditor.com 5 * Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. 6 * 7 * == BEGIN LICENSE == 8 * 9 * Licensed under the terms of any of the following licenses of your 10 * choice: 11 * 12 * - GNU General Public License Version 2 or later (the "GPL") 13 * http://www.gnu.org/licenses/gpl.html 14 * 15 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 16 * http://www.gnu.org/licenses/lgpl.html 17 * 18 * - Mozilla Public License Version 1.1 or later (the "MPL") 19 * http://www.mozilla.org/MPL/MPL-1.1.html 20 * 21 * == END LICENSE == 22 * 23 * @file 24 * CKEditor Module for Drupal 6.x 25 * 26 * This file is required by the CKEeditor module if you want to enable CKFinder, 27 * an advanced Ajax file browser. 28 * 29 */ 30 31 $GLOBALS['devel_shutdown'] = FALSE; 32 33 $ckfinder_user_files_path = ''; 34 $ckfinder_user_files_absolute_path = ''; 35 36 function CheckAuthentication() { 37 static $authenticated; 38 39 if (!isset($authenticated)) { 40 if (!empty($_SERVER['SCRIPT_FILENAME'])) { 41 $drupal_path = dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])))); 42 if (!file_exists($drupal_path .'/includes/bootstrap.inc')) { 43 $drupal_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))); 44 $depth = 2; 45 do { 46 $drupal_path = dirname($drupal_path); 47 $depth ++; 48 } 49 while (!($bootstrap_file_found = file_exists($drupal_path .'/includes/bootstrap.inc')) && $depth<10); 50 } 51 } 52 53 if (!isset($bootstrap_file_found) || !$bootstrap_file_found) { 54 $drupal_path = '../../../../..'; 55 if (!file_exists($drupal_path .'/includes/bootstrap.inc')) { 56 $drupal_path = '../..'; 57 do { 58 $drupal_path .= '/..'; 59 $depth = substr_count($drupal_path, '..'); 60 } 61 while (!($bootstrap_file_found = file_exists($drupal_path .'/includes/bootstrap.inc')) && $depth < 10); 62 } 63 } 64 if (!isset($bootstrap_file_found) || $bootstrap_file_found) { 65 $current_cwd = getcwd(); 66 chdir($drupal_path); 67 require_once './includes/bootstrap.inc'; 68 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); 69 $authenticated = user_access('allow CKFinder file uploads'); 70 if (isset($_SESSION['ckeditor']['UserFilesPath'], $_SESSION['ckeditor']['UserFilesAbsolutePath'])) { 71 $GLOBALS['ckfinder_user_files_path'] = $_SESSION['ckeditor']['UserFilesPath']; 72 $GLOBALS['ckfinder_user_files_absolute_path'] = $_SESSION['ckeditor']['UserFilesAbsolutePath']; 73 } 74 chdir($current_cwd); 75 } 76 } 77 78 return $authenticated; 79 } 80 81 CheckAuthentication(); 82 83 if (!empty($ckfinder_user_files_path)) { 84 $baseUrl = $ckfinder_user_files_path; 85 $baseDir = $ckfinder_user_files_absolute_path; 86 } 87 else { 88 // Nothing in session? Shouldn't happen... anyway let's try to upload it in the (almost) right place 89 // Path to user files relative to the document root. 90 $baseUrl = strtr(base_path(), array( 91 '/modules/ckeditor/ckfinder/core/connector/php' => '', 92 )) . file_directory_path() .'/'; 93 $baseDir = resolveUrl($baseUrl); 94 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |