mirror of
https://github.com/e107inc/e107.git
synced 2025-08-27 08:14:46 +02:00
eURL improvements & Administration area
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/e107Url.php,v $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2008-11-26 21:00:23 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* URL Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107Url.php,v $
|
||||
* $Revision: 1.8 $
|
||||
* $Date: 2008-12-02 00:32:30 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
class eURL
|
||||
@@ -28,7 +25,7 @@ class eURL
|
||||
* @param string $section
|
||||
* @param string $urlType
|
||||
* @param string|array $urlItems
|
||||
* @return string URL
|
||||
* @return string URL or '#url-not-found' on error
|
||||
*/
|
||||
function getUrl($section, $urlType, $urlItems = array())
|
||||
{
|
||||
@@ -37,7 +34,7 @@ class eURL
|
||||
$urlItems = array($urlItems => 1);
|
||||
}
|
||||
|
||||
$handlerId = $section . '/' . $urlType; if (!isset($this->_link_handlers[$handlerId]))
|
||||
$handlerId = $section . '/' . $urlType;
|
||||
if (!isset($this->_link_handlers[$handlerId]))
|
||||
{
|
||||
$this->_link_handlers[$handlerId] = $this->_initHandler($section, $urlType);
|
||||
@@ -50,29 +47,62 @@ class eURL
|
||||
return '#url-not-found';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse Request string
|
||||
*
|
||||
* @param string $section
|
||||
* @param string $urlType
|
||||
* @param string $request
|
||||
* @return mixed parsed url
|
||||
*/
|
||||
function parseUrl($section, $urlType, $request = '')
|
||||
{
|
||||
if (empty($request))
|
||||
{
|
||||
$request = e_QUERY;
|
||||
}
|
||||
|
||||
$handlerId = $section . '/' . $urlType;
|
||||
if (!isset($this->_link_handlers[$handlerId]))
|
||||
{
|
||||
$this->_link_handlers[$handlerId] = $this->_initHandler($section, $urlType);
|
||||
}
|
||||
|
||||
return call_user_func('parse_'.$this->_link_handlers[$handlerId], $request);
|
||||
}
|
||||
|
||||
function _initHandler($section, $urlType)
|
||||
{
|
||||
global $pref; //FIXME pref handler, $e107->prefs instance
|
||||
|
||||
$core = false;
|
||||
if (strpos($section, ':') !== false)
|
||||
if (strpos($section, ':') === false)
|
||||
{
|
||||
list($tmp, $section) = explode(':', $section, 2);
|
||||
$core = ($tmp === 'core');
|
||||
$section = 'plugin:'.$section;
|
||||
}
|
||||
elseif (isset($this->_link_handlers['plugin:'.$section]))
|
||||
{
|
||||
return $this->_link_handlers['plugin:'.$section];
|
||||
}
|
||||
|
||||
$handlerId = $section . '/' . $urlType;
|
||||
|
||||
list($type, $section) = explode(':', $section, 2);
|
||||
$handler = 'url_' . $section . '_' . $urlType;
|
||||
|
||||
// Check to see if custom code is active and exists
|
||||
if (varsettrue($pref['url_config'][$section]))
|
||||
{
|
||||
// Search the central url config repository - one config to rull them all
|
||||
$fileName = ($core ? e_FILE."url/custom/base/{$handlerId}.php" : e_FILE."url/custom/plugins/{$handlerId}.php");
|
||||
$filePath = str_replace(
|
||||
array(
|
||||
'core-custom:',
|
||||
'core-profile:',
|
||||
'plugin-custom:',
|
||||
'plugin-profile:'
|
||||
),
|
||||
array(
|
||||
e_FILE.'e_url/custom/core/',
|
||||
e_FILE.'e_url/core/'.$section.'/',
|
||||
e_FILE.'e_url/custom/plugin/',
|
||||
e_PLUGIN.$section.'/e_url/',
|
||||
),
|
||||
$pref['url_config'][$section]
|
||||
);
|
||||
$fileName = $filePath.'/'.$urlType.'.php';
|
||||
var_dump('FileName: '.$fileName, $handler);
|
||||
if (is_readable($fileName))
|
||||
{
|
||||
include_once ($fileName);
|
||||
@@ -81,22 +111,12 @@ class eURL
|
||||
{
|
||||
return $handler;
|
||||
}
|
||||
// Search for custom url config released with the plugin
|
||||
if (!$core)
|
||||
{
|
||||
$fileName = e_PLUGIN."{$section}/url/custom/{$urlType}.php";
|
||||
if (is_readable($fileName))
|
||||
{
|
||||
include_once ($fileName);
|
||||
}
|
||||
if (function_exists($handler))
|
||||
{
|
||||
return $handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Search the default url config - the last station
|
||||
$fileName = ($core ? e_FILE."url/base/{$handlerId}.php" : e_PLUGIN."{$section}/url/{$urlType}.php");
|
||||
|
||||
//Search the default url config - the last station
|
||||
$core = ($type === 'core');
|
||||
$handlerId = $section . '/' . $urlType;
|
||||
$fileName = ($core ? e_FILE."url/core/{$handlerId}.php" : e_PLUGIN."{$section}/url/{$urlType}.php");
|
||||
if (is_readable($fileName))
|
||||
{
|
||||
include_once ($fileName);
|
||||
@@ -111,17 +131,17 @@ class eURL
|
||||
$e107->url->getCoreUser('user', array('id' => 10));
|
||||
|
||||
function __call($method, $arguments) {
|
||||
if (strpos($method, "getCore") === 0)
|
||||
{
|
||||
$section = strtolower(substr($method, 7));
|
||||
return $this->getCoreUrl($section, varset($arguments[0]), varset($arguments[1]));
|
||||
}
|
||||
elseif (strpos($method, "get") === 0)
|
||||
{
|
||||
$section = strtolower(substr($method, 3));
|
||||
return $this->getUrl($section, varset($arguments[0]), varset($arguments[1]));
|
||||
}
|
||||
return '';
|
||||
if (strpos($method, "getCore") === 0)
|
||||
{
|
||||
$section = strtolower(substr($method, 7));
|
||||
return $this->getCoreUrl($section, varset($arguments[0]), varset($arguments[1]));
|
||||
}
|
||||
elseif (strpos($method, "get") === 0)
|
||||
{
|
||||
$section = strtolower(substr($method, 3));
|
||||
return $this->getUrl($section, varset($arguments[0]), varset($arguments[1]));
|
||||
}
|
||||
return '';
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
Reference in New Issue
Block a user