Alternc  latest
Alternc logiel libre pour l'hébergement
aws_add.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  AlternC - Web Hosting System
5  Copyright (C) 2000-2012 by the AlternC Development Team.
6  https://alternc.org/
7  ----------------------------------------------------------------------
8  LICENSE
9 
10  This program is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License (GPL)
12  as published by the Free Software Foundation; either version 2
13  of the License, or (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  To read the license please visit http://www.gnu.org/copyleft/gpl.html
21  ----------------------------------------------------------------------
22  Purpose of file: Create a new awstat statistic set.
23  ----------------------------------------------------------------------
24 */
25 require_once("../class/config.php");
26 
27 $fields = array (
28  "id" => array ("request", "integer", 0),
29 );
31 
32 if (!$id && !$quota->cancreate("aws")) {
33  $msg->raise('Alert', "aws", _("You cannot add any new statistics, your quota is over."));
34 }
35 
36 include_once("head.php");
37 ?>
38 <h3><?php if (!$id) { __("New Statistics"); } else { __("Edit Statistics"); } ?></h3>
39 <hr id="topbar"/>
40 <br />
41 <?php __("Awstats will analyze every logs availables for this domain (since its creation).");?>
42 <br/>
43 <br/>
44 <?php
45 echo $msg->msg_html_all();
46 ?>
47 <form method="post" action="<?php if (!$id) echo "aws_doadd.php"; else echo "aws_doedit.php"; ?>" id="main" name="main">
48 <?php csrf_get(); ?>
49 <table class="tedit">
50 <tr><th><input type="hidden" name="id" value="<?php echo $id ?>" />
51  <label for="hostname"><?php __("Domain name"); ?></label></th><td>
52 <?php if (!$id) { ?>
53  <select class="inl" name="hostname" id="hostname"><?php $aws->select_host_list($hostname); ?></select>
54 <?php } else { ?>
55  <code><?php echo $hostname; ?></code>
56 <?php } ?>
57 </td></tr>
58 <tr><th><?php __("Hostaliases"); ?></th><td>
59 <?php // TODO : put them on 2 columns (at least)
60 $hl=$aws->host_list();
61 reset($hl);
62 $hatab=$aws->get_hostaliases($id);
63 while (list($key,$val)=each($hl)) {
64  $ho=$val["hostname"];
65  $ty=$val["desc"];
66  echo "<input type=\"checkbox\" name=\"hostaliases[]\" id=\"ha_$ho\" value=\"$ho\"";
67  if (in_array($ho,@explode(" ",$hatab[0]))) echo " checked=\"checked\"";
68  echo " /><label for=\"ha_$ho\">$ho ($ty)</label><br />\n";
69 }
70 ?>
71 </td></tr>
72 <tr><th><?php __("Allowed Users"); ?></th><td>
73 <?php
74 // List the users (and check allowed ones) :
75 $r=$aws->list_allowed_login($id);
76 
77 if (is_array($r)) {
78 ?>
79 <?php
80 foreach($r as $v) {
81  echo "<input type=\"checkbox\" name=\"awsusers[]\" class=\"int\" id=\"u_".htmlentities($v["login"])."\" value=\"".htmlentities($v["login"])."\" ";
82  if ($v["selected"]) echo " checked=\"checked\"";
83  echo "><label for=\"u_".htmlentities($v["login"])."\">".$v["login"]."</label><br />\n";
84 }
85 ?>
86 <?php
87 } else {
88  __("No users currently defined, you must create login with the 'Manage allowed users' accounts' menu.");
89 }
90 
91 ?></td></tr>
92 <tr class="trbtn"><td colspan="2">
93  <input type="submit" class="inb" name="submit" value="<?php if (!$id) __("Create those statistics"); else __("Edit those statistics"); ?>" />
94  <input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='aws_list.php'"/>
95 
96 </td></tr>
97 </table>
98 </form>
99 <?php include_once("foot.php"); ?>
$msg
Definition: bootstrap.php:75
$r
Definition: aws_add.php:75
$fields
Definition: aws_add.php:27
__($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
if(!isset($is_include)) if(! $key &&! $crt) $id
$val
Definition: tempovars.php:15
if(empty($_POST['key'])||empty($_POST['val'])) $key
Definition: tempovars.php:14