Correction classe de gestion des htaccess
This commit is contained in:
parent
68888932dd
commit
69e61fa096
|
@ -52,7 +52,7 @@ if (!$hta->change_pass($user,$newpass,$dir)) {
|
||||||
<hr id="topbar"/>
|
<hr id="topbar"/>
|
||||||
<br />
|
<br />
|
||||||
<?php
|
<?php
|
||||||
if ($error) {
|
if (isset($error) && $error) {
|
||||||
echo "<p class=\"error\">$error</p>";
|
echo "<p class=\"error\">$error</p>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -42,7 +42,7 @@ else {
|
||||||
<hr id="topbar"/>
|
<hr id="topbar"/>
|
||||||
<br />
|
<br />
|
||||||
<?php
|
<?php
|
||||||
if ($error) {
|
if (isset($error) && $error) {
|
||||||
echo "<p class=\"error\">$error</p>";
|
echo "<p class=\"error\">$error</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ class m_hta {
|
||||||
* Returns the list of all user folder currently protected by a .htpasswd file
|
* Returns the list of all user folder currently protected by a .htpasswd file
|
||||||
* @return array Array containing user folder list
|
* @return array Array containing user folder list
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function ListDir(){
|
function ListDir(){
|
||||||
global$err,$mem,$L_ALTERNC_LOC;
|
global$err,$mem,$L_ALTERNC_LOC;
|
||||||
$err->log("hta","listdir");
|
$err->log("hta","listdir");
|
||||||
|
@ -114,14 +115,14 @@ class m_hta {
|
||||||
$err->raise("hta",4);
|
$err->raise("hta",4);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$pattern="/^".preg_quote($L_ALTERNC_LOC,"/")."\/html\/.\/[^\/]*\/(.*)\/\.htpasswd/";
|
||||||
for($i=0;$i<count($sortie);$i++){
|
for($i=0;$i<count($sortie);$i++){
|
||||||
preg_match("/^".addslashes("$L_ALTERNC_LOC/html/")."\/.\/[^\/]*\/(.*)\/\.htpasswd/", $sortie[$i], $matches);
|
preg_match($pattern,$sortie[$i],$matches);
|
||||||
$r[$i]=$matches[1]."/";
|
$r[$i]=$matches[1]."/";
|
||||||
}
|
}
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* Tells if a folder is protected.
|
* Tells if a folder is protected.
|
||||||
|
@ -191,11 +192,11 @@ class m_hta {
|
||||||
$err->raise("hta",8,$dir);
|
$err->raise("hta",8,$dir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!unlink("$dir/.htaccess")) {
|
if (!@unlink("$dir/.htaccess")) {
|
||||||
$err->raise("hta",5,$dir);
|
$err->raise("hta",5,$dir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!unlink("$dir/.htpasswd")) {
|
if (!@unlink("$dir/.htpasswd")) {
|
||||||
$err->raise("hta",6,$dir);
|
$err->raise("hta",6,$dir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +315,7 @@ class m_hta {
|
||||||
|
|
||||||
// Check this password against the password policy using common API :
|
// Check this password against the password policy using common API :
|
||||||
if (is_callable(array($admin,"checkPolicy"))) {
|
if (is_callable(array($admin,"checkPolicy"))) {
|
||||||
if (!$admin->checkPolicy("hta",$user,$password)) {
|
if (!$admin->checkPolicy("hta",$user,$newpass)) {
|
||||||
return false; // The error has been raised by checkPolicy()
|
return false; // The error has been raised by checkPolicy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue