root/trunk/wifidog-auth/wifidog/classes/Style.php @ 553

Revision 553, 4.3 KB (checked in by benoitg, 8 years ago)

2005-04-18 Benoit Gr�goire <bock@…>

  • Hotspot and network content association, continue access control work.
  • hotspot_owner.php: Fix wrong assignement of user_id that prevented the script from working.
  • All files: Remove whitespace and carriage return after the ?> closing tags.
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2  /********************************************************************\
3   * This program is free software; you can redistribute it and/or    *
4   * modify it under the terms of the GNU General Public License as   *
5   * published by the Free Software Foundation; either version 2 of   *
6   * the License, or (at your option) any later version.              *
7   *                                                                  *
8   * This program is distributed in the hope that it will be useful,  *
9   * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
11   * GNU General Public License for more details.                     *
12   *                                                                  *
13   * You should have received a copy of the GNU General Public License*
14   * along with this program; if not, contact:                        *
15   *                                                                  *
16   * Free Software Foundation           Voice:  +1-617-542-5942       *
17   * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
18   * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
19   *                                                                  *
20   \********************************************************************/
21  /**@file Style.php
22   * @author Copyright (C) 2004 Technologies Coeus inc.
23   */
24  /*Prevent caching*/
25Header("Cache-control: private, no-cache, must-revalidate");
26Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); # Past date
27Header("Pragma: no-cache");
28Header("Content-Type: text/html; charset=utf-8");
29require_once BASEPATH.'include/common.php';
30require_once BASEPATH.'classes/SmartyWifidog.php';
31require_once BASEPATH.'classes/Session.php';
32
33/** Style contains functions managing headers, footers, stylesheet, etc.
34 */
35class Style
36{
37  function Style() {
38    $session = new Session();
39    if (!empty($_REQUEST['lang']))
40      {
41        $session->set('SESS_LANGUAGE_VAR', $_REQUEST['lang']);
42      }
43
44    if ($session->get('SESS_LANGUAGE_VAR')) {
45        setlocale(LC_ALL, $session->get('SESS_LANGUAGE_VAR'));
46    }
47  }
48
49  /**Display HTML headers
50   * @param $title Title of the page
51   * @param $stylesheet stylesheet to include.
52   * @param $prevent_cache Should the browsers and proxies be prevented from caching this content?
53   * @return string to display in the page.
54   */
55  function GetHeader($title)
56  {
57    $smarty = new SmartyWifidog;
58    $smarty->assign('title',$title);
59    $retval = $smarty->fetch(DEFAULT_CONTENT_SMARTY_PATH.PAGE_HEADER_NAME);
60    global $starttime;
61    $starttime = microtime();
62
63    return $retval;
64  }
65
66  /**Affiche le pied de page HTML
67   * @return string chaine à afficher dans la page.
68   */
69  function GetFooter()
70  {
71     $retval = "";
72    /*
73     global $starttime;
74     global $sql_total_time;
75     global $sql_num_select_querys;
76     global $sql_num_select_unique_querys;
77     global $sql_num_update_querys;
78     $parts_of_starttime = explode(' ', $starttime);
79     $starttime = $parts_of_starttime[0] + $parts_of_starttime[1];
80     //echo "starttime: $starttime <br />\n";
81     $endtime = microtime();
82     $parts_of_endtime = explode(' ', $endtime);
83     $endtime = $parts_of_endtime[0] + $parts_of_endtime[1];
84     //echo "endtime: $endtime <br />\n";
85     $timetaken = $endtime - $starttime;
86     //echo "timetaken: $timetaken <br />\n";
87
88     $display_sql_percent = number_format(100 * ($sql_total_time / $timetaken), 0)."%";
89     $display_timetaken = number_format($timetaken, 3); // optional
90     $display_sql_total_time = number_format($sql_total_time, 3); // optional
91     $sql_num_querys = $sql_num_select_querys + $sql_num_select_unique_querys + $sql_num_update_querys;
92
93
94     $retval.= "<div class='content'>\n";
95     $retval.= "<P>Temps écoulé: $display_timetaken seconde(s) dont $display_sql_percent ($display_sql_total_time seconde(s)) pour les $sql_num_querys requêtes SQL ($sql_num_select_querys select, $sql_num_select_unique_querys select valeur unique, $sql_num_update_querys modifications)</P>\n";
96     $retval.= "</div>\n";
97    */
98    $retval.= "</body>\n";
99    //Work around IE cache 64k buffer bug
100    //$retval.= '<head><meta http-equiv="Pragma" CONTENT="no-cache"><meta http-equiv="Expires" CONTENT="-1"></HEAD>';
101    $retval.= "</html>";
102
103    return $retval;
104  }
105
106} /* end class Style */
107?>
Note: See TracBrowser for help on using the browser.