Răsfoiți Sursa

Merge pull request #1183 from hestiacp/staging/fixes

Staging/fixes
Raphael Schneeberger 5 ani în urmă
părinte
comite
0e40dcb182

+ 2 - 2
CONTRIBUTING.md

@@ -11,9 +11,9 @@ Ways to contribute
 - **New features**:
     - 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.
 - **Translations**:
-    - 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.
+    - 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.
 - **Donations**:
-    - 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).
+    - 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).
 
 Development Guidelines
 -----------------------

+ 1 - 1
bin/v-add-sys-ip

@@ -78,7 +78,7 @@ if [ -z "$sys_ip_check" ]; then
             sys_ip="$sys_ip\n  version: 2"
             sys_ip="$sys_ip\n  renderer: networkd"
             sys_ip="$sys_ip\n  ethernets:"
-            sys_ip="$sys_ip\n    eth0:"
+            sys_ip="$sys_ip\n    $iface:"
             sys_ip="$sys_ip\n      addresses:"
             sys_ip="$sys_ip\n        - $ip/$cidr"
         fi

+ 1 - 1
bin/v-change-database-owner

@@ -52,6 +52,7 @@ if [ -z "$db_data" ]; then
     exit $E_NOTEXIST
 fi
 
+parse_object_kv_list "$db_data"
 #Fix issue #1084 with "Upper case not allowed with PGSQL"
 if [ "$TYPE" == "pgsql" ]; then
    usersmall=$(echo "$user" | tr '[:upper:]' '[:lower:]');
@@ -83,7 +84,6 @@ tmpdir=$(mktemp -p $BACKUP -d "tmp.$database.XXXXXXXXXX" > /dev/null 2>&1)
 $BIN/v-suspend-database $owner $database > /dev/null 2>&1
 
 # Dump database
-parse_object_kv_list "$db_data"
 dump="$tmpdir/$database.$TYPE.sql"
 grants="$tmpdir/$database.$TYPE.$DBUSER"
 case $TYPE in

+ 6 - 5
bin/v-change-database-user

@@ -15,10 +15,6 @@ database=$2
 dbuser="$user"_"$3"
 password=$4; HIDE=4
 
-if [ "$type" = "pgsql" ]; then
-   dbuser=$(echo "$user"_"$3" | tr '[:upper:]' '[:lower:]'); 
-fi
-
 # Includes
 source $HESTIA/func/main.sh
 source $HESTIA/func/db.sh
@@ -60,7 +56,12 @@ update_object_value 'db' 'DB' "$database" '$DBUSER' "$dbuser"
 # Get database values
 get_database_values
 
-# Rebuild datbase
+#Fix issue #1084 with "Upper case not allowed with PGSQL"
+if [ "$TYPE" = "pgsql" ]; then
+   dbuser=$(echo $dbuser | tr '[:upper:]' '[:lower:]'); 
+fi
+
+# Rebuild database
 case $TYPE in
     mysql) rebuild_mysql_database ;;
     pgsql) rebuild_pgsql_database ;;

+ 2 - 0
bin/v-update-letsencrypt-ssl

@@ -81,6 +81,7 @@ for user in $($HESTIA/bin/v-list-sys-users plain); do
 
             msg=$($BIN/v-add-letsencrypt-domain $user $domain $aliases)
             if [ $? -ne 0 ]; then
+                echo $msg
                 log_event $E_INVALID "$domain $msg"
                 if [ -z "$fail_counter" ]; then
                     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
             ((lecounter++))
             msg=$($BIN/v-add-letsencrypt-domain $user $domain ' ' yes)
             if [ $? -ne 0 ]; then
+                echo $msg
                 log_event $E_INVALID "$domain $msg"
                 if [ -z "$fail_counter" ]; then
                     add_object_key "mail" 'DOMAIN' "$domain" 'LETSENCRYPT_FAIL_COUNT' 'LETSENCRYPT'

+ 1 - 1
bin/v-update-sys-rrd-net

@@ -41,7 +41,7 @@ ifaces=$(echo "$ndev" |grep : |cut -f 1 -d : | sed "s/ //g")
 
 # Parsing excludes
 if [ -z "$RRD_IFACE_EXCLUDE" ]; then
-    RRD_IFACE_EXCLUDE='lo'
+    RRD_IFACE_EXCLUDE='lo,docker0,br-.*,veth.*'
 fi
 for exclude in $(echo ${RRD_IFACE_EXCLUDE//,/ }); do
     ifaces=$(echo "$ifaces" |grep -vw "$exclude" )

+ 11 - 21
func/main.sh

@@ -724,14 +724,9 @@ is_common_format_valid() {
 
 # Database format validator
 is_database_format_valid() {
-    if [ "$3" == "pgsql" ]; then
-        if ! [[ "$1" =~ ^[0-9a-z_]{1,63}$ ]]; then
-            check_result $E_INVALID "invalid $2 format :: $1"
-        fi  
-    else
-        if ! [[ "$1" =~ ^[0-9a-zA-Z_]{1,64}$ ]]; then
-            check_result $E_INVALID "invalid $2 format :: $1"
-        fi  
+    exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|/|\|\"|'|;|%|\`| ]"
+    if [[ "$1" =~ $exclude ]] || [ 64 -le ${#1} ]; then
+        check_result $E_INVALID "invalid $2 format :: $1"
     fi
 }
 
@@ -744,17 +739,12 @@ is_date_format_valid() {
 
 # Database user validator
 is_dbuser_format_valid() {
-    if [ "$3" == "pgsql" ]; then
-        if ! [[ "$1" =~ ^[0-9a-z_]{1,63}$ ]]; then
-            check_result $E_INVALID "invalid $2 format :: $1"
-        fi 
-    else
-        if [ 33 -le ${#1} ]; then
-            check_result $E_INVALID "mysql username can be up to 32 characters long"
-        fi
-        if ! [[ "$1" =~ ^[0-9a-zA-Z_]{1,64}$ ]]; then
-            check_result $E_INVALID "invalid $2 format :: $1"
-        fi           
+    exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|/|\|\"|'|;|%|\`| ]"
+    if [ 33 -le ${#1} ]; then
+        check_result $E_INVALID "mysql username can be up to 32 characters long"
+    fi
+    if [[ "$1" =~ $exclude ]]; then
+        check_result $E_INVALID "invalid $2 format :: $1"
     fi
 }
 
@@ -948,10 +938,10 @@ is_format_valid() {
                 charset)        is_object_format_valid "$arg" "$arg_name" ;;
                 charsets)       is_common_format_valid "$arg" 'charsets' ;;
                 comment)        is_object_format_valid "$arg" 'comment' ;;
-                database)       is_database_format_valid "$arg" 'database' $type;;
+                database)       is_database_format_valid "$arg" 'database';;
                 day)            is_cron_format_valid "$arg" $arg_name ;;
                 dbpass)         is_password_format_valid "$arg" ;;
-                dbuser)         is_dbuser_format_valid "$arg" 'dbuser' $type;;
+                dbuser)         is_dbuser_format_valid "$arg" 'dbuser';;
                 dkim)           is_boolean_format_valid "$arg" 'dkim' ;;
                 dkim_size)      is_int_format_valid "$arg" ;;
                 domain)         is_domain_format_valid "$arg" ;;

+ 1 - 1
install/deb/exim/exim4.conf.template

@@ -207,7 +207,7 @@ acl_check_data:
 
 acl_check_mime:
   deny   message        = Blacklisted file extension detected
-         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}}
+         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}}
 
   accept
 

+ 5 - 0
install/upgrade/versions/1.3.0.sh

@@ -48,3 +48,8 @@ if [ -e $HESTIA/web/inc/i18n/en.php ]; then
     echo "[!] Clean up old language files"
     rm -fr $HESTIA/web/inc/i18n
 fi
+
+if [ -e "/etc/exim4/exim4.conf.template" ]; then
+    echo "[ * ] Updating exim4 configuration..."
+    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
+fi

+ 9 - 3
web/inc/i18n.php

@@ -2,7 +2,7 @@
 // Functions for internationalization
 // I18N support information here
 
-putenv("LANGUAGE=".$_SESSION['language']);
+putenv("LANGUAGE=".detect_user_language());
 setlocale( LC_ALL, 'C.UTF-8' );
 
 $domain = 'hestiacp';
@@ -16,8 +16,14 @@ textdomain($domain);
  * @param string Fallback language (default: 'en')
  * @return string Language code (such as 'en' and 'ja')
  */
-function detect_user_language($fallback='en') {
-    
+function detect_user_language() {
+   if (!empty($_SESSION['language'])) {
+        return $_SESSION['language'];   
+   }elseif (!empty($_SESSION['LANGUAGE'])){
+       return $_SESSION['LANGUAGE'];
+   }else{
+       return 'en';
+   }
 }
 
 /**

+ 1 - 1
web/templates/admin/list_backup_detail.html

@@ -75,7 +75,7 @@
               <div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
                 <div class="actions-panel clearfix">
                   <div class="actions-panel__col actions-panel__list shortcut-enter" key-action="href">
-                    <a href="/schedule/restore/?backup=<?=$backup?>&type=web&object=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?php print __('Restore');?>">
+                    <a href="/schedule/restore/?backup=<?=$backup?>&type=web&object=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?php print _('Restore');?>">
                       <i class="fas fa-undo status-icon green status-icon dim"></i>
                     </a>
                   </div>