commit | author | age
|
412aa4
|
1 |
<?php |
T |
2 |
|
436ed8
|
3 |
/* |
R |
4 |
Copyright (c) 2007, Till Brehm, projektfarm Gmbh |
|
5 |
All rights reserved. |
|
6 |
|
|
7 |
Redistribution and use in source and binary forms, with or without modification, |
|
8 |
are permitted provided that the following conditions are met: |
|
9 |
|
|
10 |
* Redistributions of source code must retain the above copyright notice, |
|
11 |
this list of conditions and the following disclaimer. |
|
12 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
13 |
this list of conditions and the following disclaimer in the documentation |
|
14 |
and/or other materials provided with the distribution. |
|
15 |
* Neither the name of ISPConfig nor the names of its contributors |
|
16 |
may be used to endorse or promote products derived from this software without |
|
17 |
specific prior written permission. |
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
20 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
21 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
22 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
23 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
24 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
25 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
26 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
27 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
28 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
542146
|
29 |
|
T |
30 |
--UPDATED 08.2009-- |
|
31 |
Full SOAP support for ISPConfig 3.1.4 b |
|
32 |
Updated by Arkadiusz Roch & Artur Edelman |
|
33 |
Copyright (c) Tri-Plex technology |
|
34 |
|
436ed8
|
35 |
*/ |
R |
36 |
|
412aa4
|
37 |
class remoting { |
T |
38 |
|
|
39 |
//* remote session timeout in seconds |
|
40 |
private $session_timeout = 600; |
|
41 |
|
d77ca6
|
42 |
private $server; |
T |
43 |
|
|
44 |
/* |
|
45 |
These variables shall stay global. |
|
46 |
Please do not make them private variables. |
|
47 |
|
|
48 |
private $app; |
a75d10
|
49 |
private $conf; |
d77ca6
|
50 |
*/ |
a75d10
|
51 |
|
P |
52 |
public function __construct() |
|
53 |
{ |
d77ca6
|
54 |
global $server; |
a75d10
|
55 |
$this->server = $server; |
d77ca6
|
56 |
/* |
a75d10
|
57 |
$this->app = $app; |
P |
58 |
$this->conf = $conf; |
d77ca6
|
59 |
*/ |
a75d10
|
60 |
} |
P |
61 |
|
412aa4
|
62 |
//* remote login function |
3db182
|
63 |
public function login($username, $password) |
P |
64 |
{ |
d77ca6
|
65 |
global $app, $conf, $server; |
T |
66 |
|
412aa4
|
67 |
if(empty($username)) { |
a75d10
|
68 |
$this->server->fault('login_username_empty', 'The login username is empty'); |
412aa4
|
69 |
return false; |
T |
70 |
} |
|
71 |
|
|
72 |
if(empty($password)) { |
a75d10
|
73 |
$this->server->fault('login_password_empty', 'The login password is empty'); |
412aa4
|
74 |
return false; |
T |
75 |
} |
|
76 |
|
d77ca6
|
77 |
$username = $app->db->quote($username); |
T |
78 |
$password = $app->db->quote($password); |
412aa4
|
79 |
|
T |
80 |
$sql = "SELECT * FROM remote_user WHERE remote_username = '$username' and remote_password = md5('$password')"; |
d77ca6
|
81 |
$remote_user = $app->db->queryOneRecord($sql); |
412aa4
|
82 |
if($remote_user['remote_userid'] > 0) { |
T |
83 |
//* Create a remote user session |
|
84 |
srand ((double)microtime()*1000000); |
|
85 |
$remote_session = md5(rand()); |
|
86 |
$remote_userid = $remote_user['remote_userid']; |
|
87 |
$remote_functions = $remote_user['remote_functions']; |
|
88 |
$tstamp = time() + $this->session_timeout; |
a75d10
|
89 |
$sql = 'INSERT INTO remote_session (remote_session,remote_userid,remote_functions,tstamp' |
P |
90 |
.') VALUES (' |
|
91 |
." '$remote_session',$remote_userid,'$remote_functions',$tstamp)"; |
d77ca6
|
92 |
$app->db->query($sql); |
412aa4
|
93 |
return $remote_session; |
T |
94 |
} else { |
a75d10
|
95 |
$this->server->fault('login_failed', 'The login failed. Username or password wrong.'); |
412aa4
|
96 |
return false; |
T |
97 |
} |
|
98 |
|
|
99 |
} |
|
100 |
|
|
101 |
//* remote logout function |
3db182
|
102 |
public function logout($session_id) |
a75d10
|
103 |
{ |
d77ca6
|
104 |
global $app; |
T |
105 |
|
412aa4
|
106 |
if(empty($session_id)) { |
a75d10
|
107 |
$this->server->fault('session_id_empty', 'The SessionID is empty.'); |
412aa4
|
108 |
return false; |
T |
109 |
} |
|
110 |
|
d77ca6
|
111 |
$session_id = $app->db->quote($session_id); |
412aa4
|
112 |
|
T |
113 |
$sql = "DELETE FROM remote_session WHERE remote_session = '$session_id'"; |
d77ca6
|
114 |
$app->db->query($sql); |
T |
115 |
return ($app->db->affectedRows() == 1); |
412aa4
|
116 |
} |
T |
117 |
|
92bea0
|
118 |
//* Get mail domain details |
T |
119 |
public function mail_domain_get($session_id, $domain_id) |
|
120 |
{ |
|
121 |
if(!$this->checkPerm($session_id, 'mail_domain_get')) { |
|
122 |
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); |
|
123 |
return false; |
|
124 |
} |
|
125 |
$app->uses('remoting_lib'); |
|
126 |
$app->remoting_lib->loadFormDef('../mail/form/mail_domain.tform.php'); |
|
127 |
return $app->remoting_lib->getDataRecord($domain_id); |
|
128 |
} |
d77ca6
|
129 |
|
92bea0
|
130 |
//* Add a mail domain |
d77ca6
|
131 |
public function mail_domain_add($session_id, $client_id, $params) |
3db182
|
132 |
{ |
P |
133 |
if(!$this->checkPerm($session_id, 'mail_domain_add')) { |
a75d10
|
134 |
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); |
412aa4
|
135 |
return false; |
T |
136 |
} |
d77ca6
|
137 |
$domain_id = $this->insertQuery('../mail/form/mail_domain.tform.php',$client_id,$params); |
T |
138 |
return $domain_id; |
|
139 |
} |
|
140 |
|
92bea0
|
141 |
//* Update a mail domain |
d77ca6
|
142 |
public function mail_domain_update($session_id, $client_id, $domain_id, $params) |
T |
143 |
{ |
|
144 |
if(!$this->checkPerm($session_id, 'mail_domain_update')) { |
|
145 |
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); |
|
146 |
return false; |
|
147 |
} |
92bea0
|
148 |
$affected_rows = $this->updateQuery('../mail/form/mail_domain.tform.php',$client_id,$domain_id,$params); |
T |
149 |
return $affected_rows; |
|
150 |
} |
|
151 |
|
|
152 |
//* Delete a mail domain |
|
153 |
public function mail_domain_delete($session_id, $domain_id) |
|
154 |
{ |
|
155 |
if(!$this->checkPerm($session_id, 'mail_domain_delete')) { |
|
156 |
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); |
|
157 |
return false; |
|
158 |
} |
542146
|
159 |
$affected_rows = $this->deleteQuery('../mail/form/mail_domain.tform.php',$domain_id); |
92bea0
|
160 |
return $affected_rows; |
412aa4
|
161 |
} |
542146
|
162 |
//* dodanie uzytkownika email |
T |
163 |
public function mail_user_add($session_id,$domain_id, $client_id, $params){ |
|
164 |
if (!$this->checkPerm($session_id, 'mail_user_add')){ |
|
165 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
166 |
return false; |
|
167 |
} |
|
168 |
$affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php',$domain_id, $client_id, $params); |
|
169 |
return $affected_rows; |
|
170 |
} |
|
171 |
|
|
172 |
//* edycja uzytkownika email |
|
173 |
public function mail_user_update($session_id, $client_id, $domain_id, $params) |
|
174 |
{ |
|
175 |
if (!$this->checkPerm($session_id, 'mail_user_update')) |
|
176 |
{ |
|
177 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
178 |
return false; |
|
179 |
} |
|
180 |
$affected_rows = $this->updateQuery('../mail/form/mail_user.tform.php', $client_id, $domain_id, $params); |
|
181 |
return $affected_rows; |
|
182 |
} |
|
183 |
|
412aa4
|
184 |
|
542146
|
185 |
//*usuniecie uzytkownika emial |
T |
186 |
public function mail_user_delete($session_id,$domain_id) |
|
187 |
{ |
|
188 |
if (!$this->checkPerm($session_id, 'mail_user_delete')) |
|
189 |
{ |
|
190 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
191 |
return false; |
|
192 |
} |
|
193 |
$affected_rows = $this->deleteQuery('../mail/form/mail_user.tform.php',$domain_id); |
|
194 |
return $affected_rows; |
|
195 |
} |
|
196 |
|
412aa4
|
197 |
|
542146
|
198 |
//* aliasy email |
T |
199 |
public function mail_alias_add($session_id,$domain_id, $client_id, $params) |
|
200 |
{ |
|
201 |
if (!$this->checkPerm($session_id, 'mail_alias_add')) |
|
202 |
{ |
|
203 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
204 |
return false; |
|
205 |
} |
|
206 |
$affected_rows = $this->insertQuery('../mail/form/mail_alias.tform.php', $domain_id, $client_id, $params); |
|
207 |
return $affected_rows; |
|
208 |
} |
|
209 |
|
|
210 |
|
|
211 |
public function mail_alias_update($session_id, $domain_id, $client_id, $params) |
|
212 |
{ |
|
213 |
if (!$this->checkPerm($session_id, 'mail_alias_update')) |
|
214 |
{ |
|
215 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
216 |
return false; |
|
217 |
} |
|
218 |
$affected_rows = $this->updateQuery('../mail/form/mail_alias.tform.php', $client_id, $domain_id, $params); |
|
219 |
return $affected_rows; |
|
220 |
} |
|
221 |
|
|
222 |
public function mail_alias_delete($session_id,$domain_id) |
|
223 |
{ |
|
224 |
if (!$this->checkPerm($session_id, 'mail_alias_delete')) |
|
225 |
{ |
|
226 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
227 |
return false; |
|
228 |
} |
|
229 |
$affected_rows = $this->deleteQuery('../mail/form/mail_alias.tform.php',$domain_id); |
|
230 |
return $affected_rows; |
|
231 |
} |
|
232 |
|
|
233 |
|
|
234 |
//* przekierowania email |
|
235 |
public function mail_forward_add($session_id,$domain_id, $client_id, $params) |
|
236 |
{ |
|
237 |
if (!$this->checkPerm($session_id, 'mail_forward_add')) |
|
238 |
{ |
|
239 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
240 |
return false; |
|
241 |
} |
|
242 |
$affected_rows = $this->insertQuery('../mail/form/mail_forward.tform.php', $domain_id, $client_id, $params); |
|
243 |
return $affected_rows; |
|
244 |
} |
|
245 |
|
|
246 |
|
|
247 |
public function mail_forward_update($session_id, $domain_id, $client_id, $params) |
|
248 |
{ |
|
249 |
if (!$this->checkPerm($session_id, 'mail_forward_update')) |
|
250 |
{ |
|
251 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
252 |
return false; |
|
253 |
} |
|
254 |
$affected_rows = $this->updateQuery('../mail/form/mail_forward.tform.php', $client_id, $domain_id, $params); |
|
255 |
return $affected_rows; |
|
256 |
} |
412aa4
|
257 |
|
542146
|
258 |
|
T |
259 |
public function mail_forward_delete($session_id,$domain_id) |
|
260 |
{ |
|
261 |
if (!$this->checkPerm($session_id, 'mail_forward_delete')) |
|
262 |
{ |
|
263 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
264 |
return false; |
|
265 |
} |
|
266 |
$affected_rows = $this->deleteQuery('../mail/form/mail_forward.tform.php',$domain_id); |
|
267 |
return $affected_rows; |
|
268 |
} |
|
269 |
|
|
270 |
|
|
271 |
//* catchall e-mail |
|
272 |
public function mail_catchall_add($session_id,$domain_id, $client_id, $params) |
|
273 |
{ |
|
274 |
if (!$this->checkPerm($session_id, 'mail_catchall_add')) |
|
275 |
{ |
|
276 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
277 |
return false; |
|
278 |
} |
|
279 |
$affected_rows = $this->insertQuery('../mail/form/mail_domain_catchall.tform.php', $domain_id, $client_id, $params); |
|
280 |
return $affected_rows; |
|
281 |
} |
|
282 |
|
|
283 |
|
|
284 |
public function mail_catchall_update($session_id, $domain_id, $client_id, $params) |
|
285 |
{ |
|
286 |
if (!$this->checkPerm($session_id, 'mail_catchall_update')) |
|
287 |
{ |
|
288 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
289 |
return false; |
|
290 |
} |
|
291 |
$affected_rows = $this->updateQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $domain_id, $params); |
|
292 |
return $affected_rows; |
|
293 |
} |
|
294 |
|
|
295 |
|
|
296 |
public function mail_catchall_delete($session_id,$domain_id) |
|
297 |
{ |
|
298 |
if (!$this->checkPerm($session_id, 'mail_catchall_delete')) |
|
299 |
{ |
|
300 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
301 |
return false; |
|
302 |
} |
|
303 |
$affected_rows = $this->deleteQuery('../mail/form/mail_domain_catchall.tform.php',$domain_id); |
|
304 |
return $affected_rows; |
|
305 |
} |
|
306 |
|
|
307 |
|
|
308 |
//* przeniesienia e-mail |
|
309 |
public function mail_transport_add($session_id,$domain_id, $client_id, $params) |
|
310 |
{ |
|
311 |
if (!$this->checkPerm($session_id, 'mail_transport_add')) |
|
312 |
{ |
|
313 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
314 |
return false; |
|
315 |
} |
|
316 |
$affected_rows = $this->insertQuery('../mail/form/mail_transport.tform.php', $domain_id, $client_id, $params); |
|
317 |
return $affected_rows; |
|
318 |
} |
|
319 |
|
|
320 |
|
|
321 |
public function mail_transport_update($session_id, $domain_id, $client_id, $params) |
|
322 |
{ |
|
323 |
if (!$this->checkPerm($session_id, 'mail_transport_update')) |
|
324 |
{ |
|
325 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
326 |
return false; |
|
327 |
} |
|
328 |
$affected_rows = $this->updateQuery('../mail/form/mail_transport.tform.php', $client_id, $domain_id, $params); |
|
329 |
return $affected_rows; |
|
330 |
} |
|
331 |
|
|
332 |
|
|
333 |
public function mail_transport_delete($session_id,$domain_id) |
|
334 |
{ |
|
335 |
if (!$this->checkPerm($session_id, 'mail_transport_delete')) |
|
336 |
{ |
|
337 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
338 |
return false; |
|
339 |
} |
|
340 |
$affected_rows = $this->deleteQuery('../mail/form/mail_transport.tform.php',$domain_id); |
|
341 |
return $affected_rows; |
|
342 |
} |
|
343 |
|
|
344 |
|
|
345 |
//* biała lista e-mail |
|
346 |
public function mail_spamfilter_whitelist_add($session_id,$domain_id, $client_id, $params) |
|
347 |
{ |
|
348 |
if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_add')) |
|
349 |
{ |
|
350 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
351 |
return false; |
|
352 |
} |
|
353 |
$affected_rows = $this->insertQuery('../mail/form/spamfilter_whitelist.tform.php', $domain_id, $client_id, $params); |
|
354 |
return $affected_rows; |
|
355 |
} |
|
356 |
|
|
357 |
|
|
358 |
public function mail_spamfilter_whitelist_update($session_id, $domain_id, $client_id, $params) |
|
359 |
{ |
|
360 |
if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_update')) |
|
361 |
{ |
|
362 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
363 |
return false; |
|
364 |
} |
|
365 |
$affected_rows = $this->updateQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $domain_id, $params); |
|
366 |
return $affected_rows; |
|
367 |
} |
|
368 |
|
|
369 |
|
|
370 |
public function mail_spamfilter_whitelist_delete($session_id,$domain_id) |
|
371 |
{ |
|
372 |
if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_delete')) |
|
373 |
{ |
|
374 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
375 |
return false; |
|
376 |
} |
|
377 |
$affected_rows = $this->deleteQuery('../mail/form/spamfilter_whitelist.tform.php',$domain_id); |
|
378 |
return $affected_rows; |
|
379 |
} |
|
380 |
|
|
381 |
|
|
382 |
|
|
383 |
//* czarna lista e-mail |
|
384 |
public function mail_spamfilter_blacklist_add($session_id,$domain_id, $client_id, $params) |
|
385 |
{ |
|
386 |
if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_add')) |
|
387 |
{ |
|
388 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
389 |
return false; |
|
390 |
} |
|
391 |
$affected_rows = $this->insertQuery('../mail/form/spamfilter_blacklist.tform.php', $domain_id, $client_id, $params); |
|
392 |
return $affected_rows; |
|
393 |
} |
|
394 |
|
|
395 |
|
|
396 |
public function mail_spamfilter_blacklist_update($session_id, $domain_id, $client_id, $params) |
|
397 |
{ |
|
398 |
if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_update')) |
|
399 |
{ |
|
400 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
401 |
return false; |
|
402 |
} |
|
403 |
$affected_rows = $this->updateQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $domain_id, $params); |
|
404 |
return $affected_rows; |
|
405 |
} |
|
406 |
|
|
407 |
|
|
408 |
public function mail_spamfilter_blacklist_delete($session_id,$domain_id) |
|
409 |
{ |
|
410 |
if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_delete')) |
|
411 |
{ |
|
412 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
413 |
return false; |
|
414 |
} |
|
415 |
$affected_rows = $this->deleteQuery('../mail/form/spamfilter_blacklist.tform.php',$domain_id); |
|
416 |
return $affected_rows; |
|
417 |
} |
|
418 |
|
|
419 |
|
|
420 |
//* filtr spamu użytkowników e-mail |
|
421 |
public function mail_spamfilter_user_add($session_id,$domain_id, $client_id, $params) |
|
422 |
{ |
|
423 |
if (!$this->checkPerm($session_id, 'mail_spamfilter_user_add')) |
|
424 |
{ |
|
425 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
426 |
return false; |
|
427 |
} |
|
428 |
$affected_rows = $this->insertQuery('../mail/form/spamfilter_users.tform.php', $domain_id, $client_id, $params); |
|
429 |
return $affected_rows; |
|
430 |
} |
|
431 |
|
|
432 |
|
|
433 |
public function mail_spamfilter_user_update($session_id, $domain_id, $client_id, $params) |
|
434 |
{ |
|
435 |
if (!$this->checkPerm($session_id, 'mail_spamfilter_user_update')) |
|
436 |
{ |
|
437 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
438 |
return false; |
|
439 |
} |
|
440 |
$affected_rows = $this->updateQuery('../mail/form/spamfilter_users.tform.php', $client_id, $domain_id, $params); |
|
441 |
return $affected_rows; |
|
442 |
} |
|
443 |
|
|
444 |
|
|
445 |
public function mail_spamfilter_user_delete($session_id,$domain_id) |
|
446 |
{ |
|
447 |
if (!$this->checkPerm($session_id, 'mail_spamfilter_user_delete')) |
|
448 |
{ |
|
449 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
450 |
return false; |
|
451 |
} |
|
452 |
$affected_rows = $this->deleteQuery('../mail/form/spamfilter_users.tform.php',$domain_id); |
|
453 |
return $affected_rows; |
|
454 |
} |
|
455 |
|
|
456 |
|
|
457 |
|
|
458 |
//* polityki filtrów spamu e-mail |
|
459 |
public function mail_policy_add($session_id,$domain_id, $client_id, $params) |
|
460 |
{ |
|
461 |
if (!$this->checkPerm($session_id, 'mail_policy_add')) |
|
462 |
{ |
|
463 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
464 |
return false; |
|
465 |
} |
|
466 |
$affected_rows = $this->insertQuery('../mail/form/spamfilter_policy.tform.php', $domain_id, $client_id, $params); |
|
467 |
return $affected_rows; |
|
468 |
} |
|
469 |
|
|
470 |
|
|
471 |
public function mail_policy_update($session_id, $domain_id, $client_id, $params) |
|
472 |
{ |
|
473 |
if (!$this->checkPerm($session_id, 'mail_policy_update')) |
|
474 |
{ |
|
475 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
476 |
return false; |
|
477 |
} |
|
478 |
$affected_rows = $this->updateQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $domain_id, $params); |
|
479 |
return $affected_rows; |
|
480 |
} |
|
481 |
|
|
482 |
|
|
483 |
public function mail_policy_delete($session_id,$domain_id) |
|
484 |
{ |
|
485 |
if (!$this->checkPerm($session_id, 'mail_policy_delete')) |
|
486 |
{ |
|
487 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
488 |
return false; |
|
489 |
} |
|
490 |
$affected_rows = $this->deleteQuery('../mail/form/spamfilter_policy.tform.php',$domain_id); |
|
491 |
return $affected_rows; |
|
492 |
} |
|
493 |
|
|
494 |
|
|
495 |
//* fetchmail |
|
496 |
public function mail_fetchmail_add($session_id,$domain_id, $client_id, $params) |
|
497 |
{ |
|
498 |
if (!$this->checkPerm($session_id, 'mail_fetchmail_add')) |
|
499 |
{ |
|
500 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
501 |
return false; |
|
502 |
} |
|
503 |
$affected_rows = $this->insertQuery('../mail/form/mail_get.tform.php', $domain_id, $client_id, $params); |
|
504 |
return $affected_rows; |
|
505 |
} |
|
506 |
|
|
507 |
|
|
508 |
public function mail_fetchmail_update($session_id, $domain_id, $client_id, $params) |
|
509 |
{ |
|
510 |
if (!$this->checkPerm($session_id, 'mail_fetchmail_update')) |
|
511 |
{ |
|
512 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
513 |
return false; |
|
514 |
} |
|
515 |
$affected_rows = $this->updateQuery('../mail/form/mail_get.tform.php', $client_id, $domain_id, $params); |
|
516 |
return $affected_rows; |
|
517 |
} |
|
518 |
|
|
519 |
|
|
520 |
public function mail_fetchmail_delete($session_id,$domain_id) |
|
521 |
{ |
|
522 |
if (!$this->checkPerm($session_id, 'mail_fetchmail_delete')) |
|
523 |
{ |
|
524 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
525 |
return false; |
|
526 |
} |
|
527 |
$affected_rows = $this->deleteQuery('../mail/form/mail_get.tform.php',$domain_id); |
|
528 |
return $affected_rows; |
|
529 |
} |
|
530 |
|
|
531 |
|
|
532 |
//* wpisy białej listy |
|
533 |
public function mail_whitelist_add($session_id,$domain_id, $client_id, $params) |
|
534 |
{ |
|
535 |
if (!$this->checkPerm($session_id, 'mail_whitelist_add')) |
|
536 |
{ |
|
537 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
538 |
return false; |
|
539 |
} |
|
540 |
$affected_rows = $this->insertQuery('../mail/form/mail_whitelist.tform.php', $domain_id, $client_id, $params); |
|
541 |
return $affected_rows; |
|
542 |
} |
|
543 |
|
|
544 |
|
|
545 |
public function mail_whitelist_update($session_id, $domain_id, $client_id, $params) |
|
546 |
{ |
|
547 |
if (!$this->checkPerm($session_id, 'mail_whitelist_update')) |
|
548 |
{ |
|
549 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
550 |
return false; |
|
551 |
} |
|
552 |
$affected_rows = $this->updateQuery('../mail/form/mail_whitelist.tform.php', $client_id, $domain_id, $params); |
|
553 |
return $affected_rows; |
|
554 |
} |
|
555 |
|
|
556 |
|
|
557 |
public function mail_whitelist_delete($session_id,$domain_id) |
|
558 |
{ |
|
559 |
if (!$this->checkPerm($session_id, 'mail_whitelist_delete')) |
|
560 |
{ |
|
561 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
562 |
return false; |
|
563 |
} |
|
564 |
$affected_rows = $this->deleteQuery('../mail/form/mail_whitelist.tform.php',$domain_id); |
|
565 |
return $affected_rows; |
|
566 |
} |
|
567 |
|
|
568 |
|
|
569 |
//* wpisy białej listy |
|
570 |
public function mail_blacklist_add($session_id,$domain_id, $client_id, $params) |
|
571 |
{ |
|
572 |
if (!$this->checkPerm($session_id, 'mail_blacklist_add')) |
|
573 |
{ |
|
574 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
575 |
return false; |
|
576 |
} |
|
577 |
$affected_rows = $this->insertQuery('../mail/form/mail_blacklist.tform.php', $domain_id, $client_id, $params); |
|
578 |
return $affected_rows; |
|
579 |
} |
|
580 |
|
|
581 |
|
|
582 |
public function mail_blacklist_update($session_id, $domain_id, $client_id, $params) |
|
583 |
{ |
|
584 |
if (!$this->checkPerm($session_id, 'mail_blacklist_update')) |
|
585 |
{ |
|
586 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
587 |
return false; |
|
588 |
} |
|
589 |
$affected_rows = $this->updateQuery('../mail/form/mail_blacklist.tform.php', $client_id, $domain_id, $params); |
|
590 |
return $affected_rows; |
|
591 |
} |
|
592 |
|
|
593 |
|
|
594 |
public function mail_blacklist_delete($session_id,$domain_id) |
|
595 |
{ |
|
596 |
if (!$this->checkPerm($session_id, 'mail_blacklist_delete')) |
|
597 |
{ |
|
598 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
599 |
return false; |
|
600 |
} |
|
601 |
$affected_rows = $this->deleteQuery('../mail/form/mail_blacklist.tform.php',$domain_id); |
|
602 |
return $affected_rows; |
|
603 |
} |
|
604 |
|
|
605 |
|
|
606 |
//* wpisy filtrow e-mail |
|
607 |
public function mail_filter_add($session_id,$domain_id, $client_id, $params) |
|
608 |
{ |
|
609 |
if (!$this->checkPerm($session_id, 'mail_filter_add')) |
|
610 |
{ |
|
611 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
612 |
return false; |
|
613 |
} |
|
614 |
$affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $domain_id, $client_id, $params); |
|
615 |
return $affected_rows; |
|
616 |
} |
|
617 |
|
|
618 |
|
|
619 |
public function mail_filter_update($session_id, $domain_id, $client_id, $params) |
|
620 |
{ |
|
621 |
if (!$this->checkPerm($session_id, 'mail_filter_update')) |
|
622 |
{ |
|
623 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
624 |
return false; |
|
625 |
} |
|
626 |
$affected_rows = $this->updateQuery('../mail/form/mail_content_filter.tform.php', $client_id, $domain_id, $params); |
|
627 |
return $affected_rows; |
|
628 |
} |
|
629 |
|
|
630 |
|
|
631 |
public function mail_filter_delete($session_id,$domain_id) |
|
632 |
{ |
|
633 |
if (!$this->checkPerm($session_id, 'mail_filter_delete')) |
|
634 |
{ |
|
635 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
636 |
return false; |
|
637 |
} |
|
638 |
$affected_rows = $this->deleteQuery('../mail/form/mail_content_filter.tform.php',$domain_id); |
|
639 |
return $affected_rows; |
|
640 |
} |
|
641 |
|
|
642 |
|
|
643 |
|
|
644 |
|
|
645 |
/* |
|
646 |
* |
|
647 |
* |
|
648 |
* |
|
649 |
* * klient add :) |
|
650 |
* |
|
651 |
* |
|
652 |
*/ |
|
653 |
|
|
654 |
public function client_add($session_id,$domain_id, $client_id, $params) |
|
655 |
{ |
|
656 |
if (!$this->checkPerm($session_id, 'client_add')) |
|
657 |
{ |
|
658 |
$this->server->fault('permission_denied','You do not have the permissions to access this function.'); |
|
659 |
return false; |
|
660 |
} |
|
661 |
$affected_rows = $this->klientadd('../client/form/client.tform.php',$domain_id, $client_id, $params); |
|
662 |
return $affected_rows; |
|
663 |
|
|
664 |
} |
|
665 |
|
|
666 |
|
|
667 |
|
|
668 |
|
|
669 |
|
3db182
|
670 |
//** private functions ----------------------------------------------------------------------------------- |
412aa4
|
671 |
|
T |
672 |
|
542146
|
673 |
|
T |
674 |
|
|
675 |
private function klientadd($formdef_file, $client_id, $params) |
|
676 |
{ |
|
677 |
global $app, $tform, $remoting_lib; |
|
678 |
$app->uses('remoting_lib'); |
|
679 |
|
|
680 |
//* Load the form definition |
|
681 |
$app->remoting_lib->loadFormDef($formdef_file); |
|
682 |
|
|
683 |
//* load the user profile of the client |
|
684 |
$app->remoting_lib->loadUserProfile($client_id); |
|
685 |
|
|
686 |
//* Get the SQL query |
|
687 |
$sql = $app->remoting_lib->getSQL($params,'INSERT',0); |
|
688 |
if($app->remoting_lib->errorMessage != '') { |
|
689 |
$this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); |
|
690 |
return false; |
|
691 |
} |
|
692 |
|
|
693 |
$app->db->query($sql); |
|
694 |
|
|
695 |
if($app->db->errorMessage != '') { |
|
696 |
$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); |
|
697 |
return false; |
|
698 |
} |
|
699 |
|
|
700 |
|
|
701 |
|
|
702 |
$insert_id = $app->db->insertID(); |
|
703 |
//$app->uses('tform'); |
|
704 |
//* Save changes to Datalog |
|
705 |
if($app->remoting_lib->formDef["db_history"] == 'yes') { |
|
706 |
$new_rec = $app->remoting_lib->getDataRecord($insert_id); |
|
707 |
$app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec); |
|
708 |
|
|
709 |
$app->remoting_lib->dodaj_usera($params,$insert_id); |
|
710 |
|
|
711 |
} |
|
712 |
|
|
713 |
|
|
714 |
|
|
715 |
|
|
716 |
return $insert_id; |
|
717 |
} |
|
718 |
|
|
719 |
|
|
720 |
|
|
721 |
|
d77ca6
|
722 |
private function insertQuery($formdef_file, $client_id, $params) |
T |
723 |
{ |
542146
|
724 |
global $app, $tform, $remoting_lib; |
d77ca6
|
725 |
|
T |
726 |
$app->uses('remoting_lib'); |
|
727 |
|
|
728 |
//* Load the form definition |
|
729 |
$app->remoting_lib->loadFormDef($formdef_file); |
|
730 |
|
|
731 |
//* load the user profile of the client |
|
732 |
$app->remoting_lib->loadUserProfile($client_id); |
|
733 |
|
|
734 |
//* Get the SQL query |
|
735 |
$sql = $app->remoting_lib->getSQL($params,'INSERT',0); |
|
736 |
if($app->remoting_lib->errorMessage != '') { |
|
737 |
$this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); |
|
738 |
return false; |
|
739 |
} |
|
740 |
|
|
741 |
$app->db->query($sql); |
|
742 |
|
|
743 |
if($app->db->errorMessage != '') { |
|
744 |
$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); |
|
745 |
return false; |
|
746 |
} |
|
747 |
|
|
748 |
$insert_id = $app->db->insertID(); |
|
749 |
|
542146
|
750 |
|
T |
751 |
|
|
752 |
//$app->uses('tform'); |
92bea0
|
753 |
//* Save changes to Datalog |
T |
754 |
if($app->remoting_lib->formDef["db_history"] == 'yes') { |
|
755 |
$new_rec = $app->remoting_lib->getDataRecord($insert_id); |
542146
|
756 |
$app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec); |
T |
757 |
|
92bea0
|
758 |
} |
d77ca6
|
759 |
|
T |
760 |
|
|
761 |
|
|
762 |
|
b92d70
|
763 |
return $insert_id; |
412aa4
|
764 |
} |
T |
765 |
|
|
766 |
|
92bea0
|
767 |
private function updateQuery($formdef_file, $client_id, $primary_id, $params) |
T |
768 |
{ |
|
769 |
global $app; |
|
770 |
|
|
771 |
$app->uses('remoting_lib'); |
|
772 |
|
|
773 |
//* Load the form definition |
|
774 |
$app->remoting_lib->loadFormDef($formdef_file); |
|
775 |
|
|
776 |
//* load the user profile of the client |
|
777 |
$app->remoting_lib->loadUserProfile($client_id); |
|
778 |
|
|
779 |
//* Get the SQL query |
|
780 |
$sql = $app->remoting_lib->getSQL($params,'UPDATE',$primary_id); |
|
781 |
if($app->remoting_lib->errorMessage != '') { |
|
782 |
$this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); |
|
783 |
return false; |
|
784 |
} |
|
785 |
|
|
786 |
$old_rec = $app->remoting_lib->getDataRecord($primary_id); |
|
787 |
|
|
788 |
$app->db->query($sql); |
|
789 |
|
|
790 |
if($app->db->errorMessage != '') { |
|
791 |
$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); |
|
792 |
return false; |
|
793 |
} |
|
794 |
|
|
795 |
$affected_rows = $app->db->affectedRows(); |
|
796 |
|
|
797 |
//* Save changes to Datalog |
|
798 |
if($app->remoting_lib->formDef["db_history"] == 'yes') { |
|
799 |
$new_rec = $app->remoting_lib->getDataRecord($primary_id); |
542146
|
800 |
$app->remoting_lib->datalogSave('UPDATE',$primary_id,$old_rec,$new_rec); |
92bea0
|
801 |
} |
T |
802 |
|
|
803 |
|
|
804 |
|
|
805 |
return $affected_rows; |
|
806 |
} |
|
807 |
|
|
808 |
private function deleteQuery($formdef_file, $primary_id) |
|
809 |
{ |
|
810 |
global $app; |
|
811 |
|
|
812 |
$app->uses('remoting_lib'); |
|
813 |
|
|
814 |
//* Load the form definition |
|
815 |
$app->remoting_lib->loadFormDef($formdef_file); |
|
816 |
|
|
817 |
//* Get the SQL query |
|
818 |
$sql = $app->remoting_lib->getDeleteSQL($primary_id); |
|
819 |
|
|
820 |
$app->db->query($sql); |
|
821 |
|
|
822 |
if($app->db->errorMessage != '') { |
|
823 |
$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql); |
|
824 |
return false; |
|
825 |
} |
|
826 |
|
|
827 |
$affected_rows = $app->db->affectedRows(); |
|
828 |
|
|
829 |
//* Save changes to Datalog |
|
830 |
if($app->remoting_lib->formDef["db_history"] == 'yes') { |
|
831 |
$rec = $app->remoting_lib->getDataRecord($primary_id); |
542146
|
832 |
$app->remoting_lib->datalogSave('DELETE',$primary_id,$rec,array()); |
92bea0
|
833 |
} |
T |
834 |
|
|
835 |
|
|
836 |
return $affected_rows; |
|
837 |
} |
|
838 |
|
|
839 |
|
3db182
|
840 |
private function checkPerm($session_id, $function_name) |
P |
841 |
{ |
542146
|
842 |
$dobre=Array(); |
T |
843 |
$session = $this->getSession($session_id); |
3db182
|
844 |
if(!$session){ |
P |
845 |
return false; |
|
846 |
} |
542146
|
847 |
|
T |
848 |
$dobre= str_replace(';',',',$session['remote_functions']); |
|
849 |
return in_array($function_name, explode(',', $dobre) ); |
412aa4
|
850 |
} |
T |
851 |
|
|
852 |
|
3db182
|
853 |
private function getSession($session_id) |
a75d10
|
854 |
{ |
d77ca6
|
855 |
global $app; |
T |
856 |
|
412aa4
|
857 |
if(empty($session_id)) { |
a75d10
|
858 |
$this->server->fault('session_id_empty','The SessionID is empty.'); |
412aa4
|
859 |
return false; |
T |
860 |
} |
|
861 |
|
d77ca6
|
862 |
$session_id = $app->db->quote($session_id); |
412aa4
|
863 |
|
T |
864 |
$now = time(); |
|
865 |
$sql = "SELECT * FROM remote_session WHERE remote_session = '$session_id' AND tstamp >= $now"; |
d77ca6
|
866 |
$session = $app->db->queryOneRecord($sql); |
412aa4
|
867 |
if($session['remote_userid'] > 0) { |
T |
868 |
return $session; |
|
869 |
} else { |
a75d10
|
870 |
$this->server->fault('session_does_not_exist','The Session is expired or does not exist.'); |
412aa4
|
871 |
return false; |
T |
872 |
} |
|
873 |
} |
|
874 |
} |
|
875 |
|
542146
|
876 |
?> |