Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
m_aws Class Reference

This class manage awstats statistic sets. More...

Public Member Functions

 m_aws ()
 Constructor.
 hook_menu ()
 alternc_password_policy ()
 Password kind used in this class (hook for admin class)
 alternc_module_description ()
 Name of the module function.
 get_list ()
 Returns an array with all the statistics of a member.
 get_stats_details ($id)
 Return an array with the details for 1 statistic set.
 host_list ()
 Return the list of domains / subdomains allowed for this member with the type (MX,URL,...)
 prefix_list ()
 Returns the list of prefixes that can be used on current account.
 select_prefix_list ($current)
 Echoes <option> tags of all the domains hosted on the account + the login of the account They can be used as a root for the login that may have access to web statistics hosted on an account $current will be the selected value.
 select_host_list ($current)
 Draw options for a select html code with the list of allowed and availables domains for this member.
 check_host_available ($current)
 Check if hosts is already used by awstats of available for this member.
 get_hostaliases ($id)
 Return the hostaliases list with an id.
 put_stats_details ($id, $users, $hostaliases, $public)
 Edit a statistic set (change allowed user list)
 delete_stats ($id)
 Delete a statistic set.
 add_stats ($hostname, $users="", $hostaliases, $public)
 Create a new statistic set.
 list_login ()
 list_allowed_login ($id)
 get_view_public ($id)
 login_exists ($login, $exists=1)
 del_login ($login)
 add_login ($login, $pass)
 change_pass ($login, $pass)
 allow_login ($login, $id, $noconf=0)
 delete_allowed_login ($id, $noconf=0)
 deny_login ($login, $id, $noconf=0)
 alternc_del_member ()
 alternc_del_domain ($dom)
 This function is called on each class when a domain name is uninstalled.
 hook_quota_get ()
 This function is called when we are asked to compute the used quota for a service.
 _check ($login)
 _delconf ($hostname)
 Delete the awstats configuration file for a statistic set.
 _createconf ($id, $nochk=0)
 Create a configuration file for a statistic set.
 _createhtpasswd ()
 alternc_export ()
 Exports all the aws related information for an account.

Data Fields

 $CONFDIR = "/etc/awstats"
 Where are the awstats configuration files : private.
 $HTAFILE = "/etc/alternc/awstats.htpasswd"
 $CACHEDIR = "/var/cache/awstats"
 $TEMPLATEFILE = "/etc/alternc/templates/awstats/awstats.template.conf"
 Where is the template for conf files : private.

Detailed Description

This class manage awstats statistic sets.

Copyleft AlternC Team

Definition at line 33 of file m_aws.php.

Member Function Documentation

_check (   $login)

Definition at line 650 of file m_aws.php.

References $c, $err, $mem, $r, and prefix_list().

Referenced by add_login(), allow_login(), change_pass(), and deny_login().

{
global $err,$mem;
$login=trim($login);
$login=strtolower($login);
if ($c=strpos($login,"_")) {
$prefix=substr($login,0,$c);
$postfix=substr($login,$c+1);
} else {
$prefix=$login;
$postfix="";
}
$r=$this->prefix_list();
if (!in_array($prefix,$r)) {
$err->raise("aws",_("prefix not allowed.")); // prefix not allowed.
return false;
}
if (!preg_match('/^[0-9a-z_-]*$/', $postfix)){
$err->raise("aws",_("Forbidden caracters in the postfix."));
return false;
}
return $login;
}
_createconf (   $id,
  $nochk = 0 
)

Create a configuration file for a statistic set.

if nochk==1, does not check the owner of the stat set (for admin only) private

Definition at line 693 of file m_aws.php.

References $cuid, $db, $err, $uid, and $username.

Referenced by add_stats(), allow_login(), delete_allowed_login(), deny_login(), and put_stats_details().

{
global $db,$err,$cuid,$L_ALTERNC_LOGS;
$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 {
$db->query("SELECT * FROM aws WHERE id='$id' AND uid='$cuid';");
}
if (!$db->num_rows()) {
$err->raise("aws",_("This statistic does not exist"));
return false;
}
$db->next_record();
$uid = $db->f('uid');
$hostname=$db->f("hostname");
$hostaliases=$db->f("hostaliases");
$public=$db->f("public");
$db->query("SELECT login FROM membres WHERE uid = '$uid'");
$db->next_record();
$username = $db->f('login');
$db->query("SELECT login FROM aws_access WHERE id='$id';");
$users="";
while ($db->next_record()) {
$users.=$db->f("login")." ";
}
$replace_vars = array(
'%%UID%%' => $uid,
'%%USER%%' => $username,
'%%ALTERNC_LOGS%%' => $L_ALTERNC_LOGS,
'%%PUBLIC%%' => $public,
'%%HOSTNAME%%' => $hostname,
'%%HOSTALIASES%%' => $hostaliases,
'%%USERS%%' => $users,
);
foreach ($replace_vars as $k=>$v){
$s=str_replace($k,$v,$s);
}
$f=fopen($this->CONFDIR."/awstats.".$hostname.".conf","wb");
fputs($f,$s,strlen($s));
fclose($f);
return true;
}
_createhtpasswd ( )

Definition at line 745 of file m_aws.php.

References $db, and $err.

Referenced by add_login(), add_stats(), allow_login(), alternc_del_domain(), alternc_del_member(), change_pass(), del_login(), delete_allowed_login(), deny_login(), and put_stats_details().

{
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;
}
}
_delconf (   $hostname)

Delete the awstats configuration file for a statistic set.

private

Definition at line 678 of file m_aws.php.

References $err.

Referenced by alternc_del_domain(), alternc_del_member(), and delete_stats().

{
global $err,$action;
if (!preg_match('/^[._a-z0-9-]*$/', $hostname)){
$err->raise("aws",_("Hostname is incorrect"));
return false;
}
$action->del($this->CONFDIR. DIRECTORY_SEPARATOR . "awstats.".$hostname.".conf");
}
add_login (   $login,
  $pass 
)

Definition at line 468 of file m_aws.php.

References $cuid, $db, $err, _check(), _createhtpasswd(), _md5cr(), and login_exists().

{
global $db,$err,$cuid;
$err->log("aws","add_login");
if (!($login=$this->_check($login))) {
$err->raise("aws",_("Login incorrect"));
return false;
}
if ($this->login_exists($login,1)) {
$err->raise("aws",_("Login already exist"));
return false;
}
$pass=_md5cr($pass);
// FIXME retourner une erreur l'insert se passe pas bien
$db->query("INSERT INTO aws_users (uid,login,pass) VALUES ('$cuid','$login','$pass');");
return $this->_createhtpasswd();
}
add_stats (   $hostname,
  $users = "",
  $hostaliases,
  $public 
)

Create a new statistic set.

Parameters
string$hostnameThe domain name
$uersarray the array of users that will be allowed
$hostaliasesarray an array of host aliases
$publicboolean Shall this statistic set be public ?
Returns
boolean TRUE if the set has been created

Definition at line 347 of file m_aws.php.

References $cuid, $db, $err, $key, $mem, $r, $val, _createconf(), _createhtpasswd(), allow_login(), and host_list().

{
global $db,$err,$quota,$mem,$cuid;
$err->log("aws","add_stats",$hostname);
$ha="";
$r=$this->host_list();
$hosts=array();
foreach ($r as $key=>$val) {
$hosts[]=$val["hostname"];
}
reset($hosts);
if (!in_array($hostname,$hosts) || $hostname=="") {
$err->raise("aws",_("This hostname does not exist (Domain name)"));
return false;
}
// Parse the hostaliases array (it should contains valid domains)
if (is_array($hostaliases)) {
foreach($hostaliases as $ho) {
if (!in_array($ho,$hosts) || $hostname=="") {
$err->raise("aws",_("This hostname does not exist (Hostaliases)"));
return false;
}
$ha .= "$ho ";
}
}
if ($quota->cancreate("aws")) {
$db->query("INSERT INTO aws (hostname,uid,hostaliases,public) VALUES ('$hostname','$cuid','$ha','$public')");
$id=$db->lastid();
if (is_array($users)) {
foreach($users as $v) {
$this->allow_login($v,$id, 1);
}
}
if (!$this->_createconf($id) ) return false;
if (!$this->_createhtpasswd() ) return false;
mkdir($this->CACHEDIR."/".$hostname,0777);
return true;
} else {
$err->raise("aws",_("Your stat quota is over..."));
return false;
}
}
allow_login (   $login,
  $id,
  $noconf = 0 
)

Definition at line 507 of file m_aws.php.

References $cuid, $db, $err, _check(), _createconf(), _createhtpasswd(), and login_exists().

Referenced by add_stats(), and put_stats_details().

{ // allow user $login to access stats $id.
global $db,$err,$cuid;
$err->log("aws","allow_login");
if (!($login=$this->_check($login))) {
$err->raise("aws",_("Login incorrect"));
return false;
}
if (!$this->login_exists($login)) {
$err->raise("aws",_("Login does not exist"));
return false;
}
$db->query("SELECT id FROM aws WHERE id='$id' AND uid='$cuid'");
if (!$db->next_record()) {
$err->raise("aws",_("The requested statistic does not exist."));
return false;
}
$db->query("SELECT login FROM aws_access WHERE id='$id' AND login='$login'");
if ($db->next_record()) {
$err->raise("aws",_("This login is already allowed for this statistics."));
return false;
}
$db->query("INSERT INTO aws_access (uid,id,login) VALUES ('$cuid','$id','$login');");
if (!$noconf) {
$this->_createconf($id);
$this->_createhtpasswd();
}
return true;
}
alternc_del_domain (   $dom)

This function is called on each class when a domain name is uninstalled.

Parameters
string$domthe domain to uninstall

Definition at line 613 of file m_aws.php.

References $cuid, $db, $dom, $err, $i, $t, _createhtpasswd(), and _delconf().

{
global $db,$err,$cuid;
$err->log("aws","alternc_del_domain",$dom);
$db=new DB_System();
$db->query("SELECT id,hostname FROM aws WHERE uid='$cuid' AND (hostname='$dom' OR hostname like '%.$dom')");
$t=array();
while ($db->next_record()) {
$t[]=array($db->f("hostname"),$db->f("id"));
}
foreach ($t as $i) {
$db->query("DELETE FROM aws WHERE uid='$cuid' AND hostname='".$i[0]."';");
$db->query("DELETE FROM aws_access WHERE uid='$cuid' AND id='".$i[1]."';");
$this->_delconf($i[0]);
}
return $this->_createhtpasswd();
}
alternc_del_member ( )

Definition at line 590 of file m_aws.php.

References $cuid, $db, $err, $i, $t, _createhtpasswd(), and _delconf().

{
global $db,$err,$cuid;
$err->log("aws","del_member");
$db->query("SELECT * FROM aws WHERE uid='$cuid';");
$t=array();
while ($db->next_record()) {
$t[]=$db->f("hostname");
}
$db->query("DELETE FROM aws WHERE uid='$cuid';");
foreach ($t as $i) {
$this->_delconf($i);
}
$db->query("DELETE FROM aws_access WHERE uid='$cuid'");
$db->query("DELETE FROM aws_users WHERE uid='$cuid';");
return $this->_createhtpasswd();
}
alternc_export ( )

Exports all the aws related information for an account.

private EXPERIMENTAL 'sid' function ;)

Definition at line 768 of file m_aws.php.

References $cuid, $db, $err, $host, and $r.

{
global $db,$err,$cuid;
$err->log("aws","export");
$str="<aws>\n";
$db->query("SELECT login,pass FROM aws_users WHERE uid='$cuid';");
while ($db->next_record()) {
$str.=" <user><login>".$db->Record["login"]."</login><pass hash=\"des\">".$db->Record["pass"]."</pass></user>\n";
}
$r=array();
$db->query("SELECT id, hostname FROM aws WHERE uid='$cuid' ORDER BY hostname;");
while ($db->next_record()) {
$r[$db->Record["id"]]=$db->Record["hostname"];
}
foreach($r as $id=>$host) {
$str.=" <domain>\n <name>".$host."</name>\n";
$db->query("SELECT login FROM aws_access WHERE id='$id';");
while ($db->next_record()) {
$str.=" <user>".$db->Record["login"]."</user>\n";
}
$str.=" </domain>\n";
}
$str.="</aws>\n";
return $str;
}
alternc_module_description ( )

Name of the module function.

Definition at line 81 of file m_aws.php.

{
return array("aws"=>_("The stats module allows any user to ask for statistics about his web site. Statistics are web pages generated daily based on the visits of the day before. Awstats is the soft used to produce those stats. The statistics are then protected by a login and a password."));
}
alternc_password_policy ( )

Password kind used in this class (hook for admin class)

Definition at line 72 of file m_aws.php.

{
return array("aws"=>"Awstats Web Statistics");
}
change_pass (   $login,
  $pass 
)

Definition at line 488 of file m_aws.php.

References $cuid, $db, $err, _check(), _createhtpasswd(), and login_exists().

{
global $db,$err,$cuid;
$err->log("aws","change_pass");
if (!($login=$this->_check($login))) {
$err->raise("aws",_("Login incorrect")); // Login incorrect
return false;
}
if (!($this->login_exists($login))) {
$err->raise("aws",_("Login does not exists")); // Login does not exists
return false;
}
$pass=_md5c($pass);
$db->query("UPDATE aws_users SET pass='$pass' WHERE login='$login';");
return $this->_createhtpasswd();
}
check_host_available (   $current)

Check if hosts is already used by awstats of available for this member.

Definition at line 255 of file m_aws.php.

References $err, $key, $r, $val, and get_list().

Referenced by select_host_list().

{
global $err;
$err->log("aws","check_host_available",$current);
$r=$this->get_list();
if(is_array($r)){
reset($r);
while (list($key,$val)=each($r)) {
if ($current==$val["hostname"]) {
$err->raise("aws",_("Host already managed by awstats!"));
return false;
}
}
}
return true;
}
del_login (   $login)

Definition at line 453 of file m_aws.php.

References $cuid, $db, $err, _createhtpasswd(), and login_exists().

{
global $db,$err,$cuid;
$err->log("aws","del_login");
if (!$this->login_exists($login,1)) {
$err->raise("aws",_("Login does not exist"));
return false;
}
$db->query("DELETE FROM aws_users WHERE uid='$cuid' AND login='$login';");
$db->query("DELETE FROM aws_access WHERE uid='$cuid' AND login='$login';");
$this->_createhtpasswd();
return true;
}
delete_allowed_login (   $id,
  $noconf = 0 
)

Definition at line 539 of file m_aws.php.

References $cuid, $db, $err, _createconf(), and _createhtpasswd().

Referenced by delete_stats(), and put_stats_details().

{
global $db,$err,$cuid;
$err->log("aws","delete_allowed_login");
$db->query("SELECT id FROM aws WHERE id='$id' AND uid='$cuid'");
if (!$db->next_record()) {
$err->raise("aws",_("The requested statistic does not exist."));
return false;
}
$db->query("DELETE FROM aws_access WHERE id='$id';");
if (!$noconf) {
$this->_createconf($id);
$this->_createhtpasswd();
}
return true;
}
delete_stats (   $id)

Delete a statistic set.

Parameters
integer$idThe statistic set ID
Returns
string the domain name of the deleted statistic set, or FALSE if an error occurred

Definition at line 319 of file m_aws.php.

References $cuid, $db, $err, _delconf(), and delete_allowed_login().

{
global $db,$err,$cuid,$action;
$err->log("aws","delete_stats",$id);
$db->query("SELECT hostname FROM aws WHERE id='$id' and uid='$cuid';");
if (!$db->num_rows()) {
$err->raise("aws",_("This statistic does not exist"));
return false;
}
$db->next_record();
$hostname=$db->f("hostname");
$this->delete_allowed_login($id,1);
$this->_delconf($hostname);
$db->query("DELETE FROM aws WHERE id='$id'");
$action->del($this->CACHEDIR. DIRECTORY_SEPARATOR . $hostname . DIRECTORY_SEPARATOR);
return $hostname;
}
deny_login (   $login,
  $id,
  $noconf = 0 
)

Definition at line 558 of file m_aws.php.

References $cuid, $db, $err, _check(), _createconf(), _createhtpasswd(), and login_exists().

{ // deny user $login to access stats $id.
global $db,$err,$cuid;
$err->log("aws","deny_login");
if (!($login=$this->_check($login))) {
$err->raise("aws",_("Login incorrect")); // Login incorrect
return false;
}
if (!$this->login_exists($login,0)) {
$err->raise("aws",_("Login does not exists")); // Login does not exists
return false;
}
$db->query("SELECT id FROM aws WHERE id='$id' AND uid='$cuid'");
if (!$db->next_record()) {
$err->raise("aws",_("The requested statistic does not exist."));
return false;
}
$db->query("SELECT login FROM aws_access WHERE id='$id' AND login='$login'");
if (!$db->next_record()) {
$err->raise("aws",_("This login is already denied for this statistics."));
return false;
}
$db->query("DELETE FROM aws_access WHERE id='$id' AND login='$login';");
if (!$noconf) {
$this->_createconf($id);
$this->_createhtpasswd();
}
return true;
}
get_hostaliases (   $id)

Return the hostaliases list with an id.

Definition at line 276 of file m_aws.php.

References $cuid, $db, $err, and $r.

{
global $db,$err,$cuid;
$r=array();
if ($id == NULL)
return $r;
$db->query("SELECT hostaliases FROM aws WHERE uid='$cuid' and id='$id' ORDER by hostaliases;");
while ($db->next_record()) {
$r[]=$db->f("hostaliases");
}
return $r;
}
get_list ( )

Returns an array with all the statistics of a member.

Returns
array Returns an indexed array of associative arrays like that : $r[0-n]["id"] = Id of the stat set $r[0-n]["hostname"]= domain $r[0-n]["users"]= list of allowed users separated with ' '

Definition at line 96 of file m_aws.php.

References $cuid, $db, $err, $r, and $t.

Referenced by check_host_available().

{
global $db,$err,$cuid;
$err->log("aws","get_list");
$r=array();
$db->query("SELECT id, hostname FROM aws WHERE uid='$cuid' ORDER BY hostname;");
if ($db->num_rows()) {
while ($db->next_record()) {
$r[]=array(
"id"=>$db->f("id"),
"hostname"=>$db->f("hostname")
);
}
$t=array();
foreach ($r as $v) {
$db->query("SELECT login FROM aws_access WHERE id='".$v["id"]."';");
$u="";
while ($db->next_record()) {
$u.=$db->f("login")." ";
}
$t[]=array(
"id"=>$v["id"],
"hostname"=>$v["hostname"],
"users"=>$u
);
}
return $t;
} else {
$err->raise("aws",_("No statistics currently defined"));
return false;
}
}
get_stats_details (   $id)

Return an array with the details for 1 statistic set.

Parameters
integer$idID of the set we want.
Returns
array Returns an associative array as follow : $r["id"] = Id $r["hostname"]= domain $r["users"] = List of allowed users, separated by ' '

Definition at line 139 of file m_aws.php.

References $cuid, $db, $err, and $r.

Referenced by put_stats_details().

{
global $db,$err,$cuid;
$err->log("aws","get_stats_details",$id);
$r=array();
$db->query("SELECT id, hostname, hostaliases, public FROM aws WHERE uid='$cuid' AND id='$id';");
if ($db->num_rows()) {
$db->next_record();
$id=$db->f("id");
$hostname=$db->f("hostname");
$hostaliases=$db->f("hostaliases");
$public=$db->f("public");
$db->query("SELECT login FROM aws_access WHERE id='$id';");
$u="";
while ($db->next_record()) {
$u.=$db->f("login")." ";
}
return array(
"id"=>$id,
"hostname"=>$hostname,
"users"=>$u,
"hostaliases"=>$hostaliases,
"public"=>$public
);
} else {
$err->raise("aws",_("This statistic does not exist"));
return false;
}
}
get_view_public (   $id)

Definition at line 425 of file m_aws.php.

References $cuid, $db, and $err.

{
global $db,$err,$cuid;
$db->query("SELECT public FROM aws WHERE id='$id' and uid='$cuid';");
if ($db->num_rows()) {
$db->next_record();
$pub=$db->f("public");
} else {
$pub=1;
}
return $pub;
}
hook_menu ( )

Definition at line 57 of file m_aws.php.

{
$obj = array(
'title' => _("Web Statistics"),
'ico' => 'images/stat.png',
'link' => 'aws_list.php',
'pos' => 80,
) ;
return $obj;
}
hook_quota_get ( )

This function is called when we are asked to compute the used quota for a service.

Parameters
integer$idThe userid whose quota should be computed.

Definition at line 637 of file m_aws.php.

References $cuid, $db, $err, and $q.

{
global $db,$err,$cuid;
$err->log("aws","get_quota");
$db->query("SELECT COUNT(*) AS cnt FROM aws WHERE uid='$cuid'");
$q=Array("name"=>"aws", "description"=>_("Awstats"), "used"=>0);
if ($db->next_record()) {
$q['used']=$db->f("cnt");
}
return $q;
}
host_list ( )

Return the list of domains / subdomains allowed for this member with the type (MX,URL,...)

Returns
array an array of allowed domains / subdomains.

Definition at line 174 of file m_aws.php.

References $cuid, $db, $err, and $r.

Referenced by add_stats(), and select_host_list().

{
global $db,$err,$cuid;
$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;");
while ($db->next_record()) {
if ($db->f("sub")) {
$r[]=array(
"hostname"=>$db->f("sub").".".$db->f("domaine"),
"type"=>$db->f("name"),
"desc"=>$db->f("description")
);
} else {
$r[]=array(
"hostname"=>$db->f("domaine"),
"type"=>$db->f("name"),
"desc"=>$db->f("description")
);
}
}
return $r;
}
list_allowed_login (   $id)

Definition at line 410 of file m_aws.php.

References $cuid, $db, $err, and $res.

{
global $db,$err,$cuid;
$err->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';");
$res=array();
if (!$db->next_record()) {
return false;
}
do {
$res[]=array("login"=>$db->f("login"),"selected"=>($db->f("id")));
} while ($db->next_record());
return $res;
}
list_login ( )

Definition at line 393 of file m_aws.php.

References $cuid, $db, $err, and $res.

{
global $db,$err,$cuid;
$err->log("aws","list_login");
$db->query("SELECT login FROM aws_users WHERE uid='$cuid';");
$res=array();
if (!$db->next_record()) {
$err->raise("aws",_("No user currently defined"));
return false;
}
do {
$res[]=$db->f("login");
} while ($db->next_record());
return $res;
}
login_exists (   $login,
  $exists = 1 
)

Definition at line 440 of file m_aws.php.

References $cuid, $db, and $err.

Referenced by add_login(), allow_login(), change_pass(), del_login(), and deny_login().

{
global $db,$err,$cuid;
$err->log("aws","list_login");
$db->query("SELECT login FROM aws_users WHERE uid='$cuid' AND login='$login';");
if (!$db->next_record()) {
return ($exists==0);
} else {
return ($exists==1);
}
}
m_aws ( )

Constructor.

Definition at line 54 of file m_aws.php.

{
}
prefix_list ( )

Returns the list of prefixes that can be used on current account.

Returns
array an arry with the list of domains + the login of the account

Definition at line 201 of file m_aws.php.

References $cuid, $db, $mem, and $r.

Referenced by _check(), and select_prefix_list().

{
global $db,$mem,$cuid;
$r=array();
$r[]=$mem->user["login"];
$db->query("SELECT domaine FROM domaines WHERE compte='$cuid' ORDER BY domaine;");
while ($db->next_record()) {
$r[]=$db->f("domaine");
}
return $r;
}
put_stats_details (   $id,
  $users,
  $hostaliases,
  $public 
)

Edit a statistic set (change allowed user list)

Parameters
integer$idthe stat number we change
array$usersthe list of allowed users

Definition at line 296 of file m_aws.php.

References $c, $cuid, $db, $err, _createconf(), _createhtpasswd(), allow_login(), delete_allowed_login(), and get_stats_details().

{
global $err,$db,$cuid;
if ($c=$this->get_stats_details($id)) {
$this->delete_allowed_login($id, 1);
if (is_array($users)) {
foreach($users as $v) {
$this->allow_login($v,$id,1);
}
}
$db->query("UPDATE aws SET hostaliases='$hostaliases', public='$public' where id='$id';");
$this->_createconf($id);
$this->_createhtpasswd();
return true;
} else return false;
}
select_host_list (   $current)

Draw options for a select html code with the list of allowed and availables domains for this member.

Definition at line 237 of file m_aws.php.

References $c, $key, $r, $val, check_host_available(), and host_list().

{
$r=$this->host_list();
reset($r);
while (list($key,$val)=each($r)) {
$ho=$val["hostname"];
$ty=$val["desc"];
if ($current==$ho) $c=" selected=\"selected\""; else $c="";
if ($this->check_host_available($ho)) echo "<option value=\"$ho\"$c>$ho ("._($ty).")</option>";
}
return true;
}
select_prefix_list (   $current)

Echoes <option> tags of all the domains hosted on the account + the login of the account They can be used as a root for the login that may have access to web statistics hosted on an account $current will be the selected value.

Parameters
string$currentThe default selected value
Returns
boolean TRUE.

Definition at line 221 of file m_aws.php.

References $c, $key, $r, $val, and prefix_list().

{
$r=$this->prefix_list();
reset($r);
while (list($key,$val)=each($r)) {
if ($current==$val) $c=" selected=\"selected\""; else $c="";
echo "<option$c>$val</option>";
}
return true;
}

Field Documentation

$CACHEDIR = "/var/cache/awstats"

Definition at line 41 of file m_aws.php.

$CONFDIR = "/etc/awstats"

Where are the awstats configuration files : private.

Definition at line 39 of file m_aws.php.

$HTAFILE = "/etc/alternc/awstats.htpasswd"

Definition at line 40 of file m_aws.php.

$TEMPLATEFILE = "/etc/alternc/templates/awstats/awstats.template.conf"

Where is the template for conf files : private.

Definition at line 47 of file m_aws.php.


The documentation for this class was generated from the following file: