Advertisement
Sparkster

Untitled

Oct 16th, 2013
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /**
  4.  * Nano
  5.  *
  6.  * Just another php framework
  7.  *
  8.  * @package     nano
  9.  * @link        http://madebykieron.co.uk
  10.  * @copyright   http://unlicense.org/
  11.  */
  12.  
  13. /**
  14.  * Check php version
  15.  */
  16. if(version_compare(PHP_VERSION, '5.3.6') < 0) {
  17.     echo 'We need PHP 5.3.6 or higher, you are running ' . PHP_VERSION;
  18.     exit;
  19. }
  20.  
  21. /**
  22.  * Register Globals Fix
  23.  */
  24. if(ini_get('register_globals')) {
  25.     $sg = array($_REQUEST, $_SERVER, $_FILES);
  26.  
  27.     if(isset($_SESSION)) {
  28.         array_unshift($sg, $_SESSION);
  29.     }
  30.  
  31.     foreach($sg as $global) {
  32.         foreach(array_keys($global) as $key) {
  33.             unset(${$key});
  34.         }
  35.     }
  36. }
  37.  
  38. /**
  39.  * Magic Quotes Fix
  40.  */
  41. if(get_magic_quotes_gpc()) {
  42.     $gpc = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
  43.  
  44.     array_walk_recursive($gpc, function(&$value) {
  45.         $value = stripslashes($value);
  46.     });
  47. }
  48.  
  49. /**
  50.  * Include base classes and functions
  51.  */
  52. require PATH . 'system/helpers' . EXT;
  53. require PATH . 'system/error' . EXT;
  54. require PATH . 'system/arr' . EXT;
  55. require PATH . 'system/config' . EXT;
  56. require PATH . 'system/autoloader' . EXT;
  57.  
  58. /**
  59.  * Register the autoloader
  60.  */
  61. spl_autoload_register(array('System\\Autoloader', 'load'));
  62.  
  63. // set the base path to search
  64. System\Autoloader::directory(PATH);
  65.  
  66. // map application aliases to autoloader so we dont
  67. // have to fully specify the class namespaces each time.
  68. System\Autoloader::$aliases = (array) System\Config::aliases();
  69.  
  70. /**
  71.  * Error handling
  72.  */
  73. set_exception_handler(array('System\\Error', 'exception'));
  74. set_error_handler(array('System\\Error', 'native'));
  75. register_shutdown_function(array('System\\Error', 'shutdown'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement