From a32762b444efe9991afc25b9d4bdd947b6f63d56 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sat, 4 Jun 2011 09:39:15 +0000 Subject: [PATCH] Merged changesets 2976 and 2979 from branch stable 1.0 to trunk. --- bureau/class/lang_env.php | 10 +++++++++- bureau/class/m_err.php | 1 + bureau/class/m_quota.php | 2 +- bureau/class/variables.php | 2 +- debian/control | 2 +- etc/alternc/postfix.cf | 2 +- install/alternc.install | 11 +++++++++++ 7 files changed, 25 insertions(+), 5 deletions(-) diff --git a/bureau/class/lang_env.php b/bureau/class/lang_env.php index 51e5c95e..17b33412 100644 --- a/bureau/class/lang_env.php +++ b/bureau/class/lang_env.php @@ -9,6 +9,9 @@ function update_locale($langpath) { $locales[$mat[1]]=$mat[1]; } } + if (!count($locales)) { + $locales=array("en_US"=>"en_US"); + } return $locales; } @@ -23,6 +26,11 @@ $langpath = bindtextdomain("alternc", "/var/alternc/bureau/locales"); // Create or update a locale.php file if it is outdated. $locales = update_locale($langpath); +// Default to en_US : +if (!isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { + $_SERVER["HTTP_ACCEPT_LANGUAGE"]="en_US"; +} + if (!(isset($lang))) { // Use the browser first preferred language $lang=strtolower(substr(trim($_SERVER["HTTP_ACCEPT_LANGUAGE"]),0,5)); } @@ -39,7 +47,7 @@ if (! isset($locales[$lang])) { // Requested language not found in locales } } -if (!isset($locales[$lang])) $lang=$locales[0]; +if (!isset($locales[$lang])) list($lang)=each($locales); if (isset($setlang) && isset($lang)) { setcookie("lang",$lang); diff --git a/bureau/class/m_err.php b/bureau/class/m_err.php index 83024ce2..2fe424a4 100644 --- a/bureau/class/m_err.php +++ b/bureau/class/m_err.php @@ -140,6 +140,7 @@ class m_err { global $mem,$cuid; $f=@fopen($this->logfile,"ab"); if ($f) { + if (!isset($_SERVER['REMOTE_ADDR'])) $_SERVER['REMOTE_ADDR']="::1"; fputs($f,date("d/m/Y H:i:s")." - " . $_SERVER['REMOTE_ADDR'] . " - CALL - "); fputs($f,$mem->user["login"]." - "); fputs($f,$clsid." - ".$function." - ".$param."\n"); diff --git a/bureau/class/m_quota.php b/bureau/class/m_quota.php index 195d974a..3c51eef4 100644 --- a/bureau/class/m_quota.php +++ b/bureau/class/m_quota.php @@ -173,7 +173,7 @@ class m_quota { global $err,$db,$cuid; $err->log("quota","setquota",$ressource."/".$size); if (floatval($size)==0) $size="0"; - if ($this->disk[$ressource]) { + if (isset($this->disk[$ressource])) { // It's a disk resource, update it with shell command exec("/usr/lib/alternc/quota_edit $cuid $size"); // Now we check that the value has been written properly : diff --git a/bureau/class/variables.php b/bureau/class/variables.php index b9f3834e..070f0ea1 100644 --- a/bureau/class/variables.php +++ b/bureau/class/variables.php @@ -46,7 +46,7 @@ function variable_init($conf = array()) { while ($db->next_record($result)) { /* maybe the data is *not* serialized, in that case, take it verbatim */ $variable = $db->Record; - if (($variables[$variable['name']] = unserialize($variable['value'])) === FALSE) { + if (($variables[$variable['name']] = @unserialize($variable['value'])) === FALSE) { $variables[$variable['name']] = $variable['value']; } } diff --git a/debian/control b/debian/control index 4247de59..a3534923 100644 --- a/debian/control +++ b/debian/control @@ -29,7 +29,7 @@ Homepage: http://www.alternc.org/ Package: alternc-slave Architecture: all Pre-depends: debconf (>= 0.5.00) | debconf-2.0 -Depends: debianutils (>= 1.13.1), apache2, libapache2-mod-php5, courier-ssl, courier-imap-ssl, courier-pop-ssl, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, squirrelmail, postfix-tls, bind9, wget, rsync, quota, courier-authmysql | courier-authlib-mysql, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), adduser, mysql-client, postgrey, sudo +Depends: debianutils (>= 1.13.1), apache2, libapache2-mod-php5, courier-ssl, courier-imap-ssl, courier-pop-ssl, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, squirrelmail, postfix-tls, bind9, wget, rsync, quota, courier-authmysql | courier-authlib-mysql, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), adduser, mysql-client, sudo Recommends: apache2 Conflicts: alternc-admintools, alternc-awstats (<= 0.3.2), alternc-webalizer (<= 0.9.4), alternc Provides: alternc diff --git a/etc/alternc/postfix.cf b/etc/alternc/postfix.cf index 600685b1..7abe2257 100644 --- a/etc/alternc/postfix.cf +++ b/etc/alternc/postfix.cf @@ -31,4 +31,4 @@ virtual_minimum_uid = 1000 virtual_gid_maps = proxy:mysql:/etc/postfix/mygid.cf virtual_uid_maps = static:33 default_privs = www-data -smtpd_recipient_restrictions = reject_unlisted_recipient, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unauth_destination, check_policy_service inet:127.0.0.1:60000, reject_rbl_client zen.spamhaus.org \ No newline at end of file +smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_hostname, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_rbl_client zen.spamhaus.org, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, reject_unlisted_recipient, reject_unauth_destination diff --git a/install/alternc.install b/install/alternc.install index 443d9f2c..7bee7cc2 100644 --- a/install/alternc.install +++ b/install/alternc.install @@ -258,6 +258,17 @@ if [ -e /etc/postfix/myalias.cf -o -e /etc/postfix/mydomain.cf -o -e /etc/postfi chmod 640 /etc/postfix/my* fi +if [ ! -f /etc/postfix/main.cf ] +then + echo "****************************************" + echo "POSTFIX is NOT configured properly" + echo "please launch dpkg-reconfigure -plow postfix" + echo "and choose 'Internet Site'" + echo "then reinstall alternc" + echo "****************************************" + exit 1 +fi + # configure postfix appropriatly for our needs if [ "$slave" = "1" ]; then postfix_conf=/etc/alternc/postfix-slave.cf