mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
Merge remote-tracking branch 'svnexport/master'
This commit is contained in:
commit
59686db0fe
11 files changed
+58
-154
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ url_editactive = editactive.php?table=
|
||||
url_list_admin = list-admin.php
|
||||
url_create_admin = edit.php?table=admin
|
||||
# list-domain
|
||||
url_list_domain = list-domain.php
|
||||
url_list_domain = list.php?table=domain
|
||||
url_edit_domain = edit.php?table=domain
|
||||
# list-virtual
|
||||
url_list_virtual = list-virtual.php
|
||||
|
||||
@@ -376,6 +376,7 @@ z-index:100;
|
||||
margin-top:-14px;
|
||||
}
|
||||
.quota_bg { background-color: white; z-index:98; width:120px; height:14px;margin-top:-1px;margin-left:-1px; border: 1px solid #999;}
|
||||
.quota_no_border { border:none; margin:0; }
|
||||
.quota_high { background: url(../images/quota-colors.png) repeat-x 0 -28px #f90509; }
|
||||
.quota_mid { background: url(../images/quota-colors.png) repeat-x 0 -14px #e3e909; }
|
||||
.quota_low { background: url(../images/quota-colors.png) repeat-x 0 0px #05f905; }
|
||||
|
||||
+5
-3
@@ -1322,8 +1322,9 @@ function db_get_boolean($bool) {
|
||||
*/
|
||||
function db_quota_text($count, $quota, $fieldname) {
|
||||
return " CASE $quota
|
||||
WHEN '-1' THEN coalesce($count,0)
|
||||
ELSE CONCAT(coalesce($count,0), ' / ', $quota)
|
||||
WHEN '-1' THEN CONCAT(coalesce($count,0), ' / -')
|
||||
WHEN '0' THEN CONCAT(coalesce($count,0), ' / ', '" . escape_string(html_entity_decode('∞')) . "')
|
||||
ELSE CONCAT(coalesce($count,0), ' / ', $quota)
|
||||
END AS $fieldname";
|
||||
}
|
||||
|
||||
@@ -1335,8 +1336,9 @@ function db_quota_text($count, $quota, $fieldname) {
|
||||
* @return string
|
||||
*/
|
||||
function db_quota_percent($count, $quota, $fieldname) {
|
||||
return " CASE $quota
|
||||
return " CASE $quota
|
||||
WHEN '-1' THEN -1
|
||||
WHEN '0' THEN -1
|
||||
ELSE round(100 * coalesce($count,0) / $quota)
|
||||
END AS $fieldname";
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ $PALANG['missing_field'] = 'Das Feld %s fehlt';
|
||||
$PALANG['must_be_numeric'] = '%s muss numerisch sein';
|
||||
$PALANG['must_be_boolean'] = "%s muss ein Bool'scher Wert sein";
|
||||
$PALANG['invalid_value_given'] = 'Ungültiger Wert für %s angegeben';
|
||||
$PALANG['edit_not_allowed'] = 'Sie dülrfen %s nicht bearbeiten!';
|
||||
$PALANG['edit_not_allowed'] = 'Sie dürfen %s nicht bearbeiten!';
|
||||
$PALANG['searchparams'] = 'Suchparameter:';
|
||||
|
||||
$PALANG['pFooter_logged_as'] = 'Angemeldet als %s';
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php /**
|
||||
* Postfix Admin
|
||||
*
|
||||
* LICENSE
|
||||
* This source file is subject to the GPL license that is bundled with
|
||||
* this package in the file LICENSE.TXT.
|
||||
*
|
||||
* Further details on the project are available at http://postfixadmin.sf.net
|
||||
*
|
||||
* @version $Id$
|
||||
* @license GNU GPL v2 or later.
|
||||
*
|
||||
* File: list-domain.php
|
||||
* List all domains as a quick overview.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('common.php');
|
||||
|
||||
authentication_require_role('admin');
|
||||
|
||||
# default: domain admin restrictions
|
||||
$admin_username = authentication_get_username();
|
||||
$list_admins = array(authentication_get_username());
|
||||
$is_superadmin = 0;
|
||||
$fUsername = "";
|
||||
|
||||
if (authentication_has_role('global-admin')) { # more permissions? Fine!
|
||||
$list_admins = array_keys(list_admins());
|
||||
$is_superadmin = 1;
|
||||
|
||||
$fUsername = safepost('fUsername', safeget('username', authentication_get_username())); # prefer POST over GET variable
|
||||
if ($fUsername != "") {
|
||||
$admin_username = $fUsername;
|
||||
}
|
||||
}
|
||||
|
||||
$handler = new DomainHandler(0, $admin_username);
|
||||
$handler->getList('');
|
||||
$domain_properties = $handler->result();
|
||||
|
||||
$smarty->assign ('domain_properties', $domain_properties);
|
||||
$smarty->assign ('select_options', select_options($list_admins, array ($fUsername)), false);
|
||||
if ($is_superadmin) {
|
||||
$smarty->assign('smarty_template', 'adminlistdomain');
|
||||
} else {
|
||||
$smarty->assign ('smarty_template', 'overview-get');
|
||||
}
|
||||
|
||||
$smarty->display ('index.tpl');
|
||||
|
||||
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
|
||||
?>
|
||||
+3
-3
@@ -46,7 +46,7 @@ if (count($list_domains) == 0) {
|
||||
} else {
|
||||
flash_error($PALANG['no_domains_for_this_admin']);
|
||||
}
|
||||
header("Location: list-domain.php"); # no domains (for this admin at least) - redirect to domain list
|
||||
header("Location: list.php?table=domain"); # no domains (for this admin at least) - redirect to domain list
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -59,14 +59,14 @@ if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) {
|
||||
if(!in_array($fDomain, $list_domains)) {
|
||||
flash_error( $PALANG['invalid_parameter'] );
|
||||
unset($_SESSION['list-virtual:domain']);
|
||||
header("Location: list-domain.php"); # invalid domain, or not owned by this admin
|
||||
header("Location: list.php?table=domain"); # invalid domain, or not owned by this admin
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!check_owner(authentication_get_username(), $fDomain)) {
|
||||
flash_error( $PALANG['invalid_parameter'] . " If you see this message, please open a bugreport"); # this check is most probably obsoleted by the in_array() check above
|
||||
unset($_SESSION['list-virtual:domain']);
|
||||
header("Location: list-domain.php"); # domain not owned by this admin
|
||||
header("Location: list.php?table=domain"); # domain not owned by this admin
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
+38
-15
@@ -33,8 +33,12 @@ class DomainHandler extends PFAHandler {
|
||||
$super = $this->is_superadmin;
|
||||
|
||||
$transp = min($super, Config::intbool('transport'));
|
||||
$quota = min($super, Config::intbool('quota'));
|
||||
$dom_q = min($super, Config::intbool('domain_quota'));
|
||||
$editquota = min($super, Config::intbool('quota'));
|
||||
$quota = Config::intbool('quota');
|
||||
$edit_dom_q = min($super, Config::intbool('domain_quota'));
|
||||
$dom_q = Config::intbool('domain_quota');
|
||||
|
||||
$query_used_domainquota = 'round(coalesce(__total_quota/' . intval(Config::read('quota_multiplier')) . ',0))';
|
||||
|
||||
# NOTE: There are dependencies between alias_count, mailbox_count and total_quota.
|
||||
# NOTE: If you disable "display in list" for one of them, the SQL query for the others might break.
|
||||
@@ -43,35 +47,54 @@ class DomainHandler extends PFAHandler {
|
||||
$this->struct=array(
|
||||
# field name allow display in... type $PALANG label $PALANG description default / options / ...
|
||||
# editing? form list
|
||||
'domain' => pacol( $this->new, 1, 1, 'text', 'domain' , '' ),
|
||||
'description' => pacol( $super, 1, 1, 'text', 'description' , '' ),
|
||||
'aliases' => pacol( $super, $super, 1, 'num' , 'aliases' , 'pAdminEdit_domain_aliases_text' , Config::read('aliases') ),
|
||||
'domain' => pacol( $this->new, 1, 1, 'text', 'domain' , '' , '', '',
|
||||
array('linkto' => 'list-virtual.php?domain=%s') ),
|
||||
'description' => pacol( $super, $super, $super, 'text', 'description' , '' ),
|
||||
|
||||
# Aliases
|
||||
'aliases' => pacol( $super, $super, 0, 'num' , 'aliases' , 'pAdminEdit_domain_aliases_text' , Config::read('aliases') ),
|
||||
'alias_count' => pacol( 0, 0, 1, 'vnum', '' , '' , '', '',
|
||||
/*not_in_db*/ 0,
|
||||
/*dont_write_to_db*/ 1,
|
||||
/*select*/ 'coalesce(__alias_count,0) - coalesce(__mailbox_count,0) as alias_count',
|
||||
/*extrafrom*/ 'left join ( select count(*) as __alias_count, domain as __alias_domain from ' . table_by_key('alias') .
|
||||
' group by domain) as __alias on domain = __alias_domain'),
|
||||
'mailboxes' => pacol( $super, $super, 1, 'num' , 'mailboxes' , 'pAdminEdit_domain_aliases_text' , Config::read('mailboxes') ),
|
||||
'aliases_quot' => pacol( 0, 0, 1, 'quot', 'aliases' , '' , 0, '',
|
||||
array('select' => db_quota_text( '__alias_count - __mailbox_count', 'aliases', 'aliases_quot')) ),
|
||||
'_aliases_quot_percent' => pacol( 0, 0, 1, 'vnum', '' ,'' , 0, '',
|
||||
array('select' => db_quota_percent('__alias_count - __mailbox_count', 'aliases', '_aliases_quot_percent')) ),
|
||||
|
||||
# Mailboxes
|
||||
'mailboxes' => pacol( $super, $super, 0, 'num' , 'mailboxes' , 'pAdminEdit_domain_aliases_text' , Config::read('mailboxes') ),
|
||||
'mailbox_count' => pacol( 0, 0, 1, 'vnum', '' , '' , '', '',
|
||||
/*not_in_db*/ 0,
|
||||
/*dont_write_to_db*/ 1,
|
||||
/*select*/ 'coalesce(__mailbox_count,0) as mailbox_count',
|
||||
/*extrafrom*/ 'left join ( select count(*) as __mailbox_count, sum(quota) as __total_quota, domain as __mailbox_domain from ' . table_by_key('mailbox') .
|
||||
' group by domain) as __mailbox on domain = __mailbox_domain'),
|
||||
'maxquota' => pacol( $quota, $quota, $quota, 'num' , 'pAdminEdit_domain_maxquota' , 'pAdminEdit_domain_maxquota_text' , Config::read('maxquota') ),
|
||||
'total_quota' => pacol( 0, 0, 1, 'vnum', '' , '' , '', '',
|
||||
/*not_in_db*/ 0,
|
||||
/*dont_write_to_db*/ 1,
|
||||
/*select*/ 'round(coalesce(__total_quota/' . intval(Config::read('quota_multiplier')) . ',0)) as total_quota' /*extrafrom*//* already in mailbox_count */ ),
|
||||
'quota' => pacol( $dom_q, $dom_q, $dom_q, 'num' , 'pAdminEdit_domain_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('domain_quota_default') ),
|
||||
'mailboxes_quot' => pacol( 0, 0, 1, 'quot', 'mailboxes' , '' , 0, '',
|
||||
array('select' => db_quota_text( '__mailbox_count', 'mailboxes', 'mailboxes_quot')) ),
|
||||
'_mailboxes_quot_percent' => pacol( 0, 0, 1, 'vnum', '' , '' , 0, '',
|
||||
array('select' => db_quota_percent('__mailbox_count', 'mailboxes', '_mailboxes_quot_percent')) ),
|
||||
|
||||
'maxquota' => pacol($editquota,$editquota,$quota, 'num' , 'pOverview_get_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('maxquota') ),
|
||||
|
||||
# Domain quota
|
||||
'quota' => pacol($edit_dom_q,$edit_dom_q, 0, 'num', 'pAdminEdit_domain_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('domain_quota_default') ),
|
||||
'total_quota' => pacol( 0, 0, 1, 'vnum', 'total_quota' , '' , '', '',
|
||||
array('select' => "$query_used_domainquota AS total_quota") /*extrafrom*//* already in mailbox_count */ ),
|
||||
'total_quot' => pacol( 0, 0, 1, 'quot', 'pAdminEdit_domain_quota' , '' , 0, '',
|
||||
array('select' => db_quota_text( $query_used_domainquota, 'quota', 'total_quot')) ),
|
||||
'_total_quot_percent'=> pacol( 0, 0, 1, 'vnum', '' , '' , 0, '',
|
||||
array('select' => db_quota_percent($query_used_domainquota, 'quota', '_total_quot_percent')) ),
|
||||
|
||||
'transport' => pacol( $transp, $transp,$transp,'enum', 'transport' , 'pAdminEdit_domain_transport_text' , Config::read('transport_default') ,
|
||||
/*options*/ Config::read('transport_options') ),
|
||||
'backupmx' => pacol( $super, $super, 1, 'bool', 'pAdminEdit_domain_backupmx' , '' , 0),
|
||||
'active' => pacol( $super, $super, 1, 'bool', 'active' , '' , 1 ),
|
||||
'default_aliases' => pacol( $this->new, $this->new, 0, 'bool', 'pAdminCreate_domain_defaultaliases', '' , 1,'', /*not in db*/ 1 ),
|
||||
'created' => pacol( 0, 0, 1, 'ts', 'created' , '' ),
|
||||
'modified' => pacol( 0, 0, 1, 'ts', 'last_modified' , '' ),
|
||||
'created' => pacol( 0, 0, 0, 'ts', 'created' , '' ),
|
||||
'modified' => pacol( 0, 0, $super, 'ts', 'last_modified' , '' ),
|
||||
'_can_edit' => pacol( 0, 0, 1, 'int', '' , '' , 0 ,
|
||||
/*options*/ '',
|
||||
/*not_in_db*/ 0,
|
||||
@@ -108,7 +131,7 @@ class DomainHandler extends PFAHandler {
|
||||
|
||||
# various settings
|
||||
'required_role' => 'admin',
|
||||
'listview' => 'list-domain.php',
|
||||
'listview' => 'list.php?table=domain',
|
||||
'early_init' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</tr>
|
||||
{foreach from=$admin_properties item=admin}
|
||||
{#tr_hilightoff#}
|
||||
<td><a href="list-domain.php?username={$admin.username|escape:"url"}">{$admin.username}</a></td>
|
||||
<td><a href="list.php?table=domain&username={$admin.username|escape:"url"}">{$admin.username}</a></td>
|
||||
<td>
|
||||
{if $admin.superadmin == 1}
|
||||
{$PALANG.super_admin}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<div id="overview">
|
||||
<form name="frmOverview" method="post" action="">
|
||||
<select name="fUsername" onchange="this.form.submit();">
|
||||
{$select_options}
|
||||
</select>
|
||||
<input class="button" type="submit" name="go" value="{$PALANG.go}" />
|
||||
</form>
|
||||
{#form_search#}
|
||||
</div>
|
||||
{if $domain_properties}
|
||||
<table id="admin_table">
|
||||
{#tr_header#}
|
||||
<td>{$PALANG.domain}</td>
|
||||
<td>{$PALANG.description}</td>
|
||||
<td>{$PALANG.aliases}</td>
|
||||
<td>{$PALANG.mailboxes}</td>
|
||||
{if $CONF.quota==YES}<td>{$PALANG.pOverview_get_quota}</td>{/if}
|
||||
{if $CONF.domain_quota==YES}<td>{$PALANG.pAdminList_domain_quota}</td>{/if}
|
||||
{if $CONF.transport==YES}<td>{$PALANG.transport}</td>{/if}
|
||||
<td>{$PALANG.pAdminList_domain_backupmx}</td>
|
||||
<td>{$PALANG.last_modified}</td>
|
||||
<td>{$PALANG.active}</td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
{foreach from=$domain_properties item=domain}
|
||||
{#tr_hilightoff#}
|
||||
<td><a href="{#url_list_virtual#}?domain={$domain.domain|escape:"url"}">{$domain.domain}</a></td>
|
||||
<td>{$domain.description}</td>
|
||||
<td>{$domain.alias_count} / {$domain.aliases}</td>
|
||||
<td>{$domain.mailbox_count} / {$domain.mailboxes}</td>
|
||||
{if $CONF.quota==YES}<td>{$domain.maxquota}</td>{/if}
|
||||
{if $CONF.domain_quota===YES}<td>{$domain.total_quota} / {$domain.quota}</td>{/if}
|
||||
{if $CONF.transport==YES}<td>{$domain.transport}</td>{/if}
|
||||
<td>{$domain._backupmx}</td>
|
||||
<td>{$domain.modified}</td>
|
||||
<td><a href="{#url_editactive#}domain&id={$domain.domain|escape:"url"}&active={if ($domain.active==0)}1{else}0{/if}&token={$smarty.session.PFA_token|escape:"url"}">{$domain._active}</a></td>
|
||||
<td><a href="{#url_edit_domain#}&edit={$domain.domain|escape:"url"}">{$PALANG.edit}</a></td>
|
||||
<td><a href="{#url_delete#}?table=domain&delete={$domain.domain|escape:"url"}&token={$smarty.session.PFA_token|escape:"url"}"
|
||||
onclick="return confirm ('{$PALANG.confirm_domain}{$PALANG.domain}: {$domain.domain}')">{$PALANG.del}</a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
||||
<br /><a href="{#url_edit_domain#}" class="button">{$PALANG.pAdminMenu_create_domain}</a><br />
|
||||
+8
-3
@@ -56,9 +56,13 @@
|
||||
Special handling (td content) for {$table} / {$key}
|
||||
{* {elseif $table == 'domain' && $key == 'domain'}
|
||||
<a href="list.php?table=domain&domain={$item.domain|escape:"url"}">{$item.domain}</a>
|
||||
*}
|
||||
*}
|
||||
{elseif $key == 'active'}
|
||||
<a href="{#url_editactive#}{$table}&id={$item.$id_field|escape:"url"}&active={if ($item.active==0)}1{else}0{/if}&token={$smarty.session.PFA_token|escape:"url"}">{$item._active}</a>
|
||||
{if $item._can_edit}
|
||||
<a href="{#url_editactive#}{$table}&id={$item.$id_field|escape:"url"}&active={if ($item.active==0)}1{else}0{/if}&token={$smarty.session.PFA_token|escape:"url"}">{$item._active}</a>
|
||||
{else}
|
||||
{$item._active}
|
||||
{/if}
|
||||
{elseif $field.type == 'bool'}
|
||||
{assign "tmpkey" "_{$key}"}{$item.{$tmpkey}}
|
||||
{elseif $field.type == 'list'}
|
||||
@@ -80,7 +84,8 @@
|
||||
<div class="quota_bg"></div></div>
|
||||
<div class="quota_text quota_text_{$quota_level}">{$linktext}</div>
|
||||
{else}
|
||||
{$item[$key]}
|
||||
<div class="quota_bg quota_no_border"></div></div>
|
||||
<div class="quota_text">{$linktext}</div>
|
||||
{/if}
|
||||
|
||||
{elseif $field.type == 'txtl'}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<div id="overview">
|
||||
<form name="frmOverview" method="get" action="">
|
||||
<select name="domain" onchange="this.form.submit();">
|
||||
{$select_options}
|
||||
</select>
|
||||
<input class="button" type="submit" name="go" value="{$PALANG.go}" />
|
||||
</form>
|
||||
{#form_search#}
|
||||
</div>
|
||||
<table id="overview_table">
|
||||
<tr>
|
||||
<th colspan="5">{$PALANG.pOverview_title}</th>
|
||||
</tr>
|
||||
{#tr_header#}
|
||||
<td>{$PALANG.domain}</td>
|
||||
<td>{$PALANG.aliases}</td>
|
||||
<td>{$PALANG.mailboxes}</td>
|
||||
{if $CONF.quota===YES}<td>{$PALANG.pOverview_get_quota}</td>{/if}
|
||||
{if $CONF.domain_quota===YES}<td>{$PALANG.pAdminList_domain_quota}</td>{/if}
|
||||
</tr>
|
||||
{foreach from=$domain_properties item=domain}
|
||||
{#tr_hilightoff#}
|
||||
<td><a href="{#url_list_virtual#}?domain={$domain.domain|escape:"url"}">{$domain.domain}</a></td>
|
||||
<td>{$domain.alias_count} / {$domain.aliases}</td>
|
||||
<td>{$domain.mailbox_count} / {$domain.mailboxes}</td>
|
||||
{if $CONF.quota===YES}<td>{$domain.maxquota}</td>{/if}
|
||||
{if $CONF.domain_quota===YES}<td>{$domain.total_quota} / {$domain.quota}</td>{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
Reference in new issue
Block a user