[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/ckeditor/includes/ -> filemanager.config.php (source)

   1  <?php
   2  
   3  // $Id: filemanager.config.php,v 1.1 2009/12/04 20:36:57 wwalc Exp $
   4  /**
   5   * CKEditor - The text editor for Internet - http://ckeditor.com
   6   * Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
   7   *
   8   * == BEGIN LICENSE ==
   9   *
  10   * Licensed under the terms of any of the following licenses at your
  11   * choice:
  12   *
  13   *  - GNU General Public License Version 2 or later (the "GPL")
  14   *    http://www.gnu.org/licenses/gpl.html
  15   *
  16   *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  17   *    http://www.gnu.org/licenses/lgpl.html
  18   *
  19   *  - Mozilla Public License Version 1.1 or later (the "MPL")
  20   *    http://www.mozilla.org/MPL/MPL-1.1.html
  21   *
  22   * == END LICENSE ==
  23   *
  24   * @file
  25   * CKEditor Module for Drupal 6.x
  26   *
  27   * This file is required by CKEeditor module if you want to enable CKFinder 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  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7