"Fossies" - the Fresh Open Source Software Archive

Member "srg-1.3.6/resources/header.php" (5 Aug 2009, 3164 Bytes) of package /linux/privat/old/srg-1.3.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php /* SRG Default PHP Header - 1.3.6
    2        * 
    3        * If you make modifications to this file you *must* remove the
    4        * 'SRG Default PHP Header - 1.3.6' string on the first line or your
    5        * changes may be overwritten.
    6        *
    7        * $Id: header.php 234 2005-05-11 22:18:35Z matt $
    8        *
    9        */
   10 /* Define some defaults */
   11 define("CONFIG_FILE", "/etc/srg/srg.conf");
   12 define("DEFAULT_OUTPUTURL", "/srg_reports/");
   13 define("DEFAULT_TITLE", "SRG - Squid Log Analysis");
   14 define("DEFAULT_INCLUDEJS", 0);
   15 
   16 /* Read configuration information from the default configuration file */
   17 $outputurl = DEFAULT_OUTPUTURL;
   18 $title = DEFAULT_TITLE;
   19 $include_js = DEFAULT_INCLUDEJS;
   20 
   21 $config = @file(CONFIG_FILE);
   22 
   23 if ($config) {
   24     /* Loop through lines and find output URL or title*/
   25     for ($i=0; $i<count($config); $i++) {
   26         if (substr($config[$i], 0, 5) == "title") {
   27             $title = substr($config[$i], 7);
   28             $title = trim(trim($title), "\"");
   29             continue;
   30         }
   31         if (substr($config[$i], 0, 10) == "output_url") {
   32             $outputurl = substr($config[$i], 12);
   33             $outputurl = trim(trim($outputurl), "\"");
   34             continue;
   35         }
   36         if (substr($config[$i], 0, 12) == "sort_columns") {
   37             $tmp = substr($config[$i], 13);
   38             if (strtolower(substr($tmp, 0, 4)) == "true") {
   39                 $include_js = 1;
   40             }
   41         }
   42     }
   43 }
   44 
   45 /* Check default output URL ends in a / */
   46 $last = substr($outputurl, -1, 1);
   47 if ($last != "/") {
   48     $outputurl .= "/";
   49 }
   50 
   51 /* Do any custom page setup below here */
   52 
   53 /* if you have php_authentication (-A) enabled then this function must be 
   54  * filled in.
   55  *
   56  * For each group in the report the name of the group is passed to this
   57  * function which must return true if the currently logged in user can view the
   58  * reports for the specified group.
   59  *
   60  * A return value of false causes the reports for the specified group not to be
   61  * displayed.
   62  */
   63 function can_view($groupname) {
   64     /* Retrieve the currently logged in user from your session/cookie here */
   65 
   66     /* Check authentication here */
   67 
   68     /* But by default we'll have no authentication :) */
   69     return true;
   70 }
   71 
   72 /* This function is called when an error must be displayed to the user due to 
   73  * an access denied error or similar.
   74  */
   75 function report_error($errormessage) {
   76     echo "<br><b>$errormessage</b><br>";    
   77 }
   78 
   79 /* Setup the page HTML here */
   80 ?>
   81 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   82 <html>
   83 <head>
   84 <meta name="generator" content="SRG 1.3.6 (http://www.crc.net.nz/software/srg.php)">
   85 <meta name="robots" content="noindex,nofollow">
   86 <?php
   87     echo "<link href=\"${outputurl}style.css\" type=\"text/css\" " .
   88         "rel=\"stylesheet\">\n";
   89     if ($include_js == 1) {
   90         echo "<script language=\"javascript\" src=\"${outputurl}srg.js\" " .
   91             "type=\"text/javascript\"></script>\n";
   92     }
   93     echo "<title>$title</title>\n";
   94 ?>
   95 </head>
   96 <?php
   97     if ($include_js == 1) {
   98         echo "<body onload=\"setupSort();\">\n";
   99     } else {
  100         echo "<body>\n";
  101     }
  102 ?>
  103 <br>
  104 <div align="center"><h1><?php echo $title; ?></h1></div>
  105 <br>
  106 <?php 
  107 // vim: ts=4 sw=4 sts=4 et: 
  108 ?>