function __autoload($class_name) { $class_name = strtolower($class_name); $path = PRIVATE_PATH . "/{$class_name}.class.php"; if (file_exists($path)) { require_once $path; } else { terminate_script("The file {$class_name}.class.php could not be found."); } }
<?php defined('BASEPATH') or terminate_script('Direct access to constants denied'); /* |-------------------------------------------------------------------------- | Display Debug backtrace |-------------------------------------------------------------------------- | | If set to TRUE, a backtrace will be displayed along with php errors. If | error_reporting is disabled, the backtrace will not display, regardless | of this setting | */ defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', TRUE); /* |-------------------------------------------------------------------------- | File and Directory Modes |-------------------------------------------------------------------------- | | These prefs are used when checking and setting modes when working | with the file system. The defaults are fine on servers with proper | security, but you may wish (or even need) to change the values in | certain environments (Apache running a separate process for each | user, PHP under CGI with Apache suEXEC, etc.). Octal values should | always be used to set the mode correctly. | */ defined('FILE_READ_MODE') or define('FILE_READ_MODE', 0644); defined('FILE_WRITE_MODE') or define('FILE_WRITE_MODE', 0666); defined('DIR_READ_MODE') or define('DIR_READ_MODE', 0755); defined('DIR_WRITE_MODE') or define('DIR_WRITE_MODE', 0755);
private function confirm_query($result, $sql) { if (!$result) { terminate_script("Database query failed: " . $sql); } }
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 * @filesource */ defined('BASEPATH') or terminate_script('Direct access to codeigniter denied'); /** * System Initialization File * * Loads the base classes and executes the request. * * @package CodeIgniter * @subpackage CodeIgniter * @category Front-controller * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/ */ /** * CodeIgniter Version * * @var string
if (($_temp = realpath($application_folder)) !== FALSE) { $application_folder = $_temp; } define('APPPATH', $application_folder . DIRECTORY_SEPARATOR); } else { if (!is_dir(BASEPATH . $application_folder . DIRECTORY_SEPARATOR)) { terminate_script('Your application folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF); } define('APPPATH', BASEPATH . $application_folder . DIRECTORY_SEPARATOR); } // The path to the "views" folder if (!is_dir($view_folder)) { if (!empty($view_folder) && is_dir(APPPATH . $view_folder . DIRECTORY_SEPARATOR)) { $view_folder = APPPATH . $view_folder; } elseif (!is_dir(APPPATH . 'views' . DIRECTORY_SEPARATOR)) { terminate_script('Your view folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF); } else { $view_folder = APPPATH . 'views'; } } if (($_temp = realpath($view_folder)) !== FALSE) { $view_folder = $_temp . DIRECTORY_SEPARATOR; } else { $view_folder = rtrim($view_folder, '/\\') . DIRECTORY_SEPARATOR; } define('VIEWPATH', $view_folder); /* * -------------------------------------------------------------------- * LOAD THE BOOTSTRAP FILE * -------------------------------------------------------------------- *
function terminate($message, $status_code = 500) { $status_code = abs($status_code); if ($status_code == 500) { terminate_script($message); } log_message('error', $message); $_error =& load_class('Exceptions', 'core'); $_error->terminate($status_code); }