示例#1
0
文件: setup.php 项目: rair/yacs
    $context['text'] .= '<p>' . sprintf(i18n::s('Check the provided %s file to ensure prerequisites are fulfilled.'), '<a href="' . i18n::s('readme.txt') . '">' . i18n::s('readme.txt') . '</a>') . "</p>\n";
    // link to the configuration page
    if (!count($context['error'])) {
        // report on checks
        $context['text'] .= '<h2>' . i18n::s('Ready to start the installation') . '</h2>';
        // splash screen
        $context['text'] .= i18n::s("<p>At the moment no configuration file has been found. You will now have to pass through several steps in order to achieve the setup of your server:</p>\n<ul>\n<li>Configure parameters related to the database.</li>\n<li>Load extension hooks.</li>\n<li>Create tables in the database.</li>\n<li>Add one user profile and populate the database.</li>\n<li>Configure the theme of your server.</li>\n</ul>\nIn normal conditions this will take only some minutes. If you have any problems, please consult <a href=\"http://www.yacs.fr/\">www.yacs.fr</a> for additional support.<p>Thank you for having selected the YACS solution.</p>") . "\n";
        // add a button to start the installation process
        $context['text'] .= '<form method="get" action="control/configure.php" id="main_form">' . "\n" . '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Start the installation process'), NULL, NULL, 'confirmed') . '</p>' . "\n" . '</form>' . "\n";
        // a place holder for cookies activation
        $context['text'] .= '<p id="ask_for_cookies" style="display: none; color: red; text-decoration: blink;"></p>';
        // the script used to check that cookies are activated
        Page::insert_script('document.cookie = \'CookiesEnabled=1\';' . "\n" . 'if((document.cookie == "") && document.getElementById) {' . "\n" . '	$("#ask_for_cookies").update("' . i18n::s('You must enable cookies to manage this server. Change settings of your browser accordingly, then revisit this page afterwards.') . '");' . "\n" . '	$("#ask_for_cookies").style.display = "block";' . "\n" . '	$("#confirmed").disabled = true;' . "\n" . '}' . "\n");
        // purge the scripts/run_once directory on first installation
        include_once $context['path_to_root'] . 'scripts/scripts.php';
        Scripts::purge_run_once();
    }
    // on-going installation
} elseif ($missing) {
    // splash screen
    $context['text'] .= '<p>' . i18n::s('Some configuration files are missing. Please follow the link to complete the installation process.') . "</p>\n";
    // to the control panel
    $context['text'] .= '<p><a href="control/">' . i18n::s('Control Panel') . "</a></p>\n";
    // end of the installation
} elseif (!file_exists('parameters/switch.on') && !file_exists('parameters/switch.off')) {
    // create the switch
    $content = '---------------------------------------------' . "\n" . 'YACS will process requests if this file is named switch.on,' . "\n" . 'and will redirect everything to control/closed.php if its name is changed to switch.off.' . "\n" . "\n" . 'Associates can use the script control/switch.php to stop and restart remotely.' . "\n" . '---------------------------------------------' . "\n";
    if (!Safe::file_put_contents('parameters/switch.on', $content)) {
        // not enough rights to write the file
        Logger::error(i18n::s('ERROR: YACS cannot create the file parameters/switch.on to activate the server.'));
        // allow for a manual update