Files
@ 1db340eef40b
Branch filter:
Location: hot67beta/plugins/system/legacy.php
1db340eef40b
12.9 KiB
text/x-php
add mtop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | <?php
/**
* @version $Id: legacy.php 11299 2008-11-22 01:40:44Z 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' );
jimport( 'joomla.plugin.plugin' );
/**
* Joomla! Debug plugin
*
* @package Joomla
* @subpackage System
*/
class plgSystemLegacy extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/
function plgSystemLegacy(& $subject, $config)
{
parent::__construct($subject, $config);
global $mainframe;
// Define the 1.0 legacy mode constant
define('_JLEGACY', '1.0');
// Set global configuration var for legacy mode
$config = &JFactory::getConfig();
$config->setValue('config.legacy', 1);
// Import library dependencies
require_once(dirname(__FILE__).DS.'legacy'.DS.'classes.php');
require_once(dirname(__FILE__).DS.'legacy'.DS.'functions.php');
// Register legacy classes for autoloading
JLoader::register('mosAdminMenus' , dirname(__FILE__).DS.'legacy'.DS.'adminmenus.php');
JLoader::register('mosCache' , dirname(__FILE__).DS.'legacy'.DS.'cache.php');
JLoader::register('mosCategory' , dirname(__FILE__).DS.'legacy'.DS.'category.php');
JLoader::register('mosCommonHTML' , dirname(__FILE__).DS.'legacy'.DS.'commonhtml.php');
JLoader::register('mosComponent' , dirname(__FILE__).DS.'legacy'.DS.'component.php');
JLoader::register('mosContent' , dirname(__FILE__).DS.'legacy'.DS.'content.php');
JLoader::register('mosDBTable' , dirname(__FILE__).DS.'legacy'.DS.'dbtable.php');
JLoader::register('mosHTML' , dirname(__FILE__).DS.'legacy'.DS.'html.php');
JLoader::register('mosInstaller' , dirname(__FILE__).DS.'legacy'.DS.'installer.php');
JLoader::register('mosMainFrame' , dirname(__FILE__).DS.'legacy'.DS.'mainframe.php');
JLoader::register('mosMambot' , dirname(__FILE__).DS.'legacy'.DS.'mambot.php');
JLoader::register('mosMambotHandler', dirname(__FILE__).DS.'legacy'.DS.'mambothandler.php');
JLoader::register('mosMenu' , dirname(__FILE__).DS.'legacy'.DS.'menu.php');
JLoader::register('mosMenuBar' , dirname(__FILE__).DS.'legacy'.DS.'menubar.php');
JLoader::register('mosModule' , dirname(__FILE__).DS.'legacy'.DS.'module.php');
//JLoader::register('mosPageNav' , dirname(__FILE__).DS.'legacy'.DS.'pagination.php');
JLoader::register('mosParameters' , dirname(__FILE__).DS.'legacy'.DS.'parameters.php');
JLoader::register('patFactory' , dirname(__FILE__).DS.'legacy'.DS.'patfactory.php');
JLoader::register('mosProfiler' , dirname(__FILE__).DS.'legacy'.DS.'profiler.php');
JLoader::register('mosSection' , dirname(__FILE__).DS.'legacy'.DS.'section.php');
JLoader::register('mosSession' , dirname(__FILE__).DS.'legacy'.DS.'session.php');
JLoader::register('mosToolbar' , dirname(__FILE__).DS.'legacy'.DS.'toolbar.php');
JLoader::register('mosUser' , dirname(__FILE__).DS.'legacy'.DS.'user.php');
// Register class for the database, depends on which db type has been selected for use
$dbtype = $config->getValue('config.dbtype', 'mysql');
JLoader::register('database' , dirname(__FILE__).DS.'legacy'.DS.$dbtype.'.php');
/**
* Legacy define, _ISO define not used anymore. All output is forced as utf-8.
* @deprecated As of version 1.5
*/
define('_ISO','charset=utf-8');
/**
* Legacy constant, use _JEXEC instead
* @deprecated As of version 1.5
*/
define( '_VALID_MOS', 1 );
/**
* Legacy constant, use _JEXEC instead
* @deprecated As of version 1.5
*/
define( '_MOS_MAMBO_INCLUDED', 1 );
/**
* Legacy constant, use DATE_FORMAT_LC instead
* @deprecated As of version 1.5
*/
DEFINE('_DATE_FORMAT_LC', JText::_('DATE_FORMAT_LC1') ); //Uses PHP's strftime Command Format
/**
* Legacy constant, use DATE_FORMAT_LC2 instead
* @deprecated As of version 1.5
*/
DEFINE('_DATE_FORMAT_LC2', JText::_('DATE_FORMAT_LC2'));
/**
* Legacy constant, use JFilterInput instead
* @deprecated As of version 1.5
*/
DEFINE( "_MOS_NOTRIM", 0x0001 );
/**
* Legacy constant, use JFilterInput instead
* @deprecated As of version 1.5
*/
DEFINE( "_MOS_ALLOWHTML", 0x0002 );
/**
* Legacy constant, use JFilterInput instead
* @deprecated As of version 1.5
*/
DEFINE( "_MOS_ALLOWRAW", 0x0004 );
/**
* Legacy global, use JVersion->getLongVersion() instead
* @name $_VERSION
* @deprecated As of version 1.5
*/
$GLOBALS['_VERSION'] = new JVersion();
$version = $GLOBALS['_VERSION']->getLongVersion();
/**
* Legacy global, use JFactory::getDBO() instead
* @name $database
* @deprecated As of version 1.5
*/
$conf =& JFactory::getConfig();
$GLOBALS['database'] = new database($conf->getValue('config.host'), $conf->getValue('config.user'), $conf->getValue('config.password'), $conf->getValue('config.db'), $conf->getValue('config.dbprefix'));
$GLOBALS['database']->debug($conf->getValue('config.debug'));
/**
* Legacy global, use JFactory::getUser() [JUser object] instead
* @name $my
* @deprecated As of version 1.5
*/
$user =& JFactory::getUser();
$GLOBALS['my'] = (object)$user->getProperties();
$GLOBALS['my']->gid = $user->get('aid', 0);
/**
* Insert configuration values into global scope (for backwards compatibility)
* @deprecated As of version 1.5
*/
$temp = new JConfig;
foreach (get_object_vars($temp) as $k => $v) {
$name = 'mosConfig_'.$k;
$GLOBALS[$name] = $v;
}
$GLOBALS['mosConfig_live_site'] = substr_replace(JURI::root(), '', -1, 1);
$GLOBALS['mosConfig_absolute_path'] = JPATH_SITE;
$GLOBALS['mosConfig_cachepath'] = JPATH_BASE.DS.'cache';
$GLOBALS['mosConfig_offset_user'] = 0;
$lang =& JFactory::getLanguage();
$GLOBALS['mosConfig_lang'] = $lang->getBackwardLang();
$config->setValue('config.live_site', $GLOBALS['mosConfig_live_site']);
$config->setValue('config.absolute_path', $GLOBALS['mosConfig_absolute_path']);
$config->setValue('config.lang', $GLOBALS['mosConfig_lang']);
/**
* Legacy global, use JFactory::getUser() instead
* @name $acl
* @deprecated As of version 1.5
*/
$acl =& JFactory::getACL();
// Legacy ACL's for backward compat
$acl->addACL( 'administration', 'edit', 'users', 'super administrator', 'components', 'all' );
$acl->addACL( 'administration', 'edit', 'users', 'administrator', 'components', 'all' );
$acl->addACL( 'administration', 'edit', 'users', 'super administrator', 'user properties', 'block_user' );
$acl->addACL( 'administration', 'manage', 'users', 'super administrator', 'components', 'com_users' );
$acl->addACL( 'administration', 'manage', 'users', 'administrator', 'components', 'com_users' );
$acl->addACL( 'administration', 'config', 'users', 'super administrator' );
//$acl->addACL( 'administration', 'config', 'users', 'administrator' );
$acl->addACL( 'action', 'add', 'users', 'author', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'editor', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'publisher', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'author', 'content', 'own' );
$acl->addACL( 'action', 'edit', 'users', 'editor', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'publisher', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'publisher', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'manager', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'manager', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'manager', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'administrator', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'administrator', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'administrator', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'super administrator', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'super administrator', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'super administrator', 'content', 'all' );
$acl->addACL( 'com_syndicate', 'manage', 'users', 'super administrator' );
$acl->addACL( 'com_syndicate', 'manage', 'users', 'administrator' );
$acl->addACL( 'com_syndicate', 'manage', 'users', 'manager' );
$GLOBALS['acl'] =& $acl;
/**
* Legacy global
* @name $task
* @deprecated As of version 1.5
*/
$GLOBALS['task'] = JRequest::getString('task');
/**
* Load the site language file (the old way - to be deprecated)
* @deprecated As of version 1.5
*/
global $mosConfig_lang;
$mosConfig_lang = JFilterInput::clean($mosConfig_lang, 'cmd');
$file = JPATH_SITE.DS.'language'.DS.$mosConfig_lang.'.php';
if (file_exists( $file )) {
require_once( $file);
} else {
$file = JPATH_SITE.DS.'language'.DS.'english.php';
if (file_exists( $file )) {
require_once( $file );
}
}
/**
* Legacy global
* use JApplicaiton->registerEvent and JApplication->triggerEvent for event handling
* use JPlugingHelper::importPlugin to load bot code
* @deprecated As of version 1.5
*/
$GLOBALS['_MAMBOTS'] = new mosMambotHandler();
$mosmsg = JRequest::getVar( 'mosmsg' );
$mainframe->enqueueMessage( $mosmsg );
}
/**
* Fixes the $my global if the user was restored by the remember me plugin
*/
function onAfterInitialise()
{
$user =& JFactory::getUser();
if ($user->id) {
if ($GLOBALS['my']->id === 0) {
$GLOBALS['my'] = (object)$user->getProperties();
$GLOBALS['my']->gid = $user->get('aid', 0);
}
}
return true;
}
function onAfterRoute()
{
global $mainframe;
if ($mainframe->isAdmin()) {
return;
}
switch(JRequest::getCmd('option'))
{
case 'com_content' :
$this->routeContent();
break;
case 'com_newsfeeds' :
$this->routeNewsfeeds();
break;
case 'com_weblinks' :
$this->routeWeblinks();
break;
case 'com_frontpage' :
JRequest::setVar('option', 'com_content');
JRequest::setVar('view', 'frontpage');
break;
case 'com_login' :
JRequest::setVar('option', 'com_user');
JRequest::setVar('view', 'login');
break;
case 'com_registration' :
JRequest::setVar('option', 'com_user');
JRequest::setVar('view', 'register');
break;
}
/**
* Legacy global, use JApplication::getTemplate() instead
* @name $cur_template
* @deprecated As of version 1.5
*/
$GLOBALS['cur_template'] = $mainframe->getTemplate();
}
function routeContent()
{
$viewName = JRequest::getCmd( 'view', 'article' );
$layout = JRequest::getCmd( 'layout', 'default' );
// interceptors to support legacy urls
switch( JRequest::getCmd('task'))
{
//index.php?option=com_content&task=x&id=x&Itemid=x
case 'blogsection':
$viewName = 'section';
$layout = 'blog';
break;
case 'section':
$viewName = 'section';
break;
case 'category':
$viewName = 'category';
break;
case 'blogcategory':
$viewName = 'category';
$layout = 'blog';
break;
case 'archivesection':
case 'archivecategory':
$viewName = 'archive';
break;
case 'frontpage' :
$viewName = 'frontpage';
break;
case 'view':
$viewName = 'article';
break;
}
JRequest::setVar('layout', $layout);
JRequest::setVar('view', $viewName);
}
function routeNewsfeeds()
{
$viewName = JRequest::getCmd( 'view', 'categories' );
// interceptors to support legacy urls
switch( JRequest::getCmd('task'))
{
//index.php?option=com_newsfeeds&task=x&catid=xid=x&Itemid=x
case 'view':
$viewName = 'newsfeed';
break;
default:
{
if(JRequest::getInt('catid') && !JRequest::getCmd('view')) {
$viewName = 'category';
}
}
}
JRequest::setVar('view', $viewName);
}
function routeWeblinks()
{
$viewName = JRequest::getCmd( 'view', 'categories' );
// interceptors to support legacy urls
switch( JRequest::getCmd('task'))
{
//index.php?option=com_weblinks&task=x&catid=xid=x
case 'view':
$viewName = 'weblink';
break;
default:
{
if(($catid = JRequest::getInt('catid')) && !JRequest::getCmd('view')) {
$viewName = 'category';
JRequest::setVar('id', $catid);
}
}
}
JRequest::setVar('view', $viewName);
}
}
|