ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/BBClone/trunk/lib/html.php
(Generate patch)

Comparing trunk/lib/html.php (file contents):
Revision 16 by matthys, Thu Nov 21 13:07:39 2013 UTC vs.
Revision 173 by matthys, Tue Dec 24 09:44:00 2013 UTC

# Line 1 | Line 1
1 < <?php
2 < /* This file is part of BBClone (A PHP based Web Counter on Steroids)
3 < *
4 < * SVN FILE $Id$
5 < *  
6 < * Copyright (C) 2001-2013, the BBClone Team (see doc/authors.txt for details)
7 < *
8 < * This program is free software: you can redistribute it and/or modify
9 < * it under the terms of the GNU General Public License as published by
10 < * the Free Software Foundation, either version 3 of the License, or
11 < * (at your option) any later version.
12 < *
13 < * This program is distributed in the hope that it will be useful,
14 < * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 < * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 < * GNU General Public License for more details.
17 < *
18 < * See doc/copying.txt for details
19 < */
20 <
21 < /////////////////////////
22 < // HTML Output Builder //
23 < /////////////////////////
24 <
25 < // Include BBClone hits in Stats (see config, enabled by default)
26 < if ($BBC_HITS == 1) {
27 < //  if (!defined("_BBC_PAGE_NAME")) {define("_BBC_PAGE_NAME", "/");}
28 <  if (!defined("_BBCLONE_DIR")) {define("_BBCLONE_DIR", "./");}
29 <  if (!defined("COUNTER")) {
30 <  define("COUNTER", _BBCLONE_DIR."mark_page.php");
31 <  if (is_readable(COUNTER)) include_once(COUNTER);
32 <  }
33 < }
34 <
35 < class bbc_html {
36 <  var $lang_tab, $lng, $server;
37 <
38 <  function get_lng() {
39 <    if (_BBC_PHP < 410) global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
40 <
41 <    global $BBC_LANGUAGE;
42 <
43 <        // Get variables depending on PHP version
44 <    $get = ((_BBC_PHP < 410) ? !empty($HTTP_GET_VARS['lng']) : !empty($_GET['lng'])) ?
45 <           ((_BBC_PHP < 410) ? $HTTP_GET_VARS['lng'] : $_GET['lng']) : "";
46 <    $post = ((_BBC_PHP < 410) ? !empty($HTTP_POST_VARS['lng']) : !empty($_POST['lng'])) ?
47 <            ((_BBC_PHP < 410) ? $HTTP_POST_VARS['lng'] : $_POST['lng']) : "";
48 <    $aclng = ((_BBC_PHP < 410) ? !empty($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']) :
49 <             !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) ? ((_BBC_PHP < 410) ?
50 <             $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'] : $_SERVER['HTTP_ACCEPT_LANGUAGE']) : "";
51 <
52 <    if ($get && preg_match(":^[\w\-]{1,5}:", $get)) $this->lng = $get;
53 <    elseif ($post && (preg_match(":^[\w\-]{1,5}:", $post))) $this->lng = $post;
54 <    elseif ($aclng && (preg_match(":^[\w\-]{1,5}:", $aclng))) {
55 <
56 <      $this->lng = (($comma = strpos($aclng, ",")) !== false) ? substr($aclng, 0, $comma) : $aclng;
57 <      $this->lng = ((($dash = strpos($this->lng, "-")) !== false) && (!isset($this->lang_tab[$this->lng]))) ?
58 <                   substr($this->lng, 0, $dash) : $this->lng;
59 <    }
60 <    else $this->lng = $BBC_LANGUAGE;
61 <
62 <    return (isset($this->lang_tab[$this->lng]) ? $this->lng : $BBC_LANGUAGE);
63 <  }
64 <
65 <  function set_title() {
66 <    global $BBC_TIMESTAMP, $BBC_TIME_OFFSET, $BBC_TITLEBAR, $translation;
67 <
68 <    $conv = array(
69 <      "%DATE" => date_format_translated($translation['global_day_format'], ($BBC_TIMESTAMP + ($BBC_TIME_OFFSET * 60))),
70 <      "%SERVER" => $this->server
71 <    );
72 <    if (empty($BBC_TITLEBAR)) {
73 <        $BBC_TITLEBAR = $translation['global_titlebar'];
74 <    };
75 <    return strtr($BBC_TITLEBAR, $conv);
76 <  }
77 <
78 <  function last_reset() {
79 <    global $translation, $access;
80 <    $timestamp = isset($access['time']['reset']) ? $access['time']['reset'] : "";
81 <    return "<p align=\"center\"><i>".$translation['global_last_reset'].": ".date_format_translated($translation['global_day_format'], $timestamp)
82 <          .".</i></p>\n";
83 <  }
84 <
85 <  function bbc_html() {
86 <    if (_BBC_PHP < 410) global $HTTP_SERVER_VARS;
87 <
88 <    global $translation;
89 <
90 <    $this->lang_tab = array(
91 <      "ar"    => "Arabic",
92 <      "bs"    => "Bosnian",
93 <      "bg"    => "Bulgarian",
94 <      "ca"    => "Catalan",
95 <      "cs"    => "Czech",
96 <      "zh-cn" => "Chinese Simp",
97 <      "zh-tw" => "Chinese Trad",
98 <      "da"    => "Danish",
99 <      "en"        => "English",
100 <      "nl"    => "Nederlands",
101 <      "de"    => "Deutsch",
102 <      "fr"    => "Fran&ccedil;ais",
103 <      "fi"    => "Finnish",
104 <      "el"    => "Greek",
105 <      "et"    => "Estonian",
106 <      "hu"    => "Hungarian",
107 <      "id"    => "Indonesian",
108 <      "it"    => "Italian",
109 <      "ja"    => "Japanese",
110 <      "ko"    => "Korean",
111 <      "lt"    => "Lithuanian",
112 <      "mk"    => "Macedonian",
113 <      "nb"    => "Norwegian Bkm",
114 <      "pl"    => "Polish",
115 <      "pt"    => "Portuguese",
116 <      "pt-br" => "Portuguese Br",
117 <      "ro"    => "Romanian",
118 <      "ru"    => "Russian",
119 <      "sk"    => "Slovak",
120 <      "sl"    => "Slovenian",
121 <      "es"    => "Spanish",
122 <      "sv"    => "Swedish",
123 <      "th"    => "Thai",
124 <      "tr"    => "Turkish",
125 <      "uk"    => "Ukrainian"
126 <    );
127 <    $this->lng = $this->get_lng();
128 <    $this->server = ((_BBC_PHP < 410) ? !empty($HTTP_SERVER_VARS['SERVER_NAME']) : !empty($_SERVER['SERVER_NAME'])) ?
129 <                    htmlspecialchars(((_BBC_PHP < 410) ? $HTTP_SERVER_VARS['SERVER_NAME'] : $_SERVER['SERVER_NAME']),
130 <                    ENT_QUOTES) : "noname";
131 <  }
132 <
133 <  // Generates BBClone Config details
134 <  function show_config($varname, $booleanflag = 0) {
135 <
136 <    global $translation, $$varname;
137 <
138 <    return "<tr class=\"morethan_row hover_white\">\n"
139 <          // Variable name
140 <          ."<td align=\"left\" class=\"config-cell\">\n"
141 <          ."<b>\$$varname</b>\n"
142 <          ."</td>\n"
143 <          // Explaination
144 <          ."<td align=\"left\" class=\"config-cell text-wrap\">\n"
145 <          .$translation["config_".$varname]."\n"
146 <          ."</td>\n"
147 <          // Variable value
148 <          ."<td align=\"left\" class=\"config-cell\">\n"
149 <          ."<b>".(!empty($$varname) ? ($booleanflag==1 ? $translation['global_yes'] : $$varname) : $translation['global_no'])."</b>\n"
150 <          ."</td></tr>\n";
151 <  }
152 <
153 <  // Begin of all BBClone HTML documents
154 <  function html_begin() {
155 <    global $BBC_VERSION, $BBC_EXT_LOOKUP, $BBC_IMAGES_PATH, $BBC_CSS_PATH, $BBC_CSS_FILE, $translation;
156 <
157 <    // Work around for default charset in Apache 2 (Thanks Martin Halachev!)
158 <    if (!headers_sent()) header("Content-type: text/html; charset=".$translation['global_charset']);
159 <
160 <        return "<?xml version=\"1.0\" encoding=\"".$translation['global_charset']."\"?>\n"
161 <          ."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
162 <          ."\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
163 <          ."<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
164 <          ."<head>\n"
165 <          ."<title>BBClone $BBC_VERSION $BBC_EXT_LOOKUP</title>\n"
166 <          ."<link rel=\"shortcut icon\" href=\"".$BBC_IMAGES_PATH."favicon.ico\" />\n"
167 <          ."<link rel=\"stylesheet\" href=\"".$BBC_CSS_PATH.$BBC_CSS_FILE."\" type=\"text/css\" />\n"
168 <          ."<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n"
169 <          ."<meta http-equiv=\"pragma\" content=\"no-cache\" />\n"
170 <          ."<meta http-equiv=\"content-Script-Type\" content=\"text/javasript\" />\n"
171 <          ."<meta http-equiv=\"content-Style-Type\" content=\"text/css\" />\n"
172 <          ."<meta http-equiv=\"content-type\" content=\"text/html; charset=".$translation['global_charset']."\" />\n"
173 <          ."<meta name=\"robots\" content=\"none\" />\n"
174 <          ."<meta name=\"description\" content=\"BBClone ".$BBC_VERSION." - A PHP based Web Counter on Steroids\" />\n"
175 <          ."</head>\n"
176 <          ."<body>\n"
177 <    // BBClone copyright notice: Removal or modification of the copyright holder
178 <    // will void any support by the BBClone team and may be a reason to deny
179 <    // access to the BBClone site if detected.
180 <          ."<!--\n"
181 <          ."This is BBClone $BBC_VERSION\n"
182 <          ."Homebase: http://www.bbclone.de/\n"
183 <          ."Copyright: 2001-2011 The BBClone Team\n"
184 <          ."License: GNU/GPL, version 2 or later\n"
185 <          ."-->\n";
186 <  }
187 <  
188 <  // Navigation Bar (both top and bottom)
189 <  function topbar($lang_sel = 1, $on_bottom = 0) {
190 <    if (_BBC_PHP < 410) global $HTTP_SERVER_VARS;
191 <
192 <    global $BBC_IMAGES_PATH, $BBC_MAINSITE, $BBC_SHOW_CONFIG, $translation;
193 <
194 <    $self = basename((_BBC_PHP < 410) ? $HTTP_SERVER_VARS['PHP_SELF'] : $_SERVER['PHP_SELF']);
195 <    $self = htmlspecialchars(str_replace("index.php", ".", $self), ENT_QUOTES);
196 <    $url_lng = !empty($this->lang_tab[$this->lng]) ? "?lng=".$this->lng."" : "";
197 <    // Navigation Buttons
198 <    $navbar = array(
199 <        "main"          => array( "url" => $BBC_MAINSITE,               "title" => $translation['navbar_main_site'],            "icon" => "navbar_main.png" ),
200 <        "config"        => array( "url" => "show_config.php",   "title" => !empty($BBC_SHOW_CONFIG)? $translation['navbar_configuration'] : "", "icon" => "navbar_config.png" ),
201 <        "global"        => array( "url" => "show_global.php",   "title" => $translation['navbar_global_stats'], "icon" => "navbar_global.png" ),
202 <        "detailed"      => array( "url" => "show_detailed.php", "title" => $translation['navbar_detailed_stats'], "icon" => "navbar_detailed.png" ),
203 <        "time"          => array( "url" => "show_time.php",             "title" => $translation['navbar_time_stats'],           "icon" => "navbar_time.png" )
204 <    );
205 <    // Language Selector
206 <    $str = (empty($lang_sel) ? "" : "<form method=\"post\" action=\"$self\">\n")
207 <          ."<table ".(empty($on_bottom) ? "class=\"navbar\"" : "class=\"navbar bottom\"")."><tr><td>\n";
208 <
209 <    $sep = "";
210 <    // Create Navigation Buttons
211 <    foreach (array_keys($navbar) as $menu_key) {
212 <        $url   = $navbar[$menu_key]['url'];
213 <        $title = $navbar[$menu_key]['title'];
214 <        $icon  = $navbar[$menu_key]['icon'];
215 <        $selected_class = (basename($_SERVER['SCRIPT_NAME']) == $url ? " selected" : "");
216 <        if ( basename($_SERVER['SCRIPT_NAME']) == "index.php" && $menu_key == "global") {
217 <                $selected_class = " selected";
218 <        }
219 <                if (empty($title)){
220 <                continue;
221 <        }
222 <        $str .= "<a class=\"navbar".$selected_class."\" href=\"$url".($menu_key != "main" ? $url_lng : "")."\"><img src=\"".$BBC_IMAGES_PATH.$icon."\" alt=\"icon\" />&nbsp;$title</a>&nbsp;\n";
223 <    }
224 <    // Create Language Selector
225 <    if (!empty($lang_sel)) {
226 <      $str .= "&nbsp;<img src=\"".$BBC_IMAGES_PATH."navbar_lng.png\" alt=\"".$translation['navbar_language']."\" title=\"".$translation['navbar_language']."\" />&nbsp;\n"
227 <             ."<select name=\"lng\" onchange=\"if (this.selectedIndex>0){location.href='$self?lng=' + "
228 <             ."this.options[this.selectedIndex].value;}\">\n"
229 <             ."<option value=\"\"".(empty($this->lng) ? " selected=\"selected\"" : "").">".$translation['navbar_language']."</option>\n";
230 <
231 <      foreach ($this->lang_tab as $lang_id => $lang_name) {
232 <        $str .= "<option value=\"$lang_id\"".(($this->lng == $lang_id) ? " selected=\"selected\"" : "")
233 <               .">$lang_name</option>\n";
234 <      }
235 <      $lang_tab_lng = empty($this->lang_tab[$this->lng]) ? "" : $this->lang_tab[$this->lng];
236 <      $str .= "</select>\n"
237 <             ."&nbsp;<noscript><input type=\"submit\" value=\"".$translation['navbar_go']."\" /></noscript>\n";
238 <    }
239 <
240 <    $str .= "</td></tr></table>\n"
241 <           .((!empty($on_bottom)) ? "" :
242 <            "<table class=\"titlebar\">\n"
243 <           ."<tr><td class=\"title\">\n"
244 <           .$this->set_title()."\n"
245 <           ."</td></tr></table>\n")
246 <           .(empty($lang_sel) ? "" : "</form>\n");
247 <
248 <      return $str;
249 <  }
250 <
251 <  // Color explanation
252 <  function color_explain() {
253 <    global $BBC_MAXTIME, $BBC_MAXVISIBLE, $translation;
254 <
255 <    return "<p><i>".$translation['dstat_visible_rows'].": $BBC_MAXVISIBLE&nbsp;|&nbsp;\n"
256 <          ."<span class=\"lessthan_row\">&nbsp;".$translation['dstat_last_visit']." &lt; $BBC_MAXTIME ".$translation['misc_second_unit']."&nbsp;</span>&nbsp;|&nbsp;\n"
257 <          ."<span class=\"morethan_row\">&nbsp;".$translation['dstat_last_visit']." &gt; $BBC_MAXTIME ".$translation['misc_second_unit']."&nbsp;</span>&nbsp;|&nbsp;\n"
258 <          ."<span class=\"robot_row\">&nbsp;".$translation['dstat_robots']."&nbsp;</span>&nbsp;|&nbsp;\n"
259 <          ."<span class=\"my_visit_row\">&nbsp;".$translation['dstat_my_visit']."&nbsp;</span></i></p>\n";
260 <  }
261 <
262 <  // Determine the color style of the connection
263 <  function connect_color_class($connect) {
264 <    global $BBC_MAXTIME, $BBC_TIMESTAMP, $BBC_TIME_OFFSET;
265 <    if (_BBC_PHP < 410) global $HTTP_SERVER_VARS;
266 <
267 <    // It was you
268 <    if (((_BBC_PHP < 410) ? $HTTP_SERVER_VARS["REMOTE_ADDR"] : $_SERVER["REMOTE_ADDR"]) == $connect['ip']) return 'my_visit_row';
269 <    // else, it was an access within $BBC_TIME_OFFSET
270 <    elseif ((($BBC_TIMESTAMP + ($BBC_TIME_OFFSET * 60)) - $connect['time']) < $BBC_MAXTIME) return "lessthan_row";
271 <    // else, it is red if it is a robot
272 <    elseif (!empty($connect['robot'])) return "robot_row";
273 <    // or blue if something else
274 <    else return "morethan_row";
275 <  }
276 <
277 <  // BBClone copyright notice
278 <  function copyright() {
279 <  global $BBC_IMAGES_PATH, $BBC_VERSION, $BBC_EXT_LOOKUP, $translation;
280 <
281 <  // Get Build No
282 <  if (is_readable("build.inc")) $BBC_BUILDNO = file_get_contents("build.inc");
283 <  else $BBC_BUILDNO = "";
284 <
285 <  return "<p><a href=\"http://www.bbclone.de/\">BBClone ".$BBC_VERSION." ".$BBC_EXT_LOOKUP."</a>&nbsp;&copy;&nbsp;".$translation['global_bbclone_copyright']
286 <        ."&nbsp;<a href=\"http://www.gnu.org/copyleft/gpl.html\">GPL</a>\n"
287 <        ."&nbsp;<a href=\"http://validator.w3.org/check?url=referer\">"
288 <        ."<img src=\"".$BBC_IMAGES_PATH."valid-xhtml10.png\" class=\"validicon\" alt=\"Valid XHTML 1.0!\" title=\"Valid XHTML 1.0!\" /></a>\n"
289 <        ."&nbsp;<a href=\"http://jigsaw.w3.org/css-validator/check/referer\">"
290 <        ."<img src=\"".$BBC_IMAGES_PATH."valid-css.png\" class=\"validicon\" alt=\"Valid CSS!\" title=\"Valid CSS!\" /></a>\n"
291 < //      ."<a href=\"http://www.php.net/\"><img src=\"".$BBC_IMAGES_PATH
292 < //      ."php.png\" class=\"validicon\"
293 < //       alt=\"PHP\" title=\"PHP\" "
294 < //       alt=\"".phpversion()."\" title=\"".phpversion()."\" "
295 < //      ."align=\"middle\" /></a>\n"
296 < //      .phpversion()
297 <        ."&nbsp;<a href=\"http://tidy.sourceforge.net\">"
298 <        ."<img src=\"".$BBC_IMAGES_PATH."valid-tidy.png\" class=\"validtidy\" alt=\"Valid HTML Tidy!\" title=\"Valid HTML Tidy!\" /></a></p>\n"
299 <        ;
300 <  }
301 <
302 <  // End of all BBClone HTML documents
303 <  function html_end() {
304 <    return "</body>\n"
305 <          ."</html>\n";
306 <  }
307 < }
308 < ?>
1 > <?php
2 > /* This file is part of BBClone (A PHP based Web Counter on Steroids)
3 > *
4 > * SVN FILE $Id$
5 > *  
6 > * Copyright (C) 2001-2014, the BBClone Team (see doc/authors.txt for details)
7 > *
8 > * This program is free software: you can redistribute it and/or modify
9 > * it under the terms of the GNU General Public License as published by
10 > * the Free Software Foundation, either version 3 of the License, or
11 > * (at your option) any later version.
12 > *
13 > * This program is distributed in the hope that it will be useful,
14 > * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 > * GNU General Public License for more details.
17 > *
18 > * See doc/copying.txt for details
19 > */
20 >
21 > /////////////////////////
22 > // HTML Output Builder //
23 > /////////////////////////
24 >
25 > // Include BBClone hits in Stats (see config, enabled by default)
26 > if ($BBC_HITS == 1) {
27 >  if (!defined("_BBCLONE_DIR")) {define("_BBCLONE_DIR", "./");}
28 >  if (!defined("COUNTER")) {
29 >  define("COUNTER", _BBCLONE_DIR."mark_page.php");
30 >  if (is_readable(COUNTER)) include_once(COUNTER);
31 >  }
32 > }
33 >
34 > class bbc_html {
35 >  var $lang_tab, $lng, $server;
36 >
37 >  function get_lng() {
38 >    if (_BBC_PHP < 410) global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
39 >
40 >    global $BBC_LANGUAGE;
41 >
42 >        // Get variables depending on PHP version
43 >    $get = ((_BBC_PHP < 410) ? !empty($HTTP_GET_VARS['lng']) : !empty($_GET['lng'])) ?
44 >           ((_BBC_PHP < 410) ? $HTTP_GET_VARS['lng'] : $_GET['lng']) : "";
45 >    $post = ((_BBC_PHP < 410) ? !empty($HTTP_POST_VARS['lng']) : !empty($_POST['lng'])) ?
46 >            ((_BBC_PHP < 410) ? $HTTP_POST_VARS['lng'] : $_POST['lng']) : "";
47 >    $aclng = ((_BBC_PHP < 410) ? !empty($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']) :
48 >             !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) ? ((_BBC_PHP < 410) ?
49 >             $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'] : $_SERVER['HTTP_ACCEPT_LANGUAGE']) : "";
50 >
51 >    if ($get && preg_match(":^[\w\-]{1,5}:", $get)) $this->lng = $get;
52 >    elseif ($post && (preg_match(":^[\w\-]{1,5}:", $post))) $this->lng = $post;
53 >    elseif ($aclng && (preg_match(":^[\w\-]{1,5}:", $aclng))) {
54 >
55 >      $this->lng = (($comma = strpos($aclng, ",")) !== false) ? substr($aclng, 0, $comma) : $aclng;
56 >      $this->lng = ((($dash = strpos($this->lng, "-")) !== false) && (!isset($this->lang_tab[$this->lng]))) ?
57 >                   substr($this->lng, 0, $dash) : $this->lng;
58 >    }
59 >    else $this->lng = $BBC_LANGUAGE;
60 >
61 >    return (isset($this->lang_tab[$this->lng]) ? $this->lng : $BBC_LANGUAGE);
62 >  }
63 >
64 >  function set_title() {
65 >    global $BBC_TIMESTAMP, $BBC_TIME_OFFSET, $BBC_TITLEBAR, $translation;
66 >
67 >    $conv = array(
68 >      "%DATE" => date_format_translated($translation['global_day_format'], ($BBC_TIMESTAMP + ($BBC_TIME_OFFSET * 60))),
69 >      "%SERVER" => $this->server
70 >    );
71 >    if (empty($BBC_TITLEBAR)) {
72 >        $BBC_TITLEBAR = $translation['global_titlebar'];
73 >    };
74 >    return strtr($BBC_TITLEBAR, $conv);
75 >  }
76 >
77 >  function last_reset() {
78 >    global $translation, $access;
79 >    $timestamp = isset($access['time']['reset']) ? $access['time']['reset'] : "";
80 >    return "<p align=\"center\"><i>".$translation['global_last_reset'].": ".date_format_translated($translation['global_day_format'], $timestamp)
81 >          .".</i></p>\n";
82 >  }
83 >
84 >  function bbc_html() {
85 >    if (_BBC_PHP < 410) global $HTTP_SERVER_VARS;
86 >
87 >    global $translation;
88 >
89 >    $this->lang_tab = array(
90 >      "ar"    => "العربية",           // Arabic
91 >      "bs"    => "Bosanski",         // Bosnian
92 >      "bg"    => "български",        // Bulgarian
93 >      "ca"    => "Català",           // Catalan
94 >      "cs"    => "Čeština",          // Czech
95 >      "da"    => "Dansk",            // Danish
96 >      "de"    => "Deutsch",          // German
97 >      "en"    => "English",          // English << DEFAULT
98 >      "fr"    => "Français",         // French
99 >      "fi"    => "Suomi",            // Finnish
100 >      "el"    => "Ελληνικά",         // Greek
101 >      "es"    => "Español",          // Spanish
102 >      "et"    => "Eesti keel",       // Estonian
103 >      "hu"    => "Magyar",           // Hungarian
104 >      "id"    => "Bahasa Indonésia", // Indonesian
105 >      "it"    => "Italiano",         // Italian
106 >      "ja"    => "日本語",            // Japanese
107 >      "ko"    => "한국어",             // Korean
108 >      "lt"    => "Lietuvių",         // Lithuanian
109 >      "mk"    => "Македонски",       // Macedonian
110 >      "nb"    => "Norsk Bokmål",     // Norwegian Bokmål
111 >      "nl"    => "Nederlands",       // Dutch
112 >      "pl"    => "Polski",           // Polish
113 >      "pt"    => "Português",        // Portuguese
114 >      "pt-br" => "Português Brasil", // Brazilian Portuguese
115 >      "ro"    => "Română",           // Romanian
116 >      "ru"    => "Русский",          // Russian
117 >      "sk"    => "Slovenčina",       // Slovak
118 >      "sl"    => "Slovenski",        // Slovenian
119 >      "sv"    => "Svenska",          // Swedish
120 >      "th"    => "ภาษาไทย",             // Thai
121 >      "tr"    => "Türkçe",           // Turkish
122 >      "uk"    => "українська",       // Ukrainian
123 >      "zh-cn" => "汉语(简体)",          // Simplified Chinese
124 >      "zh-tw" => "汉语(繁體)"          // Traditional Chinese
125 >    );
126 >    $this->lng = $this->get_lng();
127 >    $this->server = ((_BBC_PHP < 410) ? !empty($HTTP_SERVER_VARS['SERVER_NAME']) : !empty($_SERVER['SERVER_NAME'])) ?
128 >                    htmlspecialchars(((_BBC_PHP < 410) ? $HTTP_SERVER_VARS['SERVER_NAME'] : $_SERVER['SERVER_NAME']),
129 >                    ENT_QUOTES) : "noname";
130 >  }
131 >
132 >  // Generates BBClone Config details
133 >  function show_config($varname, $booleanflag = 0) {
134 >
135 >    global $translation, $$varname;
136 >
137 >    return "<tr class=\"morethan_row hover_white\">\n"
138 >          // Variable name
139 >          ."<td align=\"left\" class=\"config-cell\">\n"
140 >          ."<b>\$$varname</b>\n"
141 >          ."</td>\n"
142 >          // Explaination
143 >          ."<td align=\"left\" class=\"config-cell text-wrap\">\n"
144 >          .$translation["config_".$varname]."\n"
145 >          ."</td>\n"
146 >          // Variable value
147 >          ."<td align=\"left\" class=\"config-cell\">\n"
148 >          ."<b>".(!empty($$varname) ? ($booleanflag==1 ? $translation['global_yes'] : $$varname) : $translation['global_no'])."</b>\n"
149 >          ."</td></tr>\n";
150 >  }
151 >
152 >  // Begin of all BBClone HTML documents
153 >  function html_begin() {
154 >    global $BBC_VERSION, $BBC_EXT_LOOKUP, $BBC_IMAGES_PATH, $BBC_CSS_PATH, $BBC_CSS_FILE, $translation;
155 >
156 >    // Work around for default charset in Apache 2 (Thanks Martin Halachev!)
157 >    if (!headers_sent()) header("Content-type: text/html; charset=".$translation['global_charset']);
158 >
159 >        return "<?xml version=\"1.0\" encoding=\"".$translation['global_charset']."\"?>\n"
160 >          ."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
161 >          ."\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
162 >          ."<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
163 >          ."<head>\n"
164 >          ."<title>BBClone $BBC_VERSION $BBC_EXT_LOOKUP</title>\n"
165 >          ."<link rel=\"shortcut icon\" href=\"".$BBC_IMAGES_PATH."favicon.ico\" />\n"
166 >          ."<link rel=\"stylesheet\" href=\"".$BBC_CSS_PATH.$BBC_CSS_FILE."\" type=\"text/css\" />\n"
167 >          ."<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n"
168 >          ."<meta http-equiv=\"pragma\" content=\"no-cache\" />\n"
169 >          ."<meta http-equiv=\"content-Script-Type\" content=\"text/javasript\" />\n"
170 >          ."<meta http-equiv=\"content-Style-Type\" content=\"text/css\" />\n"
171 >          ."<meta http-equiv=\"content-type\" content=\"text/html; charset=".$translation['global_charset']."\" />\n"
172 >          ."<meta name=\"robots\" content=\"none\" />\n"
173 >          ."<meta name=\"description\" content=\"BBClone ".$BBC_VERSION." - A PHP based Web Counter on Steroids\" />\n"
174 >          ."</head>\n"
175 >          ."<body>\n"
176 >    // BBClone copyright notice: Removal or modification of the copyright holder
177 >    // will void any support by the BBClone team and may be a reason to deny
178 >    // access to the BBClone site if detected.
179 >          ."<!--\n"
180 >          ."This is BBClone $BBC_VERSION\n"
181 >          ."Homebase: http://www.bbclone.de/\n"
182 >          ."Copyright: 2001-2014 The BBClone Team\n"
183 >          ."License: GNU/GPL, version 3 or later\n"
184 >          ."-->\n";
185 >  }
186 >  
187 >  // Navigation Bar (both top and bottom)
188 >  function topbar($lang_sel = 1, $on_bottom = 0) {
189 >    if (_BBC_PHP < 410) global $HTTP_SERVER_VARS;
190 >
191 >    global $BBC_IMAGES_PATH, $BBC_MAINSITE, $BBC_SHOW_CONFIG, $translation;
192 >
193 >    $self = basename((_BBC_PHP < 410) ? $HTTP_SERVER_VARS['PHP_SELF'] : $_SERVER['PHP_SELF']);
194 >    $self = htmlspecialchars(str_replace("index.php", ".", $self), ENT_QUOTES);
195 >    $url_lng = !empty($this->lang_tab[$this->lng]) ? "?lng=".$this->lng."" : "";
196 >    // Navigation Buttons
197 >    $navbar = array(
198 >        "main"          => array( "url" => $BBC_MAINSITE,               "title" => $translation['navbar_main_site'],            "icon" => "navbar_main.png" ),
199 >        "config"        => array( "url" => "show_config.php",   "title" => !empty($BBC_SHOW_CONFIG)? $translation['navbar_configuration'] : "", "icon" => "navbar_config.png" ),
200 >        "global"        => array( "url" => "show_global.php",   "title" => $translation['navbar_global_stats'], "icon" => "navbar_global.png" ),
201 >        "detailed"      => array( "url" => "show_detailed.php", "title" => $translation['navbar_detailed_stats'], "icon" => "navbar_detailed.png" ),
202 >        "time"          => array( "url" => "show_time.php",             "title" => $translation['navbar_time_stats'],           "icon" => "navbar_time.png" )
203 >    );
204 >    // Language Selector
205 >    $str = (empty($lang_sel) ? "" : "<form method=\"post\" action=\"$self\">\n")
206 >          ."<table ".(empty($on_bottom) ? "class=\"navbar\"" : "class=\"navbar bottom\"")."><tr><td>\n";
207 >
208 >    $sep = "";
209 >    // Create Navigation Buttons
210 >    foreach (array_keys($navbar) as $menu_key) {
211 >        $url   = $navbar[$menu_key]['url'];
212 >        $title = $navbar[$menu_key]['title'];
213 >        $icon  = $navbar[$menu_key]['icon'];
214 >        $selected_class = (basename($_SERVER['SCRIPT_NAME']) == $url ? " selected" : "");
215 >        if ( basename($_SERVER['SCRIPT_NAME']) == "index.php" && $menu_key == "global") {
216 >                $selected_class = " selected";
217 >        }
218 >                if (empty($title)){
219 >                continue;
220 >        }
221 >        $str .= "<a class=\"navbar".$selected_class."\" href=\"$url".($menu_key != "main" ? $url_lng : "")."\"><img src=\"".$BBC_IMAGES_PATH.$icon."\" alt=\"icon\" />&nbsp;$title</a>&nbsp;\n";
222 >    }
223 >    // Create Language Selector
224 >    if (!empty($lang_sel)) {
225 >      $str .= "&nbsp;<img src=\"".$BBC_IMAGES_PATH."navbar_lng.png\" alt=\"".$translation['navbar_language']."\" title=\"".$translation['navbar_language']."\" />&nbsp;\n"
226 >             ."<select name=\"lng\" onchange=\"if (this.selectedIndex>0){location.href='$self?lng=' + "
227 >             ."this.options[this.selectedIndex].value;}\">\n"
228 >             ."<option value=\"\"".(empty($this->lng) ? " selected=\"selected\"" : "").">".$translation['navbar_language']."</option>\n";
229 >
230 >      foreach ($this->lang_tab as $lang_id => $lang_name) {
231 >        $str .= "<option value=\"$lang_id\"".(($this->lng == $lang_id) ? " selected=\"selected\"" : "")
232 >               .">$lang_name</option>\n";
233 >      }
234 >      $lang_tab_lng = empty($this->lang_tab[$this->lng]) ? "" : $this->lang_tab[$this->lng];
235 >      $str .= "</select>\n"
236 >             ."&nbsp;<noscript><input type=\"submit\" value=\"".$translation['navbar_go']."\" /></noscript>\n";
237 >    }
238 >
239 >    $str .= "</td></tr></table>\n"
240 >           .((!empty($on_bottom)) ? "" :
241 >            "<table class=\"titlebar\">\n"
242 >           ."<tr><td class=\"title\">\n"
243 >           .$this->set_title()."\n"
244 >           ."</td></tr></table>\n")
245 >           .(empty($lang_sel) ? "" : "</form>\n");
246 >
247 >      return $str;
248 >  }
249 >
250 >  // Color explanation
251 >  function color_explain() {
252 >    global $BBC_MAXTIME, $BBC_MAXVISIBLE, $translation;
253 >
254 >    return "<p><i>".$translation['dstat_visible_rows'].": $BBC_MAXVISIBLE&nbsp;|&nbsp;\n"
255 >          ."<span class=\"lessthan_row\">&nbsp;".$translation['dstat_last_visit']." &lt; $BBC_MAXTIME ".$translation['misc_second_unit']."&nbsp;</span>&nbsp;|&nbsp;\n"
256 >          ."<span class=\"morethan_row\">&nbsp;".$translation['dstat_last_visit']." &gt; $BBC_MAXTIME ".$translation['misc_second_unit']."&nbsp;</span>&nbsp;|&nbsp;\n"
257 >          ."<span class=\"robot_row\">&nbsp;".$translation['dstat_robots']."&nbsp;</span>&nbsp;|&nbsp;\n"
258 >          ."<span class=\"my_visit_row\">&nbsp;".$translation['dstat_my_visit']."&nbsp;</span></i></p>\n";
259 >  }
260 >
261 >  // Determine the color style of the connection
262 >  function connect_color_class($connect) {
263 >    global $BBC_MAXTIME, $BBC_TIMESTAMP, $BBC_TIME_OFFSET;
264 >    if (_BBC_PHP < 410) global $HTTP_SERVER_VARS;
265 >
266 >    // It was you
267 >    if (((_BBC_PHP < 410) ? $HTTP_SERVER_VARS["REMOTE_ADDR"] : $_SERVER["REMOTE_ADDR"]) == $connect['ip']) return 'my_visit_row';
268 >    // else, it was an access within $BBC_TIME_OFFSET
269 >    elseif ((($BBC_TIMESTAMP + ($BBC_TIME_OFFSET * 60)) - $connect['time']) < $BBC_MAXTIME) return "lessthan_row";
270 >    // else, it is red if it is a robot
271 >    elseif (!empty($connect['robot'])) return "robot_row";
272 >    // or blue if something else
273 >    else return "morethan_row";
274 >  }
275 >
276 >  // BBClone copyright notice
277 >  function copyright() {
278 >  global $BBC_IMAGES_PATH, $BBC_VERSION, $BBC_EXT_LOOKUP, $translation;
279 >
280 >  // Get Build No
281 >  if (is_readable("build.inc")) $BBC_BUILDNO = file_get_contents("build.inc");
282 >  else $BBC_BUILDNO = "";
283 >
284 >  return "<p><a href=\"http://www.bbclone.de/\">BBClone ".$BBC_VERSION." ".$BBC_EXT_LOOKUP."</a>&nbsp;&copy;&nbsp;".$translation['global_bbclone_copyright']
285 >        ."&nbsp;<a href=\"http://www.gnu.org/copyleft/gpl.html\">GPL</a>\n"
286 >        ."&nbsp;<a href=\"http://validator.w3.org/check?url=referer\">"
287 >        ."<img src=\"".$BBC_IMAGES_PATH."valid-xhtml10.png\" class=\"validicon\" alt=\"Valid XHTML 1.0!\" title=\"Valid XHTML 1.0!\" /></a>\n"
288 >        ."&nbsp;<a href=\"http://jigsaw.w3.org/css-validator/check/referer\">"
289 >        ."<img src=\"".$BBC_IMAGES_PATH."valid-css.png\" class=\"validicon\" alt=\"Valid CSS!\" title=\"Valid CSS!\" /></a>\n"
290 >        ."&nbsp;<a href=\"http://tidy.sourceforge.net\">"
291 >        ."<img src=\"".$BBC_IMAGES_PATH."valid-tidy.png\" class=\"validtidy\" alt=\"Valid HTML Tidy!\" title=\"Valid HTML Tidy!\" /></a></p>\n"
292 >        ;
293 >  }
294 >
295 >  // End of all BBClone HTML documents
296 >  function html_end() {
297 >    return "</body>\n"
298 >          ."</html>\n";
299 >  }
300 > }
301 > ?>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines