';
foreach (explode(':', postRequestElement('elements')) as $element) {
// Add row
$OUT .= '
{--INSTALLER_CHANGED_ELEMENT_' . strtoupper($element) . '--}';
} // END - foreach
$OUT .= '';
// Prepare content
$content = array(
'out' => $OUT,
'button' => postRequestElement('button'),
'message' => '{--INSTALLER_TAB_NAVIGATION_' . strtoupper(postRequestElement('button')) . '_LINK--}',
);
if (in_array(postRequestElement('button'), array('previous', 'next'))) {
// Load 'prefixed' template
setAjaxReplyContent(loadTemplate('install_warning_' . postRequestElement('button'), TRUE, $content));
} else {
// Load 'tab' template
setAjaxReplyContent(loadTemplate('install_warning_tab', TRUE, $content));
}
// All okay if we reach this point
setHttpStatus('200 OK');
}
// Process installer AJAC call for saving changes
function doAjaxInstallerSaveChanges () {
// 'tab' must always be set to create a post-check-callback
if (!isPostRequestElementSet('tab')) {
// This shall not happen
reportBug(__FUNCTION__, __LINE__, 'The JavaScript did not send "tab" which is fatal.');
} // END - if
// Save the tab for pre-"filtering"
$currentTab = postRequestElement('tab');
// Remove some elements which should not be saved
foreach (array('do', 'level') as $removedElement) {
// Remove this element from POST data
unsetPostRequestElement($removedElement);
} // END - foreach
// Default is failed save attempt (e.g. nothing to save)
$saveStatus = array(
'status' => 'failed',
'message' => '{--INSTALLER_SAVE_CHANGES_FAILED--}',
// Don't set this to false, or else it will be returned as 'failed' but is saved
'is_saved' => TRUE,
'failed_fields' => array()
);
// Init overall status
$isAllSaved = TRUE;
// Now set all remaining data in session
foreach (postRequestArray() as $key => $value) {
// Set it, if it is valid, else it will be added to $saveStatus (call-by-reference)
$saveStatus['is_saved'] = (
// Is the data valid?
(isInstallerDataValid($saveStatus, $key, $value))
&&
// And can it be stored in session?
(setSession($key, $value))
);
// Save the overall status for below final check
$isAllSaved = (($isAllSaved === TRUE) && ($saveStatus['is_saved'] === TRUE));
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',value=' . $value . ',is_saved=' . intval($saveStatus['is_saved']) . ',isAllSaved=' . intval($isAllSaved));
} // END - foreach
// 'is_saved' is still true?
if ($isAllSaved === TRUE) {
// Set 'done' and message
$saveStatus['status'] = 'done';
$saveStatus['message'] = '{--INSTALLER_SAVE_CHANGES_DONE--}';
// Then do the post-check
doInstallerPostCheck($currentTab, $saveStatus);
} // END - if
// Output the status array for JSON reply
setAjaxReplyContent(json_encode($saveStatus, JSON_FORCE_OBJECT));
// All okay if we reach this point
setHttpStatus('200 OK');
}
// Prepare AJAX request 'welcome'
function doAjaxPrepareInstallerWelcome () {
// Kept empty to prevent logfile entry
}
// Prepare AJAX request 'base_data'
function doAjaxPrepareInstallerBaseData () {
// Is 'base_path' not set?
if (!isSessionVariableSet('base_path')) {
// Then set it from PATH
setSession('base_path', getPath());
} // END - if
// Is 'base_url' not set?
if (!isSessionVariableSet('base_url')) {
// Then set it from URL
setSession('base_url', getUrl());
} // END - if
// Is 'main_title' not set?
if (!isSessionVariableSet('main_title')) {
// Then set it from default main title
setSession('main_title', '{--DEFAULT_MAIN_TITLE--}');
} // END - if
// Is 'slogan' not set?
if (!isSessionVariableSet('slogan')) {
// Then set it from default slogan
setSession('slogan', '{--DEFAULT_SLOGAN--}');
} // END - if
// Is 'webmaster' not set?
if (!isSessionVariableSet('webmaster')) {
// Then set it from default webmaster email address
setSession('webmaster', '{--DEFAULT_WEBMASTER--}');
} // END - if
}
// Prepare AJAX request 'database_config'
function doAjaxPrepareInstallerDatabaseConfig () {
// Is 'mysql_host' not set?
if (!isSessionVariableSet('mysql_host')) {
// Then set it directly
setSession('mysql_host', 'localhost');
} // END - if
// Is 'mysql_dbase' not set?
if (!isSessionVariableSet('mysql_dbase')) {
// Then set it directly
setSession('mysql_dbase', 'your_database');
} // END - if
// Is 'mysql_prefix' not set?
if (!isSessionVariableSet('mysql_prefix')) {
// Then set it directly
setSession('mysql_prefix', 'mailer');
} // END - if
// Is 'mysql_login' not set?
if (!isSessionVariableSet('mysql_login')) {
// Then set it directly
setSession('mysql_login', 'your_login');
} // END - if
// Is 'mysql_dbase' not set?
if (!isSessionVariableSet('mysql_pass1')) {
// Then set it directly
setSession('mysql_pass1', '');
} // END - if
// Is 'mysql_pass2' not set?
if (!isSessionVariableSet('mysql_pass2')) {
// Then set it directly
setSession('mysql_pass2', '');
} // END - if
// Is 'mysql_type' not set?
if (!isSessionVariableSet('mysql_type')) {
// Then set it directly
setSession('mysql_type', 'MyISAM');
} // END - if
}
// Prepare AJAX request 'smtp_config'
function doAjaxPrepareInstallerSmtpConfig () {
// Kept empty to prevent logfile entry because SMTP settings are optional
}
// Prepare AJAX request 'other_config'
function doAjaxPrepareInstallerOtherConfig () {
// Is 'output_mode' not set?
if (!isSessionVariableSet('output_mode')) {
// Then set it directly
setSession('output_mode', 'render');
} // END - if
// Is 'warn_no_pass' not set?
if (!isSessionVariableSet('warn_no_pass')) {
// Then set it directly
setSession('warn_no_pass', 'Y');
} // END - if
// Is 'write_footer' not set?
if (!isSessionVariableSet('write_footer')) {
// Then set it directly
setSession('write_footer', 'Y');
} // END - if
// Is 'enable_backlink' not set?
if (!isSessionVariableSet('enable_backlink')) {
// Then set it directly
setSession('enable_backlink', 'Y');
} // END - if
}
// Prepare AJAX request 'overview'
function doAjaxPrepareInstallerOverview () {
// 'tab' must always be set to create a post-check-callback
if (!isPostRequestElementSet('tab')) {
// This shall not happen
reportBug(__FUNCTION__, __LINE__, 'The JavaScript did not send "tab" which is fatal.');
} // END - if
// Save the tab for pre-"filtering"
$currentTab = postRequestElement('tab');
// Default is failed save attempt (e.g. nothing to save)
$verificationStatus = array(
// Status code, can be 'failed' or 'done'
'status' => 'failed',
// Status message (e.g. for output)
'message' => '{--INSTALLER_OVERVIEW_FINAL_CHECK_FAILED--}',
// Don't set this to false, or else it will be returned as 'failed' but is saved
'is_valid' => TRUE,
// Failed fields
'failed_fields' => array()
);
// Init overall status and final output
$isAllValid = TRUE;
$output = '';
// Check all data in session
foreach (getSessionArray() as $key => $value) {
// Skip 'mailer_theme', 'tab' and 'installer'
if (in_array($key, array('mailer_theme', 'tab', 'installer'))) {
// Skip this
continue;
} // END - if
// Is the data valid?
$verificationStatus['is_valid'] = (isInstallerDataValid($verificationStatus, $key, $value));
// Is this step okay?
if ($verificationStatus['is_valid'] === TRUE) {
// Add this key/value pair to a overview group
addKeyValueToInstallerOverviewGroup($key, $value);
} // END - if
// Save the overall status for below final check
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',value=' . $value . ',is_valid=' . intval($verificationStatus['is_valid']) . ',isAllValid=' . intval($isAllValid));
$isAllValid = (($isAllValid === TRUE) && ($verificationStatus['is_valid'] === TRUE));
} // END - foreach
// Is it still true?
if ($isAllValid === TRUE) {
// Set 'done' and message
$verificationStatus['status'] = 'done';
$verificationStatus['message'] = '{--INSTALLER_OVERVIEW_FINAL_CHECK_DONE--}';
// Then do the post-check
doInstallerPostCheck($currentTab, $verificationStatus);
} // END - if
// Is it still valid?
if ($verificationStatus['status'] != 'done') {
// Log message away
logDebugMessage(__FUNCTION__, __LINE__, 'Final check on all stored data failed. message=' . $verificationStatus['message']);
// Output the array for JSON reply
setAjaxReplyContent(json_encode($verificationStatus, JSON_FORCE_OBJECT));
/*
* Something went wrong, this might happen when e.g. the user has tried
* to save invalid database login data but hit reload button on error
* message.
*/
setHttpStatus('500 Internal Server Error');
// Abort here
return;
} // END - if
// Output final rendered content
setAjaxReplyContent($output);
// All okay if we reach this point
setHttpStatus('200 OK');
}
// [EOF]
?>