PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/administrator/index2.php

https://bitbucket.org/dgough/annamaria-daneswood-25102012
PHP | 117 lines | 67 code | 22 blank | 28 comment | 29 complexity | 69b5daa7968e606e788e7c0901d84415 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @version $Id: index2.php 6022 2006-12-18 22:30:07Z friesengeist $
  4. * @package Joomla
  5. * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
  6. * @license http://www.gnu.org/copyleft/gpl.html 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. // Set flag that this is a parent file
  14. define( '_VALID_MOS', 1 );
  15. //ini_set('display_errors','On');
  16. //error_reporting(E_ALL);
  17. if (!file_exists( '../configuration.php' )) {
  18. header( 'Location: ../installation/index.php' );
  19. exit();
  20. }
  21. require( '../globals.php' );
  22. require( '../configuration.php' );
  23. // SSL check - $http_host returns <live site url>:<port number if it is 443>
  24. $http_host = explode(':', $_SERVER['HTTP_HOST'] );
  25. if( (!empty( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) != 'off' || isset( $http_host[1] ) && $http_host[1] == 443) && substr( $mosConfig_live_site, 0, 8 ) != 'https://' ) {
  26. $mosConfig_live_site = 'https://'.substr( $mosConfig_live_site, 7 );
  27. }
  28. require_once( $mosConfig_absolute_path . '/includes/joomla.php' );
  29. include_once( $mosConfig_absolute_path . '/language/'. $mosConfig_lang .'.php' );
  30. require_once( $mosConfig_absolute_path . '/administrator/includes/admin.php' );
  31. // must start the session before we create the mainframe object
  32. session_name( md5( $mosConfig_live_site ) );
  33. session_start();
  34. $option = strval( strtolower( mosGetParam( $_REQUEST, 'option', '' ) ) );
  35. $task = strval( mosGetParam( $_REQUEST, 'task', '' ) );
  36. // mainframe is an API workhorse, lots of 'core' interaction routines
  37. $mainframe = new mosMainFrame( $database, $option, '..', true );
  38. // admin session handling
  39. $my = $mainframe->initSessionAdmin( $option, $task );
  40. // initialise some common request directives
  41. $act = strtolower( mosGetParam( $_REQUEST, 'act', '' ) );
  42. $section = mosGetParam( $_REQUEST, 'section', '' );
  43. $no_html = intval( mosGetParam( $_REQUEST, 'no_html', 0 ) );
  44. $id = intval( mosGetParam( $_REQUEST, 'id', 0 ) );
  45. $cur_template = $mainframe->getTemplate();
  46. // default admin homepage
  47. if ($option == '') {
  48. $option = 'com_admin';
  49. }
  50. //Check if the logged in user is being logged out
  51. if($option == 'com_users' && $task == 'flogout' && $id == $my->id){
  52. //Remove the admin login cookie
  53. setcookie('admin_login','', time() - 3600);
  54. }
  55. // set for overlib check
  56. $mainframe->set( 'loadOverlib', false );
  57. // precapture the output of the component
  58. require_once( $mosConfig_absolute_path . '/editor/editor.php' );
  59. ob_start();
  60. if ($path = $mainframe->getPath( 'admin' )) {
  61. require_once ( $path );
  62. } else {
  63. ?>
  64. <img src="images/joomla_logo_black.jpg" border="0" alt="<?php echo 'Joomla! Logo'; ?>" />
  65. <br />
  66. <?php
  67. }
  68. $_MOS_OPTION['buffer'] = ob_get_contents();
  69. ob_end_clean();
  70. initGzip();
  71. // start the html output
  72. if ($no_html == 0) {
  73. // loads template file
  74. if ( !file_exists( $mosConfig_absolute_path .'/administrator/templates/'. $cur_template .'/index.php' ) ) {
  75. echo 'TEMPLATE '. $cur_template .' NOT FOUND' ;
  76. } else {
  77. require_once( $mosConfig_absolute_path .'/administrator/templates/'. $cur_template .'/index.php' );
  78. }
  79. } else {
  80. mosMainBody_Admin();
  81. }
  82. // displays queries performed for page
  83. if ($mosConfig_debug) {
  84. echo $database->_ticker . ' queries executed';
  85. echo '<pre>';
  86. foreach ($database->_log as $k=>$sql) {
  87. echo $k+1 . "\n" . $sql . '<hr />';
  88. }
  89. }
  90. // if task action is 'save' or 'apply' redo session check
  91. if ( $task == 'save' || $task == 'apply' ) {
  92. $mainframe->initSessionAdmin( $option, '' );
  93. }
  94. doGzip();
  95. ?>