PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/offline.php

https://bitbucket.org/dgough/annamaria-daneswood-25102012
PHP | 169 lines | 131 code | 13 blank | 25 comment | 22 complexity | 5407c2b7a92a138739ab3a41a59dad7a MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @version $Id: offline.php 6018 2006-12-18 19:04:42Z robs $
  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. // no direct access
  14. defined( '_VALID_MOS' ) or die( 'Restricted access' );
  15. global $database;
  16. global $mosConfig_live_site, $mosConfig_lang;
  17. $adminOffline = false;
  18. if (!defined( '_INSTALL_CHECK' )) {
  19. // this method is different from 1.1 because the session handling is not the same
  20. session_name( md5( $mosConfig_live_site ) );
  21. session_start();
  22. if (class_exists( 'mosUser' )) {
  23. // restore some session variables
  24. $admin = new mosUser( $database );
  25. $admin->id = intval( mosGetParam( $_SESSION, 'session_user_id', '' ) );
  26. $admin->username = strval( mosGetParam( $_SESSION, 'session_username', '' ) );
  27. $admin->usertype = strval( mosGetParam( $_SESSION, 'session_usertype', '' ) );
  28. $session_id = mosGetParam( $_SESSION, 'session_id', '' );
  29. $logintime = mosGetParam( $_SESSION, 'session_logintime', '' );
  30. // check against db record of session
  31. if ($session_id == md5( $admin->id . $admin->username . $admin->usertype . $logintime )) {
  32. $query = "SELECT *"
  33. . "\n FROM #__session"
  34. . "\n WHERE session_id = " . $database->Quote( $session_id )
  35. . "\n AND username = " . $database->Quote( $admin->username )
  36. . "\n AND userid = " . intval( $admin->id )
  37. ;
  38. $database->setQuery( $query );
  39. if (!$result = $database->query()) {
  40. echo $database->stderr();
  41. }
  42. if ($database->getNumRows( $result ) == 1) {
  43. define( '_ADMIN_OFFLINE', 1 );
  44. }
  45. }
  46. }
  47. }
  48. if (!defined( '_ADMIN_OFFLINE' ) || defined( '_INSTALL_CHECK' )) {
  49. @include_once ('language/' . $mosConfig_lang . '.php' );
  50. if( $database != NULL ) {
  51. // get default frontend template
  52. $query = "SELECT template"
  53. . "\n FROM #__templates_menu"
  54. . "\n WHERE client_id = 0"
  55. . "\n AND menuid = 0"
  56. ;
  57. $database->setQuery( $query );
  58. $cur_template = $database->loadResult();
  59. $path = "$mosConfig_absolute_path/templates/$cur_template/index.php";
  60. if (!file_exists( $path )) {
  61. $cur_template = 'rhuk_solarflare_ii';
  62. }
  63. } else {
  64. $cur_template = 'rhuk_solarflare_ii';
  65. }
  66. // needed to seperate the ISO number from the language file constant _ISO
  67. $iso = split( '=', _ISO );
  68. // xml prolog
  69. echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';
  70. ?>
  71. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  72. <html xmlns="http://www.w3.org/1999/xhtml">
  73. <head>
  74. <title><?php echo $mosConfig_sitename; ?> - Offline</title>
  75. <link rel="stylesheet" href="<?php echo $mosConfig_live_site; ?>/templates/css/offline.css" type="text/css" />
  76. <?php
  77. if ( file_exists("$mosConfig_absolute_path/templates/$cur_template/css/offline.css") ) {
  78. ?>
  79. <link rel="stylesheet" href="<?php echo $mosConfig_live_site; ?>/templates/<?php echo $cur_template; ?>/css/offline.css" type="text/css" />
  80. <?php
  81. }
  82. ?>
  83. <?php
  84. // favourites icon
  85. if ( !$mosConfig_favicon ) {
  86. $mosConfig_favicon = 'favicon.ico';
  87. }
  88. $icon = $mosConfig_absolute_path .'/images/'. $mosConfig_favicon;
  89. // checks to see if file exists
  90. if ( !file_exists( $icon ) ) {
  91. $icon = $mosConfig_live_site .'/images/favicon.ico';
  92. } else {
  93. $icon = $mosConfig_live_site .'/images/' .$mosConfig_favicon;
  94. }
  95. ?>
  96. <link rel="shortcut icon" href="<?php echo $icon; ?>" />
  97. <meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
  98. </head>
  99. <body>
  100. <p>&nbsp;</p>
  101. <table width="550" align="center" class="outline">
  102. <?php
  103. /*<tr>
  104. <td width="60%" height="50" align="center">
  105. <img src="<?php echo $mosConfig_live_site; ?>/images/joomla_logo_black.jpg" alt="Joomla! Logo" align="middle" />
  106. </td>
  107. </tr>
  108. */ ?>
  109. <tr>
  110. <td align="center">
  111. <h1>
  112. <?php echo $mosConfig_sitename; ?>
  113. </h1>
  114. </td>
  115. </tr>
  116. <?php
  117. if ( $mosConfig_offline == 1 ) {
  118. ?>
  119. <tr>
  120. <td width="39%" align="center" class='padlock'>
  121. <h2>
  122. <?php echo $mosConfig_offline_message; ?>
  123. </h2>
  124. </td>
  125. </tr>
  126. <?php
  127. } else if (@$mosSystemError) {
  128. ?>
  129. <tr>
  130. <td width="39%" align="center" class='padlock'>
  131. <h2>
  132. <?php echo $mosConfig_error_message; ?>
  133. </h2>
  134. <span class="err"><?php echo defined( '_SYSERR'.$mosSystemError ) ? constant( '_SYSERR'.$mosSystemError ) : $mosSystemError; ?></span>
  135. </td>
  136. </tr>
  137. <?php
  138. } else {
  139. ?>
  140. <tr>
  141. <td width="39%" align="center" class='padlock'>
  142. <h2>
  143. <?php echo _INSTALL_WARN; ?>
  144. </h2>
  145. </td>
  146. </tr>
  147. <?php
  148. }
  149. ?>
  150. </table>
  151. </body>
  152. </html>
  153. <?php
  154. exit( 0 );
  155. }
  156. ?>