bootstrap.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. /* SVN FILE: $Id$ */
  3. /**
  4. * Basic Cake functionality.
  5. *
  6. * Core functions for including other source files, loading models and so forth.
  7. *
  8. * PHP versions 4 and 5
  9. *
  10. * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
  11. * Copyright (c) 2006, Cake Software Foundation, Inc.
  12. * 1785 E. Sahara Avenue, Suite 490-204
  13. * Las Vegas, Nevada 89104
  14. *
  15. * Licensed under The MIT License
  16. * Redistributions of files must retain the above copyright notice.
  17. *
  18. * @filesource
  19. * @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
  20. * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
  21. * @package cake
  22. * @subpackage cake.cake
  23. * @since CakePHP v 0.2.9
  24. * @version $Revision$
  25. * @modifiedby $LastChangedBy$
  26. * @lastmodified $Date$
  27. * @license http://www.opensource.org/licenses/mit-license.php The MIT License
  28. */
  29. /**
  30. * Configuration, directory layout and standard libraries
  31. */
  32. if(!isset($bootstrap))
  33. {
  34. require CORE_PATH.'cake'.DS.'basics.php';
  35. require APP_PATH.'config'.DS.'core.php';
  36. require CORE_PATH.'cake'.DS.'config'.DS.'paths.php';
  37. }
  38. $TIME_START = getMicrotime();
  39. require LIBS.'object.php';
  40. require LIBS.'session.php';
  41. require LIBS.'security.php';
  42. require LIBS.'neat_array.php';
  43. require LIBS.'inflector.php';
  44. require LIBS.'configure.php';
  45. $paths = Configure::getInstance();
  46. /**
  47. * Enter description here...
  48. */
  49. if (empty($uri) && defined('BASE_URL'))
  50. {
  51. $uri = setUri();
  52. if ($uri === '/' || $uri === '/index.php' || $uri === '/app/')
  53. {
  54. $_GET['url'] = '/';
  55. $url = '/';
  56. }
  57. else
  58. {
  59. if (strpos($uri, 'index.php') !== false)
  60. {
  61. $uri = r ('?', '', $uri);
  62. $elements = explode('/index.php', $uri);
  63. }
  64. else
  65. {
  66. $elements = explode('/?', $uri);
  67. }
  68. if(!empty($elements[1]))
  69. {
  70. $_GET['url'] = $elements[1];
  71. $url = $elements[1];
  72. }
  73. else
  74. {
  75. $_GET['url'] = '/';
  76. $url = '/';
  77. }
  78. }
  79. }
  80. else
  81. {
  82. if(empty($_GET['url']))
  83. {
  84. $url = null;
  85. }
  86. else
  87. {
  88. $url = $_GET['url'];
  89. }
  90. }
  91. if (strpos($url, 'ccss/') === 0)
  92. {
  93. include WWW_ROOT.DS.'css.php';
  94. die();
  95. }
  96. if (DEBUG)
  97. {
  98. error_reporting(E_ALL);
  99. if(function_exists('ini_set'))
  100. {
  101. ini_set('display_errors', 1);
  102. }
  103. }
  104. else
  105. {
  106. error_reporting(0);
  107. }
  108. require CAKE.'dispatcher.php';
  109. require LIBS.'model'.DS.'connection_manager.php';
  110. config('database');
  111. if (!class_exists('AppModel'))
  112. {
  113. require LIBS.'model'.DS.'model.php';
  114. loadModels();
  115. }
  116. if(defined('CACHE_CHECK') && CACHE_CHECK === true)
  117. {
  118. if (empty($uri))
  119. {
  120. $uri = setUri();
  121. }
  122. $filename = CACHE.'views'.DS.convertSlash($uri).'.php';
  123. if (file_exists($filename))
  124. {
  125. uses(DS.'controller'.DS.'component', DS.'view'.DS.'view');
  126. $v = null;
  127. $view = new View($v);
  128. $view->renderCache($filename, $TIME_START);
  129. }
  130. elseif (file_exists(CACHE.'views'.DS.convertSlash($uri).'_index.php'))
  131. {
  132. uses(DS.'controller'.DS.'component', DS.'view'.DS.'view');
  133. $v = null;
  134. $view = new View($v);
  135. $view->renderCache(CACHE.'views'.DS.convertSlash($uri).'_index.php', $TIME_START);
  136. }
  137. }
  138. ?>