adding roundcube + fixing squirrelmail, update javascript-common too

This commit is contained in:
Benjamin Sonntag 2012-10-16 21:13:15 +00:00
parent bde1a5ac62
commit 804fba671f
10 changed files with 293 additions and 64 deletions

5
.gitattributes vendored
View File

@ -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

View File

@ -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 <benjamin@sonntag.fr>\n"
"Language-Team: français <team@alternc.org>\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. <br/> <i>IPv4, IPv6 and subnet allowed</"
"i>"
msgstr ""
"Entrez ici l'adresse IP que vous souhaitez. <br /><i>IPV4, IPV6 et préfixes "
"sont autorisés </i>"
#: ../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&nbsp;?"
#: ../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"

30
roundcube/Makefile Normal file
View File

@ -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/

View File

@ -0,0 +1,68 @@
<?php
/*
----------------------------------------------------------------------
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: Manage Roundcube webmail configuration
----------------------------------------------------------------------
*/
/**
* This class handle roundcube's webmail
* hook the main panel page to add a link to the webmail
*/
class m_roundcube {
/* ----------------------------------------------------------------- */
/** Hook called by the homepage or the /webmail link
* to redirect the user to a known webmail url.
* the variable 'webmail_redirect' tells which webmail has the priority.
* @return string the URL of the webmail
*/
function hook_admin_webmail() {
global $db;
// Search for the domain where the panel is hosted, then search for a webmail in it.
$i=2;
$domain="";
do { // for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
list($host,$dompart)=explode(".",$_SERVER["HTTP_HOST"],$i);
// We search for a 'squirrelmail' subdomain in that domain
$db->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 */

View File

@ -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 <<EOF
s\\%%ALTERNC_LOC%%\\$ALTERNC_LOC\\;
s\\%%dbhost%%\\$MYSQL_HOST\\;
s\\%%dbname%%\\$MYSQL_DATABASE\\;
s\\%%roundcube-login%%\\$LOGIN\\;
s\\%%roundcube-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
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

View File

@ -0,0 +1,53 @@
<VirtualHost *:80>
ServerName %%fqdn%%
AssignUserId alternc-roundcube nogroup
SetEnv LOGIN "%%UID%%-%%LOGIN%%"
DocumentRoot /usr/share/roundcube
# Access to tinymce files
<Directory "/usr/share/tinymce/www/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /var/lib/roundcube/>
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
</Directory>
# Protecting basic directories:
<Directory /var/lib/roundcube/config>
Options -FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/lib/roundcube/temp>
Options -FollowSymLinks
AllowOverride None
Order allow,deny
Deny from all
</Directory>
<Directory /var/lib/roundcube/logs>
Options -FollowSymLinks
AllowOverride None
Order allow,deny
Deny from all
</Directory>
Alias /javascript /usr/share/javascript/
<Directory "/usr/share/javascript/">
Options FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

View File

@ -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

View File

@ -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;

View File

@ -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"
@ -79,6 +75,11 @@ EOF
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

View File

@ -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/
<Directory "/usr/share/javascript/">
Options FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>