1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
17:
18:
19:
20: 21: 22:
23: class SystemCorePreload extends XoopsPreloadItem
24: {
25: 26: 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: 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: 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: $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');
70: $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js');
71: $GLOBALS['xoTheme']->addScript('', array('type' => 'text/javascript'), '
72: (function($){
73: $(document).ready(function(){
74: $.jGrowl("' . $_SESSION['redirect_message'] . '", { life:3000 , position: "center", speed: "slow" });
75: });
76: })(jQuery);
77: ');
78: }
79: }
80:
81: 82: 83:
84: public static function eventSystemClassGuiHeader($args)
85: {
86: $GLOBALS['xoTheme']->addStylesheet('media/font-awesome/css/font-awesome.min.css');
87: if (!empty($_SESSION['redirect_message'])) {
88:
89: $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');
90: $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js');
91: $GLOBALS['xoTheme']->addScript('', array('type' => 'text/javascript'), '
92: (function($){
93: $(document).ready(function(){
94: $.jGrowl("' . $_SESSION['redirect_message'] . '", { life:3000 , position: "center", speed: "slow" });
95: });
96: })(jQuery);
97: ');
98: unset($_SESSION['redirect_message']);
99: }
100: }
101: }
102: