-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathheader.php
More file actions
187 lines (172 loc) · 7.08 KB
/
header.php
File metadata and controls
187 lines (172 loc) · 7.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
/************************************************************************/
/* FlatNuke - Flat Text Based Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2003-2006 by Simone Vellei */
/* http://www.flatnuke.org/ */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
// deny direct access to this file
if (preg_match("/header.php/i",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
// language definition by configuration or by cookie
global $lang;
$userlang = getparam("userlang", PAR_COOKIE, SAN_FLAT);
if ($userlang!="" AND is_alphanumeric($userlang) AND file_exists("languages/$userlang.php")) {
$lang = $userlang;
}
switch($lang) {
case "de" OR "es" OR "fr" OR "it" OR "pt":
include_once ("languages/$lang.php");
include_once ("languages/fd+lang/fd+$lang.php");
break;
default:
include_once ("languages/en.php");
include_once ("languages/fd+lang/fd+en.php");
break;
}
// dynamically build page's title and meta tags
global $sitename, $sitedescription, $keywords;
$mod = _FN_MOD;
$action = getparam("action", PAR_GET, SAN_FLAT);
$news = getparam("news", PAR_GET, SAN_FLAT);
$title = $sitename;
if (get_mod()!="") {
$news_dir = get_fn_dir("sections")."/".get_mod()."/none_newsdata/";
} else $news_dir = get_fn_dir("sections")."/none_News/none_newsdata/";
if(trim($mod)!="" AND $action!="viewnews" AND $action!="addcommentinterface") {
// include specifics keywords for this section
if (file_exists(get_fn_dir('sections')."/$mod/none_newmetatags.php")) {
include_once (get_fn_dir('sections')."/$mod/none_newmetatags.php");
}
// build title for a section
$page_title = str_replace("/", " - ", _FN_MOD);
$page_title = str_replace("none_", "", $page_title);
$page_title = preg_replace("/^[0-9]*_/", "", $page_title);
$page_title = preg_replace("/ - [0-9]*_/", " - ", $page_title);
$page_title = str_replace("_", " ", $page_title);
$title = "$sitename » $page_title";
}
$pagedescription = $sitedescription; // set page description to site description
if(($action=="viewnews" OR $action=="addcommentinterface") AND file_exists("$news_dir/$news.fn.php")) {
// build title for a news
$newsfile = get_file("$news_dir/$news.fn.php");
$page_title = get_xml_element("title",$newsfile);
$keywords = preg_replace('/[\.]*[[:alpha:]]+$/i','',get_xml_element("category",$newsfile)).", $keywords";
$pagedescription = substr(strip_tags(get_xml_element("header",$newsfile)), 0, 200); // set page description to news header
$pagedescription = _FLEGGI." : $pagedescription";
$title = "$sitename » $page_title";
}
// start HTML 5 headers
echo "<!DOCTYPE html>";
echo "<!--[if lt IE 7]> <html class=\"no-js lt-ie9 lt-ie8 lt-ie7\"> <![endif]-->";
echo "<!--[if IE 7]> <html class=\"no-js lt-ie9 lt-ie8\"> <![endif]-->";
echo "<!--[if IE 8]> <html class=\"no-js lt-ie9\"> <![endif]-->";
echo "<!--[if gt IE 8]><!--> <html class=\"no-js\" lang=\"$lang\"> <!--<![endif]-->";
//echo "<html >\n";
echo "<head>\n";
echo "<meta charset=\"utf-8\">";
echo "<title>".stripslashes($title)."</title>\n";
define("_FN_TITLE",$title);
echo "<meta name=\"author\" content=\"$admin\">\n";
echo "<meta name=\"keywords\" content=\"$keywords\">\n";
echo "<meta name=\"description\" content=\"$pagedescription\">\n";
if (file_exists(_FN_SECTIONS_DIR."/"._FN_MOD."/noindex"))
echo "<meta name=\"robots\" content=\"noindex, nofollow\">\n";
else echo "<meta name=\"robots\" content=\"index, follow\">\n";
echo "<meta name=\"revisit-after\" content=\"1 days\">\n";
echo "<meta name=\"rating\" content=\"general\">\n";
echo "<meta name=\"viewport\" content=\"width=device-width\">";
?>
<script type="text/javascript">
<!--
// Request confirmation before continue action
function check(url){
if(confirm ("<?php echo _SICURO?>"))
window.location=url;
}
// Let overload window.onload function
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
// -->
</script>
<?php
// declaration of all default StyleSheets provided by the system
$path_css_sys = "include/css";
if(file_exists($path_css_sys)) {
$dir_css_sys = opendir($path_css_sys);
$file_css_sys = 0;
while ($filename_css_sys = readdir($dir_css_sys)) {
if(preg_match('/[\.]css$/', $filename_css_sys) AND $filename_css_sys!="." AND $filename_css_sys!=".." AND !preg_match("/^none_/", $filename_css_sys)) {
$array_css_sys[$file_css_sys] = $filename_css_sys;
$file_css_sys++;
}
}
closedir($dir_css_sys);
for($i=0; $i<$file_css_sys; $i++) {
echo "\n<link rel='StyleSheet' type='text/css' href='$path_css_sys/$array_css_sys[$i]'>";
}
if($mod=="none_Admin" AND _FN_IS_ADMIN AND file_exists("$path_css_sys/none_dashboard.css")) {
echo "\n<link rel='StyleSheet' type='text/css' href='$path_css_sys/none_dashboard.css'>";
}
}
// declaration of all StyleSheets provided by the theme in use (if not using Administration section)
global $theme;
$path_css_thm = "themes/$theme";
if($mod!="none_Admin" AND file_exists($path_css_thm)) {
$dir_css_thm = opendir($path_css_thm);
$file_css_thm = 0;
while ($filename_css_thm = readdir($dir_css_thm)) {
if(preg_match('/[\.]css$/', $filename_css_thm) AND $filename_css_thm!="." AND $filename_css_thm!=".." AND !preg_match("/^none_/", $filename_css_thm)) {
$array_css_thm[$file_css_thm] = $filename_css_thm;
$file_css_thm++;
}
}
closedir($dir_css_thm);
for($i=0; $i<$file_css_thm; $i++) {
echo "\n<link rel='StyleSheet' type='text/css' href='$path_css_thm/$array_css_thm[$i]'>";
}
}
// declaration of the XML file with rss-feeds
if(file_exists(get_fn_dir("var")."/backend.xml"))
echo "\n<link rel=\"alternate\" type=\"application/rss+xml\" href=\"".get_fn_dir("var")."/backend.xml\" title=\"$sitename\">";
// favicon
if(file_exists("images/favicon.ico"))
echo "\n<link rel=\"shortcut icon\" href=\"images/favicon.ico\">\n";
// loading all JavaScripts that are present in '/include/javascripts' directory
$path_js = "include/javascripts";
if(file_exists($path_js)) {
$dir_js = opendir($path_js);
$file_js = 0;
while ($filename_js = readdir($dir_js)) {
if(preg_match('/[\.]js$/', $filename_js) AND $filename_js!="." AND $filename_js!=".." AND !preg_match("/^none_/", $filename_js) AND !preg_match("/^\./", $filename_js)) {
$array_js[$file_js] = $filename_js;
$file_js++;
}
}
closedir($dir_js);
if($file_js>0) sort($array_js);
for($i=0; $i<$file_js; $i++) {
echo "\n<script type='text/javascript' src='$path_js/$array_js[$i]'></script>";
}
}
// end of HTML headers
echo "\n\n</head>\n";
?>