commit | author | age
|
465c9e
|
1 |
<?php |
V |
2 |
/* |
|
3 |
Copyright (c) 2010, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com |
|
4 |
All rights reserved. |
|
5 |
|
|
6 |
Redistribution and use in source and binary forms, with or without modification, |
|
7 |
are permitted provided that the following conditions are met: |
|
8 |
|
|
9 |
* Redistributions of source code must retain the above copyright notice, |
|
10 |
this list of conditions and the following disclaimer. |
|
11 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
12 |
this list of conditions and the following disclaimer in the documentation |
|
13 |
and/or other materials provided with the distribution. |
|
14 |
* Neither the name of ISPConfig nor the names of its contributors |
|
15 |
may be used to endorse or promote products derived from this software without |
|
16 |
specific prior written permission. |
|
17 |
|
|
18 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
19 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
21 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
22 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
23 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
24 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
25 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
26 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
27 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
28 |
*/ |
|
29 |
|
8cf78b
|
30 |
//die('Function has been removed.'); |
6882ab
|
31 |
|
7fe908
|
32 |
require_once '../../lib/config.inc.php'; |
MC |
33 |
require_once '../../lib/app.inc.php'; |
465c9e
|
34 |
|
V |
35 |
//* Check permissions for module |
|
36 |
$app->auth->check_module_permissions('admin'); |
|
37 |
|
|
38 |
//* This is only allowed for administrators |
|
39 |
if(!$app->auth->is_admin()) die('only allowed for administrators.'); |
|
40 |
|
|
41 |
$app->uses('tpl'); |
|
42 |
|
|
43 |
$app->tpl->newTemplate('form.tpl.htm'); |
|
44 |
$app->tpl->setInclude('content_tpl', 'templates/remote_action_ispcupdate.htm'); |
|
45 |
|
|
46 |
//* load language file |
|
47 |
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_remote_action.lng'; |
7fe908
|
48 |
include $lng_file; |
465c9e
|
49 |
|
V |
50 |
/* |
|
51 |
* We need a list of all Servers |
|
52 |
*/ |
8cf78b
|
53 |
|
465c9e
|
54 |
$sysServers = $app->db->queryAllRecords("SELECT server_id, server_name FROM server order by server_name"); |
V |
55 |
$dropDown = "<option value='*'>" . $wb['select_all_server'] . "</option>"; |
|
56 |
foreach ($sysServers as $server) { |
|
57 |
$dropDown .= "<option value='" . $server['server_id'] . "'>" . $server['server_name'] . "</option>"; |
|
58 |
} |
|
59 |
$app->tpl->setVar('server_option', $dropDown); |
|
60 |
|
|
61 |
$msg = ''; |
|
62 |
|
|
63 |
/* |
|
64 |
* If the user wants to do the action, write this to our db |
|
65 |
*/ |
8cf78b
|
66 |
|
T |
67 |
//* Note: Disabled post action |
|
68 |
if (1 == 0 && isset($_POST['server_select'])) { |
5af0cf
|
69 |
|
TB |
70 |
//* CSRF Check |
|
71 |
$app->auth->csrf_token_check(); |
|
72 |
|
465c9e
|
73 |
$server = $_POST['server_select']; |
V |
74 |
$servers = array(); |
|
75 |
if ($server == '*') { |
|
76 |
/* We need ALL Servers */ |
|
77 |
foreach ($sysServers as $server) { |
|
78 |
$servers[] = $server['server_id']; |
|
79 |
} |
|
80 |
} |
|
81 |
else { |
|
82 |
/* We need only the selected Server */ |
|
83 |
$servers[] = $_POST['server_select']; |
|
84 |
} |
|
85 |
foreach ($servers as $serverId) { |
82d6e5
|
86 |
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " . |
7fe908
|
87 |
"VALUES (". |
604c0c
|
88 |
$app->functions->intval($serverId) . ", " . |
7fe908
|
89 |
time() . ", " . |
MC |
90 |
"'ispc_update', " . |
|
91 |
"'', " . |
|
92 |
"'pending', " . |
|
93 |
"''" . |
|
94 |
")"; |
465c9e
|
95 |
$app->db->query($sql); |
V |
96 |
} |
|
97 |
$msg = $wb['action_scheduled']; |
|
98 |
} |
|
99 |
|
7fe908
|
100 |
$app->tpl->setVar('msg', $msg); |
465c9e
|
101 |
|
5af0cf
|
102 |
//* SET csrf token |
TB |
103 |
$csrf_token = $app->auth->csrf_token_get('ispupdate'); |
|
104 |
$app->tpl->setVar('_csrf_id',$csrf_token['csrf_id']); |
|
105 |
$app->tpl->setVar('_csrf_key',$csrf_token['csrf_key']); |
|
106 |
|
465c9e
|
107 |
$app->tpl->setVar($wb); |
V |
108 |
|
|
109 |
$app->tpl_defaults(); |
|
110 |
$app->tpl->pparse(); |
|
111 |
|
|
112 |
|
7fe908
|
113 |
?> |