1   <?php
  2           define('DBG_SHOW_MEMORY_USAGE', 0);
  3           define('DBG_SKIP_REPORTING', 1);
  4  
  5           define('ADMIN', 1);
  6           define('REL_PATH', 'admin');
  7           $relation_level = count( explode('/', REL_PATH) );
  8           define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) );
  9           define('APPLICATION_CLASS', 'MyApplication');
  10           include_once(FULL_PATH.'/kernel/kernel4/startup.php');
  11  
  12           $application =& kApplication::Instance();
  13           $application->Init();
  14  
  15           if ($application->GetVar('check_server')) {
  16                   echo 'PING: '.date('d/m/Y H:i:s');
  17                   exit;
  18           }
  19  
  20  
  21           $user = $application->recallObject('u');
  22           $loginname = ($user->GetID() != -1) ? $user->GetDBField('Login') : 'root';
  23  
  24           $logout = $application->HREF('', '', Array('logout' => 1, '__URLENCODE__' => 1), 'index.php');
  25           $mainpage = $application->HREF('', '', Array('section' => 'in-portal:root', '__URLENCODE__' => 1), 'subitems.php');
  26           $xmlhttp_url = $application->HREF('', '', Array('check_server' => 1, '__URLENCODE__' => 1));
  27  
  28           $language =& $application->recallObject('lang.current');
  29  
  30           $use_xml = $application->isDebugMode() && dbg_ConstOn('DBG_SHOW_EXPIRATION');
  31   ?>
  32   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  33   <html>
  34   <head>
  35           <title>HEAD</title>
  36           <meta http-equiv="content-type" content="text/html;charset=<?php echo $language->GetDBField('Charset'); ?>">
  37           <meta name="generator" content="Notepad">
  38           <link rel="stylesheet" type="text/css" href="include/style.css">
  39           <?php
  40                   if ($use_xml) {
  41           ?>
  42           <script language="javascript" type="text/javascript">
  43                   function getXMLHTTPObject()
  44           {
  45                   var http_request = false;
  46                   if (window.XMLHttpRequest) { // Mozilla, Safari,...
  47                       http_request = new XMLHttpRequest();
  48                       if (http_request.overrideMimeType) {
  49                           http_request.overrideMimeType('text/plain');
  50                           // See note below about this line
  51                       }
  52                   } else if (window.ActiveXObject) { // IE
  53                       try {
  54                           http_request = new ActiveXObject("Msxml2.XMLHTTP");
  55                       } catch (e) {
  56                           try {
  57                               http_request = new ActiveXObject("Microsoft.XMLHTTP");
  58                           } catch (e) {}
  59                       }
  60                   }
  61                   return http_request;
  62           }
  63  
  64           function processResponce(http_request) {
  65                           if (http_request.readyState == 4) {
  66                           // complete
  67                           if (http_request.status == 200) {
  68                           document.getElementById('server_status').innerHTML = http_request.responseText;
  69                           http_request = null;
  70   //                              alert('responce: ['+http_request.responseText+']');
  71                       } else {
  72   //                                              alert('There was a problem with the request.');
  73                       }
  74                   }
  75  
  76               }
  77           </script>
  78           <?php
  79                   }
  80           ?>
  81   </head>
  82   <body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" bgcolor="#FFFFFF">
  83   <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
  84   <tr>
  85           <td valign="bottom">
  86                   <table cellpadding="0" cellspacing="0" border="0" width="100%" height="90">
  87                   <tr>
  88                           <td rowspan="3" valign="top">
  89                                   <a href="<?php echo $mainpage; ?>" target="main"><img title="In-portal" src="images/globe.gif" width="84" height="91" border="0"></a>
  90                           </td>
  91                           <td rowspan="3" valign="top">
  92                                   <a href="<?php echo $mainpage; ?>" target="main"><img title="In-portal" src="images/logo.gif" width="150" height="91" border="0"></a>
  93                           </td>
  94                           <td rowspan="3" width="100000" align="center">
  95                           <?php
  96                                   echo $use_xml ? '<div id="server_status"></div>' : '&nbsp;';
  97                           ?>
  98                           </td>
  99                           <td width="400">
  100                                   <img title="" src="images/blocks.gif" width="400" height="73">
  101                           </td>
  102                   </tr>
  103  
  104                   <tr>
  105                           <td align="right" background="images/version_bg.gif" class="head_version" valign="bottom">
  106                                   <img title="" src="images/spacer.gif" width="1" height="10"  align="absmiddle">
  107                                   <?php echo $application->Phrase('la_Logged_in_as').' <b>'.$loginname.' </b>'; ?>
  108                                   <a href="<?php echo $logout; ?>" target="_parent"><img src="images/blue_bar_logout.gif" height="16" width="16" align="absmiddle" border="0"></A>
  109                           </td>
  110                   </tr>
  111  
  112                   <tr>
  113                           <td><img title="" src="images/blocks2.gif" width="400" height="1"></td>
  114                   </tr>
  115  
  116                   <tr>
  117                           <td bgcolor="black" colspan="4"><img title="" src="images/spacer.gif" width="1" height="1"></td>
  118                   </tr>
  119           </table>
  120   </td>
  121   </tr>
  122   </table>
  123           <?php
  124                   if ($use_xml) {
  125           ?>
  126           <script language="javascript" type="text/javascript">
  127                   function checkServer() {
  128                           $http_request = getXMLHTTPObject();
  129                           $http_request.onreadystatechange = function() { processResponce($http_request); };
  130  
  131                           $http_request.open('GET', '<?php echo $xmlhttp_url; ?>', true);
  132                           $http_request.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
  133                   $http_request.send(null);
  134  
  135                   setTimeout('checkServer()', 20 * 60000);        // one time in 20 minutes
  136           }
  137  
  138           checkServer();
  139           </script>
  140           <?php
  141                   }
  142           ?>
  143   </body>
  144   </html>
  145   <?php
  146           $application->Done();
  147   ?>