Skip to content

Commit 9ca1e3b

Browse files
author
Till Brehm
committed
Merge branch 'master' of git.ispconfig.org:ispconfig/ispconfig3
2 parents 5fd2b14 + ccfc84e commit 9ca1e3b

26 files changed

+160
-13
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `web_domain` ADD COLUMN `enable_spdy` ENUM('y','n') NULL DEFAULT 'n' AFTER `proxy_directives`;

install/sql/ispconfig3.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,7 @@ CREATE TABLE `web_domain` (
18771877
`traffic_quota_lock` enum('n','y') NOT NULL default 'n',
18781878
`fastcgi_php_version` varchar(255) DEFAULT NULL,
18791879
`proxy_directives` mediumtext,
1880+
`enable_spdy` ENUM('y','n') NULL DEFAULT 'n',
18801881
`last_quota_notification` date NULL default NULL,
18811882
`rewrite_rules` mediumtext,
18821883
`added_date` date NOT NULL DEFAULT '0000-00-00',

install/tpl/server.ini.master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ php_ini_path_apache=/etc/php5/apache2/php.ini
8585
php_ini_path_cgi=/etc/php5/cgi/php.ini
8686
check_apache_config=y
8787
enable_sni=y
88+
enable_spdy=n
8889
enable_ip_wildcard=y
8990
overtraffic_notify_admin=y
9091
overtraffic_notify_client=y

interface/lib/classes/db_mysql.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function __construct($prefix = '') {
8686
$this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!');
8787
return false;
8888
}
89-
if(!((bool)mysqli_query( $this->_iConnId, "USE $this->dbName"))) {
89+
if(!((bool)mysqli_query( $this->_iConnId, 'USE `' . $this->dbName . '`'))) {
9090
$this->close();
9191
$this->_sqlerror('Datenbank nicht gefunden / Database not found');
9292
return false;

interface/lib/classes/validate_client.inc.php

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,85 @@ function check_used_servers($field_name, $field_value, $validator)
136136
}
137137
}
138138

139+
function check_vat_id ($field_name, $field_value, $validator){
140+
global $app, $page;
141+
142+
$vatid = trim($field_value);
143+
if(isset($app->remoting_lib->primary_id)) {
144+
$country = $app->remoting_lib->dataRecord['country'];
145+
} else {
146+
$country = $page->dataRecord['country'];
147+
}
148+
149+
// check if country is member of EU
150+
$country_details = $app->db->queryOneRecord("SELECT * FROM country WHERE iso = '".$country."'");
151+
if($country_details['eu'] == 'y' && $vatid != ''){
152+
153+
$vatid = preg_replace('/\s+/', '', $vatid);
154+
$vatid = str_replace(array('.', '-', ','), '', $vatid);
155+
$cc = substr($vatid, 0, 2);
156+
$vn = substr($vatid, 2);
157+
158+
// Test if the country of the VAT-ID matches the country of the customer
159+
if($country != ''){
160+
if(strtoupper($cc) != $country){
161+
$errmsg = $validator['errmsg'];
162+
if(isset($app->tform->wordbook[$errmsg])) {
163+
return $app->tform->wordbook[$errmsg]."<br>\r\n";
164+
} else {
165+
return $errmsg."<br>\r\n";
166+
}
167+
}
168+
}
139169

170+
$client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
171+
172+
if($client){
173+
$params = array('countryCode' => $cc, 'vatNumber' => $vn);
174+
try{
175+
$r = $client->checkVat($params);
176+
if($r->valid == true){
177+
} else {
178+
$errmsg = $validator['errmsg'];
179+
if(isset($app->tform->wordbook[$errmsg])) {
180+
return $app->tform->wordbook[$errmsg]."<br>\r\n";
181+
} else {
182+
return $errmsg."<br>\r\n";
183+
}
184+
}
185+
186+
// This foreach shows every single line of the returned information
187+
/*
188+
foreach($r as $k=>$prop){
189+
echo $k . ': ' . $prop;
190+
}
191+
*/
192+
193+
} catch(SoapFault $e) {
194+
//echo 'Error, see message: '.$e->faultstring;
195+
switch ($e->faultstring) {
196+
case 'INVALID_INPUT':
197+
$errmsg = $validator['errmsg'];
198+
if(isset($app->tform->wordbook[$errmsg])) {
199+
return $app->tform->wordbook[$errmsg]."<br>\r\n";
200+
} else {
201+
return $errmsg."<br>\r\n";
202+
}
203+
break;
204+
// the following cases shouldn't be the user's fault, so we return no error
205+
case 'SERVICE_UNAVAILABLE':
206+
case 'MS_UNAVAILABLE':
207+
case 'TIMEOUT':
208+
case 'SERVER_BUSY':
209+
break;
210+
}
211+
}
212+
} else {
213+
// Connection to host not possible, europe.eu down?
214+
// this shouldn't be the user's fault, so we return no error
215+
}
216+
}
217+
}
140218

141219

142220
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,15 @@
10211021
'width' => '40',
10221022
'maxlength' => '255'
10231023
),
1024+
'enable_spdy' => array (
1025+
'datatype' => 'VARCHAR',
1026+
'formtype' => 'CHECKBOX',
1027+
'default' => 'n',
1028+
'value' => array (
1029+
0 => 'n',
1030+
1 => 'y'
1031+
)
1032+
),
10241033
'apps_vhost_port' => array(
10251034
'datatype' => 'VARCHAR',
10261035
'formtype' => 'TEXT',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,5 @@ $wb['php_ini_check_minutes_txt'] = 'Prüfe php.ini alle X Minuten auf Änderunge
262262
$wb['php_ini_check_minutes_error_empty'] = 'Bitte geben Sie einen Wert an, wie oft die php.ini auf Änderungen geprüft werden soll.';
263263
$wb['php_ini_check_minutes_info_txt'] = '0 = keine Prüfung';
264264
$wb['php_handler_txt'] = 'Standard-PHP-Handler';
265+
$wb['enable_spdy_txt'] = 'Stellt SPDY zur Verfügung';
265266
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ $wb['network_filesystem_txt'] = 'Network Filesystem';
263263
$wb['php_ini_check_minutes_txt'] = 'Check php.ini every X minutes for changes';
264264
$wb['php_ini_check_minutes_error_empty'] = 'Please specify a value how often php.ini should be checked for changes.';
265265
$wb['php_ini_check_minutes_info_txt'] = '0 = no check';
266+
$wb['enable_spdy_txt'] = 'Makes SPDY available';
266267
?>

interface/web/admin/templates/server_config_web_edit.htm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ <h2><tmpl_var name="list_head_txt"></h2>
161161
{tmpl_var name='enable_sni'}
162162
</div>
163163
</div>
164+
<div class="ctrlHolder">
165+
<p class="label">
166+
<tmpl_var name="enable_spdy_txt">
167+
</p>
168+
<div class="multiField">
169+
<tmpl_var name="enable_spdy">
170+
</div>
171+
</div>
164172
<div class="ctrlHolder">
165173
<label for="CA_path">{tmpl_var name='CA_path_txt'}</label>
166174
<input name="CA_path" id="CA_path" value="{tmpl_var name='CA_path'}" size="40" maxlength="255" type="text" autocomplete="off" class="textInput" />

interface/web/client/form/client.tform.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,12 @@
367367
'width' => '30',
368368
'maxlength' => '255',
369369
'rows' => '',
370-
'cols' => ''
370+
'cols' => '',
371+
'validators' => array ( 0 => array ( 'type' => 'CUSTOM',
372+
'class' => 'validate_client',
373+
'function' => 'check_vat_id',
374+
'errmsg'=> 'invalid_vat_id'),
375+
),
371376
),
372377
'company_id' => array (
373378
'datatype' => 'VARCHAR',

0 commit comments

Comments
 (0)