Skip to content

Commit 20f4776

Browse files
committed
Fixes most string issues
Gettext unable work with to _('Error %s field empty', $string); Things to do: - Check emails / remove \n in translations files - Update translations files - Updated scanner...
1 parent a2873db commit 20f4776

Some content is hidden

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

53 files changed

+141
-176
lines changed

web/add/cron/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
$error_msg = $error_msg.", ".$error;
3131
}
3232
}
33-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
33+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
3434
}
3535

3636
// Protect input

web/add/db/index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
$error_msg = $error_msg.", ".$error;
3131
}
3232
}
33-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
33+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
3434
}
3535

3636
// Validate email
@@ -89,15 +89,15 @@
8989
$to = $v_db_email;
9090
$subject = _("Database Credentials");
9191
$hostname = exec('hostname');
92-
$from = _('MAIL_FROM',$hostname);
93-
$mailtext = _('DATABASE_READY',$user."_".$_POST['v_database'],$user."_".$_POST['v_dbuser'],$_POST['v_password'],$db_admin_link);
92+
$from = sprintf(_('MAIL_FROM'),$hostname);
93+
$mailtext = sprintf(_('DATABASE_READY'),$user."_".$_POST['v_database'],$user."_".$_POST['v_dbuser'],$_POST['v_password'],$db_admin_link);
9494
send_email($to, $subject, $mailtext, $from);
9595
}
9696

9797
// Flush field values on success
9898
if (empty($_SESSION['error_msg'])) {
99-
$_SESSION['ok_msg'] = _('DATABASE_CREATED_OK',htmlentities($user)."_".htmlentities($_POST['v_database']),htmlentities($user)."_".htmlentities($_POST['v_database']));
100-
$_SESSION['ok_msg'] .= " / <a href=".$db_admin_link." target='_blank'>" . _('open %s',$db_admin) . "</a>";
99+
$_SESSION['ok_msg'] = sprintf(_('DATABASE_CREATED_OK'),htmlentities($user)."_".htmlentities($_POST['v_database']),htmlentities($user)."_".htmlentities($_POST['v_database']));
100+
$_SESSION['ok_msg'] .= " / <a href=".$db_admin_link." target='_blank'>" . sprintf(_('open %s'),$db_admin) . "</a>";
101101
unset($v_database);
102102
unset($v_dbuser);
103103
unset($v_password);

web/add/dns/index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
$error_msg = $error_msg.", ".$error;
3232
}
3333
}
34-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
34+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
3535
}
3636

3737
// Protect input
@@ -85,7 +85,7 @@
8585

8686
// Flush field values on success
8787
if (empty($_SESSION['error_msg'])) {
88-
$_SESSION['ok_msg'] = _('DNS_DOMAIN_CREATED_OK',htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
88+
$_SESSION['ok_msg'] = sprintf(_('DNS_DOMAIN_CREATED_OK'),htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
8989
unset($v_domain);
9090
}
9191
}
@@ -113,7 +113,7 @@
113113
$error_msg = $error_msg.", ".$error;
114114
}
115115
}
116-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
116+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
117117
}
118118

119119
// Protect input
@@ -134,7 +134,7 @@
134134

135135
// Flush field values on success
136136
if (empty($_SESSION['error_msg'])) {
137-
$_SESSION['ok_msg'] = _('DNS_RECORD_CREATED_OK',htmlentities($_POST['v_rec']),htmlentities($_POST['v_domain']));
137+
$_SESSION['ok_msg'] = sprintf(_('DNS_RECORD_CREATED_OK'),htmlentities($_POST['v_rec']),htmlentities($_POST['v_domain']));
138138
unset($v_domain);
139139
unset($v_rec);
140140
unset($v_val);

web/add/firewall/banlist/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
$error_msg = $error_msg.", ".$error;
3333
}
3434
}
35-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
35+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
3636
}
3737

3838
// Protect input

web/add/firewall/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
$error_msg = $error_msg.", ".$error;
5252
}
5353
}
54-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
54+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
5555
}
5656

5757
// Protect input

web/add/firewall/ipset/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
$error_msg = $error_msg.", ".$error;
3636
}
3737
}
38-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
38+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
3939
}
4040

4141
$v_ipname = $_POST['v_ipname'];

web/add/ip/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
$error_msg = $error_msg.", ".$error;
3535
}
3636
}
37-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
37+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
3838
}
3939

4040
// Protect input
@@ -66,7 +66,7 @@
6666

6767
// Flush field values on success
6868
if (empty($_SESSION['error_msg'])) {
69-
$_SESSION['ok_msg'] = _('IP_CREATED_OK',htmlentities($_POST['v_ip']),htmlentities($_POST['v_ip']));
69+
$_SESSION['ok_msg'] = sprintf(_('IP_CREATED_OK'),htmlentities($_POST['v_ip']),htmlentities($_POST['v_ip']));
7070
unset($v_ip);
7171
unset($v_netmask);
7272
unset($v_name);

web/add/mail/index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
$error_msg = $error_msg.", ".$error;
4545
}
4646
}
47-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
47+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
4848
}
4949

5050
// Check antispam option
@@ -82,7 +82,7 @@
8282

8383
// Flush field values on success
8484
if (empty($_SESSION['error_msg'])) {
85-
$_SESSION['ok_msg'] = _('MAIL_DOMAIN_CREATED_OK',htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
85+
$_SESSION['ok_msg'] = sprintf(_('MAIL_DOMAIN_CREATED_OK'),htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
8686
unset($v_domain);
8787
}
8888
}
@@ -111,7 +111,7 @@
111111
$error_msg = $error_msg.", ".$error;
112112
}
113113
}
114-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
114+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
115115
}
116116

117117
// Validate email
@@ -204,14 +204,14 @@
204204
$to = $v_send_email;
205205
$subject = _("Email Credentials");
206206
$hostname = exec('hostname');
207-
$from = _('MAIL_FROM', $hostname);
207+
$from = sprintf(_('MAIL_FROM'), $hostname);
208208
$mailtext = $v_credentials;
209209
send_email($to, $subject, $mailtext, $from);
210210
}
211211

212212
// Flush field values on success
213213
if (empty($_SESSION['error_msg'])) {
214-
$_SESSION['ok_msg'] = _('MAIL_ACCOUNT_CREATED_OK',htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]));
214+
$_SESSION['ok_msg'] = sprintf(_('MAIL_ACCOUNT_CREATED_OK'),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]));
215215
unset($v_account);
216216
unset($v_password);
217217
unset($v_password);

web/add/package/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
$error_msg = $error_msg.", ".$error;
5858
}
5959
}
60-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
60+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
6161
}
6262

6363
// Protect input
@@ -149,7 +149,7 @@
149149

150150
// Flush field values on success
151151
if (empty($_SESSION['error_msg'])) {
152-
$_SESSION['ok_msg'] = _('PACKAGE_CREATED_OK',htmlentities($_POST['v_package']),htmlentities($_POST['v_package']));
152+
$_SESSION['ok_msg'] = sprintf(_('PACKAGE_CREATED_OK'),htmlentities($_POST['v_package']),htmlentities($_POST['v_package']));
153153
unset($v_package);
154154
}
155155

web/add/user/index.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
if (empty($_POST['v_package'])) $errrors[] = _('package');
2828
if (empty($_POST['v_email'])) $errors[] = _('email');
2929
if (empty($_POST['v_name'])) $errors[] = _('name');
30-
if (!empty($errors[0])) {
30+
if (!empty($errors)) {
3131
foreach ($errors as $i => $error) {
3232
if ( $i == 0 ) {
3333
$error_msg = $error;
3434
} else {
3535
$error_msg = $error_msg.", ".$error;
3636
}
3737
}
38-
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
38+
$_SESSION['error_msg'] = sprintf(_('Field "%s" can not be blank.'),$error_msg);
3939
}
4040

4141
// Validate email
@@ -91,20 +91,20 @@
9191
$subject = _("Welcome to Hestia Control Panel"); //currently not supported to use the account language
9292
$hostname = exec('hostname');
9393
unset($output);
94-
$from = _('MAIL_FROM',$hostname); //currently not supported to use the account language
94+
$from = sprintf(_('MAIL_FROM'),$hostname); //currently not supported to use the account language
9595

9696
if (!empty($_POST['v_name'])) {
97-
$mailtext = _('GREETINGS_GORDON',$_POST['v_name']);
97+
$mailtext = sprintf(_('GREETINGS_GORDON'),$_POST['v_name'])."\r\n";
9898
} else {
99-
$mailtext = _('GREETINGS');
99+
$mailtext = _('GREETINGS')."\r\n";
100100
}
101-
$mailtext .= _($_POST['v_language'],'ACCOUNT_READY',$_SERVER['HTTP_HOST'],$_POST['v_username'],$_POST['v_password']);
101+
$mailtext .= sprintf(_('ACCOUNT_READY'),$_SERVER['HTTP_HOST'],$_POST['v_username'],$_POST['v_password']);
102102
send_email($to, $subject, $mailtext, $from);
103103
}
104104

105105
// Flush field values on success
106106
if (empty($_SESSION['error_msg'])) {
107-
$_SESSION['ok_msg'] = _('USER_CREATED_OK',htmlentities($_POST['v_username']),htmlentities($_POST['v_username']));
107+
$_SESSION['ok_msg'] = sprintf(_('USER_CREATED_OK'),htmlentities($_POST['v_username']),htmlentities($_POST['v_username']));
108108
$_SESSION['ok_msg'] .= " / <a href=/login/?loginas=".htmlentities($_POST['v_username']).">" . _('login as') ." ".htmlentities($_POST['v_username']). "</a>";
109109
unset($v_username);
110110
unset($v_password);

0 commit comments

Comments
 (0)