Skip to content

Commit 9724f8f

Browse files
author
Marius Cramer
committed
Merge remote-tracking branch 'ispc/master' into new-layout-3.1
Conflicts: interface/web/dns/templates/dns_dkim_edit.htm interface/web/sites/templates/aps_instances_list.htm
2 parents d2713e4 + 551989a commit 9724f8f

File tree

134 files changed

+3927
-564
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+3927
-564
lines changed

interface/lib/classes/aps_guicontroller.inc.php

Lines changed: 104 additions & 116 deletions
Large diffs are not rendered by default.
Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2007 - 2013, 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.
29+
30+
--UPDATED 01.2015--
31+
Created by Dominik Müller <info@profi-webdesign.net>
32+
Copyright (c) Profi Webdesign Dominik Müller
33+
34+
*/
35+
36+
class remoting_aps extends remoting {
37+
//* Functions for APS
38+
public function sites_aps_update_package_list($session_id)
39+
{
40+
global $app;
41+
42+
if(!$this->checkPerm($session_id, 'sites_aps_update_package')) {
43+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
44+
return false;
45+
}
46+
47+
$app->load('aps_crawler');
48+
$aps = new ApsCrawler($app, false); // true = Interface mode, false = Server mode
49+
$aps->startCrawler();
50+
$aps->parseFolderToDB();
51+
$aps->fixURLs();
52+
53+
return true;
54+
}
55+
56+
public function sites_aps_available_packages_list($session_id, $params)
57+
{
58+
global $app;
59+
60+
if(!$this->checkPerm($session_id, 'sites_aps_available_packages_list')) {
61+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
62+
return false;
63+
}
64+
65+
$app->load('aps_base');
66+
67+
if (isset($params['all_packages']) && ($params['all_packages'] == true)) {
68+
$where = '(aps_packages.package_status = '.PACKAGE_ENABLED.' OR aps_packages.package_status = '.PACKAGE_LOCKED.')';
69+
}
70+
else {
71+
$where = 'aps_packages.package_status = '.PACKAGE_ENABLED;
72+
}
73+
74+
$sql = 'SELECT * FROM aps_packages WHERE '.$where.' ORDER BY aps_packages.name, aps_packages.version';
75+
return $app->db->queryAllRecords($sql);
76+
}
77+
78+
public function sites_aps_get_package_details($session_id, $primary_id)
79+
{
80+
global $app;
81+
82+
if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) {
83+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
84+
return false;
85+
}
86+
87+
$app->load('aps_guicontroller');
88+
$gui = new ApsGUIController($app);
89+
90+
// Package-ID Check
91+
if (isset($primary_id))
92+
{
93+
$newest_pkg_id = $gui->getNewestPackageID($pkg_id);
94+
if($newest_pkg_id != 0) $primary_id = $newest_pkg_id;
95+
}
96+
97+
// Make sure an integer ID is given
98+
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
99+
$this->server->fault('package_error', 'The given Package ID is not valid.');
100+
return false;
101+
}
102+
103+
// Get package details
104+
$details = $gui->getPackageDetails($primary_id);
105+
if (isset($details['error'])) {
106+
$this->server->fault('package_error', $details['error']);
107+
return false;
108+
}
109+
110+
// encode all parts to ensure SOAP-XML-format
111+
array_walk_recursive($details, function(&$item, &$key) { $item = utf8_encode($item); } );
112+
// Special handling for license-text because of too much problems with soap-transport
113+
$details['License content'] = base64_encode($details['License content']);
114+
115+
return $details;
116+
}
117+
118+
public function sites_aps_get_package_file($session_id, $primary_id, $filename) {
119+
global $app;
120+
121+
if(!$this->checkPerm($session_id, 'sites_aps_get_package_file')) {
122+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
123+
return false;
124+
}
125+
126+
$app->load('aps_guicontroller');
127+
$gui = new ApsGUIController($app);
128+
129+
// Package-ID Check
130+
if (isset($primary_id))
131+
{
132+
$newest_pkg_id = $gui->getNewestPackageID($pkg_id);
133+
if($newest_pkg_id != 0) $primary_id = $newest_pkg_id;
134+
}
135+
136+
// Make sure an integer ID is given
137+
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
138+
$this->server->fault('package_error', 'The given Package ID is not valid.');
139+
return false;
140+
}
141+
142+
// Get package details
143+
$details = $gui->getPackageDetails($primary_id);
144+
if (isset($details['error'])) {
145+
$this->server->fault('package_error', $details['error']);
146+
return false;
147+
}
148+
149+
// find file in details
150+
$found = false;
151+
if (basename($details['Icon']) == $filename) $found = true;
152+
if (!$found && isset($details['Screenshots']) && is_array($details['Screenshots']))
153+
foreach ($details['Screenshots'] as $screen) { if (basename($screen['ScreenPath']) == $filename) { $found = true; break; } }
154+
155+
if (!$found) {
156+
$this->server->fault('package_error', 'File not found in package.');
157+
return false;
158+
}
159+
160+
return base64_encode(file_get_contents(ISPC_ROOT_PATH.'/web/sites/aps_meta_packages/'.$details['path'].'/'.$filename));
161+
}
162+
163+
public function sites_aps_get_package_settings($session_id, $primary_id)
164+
{
165+
global $app;
166+
167+
if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) {
168+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
169+
return false;
170+
}
171+
172+
$app->load('aps_guicontroller');
173+
$gui = new ApsGUIController($app);
174+
175+
// Package-ID Check
176+
if (isset($primary_id))
177+
{
178+
$newest_pkg_id = $gui->getNewestPackageID($pkg_id);
179+
if($newest_pkg_id != 0) $primary_id = $newest_pkg_id;
180+
}
181+
182+
// Make sure an integer ID is given
183+
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
184+
$this->server->fault('package_error', 'The given Package ID is not valid.');
185+
return false;
186+
}
187+
188+
// Get package settings
189+
$settings = $gui->getPackageSettings($primary_id);
190+
if (isset($settings['error'])) {
191+
$this->server->fault('package_error', $settings['error']);
192+
return false;
193+
}
194+
195+
// encode all parts to ensure SOAP-XML-format
196+
array_walk_recursive($settings, function(&$item, &$key) { $item = utf8_encode($item); } );
197+
198+
return $settings;
199+
}
200+
201+
public function sites_aps_install_package($session_id, $primary_id, $params)
202+
{
203+
global $app;
204+
205+
if(!$this->checkPerm($session_id, 'sites_aps_install_package')) {
206+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
207+
return false;
208+
}
209+
210+
$app->load('aps_guicontroller');
211+
$gui = new ApsGUIController($app);
212+
213+
// Package-ID Check
214+
if (isset($primary_id))
215+
{
216+
$newest_pkg_id = $gui->getNewestPackageID($primary_id);
217+
if($newest_pkg_id != 0) $primary_id = $newest_pkg_id;
218+
}
219+
220+
// Make sure an integer ID is given
221+
if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag
222+
$this->server->fault('package_error', 'The given Package ID is not valid.');
223+
return false;
224+
}
225+
226+
// Get package details
227+
$details = $gui->getPackageDetails($primary_id);
228+
if (isset($details['error'])) {
229+
$this->server->fault('package_error', $details['error']);
230+
return false;
231+
}
232+
$settings = $gui->getPackageSettings($primary_id);
233+
if (isset($settings['error'])) {
234+
$this->server->fault('package_error', $settings['error']);
235+
return false;
236+
}
237+
238+
// Check given Site/VHostDomain
239+
if (!isset($params['main_domain'])) {
240+
$this->server->fault('invalid parameters', 'No valid domain given.');
241+
return false;
242+
}
243+
244+
$sql = "SELECT * FROM web_domain WHERE domain = '".$app->db->quote($params['main_domain'])."'";
245+
$domain = $app->db->queryOneRecord($sql);
246+
247+
if (!$domain) {
248+
$this->server->fault('invalid parameters', 'No valid domain given.');
249+
return false;
250+
}
251+
252+
$domains = array($domain['domain']); // Simulate correct Domain-List
253+
$result = $gui->validateInstallerInput($params, $details, $domains, $settings);
254+
if(empty($result['error']))
255+
{
256+
return $gui->createPackageInstance($result['input'], $primary_id);
257+
}
258+
259+
$this->server->fault('invalid parameters', implode('<br />', $result['error']));
260+
return false;
261+
}
262+
263+
public function sites_aps_instance_get($session_id, $primary_id)
264+
{
265+
global $app;
266+
267+
if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) {
268+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
269+
return false;
270+
}
271+
272+
$sql = "SELECT * FROM aps_instances WHERE id = ".$app->functions->intval($primary_id);
273+
$result = $app->db->queryOneRecord($sql);
274+
return $result;
275+
}
276+
277+
public function sites_aps_instance_settings_get($session_id, $primary_id)
278+
{
279+
global $app;
280+
281+
if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) {
282+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
283+
return false;
284+
}
285+
286+
$sql = "SELECT * FROM aps_instances_settings WHERE instance_id = ".$app->functions->intval($primary_id);
287+
$result = $app->db->queryAllRecords($sql);
288+
return $result;
289+
}
290+
291+
public function sites_aps_instance_delete($session_id, $primary_id, $params = array())
292+
{
293+
global $app;
294+
295+
if(!$this->checkPerm($session_id, 'sites_aps_instance_delete')) {
296+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
297+
return false;
298+
}
299+
300+
$app->load('aps_guicontroller');
301+
$gui = new ApsGUIController($app);
302+
303+
// Check if Instance exists
304+
$sql = "SELECT * FROM aps_instances WHERE id = ".$app->functions->intval($primary_id);
305+
$result = $app->db->queryOneRecord($sql);
306+
307+
if (!$result) {
308+
$this->server->fault('instance_error', 'No valid instance id given.');
309+
return false;
310+
}
311+
312+
$gui->deleteInstance($primary_id, (isset($params['keep_database']) && ($params['keep_database'] === true)));
313+
314+
return true;
315+
}
316+
}
317+
318+
?>

interface/lib/plugins/sites_web_vhost_domain_plugin.inc.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ function sites_web_vhost_domain_edit($event_name, $page_form) {
212212
if(is_array($records) && !empty($records)){
213213
foreach($records as $rec){
214214
$app->db->datalogUpdate('aps_instances_settings', "value = '".$app->db->quote($page_form->dataRecord["domain"])."'", 'id', $rec['id']);
215-
// Reinstall of package needed?
216-
//$app->db->datalogUpdate('aps_instances', "instance_status = '1'", 'id', $rec['instance_id']);
217215
}
218216
}
219217
unset($records);

interface/web/admin/form/server_config.tform.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@
320320
'dkim_strength' => array(
321321
'datatype' => 'INTEGER',
322322
'formtype' => 'SELECT',
323-
'default' => '1024',
324-
'value' => array('1024' => 'normal (1024)', '2048' => 'strong (2048)', '4096' => 'very strong (4096)')
323+
'default' => '2048',
324+
'value' => array('1024' => 'week (1024)', '2048' => 'normal (2048)', '4096' => 'strong (4096)')
325325
),
326326
'relayhost_password' => array(
327327
'datatype' => 'VARCHAR',

0 commit comments

Comments
 (0)