Alternc  latest
Alternc logiel libre pour l'hébergement
dom_subdoedit.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  * Edit a subdomain parameters
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 
28 $fields = array (
29  "domain" => array ("post", "string", ""),
30  "sub" => array ("post", "string", ""),
31  "type" => array ("post", "string", $dom->type_local),
32  "sub_domain_id" => array ("post", "integer", 0),
33 );
35 
36 // here we get a dynamic-named value
37 $dynamicvar="t_$type";
38 $httpsvar="https_$type";
39 $fields = array (
40  "$dynamicvar" => array ("post", "string", ""),
41  "$httpsvar" => array ("post", "string", ""),
42 );
46 // The dynamic value is now in $value
47 
48 $dom->lock();
49 
50 $dt=$dom->domains_type_lst();
51 if ( (!isset($isinvited) || !$isinvited) && $dt[strtolower($type)]["enable"] != "ALL" ) {
52  $msg->raise("ERROR", "dom", _("This page is restricted to authorized staff"));
53  include("dom_edit.php");
54  exit();
55 }
56 
57 if (empty($sub_domain_id)) $sub_domain_id=null;
58 $r=$dom->set_sub_domain($domain, $sub, $type, $value, $sub_domain_id, $https);
59 
60 $dom->unlock();
61 
62 if (!$r) {
63  if ($sub_domain_id!=0) {
64  $noread=true;
65  include("dom_subedit.php");
66  } else {
67  // it was a creation, not an edit
68  include("dom_edit.php");
69  }
70  exit();
71 } else {
72  $t = time();
73  // TODO: we assume the cron job is at every 5 minutes
74  $noread=false;
75  $msg->raise("INFO", "dom", _("The modifications will take effect at %s. Server time is %s."), array(date('H:i:s', ($t-($t%300)+300)), date('H:i:s', $t)));
76  foreach($fields as $k=>$v) unset($$k);
77 }
78 include("dom_edit.php");
80 
81 ?>
$msg
Definition: bootstrap.php:75
$isinvited
Definition: config.php:204
$domain
Definition: dom_import.php:36
$value
$dynamicvar
$https
exit
$httpsvar
$fields
Edit a subdomain parameters.
$noread
$sub
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
foreach($domaines_user as $domaine) $t
$dom
Definition: whois_test.php:10