X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Finstall-functions.php;h=8ef45388ab1b3435d1ecbd357766ed548f39c324;hb=0cc73bd7020ca53d7e296b9f5842331fb0d54cb1;hp=40a6ab62805d0fee38de66b4dacd8cdacfd23365;hpb=b622c2d9285f044f49328cbd98efbf2f1a24aa8e;p=mailer.git diff --git a/inc/install-functions.php b/inc/install-functions.php index 40a6ab6280..8ef45388ab 100644 --- a/inc/install-functions.php +++ b/inc/install-functions.php @@ -109,7 +109,7 @@ function doInstallWriteLocalConfigurationFile ($path) { // Adds a given template with content to install output stream function addTemplateToInstallContent ($template, $content = array()) { // Load the template - $out = loadTemplate($template, true, $content); + $out = loadTemplate($template, TRUE, $content); // Add it to output addToInstallContent($out); @@ -135,7 +135,7 @@ function getInstallerContent () { $content = $GLOBALS['install_content']; } else { // Nothing found, this needs fixing - $content = displayMessage('{--INSTALLER_CONTENT_404--}', true); + $content = displayMessage('{--INSTALLER_CONTENT_404--}', TRUE); } // Return content @@ -158,7 +158,7 @@ function readSqlDump ($FQFN) { // Generates the installer menu by simply loading another template function generateInstallerMenu () { // Load installer menu template - $OUT = loadTemplate('install_menu', true); + $OUT = loadTemplate('install_menu', TRUE); // Return loaded content return $OUT; @@ -167,7 +167,7 @@ function generateInstallerMenu () { // Generate the install footer navigation by simply loading another template function generateInstallerFooterNavigation () { // Load installer menu template - $OUT = loadTemplate('install_footer', true); + $OUT = loadTemplate('install_footer', TRUE); // Return loaded content return $OUT; @@ -223,7 +223,7 @@ function isInstallerDataValid (&$saveStatus, $key, $value) { //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Call-back function ' . $callbackName . ' not found. saveStatus[status]=' . $saveStatus['status'] . ', key=' . $key . ', value=' . $value); // All fine (CAREFULL!) - return true; + return TRUE; } // END - if // Then call it back @@ -231,7 +231,7 @@ function isInstallerDataValid (&$saveStatus, $key, $value) { // Is it not valid? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',value=' . $value . ',isValid=' . intval($isValid)); - if ($isValid === false) { + if ($isValid === FALSE) { // Then add it to saveStatus array_push($saveStatus['failed_fields'], $key); } // END - if @@ -269,12 +269,12 @@ function doInstallerPostCheck ($currentTab, &$saveStatus) { $isValid = (bool) call_user_func($callbackName, $currentTab); // Is it not valid? - if (($isValid === false) || (count($GLOBALS['installer_failed_fields'][$currentTab]) > 0)) { + if (($isValid === FALSE) || (count($GLOBALS['installer_failed_fields'][$currentTab]) > 0)) { // Then change status and message $saveStatus['status'] = 'failed'; $saveStatus['message'] = '{%message,INSTALLER_POST_CHECK_' . strtoupper($currentTab) . '_FAILED=' . $GLOBALS['installer_post_error'][$currentTab] . '%}'; - // Do we have failed fields? + // Is there failed fields? if (count($GLOBALS['installer_failed_fields'][$currentTab]) > 0) { // Then merge both $saveStatus['failed_fields'] = merge_array($saveStatus['failed_fields'], $GLOBALS['installer_failed_fields'][$currentTab]); @@ -372,7 +372,7 @@ function isInstallerWebmasterValid ($value) { // Is it a valid email address? (isEmailValid($value)) || - // Or do we have 'localhost/127.0.0.1' as hostname? Then don't check email address (e.g. you@localhost) + // Or is there 'localhost/127.0.0.1' as hostname? Then don't check email address (e.g. you@localhost) (in_array(detectServerName(), array('localhost', '127.0.0.1'))) ); @@ -421,8 +421,8 @@ function isInstallerMysqlTypeValid ($value) { // Call-back function to check if database configuration in POST is valid function isInstallerPostDatabaseConfigValid ($currentTab) { // By default nothing is valid - $isValid = false; - $engineValid = false; + $isValid = FALSE; + $engineValid = FALSE; $missingTables = 0; // Do both passwords match? @@ -430,23 +430,17 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { // Password 1 not set $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_PASSWORD1_EMPTY--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_password1'); - return false; + return FALSE; } elseif ((isPostRequestElementSet('mysql_password1')) && (!isPostRequestElementSet('mysql_password2'))) { // Password 2 not set $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_PASSWORD2_EMPTY--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_password2'); - return false; + return FALSE; } elseif (postRequestElement('mysql_password1') != postRequestElement('mysql_password2')) { // Passwords mismatch $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_PASSWORDS_MISMATCH--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_password1', 'mysql_password2'); - return false; - } // END - if - - // Restore PHP's own error handler - if (!restore_error_handler()) { - // This is fatal - reportBug(__FUNCTION__, __LINE__, 'Could not unregister error handler.'); + return FALSE; } // END - if // Try to connect to the database @@ -454,111 +448,93 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { // Is the link up if (!is_resource($linkResource)) { - // Restore own error handler again - set_error_handler('__errorHandler'); - // Cannot connect to database $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_CONNECT_ERROR--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_login', 'mysql_password1', 'mysql_password2'); - return false; + return FALSE; } // END - if // Then attempt to select the database if (!SQL_SELECT_DB(postRequestElement('mysql_dbase'), __FUNCTION__, __LINE__)) { - // Restore own error handler again - set_error_handler('__errorHandler'); - // Could not find database $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_SELECT_FAILED--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_dbase'); - return false; + return FALSE; } // END - if // Set database name and prefix setConfigEntry('__DB_NAME' , postRequestElement('mysql_dbase')); setConfigEntry('_MYSQL_PREFIX', postRequestElement('mysql_prefix')); - // Restore own error handler again - set_error_handler('__errorHandler'); - // Get an array of all supported engines $engines = getArrayFromSupportedSqlEngines(); // Is this an array? if (!is_array($engines)) { - // Restore own error handler again - set_error_handler('__errorHandler'); - // Something bad happened $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_ENGINES_SQL_ERROR--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_type'); - return false; + return FALSE; } elseif (count($engines) == 0) { - // Restore own error handler again - set_error_handler('__errorHandler'); - // No engine is active $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_NO_ENGINES_ACTIVE--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_type'); - return false; + return FALSE; } // Then check all, if the requested is working foreach ($engines as $engineArray) { // By default the selected engine is not valid - $engineValid = false; + $engineValid = FALSE; // Is the engine there? if (strtolower($engineArray['Engine']) == strtolower(postRequestElement('mysql_type'))) { // Okay, engine is found - $engineValid = true; + $engineValid = TRUE; break; } // END - if } // END - foreach // So, is the engine found? - if ($engineValid === false) { - // Restore own error handler again - set_error_handler('__errorHandler'); - + if ($engineValid === FALSE) { // Requested engine is not active $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_ENGINE_UNSUPPORTED--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_type'); - return false; + return FALSE; } // END - if // Init some known tables $tables = array( // Admins - 'admins' => true, + 'admins' => TRUE, // Admin menu - 'admin_menu' => true, + 'admin_menu' => TRUE, // Categories - 'cats' => true, + 'cats' => TRUE, // Configuration - 'config' => true, + 'config' => TRUE, // Extensions - 'extensions' => true, + 'extensions' => TRUE, // Guest menu - 'guest_menu' => true, + 'guest_menu' => TRUE, // Max receive - 'max_receive' => true, + 'max_receive' => TRUE, // Member menu - 'member_menu' => true, + 'member_menu' => TRUE, // Module registry - 'mod_reg' => true, + 'mod_reg' => TRUE, // Payments - 'payments' => true, + 'payments' => TRUE, // Sending pool - 'pool' => true, + 'pool' => TRUE, // Referral banner - 'refbanner' => true, + 'refbanner' => TRUE, // Referral levels - 'refdepths' => true, + 'refdepths' => TRUE, // Referral system - 'refsystem' => true, + 'refsystem' => TRUE, // Task system - 'task_system' => true, + 'task_system' => TRUE, ); // So check if all tables are not there @@ -567,7 +543,7 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { $tables[$tableName] = ifSqlTableExists($tableName); // Is it (hopefully not) there? - if ($tables[$tableName] === false) { + if ($tables[$tableName] === FALSE) { // This does not exist $missingTables++; } // END - if @@ -579,11 +555,8 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { // Disconnect here, we don't need idle database connections laying around SQL_CLOSE(__FUNCTION__, __LINE__); - // Restore own error handler again - set_error_handler('__errorHandler'); - // If the status is true, disconnect the database - if ($isValid === false) { + if ($isValid === FALSE) { // Still something bad happened (e.g. tables found) $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_IN_USE--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_dbase');