Suite draft DNS

This commit is contained in:
Alan Garcia 2011-01-26 17:26:01 +00:00
parent 0b5ee28489
commit 064aa0864c
6 changed files with 263 additions and 1 deletions

3
.gitattributes vendored
View File

@ -22,6 +22,9 @@ bureau/admin/adm_dodel.php -text
bureau/admin/adm_doedit.php -text bureau/admin/adm_doedit.php -text
bureau/admin/adm_domlock.php -text bureau/admin/adm_domlock.php -text
bureau/admin/adm_doms.php -text bureau/admin/adm_doms.php -text
bureau/admin/adm_domstype.php -text
bureau/admin/adm_domstypedoedit.php -text
bureau/admin/adm_domstypeedit.php -text
bureau/admin/adm_donosu.php -text bureau/admin/adm_donosu.php -text
bureau/admin/adm_dorenew.php -text bureau/admin/adm_dorenew.php -text
bureau/admin/adm_dosu.php -text bureau/admin/adm_dosu.php -text

View File

@ -0,0 +1,85 @@
<?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: Benjamin Sonntag
Purpose of file: Manage allowed TLD on the server
----------------------------------------------------------------------
*/
require_once("../class/config.php");
if (!$admin->enabled) {
__("This page is restricted to authorized staff");
exit();
}
include_once("head.php");
?>
<h3><?php __("Manage domains type"); ?></h3>
<hr id="topbar" />
<br />
<?php
if ($error) {
echo "<p class=\"error\">$error</p>";
}
$dom = new m_dom();
$r=$dom->domains_type_lst;
// die(print_r($dom->domains_type_lst()));
?>
<p>
<?php __("Here is the list of the domains type."); ?>
</p>
<p><span class="ina"><a href="adm_domstypeadd.php"><?php __("Add a new domains type"); ?></a></span></p>
<table class="tlist">
<tr>
<th><?php __("Id");?></th>
<th><?php __("Name");?></th>
<th><?php __("Description");?></th>
<th><?php __("Ask destination ?");?></th>
<th><?php __("Entry");?></th>
<th><?php __("Compatibility");?></th>
<th><?php __("Edit");?></th>
</tr>
<?php
$pair=0;
foreach($dom->domains_type_lst() as $d) {
++$pair;
?>
<tr class="lst<?php echo $pair%2+1 ?>">
<td><?php echo $d['id'];?></td>
<td><?php echo $d['name'];?></td>
<td><?php echo $d['description'];?></td>
<td><?php echo $d['ask_dest']?__("Yes"):__("No");?></td>
<td><?php echo $d['entry'];?></td>
<td><?php echo $d['compatibility'];?></td>
<td><div class="ina"><a href="adm_domstypeedit.php?id=<?php echo urlencode($d['id']); ?>"><img style="padding-bottom: 5px" src="images/edit.png" alt="<?php __("Edit"); ?>" /><?php __("Edit"); ?></a></div></td>
</tr>
<?php } // end foreach ?>
<?php include_once("foot.php"); ?>

View File

@ -0,0 +1,17 @@
<?php
require_once("../class/config.php");
if (!$admin->enabled) {
__("This page is restricted to authorized staff");
exit();
}
if ( ! $dom->domains_type_update($id, $name, $description, $ask_dest, $entry, $compatibility) ) {
die($err->errstr());
} else {
include("adm_domstype.php");
}
?>

View File

@ -0,0 +1,97 @@
<?php
/*
$Id: mail_edit.php,v 1.6 2006/01/12 01:10:48 anarcat 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: Benjamin Sonntag
Purpose of file: Edit a mailbox.
----------------------------------------------------------------------
*/
require_once("../class/config.php");
if (!$admin->enabled) {
__("This page is restricted to authorized staff");
exit();
}
include_once("head.php");
$fields = array (
"id" => array ("request", "integer", ""),
"name" => array ("request", "string", ""),
"description" => array ("request", "string", ""),
"ask_dest" => array ("request", "boolean", ""),
"entry" => array ("request", "string", ""),
"compatibility" => array ("request", "string", ""),
);
getFields($fields);
if (! $d=$dom->domains_type_get($id)) {
$error=$err->errstr();
echo $error;
} else {
?>
<h3><?php __("Edit a domains type"); ?> </h3>
<hr id="topbar"/>
<br />
<?php
if ($error_edit) {
echo "<p class=\"error\">$error_edit</p>";
$error_edit="";
} ?>
<form action="adm_domstypedoedit.php" method="post" name="main" id="main">
<input type="hidden" name="id" value="<?php echo $d['id']; ?>" />
<table class="tedit">
<tr>
<th><?php __("Name");?></th>
<td><input name="name" type=text size="15" value="<?php echo $d['name']; ?>" /></td>
</tr>
<tr>
<th><?php __("Description");?></th>
<td><input name="description" type=text size="30" value="<?php echo $d['description']; ?>" /></td>
</tr>
<tr>
<th><?php __("Ask destination ?");?></th>
<td><input name="ask_dest" type=checkbox value=1 <?php echo $d['ask_dest']?"checked":""; ?>/></td>
</tr>
<tr>
<th><?php __("Entry");?></th>
<td><input name="entry" type=text size="30" value="<?php echo $d['entry']; ?>" /></td>
</tr>
<tr>
<th><?php __("Compatibility");?></th>
<td><input name="compatibility" type=text size="15" value="<?php echo $d['compatibility']; ?>" /></td>
</tr>
<tr class="trbtn">
<td colspan="2">
<input type="submit" class="inb" name="submit" value="<?php __("Change this domains type"); ?>" />
</td>
</tr>
</table>
</form>
<?php } ?>

View File

@ -62,6 +62,7 @@ include_once("head.php");
<li class="lst1"><a href="adm_slaveaccount.php"><?php __("Manage allowed accounts for slave zone transfers"); ?></a></li> <li class="lst1"><a href="adm_slaveaccount.php"><?php __("Manage allowed accounts for slave zone transfers"); ?></a></li>
<li class="lst2"><a href="adm_mxaccount.php"><?php __("Manage allowed accounts for secondary mx"); ?></a></li> <li class="lst2"><a href="adm_mxaccount.php"><?php __("Manage allowed accounts for secondary mx"); ?></a></li>
<li class="lst1"><a href="adm_variables.php"><?php __("Configure AlternC variables"); ?></a></li> <li class="lst1"><a href="adm_variables.php"><?php __("Configure AlternC variables"); ?></a></li>
<li class="lst2"><a href="adm_domstype.php"><?php __("Manage domains type"); ?></a></li>
<!-- <li class="lst2"><a href="stats_members.php"><?php __("Account creation statistics"); ?></a></li> --> <!-- <li class="lst2"><a href="stats_members.php"><?php __("Account creation statistics"); ?></a></li> -->
</ul> </ul>

View File

@ -92,6 +92,65 @@ class m_dom {
function alternc_quota_names() { function alternc_quota_names() {
return "dom"; return "dom";
} }
/* ----------------------------------------------------------------- */
/**
* Retourne un tableau contenant les types de domaines
*
* @return array retourne un tableau indexé contenant la liste types de domaines
* authorisé. Retourne FALSE si une erreur s'est produite.
*/
function domains_type_lst() {
global $db,$err,$cuid;
$err->log("dom","domains_type_lst");
$db->query("select * from domaines_type order by id;");
$this->domains_type_lst=false;
while ($db->next_record()) {
$this->domains_type_lst[] = $db->Record;
}
return $this->domains_type_lst;
}
function domains_type_get($id) {
global $db,$err,$cuid;
$id=intval($id);
$db->query("select * from domaines_type where id = $id ;");
$db->next_record();
return $db->Record;
}
function domains_type_del($id) {
global $db,$err,$cuid;
$id=intval($id);
$db->query("delete domaines_type where id=$id;");
return true;
}
function domains_type_disable($id) {
global $db,$err,$cuid;
$id=intval($id);
$db->query("update domaines_type set enable=false where id=$id;");
return true;
}
function domains_type_enable($id) {
global $db,$err,$cuid;
$id=intval($id);
$db->query("update domaines_type set enable=true where id=$id;");
return true;
}
function domains_type_update($id, $name, $description, $ask_dest, $entry, $compatibility) {
global $err,$cuid,$db;
$id=intval($id);
$name=mysql_real_escape_string($name);
$description=mysql_real_escape_string($description);
$ask_dest=intval($ask_dest);
$entry=mysql_real_escape_string($entry);
$compatibility=mysql_real_escape_string($compatibility);
$db->query("UPDATE domaines_type SET name='$name', description='$description', ask_dest='$ask_dest', entry='$entry', compatibility='$compatibility' where id='$id';");
return true;
}
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/** /**
@ -108,7 +167,7 @@ class m_dom {
$this->domains=array(); $this->domains=array();
if ($db->num_rows()>0) { if ($db->num_rows()>0) {
while ($db->next_record()) { while ($db->next_record()) {
$this->domains[]=$db->f("domaine"); $this->domains[]=$db->f("domaine");
} }
} }
return $this->domains; return $this->domains;