From 7ea4b96bcc9e0b2ec8de9a6af35ceb155d0c6c7a Mon Sep 17 00:00:00 2001 From: Jeongkyu Shin Date: Sat, 2 May 2015 12:35:55 +0900 Subject: [PATCH] refs #1669 : add - useSSL option when initial setup. - --- library/function/misc.php | 8 ++++++++ setup.php | 17 +++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/library/function/misc.php b/library/function/misc.php index f4c4a4e4e..a3bc7341c 100644 --- a/library/function/misc.php +++ b/library/function/misc.php @@ -7,4 +7,12 @@ function getArrayValue($array, $key) { return $array[$key]; } +function isSecureProtocol() { + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { + return true; + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { + return true; + } + return false; +} ?> diff --git a/setup.php b/setup.php index b1f8b75d0..fd5d2973e 100644 --- a/setup.php +++ b/setup.php @@ -57,13 +57,13 @@ } $context = Model_Context::getInstance(); $context->setProperty('import.library', array( - 'function/string', - 'function/time', - 'function/javascript', - 'function/html', - 'function/xml', - 'function/misc', - 'function/mail')); + 'function.string', + 'function.time', + 'function.javascript', + 'function.html', + 'function.xml', + 'function.misc', + 'function.mail')); if(isset($_POST['dbms'])) $database['dbms'] = $_POST['dbms']; require ROOT.'/library/include.php'; @@ -1314,7 +1314,7 @@ function fail($msg) { else if ($step == 8) { if ($check) return true; - + $useSSL = isSecureProtocol() ? 'true' : 'false'; $filename = $root . '/config.php'; $fp = fopen($filename, 'w+'); // For first entry addition @@ -1340,6 +1340,7 @@ function fail($msg) { \$service['path'] = '$path'; \$service['skin'] = 'periwinkle'; \$service['favicon_daily_traffic'] = 10; // 10MB +\$service['useSSL'] = '{$useSSL}'; // Force SSL protocol (via https) //\$serviceURL = 'http://{$_POST['domain']}{$path}' ; // for path of Skin, plugin and etc. //\$service['reader'] = true; // Use Textcube reader. You can set it to false if you do not use Textcube reader, and want to decrease DB load. //\$service['debugmode'] = true; // uncomment for debugging, e.g. displaying DB Query or Session info