This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php declare(strict_types=1); |
||
2 | |||
3 | namespace XoopsModules\Suico; |
||
4 | |||
5 | /* |
||
6 | You may not change or alter any portion of this comment or credits |
||
7 | of supporting developers from this source code or any supporting source code |
||
8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
9 | |||
10 | This program is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
13 | */ |
||
14 | |||
15 | /** |
||
16 | * @category Module |
||
17 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
18 | * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
19 | * @author Bruno Barthez, Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
20 | */ |
||
21 | |||
22 | use Xmf\Module\Helper\Permission; |
||
23 | use XoopsDatabaseFactory; |
||
24 | use XoopsObject; |
||
25 | |||
26 | require_once XOOPS_ROOT_PATH . '/kernel/object.php'; |
||
27 | |||
28 | /** |
||
29 | * Configs class. |
||
30 | * $this class is responsible for providing data access mechanisms to the data source |
||
31 | * of XOOPS user class objects. |
||
32 | */ |
||
33 | class Configs extends XoopsObject |
||
34 | { |
||
35 | public \XoopsDatabase $db; |
||
36 | public Helper $helper; |
||
37 | public Permission $permHelper; |
||
38 | public $config_id; |
||
39 | public $config_uid; |
||
40 | public $pictures; |
||
41 | public $audio; |
||
42 | public $videos; |
||
43 | public $groups; |
||
44 | public $notes; |
||
45 | public $friends; |
||
46 | public $profile_contact; |
||
47 | public $profile_general; |
||
48 | public $profile_stats; |
||
49 | public $suspension; |
||
50 | public $backup_password; |
||
51 | public $backup_email; |
||
52 | public $end_suspension; |
||
53 | // constructor |
||
54 | |||
55 | /** |
||
56 | * Configs constructor. |
||
57 | * @param null $id |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
58 | */ |
||
59 | public function __construct($id = null) |
||
60 | { |
||
61 | /** @var Helper $helper */ |
||
62 | $this->helper = Helper::getInstance(); |
||
63 | $this->permHelper = new Permission(); |
||
64 | $this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
||
65 | $this->initVar('config_id', \XOBJ_DTYPE_INT); |
||
66 | $this->initVar('config_uid', \XOBJ_DTYPE_INT, null, false, 10); |
||
67 | $this->initVar('pictures', \XOBJ_DTYPE_INT, null, false, 10); |
||
68 | $this->initVar('audio', \XOBJ_DTYPE_INT, null, false, 10); |
||
69 | $this->initVar('videos', \XOBJ_DTYPE_INT, null, false, 10); |
||
70 | $this->initVar('groups', \XOBJ_DTYPE_INT, null, false, 10); |
||
71 | $this->initVar('notes', \XOBJ_DTYPE_INT, null, false, 10); |
||
72 | $this->initVar('friends', \XOBJ_DTYPE_INT, null, false, 10); |
||
73 | $this->initVar('profile_contact', \XOBJ_DTYPE_INT, null, false, 10); |
||
74 | $this->initVar('profile_general', \XOBJ_DTYPE_INT, null, false, 10); |
||
75 | $this->initVar('profile_stats', \XOBJ_DTYPE_INT, null, false, 10); |
||
76 | $this->initVar('suspension', \XOBJ_DTYPE_INT, null, false, 10); |
||
77 | $this->initVar('backup_password', \XOBJ_DTYPE_TXTBOX, null, false); |
||
78 | $this->initVar('backup_email', \XOBJ_DTYPE_TXTBOX, null, false); |
||
79 | $this->initVar('end_suspension', \XOBJ_DTYPE_INT, 0, false); |
||
80 | if (!empty($id)) { |
||
81 | if (\is_array($id)) { |
||
82 | $this->assignVars($id); |
||
83 | } else { |
||
84 | $this->load((int)$id); |
||
85 | } |
||
86 | } else { |
||
87 | $this->setNew(); |
||
88 | } |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * @param $id |
||
93 | */ |
||
94 | public function load($id): void |
||
95 | { |
||
96 | $sql = 'SELECT * FROM ' . $this->db->prefix('suico_configs') . ' WHERE config_id=' . $id; |
||
97 | $myrow = $this->db->fetchArray($this->db->query($sql)); |
||
98 | $this->assignVars($myrow); |
||
99 | if (!$myrow) { |
||
100 | $this->setNew(); |
||
101 | } |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * @param array $criteria |
||
106 | * @param bool $asobject |
||
107 | * @param string $sort |
||
108 | * @param string $order |
||
109 | * @param int $limit |
||
110 | * @param int $start |
||
111 | * @return array |
||
112 | */ |
||
113 | public function getAllConfigs( |
||
114 | $criteria = [], |
||
115 | $asobject = false, |
||
116 | $sort = 'config_id', |
||
117 | $order = 'ASC', |
||
118 | $limit = 0, |
||
119 | $start = 0 |
||
120 | ) { |
||
121 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
||
122 | $ret = []; |
||
123 | $whereQuery = ''; |
||
124 | if (\is_array($criteria) && \count($criteria) > 0) { |
||
125 | $whereQuery = ' WHERE'; |
||
126 | foreach ($criteria as $c) { |
||
127 | $whereQuery .= " {$c} AND"; |
||
128 | } |
||
129 | $whereQuery = mb_substr($whereQuery, 0, -4); |
||
130 | } elseif (!\is_array($criteria) && $criteria) { |
||
131 | $whereQuery = ' WHERE ' . $criteria; |
||
132 | } |
||
133 | if ($asobject) { |
||
134 | $sql = 'SELECT * FROM ' . $db->prefix('suico_configs') . "{$whereQuery} ORDER BY {$sort} {$order}"; |
||
135 | $result = $db->query($sql, $limit, $start); |
||
136 | while (false !== ($myrow = $db->fetchArray($result))) { |
||
137 | $ret[] = new self($myrow); |
||
138 | } |
||
139 | } else { |
||
140 | $sql = 'SELECT config_id FROM ' . $db->prefix( |
||
141 | 'suico_configs' |
||
142 | ) . "{$whereQuery} ORDER BY {$sort} {$order}"; |
||
143 | $result = $db->query($sql, $limit, $start); |
||
144 | while (false !== ($myrow = $db->fetchArray($result))) { |
||
145 | $ret[] = $myrow['suico_configs_id']; |
||
146 | } |
||
147 | } |
||
148 | |||
149 | return $ret; |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * Get form |
||
154 | * |
||
155 | * @return \XoopsModules\Suico\Form\ConfigsForm |
||
156 | */ |
||
157 | public function getForm() |
||
158 | { |
||
159 | return new Form\ConfigsForm($this); |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | * @return array|null |
||
164 | */ |
||
165 | public function getGroupsRead() |
||
166 | { |
||
167 | //$permHelper = new \Xmf\Module\Helper\Permission(); |
||
168 | return $this->permHelper->getGroupsForItem( |
||
169 | 'sbcolumns_read', |
||
170 | $this->getVar('config_id') |
||
171 | ); |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * @return array|null |
||
176 | */ |
||
177 | public function getGroupsSubmit() |
||
178 | { |
||
179 | //$permHelper = new \Xmf\Module\Helper\Permission(); |
||
180 | return $this->permHelper->getGroupsForItem( |
||
181 | 'sbcolumns_submit', |
||
182 | $this->getVar('config_id') |
||
183 | ); |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * @return array|null |
||
188 | */ |
||
189 | public function getGroupsModeration() |
||
190 | { |
||
191 | //$permHelper = new \Xmf\Module\Helper\Permission(); |
||
192 | return $this->permHelper->getGroupsForItem( |
||
193 | 'sbcolumns_moderation', |
||
194 | $this->getVar('config_id') |
||
195 | ); |
||
196 | } |
||
197 | } |
||
198 |