diff --git a/inc/Db.php b/inc/Db.php index 99126c0..15cdbcb 100644 --- a/inc/Db.php +++ b/inc/Db.php @@ -45,7 +45,7 @@ class Db extends PhpObject $this->asConf = $asConf; $this->asOptions = $asOptions; - parent::__construct(__FILE__, Settings::DEBUG); + parent::__construct(__FILE__); $this->oConnection = new \mysqli($this->getConf('server'), $this->getConf('user'), $this->getConf('pass')); $this->syncPhpParams($this->getConf('encoding')); diff --git a/inc/Feed.php b/inc/Feed.php index 3f5c185..9d9e99a 100755 --- a/inc/Feed.php +++ b/inc/Feed.php @@ -23,7 +23,7 @@ class Feed extends PhpObject */ public function __construct($asChannel=array(), $asItems=array()) { - parent::__construct(__CLASS__, Settings::DEBUG); + parent::__construct(__CLASS__); if(!empty($asChannel) && !array_key_exists('link', $asChannel)) { $asChannel['link'] = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'].'/rss'; diff --git a/inc/Main.php b/inc/Main.php index 93d3b1a..d1943f9 100755 --- a/inc/Main.php +++ b/inc/Main.php @@ -48,9 +48,9 @@ abstract class Main extends PhpObject /** * Main constructor */ - public function __construct($sProcessPage, $bDb=true, $sFile=__FILE__, $sTimeZone='') + public function __construct($sProcessPage, $bDb=true, $sTimeZone='', $sLogPath='') { - parent::__construct($sFile, Settings::DEBUG); + parent::__construct(get_class($this), Settings::DEBUG, PhpObject::MODE_FILE, $sLogPath); $this->setContext($sProcessPage, $sTimeZone); diff --git a/inc/Mask.php b/inc/Mask.php index c2e06b7..10f7c21 100755 --- a/inc/Mask.php +++ b/inc/Mask.php @@ -32,7 +32,7 @@ class Mask extends PhpObject public function __construct($sFileName='', Translator $oLang=null, $sTimezone = '') { //init - parent::__construct(__FILE__, Settings::DEBUG); + parent::__construct(__CLASS__); $this->sMaskName = ''; $this->sFilePath = ''; $this->sMask = ''; diff --git a/inc/PhpObject.php b/inc/PhpObject.php index 547bfad..0c2208e 100644 --- a/inc/PhpObject.php +++ b/inc/PhpObject.php @@ -12,6 +12,7 @@ class PhpObject { //Log file name const LOG_FILENAME = 'log.html'; + private $sLogPath; //Message types const NOTICE_TAB = 'Notice'; @@ -31,13 +32,14 @@ class PhpObject private $sChildClass; private $bDebug; - function __construct($sClass='', $bDebug=false, $iExtractMode=self::MODE_FILE) + function __construct($sClass='', $bDebug=Settings::DEBUG, $iExtractMode=self::MODE_FILE, $sLogPath='') { $this->asMessageStack = array(); $this->resetMessageStack(); $this->setDebug($bDebug); $this->setExtractMode($iExtractMode); $this->sChildClass = $sClass; + $this->setLogPath($sLogPath); } public function setExtractMode($iExtractMode) { @@ -54,10 +56,15 @@ class PhpObject { return $this->bDebug; } + + private function setLogPath($sLogPath) { + if($sLogPath == '') $sLogPath = defined('Settings::LOG_FOLDER')?Settings::LOG_FOLDER:dirname(__FILE__); + $this->sLogPath = $sLogPath.DIRECTORY_SEPARATOR.self::LOG_FILENAME; + } - private static function getLogPath() + private function getLogPath() { - return dirname(__FILE__).DIRECTORY_SEPARATOR.self::LOG_FILENAME; + return $this->sLogPath; } private function resetMessageStack($sType=self::ALL_TAB) diff --git a/inc/Translator.php b/inc/Translator.php index 46b8524..33d22f7 100755 --- a/inc/Translator.php +++ b/inc/Translator.php @@ -27,7 +27,7 @@ class Translator extends PhpObject */ public function __construct($sLang='', $sDefaultLang='') { - parent::__construct(__FILE__, Settings::DEBUG); + parent::__construct(__FILE__); $this->asLanguages = array(); $this->asTranslations = array(); $this->loadLanguages();