diff --git a/inc/webadmin-servername.php b/inc/webadmin-servername.php index d2e4d5c..fc82e08 100644 --- a/inc/webadmin-servername.php +++ b/inc/webadmin-servername.php @@ -193,17 +193,15 @@ if (isset($_GET['edit']) ) { $alias_list = $bdd->list_serveralias($domain); } else { - - $cmd = 'web-add.sh list-servername ' . $domain; + $cmd = 'web-add.sh list-vhost ' . $domain; if(!is_superadmin()) { $cmd = sprintf('%s %s', $cmd, $_SESSION['user']); } sudoexec($cmd, $data_output, $exec_return); - foreach($data_output as $data_line) { - array_push($servername_list, $data_line); - } + $data_vhost = explode(':', $data_output[0]); + $servername = $data_vhost[2]; } include_once EVOADMIN_BASE . '../tpl/header.tpl.php'; diff --git a/scripts/web-add.sh b/scripts/web-add.sh index 3229072..e3d5df9 100755 --- a/scripts/web-add.sh +++ b/scripts/web-add.sh @@ -128,30 +128,26 @@ del-alias VHOST ALIAS Del a ServerAlias from an Apache vhost -list-servername LOGIN - - List ServerName(s) for user LOGIN - update-servername VHOST SERVERNAME OLD_SERVERNAME Replace the OLD_SERVERNAME with the SERVERNAME for an Apache vhost - Also apply to rules + Also apply to rewrite rules check-occurence NAME List all occurences of NAME in vhosts -list-user-itk DOMAIN LOGIN +list-user-itk LOGIN - List the assigned ITK user for the DOMAIN specified + List the assigned ITK user for the LOGIN specified -enable-user-itk DOMAIN LOGIN +enable-user-itk LOGIN - Enable the assigned ITK user for the DOMAIN specified + Enable the assigned ITK user for the LOGIN specified -disable-user-itk DOMAIN LOGIN +disable-user-itk LOGIN - Disable the assigned ITK user for the DOMAIN specified + Disable the assigned ITK user for the LOGIN specified setphpversion LOGIN VERSION @@ -828,9 +824,6 @@ arg_processing() { del-alias) op_aliasdel "$@" ;; - list-servername) - op_listservername "$@" - ;; update-servername) op_servernameupdate "$@" ;; @@ -942,25 +935,6 @@ op_aliasdel() { fi } -op_listservername() { - if [ $# -eq 1 ]; then - vhost_file="$VHOST_PATH/${1}.conf"; - - if [ -f "${vhost_file}" ]; then - servernames=$(awk '/^[[:space:]]*ServerName (.*)/ { print $2 }' "$vhost_file" | uniq) - - for servername in $servernames; do - echo "$servername"; - done - else - echo "VHost file \`${vhost_file}' not found'" >&2 - return 1 - fi - else - usage - fi -} - op_servernameupdate() { if [ $# -eq 3 ]; then vhost="${1}.conf" @@ -968,7 +942,6 @@ op_servernameupdate() { old_servername=$3 vhost_file="${VHOST_PATH}/${vhost}" - # Remplacement de toutes les directives ServerName, on assume qu'il s'agit du même pour chaque vhost du fichier if [ -f "${vhost_file}" ]; then sed -i "/^ *ServerName/ s/$old_servername/$servername/g" "${vhost_file}" --follow-symlinks sed -i "/^ *RewriteCond/ s/$old_servername/$servername/g" "${vhost_file}" --follow-symlinks diff --git a/tpl/webadmin-servername.tpl.php b/tpl/webadmin-servername.tpl.php index 8b27c8b..50b87d3 100644 --- a/tpl/webadmin-servername.tpl.php +++ b/tpl/webadmin-servername.tpl.php @@ -17,7 +17,7 @@ 0) { ?> + if(!empty($servername)) { ?> @@ -30,15 +30,14 @@ '; - printf('', - $servername_list[$i]); - if (is_superadmin()) - printf('', - $domain, $servername_list[$i]); - print ''; - } ?> + print ''; + printf('', + $servername); + if (is_superadmin()) + printf('', + $domain, $servername); + print ''; + ?>
%sModifier
%sModifier