index.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /* SVN FILE: $Id$ */
  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$
  26. * @modifiedby $LastChangedBy$
  27. * @lastmodified $Date$
  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.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. {
  44. //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
  45. define('CAKE_CORE_INCLUDE_PATH', ROOT);
  46. }
  47. if(function_exists('ini_set'))
  48. {
  49. ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.PATH_SEPARATOR.ROOT.DS.APP_DIR.DS);
  50. define('APP_PATH', null);
  51. define('CORE_PATH', null);
  52. }
  53. else
  54. {
  55. define('APP_PATH', ROOT.DS.APP_DIR.DS);
  56. define('CORE_PATH', CAKE_CORE_INCLUDE_PATH.DS);
  57. }
  58. require CORE_PATH.'cake'.DS.'basics.php';
  59. require APP_PATH.'config'.DS.'core.php';
  60. require CORE_PATH.'cake'.DS.'config'.DS.'paths.php';
  61. $bootstrap = true;
  62. $uri = setUri();
  63. /**
  64. * As mod_rewrite (or .htaccess files) is not working, we need to take care
  65. * of what would normally be rewritten, i.e. the static files in app/webroot/
  66. */
  67. if ($uri === '/' || $uri === '/index.php')
  68. {
  69. $_GET['url'] = '/';
  70. require APP_DIR.DS.WEBROOT_DIR.DS.'index.php';
  71. }
  72. else
  73. {
  74. $elements = explode('/index.php', $uri);
  75. if(!empty($elements[1]))
  76. {
  77. $path = $elements[1];
  78. }
  79. else
  80. {
  81. $path = '/';
  82. }
  83. $_GET['url'] = $path;
  84. require APP_DIR.DS.WEBROOT_DIR.DS.'index.php';
  85. }
  86. ?>