* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
changeDataInLocalConfigurationFile('SITE-KEY', "setConfigEntry('SITE_KEY', '", "');", generatePassword(50), 0);
// Script is now installed
- changeDataInLocalConfigurationFile('INSTALLED', "setConfigEntry('MAILER_INSTALLED', '", "');", 'Y', 0);
+ return changeDataInLocalConfigurationFile('INSTALLED', "setConfigEntry('MAILER_INSTALLED', '", "');", 'Y', 0);
}
// Adds a given template with content to install output stream
} // END - if
// Then call it back
- $isValid = (bool) call_user_func($callbackName, trim($value));
+ $isValid = (bool) call_user_func($callbackName, $value);
// Is it not valid?
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',value=' . $value . ',isValid=' . intval($isValid));
$GLOBALS['installer_overview'][$group][$key] = $value;
}
+//-----------------------------------------------------------------------------
+// Template call-back functions
+//-----------------------------------------------------------------------------
+
+// ----------------- Extensions -----------------
+
+// Generates (and returns) a table from all extensions
+function generateInstallerExtensionTable () {
+ // Generate extension list
+ $extensions = loadAllExtensionsByTemplate();
+
+ // "Walk" through all
+ $OUT = '';
+ foreach ($extensions as $extension) {
+ // Remove prefix + suffix
+ $ext_name = substr(basename($extension), 4, -4);
+
+ // Is the extension not in development and not admintheme* ?
+ if ((loadExtension($ext_name, 'test', '0.0.0', TRUE)) && (isExtensionProductive($ext_name)) && (substr($ext_name, 0, 10) != 'admintheme')) {
+ // Default is not disabled
+ $disabled = '';
+ if ($ext_name == 'sql_patches') {
+ // Always keep this enabled
+ $disabled = ' disabled="disabled"';
+ } // END - if
+
+ // Initialize content array
+ $content = array(
+ 'ext_name' => $ext_name,
+ 'ext_version' => getExtensionVersion($ext_name),
+ 'checked' => getExtensionSelectedFromSession($ext_name, 'extensions'),
+ 'disabled' => $disabled,
+ 'description' => loadTemplate('ext_' . $ext_name, TRUE),
+ );
+
+ // Load row template
+ $OUT .= loadTemplate('install_list_extensions_row', TRUE, $content);
+ } // END - if
+ } // END - foreach
+
+ // Load main template
+ return loadTemplate('install_list_extensions', TRUE, $OUT);
+}
+
//-----------------------------------------------------------------------------
// Call-back functions to check validity
//-----------------------------------------------------------------------------
// ----------------- Other configuration -----------------
+// ----------------- Extensions -----------------
+
+// Call-back function to check 'sel' (array!)
+function isInstallerSelValid ($value) {
+ // $value is not an array, is really bad.
+ if (!is_array($value)) {
+ // Is no array
+ reportBug(__FUNCTION__, __LINE__, 'sel,value[]=' . gettype($value) . '!=array');
+ } // END - if
+
+ // Add always missing ext-sql_patches
+ $value['sql_patches'] = '1';
+
+ // Default is fine
+ $isValid = TRUE;
+
+ // "Walk" through all extensions
+ foreach ($value as $ext_name => $sel) {
+ // Is this extension choosen?
+ if ($sel != '1') {
+ // Skip this
+ continue;
+ } // END - if
+
+ // Can it be loaded?
+ $isValid = (($isValid) && (loadExtension($ext_name, 'test', '0.0.0', TRUE)));
+ } // END - foreach
+
+ // Remove 'sel' from POST data as it cannot be saved
+ unsetPostRequestElement('sel');
+
+ // Save it in session (sorry to do that here :( )
+ setSession('extensions', implode(':', array_keys($value)));
+
+ // Return result
+ return $isValid;
+}
+
//-----------------------------------------------------------------------------
// Call-back functions to post-check validity
//-----------------------------------------------------------------------------
return FALSE;
} // END - if
+ // Remove any previous flag
+ unsetSqlLinkUp(__FUNCTION__, __LINE__);
+
// Try to connect to the database
- $linkResource = SQL_CONNECT(postRequestElement('mysql_host'), postRequestElement('mysql_login'), postRequestElement('mysql_password1'), __FUNCTION__, __LINE__);
+ sqlConnectToDatabase(postRequestElement('mysql_host'), postRequestElement('mysql_login'), postRequestElement('mysql_password1'), __FUNCTION__, __LINE__);
// Is the link up
- if (!is_resource($linkResource)) {
+ if (!isSqlLinkUp()) {
// 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');
} // END - if
// Then attempt to select the database
- if (!SQL_SELECT_DB(postRequestElement('mysql_dbase'), __FUNCTION__, __LINE__)) {
+ if (!sqlSelectDatabase(postRequestElement('mysql_dbase'), __FUNCTION__, __LINE__)) {
// Could not find database
$GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_SELECT_FAILED--}';
array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_dbase');
// Disconnect here, we don't need idle database connections laying around
- SQL_CLOSE(__FUNCTION__, __LINE__);
+ sqlCloseLink(__FUNCTION__, __LINE__);
// Abort here
return FALSE;
array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_engine');
// Disconnect here, we don't need idle database connections laying around
- SQL_CLOSE(__FUNCTION__, __LINE__);
+ sqlCloseLink(__FUNCTION__, __LINE__);
// Abort here
return FALSE;
array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_engine');
// Disconnect here, we don't need idle database connections laying around
- SQL_CLOSE(__FUNCTION__, __LINE__);
+ sqlCloseLink(__FUNCTION__, __LINE__);
// Abort here
return FALSE;
array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_engine');
// Disconnect here, we don't need idle database connections laying around
- SQL_CLOSE(__FUNCTION__, __LINE__);
+ sqlCloseLink(__FUNCTION__, __LINE__);
// Abort here
return FALSE;
$isValid = (count($tables) == $missingTables);
// Disconnect here, we don't need idle database connections laying around
- SQL_CLOSE(__FUNCTION__, __LINE__);
+ sqlCloseLink(__FUNCTION__, __LINE__);
// If the status is true, disconnect the database
if ($isValid === FALSE) {
// Wrapper to import given installation SQL dump
function importInstallSqlDump ($dumpName) {
// Import the file
- importSqlDump('install', $dumpName);
+ importSqlDump('install', $dumpName, 'install');
}
// [EOF]