J'enfreind la regle. Je rajoute une feature.

A tester et valider, mais maintenant on peux reloader update_domain en un clic ;)

Quelques FIX de css, pour gérer les domaines très long et/ou les valeurs de sous domaine très longue
This commit is contained in:
Alan Garcia 2013-01-28 17:05:53 +00:00
parent 07d6b8d7a9
commit 26a4171139
15 changed files with 126 additions and 12 deletions

4
.gitattributes vendored
View File

@ -88,6 +88,7 @@ bureau/admin/adm_tldadd.php -text
bureau/admin/adm_tlddoadd.php -text
bureau/admin/adm_tlddoedit.php -text
bureau/admin/adm_tldedit.php -text
bureau/admin/adm_update_domains.php -text
bureau/admin/adm_variables.php -text
bureau/admin/aide/files/browser_set.png -text
bureau/admin/aide/files/ftp_add.png -text
@ -488,6 +489,7 @@ etc/alternc/templates/default/saslauthd -text
etc/alternc/templates/dovecot/dovecot-dict-quota.conf -text
etc/alternc/templates/dovecot/dovecot-sql.conf -text
etc/alternc/templates/dovecot/dovecot.conf -text
etc/alternc/templates/incron.d/alternc -text
etc/alternc/templates/postfix/ca.der -text
etc/alternc/templates/postfix/master.cf -text
etc/alternc/templates/postfix/myalias.cf -text
@ -532,6 +534,7 @@ install/upgrades/1.0.sql -text
install/upgrades/1.1.php -text
install/upgrades/1.1.sh -text
install/upgrades/1.1.sql -text
install/upgrades/3.0.sh -text
install/upgrades/README -text
lang/.svnignore -text
lang/README -text
@ -596,6 +599,7 @@ src/fixperms.sh -text
src/functions.sh -text
src/functions_dns.sh -text
src/functions_hosting.sh -text
src/inotify_update_domains.sh -text
src/mem_add -text
src/mem_del -text
src/popimap-log-login.sh -text

View File

@ -0,0 +1,41 @@
<?php
/*
$Id: adm_tld.php,v 1.4 2004/11/29 17:27:04 anonymous Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.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
----------------------------------------------------------------------
Original Author of file: Alan Garcia
Purpose of file: Manage domain types on the server
----------------------------------------------------------------------
*/
require_once("../class/config.php");
if (!$admin->enabled) {
__("This page is restricted to authorized staff");
exit();
}
touch($L_INOTIFY_UPDATE_DOMAIN);
Header('Location: /main.php');
?>

View File

@ -136,15 +136,17 @@ for($i=0;$i<$r["nsub"];$i++) {
<?php } ?>
</td>
<?php } // end IF ==DELETE ?>
<td><a href="http://<?php ecif($r["sub"][$i]["name"],$r["sub"][$i]["name"]."."); echo $r["name"] ?>" target="_blank"><?php ecif($r["sub"][$i]["name"],$r["sub"][$i]["name"]."."); echo $r["name"] ?></a></td>
<td><?php __($r['sub'][$i]['type_desc']); ?>
<td><div class="retour-auto"><a href="http://<?php ecif($r["sub"][$i]["name"],$r["sub"][$i]["name"]."."); echo $r["name"] ?>" target="_blank"><?php
echo ecif($r["sub"][$i]["name"] , $r["sub"][$i]["name"]."." , "" , 0) . $r["name"];
?></a></div></td>
<td><div class="retour-auto"><?php __($r['sub'][$i]['type_desc']); ?>
<?php
if ($r["sub"][$i]['type'] === 'VHOST') {
echo '<br /><a href="bro_main.php?R='.urlencode($r["sub"][$i]["dest"]).'">'.htmlspecialchars($r["sub"][$i]["dest"]).'</a>';
} else {
if ($r["sub"][$i]['type']) echo "<br />".htmlspecialchars($r["sub"][$i]["dest"]);
}
?></td>
?></div></td>
<td><?php
if (!(!$isinvited && $dt[strtolower($r["sub"][$i]["type"])]["enable"] != "ALL" )) {
if ( $r['sub'][$i]['web_action'] !='DELETE') {

View File

@ -40,6 +40,7 @@ if ($mem->checkRight()) { ?>
<li><a href="adm_panel.php"><span style="color: red;"><?php __("Admin Control Panel"); ?></span></a></li>
<li><a href="/alternc-sql/"><span style="color: red;"><?php __("General PhpMyAdmin"); ?></span></a></li>
<li><a href="alternc_debugme.php?enable=<?php echo $debug_alternc->status?"0":"1"; ?>"><span style="color: red;"><?php if ($debug_alternc->status) __("Switch debug Off"); else __("Switch debug On"); ?></span></a></li>
<li><a href="/adm_update_domains.php"><span style="color: red;"><?php __("Force a reload"); ?></span></a></li>
<?php } ?>
</ul>
</div>

View File

@ -502,3 +502,8 @@ input#dir, input#sub_local {
.grey, .grey td {
color: #999;
}
.retour-auto {
max-width:220px;
word-wrap:break-word;
}

View File

@ -246,11 +246,16 @@ function selected($bool) {
}
}
function ecif($test,$tr,$fa="") {
function ecif($test,$tr,$fa="",$affiche=1) {
if ($test)
echo $tr;
$retour = $tr;
else
echo $fa;
$retour = $fa;
if ($affiche)
echo $retour;
else
return $retour;
}
function __($str) {
@ -653,5 +658,18 @@ function display_browser($dir="", $caller="main.dir", $width=350, $height=450) {
}
// Insere un $wrap_string tous les $max caracteres dans $message
function auto_wrap($message="",$max=10,$wrap_string="<wbr/>") {
$cpt = 0;
$mot = split(" ",$message);
while (isset($mot[$cpt]) && ($mot[$cpt] != "")){
if(@strlen($mot[$cpt]) > $max){
$nvmot = chunk_split ($mot[$cpt], $max, $wrap_string );
$message = str_replace($mot[$cpt], $nvmot, $message);
}
$cpt++;
}
return $message;
}
?>

View File

@ -115,6 +115,9 @@ SQLBACKUP_OVERWRITE=""
# known slave servers, empty for none, localhost is special (no ssh)
ALTERNC_SLAVES=""
# File to look at for forced launch of update_domain (use incron)
INOTIFY_UPDATE_DOMAIN="/var/run/alternc/inotify_update_domain.lock"
EOF
chown root:alterncpanel $CONFIGFILE

2
debian/control vendored
View File

@ -10,7 +10,7 @@ Standards-Version: 3.9.1
Package: alternc
Architecture: all
Pre-depends: debconf (>= 0.5.00) | debconf-2.0, bash (>= 4)
Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, bind9, wget, rsync, 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), sudo, adduser, mysql-client, dnsutils, acl, dovecot-imapd (>= 1:1.2.15), dovecot-pop3d (>= 1:1.2.15), vlogger, mailx
Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, bind9, wget, rsync, 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), sudo, adduser, mysql-client, dnsutils, acl, dovecot-imapd (>= 1:1.2.15), dovecot-pop3d (>= 1:1.2.15), vlogger, mailx, incron
Recommends: mysql-server(>= 5.0), ntp, quota
Conflicts: alternc-admintools, alternc-awstats (< 1.0), alternc-webalizer (<= 0.9.4), alternc-mailman (< 2.0)
Provides: alternc-admintools

4
debian/rules vendored
View File

@ -61,7 +61,7 @@ install: build
chmod 1733 debian/alternc/var/alternc/sessions
chmod -R 644 debian/alternc/var/alternc/bureau
chmod -R a+X debian/alternc/var/alternc/bureau
chown -R www-data:www-data debian/alternc/var/alternc/html debian/alternc/var/run/alternc debian/alternc/var/log/alternc debian/alternc/var/alternc/tmp
chown -R www-data:www-data debian/alternc/var/alternc/html debian/alternc/var/log/alternc debian/alternc/var/alternc/tmp
chmod a+x debian/alternc/usr/share/alternc/install/alternc.install debian/alternc/usr/share/alternc/install/dopo.sh debian/alternc/usr/share/alternc/install/mysql.sh debian/alternc/usr/share/alternc/install/newone.php debian/alternc/usr/share/alternc/install/reset_root.php debian/alternc/usr/share/alternc/install/upgrade_check.sh debian/alternc/usr/share/alternc/install/upgrades/*.php debian/alternc/usr/share/alternc/install/upgrades/*.sh
for sub in mail html ; do \
@ -76,6 +76,8 @@ install: build
chown 1999:1999 debian/alternc/var/alternc/logs
# Group and user 1999 reference alterncpanel
chown 1999:1999 debian/alternc/var/alternc/html/*
mkdir -p debian/alternc/var/run/alternc/
chown 1999:1999 debian/alternc/var/run/alternc/
# Ex old alternc-admintools
install tools/top_http_users debian/alternc/usr/bin

View File

@ -0,0 +1,2 @@
/var/run/alternc/ IN_CREATE,IN_ATTRIB,IN_NO_LOOP /usr/lib/alternc/inotify_update_domains.sh

View File

@ -64,7 +64,7 @@ TEMPLATE_DIR="/etc/alternc/templates"
# Find needed configuration files (without the initial '/')
# replace this one unconditionnally
CONFIG_FILES="etc/alternc/bureau.conf"
CONFIG_FILES="etc/alternc/bureau.conf etc/incron.d/alternc"
if [ -e /etc/bind/named.conf ]; then
CONFIG_FILES="$CONFIG_FILES etc/bind/templates/zone.template
@ -228,6 +228,10 @@ done
# also backup main.cf since we're doing major changes to it
BACKUPS="$BACKUPS etc/postfix/main.cf"
# also backup /etc/incron.allow
BACKUPS="$BACKUPS etc/incron.allow"
tar -zcf "$BACKUP_FILE" -C / $BACKUPS 2>/dev/null || true
#######################################################################
@ -343,6 +347,16 @@ done
OLDDESTINATION=`postconf mydestination | awk -F '=' '{print $2}'`
echo "$OLDDESTINATION" | grep -q -v "$FQDN" && postconf -e "mydestination = $FQDN, $OLDDESTINATION"
if [ ! -f "/etc/incron.allow" ]
then
echo "Missing /etc/incron.allow ."
echo "Did you install incron ?"
exit 1
fi
grep -q ^root /etc/incron.allow || echo "root" >> /etc/incron.allow
SERVICES="$SERVICES incron"
if [ -e /etc/proftpd.conf ] ; then
chmod 640 /etc/proftpd/proftpd.conf
fi

14
install/upgrades/3.0.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. /etc/alternc/local.sh
# Add INOTIFY_UPDATE_DOMAIN var to local.sh
if [ -z "$INOTIFY_UPDATE_DOMAIN" ] ; then
echo -e '
# File to look at for forced launch of update_domain (use incron)
INOTIFY_UPDATE_DOMAIN="/var/run/alternc/inotify_update_domain.lock"
' >> /etc/alternc/local.sh
fi
chown alterncpanel /var/run/alternc/

View File

@ -19,7 +19,7 @@
# ----------------------------------------------------------------------
# Purpose of file: Makefile des binaires de /usr/lib/alternc
# ----------------------------------------------------------------------
SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh alternc_add_policy_dovecot rebuild_all_webconf.sh courier-dovecot-migrate.pl popimap-log-login.sh mem_add mem_del quota_edit quota_get du.pl update_quota_mail.sh
SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh alternc_add_policy_dovecot rebuild_all_webconf.sh courier-dovecot-migrate.pl popimap-log-login.sh mem_add mem_del quota_edit quota_get du.pl update_quota_mail.sh inotify_update_domains.sh
LIBS=functions.sh functions_hosting.sh functions_dns.sh
BIN=$(DESTDIR)/usr/lib/alternc/

8
src/inotify_update_domains.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash -x
# Launch update_domains.sh if $INOTIFY_UPDATE_DOMAIN exist
. /etc/alternc/local.sh
test -e "$INOTIFY_UPDATE_DOMAIN" && /usr/lib/alternc/update_domains.sh

View File

@ -166,7 +166,7 @@ for slave in $ALTERNC_SLAVES; do
fi
done
rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB" "$DNS_DO_RESTART"
rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB" "$DNS_DO_RESTART" "$INOTIFY_UPDATE_DOMAIN"
exit 0