Browse Source

rebase master

pull/59/head
Nicolas Roman 1 year ago
parent
commit
634a18d1cb
6 changed files with 39 additions and 50 deletions
  1. +4
    -4
      htdocs/index.php
  2. +19
    -30
      inc/webadmin-itk.php
  3. +10
    -10
      inc/webadmin-servername.php
  4. +1
    -1
      tpl/webadmin-itk.tpl.php
  5. +1
    -1
      tpl/webadmin-servername.tpl.php
  6. +4
    -4
      tpl/webadmin.tpl.php

+ 4
- 4
htdocs/index.php View File

@ -58,19 +58,19 @@ if (!array_key_exists('auth', $_SESSION) || $_SESSION['auth']!=1) {
if (in_array(htmlspecialchars(basename($_SERVER['REDIRECT_URL'])), $_SESSION['non_standard']))
http_redirect('/webadmin');
if (preg_match('#^/webadmin/servername/(.*)/?$#', $uri, $params)) {
if (preg_match('#^/webadmin/(.*)/domain/?(edit)?/?(.*)?/$#', $uri, $params)) {
include_once EVOADMIN_BASE . '../inc/webadmin-servername.php';
} elseif (preg_match('#^/webadmin/itk/(.*)/?$#', $uri, $params)) {
} elseif (preg_match('#^/webadmin/(.*)/itk/?(enable|disable)?/?(.*)?/$#', $uri, $params)) {
include_once EVOADMIN_BASE . '../inc/webadmin-itk.php';
} elseif (preg_match('#^/webadmin/php/(.*)/?$#', $uri, $params)) {
} elseif (preg_match('#^/webadmin/(.*)/php/$#', $uri, $params)) {
include_once EVOADMIN_BASE . '../inc/webadmin-php.php';
} elseif (preg_match('#^/webadmin/edit/(.*)/?$#', $uri, $params)) {
} elseif (preg_match('#^/webadmin/(.*)/alias/?(add|delete)?/?(.*)?/$#', $uri, $params)) {
include_once EVOADMIN_BASE . '../inc/webadmin-edit.php';


+ 19
- 30
inc/webadmin-itk.php View File

@ -18,28 +18,9 @@ require_once EVOADMIN_BASE . '../lib/domain.php';
global $conf;
if (isset($_GET['enable']) ) {
require_once EVOADMIN_BASE . '../evolibs/Form.php';
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';
include_once EVOADMIN_BASE . '../tpl/menu.tpl.php';
$servername = array (
'domain' => htmlspecialchars(basename($_SERVER['REDIRECT_URL'])),
);
$enable_cmd = 'web-add.sh enable-user-itk ' . $servername['domain'];
if (isset($params[3]) && $params[3] == "") http_redirect($redirect_url);
if (isset($params[2]) && $params[2] != "") {
if ($enable_cmd_return == 0) {
print 'Sécurité ITK activée.';
printf ('<p><a href="%s">Retour à la gestion ITK</a></p>', $_SERVER['REDIRECT_URL']);
}
include_once EVOADMIN_BASE . '../tpl/footer.tpl.php';
} elseif (isset($_GET['disable']) ) {
$redirect_url = "/webadmin/" . $params[1] . "/itk/";
require_once EVOADMIN_BASE . '../evolibs/Form.php';
@ -47,23 +28,31 @@ if (isset($_GET['enable']) ) {
include_once EVOADMIN_BASE . '../tpl/menu.tpl.php';
$servername = array (
'domain' => htmlspecialchars(basename($_SERVER['REDIRECT_URL'])),
'domain' => $params[1],
);
$disable_cmd = 'web-add.sh disable-user-itk ' . $servername['domain'];
if ($params[2] == "enable") {
$enable_cmd = 'web-add.sh enable-user-itk ' . $servername['domain'];
sudoexec($enable_cmd, $enable_cmd_output, $enable_cmd_return);
sudoexec($enable_cmd, $enable_cmd_output, $enable_cmd_return);
if ($enable_cmd_return == 0) {
print 'Sécurité ITK activée.';
printf ('<p><a href="%s">Retour à la gestion ITK</a></p>', $redirect_url);
}
if ($enable_cmd_return == 0) {
print 'Sécurité ITK activée.';
printf ('<p><a href="%s">Retour à la gestion ITK</a></p>', $redirect_url);
}
}
elseif ($params[2] == "disable") {
$disable_cmd = 'web-add.sh disable-user-itk ' . $servername['servername'] . ' ' . $servername['domain'];
$disable_cmd = 'web-add.sh disable-user-itk ' . $servername['domain'];
include_once EVOADMIN_BASE . '../tpl/footer.tpl.php';
sudoexec($disable_cmd, $disable_cmd_output, $disable_cmd_return);
if ($disable_cmd_return == 0) {
print 'Sécurité ITK désactivée';
printf ('<p><a href="%s">Retour à la gestion ITK</a></p>', $redirect_url);
}
}
include_once EVOADMIN_BASE . '../tpl/footer.tpl.php';
} else {
$domain = $params[1];


+ 10
- 10
inc/webadmin-servername.php View File

@ -28,8 +28,8 @@ if (isset($params[2]) && $params[2] == "edit") {
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';
include_once EVOADMIN_BASE . '../tpl/menu.tpl.php';
$form = new FormPage("Modification du ServerName", FALSE);
$form->addField('domain_servername', new DomainInputFormField("ServerName", TRUE), $params[3]);
$form = new FormPage("Modification du Servername", FALSE);
$form->addField('domain_servername', new DomainInputFormField("Servername", TRUE), $params[3]);
$form->addField('previous_servername', new DomainInputFormField("", TRUE, TRUE), $params[3]);
if (!empty($_POST)) {
@ -126,22 +126,22 @@ if (isset($params[2]) && $params[2] == "edit") {
if ($exec_return == 0) {
//domain_add($serveralias['alias'], gethostbyname($master) , false); TODO avec l'IP du load balancer
print "<center>";
printf ('<p>Le ServerName %s a bien été modifié</p>', $servername['servername']);
printf ('<p><a href="%s">Retour à la liste des ServerNames</a></p>', $redirect_url);
printf ('<p>Le Servername %s a bien été modifié</p>', $servername['servername']);
printf ('<p><a href="%s">Retour à la liste des Servernames</a></p>', $redirect_url);
print "</center>";
}
else {
print "<center>";
printf ('<p>Echec dans la modification du ServerName %s</p>', $servername['servername']);
printf ('<p><a href="%s">Retour à la liste des ServerNames</a></p>', $redirect_url);
printf ('<p>Echec dans la modification du Servername %s</p>', $servername['servername']);
printf ('<p><a href="%s">Retour à la liste des Servernames</a></p>', $redirect_url);
print "</center>";
}
}
else {
print "<center>";
printf ('<p>Echec dans la modification du ServerName %s</p>', $servername['servername']);
printf ('<p>Echec dans la modification du Servername %s</p>', $servername['servername']);
print ('<p>Le domaine existe déjà dans d\'autres vhosts.');
printf ('<p><a href="%s">Retour à la liste des ServerNames</a></p>', $redirect_url);
printf ('<p><a href="%s">Retour à la liste des Servernames</a></p>', $redirect_url);
print "</center>";
}
}
@ -156,10 +156,10 @@ if (isset($params[2]) && $params[2] == "edit") {
print "</form>";
}
} else {
print "<h2>Modification du ServerName</h2><hr>";
print "<h2>Modification du Servername</h2><hr>";
print "<form name=\"form-add\" id=\"form-add\" action=\"\" method=\"POST\">";
print " <fieldset>";
print " <legend>Modification du ServerName</legend>";
print " <legend>Modification du Servername</legend>";
print $form;
print " <p><input type=\"submit\" value=\"Modifier\"/></p>";
print " </fieldset>";


+ 1
- 1
tpl/webadmin-itk.tpl.php View File

@ -42,7 +42,7 @@
$action = ['enable', 'Activer'];
}
printf('<td><a href="/webadmin/itk/%s?%s">'.$action[1].'</a></td>',
printf('<td><a href="/webadmin/%s/itk/%s/">'.$action[1].'</a></td>',
$domain, $action[0]);
}
print '</tr>';


+ 1
- 1
tpl/webadmin-servername.tpl.php View File

@ -34,7 +34,7 @@
printf('<td>%s</td>',
$servername);
if (is_superadmin())
printf('<td><a href="/webadmin/servername/%s?edit=%s">Modifier</a></td>',
printf('<td><a href="/webadmin/%s/domain/edit/%s/">Modifier</a></td>',
$domain, $servername);
print '</tr>';
?>


+ 4
- 4
tpl/webadmin.tpl.php View File

@ -104,12 +104,12 @@
if (is_superadmin()) {
printf('<td>');
if (!in_array($vhost_info['owner'], $_SESSION['non_standard'])) {
printf('<a href="/webadmin/edit/%s">Alias</a> - ', $vhost_info['owner']);
printf('<a href="/webadmin/servername/%s">Servername</a> - ', $vhost_info['owner']);
printf('<a href="/webadmin/%s/alias/">Alias</a> - ', $vhost_info['owner']);
printf('<a href="/webadmin/%s/domain/">Servername</a> - ', $vhost_info['owner']);
if(is_multiphp()) {
printf('<a href="/webadmin/php/%s">PHP</a> - ', $vhost_info['owner']);
printf('<a href="/webadmin/%s/php/">PHP</a> - ', $vhost_info['owner']);
} else {
printf('<a href="/webadmin/itk/%s">ITK</a> - ', $vhost_info['owner']);
printf('<a href="/webadmin/%s/itk/">ITK</a> - ', $vhost_info['owner']);
}
printf('<a href="/webadmin/delete/%s">Supprimer</a>', $vhost_info['owner']);
} else {


Loading…
Cancel
Save