Skip to content

Commit 62e2548

Browse files
author
Marius Cramer
committed
Merge remote-tracking branch 'ispc/master' into new-layout-3.1
Conflicts: interface/web/themes/default/templates/main.tpl.htm
2 parents 77cc4a9 + ccfc84e commit 62e2548

Some content is hidden

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

48 files changed

+412
-44
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE `directive_snippets` ADD `customer_viewable` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `snippet`;
2+
ALTER TABLE `web_domain` ADD `directive_snippets_id` int(11) unsigned NOT NULL default '0';
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ CREATE TABLE IF NOT EXISTS `directive_snippets` (
429429
`name` varchar(255) DEFAULT NULL,
430430
`type` varchar(255) DEFAULT NULL,
431431
`snippet` mediumtext,
432+
`customer_viewable` ENUM('n','y') NOT NULL DEFAULT 'n',
432433
`active` enum('n','y') NOT NULL DEFAULT 'y',
433434
PRIMARY KEY (`directive_snippets_id`)
434435
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
@@ -1876,10 +1877,12 @@ CREATE TABLE `web_domain` (
18761877
`traffic_quota_lock` enum('n','y') NOT NULL default 'n',
18771878
`fastcgi_php_version` varchar(255) DEFAULT NULL,
18781879
`proxy_directives` mediumtext,
1880+
`enable_spdy` ENUM('y','n') NULL DEFAULT 'n',
18791881
`last_quota_notification` date NULL default NULL,
18801882
`rewrite_rules` mediumtext,
18811883
`added_date` date NOT NULL DEFAULT '0000-00-00',
18821884
`added_by` varchar(255) DEFAULT NULL,
1885+
`directive_snippets_id` int(11) unsigned NOT NULL default '0',
18831886
PRIMARY KEY (`domain_id`),
18841887
UNIQUE KEY `serverdomain` ( `server_id` , `ip_address`, `domain` )
18851888
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

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;
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
4+
class plugin_directive_snippets extends plugin_base
5+
{
6+
var $module;
7+
var $form;
8+
var $tab;
9+
var $record_id;
10+
var $formdef;
11+
var $options;
12+
13+
public function onShow()
14+
{
15+
global $app;
16+
17+
$listTpl = new tpl;
18+
$listTpl->newTemplate('templates/web_directive_snippets.htm');
19+
20+
//* Loading language file
21+
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_directive_snippets.lng";
22+
23+
include $lng_file;
24+
$listTpl->setVar($wb);
25+
26+
$message = '';
27+
$error = '';
28+
29+
$server_type = $app->getconf->get_server_config($this->form->dataRecord['server_id'], 'web');
30+
$server_type = $server_type['server_type'];
31+
$records = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND type = ? ORDER BY name ASC", $server_type);
32+
33+
for ($i = 0, $c = count($records); $i < $c; $i++)
34+
{
35+
$records[$i]['is_selected'] = false;
36+
37+
if ($this->form->dataRecord['directive_snippets_id'] === $records[$i]['directive_snippets_id'])
38+
$records[$i]['is_selected'] = true;
39+
}
40+
41+
$listTpl->setLoop('records', $records);
42+
43+
$list_name = 'directive_snippets_list';
44+
$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
45+
$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
46+
$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
47+
$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
48+
$_SESSION["s"]["form"]["return_to"] = $list_name;
49+
50+
return $listTpl->grab();
51+
}
52+
53+
public function onUpdate()
54+
{
55+
global $app, $conf;
56+
57+
if (isset($this->form->dataRecord['directive_snippets_id']) && $this->form->oldDataRecord['directive_snippets_id'] !== $this->form->dataRecord['directive_snippets_id']) {
58+
$app->db->query('UPDATE web_domain SET directive_snippets_id = ? WHERE domain_id = ?', $this->form->dataRecord['directive_snippets_id'], $this->form->id);
59+
}
60+
}
61+
62+
public function onInsert()
63+
{
64+
global $app, $conf;
65+
66+
if (isset($this->form->dataRecord['directive_snippets_id'])) {
67+
$app->db->query('UPDATE web_domain SET directive_snippets_id = ? WHERE domain_id = ?', $this->form->dataRecord['directive_snippets_id'], $this->form->id);
68+
}
69+
}
70+
71+
}
72+
?>

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/lib/lang/en.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $wb['delete_txt'] = "Delete";
2626
$wb['filter_txt'] = "Filter";
2727
$wb['add_new_record_txt'] = "Add new record";
2828
$wb['btn_save_txt'] = "Save";
29-
$wb['btn_cancel_txt'] = "Back";
29+
$wb['btn_cancel_txt'] = "Cancel";
3030
$wb['top_menu_system'] = 'System';
3131
$wb['top_menu_client'] = 'Client';
3232
$wb['top_menu_email'] = 'Email';

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@
9393
'maxlength' => '255',
9494
'searchable' => 2
9595
),
96+
'customer_viewable' => array (
97+
'datatype' => 'VARCHAR',
98+
'formtype' => 'CHECKBOX',
99+
'default' => 'n',
100+
'value' => array(0 => 'n', 1 => 'y')
101+
),
96102
'active' => array (
97103
'datatype' => 'VARCHAR',
98104
'formtype' => 'CHECKBOX',

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@
993993
'datatype' => 'VARCHAR',
994994
'formtype' => 'SELECT',
995995
'default' => 'fast-cgi',
996-
'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
996+
'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM'),
997997
'searchable' => 2
998998
),
999999
'nginx_cgi_socket' => array(
@@ -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',

0 commit comments

Comments
 (0)