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