<?php include 'config.php'; function autoload($name) { $name = str_replace('\\', '/', $name); $class_path = dirname(__FILE__) . '/include/classes/'; static $class_extension = '.php'; if (file_exists($class_path . $name . $class_extension)) { require_once $class_path . $name . $class_extension; } } spl_autoload_register('autoload'); AutoConfig::addFile('autodiscover.xml', 'ConfigOutlook'); AutoConfig::addFile('mail/config-v1.1.xml', 'ConfigMozilla'); AutoConfig::setDefault('autodiscover.xml'); $config = AutoConfig::get($_GET['file']); $config->response();
private function processTemplateContent($template) { ob_start(); eval($template); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; } public function printUsage($errorMessage) { echo "AutoConfig: {$errorMessage}\n\n"; echo "AutoConfig: Processes a template file (or directory) using data from a properties file to\n" . "produce a new file (or set of files).\n\n"; echo "Usage: AutoConfig.php [options]\n"; echo "Where options are:\n"; echo " -p props_file : Properties file to use.\n"; echo " -tf template_file : Template file. Cannot be used with the -td option.\n"; echo " -td template_dir : Template directory. Cannot be used with the -tf option.\n"; echo " -o output_dir : Output directory.\n"; echo " -r 0755 : permission on generated files in octal format .\n"; return false; } } // Main $autoconfig = new AutoConfig(); if ($autoconfig->parseArgs($argv)) { $autoconfig->process(); exit(0); // For some reason, under ubuntu exit code is 255 without this line... } else { exit(1); }
public static function setDefault($file) { self::$_default = $file; }