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.
$_SERVER['HTTPS'] and $_SERVER['REQUEST_URI']
I'm having trouble including a file into Vanilla. I have a file that is used on the rest of my site that defines standard variables, $domain, $root_virtual, etc. I can't seem to find the right place to put the include(); call within the Vanilla code. When I do put it in there I get "undefined index" warnings that refer to $_SERVER['REQUEST_URI'] and $_SERVER['HTTPS'].
Any ideas on what the correct place to include this file would be so that I can access it throughout vanilla?
0
This discussion has been closed.
Comments
I'm integrating Vanilla into a site that I'm building that uses my own custom CMS which uses some sitewide navigation, varables, images, etc. The include that deals with sitewide variables (_core.php) is causing problems when included into Vanilla. Below are the relevant code snippets:
I've figured out the $_SERVER['REQUEST_URI'] issue, but the $_SERVER['HTTPS'] one is still killing me.
Code within include file that causes error:
15: // 1 = server is running SSL | 0 = not running SSL 16: $HasSSL = ($_SERVER['HTTPS']=='on') ? 1 : 0; ======= 24: $domainSSL = ($_SERVER['HTTPS']=='on') ? 'https://'. $_SERVER['SERVER_NAME'] : 'http://'. $_SERVER['SERVER_NAME'];
Include() call within class Menu's Render() function:
function Render() { // First sort the tabs by key ksort($this->Tabs); // Now write the Menu $this->Context->Writer->Add("< div class="SiteContainer"> < a name="pgtop"></a> < div id="LoadStatus" style="display: none;">Loading...</ div>"); $this->Context->Writer->Add(" < div class="Head"> <!-- < div class="Logo">".agBANNER_TITLE."</ div> -->"); $this->Context->Writer->Write(); // inside this file is the call to include _core.php <strong style='color:red;'>include("./inc/sitenav.php");</strong> $this->Context->Writer->Add(" < ul id="MenuForum">"); while (list($Key, $Tab) = each($this->Tabs)) { $this->Context->Writer->Add($this->FormatTab($Tab["Text"], $Tab["Value"], $Tab["Url"], $Tab["CssClass"], $Tab["Attributes"])); } $this->Context->Writer->Add("</ ul> </ div> < div class="Body">"); $this->Context->Writer->Write(); }
The error's thrown:
Notice: Undefined index: HTTPS in /usr/local/apache/htdocs/_php/_core.php on line 16 Notice: Undefined index: HTTPS in /usr/local/apache/htdocs/_php/_core.php on line 24
Do you use https? If not, the easy way to get rid of these errors is to prefix the $_SERVER["https"] with an @ symbol, like this:
@$_SERVER["https"]
That will prevent your errors from being dumped to the screen.
if (array_key_exists('HTTPS', $_SERVER)) { $HasSSL = ($_SERVER['HTTPS']=='on') ? 1 : 0; } else { $HasSSL = 0; }
I know it seems a little bit redundant, but it gets the job done without breaking the rest of the site. And, I wonder why I wasn't getting the error anywhere else on the site? Thanks again for your input, it's quite appreciated!