Commit 1ca82372 authored by tbrehm's avatar tbrehm
Browse files

Merged revisions 2181-2262 from stable branch.

parent fcac50bb
...@@ -96,6 +96,14 @@ class installer extends installer_base { ...@@ -96,6 +96,14 @@ class installer extends installer_base {
chgrp($config_dir.'/'.$configfile, 'root'); chgrp($config_dir.'/'.$configfile, 'root');
} }
public function configure_apache() {
global $conf;
if(file_exists('/etc/apache2/mods-available/fcgid.conf')) replaceLine('/etc/apache2/mods-available/fcgid.conf','MaxRequestLen','MaxRequestLen 15728640',0,1);
parent::configure_apache();
}
} }
......
...@@ -105,12 +105,6 @@ class installer_dist extends installer_base { ...@@ -105,12 +105,6 @@ class installer_dist extends installer_base {
'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf', 'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf', 'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf', 'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
'virtual_create_maildirsize = yes',
'virtual_maildir_extended = yes',
'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',
'virtual_mailbox_limit_override = yes',
'virtual_maildir_limit_message = "The user you are trying to reach is over quota."',
'virtual_overquota_bounce = yes',
'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps', 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps',
'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf', 'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf',
'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf', 'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf',
......
...@@ -101,13 +101,6 @@ class installer extends installer_base ...@@ -101,13 +101,6 @@ class installer extends installer_base
'smtpd_tls_key_file = '.$config_dir.'/smtpd.key', 'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf', 'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf', 'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
'virtual_create_maildirsize = yes',
'virtual_maildir_extended = yes',
'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',
'virtual_mailbox_limit_override = yes',
'virtual_maildir_limit_message = "The user you are trying to reach is over quota."',
'virtual_overquota_bounce = yes',
'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps', 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps',
'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf', 'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf',
'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf', 'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf',
......
...@@ -76,6 +76,8 @@ class installer_dist extends installer_base { ...@@ -76,6 +76,8 @@ class installer_dist extends installer_base {
caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed'); __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
if(!is_dir($cf['vmail_mailbox_base'])) mkdir($cf['vmail_mailbox_base']);
//* Creating virtual mail user and group //* Creating virtual mail user and group
if(is_group($cf['vmail_groupname'])) { if(is_group($cf['vmail_groupname'])) {
$command = 'groupmod -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname']; $command = 'groupmod -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
...@@ -117,12 +119,6 @@ class installer_dist extends installer_base { ...@@ -117,12 +119,6 @@ class installer_dist extends installer_base {
'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf', 'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf', 'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf', 'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
'virtual_create_maildirsize = yes',
'virtual_maildir_extended = yes',
'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',
'virtual_mailbox_limit_override = yes',
'virtual_maildir_limit_message = "The user you are trying to reach is over quota."',
'virtual_overquota_bounce = yes',
'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps', 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps',
'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf', 'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf',
'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf', 'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf',
......
...@@ -116,7 +116,7 @@ class installer_base { ...@@ -116,7 +116,7 @@ class installer_base {
if(is_installed('mailman')) $conf['mailman']['installed'] = true; if(is_installed('mailman')) $conf['mailman']['installed'] = true;
if(is_installed('apache') || is_installed('apache2') || is_installed('httpd')) $conf['apache']['installed'] = true; if(is_installed('apache') || is_installed('apache2') || is_installed('httpd')) $conf['apache']['installed'] = true;
if(is_installed('getmail')) $conf['getmail']['installed'] = true; if(is_installed('getmail')) $conf['getmail']['installed'] = true;
if(is_installed('courierlogger')) $conf['courier']['installed'] = true; if(is_installed('courierlogger')) $conf['courier']['installed'] = true;
if(is_installed('dovecot')) $conf['dovecot']['installed'] = true; if(is_installed('dovecot')) $conf['dovecot']['installed'] = true;
if(is_installed('saslsauthd')) $conf['saslauthd']['installed'] = true; if(is_installed('saslsauthd')) $conf['saslauthd']['installed'] = true;
if(is_installed('amavisd-new')) $conf['amavis']['installed'] = true; if(is_installed('amavisd-new')) $conf['amavis']['installed'] = true;
...@@ -578,12 +578,6 @@ class installer_base { ...@@ -578,12 +578,6 @@ class installer_base {
'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf', 'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf', 'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf', 'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
'virtual_create_maildirsize = yes',
'virtual_maildir_extended = yes',
'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',
'virtual_mailbox_limit_override = yes',
'virtual_maildir_limit_message = "The user you are trying to reach is over quota."',
'virtual_overquota_bounce = yes',
'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps', 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps',
'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf', 'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf',
'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf', 'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf',
...@@ -622,7 +616,7 @@ class installer_base { ...@@ -622,7 +616,7 @@ class installer_base {
if(!stristr($options,'dont-create-certs')) { if(!stristr($options,'dont-create-certs')) {
//* Create the SSL certificate //* Create the SSL certificate
$command = 'cd '.$config_dir.'; ' $command = 'cd '.$config_dir.'; '
.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509'; .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509';
exec($command); exec($command);
$command = 'chmod o= '.$config_dir.'/smtpd.key'; $command = 'chmod o= '.$config_dir.'/smtpd.key';
...@@ -1103,7 +1097,8 @@ class installer_base { ...@@ -1103,7 +1097,8 @@ class installer_base {
// Check the awsatst script // Check the awsatst script
if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools'); if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl'); if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
//* add a sshusers group //* add a sshusers group
$command = 'groupadd sshusers'; $command = 'groupadd sshusers';
if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
......
...@@ -1362,7 +1362,7 @@ INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`, ...@@ -1362,7 +1362,7 @@ INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`,
-- Dumping data for table `sys_config` -- Dumping data for table `sys_config`
-- --
INSERT INTO sys_config VALUES ('1','db','db_version','3.0.3.1'); INSERT INTO sys_config VALUES ('1','db','db_version','3.0.3.3');
-- -------------------------------------------------------- -- --------------------------------------------------------
......
...@@ -11,25 +11,25 @@ ...@@ -11,25 +11,25 @@
ServerAdmin webmaster@localhost ServerAdmin webmaster@localhost
{apps_vhost_servername} {apps_vhost_servername}
<IfModule mod_fcgid.c> <IfModule mod_php5.c>
DocumentRoot {apps_vhost_dir} DocumentRoot {apps_vhost_dir}
SuexecUserGroup ispapps ispapps AddType application/x-httpd-php .php
<Directory {apps_vhost_dir}> <Directory {apps_vhost_dir}>
Options Indexes FollowSymLinks MultiViews +ExecCGI Options FollowSymLinks
AllowOverride AuthConfig Indexes Limit Options FileInfo AllowOverride None
AddHandler fcgid-script .php
FCGIWrapper {website_basedir}/php-fcgi-scripts/apps/.php-fcgi-starter .php
Order allow,deny Order allow,deny
Allow from all Allow from all
</Directory> </Directory>
</IfModule> </IfModule>
<IfModule mod_php5.c> <IfModule mod_fcgid.c>
DocumentRoot {apps_vhost_dir} DocumentRoot {apps_vhost_dir}
AddType application/x-httpd-php .php SuexecUserGroup ispapps ispapps
<Directory {apps_vhost_dir}> <Directory {apps_vhost_dir}>
Options FollowSymLinks Options Indexes FollowSymLinks MultiViews +ExecCGI
AllowOverride None AllowOverride AuthConfig Indexes Limit Options FileInfo
AddHandler fcgid-script .php
FCGIWrapper {website_basedir}/php-fcgi-scripts/apps/.php-fcgi-starter .php
Order allow,deny Order allow,deny
Allow from all Allow from all
</Directory> </Directory>
......
...@@ -56,7 +56,7 @@ $revision = str_replace(array('Revision:','$',' '), '', $svn_revision); ...@@ -56,7 +56,7 @@ $revision = str_replace(array('Revision:','$',' '), '', $svn_revision);
//** Application //** Application
define('ISPC_APP_TITLE', 'ISPConfig'); define('ISPC_APP_TITLE', 'ISPConfig');
define('ISPC_APP_VERSION', '3.0.3.2'); define('ISPC_APP_VERSION', '3.0.3.3');
//** Database //** Database
...@@ -143,7 +143,6 @@ $conf['theme'] = 'default'; ...@@ -143,7 +143,6 @@ $conf['theme'] = 'default';
$conf['html_content_encoding'] = 'utf-8'; // example: utf-8, iso-8859-1, ... $conf['html_content_encoding'] = 'utf-8'; // example: utf-8, iso-8859-1, ...
$conf['logo'] = 'themes/default/images/ispc_logo.png'; $conf['logo'] = 'themes/default/images/ispc_logo.png';
//** Default Language //** Default Language
$conf['language'] = '{language}'; $conf['language'] = '{language}';
$conf['debug_language'] = false; $conf['debug_language'] = false;
......
...@@ -163,7 +163,7 @@ class app { ...@@ -163,7 +163,7 @@ class app {
//* Load module wordbook, if it exists //* Load module wordbook, if it exists
if(isset($_SESSION['s']['module']['name']) && isset($_SESSION['s']['language'])) { if(isset($_SESSION['s']['module']['name']) && isset($_SESSION['s']['language'])) {
$lng_file = '/web/'.$_SESSION['s']['module']['name'].'/lib/lang/'.$_SESSION['s']['language'].'.lng'; $lng_file = '/web/'.$_SESSION['s']['module']['name'].'/lib/lang/'.$_SESSION['s']['language'].'.lng';
if(!file_exists(ISPC_ROOT_PATH.$lng_file)) $lng_file = '/web/'.$_SESSION['s']['module']['name'].'/lib/lang/en.lng'; if(!file_exists(ISPC_ROOT_PATH.'/'.$lng_file)) $lng_file = '/web/'.$_SESSION['s']['module']['name'].'/lib/lang/en.lng';
$this->load_language_file($lng_file); $this->load_language_file($lng_file);
} }
$this->_language_inc = 1; $this->_language_inc = 1;
...@@ -183,7 +183,7 @@ class app { ...@@ -183,7 +183,7 @@ class app {
$filename = ISPC_ROOT_PATH.'/'.$filename; $filename = ISPC_ROOT_PATH.'/'.$filename;
if(substr($filename,-4) != '.lng') $this->error('Language file has wrong extension.'); if(substr($filename,-4) != '.lng') $this->error('Language file has wrong extension.');
if(file_exists($filename)) { if(file_exists($filename)) {
@include_once($filename); @include($filename);
if(is_array($wb)) { if(is_array($wb)) {
if(is_array($this->_wb)) { if(is_array($this->_wb)) {
$this->_wb = array_merge($this->_wb,$wb); $this->_wb = array_merge($this->_wb,$wb);
......
...@@ -87,6 +87,15 @@ class functions { ...@@ -87,6 +87,15 @@ class functions {
return $out; return $out;
} }
public function currency_format($number) {
global $app;
$number_format_decimals = (int)$app->lng('number_format_decimals');
$number_format_dec_point = $app->lng('number_format_dec_point');
$number_format_thousands_sep = $app->lng('number_format_thousands_sep');
if($number_format_thousands_sep == 'number_format_thousands_sep') $number_format_thousands_sep = '';
return number_format((double)$number, $number_format_decimals, $number_format_dec_point, $number_format_thousands_sep);
}
} }
......
...@@ -281,7 +281,7 @@ class listform { ...@@ -281,7 +281,7 @@ class listform {
public function decode($record) public function decode($record)
{ {
global $conf; global $conf, $app;
if(is_array($record)) { if(is_array($record)) {
foreach($this->listDef['item'] as $field){ foreach($this->listDef['item'] as $field){
$key = $field['field']; $key = $field['field'];
...@@ -333,7 +333,7 @@ class listform { ...@@ -333,7 +333,7 @@ class listform {
break; break;
case 'CURRENCY': case 'CURRENCY':
$record[$key] = number_format($record[$key], 2, ',', ''); $record[$key] = $app->functions->currency_format($record[$key]);
break; break;
default: default:
......
...@@ -145,6 +145,18 @@ class remoting { ...@@ -145,6 +145,18 @@ class remoting {
} }
} }
public function server_get_serverid_by_ip($session_id, $ipaddress)
{
global $app;
if(!$this->checkPerm($session_id, 'server_get_serverid_by_ip')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$sql = "SELECT server_id FROM server_ip WHERE ip_address = '$ipaddress' LIMIT 1 ";
$all = $app->db->queryAllRecords($sql);
return $all;
}
//* Get mail domain details //* Get mail domain details
public function mail_domain_get($session_id, $primary_id) public function mail_domain_get($session_id, $primary_id)
{ {
...@@ -1029,6 +1041,91 @@ class remoting { ...@@ -1029,6 +1041,91 @@ class remoting {
return $affected_rows; return $affected_rows;
} }
// -----------------------------------------------------------------------------------------------
public function client_delete_everything($session_id, $client_id)
{
global $app, $conf;
if(!$this->checkPerm($session_id, 'client_delete_everything')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$client_id = intval($client_id);
$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_domain,web_traffic';
$tables_array = explode(',',$tables);
$client_group_id = intval($client_group['groupid']);
$table_list = array();
if($client_group_id > 1) {
foreach($tables_array as $table) {
if($table != '') {
$records = $app->db->queryAllRecords("SELECT * FROM $table WHERE sys_groupid = ".$client_group_id);
$number = count($records);
if($number > 0) $table_list[] = array('table' => $table."(".$number.")");
}
}
}
if($client_id > 0) {
// remove the group of the client from the resellers group
$parent_client_id = intval($this->dataRecord['parent_client_id']);
$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
$app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']);
// delete the group of the client
$app->db->query("DELETE FROM sys_group WHERE client_id = $client_id");
// delete the sys user(s) of the client
$app->db->query("DELETE FROM sys_user WHERE client_id = $client_id");
// Delete all records (sub-clients, mail, web, etc....) of this client.
$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_domain,web_traffic';
$tables_array = explode(',',$tables);
$client_group_id = intval($client_group['groupid']);
if($client_group_id > 1) {
foreach($tables_array as $table) {
if($table != '') {
$records = $app->db->queryAllRecords("SELECT * FROM $table WHERE sys_groupid = ".$client_group_id);
// find the primary ID of the table
$table_info = $app->db->tableInfo($table);
$index_field = '';
foreach($table_info as $tmp) {
if($tmp['option'] == 'primary') $index_field = $tmp['name'];
}
// Delete the records
if($index_field != '') {
if(is_array($records)) {
foreach($records as $rec) {
$app->db->datalogDelete($table, $index_field, $rec[$index_field]);
}
}
}
}
}
}
}
if (!$this->checkPerm($session_id, 'client_delete'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../client/form/client.tform.php',$client_id);
// $app->remoting_lib->ispconfig_sysuser_delete($client_id);
return false;
}
// Website functions --------------------------------------------------------------------------------------- // Website functions ---------------------------------------------------------------------------------------
//* Get cron details //* Get cron details
...@@ -1238,19 +1335,19 @@ class remoting { ...@@ -1238,19 +1335,19 @@ class remoting {
} }
//* Add a record //* Add a record
public function sites_web_domain_add($session_id, $client_id, $params, $readonly = false) public function sites_web_domain_add($session_id, $client_id, $params, $readonly = false)
{ {
global $app; global $app;
if(!$this->checkPerm($session_id, 'sites_web_domain_add')) { if(!$this->checkPerm($session_id, 'sites_web_domain_add')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false; return false;
} }
$affected_rows = $this->insertQuery('../sites/form/web_domain.tform.php',$client_id,$params, 'sites:web_domain:on_after_insert'); $domain_id = $this->insertQuery('../sites/form/web_domain.tform.php',$client_id,$params, 'sites:web_domain:on_after_insert');
if ($readonly === true) if ($readonly === true)
$app->db->query("UPDATE web_domain SET `sys_userid` = '1' WHERE domain_id = ".$affected_rows); $app->db->query("UPDATE web_domain SET `sys_userid` = '1' WHERE domain_id = ".$domain_id);
return $affected_rows; return $domain_id;
} }
//* Update a record //* Update a record
public function sites_web_domain_update($session_id, $client_id, $primary_id, $params) public function sites_web_domain_update($session_id, $client_id, $primary_id, $params)
{ {
...@@ -1369,7 +1466,59 @@ class remoting { ...@@ -1369,7 +1466,59 @@ class remoting {
return $affected_rows; return $affected_rows;
} }
// -----------------------------------------------------------------------------------------------
//* Get record details
public function domains_domain_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'domains_domain_get')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../domain/form/domain.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Add a record
public function domains_domain_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'domains_domain_add')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../domain/form/domain.tform.php',$client_id,$params);
}
//* Delete a record
public function domains_domain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'domains_domain_delete')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../domain/form/domain.tform.php',$primary_id);
return $affected_rows;
}
// -----------------------------------------------------------------------------------------------
public function domains_get_all_by_user($session_id, $group_id)
{
global $app;
if(!$this->checkPerm($session_id, 'domains_get_all_by_user')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$group_id = intval($group_id);
$sql = "SELECT domain_id, domain FROM domain WHERE sys_groupid = $group_id ";
$all = $app->db->queryAllRecords($sql);
return $all;
}
// DNS Function -------------------------------------------------------------------------------------------------- // DNS Function --------------------------------------------------------------------------------------------------
//* Get record details //* Get record details
......
...@@ -685,8 +685,16 @@ class remoting_lib { ...@@ -685,8 +685,16 @@ class remoting_lib {
$language = $app->db->quote($params["language"]); $language = $app->db->quote($params["language"]);
$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('$username','','$insert_id')", 'groupid'); $groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('$username','','$insert_id')", 'groupid');
$groups = $groupid; $groups = $groupid;
$salt="$1$";
$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for ($n=0;$n<8;$n++) {
$salt.=$base64_alphabet[mt_rand(0,63)];
}
$salt.="$";
$password = crypt(stripslashes($password),$salt);
$sql1 = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id) $sql1 = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
VALUES ('$username',md5('$password'),'$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,$insert_id)"; VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,$insert_id)";
$app->db->query($sql1); $app->db->query($sql1);
} }
...@@ -695,7 +703,14 @@ class remoting_lib { ...@@ -695,7 +703,14 @@ class remoting_lib {
$username = $app->db->quote($params["username"]); $username = $app->db->quote($params["username"]);
$password = $app->db->quote($params["password"]); $password = $app->db->quote($params["password"]);
$client_id = intval($client_id); $client_id = intval($client_id);
$sql = "UPDATE sys_user set username = '$username', passwort = md5('$password') WHERE client_id = $client_id"; $salt="$1$";
$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for ($n=0;$n<8;$n++) {
$salt.=$base64_alphabet[mt_rand(0,63)];
}
$salt.="$";
$password = crypt(stripslashes($password),$salt);
$sql = "UPDATE sys_user set username = '$username', passwort = '$password' WHERE client_id = $client_id";
$app->db->query($sql); $app->db->query($sql);
} }
......
...@@ -163,7 +163,8 @@ class tform { ...@@ -163,7 +163,8 @@ class tform {
* @return record * @return record
*/ */
function decode($record,$tab) { function decode($record,$tab) {
if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab does not exist or the tab is empty (TAB: $tab)."); global $conf, $app;
if(!is_array($this->formDef[