示例#1
0
function step7()
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    global $dbcfg_type, $dbcfg_host, $dbcfg_name, $dbcfg_user, $dbcfg_password, $dbcfg_prefix, $dbcfg_port, $dbcfg_persistent, $dbcfg_path, $action;
    $final_path = calc_db_path('');
    steppage(7);
    include_once './config.write.php';
    $config_result = config_write();
    debug_msg('CONFIG RESULT:' . $config_result, 5);
    switch ($config_result) {
        case '0':
            // Write to main configuration file succeeded
            echo '<div class="ok">Excellent</div>';
            echo '<p>The main configuration file has been written.</p>';
            break;
        case '1':
            // Unable to open main configuration file
            echo '<div class="error">ERROR!</div>';
            echo '<p>Unable to write to the main configuration file!</p>';
            echo 'Please make the main configuration file readable and writeable by the webserver.<br />';
            echo '<br />';
            echo 'You may do this using:<br />';
            echo '<pre>#: chmod 0666 ' . realpath('../') . '/config.php</pre>together with<pre>#: chmod 0777 ' . realpath('../') . '</pre>Which will ensure that the file WILL be readable and writeable by the webserver.<br /><br />';
            break;
        case '2':
            // Write to main configuration file failed
            echo '<div class="error">ERROR!</div>';
            echo '<p>Unable to write to the main configuration file!</p>';
            echo 'Please make the main configuration file readable and writeable by the webserver.<br />';
            echo '<br />';
            echo 'You may do this using:<br />';
            echo '<pre>#: chmod 0666 ' . realpath('../') . '/config.php</pre>together with<pre>#: chmod 0777 ' . realpath('../') . '</pre>Which will ensure that the file WILL be readable and writeable by the webserver.<br /><br />';
            break;
        case '4':
            // Main configuration file created NOT readable
            echo '<div class="error">ERROR!</div>';
            echo '<p>The main configuration file has been written, BUT it cannot be read by the webserver!</p>';
            echo 'Please make the main configuration file readable and writeable by the webserver.<br />';
            echo '<br />';
            echo 'You may do this using:<br />';
            echo '<pre>#: chmod 0666 ' . realpath('../') . '/config.php</pre>';
            break;
    }
    include_once './dbconfig.write.php';
    $dbconfig_result = dbconfig_write();
    debug_msg('DBCONFIG RESULT:' . $dbconfig_result, 5);
    switch ($dbconfig_result) {
        case '0':
            // Write to main configuration file succeeded
            echo '<div class="ok">Excellent</div>';
            echo '<p>The database configuration file has been written.</p>';
            break;
        case '1':
            // Unable to open main configuration file
            echo '<div class="error">ERROR!</div>';
            echo '<p>Unable to write to the database configuration file!</p>';
            echo 'Please make the database configuration file readable and writeable by the webserver.<br />';
            echo '<br />';
            echo 'You may do this using:<br />';
            echo '<pre>#: chmod 0666 ' . $final_path . 'dbconfig.php</pre>together with<pre>#: mkdir -m 0777 ' . $final_path . '</pre>Which will ensure that the file WILL be readable and writeable by the webserver.';
            break;
        case '2':
            // Write to main configuration file failed
            echo '<div class="error">ERROR!</div>';
            echo '<p>Unable to write to the database configuration file!</p>';
            echo 'Please make the database configuration file readable and writeable by the webserver.<br />';
            echo '<br />';
            echo 'You may do this using:<br />';
            echo '<pre>#: chmod 0666 ' . $final_path . 'dbconfig.php</pre>together with<pre>#: mkdir -m 0777 ' . $final_path . '</pre>Which will ensure that the file WILL be readable and writeable by the webserver.';
            break;
        case '4':
            // Database configuration file created NOT readable
            echo '<div class="error">ERROR!</div>';
            echo '<p>The database configuration file has been written, BUT it cannot be read by the webserver!</p>';
            echo 'Please make the database configuration file readable and writeable by the webserver.<br />';
            echo '<br />';
            echo 'You may do this using:<br />';
            echo '<pre>#: chmod 0666 ' . $final_path . 'dbconfig.php</pre>together with<pre>#: mkdir -m 0777 ' . $final_path . '</pre>Which will ensure that the file WILL be readable and writeable by the webserver.';
            break;
    }
    if ($dbconfig_result != 0 || $dbconfig_result != 0) {
        $continue = FALSE;
    } else {
        $continue = TRUE;
    }
    ?>
<p><form action="<?php 
    $_SERVER['PHP_SELF'];
    ?>
" method="post">
<p>
<?php 
    if ($continue) {
        echo '<button name="action" value="step8" type="submit">Continue to Step 8</button>';
    } else {
        echo '<button name="action" value="step7" type="submit">Re-Check</button>';
    }
    echo '&nbsp;&nbsp;&nbsp;&nbsp;<button name="action" value="step6" type="submit">Back</button></p>';
    if (isset($dbcfg_type)) {
        echo '<input type="hidden" name="dbcfg_type" value="' . $dbcfg_type . '" />';
    }
    if (isset($dbcfg_host)) {
        echo '<input type="hidden" name="dbcfg_host" value="' . $dbcfg_host . '" />';
    }
    if (isset($dbcfg_name)) {
        echo '<input type="hidden" name="dbcfg_name" value="' . $dbcfg_name . '" />';
    }
    if (isset($dbcfg_user)) {
        echo '<input type="hidden" name="dbcfg_user" value="' . $dbcfg_user . '" />';
    }
    if (isset($dbcfg_password)) {
        echo '<input type="hidden" name="dbcfg_password" value="' . $dbcfg_password . '" />';
    }
    if (isset($dbcfg_prefix)) {
        echo '<input type="hidden" name="dbcfg_prefix" value="' . $dbcfg_prefix . '" />';
    }
    if (isset($dbcfg_port)) {
        echo '<input type="hidden" name="dbcfg_port" value="' . $dbcfg_port . '" />';
    }
    if (isset($dbcfg_persistent)) {
        echo '<input type="hidden" name="dbcfg_persistent" value="' . $dbcfg_persistent . '" />';
    }
    if (isset($dbcfg_path)) {
        echo '<input type="hidden" name="dbcfg_path" value="' . $dbcfg_path . '" />';
    }
    ?>
</form></p>
<?php 
    html_footer();
}
示例#2
0
 /**
  * 配置银联商务
  * @param $merchantId 商户号
  * @param $private_key 私钥
  * @param $publick_key 公钥
  */
 public static function setChinaumsConfig($merchantId, $private_key, $publick_key, $test)
 {
     $chinaums_config['merchantId'] = $merchantId;
     $chinaums_config['privateKey'] = $private_key;
     $chinaums_config['publickKey'] = $publick_key;
     $chinaums_config['test'] = $test === 'true';
     $chinaums = base64_encode(serialize($chinaums_config));
     require_once __DIR__ . '/../common/function.php';
     config_write(__DIR__ . '/../config/chinaums.config', $chinaums);
 }