diff --git a/install/install.php b/install/install.php
index 0236820ce9e6d0da2fb4c176e987e06d111df775..cab7069d39807e1c017f63f8743dbc8f36608b38 100644
--- a/install/install.php
+++ b/install/install.php
@@ -246,6 +246,8 @@ $conf['services']['xmpp'] = false;
if($install_mode == 'standard') {
+ $inst->dbmaster = $inst->db;
+
//* Create the MySQL database
$inst->configure_database();
@@ -500,6 +502,9 @@ if($install_mode == 'standard') {
$inst->install_crontab();
} else swriteln('[ERROR] Cron not found');
+ swriteln('Detect IP addresses');
+ $inst->detect_ips();
+
swriteln('Restarting services ...');
if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1');
if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart'));
@@ -696,6 +701,9 @@ if($install_mode == 'standard') {
swriteln('Configuring Pureftpd');
$inst->configure_pureftpd();
}
+
+ swriteln('Detect IP addresses');
+ $inst->detect_ips();
//** Configure DNS
if(strtolower($inst->simple_query('Configure DNS Server', array('y', 'n'), 'y','configure_dns')) == 'y') {
@@ -866,6 +874,9 @@ if($install_mode == 'standard') {
if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload'));
if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload'));
}
+
+ swriteln('Detect IP addresses');
+ $inst->detect_ips();
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index db83e059810af409cab86df00cd0b162813c032e..be878c1fe737fcbdc80c81ec5e59fb1a19bd7ad7 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -371,6 +371,84 @@ class installer_base {
}
+
+ public function detect_ips(){
+ global $conf;
+
+ exec("ip addr show | awk '/global/ { print $2 }' | cut -d '/' -f 1", $output, $retval);
+
+ if($retval == 0){
+ if(is_array($output) && !empty($output)){
+ foreach($output as $line){
+ $line = trim($line);
+ $ip_type = '';
+ if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
+ $ip_type = 'IPv4';
+ }
+ if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
+ $ip_type = 'IPv6';
+ }
+ if($ip_type == '') continue;
+ if($this->db->dbHost != $this->dbmaster->dbHost){
+ $this->dbmaster->query('INSERT INTO server_ip (
+ sys_userid, sys_groupid, sys_perm_user, sys_perm_group,
+ sys_perm_other, server_id, client_id, ip_type, ip_address,
+ virtualhost, virtualhost_port
+ ) VALUES (
+ 1,
+ 1,
+ "riud",
+ "riud",
+ "",
+ ' . $conf['server_id'] . ',
+ 0,
+ "'.$ip_type.'",
+ "'.$line.'",
+ "y",
+ "80,443"
+ )');
+ $server_ip_id = $this->dbmaster->insertID();
+ $this->db->query('INSERT INTO server_ip (
+ server_php_id, sys_userid, sys_groupid, sys_perm_user, sys_perm_group,
+ sys_perm_other, server_id, client_id, ip_type, ip_address,
+ virtualhost, virtualhost_port
+ ) VALUES (
+ '.$server_ip_id.',
+ 1,
+ 1,
+ "riud",
+ "riud",
+ "",
+ ' . $conf['server_id'] . ',
+ 0,
+ "'.$ip_type.'",
+ "'.$line.'",
+ "y",
+ "80,443"
+ )');
+ } else {
+ $this->db->query('INSERT INTO server_ip (
+ sys_userid, sys_groupid, sys_perm_user, sys_perm_group,
+ sys_perm_other, server_id, client_id, ip_type, ip_address,
+ virtualhost, virtualhost_port
+ ) VALUES (
+ 1,
+ 1,
+ "riud",
+ "riud",
+ "",
+ ' . $conf['server_id'] . ',
+ 0,
+ "'.$ip_type.'",
+ "'.$line.'",
+ "y",
+ "80,443"
+ )');
+ }
+ }
+ }
+ }
+ }
public function grant_master_database_rights($verbose = false) {
global $conf;
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index 1c56118ae14bc164f0074ac9f6f5ab8c517781ce..672f94bae40e63766b1674d29e0bfe913e9dd864 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -257,6 +257,9 @@ CREATE TABLE `client` (
`customer_no_counter` int(11) NOT NULL DEFAULT '0',
`added_date` date NOT NULL DEFAULT '0000-00-00',
`added_by` varchar(255) DEFAULT NULL,
+ `validation_status` enum('accept','review','reject') NOT NULL DEFAULT 'accept',
+ `risk_score` int(10) unsigned NOT NULL DEFAULT '0',
+ `activation_code` varchar(10) NOT NULL DEFAULT '',
PRIMARY KEY (`client_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
@@ -455,6 +458,7 @@ CREATE TABLE IF NOT EXISTS `directive_snippets` (
`customer_viewable` ENUM('n','y') NOT NULL DEFAULT 'n',
`required_php_snippets` varchar(255) NOT NULL DEFAULT '',
`active` enum('n','y') NOT NULL DEFAULT 'y',
+ `master_directive_snippets_id` int(11) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`directive_snippets_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
@@ -1946,6 +1950,7 @@ CREATE TABLE `web_domain` (
`enable_pagespeed` ENUM('y','n') NOT NULL DEFAULT 'n',
`http_port` int(11) unsigned NOT NULL DEFAULT '80',
`https_port` int(11) unsigned NOT NULL DEFAULT '443',
+ `folder_directive_snippets` text NOT NULL,
PRIMARY KEY (`domain_id`),
UNIQUE KEY `serverdomain` ( `server_id` , `ip_address`, `domain` )
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master
index 286dc077b56a538e4f195968893715fdb50ba238..1f7df52936eaee3e08285d57d75fd902517c0981 100644
--- a/install/tpl/server.ini.master
+++ b/install/tpl/server.ini.master
@@ -18,6 +18,7 @@ admin_notify_events=1
backup_dir=/var/backup
backup_dir_is_mount=n
backup_mode=rootgz
+backup_time=0:00
backup_delete=n
monit_url=
monit_user=
@@ -46,7 +47,7 @@ relayhost_password=
mailbox_size_limit=0
message_size_limit=0
mailbox_quota_stats=y
-realtime_blackhole_list=
+realtime_blackhole_list=zen.spamhaus.org
overquota_notify_admin=y
overquota_notify_client=y
overquota_notify_freq=7
@@ -78,7 +79,6 @@ apps_vhost_ip=_default_
apps_vhost_servername=
php_open_basedir=[website_path]/web:[website_path]/private:[website_path]/tmp:/var/www/[website_domain]/web:/srv/www/[website_domain]/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin
htaccess_allow_override=All
-enable_spdy=y
awstats_conf_dir=/etc/awstats
awstats_data_dir=/var/lib/awstats
awstats_pl=/usr/lib/cgi-bin/awstats.pl
@@ -131,7 +131,7 @@ fastcgi_config_syntax=1
[jailkit]
jailkit_chroot_home=/home/[username]
jailkit_chroot_app_sections=basicshell editors extendedshell netutils ssh sftp scp groups jk_lsh
-jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch
+jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch /usr/bin/which /usr/lib/x86_64-linux-gnu/libmemcached.so.11 /usr/lib/x86_64-linux-gnu/libmemcachedutil.so.2 /usr/lib/x86_64-linux-gnu/libMagickWand-6.Q16.so.2 /opt/php-5.6.8/bin/php /opt/php-5.6.8/include /opt/php-5.6.8/lib
jailkit_chroot_cron_programs=/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php
[vlogger]
diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index 8ec44964536155a98128d7f3d8b7ea50a523842c..92f6f17bc92e5a78ca4ff7ffda730936cad2bfa3 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -390,6 +390,334 @@ class functions {
return getimagesizefromstring($string);
}
}
+
+ public function password($minLength = 10, $special = false){
+ global $app;
+
+ $iteration = 0;
+ $password = "";
+ $maxLength = $minLength + 5;
+ $length = $this->getRandomInt($minLength, $maxLength);
+
+ while($iteration < $length){
+ $randomNumber = (floor(((mt_rand() / mt_getrandmax()) * 100)) % 94) + 33;
+ if(!$special){
+ if (($randomNumber >=33) && ($randomNumber <=47)) { continue; }
+ if (($randomNumber >=58) && ($randomNumber <=64)) { continue; }
+ if (($randomNumber >=91) && ($randomNumber <=96)) { continue; }
+ if (($randomNumber >=123) && ($randomNumber <=126)) { continue; }
+ }
+ $iteration++;
+ $password .= chr($randomNumber);
+ }
+ $app->uses('validate_password');
+ if($app->validate_password->password_check('', $password, '') !== false) $password = $this->password($minLength, $special);
+ return $password;
+ }
+
+ public function getRandomInt($min, $max){
+ return floor((mt_rand() / mt_getrandmax()) * ($max - $min + 1)) + $min;
+ }
+
+ public function generate_customer_no(){
+ global $app;
+ // generate customer no.
+ $customer_no = mt_rand(100000, 999999);
+ while($app->db->queryOneRecord("SELECT client_id FROM client WHERE customer_no = '".$customer_no."'")){
+ $customer_no = mt_rand(100000, 999999);
+ }
+
+ return $customer_no;
+ }
+
+ public function generate_activation_code(){
+
+ $activation_code = str_pad(mt_rand(0, 99999999), 8, '0', STR_PAD_LEFT);
+
+ return $activation_code;
+ }
+
+ public function client_activate($client_id){
+ global $app, $conf;
+
+ if(!is_file(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php')) return false;
+ include(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php');
+
+ $context = stream_context_create(array(
+ 'ssl' => array(
+ 'verify_peer' => false,
+ 'verify_peer_name' => false,
+ )
+ ));
+
+ $soap_client = new SoapClient(null, array('location' => $robot_conf['soap']['soap_location'],
+ 'uri' => $robot_conf['soap']['soap_uri'],
+ 'trace' => 1,
+ 'exceptions' => 1,
+ 'stream_context' => $context));
+
+
+ try {
+ if($session_id = $soap_client->login($robot_conf['soap']['username'] , $robot_conf['soap']['password'])) {
+ //echo 'Logged successfull. Session ID:'.$session_id.'
';
+ }
+ $error = '';
+ $client_record = $soap_client->client_get($session_id, $client_id);
+
+ $client_record['password'] = $this->password();
+ if(trim($client_record['customer_no']) == '') $client_record['customer_no'] = $this->generate_customer_no();
+ $client_record['username'] = 'c'.$client_record['customer_no'];
+ //die($client_record['customer_no']);
+ //$client_record['locked'] = 'n';
+ $client_record['canceled'] = 'n';
+ $soap_client->client_update($session_id, $client_id, 0, $client_record);
+
+ $app->db->query("UPDATE client SET validation_status = 'accept', activation_code = '' WHERE client_id = ".$client_id);
+
+ $activation_letter_filename = ISPC_ROOT_PATH.'/pdf/activation_letters/c'.$client_id.'-'.$client_record['activation_code'].'.pdf';
+ if(is_file($activation_letter_filename)) unlink($activation_letter_filename);
+
+ $webdetails['ispconfiguser'] = $client_record['username'];
+ $webdetails['ispconfigpassword'] = $client_record['password'];
+ $webdetails['customer_no'] = $client_record['customer_no'];
+ $webdetails['contact'] = ($client_record['contact_firstname'] != ''? $client_record['contact_firstname'].' ' : '').$client_record['contact_name'];
+ $webdetails['salutation_de'] = ($client_record['gender'] == 'f'? 'Frau' : 'Herr');
+ $webdetails['salutation_en'] = ($client_record['gender'] == 'f'? 'Mrs.' : 'Mr.');
+ $webdetails['ispconfigurl'] = 'http'.($_SERVER['HTTPS'] == 'on'? 's' : '').'://'.$_SERVER['HTTP_HOST'];
+ $webdetails['signature_de'] = $robot_conf['textbaustein']['emailfooter'];
+ $webdetails['signature_en'] = $robot_conf['textbaustein_en']['emailfooter'];
+
+ if($error == ''){
+ // send email with login details
+ $invoice_client_settings = $app->db->queryOneRecord("SELECT * FROM invoice_client_settings WHERE client_id = ".intval($client_id));
+ $company = $app->db->queryOneRecord("SELECT * FROM invoice_company WHERE invoice_company_id = ".$invoice_client_settings['invoice_company_id']);
+
+ $subject = '['.$company['company_name_short'].'] Zugangsdaten zu unserem Kundeninterface / Login details for our customer interface';
+
+ $app->uses('tpl');
+ $tpl = new tpl;
+ $tpl->newTemplate(ISPC_WEB_PATH."/client/templates/ispconfig_login.master");
+ $tpl->setVar($webdetails);
+ $message = $tpl->grab();
+
+ if($robot_conf['production_mode']){
+ $app->functions->mail(trim($client_record['email']), $subject, $message, 'support@timmehosting.de', '', 'application/pdf', '', '', 'f.timme@timmehosting.de,hetzner@timmehosting.de', 'TimmeHosting.de Support');
+
+ $app->db->query("INSERT INTO `th_robot_message` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `client_id`, `subject`, `message`, `message_sent_date`, `message_sent_tstamp`, `email_from`, `email_to`, `email_to_bcc`) VALUES(1, 1, 'riud', 'riud', '', ".intval($client_id).", '".$app->db->quote($subject)."', '".$app->db->quote($message)."', '".date('Y-m-d')."', ".time().", 'support@timmehosting.de', '".trim($client_record['email'])."', 'f.timme@timmehosting.de,hetzner@timmehosting.de')");
+ }
+ }
+
+ if($soap_client->logout($session_id)) {
+ //echo 'Logged out.
';
+ }
+
+ } catch (SoapFault $e) {
+ //$error .= $client->__getLastResponse();
+ $error .= 'SOAP Error: '.$e->getMessage();
+ }
+ }
+
+ public function client_activation_failed($client){
+ global $app, $conf;
+
+ if(!is_file(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php')) return false;
+ include(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php');
+
+ $client_id = intval($client['client_id']);
+ $webdetails['contact'] = ($client['contact_firstname'] != ''? $client['contact_firstname'].' ' : '').$client['contact_name'];
+ $webdetails['salutation_de'] = ($client['gender'] == 'f'? 'Frau' : 'Herr');
+ $webdetails['salutation_en'] = ($client['gender'] == 'f'? 'Mrs.' : 'Mr.');
+ $webdetails['signature_de'] = $robot_conf['textbaustein']['emailfooter'];
+ $webdetails['signature_en'] = $robot_conf['textbaustein_en']['emailfooter'];
+
+
+ // send email with login details
+ $invoice_client_settings = $app->db->queryOneRecord("SELECT * FROM invoice_client_settings WHERE client_id = ".intval($client_id));
+ $company = $app->db->queryOneRecord("SELECT * FROM invoice_company WHERE invoice_company_id = ".$invoice_client_settings['invoice_company_id']);
+ $subject = '['.$company['company_name_short'].'] Aktivierung Ihres Kundenaccounts fehlgeschlagen / Activation of your customer account failed';
+
+ $app->uses('tpl');
+ $tpl = new tpl;
+ $tpl->newTemplate(ISPC_WEB_PATH."/client/templates/ispconfig_client_activation_failed.master");
+ $tpl->setVar($webdetails);
+ $message = $tpl->grab();
+
+ if($robot_conf['production_mode']){
+ $app->functions->mail(trim($client['email']), $subject, $message, 'support@timmehosting.de', '', 'application/pdf', '', '', 'f.timme@timmehosting.de,hetzner@timmehosting.de', 'TimmeHosting.de Support');
+
+ $app->db->query("INSERT INTO `th_robot_message` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `client_id`, `subject`, `message`, `message_sent_date`, `message_sent_tstamp`, `email_from`, `email_to`, `email_to_bcc`) VALUES(1, 1, 'riud', 'riud', '', ".intval($client_id).", '".$app->db->quote($subject)."', '".$app->db->quote($message)."', '".date('Y-m-d')."', ".time().", 'support@timmehosting.de', '".trim($client['email'])."', 'f.timme@timmehosting.de,hetzner@timmehosting.de')");
+ }
+ }
+
+ public function client_review($client_id){
+ global $app, $conf;
+
+ if(!is_file(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php')) return false;
+ include(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php');
+
+ $context = stream_context_create(array(
+ 'ssl' => array(
+ 'verify_peer' => false,
+ 'verify_peer_name' => false,
+ )
+ ));
+
+ $soap_client = new SoapClient(null, array('location' => $robot_conf['soap']['soap_location'],
+ 'uri' => $robot_conf['soap']['soap_uri'],
+ 'trace' => 1,
+ 'exceptions' => 1,
+ 'stream_context' => $context));
+
+ try {
+ if($session_id = $soap_client->login($robot_conf['soap']['username'] , $robot_conf['soap']['password'])) {
+ //echo 'Logged successfull. Session ID:'.$session_id.'
';
+ }
+ $error = '';
+ $client_record = $soap_client->client_get($session_id, $client_id);
+
+ if(trim($client_record['customer_no']) == ''){
+ $client_record['customer_no'] = $this->generate_customer_no();
+ $soap_client->client_update($session_id, $client_id, 0, $client_record);
+ }
+
+ $activation_code = $this->generate_activation_code();
+ $app->db->query("UPDATE client SET activation_code = '".$activation_code."'".($client_record['validation_status'] != 'review'? ", validation_status = 'review'" : "")." WHERE client_id = ".$client_id);
+
+ $webdetails['customer_no'] = $client_record['customer_no'];
+ $webdetails['contact'] = ($client_record['contact_firstname'] != ''? $client_record['contact_firstname'].' ' : '').$client_record['contact_name'];
+ $webdetails['salutation_de'] = ($client_record['gender'] == 'f'? 'Frau' : 'Herr');
+ $webdetails['salutation_en'] = ($client_record['gender'] == 'f'? 'Mrs.' : 'Mr.');
+ $webdetails['signature_de'] = $robot_conf['textbaustein']['emailfooter'];
+ $webdetails['signature_en'] = $robot_conf['textbaustein_en']['emailfooter'];
+ $webdetails['email'] = $client_record['email'];
+ include ISPC_LIB_PATH.'/lang/'.strtolower($client_record['language']).'.lng';
+ $webdetails['latest_activation_date'] = date($wb['conf_format_dateshort'], $client_record['created_at'] + 14 * 86400);
+
+ if($error == ''){
+ // send email with login details
+ $invoice_client_settings = $app->db->queryOneRecord("SELECT * FROM invoice_client_settings WHERE client_id = ".intval($client_id));
+ $company = $app->db->queryOneRecord("SELECT * FROM invoice_company WHERE invoice_company_id = ".$invoice_client_settings['invoice_company_id']);
+
+ $subject = '['.$company['company_name_short'].'] Aktivierung Ihres Kundenkontos / Activation of your customer account';
+ $webdetails['company_name_short'] = $company['company_name_short'];
+
+ $app->uses('tpl');
+ $tpl = new tpl;
+ $tpl->newTemplate(ISPC_WEB_PATH."/client/templates/ispconfig_client_activation_email.master");
+ $tpl->setVar($webdetails);
+ $message = $tpl->grab();
+
+ if($robot_conf['production_mode']){
+ $app->functions->mail(trim($client_record['email']), $subject, $message, 'support@timmehosting.de', '', 'application/pdf', '', '', 'f.timme@timmehosting.de,hetzner@timmehosting.de', 'TimmeHosting.de Support');
+
+ $app->db->query("INSERT INTO `th_robot_message` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `client_id`, `subject`, `message`, `message_sent_date`, `message_sent_tstamp`, `email_from`, `email_to`, `email_to_bcc`) VALUES(1, 1, 'riud', 'riud', '', ".intval($client_id).", '".$app->db->quote($subject)."', '".$app->db->quote($message)."', '".date('Y-m-d')."', ".time().", 'support@timmehosting.de', '".trim($client_record['email'])."', 'f.timme@timmehosting.de,hetzner@timmehosting.de')");
+ }
+ }
+
+ // create activation letter pdf
+ $app->uses('pdf');
+ $app->pdf->AliasNbPages();
+ $app->pdf->createActivationLetter($client_id);
+
+ $pdf_content = $app->pdf->Output('doc.pdf', 'S');
+
+ $activation_letter_filename = ISPC_ROOT_PATH.'/pdf/activation_letters/c'.$client_id.'-'.$activation_code.'.pdf';
+ file_put_contents($activation_letter_filename, $pdf_content);
+
+ if(is_file($activation_letter_filename)){
+ include(ISPC_WEB_PATH.'/billing/lib/onlinebrief24/Net/SFTP.php');
+ $sftp = new Net_SFTP('api.letterei-onlinebrief.de');
+ if (!$sftp->login($company['onlinebrief24_user'], $company['onlinebrief24_password'])) {
+ $error_msg = $app->lng('onlinebrief24_login_failed_txt');
+ $app->error($error_msg);
+ }
+ $upload_filename = ($company['onlinebrief24_print'] == 'coloured'? '1' : '0').'00'.($client_record['country'] == 'DE'? '1' : '0').'000000000-c'.$client_id.'-'.$activation_code.'.pdf';
+ //die($upload_filename);
+ $sftp->chdir('upload/api');
+ $sftp->put($upload_filename, $activation_letter_filename, NET_SFTP_LOCAL_FILE);
+ }
+
+ if($soap_client->logout($session_id)) {
+ //echo 'Logged out.
';
+ }
+
+ } catch (SoapFault $e) {
+ //$error .= $client->__getLastResponse();
+ $error .= 'SOAP Error: '.$e->getMessage();
+ }
+ }
+
+ public function client_reject($client_id){
+ global $app, $conf;
+
+ if(!is_file(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php')) return false;
+ include(ISPC_WEB_PATH.'/robot/lib/robot_config.inc.php');
+
+ $context = stream_context_create(array(
+ 'ssl' => array(
+ 'verify_peer' => false,
+ 'verify_peer_name' => false,
+ )
+ ));
+
+ $soap_client = new SoapClient(null, array('location' => $robot_conf['soap']['soap_location'],
+ 'uri' => $robot_conf['soap']['soap_uri'],
+ 'trace' => 1,
+ 'exceptions' => 1,
+ 'stream_context' => $context));
+
+ try {
+ if($session_id = $soap_client->login($robot_conf['soap']['username'] , $robot_conf['soap']['password'])) {
+ //echo 'Logged successfull. Session ID:'.$session_id.'
';
+ }
+ $error = '';
+ $client_record = $soap_client->client_get($session_id, $client_id);
+
+ $client_record['locked'] = 'y';
+ $client_record['canceled'] = 'y';
+ $soap_client->client_update($session_id, $client_id, 0, $client_record);
+
+ $app->db->query("UPDATE client SET validation_status = 'reject', activation_code = '' WHERE client_id = ".$client_id);
+ $app->db->query("DELETE FROM th_order WHERE client_id = ".$client_id);
+
+ $activation_letter_filename = ISPC_ROOT_PATH.'/pdf/activation_letters/c'.$client_id.'-'.$client_record['activation_code'].'.pdf';
+ if(is_file($activation_letter_filename)) unlink($activation_letter_filename);
+
+ $webdetails['contact'] = ($client_record['contact_firstname'] != ''? $client_record['contact_firstname'].' ' : '').$client_record['contact_name'];
+ $webdetails['salutation_de'] = ($client_record['gender'] == 'f'? 'Frau' : 'Herr');
+ $webdetails['salutation_en'] = ($client_record['gender'] == 'f'? 'Mrs.' : 'Mr.');
+ $webdetails['signature_de'] = $robot_conf['textbaustein']['emailfooter'];
+ $webdetails['signature_en'] = $robot_conf['textbaustein_en']['emailfooter'];
+
+ if($error == ''){
+ // send email with login details
+ $invoice_client_settings = $app->db->queryOneRecord("SELECT * FROM invoice_client_settings WHERE client_id = ".intval($client_id));
+ $company = $app->db->queryOneRecord("SELECT * FROM invoice_company WHERE invoice_company_id = ".$invoice_client_settings['invoice_company_id']);
+
+ $subject = '['.$company['company_name_short'].'] Sperrung Ihres Kundenaccounts / Suspension of your customer account';
+
+ $app->uses('tpl');
+ $tpl = new tpl;
+ $tpl->newTemplate(ISPC_WEB_PATH."/client/templates/ispconfig_client_rejection.master");
+ $tpl->setVar($webdetails);
+ $message = $tpl->grab();
+
+ if($robot_conf['production_mode']){
+ $app->functions->mail(trim($client_record['email']), $subject, $message, 'support@timmehosting.de', '', 'application/pdf', '', '', 'f.timme@timmehosting.de,hetzner@timmehosting.de', 'TimmeHosting.de Support');
+
+ $app->db->query("INSERT INTO `th_robot_message` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `client_id`, `subject`, `message`, `message_sent_date`, `message_sent_tstamp`, `email_from`, `email_to`, `email_to_bcc`) VALUES(1, 1, 'riud', 'riud', '', ".intval($client_id).", '".$app->db->quote($subject)."', '".$app->db->quote($message)."', '".date('Y-m-d')."', ".time().", 'support@timmehosting.de', '".trim($client_record['email'])."', 'f.timme@timmehosting.de,hetzner@timmehosting.de')");
+ }
+ }
+
+ if($soap_client->logout($session_id)) {
+ //echo 'Logged out.
';
+ }
+
+ } catch (SoapFault $e) {
+ //$error .= $client->__getLastResponse();
+ $error .= 'SOAP Error: '.$e->getMessage();
+ }
+ }
}
diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php
index d4ed7525495294e0e80ffccb019f8127ed40ac4a..120e6523b4babdd58abdfd01ea13a2e3ea1fbd73 100644
--- a/interface/lib/classes/listform.inc.php
+++ b/interface/lib/classes/listform.inc.php
@@ -257,10 +257,23 @@ class listform {
$searchval = $year.'-'.$month.'-'.$day;
}
}
+
+ if($i['datatype'] == 'BOOLEAN' && $searchval != ''){
+ if (!function_exists('boolval')) {
+ $searchval = (bool) $searchval;
+ if($searchval === true){
+ $searchval = 'TRUE';
+ } else {
+ $searchval = 'FALSE';
+ }
+ } else {
+ $searchval = boolval($searchval)? 'TRUE' : 'FALSE';
+ }
+ }
// if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
if(isset($searchval) && $searchval != ''){
- $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." '".$app->db->quote($i['prefix'].$searchval.$i['suffix'])."' and";
+ $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." ".($i['datatype'] == 'BOOLEAN'? "" : "'").$app->db->quote($i['prefix'].$searchval.$i['suffix']).($i['datatype'] == 'BOOLEAN'? "" : "'")." and";
}
}
}
@@ -384,7 +397,7 @@ class listform {
if(isset($vars['show_page_back']) && $vars['show_page_back'] == 1){
$content .= '
{tmpl_var name='snippet'}