index.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /* SVN FILE: $Id: index.php 2951 2006-05-25 22:12:33Z phpnut $ */
  3. /**
  4. * Requests collector.
  5. *
  6. * This file collects requests if:
  7. * - no mod_rewrite is avilable or .htaccess files are not supported
  8. * -/public is not set as a web root.
  9. *
  10. * PHP versions 4 and 5
  11. *
  12. * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
  13. * Copyright (c) 2006, Cake Software Foundation, Inc.
  14. * 1785 E. Sahara Avenue, Suite 490-204
  15. * Las Vegas, Nevada 89104
  16. *
  17. * Licensed under The MIT License
  18. * Redistributions of files must retain the above copyright notice.
  19. *
  20. * @filesource
  21. * @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
  22. * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
  23. * @package cake
  24. * @since CakePHP v 0.2.9
  25. * @version $Revision: 2951 $
  26. * @modifiedby $LastChangedBy: phpnut $
  27. * @lastmodified $Date: 2006-05-25 17:12:33 -0500 (Thu, 25 May 2006) $
  28. * @license http://www.opensource.org/licenses/mit-license.php The MIT License
  29. */
  30. /**
  31. * Get Cake's root directory
  32. */
  33. define('APP_DIR', 'app');
  34. define('DS', DIRECTORY_SEPARATOR);
  35. define('ROOT', dirname(__FILE__));
  36. define('WEBROOT_DIR', 'webroot');
  37. define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS);
  38. /**
  39. * This only needs to be changed if the cake installed libs are located
  40. * outside of the distributed directory structure.
  41. */
  42. if (!defined('CAKE_CORE_INCLUDE_PATH')) {
  43. //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
  44. define('CAKE_CORE_INCLUDE_PATH', ROOT);
  45. }
  46. if (function_exists('ini_set')) {
  47. ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS);
  48. define('APP_PATH', null);
  49. define('CORE_PATH', null);
  50. } else {
  51. define('APP_PATH', ROOT . DS . APP_DIR . DS);
  52. define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
  53. }
  54. require CORE_PATH . 'cake' . DS . 'basics.php';
  55. require APP_PATH . 'config' . DS . 'core.php';
  56. require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php';
  57. $bootstrap=true;
  58. $uri =setUri();
  59. /**
  60. * As mod_rewrite (or .htaccess files) is not working, we need to take care
  61. * of what would normally be rewritten, i.e. the static files in app/webroot/
  62. */
  63. if ($uri === '/' || $uri === '/index.php') {
  64. $_GET['url'] = '/';
  65. require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
  66. } else {
  67. $elements=explode('/index.php', $uri);
  68. if (!empty($elements[1])) {
  69. $path = $elements[1];
  70. } else {
  71. $path = '/';
  72. }
  73. $_GET['url']=$path;
  74. require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
  75. }
  76. ?>