X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Finstall-functions.php;h=9b4b42403f9c76b20cc55ca340ddf57abe6c10ad;hb=refs%2Fheads%2Fserver-0.2.1-FINAL%2Fshipsimu-org;hp=9fd326f7e9dc5d059323845269fff44604aeb706;hpb=8729e9b2566751c19f225e86daa86730f25c49b0;p=mailer.git diff --git a/inc/install-functions.php b/inc/install-functions.php index 9fd326f7e9..9b4b42403f 100644 --- a/inc/install-functions.php +++ b/inc/install-functions.php @@ -11,7 +11,7 @@ * Kurzbeschreibung : Funktionen fuer die Installationsroutine * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * Copyright (c) 2009 - 2016 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -76,6 +76,70 @@ function initInstaller () { setConfigEntry('verbose_sql' , 'N'); } +// Installer bootstrap +function doInstallerBootstrap () { + // Default output is 'direct' for HTML output + setConfigEntry('OUTPUT_MODE', 'direct'); + + // This hack prevents a backtrace in CSS output + if (isCssOutputMode()) { + // Problem with config so set output mode + setConfigEntry('OUTPUT_MODE', 'render'); + } // END - if + + // Debug message + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isAjaxOutputMode()=' . intval(isAjaxOutputMode()) . ',isSessionVariableSet(database_extension)=' . intval(isSessionVariableSet('database_extension'))); + + // Is it AJAX call and database_extension is set? + if ((isAjaxOutputMode()) && (isSessionVariableSet('database_extension'))) { + // Then take it from session + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Setting _DB_TYPE from session;database_extension=' . getSession('database_extension')); + setConfigEntry('_DB_TYPE', getSession('database_extension')); + } elseif (isPhpExtensionLoaded('mysqli')) { + // Debug message + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Setting _DB_TYPE to MySQLi ...'); + + // Set (old) default + setConfigEntry('_DB_TYPE', 'mysqli'); + } elseif (isPhpExtensionLoaded('mysql')) { + // Debug message + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Setting _DB_TYPE to default (mysql) ...'); + + // Set (old) default + setConfigEntry('_DB_TYPE', 'mysql'); + } else { + // Opps, cannot detect it? + reportBug(__FUNCTION__, __LINE__, 'Cannot detect mysql/mysqli. Please fix your setup.'); + } + + // Set link as down + unsetSqlLinkUp(__FUNCTION__, __LINE__); + + // Load database layer here + loadIncludeOnce('inc/db/lib.php'); + + // Init message system + initMessages(); + + // Init session + initSession(); + + // Include more + foreach (array('databases', 'install-functions', 'load_config', 'load_cache') as $inc) { + // Load include file + loadIncludeOnce('inc/' . $inc . '.php'); + } // END - foreach + + // Init installer + initInstaller(); + + // Check whether we are in installation routine + if ((!isInstalling()) && (!isCssOutputMode()) && (!isRawOutputMode())) { + // Redirect to the URL + redirectToUrl('install.php'); + } // END - if +} + // Write the local config-local.php file from "template" function doInstallWriteLocalConfigurationFile ($path, $url, $title, $slogan, $email, $noPassword, $writeFooter, $backLink, $databaseHost, $databaseName, $databaseLogin, $databasePassword, $databasePrefix, $tableType, $databaseExtension, $smtpHost, $smtpUser, $smtpPassword) { // Copy the config template and verify it @@ -474,7 +538,7 @@ function isInstallerBaseUrlValid ($value) { ($value == getUrl()) || ( // Starts with http:// or https:// ? - ((substr($value, 0, 7) == 'http://') || (substr($value, 0, 8) == 'https://')) + (isFullQualifiedUrl($value)) && // Has no trailing slash? (substr($value, -1, 1) != '/') @@ -563,6 +627,15 @@ function isInstallerMysqlEngineValid ($value) { return $isValid; } +// Call-back function to check validity of 'database_extension' +function isInstallerDatabaseExtensionValid ($value) { + // This value must be 'mysql' or 'mysqli' + $isValid = in_array($value, array('mysql', 'mysqli')); + + // Return it + return $isValid; +} + // Call-back function to check validity of 'mysql_dbase' function isInstallerMysqlDbaseValid ($value) { // This value must not be empty