添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@227 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: HTML_toolbar.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
*/
|
||||
require_once( dirname(__FILE__).'/../plugins/system/legacy/toolbar.php' );
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: database.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
require_once( dirname(__FILE__) .'/../libraries/loader.php' );
|
||||
|
||||
jimport( 'joomla.database.database' );
|
||||
jimport( 'joomla.database.database.mysql' );
|
||||
/**
|
||||
* Legacy class, derive from JDatabase instead.
|
||||
*
|
||||
* @package Joomla
|
||||
* @deprecated As of version 1.5
|
||||
*/
|
||||
class database extends JDatabase {
|
||||
function __construct ($host='localhost', $user, $pass, $db='', $table_prefix='', $offline = true) {
|
||||
parent::__construct( 'mysql', $host, $user, $pass, $db, $table_prefix );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: defines.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
/**
|
||||
* Joomla! Application define
|
||||
*/
|
||||
|
||||
//Global definitions
|
||||
//Joomla framework path definitions
|
||||
$parts = explode( DS, JPATH_BASE );
|
||||
|
||||
//Defines
|
||||
define( 'JPATH_ROOT', implode( DS, $parts ) );
|
||||
|
||||
define( 'JPATH_SITE', JPATH_ROOT );
|
||||
define( 'JPATH_CONFIGURATION', JPATH_ROOT );
|
||||
define( 'JPATH_ADMINISTRATOR', JPATH_ROOT.DS.'administrator' );
|
||||
define( 'JPATH_XMLRPC', JPATH_ROOT.DS.'xmlrpc' );
|
||||
define( 'JPATH_LIBRARIES', JPATH_ROOT.DS.'libraries' );
|
||||
define( 'JPATH_PLUGINS', JPATH_ROOT.DS.'plugins' );
|
||||
define( 'JPATH_INSTALLATION', JPATH_ROOT.DS.'installation' );
|
||||
define( 'JPATH_THEMES' , JPATH_BASE.DS.'templates' );
|
||||
define( 'JPATH_CACHE', JPATH_BASE.DS.'cache');
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: feedcreator.class.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
*/
|
||||
require_once( dirname(__FILE__) .'/../libraries/bitfolge/feedcreator.php' );
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: footer.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$version = new JVersion();
|
||||
|
||||
// NOTE - You may change this file to suit your site needs
|
||||
?>
|
||||
<div align="center">
|
||||
© <?php echo JHTML::_('date', 'now', '%Y' ) . ' ' . $mainframe->getCfg('sitename'); ?>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<?php echo $version->URL; ?>
|
||||
</div>
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: framework.php 12584 2009-07-30 17:46:47Z ian $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
/*
|
||||
* Joomla! system checks
|
||||
*/
|
||||
|
||||
@set_magic_quotes_runtime( 0 );
|
||||
@ini_set('zend.ze1_compatibility_mode', '0');
|
||||
|
||||
/*
|
||||
* Installation check, and check on removal of the install directory.
|
||||
*/
|
||||
if (!file_exists( JPATH_CONFIGURATION . DS . 'configuration.php' ) || (filesize( JPATH_CONFIGURATION . DS . 'configuration.php' ) < 10) || file_exists( JPATH_INSTALLATION . DS . 'index.php' )) {
|
||||
if( file_exists( JPATH_INSTALLATION . DS . 'index.php' ) ) {
|
||||
header( 'Location: installation/index.php' );
|
||||
exit();
|
||||
} else {
|
||||
echo 'No configuration file found and no installation code available. Exiting...';
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Joomla! system startup
|
||||
*/
|
||||
|
||||
// System includes
|
||||
require_once( JPATH_LIBRARIES .DS.'joomla'.DS.'import.php');
|
||||
|
||||
// Pre-Load configuration
|
||||
require_once( JPATH_CONFIGURATION .DS.'configuration.php' );
|
||||
|
||||
// System configuration
|
||||
$CONFIG = new JConfig();
|
||||
|
||||
if (@$CONFIG->error_reporting === 0) {
|
||||
error_reporting( 0 );
|
||||
} else if (@$CONFIG->error_reporting > 0) {
|
||||
error_reporting( $CONFIG->error_reporting );
|
||||
ini_set( 'display_errors', 1 );
|
||||
}
|
||||
|
||||
define( 'JDEBUG', $CONFIG->debug );
|
||||
|
||||
unset( $CONFIG );
|
||||
|
||||
/*
|
||||
* Joomla! framework loading
|
||||
*/
|
||||
|
||||
// Include object abstract class
|
||||
require_once(JPATH_SITE.DS.'libraries'.DS.'joomla'.DS.'utilities'.DS.'compat'.DS.'compat.php');
|
||||
|
||||
// System profiler
|
||||
if (JDEBUG) {
|
||||
jimport( 'joomla.error.profiler' );
|
||||
$_PROFILER =& JProfiler::getInstance( 'Application' );
|
||||
}
|
||||
|
||||
// Joomla! library imports;
|
||||
jimport( 'joomla.application.menu' );
|
||||
jimport( 'joomla.user.user');
|
||||
jimport( 'joomla.environment.uri' );
|
||||
jimport( 'joomla.html.html' );
|
||||
jimport( 'joomla.utilities.utility' );
|
||||
jimport( 'joomla.event.event');
|
||||
jimport( 'joomla.event.dispatcher');
|
||||
jimport( 'joomla.language.language');
|
||||
jimport( 'joomla.utilities.string' );
|
||||
?>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: gacl.class.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
*/
|
||||
require_once( dirname(__FILE__) .'/../libraries/phpgacl/gacl.php' );
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: gacl_api.class.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
*/
|
||||
require_once( dirname(__FILE__) .'/../libraries/phpgacl/gacl_api.php' );
|
||||
@@ -0,0 +1,4 @@
|
||||
<html>
|
||||
<body bgcolor="#FFFFFF">
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: joomla.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
*/
|
||||
require_once( dirname( __FILE__ ) . '/application.php' );
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: mambo.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
*/
|
||||
require_once( dirname( __FILE__ ) . '/application.php' );
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: mamboxml.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
*/
|
||||
require_once( dirname(__FILE__) . '/../libraries/joomla/html/parameter.php' );
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: menu.php 8682 2007-08-31 18:36:45Z jinx $
|
||||
* @package Joomla.Framework
|
||||
* @subpackage Application
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
/**
|
||||
* JMenu class
|
||||
*
|
||||
* @package Joomla.Framework
|
||||
* @subpackage Application
|
||||
* @since 1.5
|
||||
*/
|
||||
class JMenuSite extends JMenu
|
||||
{
|
||||
/**
|
||||
* Loads the entire menu table into memory
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function load()
|
||||
{
|
||||
|
||||
$cache = &JFactory::getCache('_system', 'output');
|
||||
|
||||
if (!$data = $cache->get('menu_items')) {
|
||||
// Initialize some variables
|
||||
$db = & JFactory::getDBO();
|
||||
|
||||
$sql = 'SELECT m.*, c.`option` as component' .
|
||||
' FROM #__menu AS m' .
|
||||
' LEFT JOIN #__components AS c ON m.componentid = c.id'.
|
||||
' WHERE m.published = 1'.
|
||||
' ORDER BY m.sublevel, m.parent, m.ordering';
|
||||
$db->setQuery($sql);
|
||||
|
||||
if (!($menus = $db->loadObjectList('id'))) {
|
||||
JError::raiseWarning('SOME_ERROR_CODE', "Error loading Menus: ".$db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach($menus as $key => $menu)
|
||||
{
|
||||
//Get parent information
|
||||
$parent_route = '';
|
||||
$parent_tree = array();
|
||||
if(($parent = $menus[$key]->parent) && (isset($menus[$parent])) &&
|
||||
(is_object($menus[$parent])) && (isset($menus[$parent]->route)) && isset($menus[$parent]->tree)) {
|
||||
$parent_route = $menus[$parent]->route.'/';
|
||||
$parent_tree = $menus[$parent]->tree;
|
||||
}
|
||||
|
||||
//Create tree
|
||||
array_push($parent_tree, $menus[$key]->id);
|
||||
$menus[$key]->tree = $parent_tree;
|
||||
|
||||
//Create route
|
||||
$route = $parent_route.$menus[$key]->alias;
|
||||
$menus[$key]->route = $route;
|
||||
|
||||
//Create the query array
|
||||
$url = str_replace('index.php?', '', $menus[$key]->link);
|
||||
if(strpos($url, '&') !== false)
|
||||
{
|
||||
$url = str_replace('&','&',$url);
|
||||
}
|
||||
|
||||
parse_str($url, $menus[$key]->query);
|
||||
}
|
||||
|
||||
$cache->store(serialize($menus), 'menu_items');
|
||||
$this->_items = $menus;
|
||||
} else {
|
||||
$this->_items = unserialize($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: pageNavigation.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
*/
|
||||
require_once( dirname(__FILE__) .'/../plugins/system/legacy/pagination.php' );
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: pathway.php 10752 2008-08-23 01:53:31Z eddieajau $
|
||||
* @package Joomla.Framework
|
||||
* @subpackage Application
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
/**
|
||||
* Class to manage the site application pathway
|
||||
*
|
||||
* @package Joomla
|
||||
* @since 1.5
|
||||
*/
|
||||
class JPathwaySite extends JPathway
|
||||
{
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
function __construct($options = array())
|
||||
{
|
||||
//Initialise the array
|
||||
$this->_pathway = array();
|
||||
|
||||
$menu =& JSite::getMenu();
|
||||
|
||||
if($item = $menu->getActive())
|
||||
{
|
||||
$menus = $menu->getMenu();
|
||||
$home = $menu->getDefault();
|
||||
|
||||
if(is_object($home) && ($item->id != $home->id))
|
||||
{
|
||||
foreach($item->tree as $menupath)
|
||||
{
|
||||
$url = '';
|
||||
$link = $menu->getItem($menupath);
|
||||
|
||||
switch($link->type)
|
||||
{
|
||||
case 'menulink' :
|
||||
case 'url' :
|
||||
$url = $link->link;
|
||||
break;
|
||||
case 'separator' :
|
||||
$url = null;
|
||||
break;
|
||||
default :
|
||||
$url = 'index.php?Itemid='.$link->id;
|
||||
}
|
||||
|
||||
$this->addItem( $menus[$menupath]->name, $url);
|
||||
|
||||
} // end foreach
|
||||
}
|
||||
} // end if getActive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,453 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: router.php 8180 2007-07-23 05:52:29Z eddieajau $
|
||||
* @package Joomla.Framework
|
||||
* @subpackage Application
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
/**
|
||||
* Class to create and parse routes for the site application
|
||||
*
|
||||
* @package Joomla
|
||||
* @since 1.5
|
||||
*/
|
||||
class JRouterSite extends JRouter
|
||||
{
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function __construct($options = array()) {
|
||||
parent::__construct($options);
|
||||
}
|
||||
|
||||
function parse(&$uri)
|
||||
{
|
||||
$vars = array();
|
||||
|
||||
// Get the application
|
||||
$app =& JFactory::getApplication();
|
||||
|
||||
if($app->getCfg('force_ssl') == 2 && strtolower($uri->getScheme()) != 'https') {
|
||||
//forward to https
|
||||
$uri->setScheme('https');
|
||||
$app->redirect($uri->toString());
|
||||
}
|
||||
|
||||
|
||||
// Get the path
|
||||
$path = $uri->getPath();
|
||||
|
||||
//Remove the suffix
|
||||
if($this->_mode == JROUTER_MODE_SEF)
|
||||
{
|
||||
|
||||
if($app->getCfg('sef_suffix') && !(substr($path, -9) == 'index.php' || substr($path, -1) == '/'))
|
||||
{
|
||||
if($suffix = pathinfo($path, PATHINFO_EXTENSION))
|
||||
{
|
||||
$path = str_replace('.'.$suffix, '', $path);
|
||||
$vars['format'] = $suffix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Remove basepath
|
||||
$path = substr_replace($path, '', 0, strlen(JURI::base(true)));
|
||||
|
||||
//Remove prefix
|
||||
$path = str_replace('index.php', '', $path);
|
||||
|
||||
//Set the route
|
||||
$uri->setPath(trim($path , '/'));
|
||||
|
||||
$vars += parent::parse($uri);
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
function &build($url)
|
||||
{
|
||||
$uri =& parent::build($url);
|
||||
|
||||
// Get the path data
|
||||
$route = $uri->getPath();
|
||||
|
||||
//Add the suffix to the uri
|
||||
if($this->_mode == JROUTER_MODE_SEF && $route)
|
||||
{
|
||||
$app =& JFactory::getApplication();
|
||||
|
||||
if($app->getCfg('sef_suffix') && !(substr($route, -9) == 'index.php' || substr($route, -1) == '/'))
|
||||
{
|
||||
if($format = $uri->getVar('format', 'html'))
|
||||
{
|
||||
$route .= '.'.$format;
|
||||
$uri->delVar('format');
|
||||
}
|
||||
}
|
||||
|
||||
if($app->getCfg('sef_rewrite'))
|
||||
{
|
||||
//Transform the route
|
||||
$route = str_replace('index.php/', '', $route);
|
||||
}
|
||||
}
|
||||
|
||||
//Add basepath to the uri
|
||||
$uri->setPath(JURI::base(true).'/'.$route);
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
function _parseRawRoute(&$uri)
|
||||
{
|
||||
$vars = array();
|
||||
|
||||
$menu =& JSite::getMenu(true);
|
||||
|
||||
//Handle an empty URL (special case)
|
||||
if(!$uri->getVar('Itemid') && !$uri->getVar('option'))
|
||||
{
|
||||
$item = $menu->getDefault();
|
||||
if(!is_object($item)) return $vars; // No default item set
|
||||
|
||||
//Set the information in the request
|
||||
$vars = $item->query;
|
||||
|
||||
//Get the itemid
|
||||
$vars['Itemid'] = $item->id;
|
||||
|
||||
// Set the active menu item
|
||||
$menu->setActive($vars['Itemid']);
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
//Get the variables from the uri
|
||||
$this->setVars($uri->getQuery(true));
|
||||
|
||||
//Get the itemid, if it hasn't been set force it to null
|
||||
$this->setVar('Itemid', JRequest::getInt('Itemid', null));
|
||||
|
||||
//Only an Itemid ? Get the full information from the itemid
|
||||
if(count($this->getVars()) == 1)
|
||||
{
|
||||
$item = $menu->getItem($this->getVar('Itemid'));
|
||||
$vars = $vars + $item->query;
|
||||
}
|
||||
|
||||
// Set the active menu item
|
||||
$menu->setActive($this->getVar('Itemid'));
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
function _parseSefRoute(&$uri)
|
||||
{
|
||||
$vars = array();
|
||||
|
||||
$menu =& JSite::getMenu(true);
|
||||
$route = $uri->getPath();
|
||||
|
||||
//Get the variables from the uri
|
||||
$vars = $uri->getQuery(true);
|
||||
|
||||
//Handle an empty URL (special case)
|
||||
if(empty($route))
|
||||
{
|
||||
|
||||
//If route is empty AND option is set in the query, assume it's non-sef url, and parse apropriately
|
||||
if(isset($vars['option']) || isset($vars['Itemid'])) {
|
||||
return $this->_parseRawRoute($uri);
|
||||
}
|
||||
|
||||
$item = $menu->getDefault();
|
||||
|
||||
//Set the information in the request
|
||||
$vars = $item->query;
|
||||
|
||||
//Get the itemid
|
||||
$vars['Itemid'] = $item->id;
|
||||
|
||||
// Set the active menu item
|
||||
$menu->setActive($vars['Itemid']);
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse the application route
|
||||
*/
|
||||
|
||||
if(substr($route, 0, 9) == 'component')
|
||||
{
|
||||
$segments = explode('/', $route);
|
||||
$route = str_replace('component/'.$segments[1], '', $route);
|
||||
|
||||
$vars['option'] = 'com_'.$segments[1];
|
||||
$vars['Itemid'] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Need to reverse the array (highest sublevels first)
|
||||
$items = array_reverse($menu->getMenu());
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$lenght = strlen($item->route); //get the lenght of the route
|
||||
|
||||
if($lenght > 0 && strpos($route.'/', $item->route.'/') === 0 && $item->type != 'menulink')
|
||||
{
|
||||
$route = substr($route, $lenght);
|
||||
|
||||
$vars['Itemid'] = $item->id;
|
||||
$vars['option'] = $item->component;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the active menu item
|
||||
if ( isset($vars['Itemid']) ) {
|
||||
$menu->setActive( $vars['Itemid'] );
|
||||
}
|
||||
|
||||
//Set the variables
|
||||
$this->setVars($vars);
|
||||
|
||||
/*
|
||||
* Parse the component route
|
||||
*/
|
||||
if(!empty($route) && isset($this->_vars['option']) )
|
||||
{
|
||||
$segments = explode('/', $route);
|
||||
array_shift($segments);
|
||||
|
||||
// Handle component route
|
||||
$component = preg_replace('/[^A-Z0-9_\.-]/i', '', $this->_vars['option']);
|
||||
|
||||
// Use the component routing handler if it exists
|
||||
$path = JPATH_SITE.DS.'components'.DS.$component.DS.'router.php';
|
||||
|
||||
if (file_exists($path) && count($segments))
|
||||
{
|
||||
if ($component != "com_search") { // Cheap fix on searches
|
||||
//decode the route segments
|
||||
$segments = $this->_decodeSegments($segments);
|
||||
}
|
||||
else { // fix up search for URL
|
||||
$total = count($segments);
|
||||
for($i=0; $i<$total; $i++) {
|
||||
// urldecode twice because it is encoded twice
|
||||
$segments[$i] = urldecode(urldecode(stripcslashes($segments[$i])));
|
||||
}
|
||||
}
|
||||
|
||||
require_once $path;
|
||||
$function = substr($component, 4).'ParseRoute';
|
||||
$vars = $function($segments);
|
||||
|
||||
$this->setVars($vars);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Set active menu item
|
||||
if($item =& $menu->getActive()) {
|
||||
$vars = $item->query;
|
||||
}
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
function _buildRawRoute(&$uri)
|
||||
{
|
||||
}
|
||||
|
||||
function _buildSefRoute(&$uri)
|
||||
{
|
||||
// Get the route
|
||||
$route = $uri->getPath();
|
||||
|
||||
// Get the query data
|
||||
$query = $uri->getQuery(true);
|
||||
|
||||
if(!isset($query['option'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$menu =& JSite::getMenu();
|
||||
|
||||
/*
|
||||
* Build the component route
|
||||
*/
|
||||
$component = preg_replace('/[^A-Z0-9_\.-]/i', '', $query['option']);
|
||||
$tmp = '';
|
||||
|
||||
// Use the component routing handler if it exists
|
||||
$path = JPATH_SITE.DS.'components'.DS.$component.DS.'router.php';
|
||||
|
||||
// Use the custom routing handler if it exists
|
||||
if (file_exists($path) && !empty($query))
|
||||
{
|
||||
require_once $path;
|
||||
$function = substr($component, 4).'BuildRoute';
|
||||
$parts = $function($query);
|
||||
|
||||
// encode the route segments
|
||||
if ($component != "com_search") { // Cheep fix on searches
|
||||
$parts = $this->_encodeSegments($parts);
|
||||
}
|
||||
else { // fix up search for URL
|
||||
$total = count($parts);
|
||||
for($i=0; $i<$total; $i++) {
|
||||
// urlencode twice because it is decoded once after redirect
|
||||
$parts[$i] = urlencode(urlencode(stripcslashes($parts[$i])));
|
||||
}
|
||||
}
|
||||
|
||||
$result = implode('/', $parts);
|
||||
$tmp = ($result != "") ? '/'.$result : '';
|
||||
}
|
||||
|
||||
/*
|
||||
* Build the application route
|
||||
*/
|
||||
$built = false;
|
||||
if (isset($query['Itemid']) && !empty($query['Itemid']))
|
||||
{
|
||||
$item = $menu->getItem($query['Itemid']);
|
||||
|
||||
if (is_object($item) && $query['option'] == $item->component) {
|
||||
$tmp = !empty($tmp) ? $item->route.'/'.$tmp : $item->route;
|
||||
$built = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$built) {
|
||||
$tmp = 'component/'.substr($query['option'], 4).'/'.$tmp;
|
||||
}
|
||||
|
||||
$route .= '/'.$tmp;
|
||||
|
||||
// Unset unneeded query information
|
||||
unset($query['Itemid']);
|
||||
unset($query['option']);
|
||||
|
||||
//Set query again in the URI
|
||||
$uri->setQuery($query);
|
||||
$uri->setPath($route);
|
||||
}
|
||||
|
||||
function _processParseRules(&$uri)
|
||||
{
|
||||
// Process the attached parse rules
|
||||
$vars = parent::_processParseRules($uri);
|
||||
|
||||
// Process the pagination support
|
||||
if($this->_mode == JROUTER_MODE_SEF)
|
||||
{
|
||||
$app =& JFactory::getApplication();
|
||||
|
||||
if($start = $uri->getVar('start'))
|
||||
{
|
||||
$uri->delVar('start');
|
||||
$vars['limitstart'] = $start;
|
||||
}
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
function _processBuildRules(&$uri)
|
||||
{
|
||||
// Make sure any menu vars are used if no others are specified
|
||||
if(($this->_mode != JROUTER_MODE_SEF) && $uri->getVar('Itemid') && count($uri->getQuery(true)) == 2)
|
||||
{
|
||||
$menu =& JSite::getMenu();
|
||||
|
||||
// Get the active menu item
|
||||
$itemid = $uri->getVar('Itemid');
|
||||
$item = $menu->getItem($itemid);
|
||||
|
||||
$uri->setQuery($item->query);
|
||||
$uri->setVar('Itemid', $itemid);
|
||||
}
|
||||
|
||||
// Process the attached build rules
|
||||
parent::_processBuildRules($uri);
|
||||
|
||||
// Get the path data
|
||||
$route = $uri->getPath();
|
||||
|
||||
if($this->_mode == JROUTER_MODE_SEF && $route)
|
||||
{
|
||||
$app =& JFactory::getApplication();
|
||||
|
||||
if ($limitstart = $uri->getVar('limitstart'))
|
||||
{
|
||||
$uri->setVar('start', (int) $limitstart);
|
||||
$uri->delVar('limitstart');
|
||||
}
|
||||
}
|
||||
|
||||
$uri->setPath($route);
|
||||
}
|
||||
|
||||
function &_createURI($url)
|
||||
{
|
||||
//Create the URI
|
||||
$uri =& parent::_createURI($url);
|
||||
|
||||
// Set URI defaults
|
||||
$menu =& JSite::getMenu();
|
||||
|
||||
// Get the itemid form the URI
|
||||
$itemid = $uri->getVar('Itemid');
|
||||
|
||||
if(is_null($itemid))
|
||||
{
|
||||
if($option = $uri->getVar('option'))
|
||||
{
|
||||
$item = $menu->getItem($this->getVar('Itemid'));
|
||||
if(isset($item) && $item->component == $option) {
|
||||
$uri->setVar('Itemid', $item->id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($option = $this->getVar('option')) {
|
||||
$uri->setVar('option', $option);
|
||||
}
|
||||
|
||||
if($itemid = $this->getVar('Itemid')) {
|
||||
$uri->setVar('Itemid', $itemid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$uri->getVar('option'))
|
||||
{
|
||||
$item = $menu->getItem($itemid);
|
||||
$uri->setVar('option', $item->component);
|
||||
}
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy Mode compatibility
|
||||
* @version $Id: vcard.class.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla.Legacy
|
||||
*/
|
||||
require_once( dirname(__FILE__) .'/../libraries/bitfolge/vcard.php' );
|
||||
Reference in New Issue
Block a user