Alternc  latest
Alternc logiel libre pour l'hébergement
adm_doms_def_type.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  * Manages default domain types,
22  * they are the subdomains automatically installed on a domain when you host it.
23  * AlternC's modules such as squirrelmail or roundcube may create new ones, you'll see them here
24  *
25  * @copyright AlternC-Team 2000-2017 https://alternc.com/
26  */
27 
28 require_once("../class/config.php");
29 
30 if (!$admin->enabled) {
31  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
32  echo $msg->msg_html_all();
33  exit();
34 }
35 
36 include_once("head.php");
37 ?>
38 <h3><?php __("Manage defaults domains type"); ?></h3>
39 <hr id="topbar" />
40 <p><?php __("If you don't know what this page is about, don't touch anything, and read AlternC documentation about domain types"); ?></p>
41 <p><?php __("The Type column contains a type of available VirtualHost config on The server."); ?></p>
42 <p><?php __("The Setting column contains the variables to be expanded in the defaults configuration. Available values are: "); ?></p>
43 <ul>
44  <li><?php __("%%DOMAIN%% : the Domain name"); ?></li>
45  <li><?php __("%%TARGETDOM%%: The destination domain"); ?></li>
46  <li><?php __("%%SUB%% : The subdomain name"); ?></li>
47  <li><?php __("%%DOMAINDIR%%: the domain directory on the file system"); ?></li>
48 </ul>
49 
50 <br />
51 <?php
52 $fields = array(
53  "domup" => array("post", "array", ""),
54 );
56 
57 if (!empty($domup)) {
58  if (!$dom->update_default_subdomains($domup)) {
59  $msg->raise("ERROR", "admin", _("There was an error during the record."));
60  } else {
61  $msg->raise("INFO", "admin", _("Save done."));
62  }
63 }
64 echo $msg->msg_html_all();
65 
66 $tab = $dom->lst_default_subdomains();
67 ?>
68 <form method="post" action="adm_doms_def_type.php" name="main" id="main">
69  <?php csrf_get(); ?>
70  <table class="tlist">
71  <tr><th>&nbsp;</th><th><?php __("Sub"); ?></th><th><?php __("Type"); ?></th><th><?php __("settings"); ?></th><th><?php __("Concerned"); ?></th><th><?php __("Activation"); ?></th></tr>
72  <?php for ($i = 0; $i < count($tab) + 1; $i++) { ?>
73  <tr class="lst">
74  <td>
75  <?php
76  @$val = $tab[$i];
77  if (isset($tab[$i])) {
78  echo "<input type='hidden' name='domup[$i][id]' value='" . $val['id'] . "' />";
79  }
80  ?>
81  <div class="ina delete"><a href="dom_defdel.php?id=<?php echo $val['id']; ?>"><?php __("Delete"); ?></a></div>
82  </td>
83 
84  <td><input type='text' size="16" name='domup[<?php echo $i; ?>][sub]' value="<?php echo $val['sub']; ?>"/></td>
85  <?php
86  $type = array("VHOST", "URL", "WEBMAIL", "");
87  if (in_array($val['domain_type'], $type)) {
88  ?>
89  <td><select name='domup[<?php echo $i; ?>][domain_type]'>
90  <option value='VHOST' <?php if ($val['domain_type'] == 'VHOST') echo "selected=\"selected\""; ?> >VHOST</option>
91  <option value='URL' <?php if ($val['domain_type'] == 'URL') echo "selected=\"selected\""; ?> >URL</option>
92  <option value='WEBMAIL' <?php if ($val['domain_type'] == 'WEBMAIL') echo "selected=\"selected\""; ?> >WEBMAIL</option>
93  </select>
94  <?php } else { ?>
95  <td><input type="text" style="width:100px" name="domup[<?php echo $i; ?>][domain_type]" value="<?php echo $val['domain_type'] ?>" ></td>
96  <?php } ?>
97  <td><input type ='text' name='domup[<?php echo $i; ?>][domain_type_parameter]' value='<?php echo $val['domain_type_parameter'] ?>' /></td>
98  <td><select name='domup[<?php echo $i; ?>][concerned]'>
99  <option value='MAIN' <?php if ($val['concerned'] == 'MAIN') echo "selected=\"selected\""; ?> >MAIN</option>
100  <option value='SLAVE' <?php if ($val['concerned'] == 'SLAVE') echo "selected=\"selected\""; ?> >SLAVE</option>
101  <option value='BOTH' <?php if ($val['concerned'] == 'BOTH') echo "selected=\"selected\""; ?> >BOTH</option>
102  </select>
103  </td>
104  <td><input type="checkbox" name="domup[<?php echo $i; ?>][enabled]" value="1" <?php if ($val['enabled'] == 1) echo "checked=\"checked\""; ?> /></td>
105  </tr>
106  <?php
107  }
108  ?>
109  <tr>
110  <td colspan='6'><p><input type="submit" class="inb" name="submit" value="<?php __("Save"); ?>" /></p></td>
111  </tr>
112  </table>
113 </form>
114 <?php include_once("foot.php");
115 
exit
Definition: adm_doadd.php:70
$msg
Definition: bootstrap.php:75
__($str)
Definition: functions.php:404
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
$i
$val
Definition: tempovars.php:15
$dom
Definition: whois_test.php:10