0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-20 03:36:20 +02:00
postfixadmin/list-domain.php
Christian Boltz f2c2b554ac model/PFAHandler.php:
- getList: change return value to be always true (even if the database 
  result is an empty array), and die() if the database result is not an 
  array.
  This avoids some if blocks in various files to implement a fallback
  to array() on empty results.

functions.inc.php:
- list_admins(): simplify after the *Handler->getList() change
- get_domain_properties(): change a forgotten $handler->return to 
  $handler->result() (follow-up for r1534)

list-domain, list-virtual.php:
- simplify after the *Handler->getList() change



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1535 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-13 16:11:15 +00:00

55 lines
1.5 KiB
PHP

<?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://www.postfixadmin.com or 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: */
?>