= MIN_PHP_VERSION) { logMessage(phpversion() . " OK!", true, false); } else { logMessage('TOO OLD VERSION!', true, false); logMessage(' -- Make sure that you install at least PHP 5.4', true, false); exit(); } /** * Checking if all the needed libraries are installed. * - MySQLi * - cURL */ logMessage('Checking for installed MySQLi ... ', false); if (extension_loaded('mysqli')) { logMessage('FOUND!', true, false); } else { logMessage('NOT FOUND!', true, false); logMessage(' -- You don\'t have MySQLi installed, make sure to check: http://www.php.net/manual/en/mysqli.installation.php', true, false); exit(); } logMessage('Checking for installed cURL ... ', false); if (extension_loaded('curl')) { logMessage('FOUND!', true, false); } else { logMessage('NOT FOUND!', true, false); logMessage('You don\'t have cURL installed, make sure to check: http://www.php.net/manual/en/curl.installation.php', true, false); exit(); } /** * Log and echo the given text * * @param string $message * @param bool $eol * @param bool $date */ function logMessage($message, $eol = true, $date = true) { if ($date) { $date = date('d.M y H:i:s'); $message = $date . ' ' . $message; } if ($eol) { $message .= PHP_EOL; } if (defined('LOG_CURRENT_FILE')) { if (!is_writable(dirname(LOG_CURRENT_FILE)) || !file_put_contents(LOG_CURRENT_FILE, $message, FILE_APPEND)) { echo 'Current-Logfile not write-able, please check the File Permissions!'; } } if (!is_writable(dirname(LOG_FILE)) || !file_put_contents(LOG_FILE, $message, FILE_APPEND)) { echo 'Logfile not write-able, please check the File Permissions!'; } echo $message; } // Autoload Function that loads ManiaControl Class Files on Demand spl_autoload_register(function ($className) { $classPath = str_replace('\\', DIRECTORY_SEPARATOR, $className); // Core file $classDirectoryPath = preg_replace('/ManiaControl/', 'core', $classPath, 1); $filePath = ManiaControlDir . $classDirectoryPath . '.php'; if (file_exists($filePath)) { require_once $filePath; return; } // Plugin file $filePath = ManiaControlDir . 'plugins' . DIRECTORY_SEPARATOR . $classPath . '.php'; if (file_exists($filePath)) { include_once $filePath; return; } }); // Start ManiaControl $maniaControl = new \ManiaControl\ManiaControl(); $maniaControl->run();