Awstats ready for Desktop, TNG
This commit is contained in:
parent
f325f3f5e1
commit
dd3253af2d
|
@ -29,16 +29,16 @@ $error="";
|
|||
reset($_POST);
|
||||
$found=false;
|
||||
while (list($key,$val)=each($_POST)) {
|
||||
if (substr($key,0,4)=="del_") {
|
||||
// Effacement du jeu de stats $val
|
||||
$r=$aws->delete_stats($val);
|
||||
$found=true;
|
||||
if (!$r) {
|
||||
$error.=$err->errstr()."<br />";
|
||||
} else {
|
||||
$error.=sprintf(_("The statistics %s has been successfully deleted"),$r)."<br />";
|
||||
}
|
||||
}
|
||||
if (substr($key,0,4)=="del_") {
|
||||
// Effacement du jeu de stats $val
|
||||
$r=$aws->delete_stats($val);
|
||||
$found=true;
|
||||
if (!$r) {
|
||||
$error.=$err->errstr()."<br />";
|
||||
} else {
|
||||
$error.=sprintf(_("The statistics %s has been successfully deleted"),$r)."<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
*/
|
||||
require_once("../class/config.php");
|
||||
include_once("head.php");
|
||||
?>
|
||||
|
||||
<h3><?php __("Statistics List"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
<?php if (!empty($error)) { echo "<p class=\"error\">$error</p>"; $error=''; } ?>
|
||||
<p>
|
||||
<?php
|
||||
|
||||
$nosta=false;
|
||||
if (!$r=$aws->get_list()) {
|
||||
|
@ -31,25 +39,18 @@ if (!$r=$aws->get_list()) {
|
|||
$nosta=true;
|
||||
}
|
||||
|
||||
if (!empty($error)) { echo "<p class=\"error\">$error</p>"; $error=''; }
|
||||
?>
|
||||
<h3><?php __("Statistics List"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
<p>
|
||||
<span class="ina"><a href="aws_users.php"><?php __("Manage allowed users' accounts"); ?></a></span><br /><br />
|
||||
<?php
|
||||
if ($quota->cancreate("aws")) { ?>
|
||||
<span class="ina"><a href="aws_add.php"><?php __("Create new Statistics"); ?></a></span><br />
|
||||
<?php }
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
if (isset($error) && $error) {
|
||||
echo "<p class=\"error\">$error</p>";
|
||||
}
|
||||
|
||||
if (!$nosta) {
|
||||
?>
|
||||
<span class="ina"><a href="aws_users.php"><?php __("Manage allowed users' accounts"); ?></a></span><br /><br />
|
||||
|
||||
<?php
|
||||
if ($quota->cancreate("aws")) { ?>
|
||||
<span class="ina"><a href="aws_add.php"><?php __("Create new Statistics"); ?></a></span><br />
|
||||
<?php } // cancreate ?>
|
||||
</p>
|
||||
|
||||
<?php if (!$nosta) { ?>
|
||||
|
||||
<form method="post" action="aws_del.php">
|
||||
<table cellspacing="0" cellpadding="4">
|
||||
|
@ -57,27 +58,23 @@ if (!$nosta) {
|
|||
<?php
|
||||
reset($r);
|
||||
$col=1;
|
||||
while (list($key,$val)=each($r))
|
||||
{
|
||||
while (list($key,$val)=each($r)) {
|
||||
$col=3-$col;
|
||||
?>
|
||||
<tr class="lst<?php echo $col; ?>">
|
||||
<td><input type="checkbox" class="inc" id="del_<?php echo $val["id"]; ?>" name="del_<?php echo $val["id"]; ?>" value="<?php echo $val["id"]; ?>" /></td>
|
||||
<td><div class="ina"><a href="aws_edit.php?id=<?php echo $val["id"] ?>"><img src="images/edit.png" alt="<?php __("Edit"); ?>" title="<?php __("Edit"); ?>" /><?php __("Edit"); ?></a></div></td>
|
||||
<td><label for="del_<?php echo $val["id"]; ?>"><?php echo $val["hostname"] ?></label></td>
|
||||
<td><label for="del_<?php echo $val["id"]; ?>" class="retour-auto"><?php echo $val["hostname"] ?></label></td>
|
||||
<td><?php echo $val["users"] ?></td>
|
||||
<td><div class="ina"><img src="images/stat.png" alt="<?php __("View the statistics"); ?>" /><a href="/cgi-bin/awstats.pl?config=<?php echo $val["hostname"]; ?>"><?php __("View the statistics"); ?></a></div></td>
|
||||
<td><div class="ina"><a href="/cgi-bin/awstats.pl?config=<?php echo $val["hostname"]; ?>"><img src="images/stat.png" alt="<?php __("View the statistics"); ?>" /><?php __("View the statistics"); ?></a></div></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
<?php } // while ?>
|
||||
|
||||
?>
|
||||
|
||||
<tr><td colspan="5"><input type="submit" class="inb" name="submit" value="<?php __("Delete the checked Statistics"); ?>" /></td></tr>
|
||||
<tr><td colspan="5"><input type="submit" class="inb" name="submit" onClick='return confirm("<?php __("Are you sure you want to delete the selected statistics?");?>");' value="<?php __("Delete the checked Statistics"); ?>" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
} // if !nosta
|
||||
|
||||
include_once("foot.php");
|
||||
?>
|
||||
<?php include_once("foot.php"); ?>
|
||||
|
|
|
@ -61,7 +61,7 @@ include_once("head.php");
|
|||
<?php
|
||||
if (isset($error) && $error) {
|
||||
?>
|
||||
<p class="error"><?php echo $error ?></p>
|
||||
<p class="error"><?php echo $error ; $error=''; ?></p>
|
||||
<?php } ?>
|
||||
|
||||
<form method="post" action="aws_pass.php" name="main" id="main">
|
||||
|
@ -70,7 +70,7 @@ if (isset($error) && $error) {
|
|||
<?php __("Username"); ?></th><td>
|
||||
<code><?php echo $login; ?></code> <input type="hidden" name="login" value="<?php echo $login; ?>" />
|
||||
</td></tr>
|
||||
<tr><th><label for="pass"><?php __("New Password"); ?></label></th><td><input type="password" class="int" name="pass" id="pass" value="<?php echo $pass; ?>" size="20" maxlength="64" /><?php display_div_generate_password(); ?></td></tr>
|
||||
<tr><th><label for="pass"><?php __("New Password"); ?></label></th><td><input type="password" class="int" name="pass" id="pass" value="<?php echo $pass; ?>" size="20" maxlength="64" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#pass","#passconf"); ?></td></tr>
|
||||
<tr><th><label for="passconf"><?php __("Confirm password"); ?></label></th><td><input type="password" class="int" name="passconf" id="passconf" value="" size="20" maxlength="64" /></td></tr>
|
||||
<tr class="trbtn"><td colspan="2">
|
||||
<input type="submit" class="inb" name="submit" value="<?php __("Change this user's password"); ?>" />
|
||||
|
|
|
@ -25,18 +25,22 @@
|
|||
require_once("../class/config.php");
|
||||
include_once("head.php");
|
||||
|
||||
?>
|
||||
<h3><?php __("Awstats allowed user list"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
<?php
|
||||
|
||||
if (isset($error) && $error) { ?>
|
||||
<p class="error"><?php echo $error; $error=''; ?></p>
|
||||
<?php }
|
||||
|
||||
$nologin=false;
|
||||
if (!$r=$aws->list_login()) {
|
||||
$nologin=true;
|
||||
$error=$err->errstr();
|
||||
}
|
||||
|
||||
?>
|
||||
<h3><?php __("Awstats allowed user list"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
|
||||
<?php
|
||||
if ($quota->cancreate("aws")) { ?>
|
||||
<p><span class="ina"><a href="aws_add.php"><?php __("Create new Statistics"); ?></a></span></p>
|
||||
<?php } ?>
|
||||
|
@ -47,10 +51,10 @@ if (!$r=$aws->list_login()) {
|
|||
<label for="login"><?php __("Username"); ?></label></th><td>
|
||||
<select class="inl" name="prefixe"><?php $aws->select_prefix_list($prefixe); ?></select> <b>_</b> <input type="text" class="int" name="login" id="login" value="" size="20" maxlength="64" />
|
||||
</td></tr>
|
||||
<tr><th><label for="pass"><?php __("Password"); ?></label></th><td><input type="password" class="int" name="pass" id="pass" value="" size="20" maxlength="64" /><?php display_div_generate_password(); ?></td></tr>
|
||||
<tr><th><label for="pass"><?php __("Password"); ?></label></th><td><input type="password" class="int" name="pass" id="pass" value="" size="20" maxlength="64" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#pass","#passconf"); ?></td></tr>
|
||||
<tr><th><label for="passconf"><?php __("Confirm password"); ?></label></th><td><input type="password" class="int" name="passconf" id="passconf" value="" size="20" maxlength="64" /></td></tr>
|
||||
<tr class="trbtn"><td colspan="2">
|
||||
<input type="submit" class="inb" name="submit" value="<?php __("Create this new awstat account"); ?>" />
|
||||
<input type="submit" class="inb" name="submit" value="<?php __("Create this new Awstats user"); ?>" />
|
||||
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='aws_list.php'"/>
|
||||
|
||||
</td></tr>
|
||||
|
@ -85,7 +89,7 @@ foreach ($r as $val) {
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
<tr><td colspan="5"><input type="submit" name="submit" class="inb" value="<?php __("Delete checked accounts"); ?>" /></td></tr>
|
||||
<tr><td colspan="5"><input type="submit" name="submit" class="inb" onClick='return confirm("<?php __("Are you sure you want to delete the selected accounts?");?>");' value="<?php __("Delete checked accounts"); ?>" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -32,9 +32,10 @@
|
|||
$q = $quota->getquota("aws");
|
||||
$r = $quota->getquota("dom");
|
||||
if (isset($q["t"]) && isset($r["u"]) && $q["t"] > 0 && $r["u"] > 0) {
|
||||
|
||||
?>
|
||||
<div class="menu-box">
|
||||
<div class="menu-title"><img src="images/stat.png" alt="<?php __("Web Statistics"); ?>" /> <a href="aws_list.php"><?php __("Web Statistics"); ?></a> (<?= $q["u"]; ?>/<?= $q["t"]; ?>)</div>
|
||||
<a href="aws_list.php">
|
||||
<div class="menu-title"><img src="images/stat.png" alt="<?php __("Web Statistics"); ?>" /> <?php __("Web Statistics"); ?> (<?= $q["u"]; ?>/<?= $q["t"]; ?>)</div>
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -368,8 +368,8 @@ class m_aws {
|
|||
$this->allow_login($v,$id, 1);
|
||||
}
|
||||
}
|
||||
$this->_createconf($id);
|
||||
$this->_createhtpasswd();
|
||||
if (!$this->_createconf($id) ) return false;
|
||||
if (!$this->_createhtpasswd() ) return false;
|
||||
mkdir($this->CACHEDIR."/".$hostname,0777);
|
||||
return true;
|
||||
} else {
|
||||
|
@ -468,9 +468,9 @@ class m_aws {
|
|||
return false;
|
||||
}
|
||||
$pass=crypt($pass);
|
||||
// FIXME retourner une erreur l'insert se passe pas bien
|
||||
$db->query("INSERT INTO aws_users (uid,login,pass) VALUES ('$cuid','$login','$pass');");
|
||||
$this->_createhtpasswd();
|
||||
return true;
|
||||
return $this->_createhtpasswd();
|
||||
}
|
||||
|
||||
|
||||
|
@ -489,8 +489,7 @@ class m_aws {
|
|||
}
|
||||
$pass=crypt($pass);
|
||||
$db->query("UPDATE aws_users SET pass='$pass' WHERE login='$login';");
|
||||
$this->_createhtpasswd();
|
||||
return true;
|
||||
return $this->_createhtpasswd();
|
||||
}
|
||||
|
||||
|
||||
|
@ -590,10 +589,9 @@ class m_aws {
|
|||
foreach ($t as $i) {
|
||||
$this->_delconf($i);
|
||||
}
|
||||
$this->_createhtpasswd();
|
||||
$db->query("DELETE FROM aws_access WHERE uid='$cuid'");
|
||||
$db->query("DELETE FROM aws_users WHERE uid='$cuid';");
|
||||
return true;
|
||||
return $this->_createhtpasswd();
|
||||
}
|
||||
|
||||
|
||||
|
@ -616,8 +614,7 @@ class m_aws {
|
|||
$db->query("DELETE FROM aws_access WHERE uid='$cuid' AND id='".$i[1]."';");
|
||||
$this->_delconf($i[0]);
|
||||
}
|
||||
$this->_createhtpasswd();
|
||||
return true;
|
||||
return $this->_createhtpasswd();
|
||||
}
|
||||
|
||||
|
||||
|
@ -685,7 +682,11 @@ class m_aws {
|
|||
*/
|
||||
function _createconf($id,$nochk=0) {
|
||||
global $db,$err,$cuid;
|
||||
$s=implode("",file($this->TEMPLATEFILE));
|
||||
$s=@implode("",file($this->TEMPLATEFILE));
|
||||
if (!$s) {
|
||||
$err->raise("aws",_("Problem to create the configuration"));
|
||||
return false;
|
||||
}
|
||||
if ($nochk) {
|
||||
$db->query("SELECT * FROM aws WHERE id='$id';");
|
||||
} else {
|
||||
|
@ -716,14 +717,18 @@ class m_aws {
|
|||
|
||||
/* ----------------------------------------------------------------- */
|
||||
function _createhtpasswd() {
|
||||
global $db;
|
||||
$f=fopen($this->HTAFILE,"wb");
|
||||
global $db, $err;
|
||||
$f=@fopen($this->HTAFILE,"wb");
|
||||
if ($f) {
|
||||
$db->query("SELECT login,pass FROM aws_users;");
|
||||
while ($db->next_record()) {
|
||||
fputs($f,$db->f("login").":".$db->f("pass")."\n");
|
||||
}
|
||||
fclose($f);
|
||||
return true;
|
||||
} else {
|
||||
$err->raise("aws",sprintf(_("Problem to edit file %s"), $this->HTAFILE));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue