Changeset 523

Show
Ignore:
Timestamp:
04/16/08 13:15:26 (8 months ago)
Author:
sidtheduck
Message:

Fix for ticket #114 - using $_SERVERSCRIPT_FILENAME? instead of $_SERVERSCRIPT_NAME? or $_SERVERPATH_TRANSLATED?

+ added closing semi-colon (;) to commented PLOGGER_EMBEDDED override in plog-config.php

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/plog-config.php

    r509 r523  
    1212define("PLOGGER_DB_NAME",""); 
    1313 
    14 // define("PLOGGER_EMBEDDED","")          // 1/0 (True/False) if set will overrule automatic check 
     14// define("PLOGGER_EMBEDDED","");          // 1/0 (True/False) if set will overrule automatic check 
    1515// define("PLOGGER_LOCALE","");           // da de et fr pl ro tr en-CA...etc. (en-CA for Canadian english) 
    1616?> 
  • trunk/plog-load_config.php

    r509 r523  
    4141$config["baseurl"] = $url_parts["path"]; 
    4242 
    43 // try to figure out whether we are embedded (for example running from Wordpress) 
    44 // on windows/apache $_SERVER['PATH_TRANSLATED'] uses "/" for directory separators, 
    45 // PATH_TRANSLATED is deprecated 
    46 // __FILE__ has them the other way, realpath takes care of that. 
    47 if (!defined('PLOGGER_EMBEDDED') || PLOGGER_EMBEDDED=='') { 
    48   if (dirname(__FILE__) != dirname(realpath($_SERVER["SCRIPT_NAME"])) && strpos($_SERVER["SCRIPT_NAME"],"admin") === false) { 
    49         $config["embedded"] = 1; 
    50         // disable our own cruft-free urls, because the URL has already been processed 
    51         // by WordPress 
    52         $config["use_mod_rewrite"] = 0; 
    53     trace('Autofund Wordpress!'); 
    54     trace('dirname: ' . dirname(__FILE__)); 
    55     trace('$_SERVER["SCRIPT_NAME"]' .': '. $_SERVER["SCRIPT_NAME"]); 
    56     trace('realpath($_SERVER["SCRIPT_NAME"])' .': '. realpath($_SERVER["SCRIPT_NAME"])); 
    57   } else { 
    58         $config["embedded"] = 0; 
    59         $config["baseurl"] = "http://".$_SERVER["HTTP_HOST"]. substr($_SERVER["PHP_SELF"],0,strrpos($_SERVER["PHP_SELF"],"/")) . "/";  
    60     trace('Autofund just a website!'); 
    61   } 
     43// Try to figure out whether we are embedded (for example running from Wordpress) 
     44// Using $_SERVER['SCRIPT_FILENAME'] should produce the same result as __FILE__ if inclusion script in same location as Plogger 
     45// in some environments (virtual hosts) $_SERVER['SCRIPT_FILENAME'] is not the correct absolute path, but realpath() seems to clear it up 
     46// Set PLOGGER_EMBEDDED to 1 in config file to overrule automatic test 
     47// in case Plogger inclusion in different folder location, but doesn't already use mod_rewrite paths 
     48if ((PLOGGER_EMBEDDED == '1') || (dirname(__FILE__) != dirname(realpath($_SERVER['SCRIPT_FILENAME'])) && strpos($_SERVER['SCRIPT_FILENAME'],"admin") === false)) { 
     49        $config["embedded"] = 1; 
     50        // disable our own cruft-free urls, because the URL has already been processed 
     51        // by WordPress 
     52        $config["use_mod_rewrite"] = 0; 
     53        trace('Plogger is embedded'); 
     54        trace('dirname: ' . dirname(__FILE__)); 
     55        trace('$_SERVER[\'SCRIPT_FILENAME\']' .': '. $_SERVER['SCRIPT_FILENAME']); 
     56  trace('realpath($_SERVER[\'SCRIPT_FILENAME\'])' .': '. realpath($_SERVER['SCRIPT_FILENAME'])); 
    6257} else { 
    63   // Set PLOGGER_EMBEDDED to 1 in config file to overrule automatic test 
    64   if (PLOGGER_EMBEDDED == '1') { 
    65     $config["embedded"] = 1; 
    66     $config["use_mod_rewrite"] = 0; 
    67     trace('Wordpress is here'); 
    68   } else { 
    69     $config["embedded"] = 0; 
    70   } 
     58  $config["embedded"] = 0; 
     59  $config["baseurl"] = "http://".$_SERVER["HTTP_HOST"]. substr($_SERVER["PHP_SELF"],0,strrpos($_SERVER["PHP_SELF"],"/")) . "/"; 
    7160} 
    7261