pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

paste-bin - collaborative debugging tool View Help


Posted by SteveHH on Sun 1st Jul 07:44
download | new post

  1. <?php
  2. /**
  3. * @version $Id: index.php 4750 2006-08-25 01:08:30Z stingrey $
  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. // checks for Internet Explorer 6
  14. <!--[if IE 6]>
  15. <link href="http:/www.crocodiles-hamburg.de/templates/nf_ianus-red/css/template_css_IE6.css" />
  16. <![endif]-->
  17. // Set flag that this is a parent file
  18. define( '_VALID_MOS', 1 );
  19.  
  20. // checks for configuration file, if none found loads installation page
  21. if (!file_exists( 'configuration.php' ) || filesize( 'configuration.php' ) < 10) {
  22.         $self = str_replace( '/index.php','', strtolower( $_SERVER['PHP_SELF'] ) ). '/';
  23.         header("Location: http://" . $_SERVER['HTTP_HOST'] . $self . "installation/index.php" );
  24.         exit();
  25. }
  26.  
  27. require( 'globals.php' );
  28. require_once( 'configuration.php' );
  29. require_once( 'includes/joomla.php' );
  30.  
  31. //Installation sub folder check, removed for work with SVN
  32. if (file_exists( 'installation/index.php' ) && $_VERSION->SVN == 0) {
  33.         define( '_INSTALL_CHECK', 1 );
  34.         include ( $mosConfig_absolute_path .'/offline.php');
  35.         exit();
  36. }
  37.  
  38. // displays offline/maintanance page or bar
  39. if ($mosConfig_offline == 1) {
  40.         require( $mosConfig_absolute_path .'/offline.php' );
  41. }
  42.  
  43. // load system bot group
  44. $_MAMBOTS->loadBotGroup( 'system' );
  45.  
  46. // trigger the onStart events
  47. $_MAMBOTS->trigger( 'onStart' );
  48.  
  49. if (file_exists( $mosConfig_absolute_path .'/components/com_sef/sef.php' )) {
  50.         require_once( $mosConfig_absolute_path .'/components/com_sef/sef.php' );
  51. } else {
  52.         require_once( $mosConfig_absolute_path .'/includes/sef.php' );
  53. }
  54. require_once( $mosConfig_absolute_path .'/includes/frontend.php' );
  55.  
  56. // retrieve some expected url (or form) arguments
  57. $option = strval( strtolower( mosGetParam( $_REQUEST, 'option' ) ) );
  58. $Itemid = intval( mosGetParam( $_REQUEST, 'Itemid', null ) );
  59.  
  60. if ($option == '') {
  61.         if ($Itemid) {
  62.                 $query = "SELECT id, link"
  63.                 . "\n FROM #__menu"
  64.                 . "\n WHERE menutype = 'mainmenu'"
  65.                 . "\n AND id = '$Itemid'"
  66.                 . "\n AND published = '1'"
  67.                 ;
  68.                 $database->setQuery( $query );
  69.         } else {
  70.                 $query = "SELECT id, link"
  71.                 . "\n FROM #__menu"
  72.                 . "\n WHERE menutype = 'mainmenu'"
  73.                 . "\n AND published = 1"
  74.                 . "\n ORDER BY parent, ordering"
  75.                 ;
  76.                 $database->setQuery( $query, 0, 1 );
  77.         }
  78.         $menu = new mosMenu( $database );
  79.         if ($database->loadObject( $menu )) {
  80.                 $Itemid = $menu->id;
  81.         }
  82.         $link = $menu->link;
  83.         if (($pos = strpos( $link, '?' )) !== false) {
  84.                 $link = substr( $link, $pos+1 ). '&Itemid='.$Itemid;
  85.         }
  86.         parse_str( $link, $temp );
  87.         /** this is a patch, need to rework when globals are handled better */
  88.         foreach ($temp as $k=>$v) {
  89.                 $GLOBALS[$k] = $v;
  90.                 $_REQUEST[$k] = $v;
  91.                 if ($k == 'option') {
  92.                         $option = $v;
  93.                 }
  94.         }
  95. }
  96. if ( !$Itemid ) {
  97. // when no Itemid give a default value
  98.         $Itemid = 99999999;
  99. }
  100.  
  101. // mainframe is an API workhorse, lots of 'core' interaction routines
  102. $mainframe = new mosMainFrame( $database, $option, '.' );
  103. $mainframe->initSession();
  104.  
  105. // trigger the onAfterStart events
  106. $_MAMBOTS->trigger( 'onAfterStart' );
  107.  
  108. // checking if we can find the Itemid thru the content
  109. if ( $option == 'com_content' && $Itemid === 0 ) {
  110.         $id     = intval( mosGetParam( $_REQUEST, 'id', 0 ) );
  111.         $Itemid = $mainframe->getItemid( $id );
  112. }
  113.  
  114. /** do we have a valid Itemid yet?? */
  115. if ( $Itemid === 0 ) {
  116.         /** Nope, just use the homepage then. */
  117.         $query = "SELECT id"
  118.         . "\n FROM #__menu"
  119.         . "\n WHERE menutype = 'mainmenu'"
  120.         . "\n AND published = 1"
  121.         . "\n ORDER BY parent, ordering"
  122.         ;
  123.         $database->setQuery( $query, 0, 1 );
  124.         $Itemid = $database->loadResult();
  125. }
  126.  
  127. // patch to lessen the impact on templates
  128. if ($option == 'search') {
  129.         $option = 'com_search';
  130. }
  131.  
  132. // loads english language file by default
  133. if ($mosConfig_lang=='') {
  134.         $mosConfig_lang = 'english';
  135. }
  136. include_once( $mosConfig_absolute_path .'/language/' . $mosConfig_lang . '.php' );
  137.  
  138. // frontend login & logout controls
  139. $return         = strval( mosGetParam( $_REQUEST, 'return', NULL ) );
  140. $message        = intval( mosGetParam( $_POST, 'message', 0 ) );
  141. if ($option == 'login') {
  142.         $mainframe->login();
  143.  
  144.         // JS Popup message
  145.         if ( $message ) {
  146.                 ?>
  147.                 <script language="javascript" type="text/javascript">
  148.                 <!--//
  149.                 alert( "<?php echo _LOGIN_SUCCESS; ?>" );
  150.                 //-->
  151.                 </script>
  152.                 <?php
  153.         }
  154.  
  155.         if ( $return && !( strpos( $return, 'com_registration' ) || strpos( $return, 'com_login' ) ) ) {
  156.         // checks for the presence of a return url
  157.         // and ensures that this url is not the registration or login pages
  158.                 mosRedirect( $return );
  159.         } else {
  160.                 mosRedirect( $mosConfig_live_site .'/index.php' );
  161.         }
  162.  
  163. } else if ($option == 'logout') {
  164.         $mainframe->logout();
  165.  
  166.         // JS Popup message
  167.         if ( $message ) {
  168.                 ?>
  169.                 <script language="javascript" type="text/javascript">
  170.                 <!--//
  171.                 alert( "<?php echo _LOGOUT_SUCCESS; ?>" );
  172.                 //-->
  173.                 </script>
  174.                 <?php
  175.         }
  176.  
  177.         if ( $return && !( strpos( $return, 'com_registration' ) || strpos( $return, 'com_login' ) ) ) {
  178.         // checks for the presence of a return url
  179.         // and ensures that this url is not the registration or logout pages
  180.                 mosRedirect( $return );
  181.         } else {
  182.                 mosRedirect( $mosConfig_live_site.'/index.php' );
  183.         }
  184. }
  185.  
  186. /** get the information about the current user from the sessions table */
  187. $my = $mainframe->getUser();
  188.  
  189. // detect first visit
  190. $mainframe->detect();
  191.  
  192. // set for overlib check
  193. $mainframe->set( 'loadOverlib', false );
  194.  
  195. $gid = intval( $my->gid );
  196.  
  197. // gets template for page
  198. $cur_template = $mainframe->getTemplate();
  199. /** temp fix - this feature is currently disabled */
  200.  
  201. /** @global A places to store information from processing of the component */
  202. $_MOS_OPTION = array();
  203.  
  204. // precapture the output of the component
  205. require_once( $mosConfig_absolute_path . '/editor/editor.php' );
  206.  
  207. ob_start();
  208.  
  209. if ($path = $mainframe->getPath( 'front' )) {
  210.         $task   = strval( mosGetParam( $_REQUEST, 'task', '' ) );
  211.         $ret    = mosMenuCheck( $Itemid, $option, $task, $gid );
  212.        
  213.         if ($ret) {
  214.                 require_once( $path );
  215.         } else {
  216.                 mosNotAuth();
  217.         }
  218. } else {
  219.         header( 'HTTP/1.0 404 Not Found' );
  220.         echo _NOT_EXIST;
  221. }
  222.  
  223. $_MOS_OPTION['buffer'] = ob_get_contents();
  224.  
  225. ob_end_clean();
  226.  
  227. initGzip();
  228.  
  229. header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
  230. header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
  231. header( 'Cache-Control: no-store, no-cache, must-revalidate' );
  232. header( 'Cache-Control: post-check=0, pre-check=0', false );
  233. header( 'Pragma: no-cache' );
  234.  
  235. // display the offline alert if an admin is logged in
  236. if (defined( '_ADMIN_OFFLINE' )) {
  237.         include( $mosConfig_absolute_path .'/offlinebar.php' );
  238. }
  239.  
  240. // loads template file
  241. if ( !file_exists( $mosConfig_absolute_path .'/templates/'. $cur_template .'/index.php' ) ) {
  242.         echo _TEMPLATE_WARN . $cur_template;
  243. } else {
  244.         require_once( $mosConfig_absolute_path .'/templates/'. $cur_template .'/index.php' );
  245.         echo '<!-- '. time() .' -->';
  246. }
  247.  
  248. // displays queries performed for page
  249. if ($mosConfig_debug) {
  250.         echo $database->_ticker . ' queries executed';
  251.         echo '<pre>';
  252.         foreach ($database->_log as $k=>$sql) {
  253.                echo $k+1 . "\n" . $sql . '<hr />';
  254.         }
  255.         echo '</pre>';
  256. }
  257.  
  258. doGzip();
  259. ?>

Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Use syntax highlighting

To highlight particular lines, prefix each line with @@
:
:
Remember my settings