示例#1
0
文件: Settings.php 项目: kingsj/core
 /**
  * Get safe mode access key
  *
  * @return string
  */
 public function getSafeModeKey()
 {
     return \Includes\SafeMode::getAccessKey();
 }
示例#2
0
/**
 * Do some final actions
 *
 * @param array  $params     Database access data and other parameters
 * @param bool   $silentMode Do not display any output during installing
 *
 * @return bool
 */
function doFinishInstallation(&$params, $silentMode = false)
{
    global $lcSettings, $error;
    $result = true;
    // Update config settings
    update_config_settings($params);
    generate_safe_mode_key();
    // Save authcode for the further install runs
    $authcode = save_authcode($params);
    $install_name = rename_install_script();
    if ($install_name) {
        // Text for email notification
        $install_rename_email = xtr('script_renamed_text', array(':newname' => $install_name, ':host' => $params['xlite_http_host'], ':webdir' => $params['xlite_web_dir']));
        // Text for confirmation web page
        $install_rename = xtr('script_renamed_text_html', array(':newname' => $install_name));
    } else {
        $install_rename = xtr('script_cannot_be_renamed_text');
        $install_rename_email = strip_tags($install_rename);
    }
    // Prepare files permissions recommendation text
    $perms = '';
    if (!LC_OS_IS_WIN) {
        $_perms = array();
        if (@is_writable(LC_DIR_ROOT)) {
            $_perms[] = 'chmod 755 ' . LC_DIR_ROOT;
        }
        if (@is_writable(LC_DIR_CONFIG)) {
            $_perms[] = 'chmod 755 ' . LC_DIR_CONFIG;
        }
        if (@is_writable(LC_DIR_CONFIG . constant('LC_CONFIG_FILE'))) {
            $_perms[] = "chmod 644 " . LC_DIR_CONFIG . constant('LC_CONFIG_FILE');
        }
        if (@is_writable(LC_DIR_ROOT . '.htaccess')) {
            $_perms[] = "chmod 644 " . LC_DIR_ROOT . '.htaccess';
        }
        if (!empty($_perms)) {
            $perms = implode("<br />\n", $_perms);
            $perms = xtr('correct_permissions_text', array(':perms' => $perms));
        }
    }
    // Prepare email notification text
    $perms_no_tags = strip_tags($perms);
    $message = xtr('congratulations_text', array(':host' => $params['xlite_http_host'], ':webdir' => $params['xlite_web_dir'], ':login' => $params['login'], ':password' => $params['password'], ':perms' => $perms_no_tags, ':renametext' => $install_rename_email, ':authcode' => $authcode, ':safekey' => \Includes\SafeMode::getAccessKey()));
    // Send email notification to the admin account email
    @mail($params["login"], "X-Cart installation complete", $message, "From: \"X-Cart software\" <" . $params["login"] . ">\r\n" . "X-Mailer: PHP");
    if (!$silentMode) {
        ?>

<script type="text/javascript">
  document.cookie = 'xcInstallComplete=1';
  document.cookie = 'xcInstallStarted=; expires=-1';
  document.cookie = 'passed_steps=; expires=-1';
</script>

<br />
<br />

<div class="field-label"><?php 
        echo xtr('X-Cart software has been successfully installed and is now available at the following URLs:');
        ?>
</div>
<img src="//www.x-cart.com/img/spacer2.gif" width="1" height="1" alt="" />

<br />

<a href="cart.php" class="final-link" target="_blank"><?php 
        echo xtr('Customer zone (front-end)');
        ?>
: cart.php</a>

<br />
<br />

<a href="admin.php" class="final-link" target="_blank"><?php 
        echo xtr('Administrator zone (backoffice)');
        ?>
: admin.php</a>

<br />
<br />
<br />

<?php 
        echo $perms;
        ?>

<br />
<br />

<?php 
        echo $install_rename;
        ?>

<?php 
        echo xtr('Your auth code for running install.php in the future is:');
        ?>
 <code><?php 
        echo get_authcode();
        ?>
</code>

<br />

<?php 
        echo xtr('PLEASE WRITE THIS CODE DOWN UNLESS YOU ARE GOING TO REMOVE ":filename"', array(':filename' => $install_name));
        ?>

<?php 
    }
    x_install_log(xtr('Installation complete'));
    return $result;
}