Skip to content

Commit 3bed87b

Browse files
committed
Flatta and Diman fixes
2 parents 121e5a6 + 3d27ad4 commit 3bed87b

Some content is hidden

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

98 files changed

+5159
-2930
lines changed

bin/v-list-database-hosts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ json_list() {
2828
fi
2929
done
3030

31-
echo "{"
31+
echo "["
3232
for type in $(echo $DB_SYSTEM |sed -e 's/,/\n/'); do
3333
if [ -e "$VESTA/conf/$type.conf" ]; then
3434
for str in $(cat $VESTA/conf/$type.conf); do
3535
eval $str
36-
echo -n ' "'$HOST'": {
36+
echo -n ' {
3737
"HOST": "'$HOST'",
3838
"TYPE": "'$type'",
3939
"CHARSETS": "'$CHARSETS'",
@@ -54,7 +54,7 @@ json_list() {
5454
done
5555
fi
5656
done
57-
echo '}'
57+
echo ']'
5858
}
5959

6060
# SHELL list function

bin/v-list-mail-domain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ json_list() {
2727
"DKIM": "'$DKIM'",
2828
"CATCHALL": "'$CATCHALL'",
2929
"ACCOUNTS": "'$ACCOUNTS'",
30-
"U_DISKL": "'$U_DISK'",
30+
"U_DISK": "'$U_DISK'",
3131
"SUSPENDED": "'$SUSPENDED'",
3232
"TIME": "'$TIME'",
3333
"DATE": "'$DATE'"

bin/v-list-mail-domains

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ json_list() {
3030
"DKIM": "'$DKIM'",
3131
"CATCHALL": "'$CATCHALL'",
3232
"ACCOUNTS": "'$ACCOUNTS'",
33-
"U_DISKL": "'$U_DISK'",
33+
"U_DISK": "'$U_DISK'",
3434
"SUSPENDED": "'$SUSPENDED'",
3535
"TIME": "'$TIME'",
3636
"DATE": "'$DATE'"

web/add/db/index.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,19 @@
114114
$db_types = split(',', $_SESSION['DB_SYSTEM']);
115115

116116
// List available database servers
117-
$db_hosts = array();
118-
exec (VESTA_CMD."v-list-database-hosts 'json'", $output, $return_var);
119-
$db_hosts_tmp = json_decode(implode('', $output), true);
120-
$db_hosts = array_merge($db_hosts, $db_hosts_tmp);
121-
unset($db_hosts_tmp);
117+
exec (VESTA_CMD."v-list-database-hosts json", $output, $return_var);
118+
$db_hosts_tmp1 = json_decode(implode('', $output), true);
119+
$db_hosts_tmp2 = array_map(function($host){return $host['HOST'];}, $db_hosts_tmp1);
120+
$db_hosts = array_values(array_unique($db_hosts_tmp2));
122121
unset($output);
122+
unset($db_hosts_tmp1);
123+
unset($db_hosts_tmp2);
123124

124125
render_page($user, $TAB, 'add_db');
125126

126127
// Flush session messages
127128
unset($_SESSION['error_msg']);
128129
unset($_SESSION['ok_msg']);
130+
131+
// Footer
132+
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

web/add/web/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
$aliases = implode(",",$aliases_arr);
6060
$aliases = escapeshellarg($aliases);
6161

62-
// Define proxy extentions
62+
// Define proxy extensions
6363
$v_proxy_ext = $_POST['v_proxy_ext'];
6464
$proxy_ext = preg_replace("/\n/", ",", $v_proxy_ext);
6565
$proxy_ext = preg_replace("/\r/", ",", $proxy_ext);

web/edit/server/index.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,15 @@
4646
$v_dns_cluster = 'yes';
4747
}
4848

49-
// List MySQL hosts
50-
exec (VESTA_CMD."v-list-database-hosts mysql json", $output, $return_var);
51-
$v_mysql_hosts = json_decode(implode('', $output), true);
49+
// List Database hosts
50+
exec (VESTA_CMD."v-list-database-hosts json", $output, $return_var);
51+
$db_hosts = json_decode(implode('', $output), true);
5252
unset($output);
53-
foreach ($v_mysql_hosts as $key => $value) {
54-
$v_mysql = 'yes';
55-
}
56-
57-
// List PostgreSQL hosts
58-
exec (VESTA_CMD."v-list-database-hosts pgsql json", $output, $return_var);
59-
$v_pgsql_hosts = json_decode(implode('', $output), true);
60-
unset($output);
61-
foreach ($v_pgsql_hosts as $key => $value) {
62-
$v_pgsql = 'yes';
63-
}
53+
$v_mysql_hosts = array_values(array_filter($db_hosts, function($host){return $host['TYPE'] === 'mysql';}));
54+
$v_mysql = count($v_mysql_hosts) ? 'yes' : 'no';
55+
$v_pgsql_hosts = array_values(array_filter($db_hosts, function($host){return $host['TYPE'] === 'pgsql';}));
56+
$v_pgsql = count($v_pgsql_hosts) ? 'yes' : 'no';
57+
unset($db_hosts);
6458

6559
// List backup settings
6660
$v_backup_dir = "/backup";

web/edit/web/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
$restart_proxy = 'yes';
222222
}
223223

224-
// Change proxy template / Update extention list
224+
// Change proxy template / Update extension list
225225
if ((!empty($_SESSION['PROXY_SYSTEM'])) && (!empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) {
226226
$ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']);
227227
$ext = preg_replace("/,/", " ", $ext);

web/inc/i18n.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,30 @@ function _translate() {
1010
global $LANG;
1111

1212
$args = func_get_args();
13+
1314
$l = $args[0];
15+
if (empty($l)) return 'NO LANGUAGE DEFINED';
1416

15-
if (!$l) return 'NO LANGUAGE DEFINED';
1617
$key = $args[1];
18+
if (empty($key)) return '';
1719

18-
if (!isset($LANG[$l])) {
19-
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$l.'.php');
20+
// No translation needed
21+
if (!preg_match('/[a-z]/i', $key)) {
22+
return $key;
2023
}
2124

22-
if (!isset($LANG[$l][$key])) {
23-
$text=$key;
24-
} else {
25-
$text=$LANG[$l][$key];
25+
// Load language file (if not loaded yet)
26+
if (!isset($LANG[$l])) {
27+
require_once($_SERVER['DOCUMENT_ROOT']."/inc/i18n/$l.php");
2628
}
2729

30+
//if (!isset($LANG[$l][$key])) file_put_contents('/somewhere/something.log', "$key\n", FILE_APPEND);
31+
$text = isset($LANG[$l][$key]) ? $LANG[$l][$key] : $key;
32+
2833
array_shift($args);
29-
if (count($args)>1) {
34+
if (count($args) > 1) {
3035
$args[0] = $text;
31-
return call_user_func_array("sprintf",$args);
36+
return call_user_func_array('sprintf', $args);
3237
} else {
3338
return $text;
3439
}
@@ -42,8 +47,8 @@ function _translate() {
4247
*/
4348
function __() {
4449
$args = func_get_args();
45-
array_unshift($args,$_SESSION['language']);
46-
return call_user_func_array("_translate",$args);
50+
array_unshift($args, $_SESSION['language']);
51+
return call_user_func_array('_translate', $args);
4752
}
4853

4954
/**

0 commit comments

Comments
 (0)