1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-11 09:04:38 +02:00

Fixed e_ROOT path issue on Linux. Also $_E107['debug'] was not working in e107_include() etc.

This commit is contained in:
CaMer0n
2009-12-27 13:56:15 +00:00
parent b75bbc5295
commit b3dc19d4e0
3 changed files with 52 additions and 24 deletions

View File

@@ -9,9 +9,9 @@
* e107 Core functions * e107 Core functions
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/core_functions.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/core_functions.php,v $
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Date: 2009-12-13 21:52:31 $ * $Date: 2009-12-27 13:56:14 $
* $Author: e107steved $ * $Author: e107coders $
*/ */
// //
@@ -107,32 +107,34 @@ function deftrue($str, $default='')
function e107_include($fname) function e107_include($fname)
{ {
global $e107_debug; global $e107_debug, $_E107;
$ret = ($e107_debug ? include($fname) : @include($fname)); $ret = (($e107_debug || $_E107['debug']) ? include($fname) : @include($fname));
return $ret; return $ret;
} }
function e107_include_once($fname) function e107_include_once($fname)
{ {
global $e107_debug; global $e107_debug, $_E107;
if(is_readable($fname)) if(is_readable($fname))
{ {
$ret = (!$e107_debug)? @include_once($fname) : include_once($fname); $ret = ($e107_debug || $_E107['debug']) ? include_once($fname) : @include_once($fname);
} }
return (isset($ret)) ? $ret : ''; return (isset($ret)) ? $ret : '';
} }
function e107_require_once($fname) function e107_require_once($fname)
{ {
global $e107_debug; global $e107_debug, $_E107;
$ret = ($e107_debug ? require_once($fname) : @require_once($fname));
$ret = (($e107_debug || $_E107['debug']) ? require_once($fname) : @require_once($fname));
return $ret; return $ret;
} }
function e107_require($fname) function e107_require($fname)
{ {
global $e107_debug; global $e107_debug, $_E107;
$ret = ($e107_debug ? require($fname) : @require($fname)); $ret = (($e107_debug || $_E107['debug']) ? require($fname) : @require($fname));
return $ret; return $ret;
} }

View File

@@ -9,8 +9,8 @@
* e107 Main * e107 Main
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
* $Revision: 1.97 $ * $Revision: 1.98 $
* $Date: 2009-12-27 11:25:18 $ * $Date: 2009-12-27 13:56:14 $
* $Author: e107coders $ * $Author: e107coders $
*/ */
@@ -157,7 +157,8 @@ class e107
'e_userperms' => '{e_HANDLER}user_handler.php', 'e_userperms' => '{e_HANDLER}user_handler.php',
'UserHandler' => '{e_HANDLER}user_handler.php', 'UserHandler' => '{e_HANDLER}user_handler.php',
'sitelinks' => '{e_HANDLER}sitelinks_class.php', 'sitelinks' => '{e_HANDLER}sitelinks_class.php',
'redirection' => '{e_HANDLER}redirection_class.php' 'redirection' => '{e_HANDLER}redirection_class.php',
'e107Email' => '{e_HANDLER}mail.php'
); );
/** /**
@@ -229,6 +230,7 @@ class e107
*/ */
protected function _init($e107_paths, $e107_root_path, $e107_config_mysql_info) protected function _init($e107_paths, $e107_root_path, $e107_config_mysql_info)
{ {
if(empty($this->e107_dirs)) if(empty($this->e107_dirs))
{ {
// Do some security checks/cleanup, prepare the environment // Do some security checks/cleanup, prepare the environment
@@ -280,8 +282,11 @@ class e107
$this->set_urls(); $this->set_urls();
// cleanup QUERY_STRING and friends, set related constants // cleanup QUERY_STRING and friends, set related constants
$this->set_request(); $this->set_request();
} }
return $this; return $this;
} }
@@ -537,11 +542,13 @@ class e107
*/ */
public static function getSingleton($class_name, $path = true, $regpath = '') public static function getSingleton($class_name, $path = true, $regpath = '')
{ {
$id = 'core/e107/singleton/'.$class_name.$regpath; $id = 'core/e107/singleton/'.$class_name.$regpath;
//singleton object found - overload not possible //singleton object found - overload not possible
if(self::getRegistry($id)) if(self::getRegistry($id))
{ {
return self::getRegistry($id); return self::getRegistry($id);
} }
@@ -772,6 +779,7 @@ class e107
*/ */
public static function getParser() public static function getParser()
{ {
return self::getSingleton('e_parse', e_HANDLER.'e_parse_class.php'); return self::getSingleton('e_parse', e_HANDLER.'e_parse_class.php');
} }
@@ -858,6 +866,16 @@ class e107
return self::getSingleton('e107table'); return self::getSingleton('e107table');
} }
/**
* Retrieve e107Email singleton object
*
* @return e107Email
*/
public static function getEmail()
{
return self::getSingleton('e107Email', true);
}
/** /**
* Retrieve event singleton object * Retrieve event singleton object
* *
@@ -1684,7 +1702,13 @@ class e107
// Absolute file-path of directory containing class2.php // Absolute file-path of directory containing class2.php
// define("e_ROOT", realpath(dirname(__FILE__)."/../")."/"); // define("e_ROOT", realpath(dirname(__FILE__)."/../")."/");
define("e_ROOT", realpath(dirname(__FILE__)."/../")); // Specified format gives trailing slash already (at least on Windows)
$e_ROOT = realpath(dirname(__FILE__)."/../"); // Works in Windows, fails on Linux.
if(substr($e_ROOT,-1) != '/')
{
$e_ROOT .= "/";
}
define("e_ROOT", $e_ROOT); // Specified format gives trailing slash already (at least on Windows)
$this->relative_base_path = (!isset($_E107['cli'])) ? $path : e_ROOT; $this->relative_base_path = (!isset($_E107['cli'])) ? $path : e_ROOT;
$this->http_path = "http://{$_SERVER['HTTP_HOST']}{$this->server_path}"; $this->http_path = "http://{$_SERVER['HTTP_HOST']}{$this->server_path}";
@@ -1849,6 +1873,7 @@ class e107
*/ */
public function set_request() public function set_request()
{ {
$inArray = array("'", ';', '/**/', '/UNION/', '/SELECT/', 'AS '); $inArray = array("'", ';', '/**/', '/UNION/', '/SELECT/', 'AS ');
if (strpos($_SERVER['PHP_SELF'], 'trackback') === false) if (strpos($_SERVER['PHP_SELF'], 'trackback') === false)
{ {
@@ -1885,6 +1910,7 @@ class e107
define('e_TBQS', $_SERVER['QUERY_STRING']); define('e_TBQS', $_SERVER['QUERY_STRING']);
$_SERVER['QUERY_STRING'] = e_QUERY; $_SERVER['QUERY_STRING'] = e_QUERY;
} }
/** /**

View File

@@ -9,9 +9,9 @@
* Plugin configuration module - gsitemap * Plugin configuration module - gsitemap
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_cron.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_cron.php,v $
* $Revision: 1.3 $ * $Revision: 1.4 $
* $Date: 2009-12-20 22:47:27 $ * $Date: 2009-12-27 13:56:15 $
* $Author: e107steved $ * $Author: e107coders $
* *
*/ */
@@ -20,7 +20,7 @@
* *
* @package e107_plugins * @package e107_plugins
* @subpackage event_calendar * @subpackage event_calendar
* @version $Id: e_cron.php,v 1.3 2009-12-20 22:47:27 e107steved Exp $; * @version $Id: e_cron.php,v 1.4 2009-12-27 13:56:15 e107coders Exp $;
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -87,7 +87,7 @@ class calendar_menu_cron // include plugin-folder in the name.
{ {
if ($this->logRequirement == 0) return; if ($this->logRequirement == 0) return;
$logFilename = e_FILE.'logs/calendar_mail.txt'; $logFilename = e_LOG.'calendar_mail.txt';
if ($this->logHandle == NULL) if ($this->logHandle == NULL)
{ {
if (!($this->logHandle = fopen($logFilename, "a"))) if (!($this->logHandle = fopen($logFilename, "a")))