1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* System Preloads |
4
|
|
|
* |
5
|
|
|
* You may not change or alter any portion of this comment or credits |
6
|
|
|
* of supporting developers from this source code or any supporting source code |
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
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. |
11
|
|
|
* |
12
|
|
|
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
13
|
|
|
* @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html) |
14
|
|
|
* @author Cointin Maxime (AKA Kraven30) |
15
|
|
|
* @author Andricq Nicolas (AKA MusS) |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class SystemCorePreload |
22
|
|
|
*/ |
23
|
|
|
class SystemCorePreload extends XoopsPreloadItem |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* @param $args |
27
|
|
|
*/ |
28
|
|
|
public static function eventCoreIncludeFunctionsRedirectheader($args) |
29
|
|
|
{ |
30
|
|
|
global $xoopsConfig; |
31
|
|
|
$url = $args[0]; |
32
|
|
|
if (preg_match("/[\\0-\\31]|about:|script:/i", $url)) { |
33
|
|
|
if (!preg_match('/^\b(java)?script:([\s]*)history\.go\(-\d*\)([\s]*[;]*[\s]*)$/si', $url)) { |
34
|
|
|
$url = XOOPS_URL; |
35
|
|
|
} |
36
|
|
|
} |
37
|
|
|
if (!headers_sent() && isset($xoopsConfig['redirect_message_ajax']) && $xoopsConfig['redirect_message_ajax']) { |
38
|
|
|
$_SESSION['redirect_message'] = $args[2]; |
39
|
|
|
header('Location: ' . preg_replace('/[&]amp;/i', '&', $url)); |
40
|
|
|
exit(); |
41
|
|
|
} |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param $args |
46
|
|
|
*/ |
47
|
|
|
public static function eventCoreHeaderCheckcache($args) |
|
|
|
|
48
|
|
|
{ |
49
|
|
|
if (!empty($_SESSION['redirect_message'])) { |
50
|
|
|
$GLOBALS['xoTheme']->contentCacheLifetime = 0; |
51
|
|
|
unset($_SESSION['redirect_message']); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param $args |
57
|
|
|
*/ |
58
|
|
|
public static function eventCoreHeaderAddmeta($args) |
|
|
|
|
59
|
|
|
{ |
60
|
|
|
$GLOBALS['xoTheme']->addStylesheet('media/font-awesome/css/font-awesome.min.css'); |
61
|
|
|
if (defined('XOOPS_STARTPAGE_REDIRECTED') || (isset($GLOBALS['xoopsOption']['template_main']) && $GLOBALS['xoopsOption']['template_main'] === 'db:system_homepage.tpl')) { |
62
|
|
|
if (is_object($GLOBALS['xoopsTpl'])) { |
63
|
|
|
$GLOBALS['xoopsTpl']->assign('homepage', true); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
if (!empty($_SESSION['redirect_message'])) { |
68
|
|
|
/** |
69
|
|
|
* Don't load jquery if already done by the theme |
70
|
|
|
*/ |
71
|
|
|
$GLOBALS['xoTheme']->addScript('', array('type' => 'text/javascript'), " |
72
|
|
|
if (typeof jQuery == 'undefined') { |
73
|
|
|
var tag = '<scr' + 'ipt type=\'text/javascript\' src=\'" . XOOPS_URL . "/browse.php?Frameworks/jquery/jquery.js\'></scr' + 'ipt>'; |
74
|
|
|
document.write(tag); |
75
|
|
|
};" |
76
|
|
|
); |
77
|
|
|
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js'); |
78
|
|
|
$GLOBALS['xoTheme']->addScript('', array('type' => 'text/javascript'), ' |
79
|
|
|
(function($){ |
80
|
|
|
$(document).ready(function(){ |
81
|
|
|
$.jGrowl("' . $_SESSION['redirect_message'] . '", { life:3000 , position: "center", speed: "slow" }); |
82
|
|
|
}); |
83
|
|
|
})(jQuery); |
84
|
|
|
'); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @param $args |
90
|
|
|
*/ |
91
|
|
|
public static function eventSystemClassGuiHeader($args) |
|
|
|
|
92
|
|
|
{ |
93
|
|
|
$GLOBALS['xoTheme']->addStylesheet('media/font-awesome/css/font-awesome.min.css'); |
94
|
|
|
if (!empty($_SESSION['redirect_message'])) { |
95
|
|
|
//$GLOBALS['xoTheme']->addStylesheet('xoops.css'); |
96
|
|
|
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js'); |
97
|
|
|
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js'); |
98
|
|
|
$GLOBALS['xoTheme']->addScript('', array('type' => 'text/javascript'), ' |
99
|
|
|
(function($){ |
100
|
|
|
$(document).ready(function(){ |
101
|
|
|
$.jGrowl("' . $_SESSION['redirect_message'] . '", { life:3000 , position: "center", speed: "slow" }); |
102
|
|
|
}); |
103
|
|
|
})(jQuery); |
104
|
|
|
'); |
105
|
|
|
unset($_SESSION['redirect_message']); |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.