classe aws & fichiers section admin associés
This commit is contained in:
parent
8479d79bde
commit
dec3ac1b9a
|
@ -30,7 +30,7 @@ $fields = array (
|
||||||
getFields($fields);
|
getFields($fields);
|
||||||
|
|
||||||
if (!$id && !$quota->cancreate("aws")) {
|
if (!$id && !$quota->cancreate("aws")) {
|
||||||
$error=_("You cannot add any new statistics, your quota is over.");
|
$msg->raise('Alert', "aws", _("You cannot add any new statistics, your quota is over."));
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once("head.php");
|
include_once("head.php");
|
||||||
|
@ -42,9 +42,7 @@ include_once("head.php");
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<?php
|
<?php
|
||||||
if (isset($error) && $error) {
|
echo $msg->msg_html_all();
|
||||||
echo "<p class=\"error\">$error</p></body></html>";
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<form method="post" action="<?php if (!$id) echo "aws_doadd.php"; else echo "aws_doedit.php"; ?>" id="main" name="main">
|
<form method="post" action="<?php if (!$id) echo "aws_doadd.php"; else echo "aws_doedit.php"; ?>" id="main" name="main">
|
||||||
<?php csrf_get(); ?>
|
<?php csrf_get(); ?>
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
*/
|
*/
|
||||||
require_once("../class/config.php");
|
require_once("../class/config.php");
|
||||||
|
|
||||||
$error="";
|
|
||||||
// On parcours les POST_VARS et on repere les del_.
|
// On parcours les POST_VARS et on repere les del_.
|
||||||
reset($_POST);
|
reset($_POST);
|
||||||
$found=false;
|
$found=false;
|
||||||
|
@ -33,16 +32,14 @@ while (list($key,$val)=each($_POST)) {
|
||||||
// Effacement du jeu de stats $val
|
// Effacement du jeu de stats $val
|
||||||
$r=$aws->delete_stats($val);
|
$r=$aws->delete_stats($val);
|
||||||
$found=true;
|
$found=true;
|
||||||
if (!$r) {
|
if ($r) {
|
||||||
$error.=$err->errstr()."<br />";
|
$msg->raise('Ok', "aws", _("The statistics %s has been successfully deleted"),$r);
|
||||||
} else {
|
|
||||||
$error.=sprintf(_("The statistics %s has been successfully deleted"),$r)."<br />";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
$error.=_("Please check the statistics set you want to delete");
|
$msg->raise('Info', "aws", _("Please check the statistics set you want to delete"));
|
||||||
}
|
}
|
||||||
|
|
||||||
include("aws_list.php");
|
include("aws_list.php");
|
||||||
|
|
|
@ -34,17 +34,15 @@ getFields($fields);
|
||||||
if ($aws->check_host_available($hostname)) {
|
if ($aws->check_host_available($hostname)) {
|
||||||
$r=$aws->add_stats($hostname,$awsusers,$hostaliases,1);
|
$r=$aws->add_stats($hostname,$awsusers,$hostaliases,1);
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
$error=$err->errstr();
|
|
||||||
include("aws_add.php");
|
include("aws_add.php");
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
$error=_("The statistics has been successfully created");
|
$msg->raise('Ok', "aws", _("The statistics has been successfully created"));
|
||||||
include("aws_list.php");
|
include("aws_list.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$error=$err->errstr();
|
|
||||||
include("aws_add.php");
|
include("aws_add.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ $fields = array (
|
||||||
getFields($fields);
|
getFields($fields);
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
$error=_("No Statistics selected!");
|
$msg->raise('Error', "aws", _("No Statistics selected!"));
|
||||||
} else {
|
} else {
|
||||||
$ha ="";
|
$ha ="";
|
||||||
foreach($hostaliases as $ho)
|
foreach($hostaliases as $ho)
|
||||||
|
@ -41,11 +41,10 @@ if (!$id) {
|
||||||
|
|
||||||
$r=$aws->put_stats_details($id,$awsusers,$ha,$public);
|
$r=$aws->put_stats_details($id,$awsusers,$ha,$public);
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
$error=$err->errstr();
|
|
||||||
include("aws_edit.php");
|
include("aws_edit.php");
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
$error=_("The Statistics has been successfully changed");
|
$msg->raise('Ok', "aws", _("The Statistics has been successfully changed"));
|
||||||
include("aws_list.php");
|
include("aws_list.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,10 @@ $fields = array (
|
||||||
getFields($fields);
|
getFields($fields);
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
$error=_("No Statistics selected!");
|
$msg->raise('Error', "aws", _("No Statistics selected!"));
|
||||||
} else {
|
} else {
|
||||||
$r=$aws->get_stats_details($id);
|
$r=$aws->get_stats_details($id);
|
||||||
if (!$r) {
|
if ($r) {
|
||||||
$error=$err->errstr();
|
|
||||||
} else {
|
|
||||||
$id=$r["id"];
|
$id=$r["id"];
|
||||||
$hostname=$r["hostname"];
|
$hostname=$r["hostname"];
|
||||||
$awsusers=$r["users"];
|
$awsusers=$r["users"];
|
||||||
|
|
|
@ -24,28 +24,35 @@
|
||||||
*/
|
*/
|
||||||
require_once("../class/config.php");
|
require_once("../class/config.php");
|
||||||
include_once("head.php");
|
include_once("head.php");
|
||||||
|
|
||||||
|
$nosta=false;
|
||||||
|
if (!$r=$aws->get_list()) {
|
||||||
|
$msg->raise('Info', "aws", _("No statistics currently defined"));
|
||||||
|
$nosta=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$create=true;
|
||||||
|
if (!$quota->cancreate("aws")) {
|
||||||
|
$msg->raise('Info', "aws", _("Your stat quota is over..."));
|
||||||
|
$create=false;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h3><?php __("Statistics List"); ?></h3>
|
<h3><?php __("Statistics List"); ?></h3>
|
||||||
<hr id="topbar"/>
|
<hr id="topbar"/>
|
||||||
<br />
|
<br />
|
||||||
<?php if (!empty($error)) { echo "<p class=\"error\">$error</p>"; $error=''; } ?>
|
<?php
|
||||||
|
echo $msg->msg_html_all("<li>", true, true);
|
||||||
|
?>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
|
//echo "<pre>";print_r($mem);echo "</pre>";
|
||||||
$nosta=false;
|
|
||||||
if (!$r=$aws->get_list()) {
|
|
||||||
$error=$err->errstr();
|
|
||||||
$nosta=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($error)) { echo "<p class=\"error\">$error</p>"; $error=''; }
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<span class="ina"><a href="aws_users.php"><?php __("Manage allowed users' accounts"); ?></a></span><br /><br />
|
<span class="ina"><a href="aws_users.php"><?php __("Manage allowed users' accounts"); ?></a></span><br /><br />
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($quota->cancreate("aws")) { ?>
|
if ($create) { ?>
|
||||||
<span class="ina"><a href="aws_add.php"><?php __("Create new Statistics"); ?></a></span><br />
|
<span class="ina"><a href="aws_add.php"><?php __("Create new Statistics"); ?></a></span><br />
|
||||||
<?php } // cancreate ?>
|
<?php } // cancreate ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -26,28 +26,26 @@ require_once("../class/config.php");
|
||||||
|
|
||||||
$fields = array (
|
$fields = array (
|
||||||
"login" => array ("request", "string", ""),
|
"login" => array ("request", "string", ""),
|
||||||
"pass" => array ("request", "string", ""),
|
"pass" => array ("post", "string", ""),
|
||||||
"passconf" => array ("request", "string", ""),
|
"passconf" => array ("post", "string", ""),
|
||||||
|
"confirm" => array ("post", "string", ""),
|
||||||
);
|
);
|
||||||
|
|
||||||
getFields($fields);
|
getFields($fields);
|
||||||
|
|
||||||
if (!$aws->login_exists($login)) {
|
if (!$aws->login_exists($login)) {
|
||||||
$error=$err->errstr();
|
|
||||||
include("aws_users.php");
|
include("aws_users.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pass) {
|
if ($confirm == 1) {
|
||||||
if ($pass != $passconf) {
|
if (empty($pass) || is_null($pass)) {
|
||||||
$error = _("Passwords do not match");
|
$msg->raise('Error', "aws", _("Please enter a password"));
|
||||||
include("aws_users.php");
|
} else if ($pass != $passconf) {
|
||||||
exit();
|
$msg->raise('Error', "aws", _("Passwords do not match"));
|
||||||
} else {
|
} else {
|
||||||
if (!$aws->change_pass($login,$pass)) {
|
if ($aws->change_pass($login,$pass)) {
|
||||||
$error=$err->errstr();
|
$msg->raise('Ok', "aws", _("Password successfuly updated"));
|
||||||
} else {
|
|
||||||
$error = _("Password successfuly updated");
|
|
||||||
include("aws_users.php");
|
include("aws_users.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
@ -56,22 +54,24 @@ if ($pass) {
|
||||||
|
|
||||||
include_once("head.php");
|
include_once("head.php");
|
||||||
|
|
||||||
|
$c=$admin->listPasswordPolicies();
|
||||||
|
$passwd_classcount = $c['aws']['classcount'];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<h3><?php __("Change a user's password"); ?></h3>
|
<h3><?php __("Change a user's password"); ?></h3>
|
||||||
<?php
|
<?php
|
||||||
if (isset($error) && $error) {
|
echo $msg->msg_html_all();
|
||||||
?>
|
?>
|
||||||
<p class="error"><?php echo $error ; $error=''; ?></p>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<form method="post" action="aws_pass.php" name="main" id="main">
|
<form method="post" action="aws_pass.php" name="main" id="main">
|
||||||
<?php csrf_get(); ?>
|
<?php csrf_get(); ?>
|
||||||
|
<input type="hidden" name="confirm" value="1" />
|
||||||
<table class="tedit">
|
<table class="tedit">
|
||||||
<tr><th>
|
<tr><th>
|
||||||
<?php __("Username"); ?></th><td>
|
<?php __("Username"); ?></th><td>
|
||||||
<code><?php echo $login; ?></code> <input type="hidden" name="login" value="<?php echo $login; ?>" />
|
<code><?php echo $login; ?></code> <input type="hidden" name="login" value="<?php echo $login; ?>" />
|
||||||
</td></tr>
|
</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="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",$passwd_classcount); ?></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><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">
|
<tr class="trbtn"><td colspan="2">
|
||||||
<input type="submit" class="inb" name="submit" value="<?php __("Change this user's password"); ?>" />
|
<input type="submit" class="inb" name="submit" value="<?php __("Change this user's password"); ?>" />
|
||||||
|
|
|
@ -33,14 +33,12 @@ $fields = array (
|
||||||
getFields($fields);
|
getFields($fields);
|
||||||
|
|
||||||
if ($pass != $passconf) {
|
if ($pass != $passconf) {
|
||||||
$error = _("Passwords do not match");
|
$msg->raise('Error', "aws", _("Passwords do not match"));
|
||||||
}else{
|
}else{
|
||||||
$r=$aws->add_login($prefixe.(($login)?"_":"").$login,$pass);
|
$r=$aws->add_login($prefixe.(($login)?"_":"").$login,$pass);
|
||||||
|
|
||||||
if (!$r) {
|
if ($r) {
|
||||||
$error=$err->errstr();
|
$msg->raise('Ok', "aws", _("The Awstat account has been successfully created"));
|
||||||
} else {
|
|
||||||
$error=_("The Awstat account has been successfully created");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,17 +24,14 @@
|
||||||
*/
|
*/
|
||||||
require_once("../class/config.php");
|
require_once("../class/config.php");
|
||||||
|
|
||||||
$error="";
|
|
||||||
// On parcours les POST_VARS et on repere les del_.
|
// On parcours les POST_VARS et on repere les del_.
|
||||||
reset($_POST);
|
reset($_POST);
|
||||||
while (list($key,$val)=each($_POST)) {
|
while (list($key,$val)=each($_POST)) {
|
||||||
if (substr($key,0,4)=="del_") {
|
if (substr($key,0,4)=="del_") {
|
||||||
// Effacement du compte ftp $val
|
// Effacement du compte ftp $val
|
||||||
$r=$aws->del_login($val);
|
$r=$aws->del_login($val);
|
||||||
if (!$r) {
|
if ($r) {
|
||||||
$error.=$err->errstr()."<br />";
|
$msg->raise('Ok', "aws", _("The awstat account %s has been successfully deleted"),$val);
|
||||||
} else {
|
|
||||||
$error.=sprintf(_("The awstat account %s has been successfully deleted"),$val)."<br />";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,16 @@ include_once("head.php");
|
||||||
<hr id="topbar"/>
|
<hr id="topbar"/>
|
||||||
<br />
|
<br />
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (isset($error) && $error) { ?>
|
|
||||||
<p class="error"><?php echo $error; $error=''; ?></p>
|
|
||||||
<?php }
|
|
||||||
|
|
||||||
$nologin=false;
|
$nologin=false;
|
||||||
if (!$r=$aws->list_login()) {
|
if (!$r=$aws->list_login()) {
|
||||||
$nologin=true;
|
$nologin=true;
|
||||||
$error=$err->errstr();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo $msg->msg_html_all();
|
||||||
|
|
||||||
|
$c=$admin->listPasswordPolicies();
|
||||||
|
$passwd_classcount = $c['aws']['classcount'];
|
||||||
|
|
||||||
if ($quota->cancreate("aws")) { ?>
|
if ($quota->cancreate("aws")) { ?>
|
||||||
<p><span class="ina"><a href="aws_add.php"><?php __("Create new Statistics"); ?></a></span></p>
|
<p><span class="ina"><a href="aws_add.php"><?php __("Create new Statistics"); ?></a></span></p>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -52,7 +51,7 @@ if (!$r=$aws->list_login()) {
|
||||||
<label for="login"><?php __("Username"); ?></label></th><td>
|
<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" />
|
<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>
|
</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="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",$passwd_classcount); ?></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><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">
|
<tr class="trbtn"><td colspan="2">
|
||||||
<input type="submit" class="inb" name="submit" value="<?php __("Create this new Awstats user"); ?>" />
|
<input type="submit" class="inb" name="submit" value="<?php __("Create this new Awstats user"); ?>" />
|
||||||
|
@ -62,14 +61,8 @@ if (!$r=$aws->list_login()) {
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
if (isset($error) && $error) {
|
|
||||||
?>
|
|
||||||
<p class="error"><?php echo $error ?></p>
|
|
||||||
<?php }
|
|
||||||
|
|
||||||
if (!$nologin) {
|
if (!$nologin) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,8 @@ class m_aws {
|
||||||
* $r[0-n]["users"]= list of allowed users separated with ' '
|
* $r[0-n]["users"]= list of allowed users separated with ' '
|
||||||
*/
|
*/
|
||||||
function get_list() {
|
function get_list() {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","get_list");
|
$msg->log("aws","get_list");
|
||||||
$r=array();
|
$r=array();
|
||||||
$db->query("SELECT id, hostname FROM aws WHERE uid='$cuid' ORDER BY hostname;");
|
$db->query("SELECT id, hostname FROM aws WHERE uid='$cuid' ORDER BY hostname;");
|
||||||
if ($db->num_rows()) {
|
if ($db->num_rows()) {
|
||||||
|
@ -120,7 +120,6 @@ class m_aws {
|
||||||
}
|
}
|
||||||
return $t;
|
return $t;
|
||||||
} else {
|
} else {
|
||||||
$err->raise("aws",_("No statistics currently defined"));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,8 +136,8 @@ class m_aws {
|
||||||
* $r["users"] = List of allowed users, separated by ' '
|
* $r["users"] = List of allowed users, separated by ' '
|
||||||
*/
|
*/
|
||||||
function get_stats_details($id) {
|
function get_stats_details($id) {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","get_stats_details",$id);
|
$msg->log("aws","get_stats_details",$id);
|
||||||
$db->query("SELECT id, hostname, hostaliases, public FROM aws WHERE uid='$cuid' AND id='$id';");
|
$db->query("SELECT id, hostname, hostaliases, public FROM aws WHERE uid='$cuid' AND id='$id';");
|
||||||
if ($db->num_rows()) {
|
if ($db->num_rows()) {
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
|
@ -159,7 +158,7 @@ class m_aws {
|
||||||
"public"=>$public
|
"public"=>$public
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$err->raise("aws",_("This statistic does not exist"));
|
$msg->raise('Error', "aws",_("This statistic does not exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +170,7 @@ class m_aws {
|
||||||
* @return array an array of allowed domains / subdomains.
|
* @return array an array of allowed domains / subdomains.
|
||||||
*/
|
*/
|
||||||
function host_list() {
|
function host_list() {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$r=array();
|
$r=array();
|
||||||
$db->query("SELECT sd.domaine, sd.sub, dt.name, dt.description FROM sub_domaines sd, domaines_type dt WHERE compte='$cuid' AND lower(sd.type) = lower(dt.name) AND dt.only_dns = false ORDER BY domaine,sub;");
|
$db->query("SELECT sd.domaine, sd.sub, dt.name, dt.description FROM sub_domaines sd, domaines_type dt WHERE compte='$cuid' AND lower(sd.type) = lower(dt.name) AND dt.only_dns = false ORDER BY domaine,sub;");
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
|
@ -252,14 +251,14 @@ class m_aws {
|
||||||
* of available for this member.
|
* of available for this member.
|
||||||
*/
|
*/
|
||||||
function check_host_available($current) {
|
function check_host_available($current) {
|
||||||
global $err;
|
global $msg;
|
||||||
$err->log("aws","check_host_available",$current);
|
$msg->log("aws","check_host_available",$current);
|
||||||
$r=$this->get_list();
|
$r=$this->get_list();
|
||||||
if(is_array($r)){
|
if(is_array($r)){
|
||||||
reset($r);
|
reset($r);
|
||||||
while (list($key,$val)=each($r)) {
|
while (list($key,$val)=each($r)) {
|
||||||
if ($current==$val["hostname"]) {
|
if ($current==$val["hostname"]) {
|
||||||
$err->raise("aws",_("Host already managed by awstats!"));
|
$msg->raise('Alert', "aws",_("Host already managed by awstats!"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,7 +272,7 @@ class m_aws {
|
||||||
* Return the hostaliases list with an id.
|
* Return the hostaliases list with an id.
|
||||||
*/
|
*/
|
||||||
function get_hostaliases($id) {
|
function get_hostaliases($id) {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$r=array();
|
$r=array();
|
||||||
if ($id == NULL)
|
if ($id == NULL)
|
||||||
return $r;
|
return $r;
|
||||||
|
@ -293,7 +292,7 @@ class m_aws {
|
||||||
* @param array $users the list of allowed users
|
* @param array $users the list of allowed users
|
||||||
*/
|
*/
|
||||||
function put_stats_details($id,$users,$hostaliases,$public) {
|
function put_stats_details($id,$users,$hostaliases,$public) {
|
||||||
global $err,$db,$cuid;
|
global $msg,$db,$cuid;
|
||||||
if ($this->get_stats_details($id)) {
|
if ($this->get_stats_details($id)) {
|
||||||
$this->delete_allowed_login($id, 1);
|
$this->delete_allowed_login($id, 1);
|
||||||
if (is_array($users)) {
|
if (is_array($users)) {
|
||||||
|
@ -318,11 +317,11 @@ class m_aws {
|
||||||
* @return string the domain name of the deleted statistic set, or FALSE if an error occurred
|
* @return string the domain name of the deleted statistic set, or FALSE if an error occurred
|
||||||
*/
|
*/
|
||||||
function delete_stats($id) {
|
function delete_stats($id) {
|
||||||
global $db,$err,$cuid,$action;
|
global $db,$msg,$cuid,$action;
|
||||||
$err->log("aws","delete_stats",$id);
|
$msg->log("aws","delete_stats",$id);
|
||||||
$db->query("SELECT hostname FROM aws WHERE id='$id' and uid='$cuid';");
|
$db->query("SELECT hostname FROM aws WHERE id='$id' and uid='$cuid';");
|
||||||
if (!$db->num_rows()) {
|
if (!$db->num_rows()) {
|
||||||
$err->raise("aws",_("This statistic does not exist"));
|
$msg->raise('Error', "aws",_("This statistic does not exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
|
@ -346,8 +345,8 @@ class m_aws {
|
||||||
* @return boolean TRUE if the set has been created
|
* @return boolean TRUE if the set has been created
|
||||||
*/
|
*/
|
||||||
function add_stats($hostname,$users="", $hostaliases,$public) {
|
function add_stats($hostname,$users="", $hostaliases,$public) {
|
||||||
global $db,$err,$quota,$mem,$cuid;
|
global $db,$msg,$quota,$mem,$cuid;
|
||||||
$err->log("aws","add_stats",$hostname);
|
$msg->log("aws","add_stats",$hostname);
|
||||||
$ha="";
|
$ha="";
|
||||||
$r=$this->host_list();
|
$r=$this->host_list();
|
||||||
$hosts=array();
|
$hosts=array();
|
||||||
|
@ -356,7 +355,7 @@ class m_aws {
|
||||||
}
|
}
|
||||||
reset($hosts);
|
reset($hosts);
|
||||||
if (!in_array($hostname,$hosts) || $hostname=="") {
|
if (!in_array($hostname,$hosts) || $hostname=="") {
|
||||||
$err->raise("aws",_("This hostname does not exist (Domain name)"));
|
$msg->raise('Error', "aws",_("This hostname does not exist (Domain name)"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +363,7 @@ class m_aws {
|
||||||
if (is_array($hostaliases)) {
|
if (is_array($hostaliases)) {
|
||||||
foreach($hostaliases as $ho) {
|
foreach($hostaliases as $ho) {
|
||||||
if (!in_array($ho,$hosts) || $hostname=="") {
|
if (!in_array($ho,$hosts) || $hostname=="") {
|
||||||
$err->raise("aws",_("This hostname does not exist (Hostaliases)"));
|
$msg->raise('Error', "aws",_("This hostname does not exist (Hostaliases)"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$ha .= "$ho ";
|
$ha .= "$ho ";
|
||||||
|
@ -384,7 +383,7 @@ class m_aws {
|
||||||
mkdir($this->CACHEDIR."/".$hostname,0777);
|
mkdir($this->CACHEDIR."/".$hostname,0777);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$err->raise("aws",_("Your stat quota is over..."));
|
$msg->raise('Alert', "aws",_("Your stat quota is over..."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -392,12 +391,12 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function list_login() {
|
function list_login() {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","list_login");
|
$msg->log("aws","list_login");
|
||||||
$db->query("SELECT login FROM aws_users WHERE uid='$cuid';");
|
$db->query("SELECT login FROM aws_users WHERE uid='$cuid';");
|
||||||
$res=array();
|
$res=array();
|
||||||
if (!$db->next_record()) {
|
if (!$db->next_record()) {
|
||||||
$err->raise("aws",_("No user currently defined"));
|
$msg->raise('Info', "aws",_("No user currently defined"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
@ -409,8 +408,8 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function list_allowed_login($id) {
|
function list_allowed_login($id) {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","list_allowed_login");
|
$msg->log("aws","list_allowed_login");
|
||||||
$db->query("SELECT u.login,a.id FROM aws_users u LEFT JOIN aws_access a ON a.id='$id' AND a.login=u.login WHERE u.uid='$cuid';");
|
$db->query("SELECT u.login,a.id FROM aws_users u LEFT JOIN aws_access a ON a.id='$id' AND a.login=u.login WHERE u.uid='$cuid';");
|
||||||
$res=array();
|
$res=array();
|
||||||
if (!$db->next_record()) {
|
if (!$db->next_record()) {
|
||||||
|
@ -424,7 +423,7 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function get_view_public($id) {
|
function get_view_public($id) {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$db->query("SELECT public FROM aws WHERE id='$id' and uid='$cuid';");
|
$db->query("SELECT public FROM aws WHERE id='$id' and uid='$cuid';");
|
||||||
if ($db->num_rows()) {
|
if ($db->num_rows()) {
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
|
@ -439,8 +438,8 @@ class m_aws {
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
/* Check that a login exists ($exists=1) or doesn't exist ($exists=0) */
|
/* Check that a login exists ($exists=1) or doesn't exist ($exists=0) */
|
||||||
function login_exists($login,$exists=1) {
|
function login_exists($login,$exists=1) {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","list_login");
|
$msg->log("aws","list_login");
|
||||||
$db->query("SELECT login FROM aws_users WHERE uid='$cuid' AND login='$login';");
|
$db->query("SELECT login FROM aws_users WHERE uid='$cuid' AND login='$login';");
|
||||||
if (!$db->next_record()) {
|
if (!$db->next_record()) {
|
||||||
return ($exists==0);
|
return ($exists==0);
|
||||||
|
@ -452,10 +451,10 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function del_login($login) {
|
function del_login($login) {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","del_login");
|
$msg->log("aws","del_login");
|
||||||
if (!$this->login_exists($login,1)) {
|
if (!$this->login_exists($login,1)) {
|
||||||
$err->raise("aws",_("Login does not exist"));
|
$msg->raise('Error', "aws",_("Login does not exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("DELETE FROM aws_users WHERE uid='$cuid' AND login='$login';");
|
$db->query("DELETE FROM aws_users WHERE uid='$cuid' AND login='$login';");
|
||||||
|
@ -467,17 +466,22 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function add_login($login,$pass) {
|
function add_login($login,$pass) {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid,$admin;
|
||||||
$err->log("aws","add_login");
|
$msg->log("aws","add_login");
|
||||||
|
|
||||||
if (!($login=$this->_check($login))) {
|
if (!($login=$this->_check($login))) {
|
||||||
$err->raise("aws",_("Login incorrect"));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($this->login_exists($login,1)) {
|
if ($this->login_exists($login,1)) {
|
||||||
$err->raise("aws",_("Login already exist"));
|
$msg->raise('Error', "aws",_("Login already exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Check this password against the password policy using common API :
|
||||||
|
if (is_callable(array($admin, "checkPolicy"))) {
|
||||||
|
if (!$admin->checkPolicy("aws", $login, $pass)) {
|
||||||
|
return false; // The error has been raised by checkPolicy()
|
||||||
|
}
|
||||||
|
}
|
||||||
$pass=$this->crypt_apr1_md5($pass);
|
$pass=$this->crypt_apr1_md5($pass);
|
||||||
// FIXME retourner une erreur l'insert se passe pas bien
|
// FIXME retourner une erreur l'insert se passe pas bien
|
||||||
$db->query("INSERT INTO aws_users (uid,login,pass) VALUES ('$cuid','$login','$pass');");
|
$db->query("INSERT INTO aws_users (uid,login,pass) VALUES ('$cuid','$login','$pass');");
|
||||||
|
@ -487,17 +491,23 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function change_pass($login,$pass) {
|
function change_pass($login,$pass) {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid,$admin;
|
||||||
$err->log("aws","change_pass");
|
$msg->log("aws","change_pass");
|
||||||
|
|
||||||
if (!($login=$this->_check($login))) {
|
if (!($login=$this->_check($login))) {
|
||||||
$err->raise("aws",_("Login incorrect")); // Login incorrect
|
$msg->raise('Error', "aws",_("Login incorrect")); // Login incorrect
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!($this->login_exists($login))) {
|
if (!($this->login_exists($login))) {
|
||||||
$err->raise("aws",_("Login does not exists")); // Login does not exists
|
$msg->raise('Error', "aws",_("Login does not exists")); // Login does not exists
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Check this password against the password policy using common API :
|
||||||
|
if (is_callable(array($admin, "checkPolicy"))) {
|
||||||
|
if (!$admin->checkPolicy("aws", $login, $pass)) {
|
||||||
|
return false; // The error has been raised by checkPolicy()
|
||||||
|
}
|
||||||
|
}
|
||||||
$pass=$this->crypt_apr1_md5($pass);
|
$pass=$this->crypt_apr1_md5($pass);
|
||||||
$db->query("UPDATE aws_users SET pass='$pass' WHERE login='$login';");
|
$db->query("UPDATE aws_users SET pass='$pass' WHERE login='$login';");
|
||||||
return $this->_createhtpasswd();
|
return $this->_createhtpasswd();
|
||||||
|
@ -506,25 +516,25 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function allow_login($login,$id,$noconf=0) { // allow user $login to access stats $id.
|
function allow_login($login,$id,$noconf=0) { // allow user $login to access stats $id.
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","allow_login");
|
$msg->log("aws","allow_login");
|
||||||
|
|
||||||
if (!($login=$this->_check($login))) {
|
if (!($login=$this->_check($login))) {
|
||||||
$err->raise("aws",_("Login incorrect"));
|
$msg->raise('Error', "aws",_("Login incorrect"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!$this->login_exists($login)) {
|
if (!$this->login_exists($login)) {
|
||||||
$err->raise("aws",_("Login does not exist"));
|
$msg->raise('Error', "aws",_("Login does not exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("SELECT id FROM aws WHERE id='$id' AND uid='$cuid'");
|
$db->query("SELECT id FROM aws WHERE id='$id' AND uid='$cuid'");
|
||||||
if (!$db->next_record()) {
|
if (!$db->next_record()) {
|
||||||
$err->raise("aws",_("The requested statistic does not exist."));
|
$msg->raise('Error', "aws",_("The requested statistic does not exist."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("SELECT login FROM aws_access WHERE id='$id' AND login='$login'");
|
$db->query("SELECT login FROM aws_access WHERE id='$id' AND login='$login'");
|
||||||
if ($db->next_record()) {
|
if ($db->next_record()) {
|
||||||
$err->raise("aws",_("This login is already allowed for this statistics."));
|
$msg->raise('Error', "aws",_("This login is already allowed for this statistics."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("INSERT INTO aws_access (uid,id,login) VALUES ('$cuid','$id','$login');");
|
$db->query("INSERT INTO aws_access (uid,id,login) VALUES ('$cuid','$id','$login');");
|
||||||
|
@ -542,12 +552,12 @@ class m_aws {
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
*/
|
*/
|
||||||
function delete_allowed_login($id,$noconf=0) {
|
function delete_allowed_login($id,$noconf=0) {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","delete_allowed_login");
|
$msg->log("aws","delete_allowed_login");
|
||||||
|
|
||||||
$db->query("SELECT id FROM aws WHERE id='$id' AND uid='$cuid'");
|
$db->query("SELECT id FROM aws WHERE id='$id' AND uid='$cuid'");
|
||||||
if (!$db->next_record()) {
|
if (!$db->next_record()) {
|
||||||
$err->raise("aws",_("The requested statistic does not exist."));
|
$msg->raise('Error', "aws",_("The requested statistic does not exist."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("DELETE FROM aws_access WHERE id='$id';");
|
$db->query("DELETE FROM aws_access WHERE id='$id';");
|
||||||
|
@ -561,25 +571,25 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function deny_login($login,$id,$noconf=0) { // deny user $login to access stats $id.
|
function deny_login($login,$id,$noconf=0) { // deny user $login to access stats $id.
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","deny_login");
|
$msg->log("aws","deny_login");
|
||||||
|
|
||||||
if (!($login=$this->_check($login))) {
|
if (!($login=$this->_check($login))) {
|
||||||
$err->raise("aws",_("Login incorrect")); // Login incorrect
|
$msg->raise('Error', "aws",_("Login incorrect")); // Login incorrect
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!$this->login_exists($login,0)) {
|
if (!$this->login_exists($login,0)) {
|
||||||
$err->raise("aws",_("Login does not exists")); // Login does not exists
|
$msg->raise('Error', "aws",_("Login does not exists")); // Login does not exists
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("SELECT id FROM aws WHERE id='$id' AND uid='$cuid'");
|
$db->query("SELECT id FROM aws WHERE id='$id' AND uid='$cuid'");
|
||||||
if (!$db->next_record()) {
|
if (!$db->next_record()) {
|
||||||
$err->raise("aws",_("The requested statistic does not exist."));
|
$msg->raise('Error', "aws",_("The requested statistic does not exist."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("SELECT login FROM aws_access WHERE id='$id' AND login='$login'");
|
$db->query("SELECT login FROM aws_access WHERE id='$id' AND login='$login'");
|
||||||
if (!$db->next_record()) {
|
if (!$db->next_record()) {
|
||||||
$err->raise("aws",_("This login is already denied for this statistics."));
|
$msg->raise('Error', "aws",_("This login is already denied for this statistics."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("DELETE FROM aws_access WHERE id='$id' AND login='$login';");
|
$db->query("DELETE FROM aws_access WHERE id='$id' AND login='$login';");
|
||||||
|
@ -593,8 +603,8 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function alternc_del_member() {
|
function alternc_del_member() {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","del_member");
|
$msg->log("aws","del_member");
|
||||||
$db->query("SELECT * FROM aws WHERE uid='$cuid';");
|
$db->query("SELECT * FROM aws WHERE uid='$cuid';");
|
||||||
$t=array();
|
$t=array();
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
|
@ -616,8 +626,8 @@ class m_aws {
|
||||||
* @param string $dom the domain to uninstall
|
* @param string $dom the domain to uninstall
|
||||||
*/
|
*/
|
||||||
function alternc_del_domain($dom) {
|
function alternc_del_domain($dom) {
|
||||||
global $err,$cuid;
|
global $msg,$cuid;
|
||||||
$err->log("aws","alternc_del_domain",$dom);
|
$msg->log("aws","alternc_del_domain",$dom);
|
||||||
$db=new DB_System();
|
$db=new DB_System();
|
||||||
$db->query("SELECT id,hostname FROM aws WHERE uid='$cuid' AND (hostname='$dom' OR hostname like '%.$dom')");
|
$db->query("SELECT id,hostname FROM aws WHERE uid='$cuid' AND (hostname='$dom' OR hostname like '%.$dom')");
|
||||||
$t=array();
|
$t=array();
|
||||||
|
@ -639,8 +649,8 @@ class m_aws {
|
||||||
* for a service
|
* for a service
|
||||||
*/
|
*/
|
||||||
function hook_quota_get() {
|
function hook_quota_get() {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","get_quota");
|
$msg->log("aws","get_quota");
|
||||||
$db->query("SELECT COUNT(*) AS cnt FROM aws WHERE uid='$cuid'");
|
$db->query("SELECT COUNT(*) AS cnt FROM aws WHERE uid='$cuid'");
|
||||||
$q=Array("name"=>"aws", "description"=>_("Awstats"), "used"=>0);
|
$q=Array("name"=>"aws", "description"=>_("Awstats"), "used"=>0);
|
||||||
if ($db->next_record()) {
|
if ($db->next_record()) {
|
||||||
|
@ -652,7 +662,7 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function _check($login) {
|
function _check($login) {
|
||||||
global $err,$mem;
|
global $msg,$mem;
|
||||||
$login=trim($login);
|
$login=trim($login);
|
||||||
$login=strtolower($login);
|
$login=strtolower($login);
|
||||||
if ($c=strpos($login,"_")) {
|
if ($c=strpos($login,"_")) {
|
||||||
|
@ -664,11 +674,11 @@ class m_aws {
|
||||||
}
|
}
|
||||||
$r=$this->prefix_list();
|
$r=$this->prefix_list();
|
||||||
if (!in_array($prefix,$r)) {
|
if (!in_array($prefix,$r)) {
|
||||||
$err->raise("aws",_("prefix not allowed.")); // prefix not allowed.
|
$msg->raise('Error', "aws",_("prefix not allowed.")); // prefix not allowed.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!preg_match('/^[0-9a-z_-]*$/', $postfix)){
|
if (!preg_match('/^[0-9a-z_-]*$/', $postfix)){
|
||||||
$err->raise("aws",_("Forbidden caracters in the postfix."));
|
$msg->raise('Error', "aws", _("There is some forbidden characters in the login (only A-Z 0-9 _ and - are allowed)")); // à traduire
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $login;
|
return $login;
|
||||||
|
@ -680,9 +690,9 @@ class m_aws {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _delconf($hostname) {
|
function _delconf($hostname) {
|
||||||
global $err,$action;
|
global $msg,$action;
|
||||||
if (!preg_match('/^[._a-z0-9-]*$/', $hostname)){
|
if (!preg_match('/^[._a-z0-9-]*$/', $hostname)){
|
||||||
$err->raise("aws",_("Hostname is incorrect"));
|
$msg->raise('Error', "aws",_("Hostname is incorrect"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$action->del($this->CONFDIR. DIRECTORY_SEPARATOR . "awstats.".$hostname.".conf");
|
$action->del($this->CONFDIR. DIRECTORY_SEPARATOR . "awstats.".$hostname.".conf");
|
||||||
|
@ -695,10 +705,10 @@ class m_aws {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _createconf($id,$nochk=0) {
|
function _createconf($id,$nochk=0) {
|
||||||
global $db,$err,$cuid,$L_ALTERNC_LOGS;
|
global $db,$msg,$cuid,$L_ALTERNC_LOGS;
|
||||||
$s=@implode("",file($this->TEMPLATEFILE));
|
$s=@implode("",file($this->TEMPLATEFILE));
|
||||||
if (!$s) {
|
if (!$s) {
|
||||||
$err->raise("aws",_("Problem to create the configuration"));
|
$msg->raise('Error', "aws",_("Problem to create the configuration"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($nochk) {
|
if ($nochk) {
|
||||||
|
@ -707,7 +717,7 @@ class m_aws {
|
||||||
$db->query("SELECT * FROM aws WHERE id='$id' AND uid='$cuid';");
|
$db->query("SELECT * FROM aws WHERE id='$id' AND uid='$cuid';");
|
||||||
}
|
}
|
||||||
if (!$db->num_rows()) {
|
if (!$db->num_rows()) {
|
||||||
$err->raise("aws",_("This statistic does not exist"));
|
$msg->raise('Error', "aws",_("This statistic does not exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
|
@ -747,7 +757,7 @@ class m_aws {
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
function _createhtpasswd() {
|
function _createhtpasswd() {
|
||||||
global $db, $err;
|
global $db, $msg;
|
||||||
$f=@fopen($this->HTAFILE,"wb");
|
$f=@fopen($this->HTAFILE,"wb");
|
||||||
if ($f) {
|
if ($f) {
|
||||||
$db->query("SELECT login,pass FROM aws_users;");
|
$db->query("SELECT login,pass FROM aws_users;");
|
||||||
|
@ -757,7 +767,7 @@ class m_aws {
|
||||||
fclose($f);
|
fclose($f);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$err->raise("aws",sprintf(_("Problem to edit file %s"), $this->HTAFILE));
|
$msg->raise('Error', "aws", _("Problem to edit file %s"), $this->HTAFILE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -770,8 +780,8 @@ class m_aws {
|
||||||
* EXPERIMENTAL 'sid' function ;)
|
* EXPERIMENTAL 'sid' function ;)
|
||||||
*/
|
*/
|
||||||
function alternc_export() {
|
function alternc_export() {
|
||||||
global $db,$err,$cuid;
|
global $db,$msg,$cuid;
|
||||||
$err->log("aws","export");
|
$msg->log("aws","export");
|
||||||
$str="<aws>\n";
|
$str="<aws>\n";
|
||||||
$db->query("SELECT login,pass FROM aws_users WHERE uid='$cuid';");
|
$db->query("SELECT login,pass FROM aws_users WHERE uid='$cuid';");
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
|
|
Loading…
Reference in New Issue