| 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: | |
| 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: | |
| 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: |
|
| 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: | |