1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* **************************************************************************** |
5
|
|
|
* - A Project by Developers TEAM For Xoops - ( https://xoops.org ) |
6
|
|
|
* **************************************************************************** |
7
|
|
|
* XHTTPERROR - MODULE FOR XOOPS |
8
|
|
|
* Copyright (c) 2007 - 2012 |
9
|
|
|
* Rota Lucio ( http://luciorota.altervista.org/xoops/ ) |
10
|
|
|
* |
11
|
|
|
* You may not change or alter any portion of this comment or credits |
12
|
|
|
* of supporting developers from this source code or any supporting |
13
|
|
|
* source code which is considered copyrighted (c) material of the |
14
|
|
|
* original comment or credit authors. |
15
|
|
|
* |
16
|
|
|
* This program is distributed in the hope that it will be useful, |
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19
|
|
|
* GNU General Public License for more details. |
20
|
|
|
* --------------------------------------------------------------------------- |
21
|
|
|
* @copyright Rota Lucio ( http://luciorota.altervista.org/xoops/ ) |
22
|
|
|
* @license GNU General Public License v3.0 |
23
|
|
|
* @package xhttperror |
24
|
|
|
* @author Rota Lucio ( [email protected] ) |
25
|
|
|
* |
26
|
|
|
* $Rev$: Revision of last commit |
27
|
|
|
* $Author$: Author of last commit |
28
|
|
|
* $Date$: Date of last commit |
29
|
|
|
* **************************************************************************** |
30
|
|
|
*/ |
31
|
|
|
function xhttperror_checkModuleAdmin() |
32
|
|
|
{ |
33
|
|
|
if (is_file($GLOBALS['xoops']->path('Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))) { |
34
|
|
|
require_once $GLOBALS['xoops']->path('Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); |
35
|
|
|
|
36
|
|
|
return true; |
37
|
|
|
} |
38
|
|
|
echo xoops_error("Error: You don't use the Frameworks \"admin module\". Please install this Frameworks"); |
|
|
|
|
39
|
|
|
|
40
|
|
|
return false; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param $global |
45
|
|
|
* @param $key |
46
|
|
|
* @param string $default |
47
|
|
|
* @param string $type |
48
|
|
|
* @return false|int|mixed|string |
49
|
|
|
*/ |
50
|
|
|
function xhttperror_CleanVars($global, $key, $default = '', $type = 'int') |
51
|
|
|
{ |
52
|
|
|
switch ($type) { |
53
|
|
|
case 'array': |
54
|
|
|
$ret = (isset($global[$key]) && is_array($global[$key])) ? $global[$key] : $default; |
55
|
|
|
break; |
56
|
|
|
case 'date': |
57
|
|
|
$ret = isset($global[$key]) ? strtotime($global[$key]) : $default; |
58
|
|
|
break; |
59
|
|
|
case 'string': |
60
|
|
|
if (defined('FILTER_SANITIZE_ADD_SLASHES')) { |
61
|
|
|
$ret = isset($global[$key]) ? filter_var($global[$key], FILTER_SANITIZE_ADD_SLASHES) : $default; |
62
|
|
|
} else { |
63
|
|
|
$ret = isset($global[$key]) ? filter_var($global[$key], FILTER_SANITIZE_MAGIC_QUOTES) : $default; |
64
|
|
|
} |
65
|
|
|
break; |
66
|
|
|
case 'int': |
67
|
|
|
default: |
68
|
|
|
$ret = isset($global[$key]) ? filter_var($global[$key], FILTER_SANITIZE_NUMBER_INT) : $default; |
69
|
|
|
break; |
70
|
|
|
} |
71
|
|
|
if (false === $ret) { |
72
|
|
|
return $default; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
return $ret; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param $content |
80
|
|
|
*/ |
81
|
|
|
function xhttperror_meta_keywords($content) |
82
|
|
|
{ |
83
|
|
|
global $xoopsTpl, $xoTheme; |
84
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
85
|
|
|
$content = $myts->undoHtmlSpecialChars($myts->displayTbox($content)); |
|
|
|
|
86
|
|
|
if (isset($xoTheme) && is_object($xoTheme)) { |
87
|
|
|
$xoTheme->addMeta('meta', 'keywords', strip_tags($content)); |
88
|
|
|
} else { // Compatibility for old Xoops versions |
89
|
|
|
$xoopsTpl->assign('xoops_meta_keywords', strip_tags($content)); |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param $content |
95
|
|
|
*/ |
96
|
|
|
function xhttperror_meta_description($content) |
97
|
|
|
{ |
98
|
|
|
global $xoopsTpl, $xoTheme; |
99
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
100
|
|
|
$content = $myts->undoHtmlSpecialChars($myts->displayTarea($content)); |
101
|
|
|
if (isset($xoTheme) && is_object($xoTheme)) { |
102
|
|
|
$xoTheme->addMeta('meta', 'description', strip_tags($content)); |
103
|
|
|
} else { // Compatibility for old Xoops versions |
104
|
|
|
$xoopsTpl->assign('xoops_meta_description', strip_tags($content)); |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.