29 changed files with 1014 additions and 1232 deletions
8
conlite/classes/Exceptions/Exception.php
Normal file
8
conlite/classes/Exceptions/Exception.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class Exception extends \Exception
|
||||
{
|
||||
|
||||
}
|
8
conlite/classes/Exceptions/FileNotFoundException.php
Normal file
8
conlite/classes/Exceptions/FileNotFoundException.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class FileNotFoundException extends RuntimeException
|
||||
{
|
||||
|
||||
}
|
8
conlite/classes/Exceptions/InvalidArgumentException.php
Normal file
8
conlite/classes/Exceptions/InvalidArgumentException.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class InvalidArgumentException extends LogicException
|
||||
{
|
||||
|
||||
}
|
8
conlite/classes/Exceptions/LogicException.php
Normal file
8
conlite/classes/Exceptions/LogicException.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class LogicException extends Exception
|
||||
{
|
||||
|
||||
}
|
8
conlite/classes/Exceptions/RuntimeException.php
Normal file
8
conlite/classes/Exceptions/RuntimeException.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Exceptions;
|
||||
|
||||
class RuntimeException extends Exception
|
||||
{
|
||||
|
||||
}
|
306
conlite/classes/Log/Log.php
Normal file
306
conlite/classes/Log/Log.php
Normal file
|
@ -0,0 +1,306 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Log;
|
||||
|
||||
use ConLite\Exceptions\InvalidArgumentException;
|
||||
use cString;
|
||||
use ReflectionClass;
|
||||
|
||||
class Log
|
||||
{
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const EMERG = 0;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const ALERT = 1;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CRIT = 2;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const ERR = 3;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const WARN = 4;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const NOTICE = 5;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const INFO = 6;
|
||||
|
||||
/**
|
||||
* logging level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEBUG = 7;
|
||||
|
||||
protected $writer;
|
||||
|
||||
protected $shortcutHandlers = [];
|
||||
|
||||
protected $priorities = [];
|
||||
|
||||
protected $defaultPriorities = [];
|
||||
|
||||
protected $buffer = [];
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(LogWriter $writer = null)
|
||||
{
|
||||
$createWriter = false;
|
||||
|
||||
if(!$writer) {
|
||||
$createWriter = true;
|
||||
} elseif (!is_object($writer) || !($writer instanceof LogWriter)) {
|
||||
cWarning(__FILE__, __LINE__, 'The passed class is not a subclass of ConLite LogWriter. Creating new one.');
|
||||
$createWriter = true;
|
||||
}
|
||||
|
||||
if($createWriter) {
|
||||
$options = ['destination' => \cRegistry::getConfigValue('path', 'logs') . 'conlite.log'];
|
||||
$writer = LogWriter::factory('File', $options);
|
||||
}
|
||||
|
||||
$this->setWriter($writer);
|
||||
$this->setShortcutHandler('%date', [$this, 'shDate']);
|
||||
$this->setShortcutHandler('%level', [$this, 'shLevel']);
|
||||
$this->setShortcutHandler('%message', [$this, 'shMessage']);
|
||||
|
||||
$this->getWriter()->setOption('log_format', '[%date] [%level] %message', false);
|
||||
|
||||
$reflection = new ReflectionClass($this);
|
||||
$this->priorities = $this->defaultPriorities = array_flip($reflection->getConstants());
|
||||
}
|
||||
|
||||
public function getWriter() {
|
||||
return $this->writer;
|
||||
}
|
||||
|
||||
public function setWriter(LogWriter $writer): void
|
||||
{
|
||||
$this->writer = $writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function setShortcutHandler($shortcut, $handler): bool
|
||||
{
|
||||
if ($shortcut == '') {
|
||||
throw new InvalidArgumentException('The shortcut name must not be empty.');
|
||||
}
|
||||
|
||||
if (cString::getPartOfString($shortcut, 0, 1) == '%') {
|
||||
$shortcut = cString::getPartOfString($shortcut, 1);
|
||||
}
|
||||
|
||||
if (!is_callable($handler)) {
|
||||
throw new InvalidArgumentException('The specified shortcut handler does not exist.');
|
||||
}
|
||||
|
||||
if (array_key_exists($shortcut, $this->shortcutHandlers)) {
|
||||
throw new InvalidArgumentException('The shortcut ' . $shortcut . ' is already in use!');
|
||||
}
|
||||
|
||||
$this->shortcutHandlers[$shortcut] = $handler;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function unsetShortcutHandler($shortcut)
|
||||
{
|
||||
if(!in_array($shortcut, $this->shortcutHandlers)) {
|
||||
throw new InvalidArgumentException('The specified shortcut handler does not exist.');
|
||||
}
|
||||
|
||||
unset($this->shortcutHandlers[$shortcut]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function buffer(string $message, $priority = null): void
|
||||
{
|
||||
$this->buffer[] = [$message, $priority];
|
||||
}
|
||||
|
||||
public function commit(bool $clearBuffer = true)
|
||||
{
|
||||
if (count($this->buffer) == 0) {
|
||||
cWarning(__FILE__, __LINE__, 'There are no buffered messages to commit.');
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->buffer as $bufferInfo) {
|
||||
$this->log($bufferInfo[0], $bufferInfo[1]);
|
||||
}
|
||||
|
||||
if ($clearBuffer) {
|
||||
$this->clearBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
public function clearBuffer(): void
|
||||
{
|
||||
$this->buffer = [];
|
||||
}
|
||||
|
||||
public function log(string $message, $priority = null): void
|
||||
{
|
||||
if ($priority && !is_int($priority) && in_array($priority, $this->priorities)) {
|
||||
$priority = array_search($priority, $this->priorities);
|
||||
}
|
||||
|
||||
if ($priority === null || !array_key_exists($priority, $this->priorities)) {
|
||||
$priority = $this->getWriter()->getOption('default_priority');
|
||||
}
|
||||
|
||||
$logMessage = $this->getWriter()->getOption('log_format');
|
||||
$lineEnding = $this->getWriter()->getOption('line_ending');
|
||||
|
||||
foreach ($this->shortcutHandlers as $shortcut => $handler) {
|
||||
if (cString::getPartOfString($shortcut, 0, 1) != '%') {
|
||||
$shortcut = '%' . $shortcut;
|
||||
}
|
||||
|
||||
$info = [
|
||||
'message' => $message,
|
||||
'priority' => $priority
|
||||
];
|
||||
|
||||
$value = call_user_func($handler, $info);
|
||||
|
||||
$logMessage = str_replace($shortcut, $value, $logMessage);
|
||||
}
|
||||
|
||||
$this->getWriter()->write($logMessage . $lineEnding, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function addPriority(string $name, int $value): void
|
||||
{
|
||||
if ($name == '') {
|
||||
throw new InvalidArgumentException('Priority name must not be empty.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->priorities)) {
|
||||
throw new InvalidArgumentException('The given priority name already exists.');
|
||||
}
|
||||
|
||||
if (array_key_exists($value, $this->priorities)) {
|
||||
throw new InvalidArgumentException('The priority value already exists.');
|
||||
}
|
||||
|
||||
$this->priorities[$value] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function removePriority(string $name): void
|
||||
{
|
||||
if ($name == '') {
|
||||
throw new InvalidArgumentException('Priority name must not be empty.');
|
||||
}
|
||||
|
||||
if (!in_array($name, $this->priorities)) {
|
||||
throw new InvalidArgumentException('Priority name does not exist.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->defaultPriorities)) {
|
||||
throw new InvalidArgumentException('Removing default priorities is not allowed.');
|
||||
}
|
||||
|
||||
$priorityIndex = array_search($name, $this->priorities);
|
||||
|
||||
unset($this->priorities[$priorityIndex]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __call(string $method, array $arguments) {
|
||||
$priorityName = cString::toUpperCase($method);
|
||||
|
||||
if (!in_array($priorityName, $this->priorities)) {
|
||||
throw new InvalidArgumentException('The given priority ' . $priorityName . ' is not supported.');
|
||||
}
|
||||
|
||||
$priorityIndex = array_search($priorityName, $this->priorities);
|
||||
|
||||
$this->log($arguments[0], $priorityIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Date.
|
||||
* Returns the current date.
|
||||
*
|
||||
* @return string
|
||||
* The current date
|
||||
*/
|
||||
public function shDate(): string
|
||||
{
|
||||
return date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Level.
|
||||
* Returns the canonical name of the priority.
|
||||
* The canonical name is padded to 10 characters to achieve a better
|
||||
* formatting.
|
||||
*
|
||||
* @param array $info
|
||||
* @return string
|
||||
* The canonical log level
|
||||
*/
|
||||
public function shLevel(array $info): string
|
||||
{
|
||||
$logLevel = $info['priority'];
|
||||
return str_pad($this->priorities[$logLevel], 10, ' ', STR_PAD_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Message.
|
||||
* Returns the log message.
|
||||
*
|
||||
* @param array $info
|
||||
* @return string
|
||||
* The log message
|
||||
*/
|
||||
public function shMessage(array $info): string
|
||||
{
|
||||
return $info['message'];
|
||||
}
|
||||
}
|
66
conlite/classes/Log/LogWriter.php
Normal file
66
conlite/classes/Log/LogWriter.php
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Log;
|
||||
|
||||
use ConLite\Exceptions\InvalidArgumentException;
|
||||
|
||||
abstract class LogWriter
|
||||
{
|
||||
/**
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(
|
||||
protected array $options = []
|
||||
)
|
||||
{
|
||||
$this->setOptions($options);
|
||||
|
||||
$this->setOption('default_priority', Log::INFO, false);
|
||||
$this->setOption('line_ending', PHP_EOL, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws invalidArgumentException
|
||||
*/
|
||||
public static function factory($writerName, array $writerOptions): LogWriter
|
||||
{
|
||||
$logWriterClassName = __NAMESPACE__ . '\\LogWriter' . ucfirst($writerName);
|
||||
if(!class_exists($logWriterClassName)) {
|
||||
throw new InvalidArgumentException('Unknown ConLite LogWriter class: ' . $logWriterClassName);
|
||||
}
|
||||
|
||||
$writer = new $logWriterClassName($writerOptions);
|
||||
if(!($writer instanceof LogWriter)) {
|
||||
throw new InvalidArgumentException('Provided class is not an instance of ConLite LogWriter');
|
||||
}
|
||||
|
||||
return $writer;
|
||||
}
|
||||
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
public function getOption($option) {
|
||||
return $this->options[$option];
|
||||
}
|
||||
|
||||
public function setOptions(array $options): void
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
public function setOption($option, $value, $force = false) {
|
||||
if (!$force && isset($this->options[$option])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->options[$option] = $value;
|
||||
}
|
||||
public function removeOption($option) {
|
||||
unset($this->options[$option]);
|
||||
}
|
||||
|
||||
abstract function write($message, $priority);
|
||||
}
|
135
conlite/classes/Log/LogWriterFile.php
Normal file
135
conlite/classes/Log/LogWriterFile.php
Normal file
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Log;
|
||||
|
||||
use ConLite\Exceptions\Exception;
|
||||
use ConLite\Exceptions\FileNotFoundException;
|
||||
use DirectoryIterator;
|
||||
|
||||
class LogWriterFile extends LogWriter
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $handle = NULL;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected int $maxLogFileSize = 1024;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected int $maxRotationFiles = 10;
|
||||
|
||||
|
||||
/**
|
||||
* @throws FileNotFoundException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(array $options = []) {
|
||||
|
||||
parent::__construct($options);
|
||||
|
||||
$logFileSize = (int) getEffectiveSetting('log', 'writer-file-size-' . basename($this->getOption('destination')), $this->getOption('logFileSize') ?? 0);
|
||||
|
||||
if($logFileSize > 0) {
|
||||
$this->maxLogFileSize = $logFileSize;
|
||||
}
|
||||
|
||||
$this->createHandle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param int $priority
|
||||
* @return bool
|
||||
*/
|
||||
public function write($message, $priority): bool
|
||||
{
|
||||
$this->rotateLog();
|
||||
return fwrite($this->handle, $message) != false;
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->closeHandle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
protected function createHandle(): void
|
||||
{
|
||||
$destination = $this->getOption('destination');
|
||||
if ($destination == '') {
|
||||
throw new Exception('No destination was specified.');
|
||||
}
|
||||
|
||||
if (($this->handle = fopen($destination, 'a')) === false) {
|
||||
throw new FileNotFoundException('Destination handle could not be created.');
|
||||
}
|
||||
}
|
||||
|
||||
protected function closeHandle(): void
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
protected function rotateLog()
|
||||
{
|
||||
$logfile = $this->getOption('destination');
|
||||
|
||||
if(!file_exists($logfile)) {
|
||||
cWarning(__FILE__, __LINE__, 'Logfile ' . $logfile . ' not found.');
|
||||
return false;
|
||||
} elseif (!is_readable($logfile)) {
|
||||
cWarning(__FILE__, __LINE__, 'Logfile ' . $logfile . ' not readable.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (filesize($logfile) >= $this->maxLogFileSize * 1024) {
|
||||
$pathInfo = pathinfo($logfile);
|
||||
$baseDirectory = $pathInfo['dirname'];
|
||||
$baseName = $pathInfo['basename'];
|
||||
$numMap = [];
|
||||
|
||||
foreach (new DirectoryIterator($baseDirectory) as $fileInfo) {
|
||||
if ($fileInfo->isDot() || !$fileInfo->isFile()) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/^' . $baseName . '\.?([0-9]*)$/', $fileInfo->getFilename(), $matches)) {
|
||||
$num = $matches[1];
|
||||
$file2move = $fileInfo->getFilename();
|
||||
if ($num == '') {
|
||||
$num = 0;
|
||||
}
|
||||
$numMap[$num] = $file2move;
|
||||
}
|
||||
}
|
||||
krsort($numMap);
|
||||
foreach ($numMap as $num => $file2move) {
|
||||
$targetN = $num + 1;
|
||||
if($targetN > $this->maxRotationFiles) {
|
||||
unlink($baseDirectory . DIRECTORY_SEPARATOR . $file2move);
|
||||
continue;
|
||||
}
|
||||
rename($baseDirectory . DIRECTORY_SEPARATOR . $file2move, $baseDirectory . DIRECTORY_SEPARATOR .$baseName . '.' . $targetN);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getMaxLogFileSize(): int
|
||||
{
|
||||
return $this->maxLogFileSize;
|
||||
}
|
||||
|
||||
public function setMaxLogFileSize(int $maxLogFileSize): void
|
||||
{
|
||||
$this->maxLogFileSize = $maxLogFileSize;
|
||||
}
|
||||
}
|
8
conlite/classes/Log/ModuleLog.php
Normal file
8
conlite/classes/Log/ModuleLog.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace ConLite\Log;
|
||||
|
||||
class ModuleLog extends Log
|
||||
{
|
||||
|
||||
}
|
|
@ -19,6 +19,10 @@
|
|||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
use ConLite\Log\LogWriter;
|
||||
use ConLite\Log\Log;
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
@ -148,9 +152,9 @@ class cApiModule extends Item {
|
|||
try {
|
||||
mkdir($this->_aModFileEditConf['modPath'], 0777, true);
|
||||
} catch (Exception $ex) {
|
||||
$oWriter = cLogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$oLog = new cLog($oWriter);
|
||||
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
|
||||
$writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$log = new Log($writer);
|
||||
$log->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), Log::WARN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,9 +164,9 @@ class cApiModule extends Item {
|
|||
try {
|
||||
mkdir($this->getModulePath(), 0777);
|
||||
} catch (Exception $ex) {
|
||||
$oWriter = cLogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$oLog = new cLog($oWriter);
|
||||
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
|
||||
$writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$log = new Log($writer);
|
||||
$log->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), Log::WARN);
|
||||
}
|
||||
|
||||
if (is_writable($this->getModulePath())) {
|
||||
|
@ -171,9 +175,9 @@ class cApiModule extends Item {
|
|||
umask($this->_oldumask);
|
||||
}
|
||||
} else {
|
||||
$oWriter = cLogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$oLog = new cLog($oWriter);
|
||||
$oLog->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), cLog::WARN);
|
||||
$writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
|
||||
$log = new Log($writer);
|
||||
$log->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), Log::WARN);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -244,7 +248,8 @@ class cApiModule extends Item {
|
|||
*
|
||||
* @return array Found strings for this module
|
||||
*/
|
||||
public function parseModuleForStrings() {
|
||||
public function parseModuleForStrings(): bool|array
|
||||
{
|
||||
global $cfg;
|
||||
if ($this->virgin == true) {
|
||||
return false;
|
||||
|
|
|
@ -1,393 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file contains the log class.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
* @version SVN Revision $Rev$
|
||||
*
|
||||
* @author Dominik Ziegler
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
|
||||
|
||||
/**
|
||||
* This class contains the main functionalities for the logging in CONTENIDO.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* $writer = cLogWriter::factory("File", array('destination' => 'contenido.log'));
|
||||
* $log = new cLog($writer);
|
||||
*
|
||||
* $log->addPriority("CONTENIDO", 10);
|
||||
* $log->log("Contenido Log Message.", "CONTENIDO");
|
||||
* $log->contenido("Same log entry in short notation.");
|
||||
* $log->removePriority("CONTENIDO");
|
||||
*
|
||||
* $log->emerg("System down.");
|
||||
*
|
||||
* $log->log('Notice Log Message', cLog::NOTICE);
|
||||
*
|
||||
* $log->buffer('Buffered Log Message', cLog::WARN);
|
||||
* $log->commit();
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
*/
|
||||
class cLog {
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const EMERG = 0;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const ALERT = 1;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const CRIT = 2;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const ERR = 3;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const WARN = 4;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const NOTICE = 5;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const INFO = 6;
|
||||
|
||||
/**
|
||||
* @var int logging level
|
||||
*/
|
||||
const DEBUG = 7;
|
||||
|
||||
/**
|
||||
* @var cLogWriter Contains the local log writer instance.
|
||||
*/
|
||||
protected $_writer;
|
||||
|
||||
/**
|
||||
* @var array Contains all shortcut handlers
|
||||
*/
|
||||
protected $_shortcutHandlers = array();
|
||||
|
||||
/**
|
||||
* @var array Contains all available priorities
|
||||
*/
|
||||
protected $_priorities = array();
|
||||
|
||||
/**
|
||||
* @var array Contains all default priorities
|
||||
*/
|
||||
protected $_defaultPriorities = array();
|
||||
|
||||
/**
|
||||
* @var array Contains all buffered messages
|
||||
*/
|
||||
protected $_buffer = array();
|
||||
|
||||
/**
|
||||
* Creates a new instance of the CONTENIDO Log mechanism.
|
||||
*
|
||||
* The log format interface of cLog is capable of being extended by subclasses. See the note about
|
||||
* the log shortcuts below.
|
||||
*
|
||||
*
|
||||
* About Log Shortcuts
|
||||
* -------------------
|
||||
* Log shortcuts are placeholders which are replaced when a log entry is created. Placeholders start with a
|
||||
* percentage sign (%) and contain one or more characters. Each placeholder is handled by an own function which
|
||||
* decides what to do.
|
||||
*
|
||||
* @param mixed $writer Writer object (any subclass of cLogWriter), or false if cLog should handle the writer creation
|
||||
*/
|
||||
public function __construct($writer = false) {
|
||||
$cfg = cRegistry::getConfig();
|
||||
|
||||
$createWriter = false;
|
||||
|
||||
if ($writer == false) {
|
||||
$createWriter = true;
|
||||
} else if (!is_object($writer) || ($writer instanceof cLogWriter) == false) {
|
||||
cWarning(__FILE__, __LINE__, "The passed class is not a subclass of cLogWriter. Creating new one.");
|
||||
$createWriter = true;
|
||||
}
|
||||
|
||||
if ($createWriter == true) {
|
||||
$options = array(
|
||||
'destination' => cRegistry::getConfigValue('path', 'contenido')
|
||||
.cRegistry::getConfigValue('path', 'logs')
|
||||
.'contenido.log');
|
||||
$writer = cLogWriter::factory("File", $options);
|
||||
}
|
||||
|
||||
$this->setWriter($writer);
|
||||
$this->setShortcutHandler("%date", array($this, "shDate"));
|
||||
$this->setShortcutHandler("%level", array($this, "shLevel"));
|
||||
$this->setShortcutHandler("%message", array($this, "shMessage"));
|
||||
|
||||
$this->getWriter()->setOption('log_format', '[%date] [%level] %message', false);
|
||||
|
||||
$reflection = new ReflectionClass($this);
|
||||
$this->_priorities = $this->_defaultPriorities = array_flip($reflection->getConstants());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local writer instance.
|
||||
* @return cLogWriter
|
||||
*/
|
||||
public function getWriter() {
|
||||
return $this->_writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the local writer instance.
|
||||
*
|
||||
* @param cLogWriter $writer Writer instacne
|
||||
*/
|
||||
public function setWriter(cLogWriter $writer) {
|
||||
$this->_writer = $writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a custom shortcut handler.
|
||||
*
|
||||
* Each shortcut handler receives an array with the
|
||||
* message and the priority of the entry.
|
||||
*
|
||||
* @param string $shortcut Shortcut name
|
||||
* @param string $handler Name of the function to call
|
||||
* @throws cInvalidArgumentException if the given shortcut is empty or
|
||||
* already in use or if the handler is not callable
|
||||
* @return bool True if setting was successful
|
||||
*/
|
||||
public function setShortcutHandler($shortcut, $handler) {
|
||||
if ($shortcut == '') {
|
||||
throw new Exception('The shortcut name must not be empty.');
|
||||
}
|
||||
|
||||
if (substr($shortcut, 0, 1) == "%") {
|
||||
$shortcut = substr($shortcut, 1);
|
||||
}
|
||||
|
||||
if (is_callable($handler) == false) {
|
||||
throw new Exception('The specified shortcut handler does not exist.');
|
||||
}
|
||||
|
||||
if (array_key_exists($shortcut, $this->_shortcutHandlers)) {
|
||||
throw new Exception('The shortcut ' . $shortcut . ' is already in use!');
|
||||
}
|
||||
|
||||
$this->_shortcutHandlers[$shortcut] = $handler;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets a specific shortcut handler.
|
||||
*
|
||||
* @param string $shortcut Name of the shortcut
|
||||
* @throws cInvalidArgumentException if the given shortcut handler does not
|
||||
* exist
|
||||
* @return boolean
|
||||
*/
|
||||
public function unsetShortcutHandler($shortcut) {
|
||||
if (!in_array($shortcut, $this->_shortcutHandlers)) {
|
||||
throw new Exception('The specified shortcut handler does not exist.');
|
||||
}
|
||||
|
||||
unset($this->_shortcutHandlers[$shortcut]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buffers a log message for committing them on a later moment.
|
||||
*
|
||||
* @param string $message Message to buffer
|
||||
* @param mixed $priority Priority of the log entry (optional)
|
||||
*/
|
||||
public function buffer($message, $priority = NULL) {
|
||||
$this->_buffer[] = array($message, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Commits all buffered messages and empties the message buffer if parameter is not false.
|
||||
*
|
||||
* @param boolean $revoke Flag, whether the buffer is cleared or not (optional, default: true)
|
||||
*/
|
||||
public function commit($revoke = true) {
|
||||
if (count($this->_buffer) == 0) {
|
||||
cWarning(__FILE__, __LINE__, "There are no buffered messages to commit.");
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->_buffer as $bufferInfo) {
|
||||
$this->log($bufferInfo[0], $bufferInfo[1]);
|
||||
}
|
||||
|
||||
if ($revoke == true) {
|
||||
$this->revoke();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Empties the message buffer.
|
||||
*/
|
||||
public function revoke() {
|
||||
$this->_buffer = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a message using the local writer instance
|
||||
*
|
||||
* @param string $message Message to log
|
||||
* @param mixed $priority Priority of the log entry (optional)
|
||||
*/
|
||||
public function log($message, $priority = NULL) {
|
||||
if ($priority && is_int($priority) == false && in_array($priority, $this->_priorities)) {
|
||||
$priority = array_search($priority, $this->_priorities);
|
||||
}
|
||||
|
||||
if ($priority === NULL || array_key_exists($priority, $this->_priorities) == false) {
|
||||
$priority = $this->getWriter()->getOption('default_priority');
|
||||
}
|
||||
|
||||
$logMessage = $this->getWriter()->getOption('log_format');
|
||||
$lineEnding = $this->getWriter()->getOption('line_ending');
|
||||
|
||||
foreach ($this->_shortcutHandlers as $shortcut => $handler) {
|
||||
if (substr($shortcut, 0, 1) != "%") {
|
||||
$shortcut = "%" . $shortcut;
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'message' => $message,
|
||||
'priority' => $priority
|
||||
);
|
||||
|
||||
$value = call_user_func($handler, $info);
|
||||
|
||||
$logMessage = str_replace($shortcut, $value, $logMessage);
|
||||
}
|
||||
|
||||
$this->getWriter()->write($logMessage . $lineEnding, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new priority to the log.
|
||||
*
|
||||
* @param string $name Name of the log priority
|
||||
* @param int $value Index value of the log priority
|
||||
* @throws cInvalidArgumentException if the given name is empty, already
|
||||
* exists or the value already exists
|
||||
*/
|
||||
public function addPriority($name, $value) {
|
||||
if ($name == '') {
|
||||
throw new Exception('Priority name must not be empty.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->_priorities)) {
|
||||
throw new Exception('The given priority name already exists.');
|
||||
}
|
||||
|
||||
if (array_key_exists($value, $this->_priorities)) {
|
||||
throw new Exception('The priority value already exists.');
|
||||
}
|
||||
|
||||
$this->_priorities[$value] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a priority from log.
|
||||
* Default properties can not be removed.
|
||||
*
|
||||
* @param string $name Name of the log priority to remove
|
||||
* @throws cInvalidArgumentException if the given name is empty, does not
|
||||
* exist or is a default priority
|
||||
*/
|
||||
public function removePriority($name) {
|
||||
if ($name == '') {
|
||||
throw new Exception('Priority name must not be empty.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->_priorities) == false) {
|
||||
throw new Exception('Priority name does not exist.');
|
||||
}
|
||||
|
||||
if (in_array($name, $this->_defaultPriorities) == true) {
|
||||
throw new Exception('Removing default priorities is not allowed.');
|
||||
}
|
||||
|
||||
$priorityIndex = array_search($name, $this->_priorities);
|
||||
|
||||
unset($this->_priorities[$priorityIndex]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic call method for direct priority named calls.
|
||||
*
|
||||
* @param string $method Name of the method
|
||||
* @param array $arguments Array with the method arguments
|
||||
* @throws cInvalidArgumentException if the given priority is not supported
|
||||
*/
|
||||
public function __call($method, $arguments) {
|
||||
$priorityName = strtoupper($method);
|
||||
|
||||
if (in_array($priorityName, $this->_priorities) == false) {
|
||||
throw new Exception('The given priority ' . $priorityName . ' is not supported.');
|
||||
}
|
||||
|
||||
$priorityIndex = array_search($priorityName, $this->_priorities);
|
||||
|
||||
return $this->log($arguments[0], $priorityIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Date.
|
||||
* Returns the current date
|
||||
* @return string The current date
|
||||
*/
|
||||
public function shDate() {
|
||||
return date("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Level.
|
||||
* Returns the canonical name of the priority.
|
||||
* The canonical name is padded to 10 characters to achieve a better formatting.
|
||||
* @return string The canonical log level
|
||||
*/
|
||||
public function shLevel($info) {
|
||||
$logLevel = $info['priority'];
|
||||
return str_pad($this->_priorities[$logLevel], 10, " ", STR_PAD_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Message.
|
||||
* Returns the log message.
|
||||
* @return string The log message
|
||||
*/
|
||||
public function shMessage($info) {
|
||||
return $info['message'];
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file contains the log file writer class.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
* @version SVN Revision $Rev$
|
||||
*
|
||||
* @author Dominik Ziegler
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
|
||||
|
||||
/**
|
||||
* This class contains the file writer class for the logging mechanism.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
*/
|
||||
class cLogWriterFile extends cLogWriter {
|
||||
/**
|
||||
* @var resource Destination handle
|
||||
*/
|
||||
protected $_handle = NULL;
|
||||
|
||||
/**
|
||||
* Constructor of the writer instance.
|
||||
* @param array $options Array with options for the writer instance (optional)
|
||||
*/
|
||||
public function __construct($options = array()) {
|
||||
parent::__construct($options);
|
||||
|
||||
$this->_createHandle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks destination and creates the handle for the write process.
|
||||
*
|
||||
* @throws cException if not destination is specified
|
||||
* @throws cFileNotFoundException if the destination file could not be read
|
||||
*/
|
||||
protected function _createHandle() {
|
||||
$destination = $this->getOption('destination');
|
||||
if ($destination == '') {
|
||||
throw new Exception('No destination was specified.');
|
||||
}
|
||||
|
||||
if (($this->_handle = fopen($destination, 'a')) === false) {
|
||||
throw new Exception('Destination handle could not be created.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the content to file handle.
|
||||
*
|
||||
* @param string $message Message to write
|
||||
* @param int $priority Priority of the log entry
|
||||
* @return boolean State of the write process
|
||||
*/
|
||||
public function write($message, $priority) {
|
||||
return (fwrite($this->_handle, $message) != false);
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file contains the abstract log writer class.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
* @version SVN Revision $Rev$
|
||||
*
|
||||
* @author Dominik Ziegler
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
|
||||
|
||||
/**
|
||||
* This class contains the main functionalities for the logging writer in CONTENIDO.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
*/
|
||||
abstract class cLogWriter {
|
||||
/**
|
||||
* @var array Contains all options of the current writer instance.
|
||||
*/
|
||||
protected $_options = array();
|
||||
|
||||
/**
|
||||
* Constructor of the writer instance.
|
||||
* @param array $options Array with options for the writer instance (optional)
|
||||
*/
|
||||
public function __construct($options = array()) {
|
||||
$this->setOptions($options);
|
||||
|
||||
// Set all default options if they were not set already
|
||||
$this->setOption('default_priority', cLog::INFO, false);
|
||||
$this->setOption('line_ending', PHP_EOL, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for a new writer instance.
|
||||
*
|
||||
* @param string $writerName Name of the writer
|
||||
* @param array $writerOptions Options array for the writer instance
|
||||
* @throws cInvalidArgumentException if the writer class with the given name
|
||||
* does not exist or is not an instance of clogWriter
|
||||
* @return cLogWriter Log writer instance
|
||||
*/
|
||||
public static function factory($writerName, array $writerOptions) {
|
||||
$logWriterClassName = 'cLogWriter' . ucfirst($writerName);
|
||||
if (!class_exists($logWriterClassName)) {
|
||||
throw new Exception('Unknown writer class: ' . $writerName);
|
||||
}
|
||||
|
||||
$writer = new $logWriterClassName($writerOptions);
|
||||
if (($writer instanceof cLogWriter) == false) {
|
||||
throw new Exception('Provided class is not an instance of cLogWriter');
|
||||
}
|
||||
|
||||
return $writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the whole options array.
|
||||
*
|
||||
* @param array $options Array with options
|
||||
*/
|
||||
public function setOptions(array $options) {
|
||||
$this->_options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all options.
|
||||
* @return array Array with all options
|
||||
*/
|
||||
public function getOptions() {
|
||||
return $this->_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a option. If option was set previously, it must be forced to overwrite the value.
|
||||
*
|
||||
* @param string $option Name of the option
|
||||
* @param mixed $value Value of the option
|
||||
* @param boolean $force Flag to force setting the option value (optional, default: false)
|
||||
*/
|
||||
public function setOption($option, $value, $force = false) {
|
||||
if ($force == false && isset($this->_options[$option]) == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_options[$option] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of an option entry.
|
||||
*
|
||||
* @param string $option Name of the option
|
||||
*
|
||||
* @return mixed Value of the option entry
|
||||
*/
|
||||
public function getOption($option) {
|
||||
return $this->_options[$option];
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an option entry.
|
||||
*
|
||||
* @param string $option Name of the option
|
||||
*/
|
||||
public function removeOption($option) {
|
||||
unset($this->_options[$option]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract function for the write process.
|
||||
* This method must be implemented in the specific writer.
|
||||
*
|
||||
* @param string $message Message to write
|
||||
* @param int $priority Priority of the log entry
|
||||
*
|
||||
* @return boolean State of the write process
|
||||
*/
|
||||
abstract function write($message, $priority);
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file contains the module log class.
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
* @version SVN Revision $Rev$
|
||||
*
|
||||
* @author Dominik Ziegler
|
||||
* @copyright four for business AG <www.4fb.de>
|
||||
* @license http://www.contenido.org/license/LIZENZ.txt
|
||||
* @link http://www.4fb.de
|
||||
* @link http://www.contenido.org
|
||||
*/
|
||||
|
||||
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
|
||||
|
||||
/**
|
||||
* This class contains the main functionalities for the module logging in
|
||||
* CONTENIDO.
|
||||
* The funcationality is almost the same like normal logging with the exception,
|
||||
* that log entries contains an additional information about the used module.
|
||||
*
|
||||
* Example:
|
||||
* $writer = cLogWriter::factory("File", array('destination' =>
|
||||
* 'contenido.log'));
|
||||
*
|
||||
* $log = new cModuleLog($writer);
|
||||
* $log->setModule(1);
|
||||
* $log->log("Anything you want to log.");
|
||||
*
|
||||
* @package Core
|
||||
* @subpackage Log
|
||||
*/
|
||||
class cModuleLog extends cLog {
|
||||
|
||||
/**
|
||||
* @var cApiModule instance of module model
|
||||
*/
|
||||
private $_module;
|
||||
|
||||
/**
|
||||
* Constructor of the module log.
|
||||
*
|
||||
* @param mixed $writer Writer object (any subclass of cLogWriter), or false
|
||||
* if cLog should handle the writer creation
|
||||
*
|
||||
*/
|
||||
public function __construct($writer = false) {
|
||||
parent::__construct($writer);
|
||||
|
||||
$this->setShortcutHandler('module', array(
|
||||
$this,
|
||||
'shModule'
|
||||
));
|
||||
$this->getWriter()->setOption("log_format", "[%date] [%level] [%module] %message", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the module to use.
|
||||
*
|
||||
* setModule automatically buffers basic module information to the log to
|
||||
* assist the developer in debugging his modules.
|
||||
*
|
||||
* @param int $idmod The module ID to use
|
||||
* @throws cException if the module with the given idmod could not be loaded
|
||||
*/
|
||||
public function setModule($idmod) {
|
||||
$this->_module = new cApiModule($idmod);
|
||||
if ($this->_module->isLoaded() == false) {
|
||||
throw new Exception('Could not load module information.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut Handler Module.
|
||||
* Returns the ID and the name of the module.
|
||||
*
|
||||
* @return string ID and name of the module
|
||||
*/
|
||||
public function shModule() {
|
||||
if ($this->_module->isLoaded() == false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->_module->get("idmod") . ": " . $this->_module->get("name");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -25,27 +25,26 @@ if (!defined("CON_FRAMEWORK")) {
|
|||
// Contenido startup process
|
||||
include_once ('../includes/startup.php');
|
||||
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.con.php');
|
||||
$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes');
|
||||
$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes');
|
||||
|
||||
include_once ($classPath . 'class.user.php');
|
||||
include_once ($classPath . 'class.xml.php');
|
||||
include_once ($classPath . 'class.navigation.php');
|
||||
include_once ($classPath . 'template/class.template.php');
|
||||
include_once ($classPath . 'class.backend.php');
|
||||
include_once ($classPath . 'class.table.php');
|
||||
include_once ($classPath . 'class.notification.php');
|
||||
include_once ($classPath . 'class.area.php');
|
||||
include_once ($classPath . 'class.layout.php');
|
||||
include_once ($classPath . 'class.client.php');
|
||||
include_once ($classPath . 'class.cat.php');
|
||||
include_once ($classPath . 'class.treeitem.php');
|
||||
include_once ($includesPath . 'cfg_language_de.inc.php');
|
||||
include_once ($includesPath . 'functions.con.php');
|
||||
|
||||
if(!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") {
|
||||
|
||||
$db = new DB_ConLite;
|
||||
|
||||
conFlagOnOffline();
|
||||
|
||||
conMoveArticles();
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -25,20 +25,23 @@ if (!defined("CON_FRAMEWORK")) {
|
|||
// Contenido startup process
|
||||
include_once ('../includes/startup.php');
|
||||
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.stat.php');
|
||||
$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes');
|
||||
$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes');
|
||||
|
||||
include_once ($classPath . 'class.user.php');
|
||||
include_once ($classPath . 'class.xml.php');
|
||||
include_once ($classPath . 'class.navigation.php');
|
||||
include_once ($classPath . 'template/class.template.php');
|
||||
include_once ($classPath . 'class.backend.php');
|
||||
include_once ($classPath . 'class.table.php');
|
||||
include_once ($classPath . 'class.notification.php');
|
||||
include_once ($classPath . 'class.area.php');
|
||||
include_once ($classPath . 'class.layout.php');
|
||||
include_once ($classPath . 'class.client.php');
|
||||
include_once ($classPath . 'class.cat.php');
|
||||
include_once ($classPath . 'class.treeitem.php');
|
||||
include_once ($includesPath . 'cfg_language_de.inc.php');
|
||||
include_once ($includesPath . 'functions.stat.php');
|
||||
|
||||
if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs")
|
||||
{
|
||||
|
@ -57,5 +60,4 @@ if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs")
|
|||
|
||||
statsArchive(sprintf("%04d%02d",$year,$month));
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -25,37 +25,41 @@ if (!defined("CON_FRAMEWORK")) {
|
|||
// Contenido startup process
|
||||
include_once ('../includes/startup.php');
|
||||
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php');
|
||||
include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.stat.php');
|
||||
$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes');
|
||||
$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes');
|
||||
|
||||
include_once ($classPath . 'class.user.php');
|
||||