|
1
|
|
|
<?php namespace XoopsModules\Mymenus; |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
You may not change or alter any portion of this comment or credits |
|
5
|
|
|
of supporting developers from this source code or any supporting source code |
|
6
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
7
|
|
|
|
|
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
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
15
|
|
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License |
|
16
|
|
|
* @package Mymenus |
|
17
|
|
|
* @since 1.0 |
|
18
|
|
|
* @author trabis <[email protected]> |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
use XoopsModules\Mymenus; |
|
22
|
|
|
|
|
23
|
|
|
defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
|
24
|
|
|
|
|
25
|
|
|
//require dirname(__DIR__) . '/include/common.php'; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Class Links |
|
29
|
|
|
*/ |
|
30
|
|
|
class Links extends \XoopsObject |
|
|
|
|
|
|
31
|
|
|
{ |
|
32
|
|
|
/** |
|
33
|
|
|
* @var Links |
|
34
|
|
|
* @access private |
|
35
|
|
|
*/ |
|
36
|
|
|
private $helper; |
|
37
|
|
|
private $db; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* constructor |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct() |
|
43
|
|
|
{ |
|
44
|
|
|
/** @var \XoopsModules\Mymenus\Helper $this->helper */ |
|
45
|
|
|
$this->helper = \XoopsModules\Mymenus\Helper::getInstance(); |
|
46
|
|
|
$this->db = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
|
|
|
|
|
47
|
|
|
$this->initVar('id', XOBJ_DTYPE_INT); |
|
|
|
|
|
|
48
|
|
|
$this->initVar('pid', XOBJ_DTYPE_INT); |
|
49
|
|
|
$this->initVar('mid', XOBJ_DTYPE_INT); |
|
50
|
|
|
$this->initVar('title', XOBJ_DTYPE_TXTBOX); |
|
|
|
|
|
|
51
|
|
|
$this->initVar('alt_title', XOBJ_DTYPE_TXTBOX); |
|
52
|
|
|
$this->initVar('visible', XOBJ_DTYPE_INT, true); |
|
53
|
|
|
$this->initVar('link', XOBJ_DTYPE_TXTBOX); |
|
54
|
|
|
$this->initVar('weight', XOBJ_DTYPE_INT, 255); |
|
55
|
|
|
$this->initVar('target', XOBJ_DTYPE_TXTBOX); |
|
56
|
|
|
$this->initVar('groups', XOBJ_DTYPE_ARRAY, serialize([XOOPS_GROUP_ANONYMOUS, XOOPS_GROUP_USERS])); |
|
|
|
|
|
|
57
|
|
|
$this->initVar('hooks', XOBJ_DTYPE_ARRAY, serialize([])); |
|
58
|
|
|
$this->initVar('image', XOBJ_DTYPE_TXTBOX); |
|
59
|
|
|
$this->initVar('css', XOBJ_DTYPE_TXTBOX); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return bool |
|
64
|
|
|
*/ |
|
65
|
|
|
public function checkAccess() |
|
66
|
|
|
{ |
|
67
|
|
|
$hooks = $this->getHooks(); |
|
68
|
|
|
$hooks['mymenus'][] = 'checkAccess'; |
|
69
|
|
|
foreach ($hooks as $hookName => $hook) { |
|
70
|
|
|
if (!mymenusHook($hookName, 'checkAccess', ['links' => $this])) { |
|
|
|
|
|
|
71
|
|
|
return false; |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
return true; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @return array |
|
80
|
|
|
*/ |
|
81
|
|
|
public function getHooks() |
|
82
|
|
|
{ |
|
83
|
|
|
$ret = []; |
|
84
|
|
|
$data = $this->getVar('hooks', 'n'); |
|
85
|
|
|
if (!$data) { |
|
86
|
|
|
return $ret; |
|
87
|
|
|
} |
|
88
|
|
|
$lines = explode("\n", $data); |
|
89
|
|
|
foreach ($lines as $line) { |
|
90
|
|
|
$line = trim($line); |
|
91
|
|
|
$line = explode('|', $line); |
|
92
|
|
|
$hook = trim($line[0]); |
|
93
|
|
|
$method = isset($line[1]) ? trim($line[1]) : ''; |
|
94
|
|
|
//$info = explode(',', trim($line[0])); |
|
95
|
|
|
$ret[$hook][] = $method; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
return $ret; |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths