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']

edited August 2005 in Vanilla 1.0 Help
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?

Comments

  • perhaps a brief explanation of what it is you're pulling into vanilla and via what method? is this an extension?
  • MarkMark Vanilla Staff
    Also, please copy and paste the actual errors. Paraphrased errors can be very misleading.
  • edited August 2005
    Here's a more concise explanation of the problem:

    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
  • MarkMark Vanilla Staff
    This is actually an error in your other program due to lack of error checking. The $_SERVER collection on your machine doesn't have the HTTPS index defined, and that other software assumes that it does.

    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.
  • edited August 2005
    Thanks mark, you were correct about the underlying problem. I've added some error correction to my files to correct it:

    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!
  • MarkMark Vanilla Staff
    In Vanilla I have overridden the default php.ini error_reporting setting so that it now reports all errors. I do this so that bugs are easier to track down in Vanilla - since, after all, there should never be any bugs - and if there are, I want to find and fix them.
  • but what about people like me who LOVE to write super buggy software?
  • MarkMark Vanilla Staff
    hahaha
This discussion has been closed.