Advertisement
Guest User

utilities.php

a guest
Aug 30th, 2011
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.84 KB | None | 0 0
  1. <?php
  2. /*
  3.    |---------------------------------------------------------------
  4.    | PHP ERROR REPORTING LEVEL
  5.    |---------------------------------------------------------------
  6.    |
  7.    | By default CI runs with error reporting set to ALL.  For security
  8.    | reasons you are encouraged to change this when your site goes live.
  9.    | For more info visit:  http://www.php.net/error_reporting
  10.    |
  11.  */
  12. error_reporting(E_ALL);
  13.  
  14. //This file is used for cron taks... Set no time limit (should not be neeed)
  15. set_time_limit(0);
  16.  
  17. //Make the directory the current working dir
  18. chdir(dirname(__FILE__));
  19.  
  20. /*
  21.    |---------------------------------------------------------------
  22.    | SYSTEM FOLDER NAME
  23.    |---------------------------------------------------------------
  24.    |
  25.    | This variable must contain the name of your "system" folder.
  26.    | Include the path if the folder is not in the same  directory
  27.    | as this file.
  28.    |
  29.    | NO TRAILING SLASH!
  30.    |
  31.  */
  32. $system_folder = "../system";
  33.  
  34. //Emulate a $_SERVER['REQUEST_URI']
  35. $_SERVER['REQUEST_URI'] = '/script/'.$argv[1];
  36.  
  37. for($i=2; $i<$argc; $i++) {
  38.     $_SERVER['REQUEST_URI'] .= '/'.$argv[$i];
  39. }
  40.  
  41. /*
  42.    |---------------------------------------------------------------
  43.    | APPLICATION FOLDER NAME
  44.    |---------------------------------------------------------------
  45.    |
  46.    | If you want this front controller to use a different "application"
  47.    | folder then the default one you can set its name here. The folder
  48.    | can also be renamed or relocated anywhere on your server.
  49.    | For more info please see the user guide:
  50.    | http://codeigniter.com/user_guide/general/managing_apps.html
  51.    |
  52.    |
  53.    | NO TRAILING SLASH!
  54.    |
  55.  */
  56. $application_folder = "application";
  57.  
  58. /*
  59.    |===============================================================
  60.    | END OF USER CONFIGURABLE SETTINGS
  61.    |===============================================================
  62.  */
  63.  
  64.  
  65. /*
  66.    |---------------------------------------------------------------
  67.    | SET THE SERVER PATH
  68.    |---------------------------------------------------------------
  69.    |
  70.    | Let's attempt to determine the full-server path to the "system"
  71.    | folder in order to reduce the possibility of path problems.
  72.    | Note: We only attempt this if the user hasn't specified a
  73.    | full server path.
  74.    |
  75.  */
  76. if (strpos($system_folder, '/') === FALSE)
  77. {
  78.     if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
  79.     {
  80.         $system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
  81.     }
  82. }
  83. else
  84. {
  85.     // Swap directory separators to Unix style for consistency
  86.     $system_folder = str_replace("\\", "/", $system_folder);
  87. }
  88.  
  89. /*
  90.    |---------------------------------------------------------------
  91.    | DEFINE APPLICATION CONSTANTS
  92.    |---------------------------------------------------------------
  93.    |
  94.    | EXT        - The file extension.  Typically ".php"
  95.    | FCPATH - The full server path to THIS file
  96.    | SELF       - The name of THIS file (typically "index.php)
  97.    | BASEPATH   - The full server path to the "system" folder
  98.    | APPPATH    - The full server path to the "application" folder
  99.    |
  100.  */
  101. define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
  102. define('FCPATH', __FILE__);
  103. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  104. define('BASEPATH', $system_folder.'/');
  105.  
  106. if (is_dir($application_folder))
  107. {
  108.     define('APPPATH', $application_folder.'/');
  109. }
  110. else
  111. {
  112.     if ($application_folder == '')
  113.     {
  114.         $application_folder = 'application';
  115.     }
  116.  
  117.     define('APPPATH', BASEPATH.$application_folder.'/');
  118. }
  119.  
  120. /*
  121.    |---------------------------------------------------------------
  122.    | LOAD THE FRONT CONTROLLER
  123.    |---------------------------------------------------------------
  124.    |
  125.    | And away we go...
  126. |
  127. */
  128. require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;
  129.  
  130. /* End of file index.php */
  131. /* Location: ./index.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement