Skip to content

Commit 0e40dcb

Browse files
authored
Merge pull request hestiacp#1183 from hestiacp/staging/fixes
Staging/fixes
2 parents 789a2b0 + 1f8f533 commit 0e40dcb

File tree

11 files changed

+40
-36
lines changed

11 files changed

+40
-36
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Ways to contribute
1111
- **New features**:
1212
- Is there an awesome feature that you'd love to see included? While our development team tries to fulfill all reasonable requests, it can take time to implement new features depending on the amount of work involved. Submit a pull request with your code and if your idea is approved, we'll review and test it for inclusion with an upcoming release.
1313
- **Translations**:
14-
- If you are a non-English speaker and would like to improve the quality of the translations used in Hestia Control Panel's web interface, please review the `.php` files found under `hestiacp/web/inc/i18n` and submit a pull request or open an issue report [GitHub](https://www.github.com/hestiacp/hestiacp/issues) highlighting the issue with the current translation so that it can be corrected.
14+
- If you are a non-English speaker and would like to improve the quality of the translations used in Hestia Control Panel's web interface, Please go to [Hestia Translate](https://translate.hestiacp.com/projects/hestiacp/) to review the translations. For more information please read [How to contribute with Translations](https://forum.hestiacp.com/t/how-to-contribute-with-translations/1664). Or open an issue report [GitHub](https://www.github.com/hestiacp/hestiacp/issues) highlighting the issue with the current translation so that it can be corrected.
1515
- **Donations**:
16-
- If you're not a developer but you still want to make a contribution, you can make a donation to the Hestia Control Panel project to further its development (or if you'd just like to buy our developers a lunch, we'd appreciate that too). We currently accept dontations through [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ST87LQH2CHGLA).
16+
- If you're not a developer but you still want to make a contribution, you can make a donation to the Hestia Control Panel project to further its development (or if you'd just like to buy our developers a lunch, we'd appreciate that too). We currently accept donations through [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ST87LQH2CHGLA).
1717

1818
Development Guidelines
1919
-----------------------

bin/v-add-sys-ip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ if [ -z "$sys_ip_check" ]; then
7878
sys_ip="$sys_ip\n version: 2"
7979
sys_ip="$sys_ip\n renderer: networkd"
8080
sys_ip="$sys_ip\n ethernets:"
81-
sys_ip="$sys_ip\n eth0:"
81+
sys_ip="$sys_ip\n $iface:"
8282
sys_ip="$sys_ip\n addresses:"
8383
sys_ip="$sys_ip\n - $ip/$cidr"
8484
fi

bin/v-change-database-owner

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ if [ -z "$db_data" ]; then
5252
exit $E_NOTEXIST
5353
fi
5454

55+
parse_object_kv_list "$db_data"
5556
#Fix issue #1084 with "Upper case not allowed with PGSQL"
5657
if [ "$TYPE" == "pgsql" ]; then
5758
usersmall=$(echo "$user" | tr '[:upper:]' '[:lower:]');
@@ -83,7 +84,6 @@ tmpdir=$(mktemp -p $BACKUP -d "tmp.$database.XXXXXXXXXX" > /dev/null 2>&1)
8384
$BIN/v-suspend-database $owner $database > /dev/null 2>&1
8485

8586
# Dump database
86-
parse_object_kv_list "$db_data"
8787
dump="$tmpdir/$database.$TYPE.sql"
8888
grants="$tmpdir/$database.$TYPE.$DBUSER"
8989
case $TYPE in

bin/v-change-database-user

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ database=$2
1515
dbuser="$user"_"$3"
1616
password=$4; HIDE=4
1717

18-
if [ "$type" = "pgsql" ]; then
19-
dbuser=$(echo "$user"_"$3" | tr '[:upper:]' '[:lower:]');
20-
fi
21-
2218
# Includes
2319
source $HESTIA/func/main.sh
2420
source $HESTIA/func/db.sh
@@ -60,7 +56,12 @@ update_object_value 'db' 'DB' "$database" '$DBUSER' "$dbuser"
6056
# Get database values
6157
get_database_values
6258

63-
# Rebuild datbase
59+
#Fix issue #1084 with "Upper case not allowed with PGSQL"
60+
if [ "$TYPE" = "pgsql" ]; then
61+
dbuser=$(echo $dbuser | tr '[:upper:]' '[:lower:]');
62+
fi
63+
64+
# Rebuild database
6465
case $TYPE in
6566
mysql) rebuild_mysql_database ;;
6667
pgsql) rebuild_pgsql_database ;;

bin/v-update-letsencrypt-ssl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ for user in $($HESTIA/bin/v-list-sys-users plain); do
8181

8282
msg=$($BIN/v-add-letsencrypt-domain $user $domain $aliases)
8383
if [ $? -ne 0 ]; then
84+
echo $msg
8485
log_event $E_INVALID "$domain $msg"
8586
if [ -z "$fail_counter" ]; then
8687
add_object_key "web" 'DOMAIN' "$domain" 'LETSENCRYPT_FAIL_COUNT' 'LETSENCRYPT'
@@ -116,6 +117,7 @@ for user in $($HESTIA/bin/v-list-sys-users plain); do
116117
((lecounter++))
117118
msg=$($BIN/v-add-letsencrypt-domain $user $domain ' ' yes)
118119
if [ $? -ne 0 ]; then
120+
echo $msg
119121
log_event $E_INVALID "$domain $msg"
120122
if [ -z "$fail_counter" ]; then
121123
add_object_key "mail" 'DOMAIN' "$domain" 'LETSENCRYPT_FAIL_COUNT' 'LETSENCRYPT'

bin/v-update-sys-rrd-net

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ifaces=$(echo "$ndev" |grep : |cut -f 1 -d : | sed "s/ //g")
4141

4242
# Parsing excludes
4343
if [ -z "$RRD_IFACE_EXCLUDE" ]; then
44-
RRD_IFACE_EXCLUDE='lo'
44+
RRD_IFACE_EXCLUDE='lo,docker0,br-.*,veth.*'
4545
fi
4646
for exclude in $(echo ${RRD_IFACE_EXCLUDE//,/ }); do
4747
ifaces=$(echo "$ifaces" |grep -vw "$exclude" )

func/main.sh

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -724,14 +724,9 @@ is_common_format_valid() {
724724

725725
# Database format validator
726726
is_database_format_valid() {
727-
if [ "$3" == "pgsql" ]; then
728-
if ! [[ "$1" =~ ^[0-9a-z_]{1,63}$ ]]; then
729-
check_result $E_INVALID "invalid $2 format :: $1"
730-
fi
731-
else
732-
if ! [[ "$1" =~ ^[0-9a-zA-Z_]{1,64}$ ]]; then
733-
check_result $E_INVALID "invalid $2 format :: $1"
734-
fi
727+
exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|/|\|\"|'|;|%|\`| ]"
728+
if [[ "$1" =~ $exclude ]] || [ 64 -le ${#1} ]; then
729+
check_result $E_INVALID "invalid $2 format :: $1"
735730
fi
736731
}
737732

@@ -744,17 +739,12 @@ is_date_format_valid() {
744739

745740
# Database user validator
746741
is_dbuser_format_valid() {
747-
if [ "$3" == "pgsql" ]; then
748-
if ! [[ "$1" =~ ^[0-9a-z_]{1,63}$ ]]; then
749-
check_result $E_INVALID "invalid $2 format :: $1"
750-
fi
751-
else
752-
if [ 33 -le ${#1} ]; then
753-
check_result $E_INVALID "mysql username can be up to 32 characters long"
754-
fi
755-
if ! [[ "$1" =~ ^[0-9a-zA-Z_]{1,64}$ ]]; then
756-
check_result $E_INVALID "invalid $2 format :: $1"
757-
fi
742+
exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|/|\|\"|'|;|%|\`| ]"
743+
if [ 33 -le ${#1} ]; then
744+
check_result $E_INVALID "mysql username can be up to 32 characters long"
745+
fi
746+
if [[ "$1" =~ $exclude ]]; then
747+
check_result $E_INVALID "invalid $2 format :: $1"
758748
fi
759749
}
760750

@@ -948,10 +938,10 @@ is_format_valid() {
948938
charset) is_object_format_valid "$arg" "$arg_name" ;;
949939
charsets) is_common_format_valid "$arg" 'charsets' ;;
950940
comment) is_object_format_valid "$arg" 'comment' ;;
951-
database) is_database_format_valid "$arg" 'database' $type;;
941+
database) is_database_format_valid "$arg" 'database';;
952942
day) is_cron_format_valid "$arg" $arg_name ;;
953943
dbpass) is_password_format_valid "$arg" ;;
954-
dbuser) is_dbuser_format_valid "$arg" 'dbuser' $type;;
944+
dbuser) is_dbuser_format_valid "$arg" 'dbuser';;
955945
dkim) is_boolean_format_valid "$arg" 'dkim' ;;
956946
dkim_size) is_int_format_valid "$arg" ;;
957947
domain) is_domain_format_valid "$arg" ;;

install/deb/exim/exim4.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ acl_check_data:
207207

208208
acl_check_mime:
209209
deny message = Blacklisted file extension detected
210-
condition = ${if match {${lc:$mime_filename}}{\N(\.ade|\.adp|\.bat|\.chm|\.cmd|\.com|\.cpl|\.exe|\.hta|\.ins|\.isp|\.jse|\.lib|\.lnk|\.mde|\.msc|\.msp|\.mst|\.pif|\.scr|\.sct|\.shb|\.sys|\.vb|\.vbe|\.vbs|\.vxd|\.wsc|\.wsf|\.wsh)$\N}{1}{0}}
210+
condition = ${if match {${lc:$mime_filename}}{\N(\.ace|\.ade|\.adp|\.app|\.arj|\.asp|\.aspx|\.asx|\.bas|\.bat|\.cab|\.cer|\.chm|\.cmd|\.cnt|\.com|\.cpl|\.crt|\.csh|\.der|\.diagcab|\.dll|\.efi|\.exe|\.fla|\.fon|\.fxp|\.gadget|\.grp|\.hlp|\.hpj|\.hta|\.htc|\.img|\.inf|\.ins|\.iso|\.isp|\.its|\.jar|\.jnlp|\.js|\.jse|\.ksh|\.lib|\.lnk|\.mad|\.maf|\.mag|\.mam|\.maq|\.mar|\.mas|\.mat|\.mau|\.mav|\.maw|\.mcf|\.mda|\.mdb|\.mde|\.mdt|\.mdw|\.mdz|\.msc|\.msh|\.msh1|\.msh1xml|\.msh2|\.msh2xml|\.mshxml|\.msi|\.msp|\.mst|\.msu|\.ops|\.osd|\.pcd|\.pif|\.pl|\.plg|\.prf|\.prg|\.printerexport|\.ps1|\.ps1xml|\.ps2|\.ps2xml|\.psc1|\.psc2|\.psd1|\.psdm1|\.pst|\.py|\.pyc|\.pyo|\.pyw|\.pyz|\.pyzw|\.reg|\.scf|\.scr|\.sct|\.sfx|\.shb|\.shs|\.swf|\.sys|\.theme|\.tmp|\.ttf|\.url|\.vb|\.vba|\.vbe|\.vbp|\.vbs|\.vhd|\.vhdx|\.vsmacros|\.vsw|\.vxd|\.webpnp|\.website|\.wim|\.ws|\.wsc|\.wsf|\.wsh|\.xbap|\.xll|\.xnk)$\N}{1}{0}}
211211

212212
accept
213213

install/upgrade/versions/1.3.0.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ if [ -e $HESTIA/web/inc/i18n/en.php ]; then
4848
echo "[!] Clean up old language files"
4949
rm -fr $HESTIA/web/inc/i18n
5050
fi
51+
52+
if [ -e "/etc/exim4/exim4.conf.template" ]; then
53+
echo "[ * ] Updating exim4 configuration..."
54+
sed -i 's/${if match {${lc:$mime_filename}}{\\N(\\.ade|\\.adp|\\.bat|\\.chm|\\.cmd|\\.com|\\.cpl|\\.exe|\\.hta|\\.ins|\\.isp|\\.jse|\\.lib|\\.lnk|\\.mde|\\.msc|\\.msp|\\.mst|\\.pif|\\.scr|\\.sct|\\.shb|\\.sys|\\.vb|\\.vbe|\\.vbs|\\.vxd|\\.wsc|\\.wsf|\\.wsh)$\\N}{1}{0}}/${if match {${lc:$mime_filename}}{\\N(\\.ace|\\.ade|\\.adp|\\.app|\\.arj|\\.asp|\\.aspx|\\.asx|\\.bas|\\.bat|\\.cab|\\.cer|\\.chm|\\.cmd|\\.cnt|\\.com|\\.cpl|\\.crt|\\.csh|\\.der|\\.diagcab|\\.dll|\\.efi|\\.exe|\\.fla|\\.fon|\\.fxp|\\.gadget|\\.grp|\\.hlp|\\.hpj|\\.hta|\\.htc|\\.img|\\.inf|\\.ins|\\.iso|\\.isp|\\.its|\\.jar|\\.jnlp|\\.js|\\.jse|\\.ksh|\\.lib|\\.lnk|\\.mad|\\.maf|\\.mag|\\.mam|\\.maq|\\.mar|\\.mas|\\.mat|\\.mau|\\.mav|\\.maw|\\.mcf|\\.mda|\\.mdb|\\.mde|\\.mdt|\\.mdw|\\.mdz|\\.msc|\\.msh|\\.msh1|\\.msh1xml|\\.msh2|\\.msh2xml|\\.mshxml|\\.msi|\\.msp|\\.mst|\\.msu|\\.ops|\\.osd|\\.pcd|\\.pif|\\.pl|\\.plg|\\.prf|\\.prg|\\.printerexport|\\.ps1|\\.ps1xml|\\.ps2|\\.ps2xml|\\.psc1|\\.psc2|\\.psd1|\\.psdm1|\\.pst|\\.py|\\.pyc|\\.pyo|\\.pyw|\\.pyz|\\.pyzw|\\.reg|\\.scf|\\.scr|\\.sct|\\.sfx|\\.shb|\\.shs|\\.swf|\\.sys|\\.theme|\\.tmp|\\.ttf|\\.url|\\.vb|\\.vba|\\.vbe|\\.vbp|\\.vbs|\\.vhd|\\.vhdx|\\.vsmacros|\\.vsw|\\.vxd|\\.webpnp|\\.website|\\.wim|\\.ws|\\.wsc|\\.wsf|\\.wsh|\\.xbap|\\.xll|\\.xnk)$\\N}{1}{0}}/g' /etc/exim4/exim4.conf.template
55+
fi

web/inc/i18n.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Functions for internationalization
33
// I18N support information here
44

5-
putenv("LANGUAGE=".$_SESSION['language']);
5+
putenv("LANGUAGE=".detect_user_language());
66
setlocale( LC_ALL, 'C.UTF-8' );
77

88
$domain = 'hestiacp';
@@ -16,8 +16,14 @@
1616
* @param string Fallback language (default: 'en')
1717
* @return string Language code (such as 'en' and 'ja')
1818
*/
19-
function detect_user_language($fallback='en') {
20-
19+
function detect_user_language() {
20+
if (!empty($_SESSION['language'])) {
21+
return $_SESSION['language'];
22+
}elseif (!empty($_SESSION['LANGUAGE'])){
23+
return $_SESSION['LANGUAGE'];
24+
}else{
25+
return 'en';
26+
}
2127
}
2228

2329
/**

0 commit comments

Comments
 (0)