/** * Declare this on extensions to set the allowed IPs or allowed users to see the debug prints * @return boolean true if allowed false if not * @since ADD MVC 0.0 */ static function current_user_allowed() { return add::is_developer(); }
/** * Sets and return or return an environment status * * @since ADD MVC 0.8 */ public static function environment_status($new_status = null) { /** * * @see http://code.google.com/p/add-mvc-framework/issues/detail?id=33 */ if (!add::is_developer()) { if (add::$environment_status != 'live' || isset($new_status) && $new_status != 'live') { $new_status = 'live'; } } if ($new_status) { if (is_string($new_status)) { if ($new_status === 'development') { if (add::is_developer()) { add::$environment_status = $new_status; } else { add::$environment_status = "live"; } } else { if ($new_status === 'live') { add::$environment_status = 'live'; } else { throw new e_developer("Invalid environment_status: {$new_status}"); } } } else { if ($new_status !== true) { throw new e_developer("Invalid new environment status", $new_status); } } /** * No errors if live * * @since ADD MVC 0.7.2 */ if (add::is_live()) { error_reporting(0); ini_set('display_errors', 0); add::$handle_shutdown = false; } else { error_reporting(E_ALL); ini_set('display_errors', 1); /** * When development, record the time spent on script execution * * @since ADD MVC 0.7.2 */ if (add::is_development()) { add::$handle_shutdown = true; if (!isset($GLOBALS['add_mvc_root_timer'])) { $GLOBALS['add_mvc_root_timer'] = add_development_timer::start("Framework Configuration"); } add::config()->root_timer = $GLOBALS['add_mvc_root_timer']; } } } return add::$environment_status; }
/** * Sets and return or return an environment status * * @since ADD MVC 0.8 */ public static function environment_status($new_status = null) { if ($new_status) { if (is_string($new_status)) { if ($new_status === 'development') { if (add::is_developer()) { add::$environment_status = $new_status; } else { add::$environment_status = "live"; } } else { if ($new_status === 'live') { add::$environment_status = 'live'; } else { throw new e_developer("Invalid environment_status: {$new_status}"); } } } /** * No errors if live * * @since ADD MVC 0.7.2 */ if (add::is_live()) { error_reporting(0); add::$handle_shutdown = false; } else { error_reporting(E_ALL); /** * When development, record the time spent on script execution * * @since ADD MVC 0.7.2 */ if (add::is_development()) { add::$handle_shutdown = true; if (!isset($GLOBALS['add_mvc_root_timer'])) { $GLOBALS['add_mvc_root_timer'] = add_development_timer::start("Framework Configuration"); } add::config()->root_timer = $GLOBALS['add_mvc_root_timer']; } } } return add::$environment_status; }
<?php require 'config.php'; #echo "ADD DIR: ".$C->add_dir; require $C->add_dir . '/init.php'; #date_default_timezone_set(add::config()->default_timezone); if (add::config()->debug_sql && add::is_development() && add::is_developer()) { locust_mule_db::singleton()->debug = true; }