[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_themes/templates/ -> footer_default.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/footer_default.php,v $
  14  |     $Revision: 1.52 $
  15  |     $Date: 2006/12/17 23:26:14 $
  16  |     $Author: mrpete $
  17  +----------------------------------------------------------------------------+
  18  */
  19  if (!defined('e107_INIT')) { exit; }
  20  $In_e107_Footer = TRUE;    // For registered shutdown function
  21  
  22  global $eTraffic, $error_handler, $db_time, $sql, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $CUSTOMFOOTER, $FOOTER, $e107;
  23  
  24  //
  25  // SHUTDOWN SEQUENCE
  26  //
  27  // The following items have been carefully designed so page processing will finish properly
  28  // Please DO NOT re-order these items without asking first! You WILL break something ;)
  29  // These letters match the USER footer (that's why there may be B.1,B.2)
  30  //
  31  // A Ensure sql and traffic objects exist
  32  // [Next few ONLY if a regular page; not done for popups]
  33  // B Send the footer templated data
  34  // C Dump any/all traffic and debug information
  35  // [end of regular-page-only items]
  36  // D Close the database connection
  37  // E Themed footer code
  38  // F Configured footer scripts
  39  // G Browser-Server time sync script (must be the last one generated/sent)
  40  // H Final HTML (/body, /html)
  41  // I collect and send buffered page, along with needed headers
  42  //
  43  
  44  //
  45  // A Ensure sql and traffic objects exist
  46  //
  47  
  48  if(!is_object($sql)){
  49      // reinstigate db connection if another connection from third-party script closed it ...
  50      $sql = new db;
  51      $sql -> db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
  52  }
  53  if (!is_object($eTraffic)) {
  54      $eTraffic = new e107_traffic;
  55      $eTraffic->Bump('Lost Traffic Counters');
  56  }
  57  
  58  unset($fh);
  59  
  60  
  61  if(varset($e107_popup)!=1){
  62      //
  63      // B Send footer template
  64      //
  65      parseheader(($ph ? $cust_footer : $FOOTER));
  66  
  67      //
  68      // C Dump all debug and traffic information
  69      //
  70      $eTimingStop = microtime();
  71      global $eTimingStart;
  72      $rendertime = number_format($eTraffic->TimeDelta( $eTimingStart, $eTimingStop ), 4);
  73      $db_time    = number_format($db_time,4);
  74      $rinfo = '';
  75  
  76      if($pref['displayrendertime']){ $rinfo .= "Render time: {$rendertime} second(s); {$db_time} of that for queries. "; }
  77      if($pref['displaysql']){ $rinfo .= "DB queries: ".$sql -> db_QueryCount().". "; }
  78      if(isset($pref['display_memory_usage']) && $pref['display_memory_usage']){ $rinfo .= "Memory Usage: ".$e107->get_memory_usage(); }
  79      if(isset($pref['displaycacheinfo']) && $pref['displaycacheinfo']){ $rinfo .= $cachestring."."; }
  80      echo ($rinfo ? "\n<div style='text-align:center' class='smalltext'>{$rinfo}</div>\n" : "");
  81  
  82  
  83      if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL) {
  84          global $db_debug;
  85          echo "\n<!-- DEBUG -->\n";
  86          $db_debug->Show_All();
  87      }
  88  
  89      /*
  90      changes by jalist 24/01/2005:
  91      show sql queries
  92      usage: add ?showsql to query string, must be admin
  93      */
  94  
  95      if(ADMIN && isset($queryinfo) && is_array($queryinfo))
  96      {
  97          $c=1;
  98          $mySQLInfo = $sql->mySQLinfo;
  99          echo "<table class='fborder' style='width: 100%;'>
 100          <tr>
 101          <td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n";
 102          foreach ($queryinfo as $infovalue)
 103          {
 104              echo "<tr>\n<td class='forumheader3' style='width: 5%;'>{$c}</td><td class='forumheader3' style='width: 95%;'>{$infovalue}</td>\n</tr>\n";
 105              $c++;
 106          }
 107          echo "</table>";
 108      }
 109  
 110  } // End of regular-page footer (the above NOT done for popups)
 111  
 112  //
 113  // D Close DB connection. We're done talking to underlying MySQL
 114  //
 115      $sql -> db_Close();  // Only one is needed; the db is only connected once even with several $sql objects
 116  
 117      //
 118      // Just before we quit: dump quick timer if there is any
 119      // Works any time we get this far. Not calibrated, but it is quick and simple to use.
 120      // To use: eQTimeOn(); eQTimeOff();
 121      //
 122      $tmp = eQTimeElapsed();
 123      if (strlen($tmp)) {
 124          global $ns;
 125          $ns->tablerender('Quick Admin Timer',"Results: {$tmp} microseconds");
 126      }
 127  
 128  if ($pref['developer']) {
 129      global $oblev_at_start,$oblev_before_start;
 130      if (ob_get_level() != $oblev_at_start) {
 131          $oblev = ob_get_level();
 132          $obdbg = "<div style='text-align:center' class='smalltext'>Software defect detected; ob_*() level {$oblev} at end instead of ($oblev_at_start). POPPING EXTRA BUFFERS!</div>";
 133          while (ob_get_level() > $oblev_at_start) {
 134              ob_end_flush();
 135          }
 136          echo $obdbg;
 137      }
 138      // 061109 PHP 5 has a bug such that the starting level might be zero or one.
 139      // Until they work that out, we'll disable this message.
 140      // Devs can re-enable for testing as needed.
 141      //
 142      if (0 && $oblev_before_start != 0) {
 143          $obdbg = "<div style='text-align:center' class='smalltext'>Software warning; ob_*() level {$oblev_before_start} at start; this page not properly integrated into its wrapper.</div>";
 144          echo $obdbg;
 145      }
 146  }
 147  
 148  if((ADMIN == true || $pref['developer']) && $error_handler->debug == true) {
 149      echo "
 150      <br /><br />
 151      <div>
 152          <h3>PHP Errors:</h3><br />
 153          ".$error_handler->return_errors()."
 154      </div>
 155      ";
 156  }
 157  
 158  //
 159  // E Last themed footer code, usually JS
 160  //
 161  if (function_exists('theme_foot'))
 162  {
 163      echo theme_foot();
 164  }
 165  
 166  //
 167  // F any included JS footer scripts
 168  //
 169  global $footer_js;
 170  if(isset($footer_js) && is_array($footer_js))
 171  {
 172      $footer_js = array_unique($footer_js);
 173      foreach($footer_js as $fname)
 174      {
 175          echo "<script type='text/javascript' src='{$fname}'></script>\n";
 176          $js_included[] = $fname;
 177      }
 178  }
 179  
 180  //
 181  // G final JS script keeps user and server time in sync.
 182  //   It must be the last thing created before sending the page to the user.
 183  //
 184  // see e107.js and class2.php
 185  // This must be done as late as possible in page processing.
 186  $_serverTime=time();
 187  $lastSet = isset($_COOKIE['e107_tdSetTime']) ? $_COOKIE['e107_tdSetTime'] : 0;
 188  if (abs($_serverTime - $lastSet) > 120) {
 189      /* update time delay every couple of minutes.
 190      * Benefit: account for user time corrections and changes in internet delays
 191      * Drawback: each update may cause all server times to display a bit different
 192      */
 193      echo "<script type='text/javascript'>\n";
 194      echo "SyncWithServerTime('{$_serverTime}');
 195         </script>\n";
 196  }
 197  
 198  //
 199  // H Final HTML
 200  //
 201  echo "</body></html>";
 202  
 203  //
 204  // I Send the buffered page data, along with appropriate headers
 205  //
 206  $page = ob_get_clean();
 207  
 208  $etag = md5($page);
 209  header("Cache-Control: must-revalidate");
 210  header("ETag: {$etag}");
 211  
 212  $pref['compression_level'] = 6;
 213  if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip")) {
 214      $browser_support = true;
 215  }
 216  if(ini_get("zlib.output_compression") == false && function_exists("gzencode")) {
 217      $server_support = true;
 218  }
 219  if(varset($pref['compress_output'],false) && $server_support == true && $browser_support == true) {
 220      $level = intval($pref['compression_level']);
 221      $page = gzencode($page, $level);
 222      header("Content-Encoding: gzip", true);
 223      header("Content-Length: ".strlen($page), true);
 224      echo $page;
 225  } else {
 226      header("Content-Length: ".strlen($page), true);
 227      echo $page;
 228  }
 229  
 230  unset($In_e107_Footer);
 231  $e107_Clean_Exit=TRUE;    // For registered shutdown function -- let it know all is well!
 232  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7