/** * Configures the shared variables in Detector so that they can be used in functions that might not need to run Detector::build(); * * @return {Boolean} the result of checking the current user agent string against a list of bots */ private static function configure() { // set-up the configuration options for the system if (!($config = @parse_ini_file(__DIR__ . "/config/config.ini"))) { // config.ini didn't exist so attempt to create it using the default file if (!@copy(__DIR__ . "/config/config.ini.default", __DIR__ . "/config/config.ini")) { print "Please make sure config.ini.default exists before trying to have Detector build the config.ini file automagically."; exit; } else { $config = @parse_ini_file(__DIR__ . "/config/config.ini"); } } // populate some standard variables out of the config foreach ($config as $key => $value) { self::${$key} = $value; } // populate some standard variables based on the user agent string self::$ua = strip_tags($_SERVER["HTTP_USER_AGENT"]); self::$accept = strip_tags($_SERVER["HTTP_ACCEPT"]); self::$uaHash = md5(self::$ua); self::$sessionID = md5(self::$ua . "-session-" . self::$coreVersion . "-" . self::$extendedVersion); self::$cookieID = md5(self::$ua . "-cookie-" . self::$coreVersion . "-" . self::$extendedVersion); }