Fixed htpasswd creation for nginx, fixes #722

Thanks to altmir.
This commit is contained in:
Andreas Burchert (scarya)
2011-04-24 01:26:17 +02:00
parent b34c0e268e
commit a97e7d3697

View File

@@ -186,6 +186,7 @@ class nginx
$this->nginx_data[$vhost_filename].= "\t".'access_log /var/log/nginx/access.log;' . "\n"; $this->nginx_data[$vhost_filename].= "\t".'access_log /var/log/nginx/access.log;' . "\n";
$mypath = '';
if($row_ipsandports['vhostcontainer'] == '1') if($row_ipsandports['vhostcontainer'] == '1')
{ {
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); $mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
@@ -550,7 +551,7 @@ class nginx
$x = 0; $x = 0;
while($row_htpasswds = $this->db->fetch_array($result)) while($row_htpasswds = $this->db->fetch_array($result))
{ {
if(count($row_htpasswds['htpasswds']) > 0) if(count($row_htpasswds) > 0)
{ {
$htpasswd_filename = makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $row_htpasswds['customerid'] . '-' . md5($row_htpasswds['path']) . '.htpasswd'); $htpasswd_filename = makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $row_htpasswds['customerid'] . '-' . md5($row_htpasswds['path']) . '.htpasswd');
@@ -559,12 +560,9 @@ class nginx
$this->htpasswds_data[$htpasswd_filename] = ''; $this->htpasswds_data[$htpasswd_filename] = '';
} }
foreach($row['htpasswds'] as $row_htpasswd) $this->htpasswds_data[$htpasswd_filename].= $row_htpasswds['username'] . ':' . $row_htpasswds['password'] . "\n";
{
$this->htpasswds_data[$htpasswd_filename].= $row_htpasswd['username'] . ':' . $row_htpasswd['password'] . "\n";
}
$path = makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1)); $path = makeCorrectDir(substr($row_htpasswds['path'], strlen($domain['documentroot']) - 1));
$returnval[$x]['path'] = $path; $returnval[$x]['path'] = $path;
$returnval[$x]['root'] = makeCorrectDir($domain['documentroot']); $returnval[$x]['root'] = makeCorrectDir($domain['documentroot']);