From 804fba671ffb171165d85073f4d35597240ac2fa Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Tue, 16 Oct 2012 21:13:15 +0000 Subject: [PATCH] adding roundcube + fixing squirrelmail, update javascript-common too --- .gitattributes | 5 +- bureau/locales/fr_FR/LC_MESSAGES/messages.po | 73 ++++++++-------- roundcube/Makefile | 30 +++++++ roundcube/class/m_roundcube.php | 68 +++++++++++++++ roundcube/roundcube-install | 87 +++++++++++++++++++ roundcube/templates/apache2/roundcube.conf | 53 +++++++++++ squirrelmail/Makefile | 1 - squirrelmail/class/m_squirrelmail.php | 4 +- squirrelmail/squirrelmail-install | 25 +++--- .../javascript-common/javascript-common.conf | 11 --- 10 files changed, 293 insertions(+), 64 deletions(-) create mode 100644 roundcube/Makefile create mode 100644 roundcube/class/m_roundcube.php create mode 100644 roundcube/roundcube-install create mode 100644 roundcube/templates/apache2/roundcube.conf delete mode 100644 squirrelmail/templates/javascript-common/javascript-common.conf diff --git a/.gitattributes b/.gitattributes index 7c7984fd..1ad31f6e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -544,6 +544,10 @@ po/alternc-admintools.pot -text po/fr/LC_MESSAGES/.svnignore -text po/fr/LC_MESSAGES/alternc-admintools.po -text /repos-to-tx.sh -text +roundcube/Makefile -text +roundcube/class/m_roundcube.php -text +roundcube/roundcube-install -text +roundcube/templates/apache2/roundcube.conf -text selenium/20120826-alternc-panel-testsuite.html -text selenium/README -text selenium/alternc.domain-local-mail-tld.html -text @@ -553,7 +557,6 @@ squirrelmail/alternc_changepass/setup.php -text squirrelmail/class/m_squirrelmail.php -text squirrelmail/squirrelmail-install -text squirrelmail/templates/apache2/squirrelmail.conf -text -squirrelmail/templates/javascript-common/javascript-common.conf -text squirrelmail/templates/squirrelmail/alternc-changepass.conf -text squirrelmail/templates/squirrelmail/apache.conf -text squirrelmail/templates/squirrelmail/avelsieve-config.php -text diff --git a/bureau/locales/fr_FR/LC_MESSAGES/messages.po b/bureau/locales/fr_FR/LC_MESSAGES/messages.po index 4302c877..716c4800 100644 --- a/bureau/locales/fr_FR/LC_MESSAGES/messages.po +++ b/bureau/locales/fr_FR/LC_MESSAGES/messages.po @@ -10,7 +10,7 @@ msgstr "" "$\n" "Report-Msgid-Bugs-To: i18n@alternc.org\n" "POT-Creation-Date: 2012-10-16 16:58+0200\n" -"PO-Revision-Date: 2012-10-16 16:48+0200\n" +"PO-Revision-Date: 2012-10-16 19:47+0200\n" "Last-Translator: Benjamin Sonntag \n" "Language-Team: français \n" "Language: fr\n" @@ -302,41 +302,42 @@ msgstr "Annuler" #: ../admin/adm_authip_whitelist.php:31 ../admin/ip_main.php:50 #: ../admin/menu_ip.php:28 ../admin/menu_ip.php:35 msgid "Access security" -msgstr "" +msgstr "Contrôle d'accès" #: ../admin/adm_authip_whitelist.php:39 msgid "" "The IP and subnet you have here are allowed for ALL users and ALL usages" msgstr "" +"L'IP et le préfixe ci-dessous seront autorisés pour TOUS les utilisateurs et " +"TOUS les usages" #: ../admin/adm_authip_whitelist.php:39 msgid "Warning" -msgstr "" +msgstr "Attention" #: ../admin/adm_authip_whitelist.php:44 ../admin/ip_main.php:165 -#, fuzzy msgid "Add an IP" -msgstr "Créer un nouveau TLD" +msgstr "Ajouter une IP" #: ../admin/adm_authip_whitelist.php:44 ../admin/ip_main.php:165 msgid "Add my current IP" -msgstr "" +msgstr "Ajouter mon IP" #: ../admin/adm_authip_whitelist.php:47 ../admin/ip_main.php:168 -#, fuzzy msgid "Cancel edit" -msgstr "Annuler" +msgstr "Annuler la modification" #: ../admin/adm_authip_whitelist.php:50 ../admin/ip_main.php:171 msgid "" "Enter here the IP address you want.
IPv4, IPv6 and subnet allowed" msgstr "" +"Entrez ici l'adresse IP que vous souhaitez.
IPV4, IPV6 et préfixes " +"sont autorisés " #: ../admin/adm_authip_whitelist.php:54 ../admin/ip_main.php:175 -#, fuzzy msgid "Add a comment" -msgstr "Héberger un domaine" +msgstr "Ajouter un commentaire" #: ../admin/adm_authip_whitelist.php:57 ../admin/adm_doms_def_type.php:88 #: ../admin/bro_editor.php:77 ../admin/bro_editor.php:90 ../admin/cron.php:66 @@ -347,12 +348,11 @@ msgstr "Enregistrer" #: ../admin/adm_authip_whitelist.php:64 ../admin/ip_main.php:136 msgid "IP" -msgstr "" +msgstr "IP" #: ../admin/adm_authip_whitelist.php:64 ../admin/ip_main.php:136 -#, fuzzy msgid "Informations" -msgstr "Accueil / Information" +msgstr "Informations" #: ../admin/adm_authip_whitelist.php:64 ../admin/adm_doms_def_type.php:48 #: ../admin/dom_edit.php:97 ../admin/dom_edit.php:99 ../admin/ip_main.php:136 @@ -438,7 +438,7 @@ msgstr "Changer les quotas par défaut" #: ../admin/adm_defquotas.php:52 msgid "User's quotas synchronised" -msgstr "" +msgstr "Synchroniser les quotas utilisateurs" #: ../admin/adm_defquotas.php:55 ../admin/adm_defquotas.php:63 msgid "Add account type" @@ -461,6 +461,7 @@ msgstr "" #: ../admin/adm_defquotas.php:89 msgid "Synchronise user's quota (only to upper value)" msgstr "" +"Synchroniser les quotas utilisateurs (uniquement pour une valeur plus grande)" #: ../admin/adm_defquotas.php:93 ../admin/adm_defquotas.php:94 #: ../admin/adm_defquotas.php:102 @@ -689,9 +690,8 @@ msgid "Unlock" msgstr "Déverrouiller" #: ../admin/adm_doms_def_type.php:12 ../admin/adm_panel.php:67 -#, fuzzy msgid "Manage defaults domains type" -msgstr "Gestion des types de domaines" +msgstr "Gestion des types de domaines par défaut" #: ../admin/adm_doms_def_type.php:14 ../admin/adm_domstype.php:42 msgid "" @@ -706,58 +706,60 @@ msgid "" "The Type column contains a type of available VirtualHost config on The " "server." msgstr "" +"La colonne Type contient la liste des Hôtes Virtuels disponibles dans la " +"configuration du serveur." #: ../admin/adm_doms_def_type.php:16 msgid "" "The Setting column contains the variables to be expanded in the defaults " "configuration. Available values are: " msgstr "" +"La colonne Paramètre contient la variable qui sera substituée dans la " +"configuration par défaut. Les valeurs possibles sont : " #: ../admin/adm_doms_def_type.php:18 -#, fuzzy, php-format +#, php-format msgid "%%DOMAIN%% : the Domain name" -msgstr "Afficher les domaines" +msgstr "%%DOMAIN%% : Le nom du domaine" #: ../admin/adm_doms_def_type.php:19 #, php-format msgid "%%TARGETDOM%%: The destination domain" -msgstr "" +msgstr "%%TARGETDOM%% : Le domaine de destination" #: ../admin/adm_doms_def_type.php:20 -#, fuzzy, php-format +#, php-format msgid "%%SUB%% : The subdomain name" -msgstr "Afficher les domaines" +msgstr "%%SUB%% : Le nom du sous-domaine" #: ../admin/adm_doms_def_type.php:21 #, php-format msgid "%%DOMAINDIR%%: the domain directory on the file system" -msgstr "" +msgstr "%%DOMAINDIR%% : Le répertoire du domaine dans le système de fichier" #: ../admin/adm_doms_def_type.php:38 ../admin/cron.php:7 ../admin/cron.php:12 msgid "There was an error during the record." -msgstr "" +msgstr "Une erreur est survenue pendant l'enregistrement." #: ../admin/adm_doms_def_type.php:40 ../admin/cron.php:9 ../admin/cron.php:14 msgid "Save done." -msgstr "" +msgstr "Sauvegarde effectuée." #: ../admin/adm_doms_def_type.php:48 -#, fuzzy msgid "Activation" -msgstr "Action" +msgstr "Activation" #: ../admin/adm_doms_def_type.php:48 msgid "Concerned" -msgstr "" +msgstr "Concernant " #: ../admin/adm_doms_def_type.php:48 msgid "Sub" -msgstr "" +msgstr "Sous" #: ../admin/adm_doms_def_type.php:48 -#, fuzzy msgid "settings" -msgstr "Configuration" +msgstr "paramètres" #: ../admin/adm_domstype.php:40 ../admin/adm_panel.php:66 #: ../admin/adm_panel.php:67 ../admin/adm_panel.php:68 @@ -815,11 +817,11 @@ msgstr "Est-ce une fonctionnalité avancée ?" #: ../admin/adm_domstype.php:67 ../admin/adm_domstypeedit.php:123 msgid "Create tmp directory ?" -msgstr "" +msgstr "Créer un répertoire temporaire ?" #: ../admin/adm_domstype.php:68 msgid "create www directory ?" -msgstr "" +msgstr "Créer un répertoire www ?" #: ../admin/adm_domstype.php:76 ../admin/adm_domstype.php:78 msgid "Regenerate" @@ -863,7 +865,7 @@ msgstr "Modifier ce type de domaine" #: ../admin/adm_domstypeedit.php:128 msgid "Create target directory ?" -msgstr "" +msgstr "Créer le répertoire destination ?" #: ../admin/adm_donosu.php:45 msgid "This account is now a normal account" @@ -957,12 +959,11 @@ msgstr "Compte créé par %s" #: ../admin/adm_email.php:43 ../admin/adm_panel.php:56 msgid "Send an email to all members" -msgstr "" +msgstr "Envoyer un mail à tous les membres" #: ../admin/adm_email.php:48 -#, fuzzy msgid "The email was successfully sent" -msgstr "Le compte AlternC a été modifié avec succès" +msgstr "L'Email a été modifié avec succès" #: ../admin/adm_email.php:50 msgid "There was an error" diff --git a/roundcube/Makefile b/roundcube/Makefile new file mode 100644 index 00000000..74c681c8 --- /dev/null +++ b/roundcube/Makefile @@ -0,0 +1,30 @@ +# ---------------------------------------------------------------------- +# AlternC - Web Hosting System +# Copyright (C) 2000-2012 by the AlternC Development Team. +# https://alternc.org/ +# ---------------------------------------------------------------------- +# LICENSE +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# To read the license please visit http://www.gnu.org/copyleft/gpl.html +# ---------------------------------------------------------------------- +# Purpose of file: Install the files of alternc-roundcube packages +# ---------------------------------------------------------------------- + +install: + # alternc-roundcube files install + install -m 644 templates/roundcube/* $(DESTDIR)/etc/alternc/templates/roundcube/ + install -m 750 roundcube-install $(DESTDIR)/usr/lib/alternc/install.d/ + # domaintype template: + install -m 644 templates/apache2/roundcube.conf $(DESTDIR)/etc/alternc/templates/apache2/roundcube.conf + # Desktop files + install -o 1999 -g 1999 -m 644 class/m_roundcube.php $(DESTDIR)/var/alternc/bureau/class/ diff --git a/roundcube/class/m_roundcube.php b/roundcube/class/m_roundcube.php new file mode 100644 index 00000000..1f841be8 --- /dev/null +++ b/roundcube/class/m_roundcube.php @@ -0,0 +1,68 @@ +query("SELECT * FROM sub_domaines s WHERE s.domaine='".addslashes($dompart)."' AND s.type='roundcube';"); + if ($db->next_record()) { + $domain=$db->Record; + return "http://".$domain["sub"].(($domain["sub"])?".":"").$domain["domaine"]; + } + $i++; + } while (strpos($dompart,'.')!==false); + + // not found: search for a webmail in the admin user account + $db->query("SELECT * FROM sub_domaines s WHERE s.compte=2000 AND s.type='roundcube';"); + if ($db->next_record()) { + $domain=$db->Record; + return "http://".$domain["sub"].(($domain["sub"])?".":"").$domain["domaine"]; + } + + } + +} /* Class Roundcube */ + + + + + diff --git a/roundcube/roundcube-install b/roundcube/roundcube-install new file mode 100644 index 00000000..6f5e01f1 --- /dev/null +++ b/roundcube/roundcube-install @@ -0,0 +1,87 @@ +#!/bin/bash + +# ---------------------------------------------------------------------- +# AlternC - Web Hosting System +# Copyright (C) 2000-2012 by the AlternC Development Team. +# https://alternc.org/ +# ---------------------------------------------------------------------- +# LICENSE +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# To read the license please visit http://www.gnu.org/copyleft/gpl.html +# ---------------------------------------------------------------------- +# Purpose of file: Install roundcube conf files. +# ---------------------------------------------------------------------- + +if [ "$1" = "templates" ] +then + echo "Installing Roundcube Templates ..." +# cp -f /etc/alternc/templates/roundcube/avelsieve-config.php /etc/alternc/templates/roundcube/apache.conf /etc/roundcube/ +# cp -f /etc/alternc/templates/javascript-common/javascript-common.conf /etc/javascript-common/ + + LOGIN="2000_roundcube" + PASSWORD="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)'`" + + # Add new variables to the sed script ... + SED_SCRIPT="/tmp/alternc-roundcube.sedscript" + # cf alternc.install for more explanations on this horror : + eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_USER/;s/password/MYSQL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my.cnf` + . /etc/alternc/local.sh + # Configuration template location + TEMPLATE_DIR="/etc/alternc/templates" + + cat > $SED_SCRIPT < /$file + fi + done + rm -f $SED_SCRIPT + + echo " Done" + + . /usr/lib/alternc/functions.sh + + echo "giving write access to roundcube to the email password ..." + # now database host user and password are mysql root account values ;) + mysql_query "GRANT UPDATE (password) ON ${database}.address TO '${LOGIN}'@'${MYSQL_CLIENT}' IDENTIFIED BY '${PASSWORD}';" + mysql_query "GRANT SELECT ON ${database}.address TO '${LOGIN}'@'${MYSQL_CLIENT}';" + mysql_query "GRANT SELECT ON ${database}.domaines TO '${LOGIN}'@'${MYSQL_CLIENT}';" + echo " Done" + + echo "Setting roundcube domaintype" + mysql_query "INSERT IGNORE INTO domaines_type (name ,description ,target ,entry ,compatibility ,enable ,only_dns ,need_dns ,advanced )VALUES ('roundcube','Roundcube Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', 'ALL', '0', '0', '0');" + echo " Done" + + echo "Migrating old webmail domaine type to roundcube one:" + # migration of the "webmail" hosts to "roundcube" hosts: + mysql_query "INSERT IGNORE INTO sub_domaines (compte, domaine, sub, valeur, type, web_action, web_result, enable) SELECT compte, domaine, sub, valeur,'roundcube', 'UPDATE',0, enable FROM sub_domaines WHERE type='webmail' AND web_action='OK';" + mysql_query "UPDATE sub_domaines SET web_action='DELETE' WHERE type='webmail' AND web_action='OK';" + echo " Done" + + echo "Deconfiguring javascript-common alias" + rm -f /etc/apache2/conf.d/javascript-common.conf + # just in case + sed -i -e "s/^Alias \/javascript/# Do not uncomment, commented by AlternC to prevent a global alias\n#Alias \/javascript/" /etc/javascript-common/javascript-common.conf + echo " Done" + +fi + + diff --git a/roundcube/templates/apache2/roundcube.conf b/roundcube/templates/apache2/roundcube.conf new file mode 100644 index 00000000..1920bc65 --- /dev/null +++ b/roundcube/templates/apache2/roundcube.conf @@ -0,0 +1,53 @@ + + ServerName %%fqdn%% + AssignUserId alternc-roundcube nogroup + SetEnv LOGIN "%%UID%%-%%LOGIN%%" + + DocumentRoot /usr/share/roundcube + +# Access to tinymce files + + Options Indexes MultiViews FollowSymLinks + AllowOverride None + Order allow,deny + allow from all + + + + Options +FollowSymLinks + # This is needed to parse /var/lib/roundcube/.htaccess. See its + # content before setting AllowOverride to None. + AllowOverride All + order allow,deny + allow from all + + +# Protecting basic directories: + + Options -FollowSymLinks + AllowOverride None + + + + Options -FollowSymLinks + AllowOverride None + Order allow,deny + Deny from all + + + + Options -FollowSymLinks + AllowOverride None + Order allow,deny + Deny from all + + + Alias /javascript /usr/share/javascript/ + + + Options FollowSymLinks MultiViews + Order allow,deny + Allow from all + + + diff --git a/squirrelmail/Makefile b/squirrelmail/Makefile index 93cc523c..665b87eb 100644 --- a/squirrelmail/Makefile +++ b/squirrelmail/Makefile @@ -23,7 +23,6 @@ install: # alternc-squirrelmail files install install -m 644 templates/squirrelmail/* $(DESTDIR)/etc/alternc/templates/squirrelmail/ - install -m 644 templates/javascript-common/* $(DESTDIR)/etc/alternc/templates/javascript-common/ install -m 750 squirrelmail-install $(DESTDIR)/usr/lib/alternc/install.d/ # domaintype template: install -m 644 templates/apache2/squirrelmail.conf $(DESTDIR)/etc/alternc/templates/apache2/squirrelmail.conf diff --git a/squirrelmail/class/m_squirrelmail.php b/squirrelmail/class/m_squirrelmail.php index f1195d6b..82add3db 100644 --- a/squirrelmail/class/m_squirrelmail.php +++ b/squirrelmail/class/m_squirrelmail.php @@ -37,8 +37,6 @@ class m_squirrelmail { */ function hook_admin_webmail() { global $db; - // not found ? use admin account (2000) - $account=2000; // Search for the domain where the panel is hosted, then search for a webmail in it. $i=2; $domain=""; @@ -53,7 +51,7 @@ class m_squirrelmail { $i++; } while (strpos($dompart,'.')!==false); - // not found: search for a webmail in the admin user account + // not found: search for a webmail in the admin user account $db->query("SELECT * FROM sub_domaines s WHERE s.compte=2000 AND s.type='squirrelmail';"); if ($db->next_record()) { $domain=$db->Record; diff --git a/squirrelmail/squirrelmail-install b/squirrelmail/squirrelmail-install index dcc744a1..dc551cb8 100644 --- a/squirrelmail/squirrelmail-install +++ b/squirrelmail/squirrelmail-install @@ -26,10 +26,6 @@ if [ "$1" = "templates" ] then echo "Installing Squirrelmail Templates ..." cp -f /etc/alternc/templates/squirrelmail/avelsieve-config.php /etc/alternc/templates/squirrelmail/apache.conf /etc/squirrelmail/ - cp -f /etc/alternc/templates/javascript-common/javascript-common.conf /etc/javascript-common/ - if [ -e /etc/alternc/templates/squirrelmail/alternc-changepass.conf ]; then - CONFIG_FILES="$CONFIG_FILES etc/squirrelmail/alternc-changepass.conf" - fi LOGIN="2000_squirrel" PASSWORD="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)'`" @@ -49,13 +45,13 @@ s\\%%dbname%%\\$MYSQL_DATABASE\\; s\\%%squirrelmail-login%%\\$LOGIN\\; s\\%%squirrelmail-password%%\\$PASSWORD\\; EOF - for file in $CONFIG_FILES; do - TEMPLATE="$TEMPLATE_DIR/${file##etc/}" - echo -n " $file" - if [ -f "$TEMPLATE" ]; then - sed -f "$SED_SCRIPT" < $TEMPLATE > /$file - fi - done + + file="etc/squirrelmail/alternc-changepass.conf" + TEMPLATE="$TEMPLATE_DIR/${file##etc/}" + echo -n " $file" + if [ -f "$TEMPLATE" ]; then + sed -f "$SED_SCRIPT" < $TEMPLATE > /$file + fi rm -f $SED_SCRIPT echo " Done" @@ -78,7 +74,12 @@ EOF mysql_query "INSERT IGNORE INTO sub_domaines (compte, domaine, sub, valeur, type, web_action, web_result, enable) SELECT compte, domaine, sub, valeur,'squirrelmail', 'UPDATE',0, enable FROM sub_domaines WHERE type='webmail' AND web_action='OK';" mysql_query "UPDATE sub_domaines SET web_action='DELETE' WHERE type='webmail' AND web_action='OK';" echo " Done" - + + echo "Deconfiguring javascript-common alias" + rm -f /etc/apache2/conf.d/javascript-common.conf + # just in case + sed -i -e "s/^Alias \/javascript/# Do not uncomment, commented by AlternC to prevent a global alias\n#Alias \/javascript/" /etc/javascript-common/javascript-common.conf + echo " Done" fi diff --git a/squirrelmail/templates/javascript-common/javascript-common.conf b/squirrelmail/templates/javascript-common/javascript-common.conf deleted file mode 100644 index b9c448d4..00000000 --- a/squirrelmail/templates/javascript-common/javascript-common.conf +++ /dev/null @@ -1,11 +0,0 @@ - -# WARNING: Do not edit this file, edit the one in /etc/alternc/templates and launch alternc.install again. - -#Alias /javascript /usr/share/javascript/ - - - Options FollowSymLinks MultiViews - Order allow,deny - Allow from all - -