PageRenderTime 57ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/components/com_virtuemart/themes/default/templates/index2.php

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