Alternc  3.2
Alternc logiel libre pour l'h├ębergement
 All Data Structures Namespaces Files Functions Variables Pages
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  $error=_("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  if (isset($error) && $error) {
46  echo "<p class=\"error\">$error</p></body></html>";
47  }
48 ?>
49 <form method="post" action="<?php if (!$id) echo "aws_doadd.php"; else echo "aws_doedit.php"; ?>" id="main" name="main">
50 <table class="tedit">
51 <tr><th><input type="hidden" name="id" value="<?php echo $id ?>" />
52  <label for="hostname"><?php __("Domain name"); ?></label></th><td>
53 <?php if (!$id) { ?>
54  <select class="inl" name="hostname" id="hostname"><?php $aws->select_host_list($hostname); ?></select>
55 <?php } else { ?>
56  <code><?php echo $hostname; ?></code>
57 <?php } ?>
58 </td></tr>
59 <tr><th><?php __("Hostaliases"); ?></th><td>
60 <?php // TODO : put them on 2 columns (at least)
61 $hl=$aws->host_list();
62 reset($hl);
63 $hatab=$aws->get_hostaliases($id);
64 while (list($key,$val)=each($hl)) {
65  $ho=$val["hostname"];
66  $ty=$val["desc"];
67  echo "<input type=\"checkbox\" name=\"hostaliases[]\" id=\"ha_$ho\" value=\"$ho\"";
68  if (in_array($ho,@explode(" ",$hatab[0]))) echo " checked=\"checked\"";
69  echo " /><label for=\"ha_$ho\">$ho ($ty)</label><br />\n";
70 }
71 ?>
72 </td></tr>
73 <tr><th><?php __("Allowed Users"); ?></th><td>
74 <?php
75 // List the users (and check allowed ones) :
76 $r=$aws->list_allowed_login($id);
77 
78 if (is_array($r)) {
79 ?>
80 <?php
81 foreach($r as $v) {
82  echo "<input type=\"checkbox\" name=\"awsusers[]\" class=\"int\" id=\"u_".htmlentities($v["login"])."\" value=\"".htmlentities($v["login"])."\" ";
83  if ($v["selected"]) echo " checked=\"checked\"";
84  echo "><label for=\"u_".htmlentities($v["login"])."\">".$v["login"]."</label><br />\n";
85 }
86 ?>
87 <?php
88 } else {
89  __("No users currently defined, you must create login with the 'Manage allowed users' accounts' menu.");
90 }
91 
92 ?></td></tr>
93 <tr class="trbtn"><td colspan="2">
94  <input type="submit" class="inb" name="submit" value="<?php if (!$id) __("Create those statistics"); else __("Edit those statistics"); ?>" />
95  <input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='aws_list.php'"/>
96 
97 </td></tr>
98 </table>
99 </form>
100 <?php include_once("foot.php"); ?>