Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
SSL support and Undefined index: DEFAULT_EMAIL_VISIBLE
Hi,
I finally installed Vanilla and it looks great. Good work! I just wanted to report the two small problems I ran into.
1. First time I tried to apply for membership I recieved this notice in people.php:
Notice: Undefined index: DEFAULT_EMAIL_VISIBLE in /vanilla/library/People/People.Class.UserManager.php on line 229
UtilizeEmail in the database is default to 0, and when I didn't have DEFAULT_EMAIL_VISIBLE in my setting -- this oddly enough got the value ''. Not 0 and not 1. I'm using MySQL 4.1. This should have any affect tho since UtilizeEmail is forced to boolean.
I added $Configuration['DEFAULT_EMAIL_VISIBLE'] = '0'; to my conf/settings.php and the problem went away.
2. I've enabled SSL on my host and by default vanilla only uses http://. I changed my settings.php to use https:// and applied the following changes.
Cheers
I finally installed Vanilla and it looks great. Good work! I just wanted to report the two small problems I ran into.
1. First time I tried to apply for membership I recieved this notice in people.php:
Notice: Undefined index: DEFAULT_EMAIL_VISIBLE in /vanilla/library/People/People.Class.UserManager.php on line 229
UtilizeEmail in the database is default to 0, and when I didn't have DEFAULT_EMAIL_VISIBLE in my setting -- this oddly enough got the value ''. Not 0 and not 1. I'm using MySQL 4.1. This should have any affect tho since UtilizeEmail is forced to boolean.
I added $Configuration['DEFAULT_EMAIL_VISIBLE'] = '0'; to my conf/settings.php and the problem went away.
2. I've enabled SSL on my host and by default vanilla only uses http://. I changed my settings.php to use https:// and applied the following changes.
===================================================================
--- library/Framework/Framework.Functions.php
+++ library/Framework/Framework.Functions.php
@@ -77,7 +77,7 @@
// Append two paths
function ConcatenatePath($OriginalPath, $PathToConcatenate) {
- if (strpos($PathToConcatenate, 'http://') !== false) return $PathToConcatenate;
+ if (strpos($PathToConcatenate, 'http://') !== false || strpos($PathToConcatenate, 'https://') !== false) return $PathToConcatenate;
if (substr($OriginalPath, strlen($OriginalPath)-1, strlen($OriginalPath)) != '/') $OriginalPath .= '/';
if (substr($PathToConcatenate,0,1) == '/') $PathToConcatenate = substr($PathToConcatenate,1,strlen($PathToConcatenate));
return $OriginalPath.$PathToConcatenate;
@@ -308,6 +308,15 @@
$Display = $LinkText;
}
return '<a href="'.$InString.'">'.$Display.'</a>';
+ } elseif (strpos($InString, 'https://') == 0 && strpos($InString, 'https://') !== false) {
+ if ($LinkText == '') {
+ $Display = $InString;
+ if (substr($Display, strlen($Display)-1,1) == '/') $Display = substr($Display, 0, strlen($Display)-1);
+ $Display = str_replace('https://', '', $Display);
+ } else {
+ $Display = $LinkText;
+ }
+ return '<a href="'.$InString.'">'.$Display.'</a>';
} elseif (strpos($InString, 'mailto:') == 0 && strpos($InString, 'mailto:') !== false) {
if ($LinkText == '') {
$Display = str_replace('mailto:', '', $InString);
@@ -425,7 +434,12 @@
function GetRequestUri() {
$Host = ForceString($_SERVER['HTTP_HOST'], '');
- if ($Host != '') $Host = PrependString('http://', $Host);
+ if ($Host != '') {
+ if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
+ $Host = PrependString('https://', $Host);
+ else
+ $Host = PrependString('http://', $Host);
+ }
$Path = @$_SERVER['REQUEST_URI'];
// If the path wasn't provided in the REQUEST_URI variable, let's look elsewhere for it
if ($Path == '') $Path = @$_SERVER['HTTP_X_REWRITE_URL']; // Some servers use this instead
Cheers
0
This discussion has been closed.
Comments
If you got it from svn, you didn't get all of the files properly - which is causing the DEFAULT_EMAIL_VISIBLE bug, I believe.
You should really be sticking to the public release from getvanilla.com, anyway.
Here's another thing I found that need to be changed if the forum should work on SSL.
=================================================================== --- library/People/People.Class.User.php +++ library/People/People.Class.User.php @@ -235,8 +235,8 @@ $this->Email = ForceIncomingString('Email', ''); $this->UtilizeEmail = ForceIncomingBool('UtilizeEmail',0); $this->Password = ForceIncomingString('Password', ''); - $this->Icon = PrependString('http://', ForceIncomingString('Icon','')); - $this->Picture = PrependString('http://', ForceIncomingString('Picture','')); + $this->Icon = PrependString(array('http://', 'https://'), ForceIncomingString('Icon','')); + $this->Picture = PrependString(array('http://', 'https://'), ForceIncomingString('Picture','')); $this->AgreeToTerms = ForceIncomingBool('AgreeToTerms', 0); $this->ReadTerms = ForceIncomingBool('ReadTerms', 0); $this->Discovery = ForceIncomingString('Discovery', ''); =================================================================== --- library/Framework/Framework.Functions.php +++ library/Framework/Framework.Functions.php @@ -560,7 +560,15 @@ } function PrependString($Prepend, $String) { - $pos = strpos(strtolower($String), strtolower($Prepend)); + if (is_array($Prepend)) { + foreach ($Prepend as $token) { + if (($pos = strpos(strtolower($String), strtolower($token))) !== false) + break; + } + $Prepend = array_shift($Prepend); + } + else + $pos = strpos(strtolower($String), strtolower($Prepend)); if (($pos !== false && $pos == 0) || $String == '') { return $String; } else {
I guess one could alter the function to take a third argument instead of doing an array-hack.