Alternc  latest
Alternc logiel libre pour l'hébergement
dom_import.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Import of DNS informations from an existing zone, transformation into AlternC's system zone.
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 include_once("head.php");
28 
29 $fields = array (
30  "domain" => array ("post", "string", ""),
31  "zone" => array ("post", "string", ""),
32  "save" => array ("post", "integer", "0"),
33  "detect_redirect" => array ("post", "integer", "0"),
34 );
37 
38 ?>
39 <h3><?php __("Import a DNS zone"); ?></h3>
40 <hr id="topbar"/>
41 <br />
42 
43 <?php
44 if ( !empty($zone) && empty($domain) ) {
45  $msg->raise("ALERT", "dom", _("The domain field seems to be empty"));
46 }
47 
48 echo $msg->msg_html_all();
49 ?>
50 
51 <?php if ( !empty($zone) ) {
52 if ( !empty($domain) ) {
53  __("Here is my proposition. Modify your zone until my proposition seems good to you"); ?>
54  <table class="tlist">
55  <tr><th colspan=3><h2><?php printf(_("Working on %s"),$domain); ?></h2></th></tr>
56  <tr>
57  <th width="50%"><?php __("Zone"); ?></th><th width="50%"><?php __("Generated entry"); ?></th><?php if ($save) {echo "<th>"._("Result")."</th>"; } ?>
58  </tr>
59  <tbody>
60  <?php foreach ($dom->import_manual_dns_zone($zone, $domain, $detect_redirect, $save) as $val) {
61  if (empty($val)) continue;
62  //echo "<tr><td>"; print_r($val);
63  echo "<tr class='";
64  if ($save) {
65  echo "tab-".($val['did_it']==1?'ok':'err');
66  } else {
67  echo "tab-".$val['status'];
68  }
69  echo "'><td>".$val['entry_old']."</td><td>".$val['comment']."</td>";
70  if ($save) { echo "<td>".($val['did_it']==1?_("OK"):_("ERROR"))."</td>"; }
71  echo "</tr>\n";
72  } // foreach
73  ?>
74  </tbody>
75  </table>
76 <?php
77 } // empty domain
78 echo "<hr/>";
79 } // empty $zone
80 
81 
82 if ($save) {
83  echo '<span class="inb"><a href="dom_edit.php?domain='.urlencode($domain).'" >'._("Click here to continue").'</a></span>';
84 } else {
85 ?>
86 
87 
88 <form method="post" action="dom_import.php">
89  <?php csrf_get(); ?>
90  <table>
91  <tr>
92  <td>
93  <label for="domain"><?php __("Enter the domain name you want to import") ; ?></label>
94  </td>
95  <td>
96  <input type="text" size="40" name="domain" value="<?php ehe($domain); ?>" />
97  </td>
98  </tr>
99  <tr>
100  <td>
101  <label for="detect_redirect"><?php __("Do you want to detect the redirection?"); ?></label>
102  </td>
103  <td>
104  <input name="detect_redirect" type="checkbox" value="1" <?php cbox($detect_redirect); ?> />
105  </td>
106  </tr>
107  <tr>
108  <td colspan="2">
109 
110  <p>
111  <label for="zone"><?php
112  __("Paste your existing DNS zone here.");
113  echo '<br/>';
114  __("If you don't know what it is, don't submit this form.");?></label>
115  <textarea cols=100 rows=20 name="zone"><?php echo $zone; ?></textarea>
116  </p>
117 
118  <?php if ( ! empty($zone) && ! empty($domain) ) { // only if you reviewed ?>
119  <label><?php __("Do you want to import the zone as it?"); ?></label>
120  <input name="save" type="checkbox" value="1" />
121  <?php } ?>
122 
123  <p><input type="submit" name="submit" class="inb ok" value="<?php __("Submit"); ?>" /></p>
124  </td>
125  </tr>
126  </table>
127 </form>
128 
129 <?php
130 } // $save
131 
132 include_once("foot.php");
133 
134 ?>
$msg
Definition: bootstrap.php:75
$fields
Import of DNS informations from an existing zone, transformation into AlternC's system zone.
Definition: dom_import.php:29
$domain
Definition: dom_import.php:36
__($str)
Definition: functions.php:404
cbox($test, $echo=true)
ECHOes checked="checked" only if the parameter is true useful for checkboxes and radio buttons.
Definition: functions.php:345
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
Definition: functions.php:1159
$val
Definition: tempovars.php:15
$dom
Definition: whois_test.php:10