Skip to content

Commit

Permalink
refs #1669 : add - useSSL option when initial setup.
Browse files Browse the repository at this point in the history
 -
  • Loading branch information
inureyes committed May 2, 2015
1 parent 6b4e82b commit 7ea4b96
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
8 changes: 8 additions & 0 deletions library/function/misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
?>
17 changes: 9 additions & 8 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7ea4b96

Please sign in to comment.