<?php // Increase the amount of time allowed for this page to run set_time_limit(180); // Three minutes // Installation Header require dirname(ROUTE_SECOND_PATH) . "/includes/install_header.php"; // Connect to database with admin user Database::initRoot(); // Run Global Script require dirname(ROUTE_SECOND_PATH) . "/includes/install_global.php"; // Display the Header require HEADER_PATH; // Display the Page echo ' <h1>Installation: Classes</h1> <h3>Step #1 - Install Core Classes</h3> <p>The core plugins are the plugins that are provided by default in the engine. The core functionality of the system depends on many of these plugins. This step will automatically install them.</p>'; // Loop through each class and install it $configPaths = File_Scan::scanRecursive(SYS_PATH . "/core-classes", "*.config.php"); foreach ($configPaths as $configPath) { // Extract the name of this class $class = str_replace(".config.php", "", basename($configPath)); // Load the Class's Config Class if (!($classConfig = Classes_Meta::getConfig($class, SYS_PATH . "/core-classes"))) { echo '<h4 style="color:red;">' . $class . '</h4> <p><span style="color:red;">The class\'s config class was inaccessible.</span></p>'; } // Install the Class
$dbName = Sanitize::variable(DATABASE_NAME); // Installation Header require dirname(ROUTE_SECOND_PATH) . "/includes/install_header.php"; // Attempt to cheat if (Database::initRoot('mysql')) { Database::exec("CREATE DATABASE IF NOT EXISTS `" . $dbName . '`'); } // Check if the standard user is properly configured after POST values were used if (Database::initialize($dbName)) { Alert::success("DB User", "The database user has access to the `" . $dbName . "` database!"); } else { Alert::error("DB User", "The `" . $dbName . "` database does not exist, or the user does not have access to it."); $userAccess = false; } // Check if the admin user is properly configured after POST values were used if (Database::initRoot($dbName)) { Alert::success("DB Admin", "The administrative database user has access to the `" . $dbName . "` database!"); } else { if ($userAccess) { Alert::error("DB Admin", "The `" . $dbName . "` database exists, but you do not have administrative privileges."); } else { Alert::error("DB Admin", "The `" . $dbName . "` database does not exist, or you do not have administrative privileges."); } } // If everything is successful: if (Validate::pass()) { // Check if the form was submitted (to continue to the next page) if (Form::submitted("install-db-connect")) { header("Location: /install/classes-core"); exit; }