-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhead.inc.php
373 lines (341 loc) · 12.4 KB
/
head.inc.php
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
<?php
/**
*
* @file head.inc.php
* @brief В файле реализовано формирование базовой функциональности и структуры страниц сайта
*
*/
ob_start();
require_once('lib/config.inc.php');
/**
* Send http headers
*/
// Don't use cache (required for Opera)
$now = gmdate('D, d M Y H:i:s') . ' GMT';
header('Expires: ' . $now);
header('Last-Modified: ' . $now);
header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Pragma: no-cache'); // HTTP/1.0
// Define the charset to be used
header('Content-Type: text/html; charset=' . $chset);
if (isset($ie6_quirks_mode) && $ie6_quirks_mode && preg_match('/MSIE\s*6/', $_SERVER['HTTP_USER_AGENT'])) {
print '<?xml version="1.0" encoding="' . $chset . '"?>' . "\n";
}
print "<!DOCTYPE html>\n";
print '<html><head>' . "\n";
print '<meta http-equiv="Content-Type" content="text/html; charset=' . $chset . '" />' . "\n";
if (!empty($IE_COMPAT)) {
print '<meta http-equiv="X-UA-Compatible" content="IE=' . $IE_COMPAT . '" />' . "\n";
}
print '<meta name="author" content="Andrey Nikitin <nik-a at mail dot ru>" />' . "\n";
print '<link rel="SHORTCUT ICON" href="' . $conf['prefix'] . '/favicon.ico">' . "\n";
print '<title>';
if (isset($GLOBALS['pageTitle'])) {
if (isset($GLOBALS[$GLOBALS['pageTitle']])) {
// use localized version onto lang file
print($conf['server-name'] . '[' . $named . ']::' . $GLOBALS[$GLOBALS['pageTitle']]);
} else {
print($conf['server-name'] . '[' . $named . ']::' . $GLOBALS['pageTitle']);
}
} else {
print($conf['server-name'] . '[' . $named . ']');
}
print '</title>' . "\n";
if (isset($BaseTarget)) {
print '<base target="' . $BaseTarget . '">' . "\n";
}
print '<style type="text/css">' . "\n";
// print '<!--'."\n";
readfile($wwwdir . '/main.css');
// print '// -->'."\n";
print '</style>' . "\n";
if (isset($css_links) && is_array($css_links)) {
foreach ($css_links as &$__css_link) {
print '<link href="' . $conf['prefix'] . '/' . $__css_link . '" rel="stylesheet" type="text/css" />' . "\n";
}
}
if (isset($USE_JQUERY)) {
print '<script type="text/javascript" src="' .
$conf['prefix'] . '/lib/js/third-party/jquery.js"></script>' . "\n";
}
?>
<script type=text/javascript>
if (typeof(console) == 'undefined') {
var console = {
log: function (message) {
},
info: function (message) {
},
warn: function (message) {
},
error: function (message) {
alert(message);
}
}
}
<?php
/* setup PHP and JS global DEBUG variable */
printf("var DEBUG = %s;\n", @empty($_REQUEST['debug']) && @empty($conf['debug']) ? 'false' : 'true');
printf("var WwwPrefix = '%s';\n", addcslashes($conf['prefix'], '\'"/\\'));
?>
</script>
<?php
if (isset($link_javascripts) && is_array($link_javascripts)) {
foreach ($link_javascripts as &$__js_link) {
print '<script type="text/javascript" src="' . $conf['prefix'] . '/' . $__js_link . '"></script>' . "\n";
}
}
?>
<script type="text/javascript" src="<?php echo $conf['prefix']; ?>/lib/js/utils.js"></script>
<script type="text/javascript">
<!--
<?php
printf("var StorageDir = '%s';\n", addcslashes($conf['storage-dir'], '\'"/\\'));
printf("var MediaAlias = '%s';\n", addcslashes($conf['media-alias'], '\'"/\\'));
printf(
"var flowplayer_conf = '%s';\n",
addcslashes($conf['flowplayer-path'] . '/' . $conf['flowplayer-js'], '\'"/\\')
);
printf(
"var flowplayer_swf = '%s';\n",
addcslashes($conf['flowplayer-path'] . '/' . $conf['flowplayer-swf'], '\'"/\\')
);
printf(
"var flowplayer_pseaudio = '%s';\n",
addcslashes($conf['flowplayer-path'] . '/' . $conf['flowplayer-pseaudiostreaming'], '\'"/\\')
);
?>
var MSIE = false;
var GECKO = false;
var WEBKIT = false;
var UA = navigator.userAgent.toLowerCase();
if (UA.indexOf('msie') >= 0 || UA.indexOf('trident') >= 0) {
MSIE = true;
} else if (UA.indexOf('webkit') >= 0) {
WEBKIT = true;
} else if (UA.indexOf('gecko') >= 0) {
GECKO = true;
}
var tipobj = null;
var offsetxpoint = -60; //Customize x offset of tooltip
var offsetypoint = 20; //Customize y offset of tooltip
var ie = document.all;
var ns6 = document.getElementById && !document.all;
var enabletip = false;
var hint = null;
//очистка html-контента элемента
function clear_innerHTML(obj) {
var child;
while (child = obj.firstChild)
obj.removeChild(child);
obj.innerHTML = '';
}
function ietruebody() {
return (document.compatMode &&
document.compatMode != 'BackCompat') ? document.documentElement : document.body;
}
function ddrivetip(thetext, thecolor, thewidth) {
if (ns6 || ie) {
if (thetext && typeof thetext != 'undefined') {
clear_innerHTML(tipobj);
tipobj.innerHTML = thetext;
} else if (hint != null) {
clear_innerHTML(tipobj);
tipobj.innerHTML = hint;
} else {
return false;
}
if (thewidth || typeof thewidth != 'undefined') {
tipobj.style.width = thewidth + 'px';
}
if (thecolor && typeof thecolor != 'undefined' && thecolor != '') {
tipobj.style.backgroundColor = thecolor;
}
enabletip = true;
return false;
}
}
function positiontip(e) {
if (enabletip) {
var curX = (ns6) ? e.pageX : event.clientX + ietruebody().scrollLeft;
var curY = (ns6) ? e.pageY : event.clientY + ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge = ie && !window.opera ?
ietruebody().clientWidth - event.clientX - offsetxpoint :
window.innerWidth - e.clientX - offsetxpoint - 20;
var bottomedge = ie && !window.opera ?
ietruebody().clientHeight - event.clientY - offsetypoint :
window.innerHeight - e.clientY - offsetypoint - 20;
var leftedge = (offsetxpoint < 0) ? offsetxpoint * (-1) : -1000;
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge < tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
{
tipobj.style.left = ie ?
ietruebody().scrollLeft + event.clientX - tipobj.offsetWidth + "px" :
window.pageXOffset + e.clientX - tipobj.offsetWidth + "px";
}
else if (curX < leftedge) {
tipobj.style.left = "5px";
}
else
//position the horizontal position of the menu where the mouse is positioned
{
tipobj.style.left = curX + offsetxpoint + "px"
}
//same concept with the vertical position
if (bottomedge < tipobj.offsetHeight) {
tipobj.style.top = ie ?
ietruebody().scrollTop + event.clientY - tipobj.offsetHeight - offsetypoint + "px" :
window.pageYOffset + e.clientY - tipobj.offsetHeight - offsetypoint + "px";
}
else {
tipobj.style.top = curY + offsetypoint + "px";
}
tipobj.style.visibility = "visible";
}
}
function hideddrivetip() {
if (ns6 || ie) {
enabletip = false;
tipobj.style.visibility = "hidden";
tipobj.style.left = "-1000px";
tipobj.style.backgroundColor = '';
tipobj.style.width = '';
}
}
function MakeArray(n) {
this.length = n;
return this;
}
monthNames = new MakeArray(12);
monthNames[1] = "Янв";
monthNames[2] = "Фев";
monthNames[3] = "Мар";
monthNames[4] = "Апр";
monthNames[5] = "Мая";
monthNames[6] = "Июн";
monthNames[7] = "Июл";
monthNames[8] = "Авг";
monthNames[9] = "Сен";
monthNames[10] = "Окт";
monthNames[11] = "Ноя";
monthNames[12] = "Дек";
dayNames = new MakeArray(7);
dayNames[0] = "Вск";
dayNames[1] = "Пнд";
dayNames[2] = "Втр";
dayNames[3] = "Срд";
dayNames[4] = "Чтв";
dayNames[5] = "Птн";
dayNames[6] = "Сбт";
function SetCookie(cookieName, cookieValue, nDays, Path) {
var today = new Date();
var expire = new Date();
if (nDays == null || nDays == 0) {
nDays = 1;
}
expire.setTime(today.getTime() + 3600000 * 24 * nDays);
var dpath = (Path != null && Path != '') ? ';path=' + Path : '';
document.cookie = cookieName + '=' + escape(cookieValue) + ";expires=" + expire.toGMTString() + dpath;
if (MSIE) {
document.cookie = cookieName + '=' + escape(cookieValue) + ";expires=" + expire.toGMTString();
}
}
function ReadCookie(cookieName) {
if (!(cookieName && typeof cookieName != 'undefined')) {
return "";
}
var theCookie = "" + document.cookie;
var ind = theCookie.indexOf(cookieName);
if (ind == -1) {
;
}
var ind1 = theCookie.indexOf(';', ind);
if (ind1 == -1) {
ind1 = theCookie.length;
}
return unescape(theCookie.substring(ind + cookieName.length + 1, ind1));
}
<?php
if (isset($include_javascripts) && is_array($include_javascripts)) {
foreach ($include_javascripts as &$__js) {
if (preg_match('/\.php$/i', $__js)) {
require ($wwwdir.$__js); // todo fix this - you don't want to include javascript files like this
} else {
readfile($wwwdir.$__js);
}
}
}
?>
// -->
</script>
</head>
<?php
if (!isset($NOBODY)) {
if (isset($MENU)) {
$pageBgColor = $left_bgcolor;
} else {
if (!isset($pageBgColor)) {
$pageBgColor = $ContentColor;
}
// print_syslog(LOG_NOTICE, 'access: '.basename($_SERVER['SCRIPT_FILENAME']));
}
if (!isset($body_style)) {
$body_style = '';
}
if (isset($pageBgColor) && !empty($pageBgColor)) {
$body_style .= 'background-color: ' . $pageBgColor . ';';
} else {
$body_style .= 'visibility:visible;';
}
if (isset($body_onload) && !empty($body_onload)) {
$_onload = 'onload="JavaScript:' . $body_onload . '"';
} elseif (isset($load) && !empty($load)) {
$_onload = 'onload="JavaScript:window.open(\'' . $load . '\', target=\'content\')"';
} else {
$_onload = '';
}
if (!isset($body_addons)) {
$body_addons = '';
}
/*
if ( isset($body_onunload) && !empty($body_onunload) )
$_onload = 'onunload="JavaScript:'.$body_onunload.'"';
*/
print sprintf('<body style="%s" %s %s>', $body_style, $_onload, $body_addons) . "\n";
$custom_header = preg_replace(
'%^' . $conf['prefix'] . '(/.+)\.php$%',
'\1_header.inc.php',
$_SERVER['SCRIPT_NAME']
);
if (0 != strcmp($_SERVER['SCRIPT_NAME'], $custom_header)) {
if ($conf['debug']) {
print '<div class="legend header"><span class="legend">@include "' .
$conf['customize-dir'] . $custom_header . "\"</span>\n";
}
#tohtml($_SERVER['SCRIPT_NAME']);
@include($conf['customize-dir'] . $custom_header);
if ($conf['debug']) {
print "</div>\n";
}
}
}
?>
<noscript>
<center>
<div class="help" style="width:50%;text-align:left;">
Ваш браузер не использует JavaScript.<br>
Включите поддержку JavaScript и перегрузите/обновите эту страницу.
</div>
</center>
</noscript>
<div id="tooltip"></div>
<?php
// чтобы из включений customize/PAGE_header.inc.php можно было другой http-ответ послать, например redirect
if (empty($NO_OB_END_FLUSH)) {
while (@ob_end_flush()) {
// do nothing
};
}
/* vim: set expandtab smartindent tabstop=4 shiftwidth=4: */