Skip to content

Commit 6e8071c

Browse files
committed
Merge branch 'vhostalias' of /home/git/repositories/renky/ispconfig3
2 parents 681d3f5 + 33ff5ab commit 6e8071c

File tree

125 files changed

+6264
-111
lines changed

Some content is hidden

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

125 files changed

+6264
-111
lines changed

interface/lib/classes/remote.d/sites.inc.php

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,75 @@ public function sites_web_domain_delete($session_id, $primary_id)
450450

451451
// ----------------------------------------------------------------------------------------------------------
452452

453+
//* Get record details
454+
public function sites_web_vhost_aliasdomain_get($session_id, $primary_id)
455+
{
456+
global $app;
457+
458+
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_get')) {
459+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
460+
return false;
461+
}
462+
$app->uses('remoting_lib');
463+
$app->remoting_lib->loadFormDef('../sites/form/web_vhost_aliasdomain.tform.php');
464+
return $app->remoting_lib->getDataRecord($primary_id);
465+
}
466+
467+
//* Add a record
468+
public function sites_web_vhost_aliasdomain_add($session_id, $client_id, $params)
469+
{
470+
global $app;
471+
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_add')) {
472+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
473+
return false;
474+
}
475+
476+
//* Set a few params to "not empty" values which get overwritten by the sites_web_domain_plugin
477+
if($params['document_root'] == '') $params['document_root'] = '-';
478+
if($params['system_user'] == '') $params['system_user'] = '-';
479+
if($params['system_group'] == '') $params['system_group'] = '-';
480+
481+
//* Set a few defaults for nginx servers
482+
if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
483+
if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
484+
if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
485+
if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
486+
487+
$domain_id = $this->insertQuery('../sites/form/web_vhost_aliasdomain.tform.php', $client_id, $params, 'sites:web_vhost_aliasdomain:on_after_insert');
488+
return $domain_id;
489+
}
490+
491+
//* Update a record
492+
public function sites_web_vhost_aliasdomain_update($session_id, $client_id, $primary_id, $params)
493+
{
494+
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_update')) {
495+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
496+
return false;
497+
}
498+
499+
//* Set a few defaults for nginx servers
500+
if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
501+
if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
502+
if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
503+
if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
504+
505+
$affected_rows = $this->updateQuery('../sites/form/web_vhost_aliasdomain.tform.php', $client_id, $primary_id, $params, 'sites:web_vhost_aliasdomain:on_after_insert');
506+
return $affected_rows;
507+
}
508+
509+
//* Delete a record
510+
public function sites_web_vhost_aliasdomain_delete($session_id, $primary_id)
511+
{
512+
if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_delete')) {
513+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
514+
return false;
515+
}
516+
$affected_rows = $this->deleteQuery('../sites/form/web_vhost_aliasdomain.tform.php', $primary_id);
517+
return $affected_rows;
518+
}
519+
520+
// ----------------------------------------------------------------------------------------------------------
521+
453522
//* Get record details
454523
public function sites_web_vhost_subdomain_get($session_id, $primary_id)
455524
{
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
/**
3+
* sites_web_vhost_aliasdomain_plugin plugin
4+
*
5+
* @author Marius Cramer <m.cramer@pixcept.de> pixcept KG 2012, copied and adapted from web_domain plugin by:
6+
* @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
7+
*/
8+
9+
10+
class sites_web_vhost_aliasdomain_plugin {
11+
12+
var $plugin_name = 'sites_web_vhost_aliasdomain_plugin';
13+
var $class_name = 'sites_web_vhost_aliasdomain_plugin';
14+
15+
// TODO: This function is a duplicate from the one in interface/web/sites/web_vhost_aliasdomain_edit.php
16+
// There should be a single "token replacement" function to be called from modules and
17+
// from the main code.
18+
// Returna a "3/2/1" path hash from a numeric id '123'
19+
function id_hash($id, $levels) {
20+
$hash = "" . $id % 10 ;
21+
$id /= 10 ;
22+
$levels -- ;
23+
while ( $levels > 0 ) {
24+
$hash .= "/" . $id % 10 ;
25+
$id /= 10 ;
26+
$levels-- ;
27+
}
28+
return $hash;
29+
}
30+
31+
/*
32+
This function is called when the plugin is loaded
33+
*/
34+
function onLoad() {
35+
global $app;
36+
//Register for the events
37+
// both event call the same function as the things to do do not differ here
38+
$app->plugin->registerEvent('sites:web_vhost_aliasdomain:on_after_insert', 'sites_web_vhost_aliasdomain_plugin', 'sites_web_vhost_aliasdomain_edit');
39+
$app->plugin->registerEvent('sites:web_vhost_aliasdomain:on_after_update', 'sites_web_vhost_aliasdomain_plugin', 'sites_web_vhost_aliasdomain_edit');
40+
}
41+
42+
/*
43+
Function to create the sites_web_vhost_aliasdomain rule and insert it into the custom rules
44+
*/
45+
function sites_web_vhost_aliasdomain_edit($event_name, $page_form) {
46+
global $app, $conf;
47+
48+
// Get configuration for the web system
49+
$app->uses("getconf");
50+
$web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']), 'web');
51+
52+
$parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . $app->functions->intval($page_form->dataRecord['parent_domain_id']) . "'");
53+
54+
// Set the values for document_root, system_user and system_group
55+
$system_user = $app->db->quote($parent_domain['system_user']);
56+
$system_group = $app->db->quote($parent_domain['system_group']);
57+
$document_root = $app->db->quote($parent_domain['document_root']);
58+
$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$page_form->dataRecord['web_folder'], $web_config["php_open_basedir"]);
59+
$php_open_basedir = str_replace("[website_domain]/web", $page_form->dataRecord['domain'].'/'.$page_form->dataRecord['web_folder'], $php_open_basedir);
60+
$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
61+
$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $page_form->dataRecord['domain'], $php_open_basedir));
62+
$htaccess_allow_override = $app->db->quote($parent_domain['allow_override']);
63+
64+
$sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($parent_domain['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$page_form->id;
65+
$app->db->query($sql);
66+
}
67+
68+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@
154154
'default' => 'n',
155155
'value' => array(0 => 'n', 1 => 'y')
156156
),
157+
'vhost_aliasdomains' => array (
158+
'datatype' => 'VARCHAR',
159+
'formtype' => 'CHECKBOX',
160+
'default' => 'n',
161+
'value' => array(0 => 'n', 1 => 'y')
162+
),
157163
'client_username_web_check_disabled' => array (
158164
'datatype' => 'VARCHAR',
159165
'formtype' => 'CHECKBOX',

interface/web/admin/lib/lang/ar_system_config.lng

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail
3939
$wb['tab_change_discard_txt'] = 'Discard changes on tab change';
4040
$wb['tab_change_warning_txt'] = 'Tab change warning';
4141
$wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.';
42-
$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site';
42+
$wb['vhost_subdomains_txt'] = 'Create subdomains as web site';
4343
$wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!';
44+
$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site';
45+
$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!';
4446
$wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL';
4547
$wb['use_combobox_txt'] = 'Use jQuery UI Combobox';
4648
$wb['use_loadindicator_txt'] = 'Use Load Indicator';

interface/web/admin/lib/lang/bg_system_config.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ $wb['tab_change_warning_txt'] = 'Tab change warning';
4141
$wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.';
4242
$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site';
4343
$wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!';
44+
$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site';
45+
$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!';
4446
$wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL';
4547
$wb['use_combobox_txt'] = 'Use jQuery UI Combobox';
4648
$wb['use_loadindicator_txt'] = 'Use Load Indicator';

interface/web/admin/lib/lang/br_system_config.lng

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ $wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail
3939
$wb['tab_change_discard_txt'] = 'Discard changes on tab change';
4040
$wb['tab_change_warning_txt'] = 'Tab change warning';
4141
$wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.';
42-
$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site';
42+
$wb['vhost_subdomains_txt'] = 'Create subdomains as web site';
4343
$wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!';
44+
$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site';
45+
$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!';
4446
$wb['phpmyadmin_url_error_regex'] = 'Invalid phpmyadmin URL';
4547
$wb['use_combobox_txt'] = 'Use jQuery UI Combobox';
4648
$wb['use_loadindicator_txt'] = 'Use Load Indicator';

interface/web/admin/lib/lang/cz_system_config.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ $wb['tab_change_warning_txt'] = 'Záložka změna varování';
4141
$wb['tab_change_warning_note_txt'] = 'Show a warning on tab change in edit forms if any data has been altered by the user.';
4242
$wb['vhost_subdomains_txt'] = 'Vytvořit subdomény jako webové stránky';
4343
$wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!';
44+
$wb['vhost_aliasdomains_txt'] = 'Vytvořit aliasdomény jako webové stránky';
45+
$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!';
4446
$wb['phpmyadmin_url_error_regex'] = 'phpmyadmin neplatné URL';
4547
$wb['use_combobox_txt'] = 'Použití jQuery UI Combobox';
4648
$wb['use_loadindicator_txt'] = 'Použití indikátoru zatížení';

interface/web/admin/lib/lang/de_system_config.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ $wb['shelluser_prefix_txt'] = 'Shell Benutzer Präfix';
1111
$wb['ftpuser_prefix_txt'] = 'FTP Benutzer Präfix';
1212
$wb['vhost_subdomains_txt'] = 'Subdomains als Webseite anlegen';
1313
$wb['vhost_subdomains_note_txt'] = 'Diese Einstellung kann nicht wieder deaktiviert werden, wenn Vhost Subdomains im System vorhanden sind!';
14+
$wb['vhost_aliasdomains_txt'] = 'Aliasdomains als Webseite anlegen';
15+
$wb['vhost_aliasdomains_note_txt'] = 'Diese Einstellung kann nicht wieder deaktiviert werden, wenn Vhost Aliasdomains im System vorhanden sind!';
1416
$wb['dbname_prefix_error_regex'] = 'Zeichen nicht erlaubt in Datenbank Namen Präfix.';
1517
$wb['dbuser_prefix_error_regex'] = 'Zeichen nicht erlaubt in Datenbank Benutzer Präfix.';
1618
$wb['ftpuser_prefix_error_regex'] = 'Zeichen nicht erlaubt in FTP Benutzer Präfix.';

interface/web/admin/lib/lang/el_system_config.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ $wb['tab_change_warning_txt'] = 'Προειδοποίηση αλλαγής κα
4141
$wb['tab_change_warning_note_txt'] = 'Εμφάνιση μιας προειδοποίησης κατα την αλλαγή καρτέλας σε φόρμες επεξεργασίας που έχουν τροποποιηθεί από τον χρήστη.';
4242
$wb['vhost_subdomains_txt'] = 'Δημιουργία Subdomains ως web site';
4343
$wb['vhost_subdomains_note_txt'] = 'Δεν μπορεί να γίνει απενεργοποίηση όσο υπάρχουν vhost subdomains στο σύστημα!';
44+
$wb['vhost_aliasdomains_txt'] = 'Δημιουργία aliasdomains ως web site';
45+
$wb['vhost_aliasdomains_note_txt'] = 'Δεν μπορεί να γίνει απενεργοποίηση όσο υπάρχουν vhost aliasdomains στο σύστημα!';
4446
$wb['phpmyadmin_url_error_regex'] = 'Μη έγκυρο URL phpmyadmin';
4547
$wb['use_combobox_txt'] = 'Χρήση jQuery UI Combobox';
4648
$wb['use_loadindicator_txt'] = 'Χρήση Load Indicator (ενδεικτή φόρτωσης)';

interface/web/admin/lib/lang/en_system_config.lng

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ $wb["dbuser_prefix_txt"] = 'Database user prefix';
1313
$wb["shelluser_prefix_txt"] = 'Shell user prefix';
1414
$wb["webdavuser_prefix_txt"] = 'Webdav user prefix';
1515
$wb["ftpuser_prefix_txt"] = 'FTP user prefix';
16-
$wb['vhost_subdomains_txt'] = 'Create Subdomains as web site';
16+
$wb['vhost_subdomains_txt'] = 'Create subdomains as web site';
1717
$wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!';
18+
$wb['vhost_aliasdomains_txt'] = 'Create aliasdomains as web site';
19+
$wb['vhost_aliasdomains_note_txt'] = 'You cannot disable this as long as vhost aliasdomains exist in the system!';
1820
$wb["dbname_prefix_error_regex"] = 'Char not allowed in database name prefix.';
1921
$wb["dbuser_prefix_error_regex"] = 'Char not allowed in database user prefix.';
2022
$wb["ftpuser_prefix_error_regex"] = 'Char not allowed in ftp user prefix.';

0 commit comments

Comments
 (0)