2019-11-04 15:57:28 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* AMR base Mod Rewrite class
|
|
|
|
*
|
|
|
|
* @package plugin
|
|
|
|
* @subpackage Mod Rewrite
|
|
|
|
* @version SVN Revision $Rev: 128 $
|
|
|
|
* @id $Id: class.modrewritebase.php 128 2019-07-03 11:58:28Z oldperl $:
|
|
|
|
* @author Murat Purc <murat@purc.de>
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!defined('CON_FRAMEWORK')) {
|
|
|
|
die('Illegal call');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract base mod rewrite class.
|
|
|
|
*
|
|
|
|
* Provides some common features such as common debugging, globals/configuration
|
|
|
|
* access for childs.
|
|
|
|
*
|
|
|
|
* @author Murat Purc <murat@purc.de>
|
|
|
|
* @package plugin
|
|
|
|
* @subpackage Mod Rewrite
|
|
|
|
*/
|
|
|
|
abstract class ModRewriteBase {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialization, is to call at least once by an child.
|
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
protected static function initialize($clientId) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns enabled state of mod rewrite plugin
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public static function isEnabled() {
|
|
|
|
return (self::getConfig('use', 0) == 1) ? true : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the enabled state of mod rewrite plugin
|
|
|
|
*
|
|
|
|
* @param bool $bEnabled
|
|
|
|
*/
|
|
|
|
public static function setEnabled($bEnabled) {
|
|
|
|
self::setConfig('use', (bool) $bEnabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-12-28 16:11:03 +00:00
|
|
|
* Returns configuration of mod rewrite, content of gobal $cfg['cl-mod-rewrite']
|
2019-11-04 15:57:28 +00:00
|
|
|
*
|
|
|
|
* @param string $key Name of configuration key
|
|
|
|
* @param mixed $default Default value to return as a fallback
|
|
|
|
* @return mixed Desired value mr configuration, either the full configuration
|
|
|
|
* or one of the desired subpart
|
|
|
|
*/
|
|
|
|
public static function getConfig($key = null, $default = null) {
|
|
|
|
global $cfg;
|
|
|
|
if ($key == null) {
|
2019-12-28 16:11:03 +00:00
|
|
|
return $cfg['cl-mod-rewrite'];
|
2019-11-04 15:57:28 +00:00
|
|
|
} elseif ((string) $key !== '') {
|
2019-12-28 16:11:03 +00:00
|
|
|
return (isset($cfg['cl-mod-rewrite'][$key])) ? $cfg['cl-mod-rewrite'][$key] : $default;
|
2019-11-04 15:57:28 +00:00
|
|
|
} else {
|
|
|
|
return $default;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-12-28 16:11:03 +00:00
|
|
|
* Sets the configuration of mod rewrite, content of gobal $cfg['cl-mod-rewrite']
|
2019-11-04 15:57:28 +00:00
|
|
|
*
|
|
|
|
* @param string $key Name of configuration key
|
|
|
|
* @param mixed $value The value to set
|
|
|
|
*/
|
|
|
|
public static function setConfig($key, $value) {
|
|
|
|
global $cfg;
|
2019-12-28 16:11:03 +00:00
|
|
|
$cfg['cl-mod-rewrite'][$key] = $value;
|
2019-11-04 15:57:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|