index.php

Go to the documentation of this file.
00001 <?php
00002 /* SVN FILE: $Id: index_8php-source.html 675 2008-12-26 00:27:14Z gwoo $ */
00003 /**
00004  * Requests collector.
00005  *
00006  *  This file collects requests if:
00007  *  - no mod_rewrite is avilable or .htaccess files are not supported
00008  *  -/public is not set as a web root.
00009  *
00010  * PHP versions 4 and 5
00011  *
00012  * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
00013  * Copyright 2005-2008, Cake Software Foundation, Inc.
00014  *                              1785 E. Sahara Avenue, Suite 490-204
00015  *                              Las Vegas, Nevada 89104
00016  *
00017  * Licensed under The MIT License
00018  * Redistributions of files must retain the above copyright notice.
00019  *
00020  * @filesource
00021  * @copyright       Copyright 2005-2008, Cake Software Foundation, Inc.
00022  * @link                http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
00023  * @package         cake
00024  * @since           CakePHP(tm) v 0.2.9
00025  * @version         $Revision: 675 $
00026  * @modifiedby      $LastChangedBy: gwoo $
00027  * @lastmodified    $Date: 2008-12-25 16:27:14 -0800 (Thu, 25 Dec 2008) $
00028  * @license         http://www.opensource.org/licenses/mit-license.php The MIT License
00029  */
00030 /**
00031  *  Get Cake's root directory
00032  */
00033     define('APP_DIR', 'app');
00034     define('DS', DIRECTORY_SEPARATOR);
00035     define('ROOT', dirname(__FILE__));
00036     define('WEBROOT_DIR', 'webroot');
00037     define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS);
00038 /**
00039  * This only needs to be changed if the cake installed libs are located
00040  * outside of the distributed directory structure.
00041  */
00042     if (!defined('CAKE_CORE_INCLUDE_PATH')) {
00043         //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
00044         define('CAKE_CORE_INCLUDE_PATH', ROOT);
00045     }
00046     if (function_exists('ini_set')) {
00047         ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS);
00048         define('APP_PATH', null);
00049         define('CORE_PATH', null);
00050     } else {
00051         define('APP_PATH', ROOT . DS . APP_DIR . DS);
00052         define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
00053     }
00054     require CORE_PATH . 'cake' . DS . 'basics.php';
00055     require APP_PATH . 'config' . DS . 'core.php';
00056     require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php';
00057     $bootstrap=true;
00058     $uri      =setUri();
00059 /**
00060  * As mod_rewrite (or .htaccess files) is not working, we need to take care
00061  * of what would normally be rewritten, i.e. the static files in app/webroot/
00062  */
00063     if ($uri === '/' || $uri === '/index.php') {
00064         $_GET['url'] = '/';
00065         require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
00066     } else {
00067         $elements=explode('/index.php', $uri);
00068 
00069         if (!empty($elements[1])) {
00070             $path = $elements[1];
00071         } else {
00072             $path = '/';
00073         }
00074         $_GET['url']=$path;
00075         require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
00076     }
00077 ?>