Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
- fixed a small bug in cron_tasks, which could prevent old htpasswd f…
Browse files Browse the repository at this point in the history
…iles from being deleted

- added patch to enhance usability if you have many emails
- added patch to enhance usability if you have many domains/subdomains


git-svn-id: file:///var/svn/trunk@164 45fdb5c4-e40b-0410-b369-9aab4fe9a275
  • Loading branch information
Martin Burchert committed Apr 20, 2005
1 parent dceac92 commit 45c8b88
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 22 deletions.
58 changes: 42 additions & 16 deletions syscp/customer_domains.php
Expand Up @@ -41,23 +41,49 @@
{
if($action=='')
{
$result=$db->query("SELECT `id`, `customerid`, `domain`, `documentroot`, `isemaildomain`, `caneditdomain`, `iswildcarddomain`, `parentdomainid` FROM `".TABLE_PANEL_DOMAINS."` WHERE `customerid`='".$userinfo['customerid']."' AND `id` <> ".$userinfo['standardsubdomain']." ORDER BY `domain` ASC");
$domains='';
$parentdomains_count=0;
$domains_count=0;
$domain_array=array();
while($row=$db->fetch_array($result))
{
$row['domain'] = $idna_convert->decode($row['domain']);
$domain_array[$row['domain']] = $row;
}
ksort($domain_array);
foreach($domain_array as $row)
{
$row['documentroot']=str_replace($userinfo['documentroot'],'',$row['documentroot']);
eval("\$domains.=\"".getTemplate("domains/domains_domain")."\";");
if($row['parentdomainid'] == '0' && $row['iswildcarddomain'] != '1' && $row['caneditdomain'] == '1')
$result = $db->query(
"SELECT `id`, " .
" `customerid`, " .
" `domain`, " .
" `documentroot`, " .
" `isemaildomain`, " .
" `caneditdomain`, " .
" `iswildcarddomain`, " .
" `parentdomainid` " .
"FROM `".TABLE_PANEL_DOMAINS."` " .
"WHERE `customerid`='".$userinfo['customerid']."' " .
" AND `id` <> ".$userinfo['standardsubdomain']
);
$domains='';
$parentdomains_count=0;
$domains_count=0;
$domain_array=array();
while( $row = $db->fetch_array($result) )
{
$row['domain'] = $idna_convert->decode($row['domain']);
$domainparts = explode('.',$row['domain']);
$domainparts = array_reverse($domainparts);
$sortkey = '';
foreach ($domainparts as $key => $part)
{
$sortkey .= $part.'.';
}
$domain_array[$sortkey] = $row;
}
ksort($domain_array);
$parentdomainid = 0;
foreach($domain_array as $row)
{
$row['documentroot']=str_replace($userinfo['documentroot'],'',$row['documentroot']);

if ($row['parentdomainid'] == 0)
{
eval("\$domains.=\"".getTemplate("domains/domains_delimiter")."\";");
}

eval("\$domains.=\"".getTemplate("domains/domains_domain")."\";");
if($row['parentdomainid'] == '0' && $row['iswildcarddomain'] != '1' && $row['caneditdomain'] == '1')
{
$parentdomains_count++;
}
$domains_count++;
Expand Down
28 changes: 24 additions & 4 deletions syscp/customer_email.php
Expand Up @@ -42,11 +42,31 @@
{
if($action=='')
{
$result=$db->query("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `popaccountid` FROM `".TABLE_MAIL_VIRTUAL."` WHERE `customerid`='".$userinfo['customerid']."' ORDER BY `email` ASC");
$accounts='';
$result = $db->query(
'SELECT `'.TABLE_MAIL_VIRTUAL.'`.`id`, ' .
' `'.TABLE_MAIL_VIRTUAL.'`.`domainid`, ' .
' `'.TABLE_MAIL_VIRTUAL.'`.`email`, ' .
' `'.TABLE_MAIL_VIRTUAL.'`.`email_full`, ' .
' `'.TABLE_MAIL_VIRTUAL.'`.`iscatchall`, ' .
' `'.TABLE_MAIL_VIRTUAL.'`.`destination`, ' .
' `'.TABLE_MAIL_VIRTUAL.'`.`popaccountid`, ' .
' `'.TABLE_PANEL_DOMAINS.'`.`domain` ' .
'FROM `'.TABLE_MAIL_VIRTUAL.'` ' .
'LEFT JOIN `'.TABLE_PANEL_DOMAINS.'` ' .
' ON (`'.TABLE_MAIL_VIRTUAL.'`.`domainid` = `'.TABLE_PANEL_DOMAINS.'`.`id`)' .
'WHERE `'.TABLE_MAIL_VIRTUAL.'`.`customerid`="'.$userinfo['customerid'].'" ' .
'ORDER BY `domainid`, `email` ASC'
);
$accounts='';
$emails_count=0;
while($row=$db->fetch_array($result))
{
$domainname = '';
while($row = $db->fetch_array($result))
{
if ($domainname != $row['domain'])
{
$domainname = $row['domain'];
eval("\$accounts.=\"".getTemplate("email/emails_domain")."\";");
}
$emails_count++;
$row['email'] = $idna_convert->decode($row['email']);
$row['email_full'] = $idna_convert->decode($row['email_full']);
Expand Down
4 changes: 2 additions & 2 deletions syscp/scripts/cron_tasks.php
Expand Up @@ -251,9 +251,9 @@
$htpasswd_file_dirhandle = opendir($settings['system']['apacheconf_directory'].'htpasswd/');
while(false !== ($htpasswd_filename = readdir($htpasswd_file_dirhandle)))
{
if($htpasswd_filename != '.' && $htpasswd_filename != '..' && !in_array($htpasswd_filename,$htpasswd_files))
if($htpasswd_filename != '.' && $htpasswd_filename != '..' && !in_array($htpasswd_filename,$htpasswd_files) && file_exists($settings['system']['apacheconf_directory'].'htpasswd/'.$htpasswd_filename))
{
unlink($htpasswd_filename);
unlink($settings['system']['apacheconf_directory'].'htpasswd/'.$htpasswd_filename);
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions syscp/templates/customer/domains/domains_delimiter.tpl
@@ -0,0 +1,3 @@
<tr>
<td class="maintable" colspan="4">&nbsp;&nbsp;&nbsp;&nbsp;<b>{$row['domain']}</b></td>
</tr>
4 changes: 4 additions & 0 deletions syscp/templates/customer/email/emails_domain.tpl
@@ -0,0 +1,4 @@
<tr>
<td class="maintable" colspan="6">&nbsp;&nbsp;&nbsp;&nbsp;<b>{$domainname}</b></td>
</tr>

0 comments on commit 45c8b88

Please sign in to comment.