bootstrap.php

Go to the documentation of this file.
00001 <?php
00002 /* SVN FILE: $Id: cake_2bootstrap_8php-source.html 675 2008-12-26 00:27:14Z gwoo $ */
00003 /**
00004  * Basic Cake functionality.
00005  *
00006  * Core functions for including other source files, loading models and so forth.
00007  *
00008  * PHP versions 4 and 5
00009  *
00010  * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
00011  * Copyright 2005-2008, Cake Software Foundation, Inc.
00012  *                              1785 E. Sahara Avenue, Suite 490-204
00013  *                              Las Vegas, Nevada 89104
00014  *
00015  * Licensed under The MIT License
00016  * Redistributions of files must retain the above copyright notice.
00017  *
00018  * @filesource
00019  * @copyright       Copyright 2005-2008, Cake Software Foundation, Inc.
00020  * @link                http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
00021  * @package         cake
00022  * @subpackage      cake.cake
00023  * @since           CakePHP(tm) v 0.2.9
00024  * @version         $Revision: 675 $
00025  * @modifiedby      $LastChangedBy: gwoo $
00026  * @lastmodified    $Date: 2008-12-25 18:27:14 -0600 (Thu, 25 Dec 2008) $
00027  * @license         http://www.opensource.org/licenses/mit-license.php The MIT License
00028  */
00029 /**
00030  * Configuration, directory layout and standard libraries
00031  */
00032     if (!isset($bootstrap)) {
00033         require CORE_PATH . 'cake' . DS . 'basics.php';
00034         require APP_PATH . 'config' . DS . 'core.php';
00035         require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php';
00036     }
00037     $TIME_START = getMicrotime();
00038     require LIBS . 'object.php';
00039     require LIBS . 'session.php';
00040     require LIBS . 'security.php';
00041     require LIBS . 'inflector.php';
00042     require LIBS . 'configure.php';
00043     $paths = Configure::getInstance();
00044 /**
00045  * Enter description here...
00046  */
00047     if (empty($uri) && defined('BASE_URL')) {
00048         $uri = setUri();
00049 
00050         if ($uri === '/' || $uri === '/index.php' || $uri === '/'.APP_DIR.'/') {
00051             $_GET['url'] = '/';
00052             $url = '/';
00053         } else {
00054             if (strpos($uri, 'index.php') !== false) {
00055                 $uri = r('?', '', $uri);
00056                 $elements=explode('/index.php', $uri);
00057             } else {
00058                 $elements = explode('/?', $uri);
00059             }
00060 
00061             if (!empty($elements[1])) {
00062                 $_GET['url'] = $elements[1];
00063                 $url = $elements[1];
00064             } else {
00065                 $_GET['url'] = '/';
00066                 $url = '/';
00067             }
00068         }
00069     } else {
00070         if (empty($_GET['url'])) {
00071             $url = null;
00072         } else {
00073             $url = $_GET['url'];
00074         }
00075     }
00076 
00077     if (strpos($url, 'ccss/') === 0) {
00078         include WWW_ROOT . DS . 'css.php';
00079         die();
00080     }
00081 
00082     Configure::write('debug', DEBUG);
00083 
00084     require CAKE . 'dispatcher.php';
00085 
00086     if (defined('CACHE_CHECK') && CACHE_CHECK === true) {
00087         if (empty($uri)) {
00088             $uri = setUri();
00089         }
00090         $filename=CACHE . 'views' . DS . convertSlash($uri) . '.php';
00091 
00092         if (file_exists($filename)) {
00093             uses(DS . 'controller' . DS . 'component', DS . 'view' . DS . 'view');
00094             $v = null;
00095             $view = new View($v);
00096             $view->renderCache($filename, $TIME_START);
00097         } elseif (file_exists(CACHE . 'views' . DS . convertSlash($uri) . '_index.php')) {
00098             uses(DS . 'controller' . DS . 'component', DS . 'view' . DS . 'view');
00099             $v = null;
00100             $view = new View($v);
00101             $view->renderCache(CACHE . 'views' . DS . convertSlash($uri) . '_index.php', $TIME_START);
00102         }
00103     }
00104 ?>