00001 <?php 00025 // Get config instance 00026 $cfg = FrameworkConfiguration::getInstance(); 00027 00028 // Include the class loader function 00029 require(sprintf("%sinc/loader/class_ClassLoader.php", $cfg->readConfig('base_path'))); 00030 00031 // Does the user has an application specified? 00032 if (!empty($_GET['app'])) { 00033 // Set the application from string 00034 $application = (string) $_GET['app']; 00035 } elseif (!empty($_SERVER['argv'][1])) { 00036 // Set the application from string 00037 $application = (string) $_SERVER['argv'][1]; 00038 $app = explode('=', trim($application)); 00039 if ($app[0] == 'app') { 00040 // Application is valid! 00041 $application = trim($app[1]); 00042 } else { 00043 // Invalid entry found, first must be "app"! 00044 $application = $cfg->readConfig('default_application'); 00045 } 00046 } else { 00047 // Set the "application selector" application 00048 $application = $cfg->readConfig('default_application'); 00049 } 00050 00051 // Secure it, by keeping out tags 00052 $application = htmlentities(strip_tags($application), ENT_QUOTES); 00053 00054 // Secure it a little more with a reg.exp. 00055 $application = preg_replace('/([^a-z0-9_-])+/i', "", $application); 00056 00057 // Set the application name for later usage 00058 $cfg->setConfigEntry('app_name', $application); 00059 00066 function __autoload ($className) { 00067 // Try to include this class 00068 ClassLoader::getInstance()->includeClass($className); 00069 } 00070 00074 if (is_dir(sprintf("%sdevel", $cfg->readConfig('base_path')))) { 00078 ClassLoader::getInstance()->loadClasses('devel'); 00079 } 00080 00081 // Shall we include additional configs where you can configure some things? Then 00082 // Load matching config 00083 ClassLoader::getInstance()->loadExtraConfigs(); 00084 00085 // [EOF] 00086 ?>
1.5.6