<?php
require_once('../../../config.php');
require_once(FOLDER_RELATIVE_COMMON . 'html.php');
// Check for installation previously completed, allow reconfig if authorized.
if (FLAG_INSTALLED == 'Y') {
require_once(FOLDER_RELATIVE_COMMON . 'authorization.php');
}
$errors = '';
$request = isset($_GET['request']) ? $_GET['request'] : '';
if ($request == 'xml') {
// Default file messages to 'unable to write'.
$privilege_config = '<span class="setup_invalid">unable to write to file</span>';
$privilege_upload = '<span class="setup_invalid">unable to write to file</span>';
// Now check for writability.
if (is_writable(FOLDER_RELATIVE_BASE . 'config.php')) $privilege_config = '<span class="setup_valid">able to write to file</span>';
if (is_writable(FOLDER_RELATIVE_BASE . 'upload')) $privilege_upload = '<span class="setup_valid">able to write to folder</span>';
$misc_organization = ORGANIZATION;
$misc_title_homepage = TITLE_HOMEPAGE;
$misc_title_error = TITLE_ERROR;
$folder_relative_base = FOLDER_RELATIVE_BASE;
$folder_relative_common = FOLDER_RELATIVE_COMMON;
$folder_adodb = FOLDER_ADODB;
$folder_upload = FOLDER_UPLOAD;
$folder_template = FOLDER_TEMPLATE;
$folder_css = FOLDER_CSS;
$folder_javascript = FOLDER_JAVASCRIPT;
$file_template_main = FILE_TEMPLATE_MAIN;
$file_template_page = FILE_TEMPLATE_PAGE;
$file_template_admin = FILE_TEMPLATE_ADMIN;
$file_template_install = FILE_TEMPLATE_INSTALL;
$file_template_error = FILE_TEMPLATE_ERROR;
header('Content-Type: text/xml');
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
$xml .= "<root>\n";
$xml .= " <controls_id>\n";
$xml .= " <record><key>privilege_config</key><value><![CDATA[$privilege_config]]></value></record>\n";
$xml .= " <record><key>privilege_upload</key><value><![CDATA[$privilege_upload]]></value></record>\n";
$xml .= " </controls_id>\n";
$xml .= " <controls_input>\n";
$xml .= " <record><key>misc_organization</key><value><![CDATA[$misc_organization]]></value></record>\n";
$xml .= " <record><key>misc_title_homepage</key><value><![CDATA[$misc_title_homepage]]></value></record>\n";
$xml .= " <record><key>misc_title_error</key><value><![CDATA[$misc_title_error]]></value></record>\n";
$xml .= " <record><key>folder_relative_base</key><value><![CDATA[$folder_relative_base]]></value></record>\n";
$xml .= " <record><key>folder_relative_common</key><value><![CDATA[$folder_relative_common]]></value></record>\n";
$xml .= " <record><key>folder_adodb</key><value><![CDATA[$FOLDER_ADODB]]></value></record>\n";
$xml .= " <record><key>folder_upload</key><value><![CDATA[$folder_upload]]></value></record>\n";
$xml .= " <record><key>folder_template</key><value><![CDATA[$folder_template]]></value></record>\n";
$xml .= " <record><key>folder_css</key><value><![CDATA[$folder_css]]></value></record>\n";
$xml .= " <record><key>folder_javascript</key><value><![CDATA[$folder_javascript]]></value></record>\n";
$xml .= " <record><key>file_template_main</key><value><![CDATA[$file_template_main]]></value></record>\n";
$xml .= " <record><key>file_template_page</key><value><![CDATA[$file_template_page]]></value></record>\n";
$xml .= " <record><key>file_template_admin</key><value><![CDATA[$file_template_admin]]></value></record>\n";
$xml .= " <record><key>file_template_install</key><value><![CDATA[$file_template_install]]></value></record>\n";
$xml .= " <record><key>file_template_error</key><value><![CDATA[$file_template_error]]></value></record>\n";
$xml .= " </controls_input>\n";
$xml .= "</root>\n";
echo $xml;
exit;
}
// Write config changes to config.php then redirect back.
// The redirect is necessary to get a fresh read of config.php at the top of this script.
if ($request == 'configure') {
require_once(FOLDER_RELATIVE_COMMON . 'filesystem.php');
require_once(FOLDER_RELATIVE_COMMON . 'configurator.php');
writeConfigurationChangeToDisk();
header('location:install_filesystem.php');
exit;
}
require_once(FOLDER_RELATIVE_COMMON . 'builder-install.php');
$header = '<script language="Javascript" type="text/javascript" src="install_filesystem.js"></script>' . "\n";
$onload = 'initializePage();';
$title = 'Filesystem';
$content = fileRead('install_filesystem.html');
$success = 2;
$page = buildInstallPage($header, $onload, $title, $content, $success);
echo $page;
?>