These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * /classes/DomainMOD/Assets.php |
||
4 | * |
||
5 | * This file is part of DomainMOD, an open source domain and internet asset manager. |
||
6 | * Copyright (c) 2010-2017 Greg Chetcuti <[email protected]> |
||
7 | * |
||
8 | * Project: http://domainmod.org Author: http://chetcuti.com |
||
9 | * |
||
10 | * DomainMOD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public |
||
11 | * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
||
12 | * version. |
||
13 | * |
||
14 | * DomainMOD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
||
15 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
||
16 | * |
||
17 | * You should have received a copy of the GNU General Public License along with DomainMOD. If not, see |
||
18 | * http://www.gnu.org/licenses/. |
||
19 | * |
||
20 | */ |
||
21 | //@formatter:off |
||
22 | namespace DomainMOD; |
||
23 | |||
24 | class Assets |
||
25 | { |
||
26 | public $system; |
||
27 | public $error; |
||
28 | public $log; |
||
29 | |||
30 | public function __construct() |
||
31 | { |
||
32 | $this->system = new System(); |
||
33 | $this->log = new Log('assets.class'); |
||
34 | $this->error = new Error(); |
||
35 | } |
||
36 | |||
37 | View Code Duplication | public function getRegistrar($registrar_id) |
|
1 ignored issue
–
show
|
|||
38 | { |
||
39 | $pdo = $this->system->db(); |
||
40 | |||
41 | $stmt = $pdo->prepare(" |
||
42 | SELECT `name` |
||
43 | FROM registrars |
||
44 | WHERE id = :registrar_id"); |
||
45 | $stmt->bindValue('registrar_id', $registrar_id, \PDO::PARAM_INT); |
||
46 | $stmt->execute(); |
||
47 | $result = $stmt->fetchColumn(); |
||
48 | |||
49 | if (!$result) { |
||
50 | |||
51 | $log_message = 'Unable to retrieve Registrar name'; |
||
52 | $log_extra = array('Registrar ID' => $registrar_id); |
||
53 | $this->log->error($log_message, $log_extra); |
||
54 | return $log_message; |
||
55 | |||
56 | } else { |
||
57 | |||
58 | return $result; |
||
59 | |||
60 | } |
||
61 | } |
||
62 | |||
63 | View Code Duplication | public function getRegistrarByAcc($account_id) |
|
1 ignored issue
–
show
The parameter $account_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
64 | { |
||
65 | $pdo = $this->system->db(); |
||
66 | |||
67 | $stmt = $pdo->prepare(" |
||
68 | SELECT r.name |
||
69 | FROM registrars AS r, registrar_accounts AS ra |
||
70 | WHERE r.id = ra.registrar_id |
||
71 | AND ra.id = :account_id |
||
72 | LIMIT 1"); |
||
73 | $stmt->bindValue('account_id', $account_id, \PDO::PARAM_INT); |
||
74 | $stmt->execute(); |
||
75 | $result = $stmt->fetchColumn(); |
||
76 | |||
77 | if (!$result) { |
||
78 | |||
79 | $log_message = 'Unable to retrieve Registrar name'; |
||
80 | $log_extra = array('Account ID' => $account_id); |
||
81 | $this->log->error($log_message, $log_extra); |
||
82 | return $log_message; |
||
83 | |||
84 | } else { |
||
85 | |||
86 | return $result; |
||
87 | |||
88 | } |
||
89 | } |
||
90 | |||
91 | View Code Duplication | public function getSslType($type_id) |
|
1 ignored issue
–
show
The parameter $type_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
92 | { |
||
93 | $pdo = $this->system->db(); |
||
94 | |||
95 | $stmt = $pdo->prepare(" |
||
96 | SELECT type |
||
97 | FROM ssl_cert_types |
||
98 | WHERE id = :type_id"); |
||
99 | $stmt->bindValue('type_id', $type_id, \PDO::PARAM_INT); |
||
100 | $stmt->execute(); |
||
101 | $result = $stmt->fetchColumn(); |
||
102 | |||
103 | if (!$result) { |
||
104 | |||
105 | $log_message = 'Unable to retrieve SSL Type'; |
||
106 | $log_extra = array('SSL Type ID' => $type_id); |
||
107 | $this->log->error($log_message, $log_extra); |
||
108 | return $log_message; |
||
109 | |||
110 | } else { |
||
111 | |||
112 | return $result; |
||
113 | |||
114 | } |
||
115 | } |
||
116 | |||
117 | View Code Duplication | public function getDnsName($dns_id) |
|
1 ignored issue
–
show
The parameter $dns_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
118 | { |
||
119 | $pdo = $this->system->db(); |
||
120 | |||
121 | $stmt = $pdo->prepare(" |
||
122 | SELECT `name` |
||
123 | FROM dns |
||
124 | WHERE id = :dns_id"); |
||
125 | $stmt->bindValue('dns_id', $dns_id, \PDO::PARAM_INT); |
||
126 | $stmt->execute(); |
||
127 | $result = $stmt->fetchColumn(); |
||
128 | |||
129 | if (!$result) { |
||
130 | |||
131 | $log_message = 'Unable to retrieve DNS Profile name'; |
||
132 | $log_extra = array('DNS Profile ID' => $dns_id); |
||
133 | $this->log->error($log_message, $log_extra); |
||
134 | return $log_message; |
||
135 | |||
136 | } else { |
||
137 | |||
138 | return $result; |
||
139 | |||
140 | } |
||
141 | } |
||
142 | |||
143 | View Code Duplication | public function getIpName($ip_id) |
|
1 ignored issue
–
show
The parameter $ip_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
144 | { |
||
145 | $pdo = $this->system->db(); |
||
146 | |||
147 | $stmt = $pdo->prepare(" |
||
148 | SELECT `name` |
||
149 | FROM ip_addresses |
||
150 | WHERE id = :ip_id"); |
||
151 | $stmt->bindValue('ip_id', $ip_id, \PDO::PARAM_INT); |
||
152 | $stmt->execute(); |
||
153 | $result = $stmt->fetchColumn(); |
||
154 | |||
155 | if (!$result) { |
||
156 | |||
157 | $log_message = 'Unable to retrieve IP Address name'; |
||
158 | $log_extra = array('IP Address ID' => $ip_id); |
||
159 | $this->log->error($log_message, $log_extra); |
||
160 | return $log_message; |
||
161 | |||
162 | } else { |
||
163 | |||
164 | return $result; |
||
165 | |||
166 | } |
||
167 | } |
||
168 | |||
169 | public function getIpAndName($ip_id) |
||
1 ignored issue
–
show
The parameter $ip_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
170 | { |
||
171 | $pdo = $this->system->db(); |
||
172 | |||
173 | $stmt = $pdo->prepare(" |
||
174 | SELECT `name`, ip |
||
175 | FROM ip_addresses |
||
176 | WHERE id = :ip_id"); |
||
177 | $stmt->bindValue('ip_id', $ip_id, \PDO::PARAM_INT); |
||
178 | $stmt->execute(); |
||
179 | $result = $stmt->fetch(); |
||
180 | |||
181 | if (!$result) { |
||
182 | |||
183 | $log_message = 'Unable to retrieve IP Address name & IP Address'; |
||
184 | $log_extra = array('IP Address ID' => $ip_id); |
||
185 | $this->log->error($log_message, $log_extra); |
||
186 | return array($log_message, ''); |
||
187 | |||
188 | } else { |
||
189 | |||
190 | return array($result->name, $result->ip); |
||
191 | |||
192 | } |
||
193 | } |
||
194 | |||
195 | View Code Duplication | public function getSslProvider($ssl_provider_id) |
|
1 ignored issue
–
show
The parameter $ssl_provider_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
196 | { |
||
197 | $pdo = $this->system->db(); |
||
198 | |||
199 | $stmt = $pdo->prepare(" |
||
200 | SELECT `name` |
||
201 | FROM ssl_providers |
||
202 | WHERE id = :ssl_provider_id"); |
||
203 | $stmt->bindValue('ssl_provider_id', $ssl_provider_id, \PDO::PARAM_INT); |
||
204 | $stmt->execute(); |
||
205 | $result = $stmt->fetchColumn(); |
||
206 | |||
207 | if (!$result) { |
||
208 | |||
209 | $log_message = 'Unable to retrieve SSL Provider name'; |
||
210 | $log_extra = array('SSL Provider ID' => $ssl_provider_id); |
||
211 | $this->log->error($log_message, $log_extra); |
||
212 | return $log_message; |
||
213 | |||
214 | } else { |
||
215 | |||
216 | return $result; |
||
217 | |||
218 | } |
||
219 | } |
||
220 | |||
221 | View Code Duplication | public function getOwner($owner_id) |
|
1 ignored issue
–
show
The parameter $owner_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
222 | { |
||
223 | $pdo = $this->system->db(); |
||
224 | |||
225 | $stmt = $pdo->prepare(" |
||
226 | SELECT `name` |
||
227 | FROM owners |
||
228 | WHERE id = :owner_id"); |
||
229 | $stmt->bindValue('owner_id', $owner_id, \PDO::PARAM_INT); |
||
230 | $stmt->execute(); |
||
231 | $result = $stmt->fetchColumn(); |
||
232 | |||
233 | if (!$result) { |
||
234 | |||
235 | $log_message = 'Unable to retrieve Owner name'; |
||
236 | $log_extra = array('Owner ID' => $owner_id); |
||
237 | $this->log->error($log_message, $log_extra); |
||
238 | return $log_message; |
||
239 | |||
240 | } else { |
||
241 | |||
242 | return $result; |
||
243 | |||
244 | } |
||
245 | } |
||
246 | |||
247 | View Code Duplication | public function getHost($host_id) |
|
1 ignored issue
–
show
The parameter $host_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
248 | { |
||
249 | $pdo = $this->system->db(); |
||
250 | |||
251 | $stmt = $pdo->prepare(" |
||
252 | SELECT `name` |
||
253 | FROM hosting |
||
254 | WHERE id = :host_id"); |
||
255 | $stmt->bindValue('host_id', $host_id, \PDO::PARAM_INT); |
||
256 | $stmt->execute(); |
||
257 | $result = $stmt->fetchColumn(); |
||
258 | |||
259 | if (!$result) { |
||
260 | |||
261 | $log_message = 'Unable to retrieve Hosting name'; |
||
262 | $log_extra = array('Hosting ID' => $host_id); |
||
263 | $this->log->error($log_message, $log_extra); |
||
264 | return $log_message; |
||
265 | |||
266 | } else { |
||
267 | |||
268 | return $result; |
||
269 | |||
270 | } |
||
271 | } |
||
272 | |||
273 | View Code Duplication | public function getCat($cat_id) |
|
1 ignored issue
–
show
The parameter $cat_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
274 | { |
||
275 | $pdo = $this->system->db(); |
||
276 | |||
277 | $stmt = $pdo->prepare(" |
||
278 | SELECT `name` |
||
279 | FROM categories |
||
280 | WHERE id = :cat_id"); |
||
281 | $stmt->bindValue('cat_id', $cat_id, \PDO::PARAM_INT); |
||
282 | $stmt->execute(); |
||
283 | $result = $stmt->fetchColumn(); |
||
284 | |||
285 | if (!$result) { |
||
286 | |||
287 | $log_message = 'Unable to retrieve Category'; |
||
288 | $log_extra = array('Category ID' => $cat_id); |
||
289 | $this->log->error($log_message, $log_extra); |
||
290 | return $log_message; |
||
291 | |||
292 | } else { |
||
293 | |||
294 | return $result; |
||
295 | |||
296 | } |
||
297 | } |
||
298 | |||
299 | View Code Duplication | public function getUsername($account_id) |
|
1 ignored issue
–
show
The parameter $account_id is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes
Loading history...
|
|||
300 | { |
||
301 | $pdo = $this->system->db(); |
||
302 | |||
303 | $stmt = $pdo->prepare(" |
||
304 | SELECT username |
||
305 | FROM registrar_accounts |
||
306 | WHERE id = :account_id"); |
||
307 | $stmt->bindValue('account_id', $account_id, \PDO::PARAM_INT); |
||
308 | $stmt->execute(); |
||
309 | |||
310 | $result = $stmt->fetchColumn(); |
||
311 | |||
312 | if (!$result) { |
||
313 | |||
314 | $log_message = 'Unable to retrieve Registrar Account Username'; |
||
315 | $log_extra = array('Account ID' => $account_id); |
||
316 | $this->log->error($log_message, $log_extra); |
||
317 | return $log_message; |
||
318 | |||
319 | } else { |
||
320 | |||
321 | return $result; |
||
322 | |||
323 | } |
||
324 | } |
||
325 | |||
326 | } //@formatter:on |
||
327 |
This check marks parameter names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString
.