SF.net SVN: postfixadmin: [181] trunk
Brought to you by:
christian_boltz,
gingerdog
|
From: <chr...@us...> - 2007-11-03 22:24:30
|
Revision: 181
http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=181&view=rev
Author: christian_boltz
Date: 2007-11-03 15:24:34 -0700 (Sat, 03 Nov 2007)
Log Message:
-----------
merged overview.php into list-domain.php and list-virtual.php
list-domain.php:
- added several admin/superadmin switches and permission checks
- merged GET and POST code
- Note: still different templates for superadmins (admin_list-domain.tpl)
and admins (overview-get.tpl) because of large layout difference
list-virtual.php:
- added several admin/superadmin switches and permission checks
- added check for admins without any domains (redirects to domain list,
which can handle this situation)
- migrated FIXME from overview.php
-> David, please review the query and remove the FIXME afterwards
overview.php:
- DELETED - no longer needed
overview.tpl:
- RENAMED overview.tpl to list-virtual.tpl
- removed admin/superadmin filename switch
- removed $incpath switch for images
menu.tpl:
- menu for domain admins now has "domain list" and "virtual list"
instead of "overview"
delete.php, edit-active.php, edit-alias.php, edit-mailbox.php, search.php:
- changed redirect to list-virtual.php
overview-get.tpl:
- changed link to list-virtual.php
main.tpl:
- changed overview link to list-domain.php
Modified Paths:
--------------
trunk/delete.php
trunk/edit-active.php
trunk/edit-alias.php
trunk/edit-mailbox.php
trunk/list-domain.php
trunk/list-virtual.php
trunk/search.php
trunk/templates/main.tpl
trunk/templates/menu.tpl
trunk/templates/overview-get.tpl
Added Paths:
-----------
trunk/templates/list-virtual.tpl
Removed Paths:
-------------
trunk/overview.php
trunk/templates/overview.tpl
Modified: trunk/delete.php
===================================================================
--- trunk/delete.php 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/delete.php 2007-11-03 22:24:34 UTC (rev 181)
@@ -149,9 +149,7 @@
if ($error != 1)
{
if ($CONF['database_type'] == "pgsql") db_query('COMMIT');
- $url = "overview.php";
- if (authentication_has_role('global-admin')) $url = "list-virtual.php";
- header ("Location: $url?domain=$fDomain");
+ header ("Location: list-virtual.php?domain=$fDomain");
exit;
} else {
$tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> (physical mail)!</span>";
Modified: trunk/edit-active.php
===================================================================
--- trunk/edit-active.php 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/edit-active.php 2007-11-03 22:24:34 UTC (rev 181)
@@ -78,7 +78,6 @@
if ($error != 1)
{
if ( preg_match( "/^list-virtual.php.*/", $fReturn ) ||
- preg_match( "/^overview.php.*/", $fReturn ) ||
preg_match( "/^search.php.*/", $fReturn ) )
{
//$fReturn appears OK, jump there
@@ -86,11 +85,7 @@
}
else
{
- if (authentication_has_role('global-admin')) {
- header ("Location: list-virtual.php?domain=$fDomain");
- } else {
- header ("Location: overview.php?domain=$fDomain");
- }
+ header ("Location: list-virtual.php?domain=$fDomain");
}
exit;
}
Modified: trunk/edit-alias.php
===================================================================
--- trunk/edit-alias.php 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/edit-alias.php 2007-11-03 22:24:34 UTC (rev 181)
@@ -118,11 +118,7 @@
{
db_log ($SESSID_USERNAME, $fDomain, 'edit_alias', "$fAddress -> $goto");
- if (authentication_has_role('global-admin')) {
- header ("Location: list-virtual.php?domain=$fDomain");
- } else {
- header ("Location: overview.php?domain=$fDomain");
- }
+ header ("Location: list-virtual.php?domain=$fDomain");
exit;
}
}
Modified: trunk/edit-mailbox.php
===================================================================
--- trunk/edit-mailbox.php 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/edit-mailbox.php 2007-11-03 22:24:34 UTC (rev 181)
@@ -144,11 +144,7 @@
else {
db_log ($SESSID_USERNAME, $fDomain, 'edit_mailbox', $fUsername);
- if (authentication_has_role('global-admin')) {
- header ("Location: list-virtual.php?domain=$fDomain");
- } else {
- header ("Location: overview.php?domain=$fDomain");
- }
+ header ("Location: list-virtual.php?domain=$fDomain");
exit;
}
}
Modified: trunk/list-domain.php
===================================================================
--- trunk/list-domain.php 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/list-domain.php 2007-11-03 22:24:34 UTC (rev 181)
@@ -27,41 +27,28 @@
require_once('common.php');
-authentication_require_role('global-admin');
+authentication_require_role('admin');
-$list_admins = list_admins ();
+if (authentication_has_role('global-admin')) {
+ $list_admins = list_admins ();
+ $is_superadmin = 1;
+} else {
+ $list_admins = array(authentication_get_username());
+ $is_superadmin = 0;
+}
-if ($_SERVER['REQUEST_METHOD'] == "GET") {
- if (isset ($_GET['username'])) {
- $fUsername = escape_string ($_GET['username']);
- $list_domains = list_domains_for_admin ($fUsername);
- if ($list_domains != 0)
- {
- for ($i = 0; $i < sizeof ($list_domains); $i++)
- {
- $domain_properties[$i] = get_domain_properties ($list_domains[$i]);
- }
- }
- }
- else
- {
- $list_domains = list_domains ();
- if ((is_array ($list_domains) and sizeof ($list_domains) > 0))
- for ($i = 0; $i < sizeof ($list_domains); $i++)
- {
- $domain_properties[$i] = get_domain_properties ($list_domains[$i]);
- }
- }
+if ($_SERVER['REQUEST_METHOD'] == "POST" && $is_superadmin && isset ($_POST['fUsername'])) {
+ $fUsername = escape_string ($_POST['fUsername']);
+ $list_domains = list_domains_for_admin ($fUsername);
+} elseif ($_SERVER['REQUEST_METHOD'] == "GET" && $is_superadmin && isset ($_GET['username'])) {
+ $fUsername = escape_string ($_GET['username']);
+ $list_domains = list_domains_for_admin ($fUsername);
+} elseif ($is_superadmin) {
+ $list_domains = list_domains ();
+} else {
+ $list_domains = list_domains_for_admin(authentication_get_username());
}
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- if (isset ($_POST['fUsername']))
- {
- $fUsername = escape_string ($_POST['fUsername']);
- $list_domains = list_domains_for_admin ($fUsername);
- }
-
if (!empty ($list_domains))
{
for ($i = 0; $i < sizeof ($list_domains); $i++)
@@ -69,10 +56,15 @@
$domain_properties[$i] = get_domain_properties ($list_domains[$i]);
}
}
-}
+#}
include ("templates/header.tpl");
include ("templates/menu.tpl");
-include ("templates/admin_list-domain.tpl");
+
+if ($is_superadmin) {
+ include ("templates/admin_list-domain.tpl");
+} else {
+ include ("templates/overview-get.tpl");
+}
include ("templates/footer.tpl");
?>
Modified: trunk/list-virtual.php
===================================================================
--- trunk/list-virtual.php 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/list-virtual.php 2007-11-03 22:24:34 UTC (rev 181)
@@ -15,7 +15,7 @@
* File: list-virtual.php
* List virtual users for a domain.
*
- * Template File: overview.tpl
+ * Template File: list-virtual.tpl
*
* Template Variables:
*
@@ -31,11 +31,16 @@
require_once('common.php');
-authentication_require_role('global-admin');
+authentication_require_role('admin');
-$list_domains = list_domains ();
+if (authentication_has_role('global-admin')) {
+ $list_domains = list_domains ();
+ $is_superadmin = 1;
+} else {
+ $list_domains = list_domains_for_admin(authentication_get_username());
+ $is_superadmin = 0;
+}
-
$tAlias = array();
$tMailbox = array();
$fDisplay = 0;
@@ -52,12 +57,21 @@
if (isset ($_POST['limit'])) $fDisplay = intval ($_POST['limit']);
}
+if (count($list_domains) == 0) {
+# die("no domains");
+ header("Location: list-domain.php"); # no domains (for this admin at least) - redirect to domain list
+}
if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[0];
-if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[1];
+if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[1]; # TODO: should never happen?!? ($fDomain should already be filled by the line above)
+if (!check_owner(authentication_get_username(), $fDomain)) {
+# die($PALANG['invalid_parameter']);
+ header("Location: list-domain.php"); # domain not owned by this admin
+}
+
$query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.domain='$fDomain' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address LIMIT $fDisplay, $page_size";
if ('pgsql'==$CONF['database_type'])
{
@@ -83,6 +97,7 @@
$query = ("SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $fDisplay, $page_size");
if ('pgsql'==$CONF['database_type'])
{
+ //TODO/FIXME: postgres query needs to be rewrited
$query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $page_size OFFSET $fDisplay";
}
}
@@ -106,7 +121,7 @@
$row['created']=gmstrftime('%c %Z',$row['uts_created']);
$row['modified']=gmstrftime('%c %Z',$row['uts_modified']);
$row['active']=('t'==$row['active']) ? 1 : 0;
- $row['v_active'] = 1; // default to off...
+ $row['v_active'] = 1; // default to off... TODO: 1 is NOT off
if(isset($row['v_active'])) { /* key may not be present in results due to query from above */
$row['v_active']=('t'==$row['v_active']) ? 1 : 0;
}
@@ -157,7 +172,7 @@
include ("templates/header.tpl");
include ("templates/menu.tpl");
-include ("templates/overview.tpl");
+include ("templates/list-virtual.tpl");
include ("templates/footer.tpl");
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
Deleted: trunk/overview.php
===================================================================
--- trunk/overview.php 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/overview.php 2007-11-03 22:24:34 UTC (rev 181)
@@ -1,249 +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://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: overview.php
- * Shows an overview for admins.
- *
- * Template File: overview.tpl
- *
- * Template Variables:
- *
- * tAlias
- * tDomain
- * tMailbox
- * tDisplay_back
- * tDisplay_next
- *
- * Form POST \ GET Variables:
- *
- * domain
- * fDomain
- * limit
- */
-
-require_once('common.php');
-
-authentication_require_role('admin');
-
-$SESSID_USERNAME = authentication_get_username();
-
-if(authentication_has_role('global-admin')) {
- $list_domains = list_domains ();
-}
-else {
- $list_domains = list_domains_for_admin ($SESSID_USERNAME);
-}
-
-$tAlias = array();
-$tMailbox = array();
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- $fDisplay = 0;
- $page_size = $CONF['page_size'];
-
- if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']);
- if (isset ($_GET['limit'])) $fDisplay = escape_string ($_GET['limit']);
-
- $limit = get_domain_properties ($fDomain);
-
- $limitSql=('pgsql'==$CONF['database_type']) ? "$page_size OFFSET $fDisplay" : "$fDisplay, $page_size";
-
- if (check_owner ($SESSID_USERNAME, $fDomain))
- {
- $tCanAddAlias = 1; # TODO: workaround for undefined variable
- $tCanAddMailbox = 1; # TODO: workaround for undefined variable
-
- $query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.domain='$fDomain' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address LIMIT $limitSql";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT address,goto,extract(epoch from modified) as modified,active FROM $table_alias WHERE domain='$fDomain' AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) ORDER BY address LIMIT $limitSql";
- }
-
- $result = db_query ($query);
- if ($result['rows'] > 0)
- {
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['modified']=gmstrftime('%c %Z',$row['modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- }
- $tAlias[] = $row;
- }
- }
-
- if ($CONF['vacation_control_admin'] == 'YES')
- {
- $query = ("SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $limitSql");
- if ('pgsql'==$CONF['database_type'])
- {
- //FIXME: postgres query needs to be rewrited
- $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql";
- }
- }
- else
- {
- $query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql";
- }
- }
-
- $result = db_query ($query);
- if ($result['rows'] > 0)
- {
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['created']=gmstrftime('%c %Z',$row['uts_created']);
- $row['modified']=gmstrftime('%c %Z',$row['uts_modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- if(isset($row['v_active'])) {
- $row['v_active']=('t'==$row['v_active']) ? 1 : 0;
- }
- else {
- $row['v_active'] = -1 ; //unknown; broken query above..
- }
- unset($row['uts_created']);
- unset($row['uts_modified']);
- }
- $tMailbox[] = $row;
- }
- }
- $template = "overview.tpl";
- }
- else
- {
- $template = "overview-get.tpl";
- }
-
- $tDomain = $fDomain;
-
- if (isset ($limit))
- {
- if ($fDisplay >= $page_size)
- {
- $tDisplay_back_show = 1;
- $tDisplay_back = $fDisplay - $page_size;
- }
- if (($limit['alias_count'] > $page_size) or ($limit['mailbox_count'] > $page_size))
- {
- $tDisplay_up_show = 1;
- }
- if ((($fDisplay + $page_size) < $limit['alias_count']) or (($fDisplay + $page_size) < $limit['mailbox_count']))
- {
- $tDisplay_next_show = 1;
- $tDisplay_next = $fDisplay + $page_size;
- }
- }
-
- include ("./templates/header.tpl");
- include ("./templates/menu.tpl");
- include ("./templates/$template");
- include ("./templates/footer.tpl");
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- $fDisplay = 0;
- $page_size = $CONF['page_size'];
-
- if (isset ($_POST['limit'])) $fDisplay = escape_string ($_POST['limit']);
- if (isset ($_POST['domain'])) $fDomain = escape_string ($_POST['fDomain']);
-
- if (check_owner ($SESSID_USERNAME, escape_string ($_POST['fDomain'])))
- {
- $limitSql=('pgsql'==$CONF['database_type']) ? "$page_size OFFSET $fDisplay" : "$fDisplay, $page_size";
-
- if ($CONF['alias_control_admin'] == "YES")
- {
- $query = "SELECT address,goto,modified,active FROM $table_alias WHERE domain='$fDomain' ORDER BY address LIMIT $limitSql";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT address,goto,extract(epoch from modified) as modified,active FROM $table_alias WHERE domain='$fDomain' ORDER BY address LIMIT $limitSql";
- }
- }
- else
- {
- $query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.domain='$fDomain' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address LIMIT $limitSql";
- if ('pgsql'==$CONF['database_type'])
- {
- $query="SELECT address,goto,extract(epoch from modified) as modified,active FROM $table_alias WHERE domain='$fDomain' AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) ORDER BY address LIMIT $limitSql";
- }
- }
-
- $result = db_query ("$query");
- if ($result['rows'] > 0)
- {
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['modified']=gmstrftime('%c %Z',$row['modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- }
- $tAlias[] = $row;
- }
- }
-
- $query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT *,,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql";
- }
- $result = db_query ($query);
- if ($result['rows'] > 0)
- {
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['created']=gmstrftime('%c %Z',$row['uts_created']);
- $row['modified']=gmstrftime('%c %Z',$row['uts_modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- }
- $tMailbox[] = $row;
- }
- }
- }
-
- if (isset ($limit))
- {
- if ($fDisplay >= $page_size)
- {
- $tDisplay_back_show = 1;
- $tDisplay_back = $fDisplay - $page_size;
- }
- if (($limit['alias_count'] > $page_size) or ($limit['mailbox_count'] > $page_size))
- {
- $tDisplay_up_show = 1;
- }
- if ((($fDisplay + $page_size) < $limit['alias_count']) or (($fDisplay + $page_size) < $limit['mailbox_count']))
- {
- $tDisplay_next_show = 1;
- $tDisplay_next = $fDisplay + $page_size;
- }
- }
-
- include ("./templates/header.tpl");
- include ("./templates/menu.tpl");
- include ("./templates/overview.tpl");
- include ("./templates/footer.tpl");
-}
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-?>
Modified: trunk/search.php
===================================================================
--- trunk/search.php 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/search.php 2007-11-03 22:24:34 UTC (rev 181)
@@ -59,14 +59,7 @@
if (empty ($fSearch) /* && !empty ($fGo) */)
{
- if (authentication_has_role('global-admin'))
- {
- header("Location: list-virtual.php?domain=" . $fDomain ) && exit;
- }
- else
- {
- header("Location: overview.php?domain=" . $fDomain ) && exit;
- }
+ header("Location: list-virtual.php?domain=" . $fDomain ) && exit;
}
if ($CONF['alias_control_admin'] == "YES")
Copied: trunk/templates/list-virtual.tpl (from rev 175, trunk/templates/overview.tpl)
===================================================================
--- trunk/templates/list-virtual.tpl (rev 0)
+++ trunk/templates/list-virtual.tpl 2007-11-03 22:24:34 UTC (rev 181)
@@ -0,0 +1,317 @@
+<div id="overview">
+<form name="overview" method="post">
+<select name="fDomain" onChange="this.form.submit();">
+<?php
+
+$file = 'list-virtual.php';
+
+if ($limit['aliases'] == 0) $limit['aliases'] = $PALANG['pOverview_unlimited'];
+if ($limit['mailboxes'] == 0) $limit['mailboxes'] = $PALANG['pOverview_unlimited'];
+if ($limit['maxquota'] == 0) $limit['maxquota'] = $PALANG['pOverview_unlimited'];
+if ($limit['aliases'] < 0) $limit['aliases'] = $PALANG['pOverview_disabled'];
+if ($limit['mailboxes'] < 0) $limit['mailboxes'] = $PALANG['pOverview_disabled'];
+if ($limit['maxquota'] < 0) $limit['maxquota'] = $PALANG['pOverview_disabled'];
+
+for ($i = 0; $i < sizeof ($list_domains); $i++)
+{
+ if ($fDomain == $list_domains[$i])
+ {
+ print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n";
+ }
+ else
+ {
+ print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n";
+ }
+}
+?>
+</select>
+<input type="hidden" name="limit" value="0" />
+<input class="button" type="submit" name="go" value="<?php print $PALANG['pOverview_button']; ?>" />
+</form>
+<h4><?php print $PALANG['pOverview_welcome'] . $fDomain; ?></h4>
+<p><?php print $PALANG['pOverview_alias_alias_count'] . ": " . $limit['alias_count'] . " / " . $limit['aliases']; ?></p>
+<p><?php print $PALANG['pOverview_alias_mailbox_count'] . ": " . $limit['mailbox_count'] . " / " . $limit['mailboxes']; ?></p>
+<form name="search" method="post" action="search.php"><?php print $PALANG['pSearch']; ?>:
+<input type="textbox" name="search" size="10" />
+</form>
+</div>
+
+<div id="nav_bar">
+ <table width=730><colgroup span="1"><col width="550"></col></colgroup>
+ <tr><td align=left >
+<?php
+if ($limit['alias_pgindex_count'] ) print "<b>".$PALANG['pOverview_alias_title']."</b>  ";
+($tDisplay_back_show == 1) ? $highlight_at = $tDisplay_back / $CONF['page_size'] + 1 : $highlight_at = 0;
+$current_limit=$highlight_at * $CONF['page_size'];
+for ($i = 0; $i < $limit['alias_pgindex_count']; $i++)
+{
+ if ( $i == $highlight_at )
+ {
+ print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "\"><b>" . $limit['alias_pgindex'][$i] . "</b></a>\n";
+ }
+ else
+ {
+ print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "\">" . $limit['alias_pgindex'][$i] . "</a>\n";
+ }
+}
+print "</td><td valign=middle align=right>";
+
+if ($tDisplay_back_show == 1)
+{
+ print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n";
+}
+if ($tDisplay_up_show == 1)
+{
+ print "<a href=\"$file?domain=$fDomain&limit=0\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n";
+}
+if ($tDisplay_next_show == 1)
+{
+ print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n";
+}
+print "</td></tr></table></div>\n";
+
+if (sizeof ($tAlias) > 0)
+{
+ print "<table id=\"alias_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"7\"><h3>" . $PALANG['pOverview_alias_title'] . "</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; }
+ print " <td>" . $PALANG['pOverview_alias_address'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_alias_goto'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_alias_modified'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_alias_active'] . "</td>\n";
+ print " <td colspan=\"2\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < sizeof ($tAlias); $i++)
+ {
+ if ((is_array ($tAlias) and sizeof ($tAlias) > 0))
+ {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+ if ($CONF['show_status'] == 'YES')
+ {
+ print " <td>" . gen_show_status($tAlias[$i]['address']) . "</td>\n";
+ }
+
+ print " <td>" . $tAlias[$i]['address'] . "</td>\n";
+ if ($CONF['alias_goto_limit'] > 0) {
+ print " <td>" . ereg_replace (",", "<br>", preg_replace('/^(([^,]+,){'.$CONF['alias_goto_limit'].'})[^,]+,.*/','$1[and '. (substr_count ($tAlias[$i]['goto'], ',') - $CONF['alias_goto_limit'] + 1) .' more...]',$tAlias[$i]['goto'])) . "</td>\n";
+ } else {
+ print " <td>" . ereg_replace (",", "<br>", $tAlias[$i]['goto']) . "</td>\n";
+ }
+ print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
+
+
+# TODO: merge superadmin / domain admin code
+ if (authentication_has_role('global-admin')) {
+# superadmin code
+ $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain&return=$file?domain=$fDomain" . urlencode ("&limit=" . $current_limit) . "\">" . $active . "</a></td>\n";
+ print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?table=alias" . "&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+
+ } else {
+# domain admin code
+ if ($CONF['special_alias_control'] == 'YES')
+ {
+ $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
+ print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?table=alias&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ }
+ else
+ {
+ if ( check_alias_owner ($SESSID_USERNAME, $tAlias[$i]['address']))
+ {
+ $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
+ print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?table=mailbox&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ }
+ else
+ {
+ //this is a special alias, show status only, don't allow changes
+ $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td>" . $active . "</td>\n";
+ print " <td> </td>\n";
+ print " <td> </td>\n";
+ }
+ }
+# end diff
+ }
+
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+}
+
+if($tCanAddAlias) {
+ print "<p><a href=\"create-alias.php?domain=$fDomain\">" . $PALANG['pMenu_create_alias'] . "</a>\n";
+}
+
+ print "<div id=\"nav_bar\"><a name=\"MidArrow\"></a>\n<table width=730><colgroup span=\"1\"> <col width=\"550\"></col></colgroup> <tr><td align=left >";
+ if ( $limit['mbox_pgindex_count'] ) print "<b>".$PALANG['pOverview_mailbox_title']."</b>  ";
+ ($tDisplay_back_show == 1) ? $highlight_at = $tDisplay_back / $CONF['page_size'] + 1 : $highlight_at = 0;
+ for ($i = 0; $i < $limit['mbox_pgindex_count']; $i++)
+ {
+ if ( $i == $highlight_at )
+ {
+ print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "#MidArrow\"><b>" . $limit['mbox_pgindex'][$i] . "</b></a>\n";
+ }
+ else
+ {
+ print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "#MidArrow\">" . $limit['mbox_pgindex'][$i] . "</a>\n";
+ }
+ }
+ print "</td><td valign=middle align=right>";
+
+if ($tDisplay_back_show == 1)
+{
+ print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back#MidArrow\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n";
+}
+if ($tDisplay_up_show == 1)
+{
+ print "<a href=\"$file?domain=$fDomain&limit=0#MidArrow\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n";
+}
+if ($tDisplay_next_show == 1)
+{
+ print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next#MidArrow\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n";
+}
+print "</td></tr></table></div>\n";
+
+if (sizeof ($tMailbox) > 0)
+{
+ $colspan=8;
+ if ($CONF['vacation_control_admin'] == 'YES') $colspan=$colspan+1;
+ if ($CONF['alias_control_admin'] == 'YES') $colspan=$colspan+1;
+ print "<table id=\"mailbox_table\">\n";
+ print " <tr>\n";
+ print " <td colspan=\"$colspan\"><h3>" . $PALANG['pOverview_mailbox_title'] . "</h3></td>";
+ print " </tr>";
+ print " <tr class=\"header\">\n";
+ if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; }
+ print " <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pOverview_mailbox_quota'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_modified'] . "</td>\n";
+ print " <td>" . $PALANG['pOverview_mailbox_active'] . "</td>\n";
+ $colspan = $colspan - 6;
+ print " <td colspan=\"$colspan\"> </td>\n";
+ print " </tr>\n";
+
+ for ($i = 0; $i < sizeof ($tMailbox); $i++)
+ {
+ if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0))
+ {
+ print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
+
+ if ($CONF['show_status'] == 'YES')
+ {
+ print " <td>" . gen_show_status($tMailbox[$i]['username']) . "</td>\n";
+ }
+
+ print " <td>" . $tMailbox[$i]['username'] . "</td>\n";
+ print " <td>" . $tMailbox[$i]['name'] . "</td>\n";
+ if ($CONF['quota'] == 'YES')
+ {
+ print " <td>";
+ if ($tMailbox[$i]['quota'] == 0)
+ {
+ print $PALANG['pOverview_unlimited'];
+ }
+ elseif ($tMailbox[$i]['quota'] < 0)
+ {
+ print $PALANG['pOverview_disabled'];
+ }
+ else
+ {
+ print divide_quota ($tMailbox[$i]['quota']);
+ }
+ print "</td>\n";
+ }
+ print " <td>" . $tMailbox[$i]['modified'] . "</td>\n";
+ $active = ($tMailbox[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
+ print " <td><a href=\"edit-active.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
+
+ if ($CONF['vacation_control_admin'] == 'YES')
+ {
+ $v_active_int = $tMailbox[$i]['v_active'];
+ if($v_active_int !== -1) {
+ if($v_active_int == 1) {
+ $v_active = $PALANG['pOverview_vacation_edit'];
+ }
+ else {
+ $v_active = $PALANG['pOverview_vacation_option'];
+ }
+ print "<td><a href=\"edit-vacation.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $v_active . "</a></td>\n";
+ }
+ else {
+ // can't tell vacation state - broken pgsql query
+ echo "<td> </td>\n";
+ }
+ }
+
+ $edit_aliases=0;
+ if ( authentication_has_role('global-admin') && $CONF['alias_control_admin'] == 'YES') $edit_aliases = 1;
+ if ( (! authentication_has_role('global-admin')) && $CONF['alias_control'] == 'YES') $edit_aliases = 1;
+
+ if ($edit_aliases == 1)
+ {
+ print " <td><a href=\"edit-alias.php?address=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['pOverview_alias_edit'] . "</a></td>\n";
+ }
+
+ print " <td><a href=\"edit-mailbox.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
+ print " <td><a href=\"delete.php?table=mailbox" . "&delete=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n";
+ print " </tr>\n";
+ }
+ }
+ print "</table>\n";
+ print "<div id=\"nav_bar\"><a name=\"LowArrow\" /a>\n";
+ if ($tDisplay_back_show == 1)
+ {
+ print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back#LowArrow\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n";
+ }
+ if ($tDisplay_up_show == 1)
+ {
+ print "<a href=\"$file?domain=$fDomain&limit=0#LowArrow\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n";
+ }
+ if ($tDisplay_next_show == 1)
+ {
+ print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next#LowArrow\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n";
+ }
+ print "</div>\n";
+
+}
+if($tCanAddMailbox) {
+ print "<p><a href=\"create-mailbox.php?domain=$fDomain\">" . $PALANG['pMenu_create_mailbox'] . "</a>\n";
+}
+
+if ($CONF['show_status'] == 'YES' && $CONF['show_status_key'] == 'YES')
+{
+ print "<br><br>";
+ if ($CONF['show_undeliverable'] == 'YES')
+ {
+ print " <span style='background-color:" . $CONF['show_undeliverable_color'] .
+ "'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_undeliverable'] . "\n";
+ }
+ if ($CONF['show_popimap'] == 'YES')
+ {
+ print " <span style='background-color:" . $CONF['show_popimap_color'] .
+ "'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_popimap'] . "\n";
+ }
+ if ( $CONF['show_custom_count'] > 0 )
+ {
+ for ($i = 0; $i < sizeof ($CONF['show_custom_domains']); $i++)
+ {
+ print " <span style='background-color:" . $CONF['show_custom_colors'][$i] . "'>" .
+ $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_custom'] .
+ $CONF['show_custom_domains'][$i] . "\n";
+ }
+ }
+}
+
+/* vim: set ft=php expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
+?>
Modified: trunk/templates/main.tpl
===================================================================
--- trunk/templates/main.tpl 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/templates/main.tpl 2007-11-03 22:24:34 UTC (rev 181)
@@ -1,7 +1,7 @@
<div id="main_menu">
<table>
<tr>
- <td nowrap><a target="_top" href="overview.php"><?php print $PALANG['pMenu_overview']; ?></a></td>
+ <td nowrap><a target="_top" href="list-domain.php"><?php print $PALANG['pMenu_overview']; ?></a></td>
<td><?php print $PALANG['pMain_overview']; ?></td>
</tr>
<tr>
Modified: trunk/templates/menu.tpl
===================================================================
--- trunk/templates/menu.tpl 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/templates/menu.tpl 2007-11-03 22:24:34 UTC (rev 181)
@@ -26,15 +26,16 @@
$submenu_domain = "";
}
+
if (authentication_has_role('global-admin')) {
print _menulink("list-admin.php", $PALANG['pAdminMenu_list_admin'], $submenu_admin);
- print _menulink("list-domain.php", $PALANG['pAdminMenu_list_domain'], $submenu_domain);
- print _menulink("list-virtual.php", $PALANG['pAdminMenu_list_virtual'], $submenu_virtual);
} else {
print _menulink("main.php", $PALANG['pMenu_main']);
- print _menulink("overview.php", $PALANG['pMenu_overview'], $submenu_virtual);
}
+print _menulink("list-domain.php", $PALANG['pAdminMenu_list_domain'], $submenu_domain);
+print _menulink("list-virtual.php", $PALANG['pAdminMenu_list_virtual'], $submenu_virtual);
+
if ($CONF['fetchmail'] == 'YES') {
print _menulink("fetchmail.php", $PALANG['pMenu_fetchmail'], $submenu_fetchmail);
}
Modified: trunk/templates/overview-get.tpl
===================================================================
--- trunk/templates/overview-get.tpl 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/templates/overview-get.tpl 2007-11-03 22:24:34 UTC (rev 181)
@@ -48,7 +48,7 @@
if ($limit['maxquota'] < 0) $limit['maxquota'] = $PALANG['pOverview_disabled'];
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
- print " <td><a href=\"overview.php?domain=" . $list_domains[$i] . "\">" . $list_domains[$i] . "</a></td>\n";
+ print " <td><a href=\"list-virtual.php?domain=" . $list_domains[$i] . "\">" . $list_domains[$i] . "</a></td>\n";
print " <td>" . $limit['alias_count'] . " / " . $limit['aliases'] . "</td>\n";
print " <td>" . $limit['mailbox_count'] . " / " . $limit['mailboxes'] . "</td>\n";
if ($CONF['quota'] == 'YES') print " <td>" . $limit['maxquota'] . "</td>\n";
Deleted: trunk/templates/overview.tpl
===================================================================
--- trunk/templates/overview.tpl 2007-11-03 19:21:27 UTC (rev 180)
+++ trunk/templates/overview.tpl 2007-11-03 22:24:34 UTC (rev 181)
@@ -1,323 +0,0 @@
-<div id="overview">
-<form name="overview" method="post">
-<select name="fDomain" onChange="this.form.submit();">
-<?php
-
-if (authentication_has_role('global-admin')) {
- $file = 'list-virtual.php';
- $incpath = '..'; # warning: overrides $incpath from common.php - TODO: fix common.php $incpath
-} else {
- $file = 'overview.php';
- $incpath = '.'; # warning: overrides $incpath from common.php - TODO: fix common.php $incpath
-}
-
-if ($limit['aliases'] == 0) $limit['aliases'] = $PALANG['pOverview_unlimited'];
-if ($limit['mailboxes'] == 0) $limit['mailboxes'] = $PALANG['pOverview_unlimited'];
-if ($limit['maxquota'] == 0) $limit['maxquota'] = $PALANG['pOverview_unlimited'];
-if ($limit['aliases'] < 0) $limit['aliases'] = $PALANG['pOverview_disabled'];
-if ($limit['mailboxes'] < 0) $limit['mailboxes'] = $PALANG['pOverview_disabled'];
-if ($limit['maxquota'] < 0) $limit['maxquota'] = $PALANG['pOverview_disabled'];
-
-for ($i = 0; $i < sizeof ($list_domains); $i++)
-{
- if ($fDomain == $list_domains[$i])
- {
- print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n";
- }
- else
- {
- print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n";
- }
-}
-?>
-</select>
-<input type="hidden" name="limit" value="0" />
-<input class="button" type="submit" name="go" value="<?php print $PALANG['pOverview_button']; ?>" />
-</form>
-<h4><?php print $PALANG['pOverview_welcome'] . $fDomain; ?></h4>
-<p><?php print $PALANG['pOverview_alias_alias_count'] . ": " . $limit['alias_count'] . " / " . $limit['aliases']; ?></p>
-<p><?php print $PALANG['pOverview_alias_mailbox_count'] . ": " . $limit['mailbox_count'] . " / " . $limit['mailboxes']; ?></p>
-<form name="search" method="post" action="search.php"><?php print $PALANG['pSearch']; ?>:
-<input type="textbox" name="search" size="10" />
-</form>
-</div>
-
-<div id="nav_bar">
- <table width=730><colgroup span="1"><col width="550"></col></colgroup>
- <tr><td align=left >
-<?php
-if ($limit['alias_pgindex_count'] ) print "<b>".$PALANG['pOverview_alias_title']."</b>  ";
-($tDisplay_back_show == 1) ? $highlight_at = $tDisplay_back / $CONF['page_size'] + 1 : $highlight_at = 0;
-$current_limit=$highlight_at * $CONF['page_size'];
-for ($i = 0; $i < $limit['alias_pgindex_count']; $i++)
-{
- if ( $i == $highlight_at )
- {
- print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "\"><b>" . $limit['alias_pgindex'][$i] . "</b></a>\n";
- }
- else
- {
- print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "\">" . $limit['alias_pgindex'][$i] . "</a>\n";
- }
-}
-print "</td><td valign=middle align=right>";
-
-if ($tDisplay_back_show == 1)
-{
- print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back\"><img border=\"0\" src=\"$incpath/images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n";
-}
-if ($tDisplay_up_show == 1)
-{
- print "<a href=\"$file?domain=$fDomain&limit=0\"><img border=\"0\" src=\"$incpath/images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n";
-}
-if ($tDisplay_next_show == 1)
-{
- print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next\"><img border=\"0\" src=\"$incpath/images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n";
-}
-print "</td></tr></table></div>\n";
-
-if (sizeof ($tAlias) > 0)
-{
- print "<table id=\"alias_table\">\n";
- print " <tr>\n";
- print " <td colspan=\"7\"><h3>" . $PALANG['pOverview_alias_title'] . "</h3></td>";
- print " </tr>";
- print " <tr class=\"header\">\n";
- if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; }
- print " <td>" . $PALANG['pOverview_alias_address'] . "</td>\n";
- print " <td>" . $PALANG['pOverview_alias_goto'] . "</td>\n";
- print " <td>" . $PALANG['pOverview_alias_modified'] . "</td>\n";
- print " <td>" . $PALANG['pOverview_alias_active'] . "</td>\n";
- print " <td colspan=\"2\"> </td>\n";
- print " </tr>\n";
-
- for ($i = 0; $i < sizeof ($tAlias); $i++)
- {
- if ((is_array ($tAlias) and sizeof ($tAlias) > 0))
- {
- print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
- if ($CONF['show_status'] == 'YES')
- {
- print " <td>" . gen_show_status($tAlias[$i]['address']) . "</td>\n";
- }
-
- print " <td>" . $tAlias[$i]['address'] . "</td>\n";
- if ($CONF['alias_goto_limit'] > 0) {
- print " <td>" . ereg_replace (",", "<br>", preg_replace('/^(([^,]+,){'.$CONF['alias_goto_limit'].'})[^,]+,.*/','$1[and '. (substr_count ($tAlias[$i]['goto'], ',') - $CONF['alias_goto_limit'] + 1) .' more...]',$tAlias[$i]['goto'])) . "</td>\n";
- } else {
- print " <td>" . ereg_replace (",", "<br>", $tAlias[$i]['goto']) . "</td>\n";
- }
- print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
-
-
-# TODO: merge superadmin / domain admin code
- if (authentication_has_role('global-admin')) {
-# superadmin code
- $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
- print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain&return=$file?domain=$fDomain" . urlencode ("&limit=" . $current_limit) . "\">" . $active . "</a></td>\n";
- print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
- print " <td><a href=\"delete.php?table=alias" . "&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
-
- } else {
-# domain admin code
- if ($CONF['special_alias_control'] == 'YES')
- {
- $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
- print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
- print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
- print " <td><a href=\"delete.php?table=alias&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
- }
- else
- {
- if ( check_alias_owner ($SESSID_USERNAME, $tAlias[$i]['address']))
- {
- $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
- print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
- print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
- print " <td><a href=\"delete.php?table=mailbox&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
- }
- else
- {
- //this is a special alias, show status only, don't allow changes
- $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
- print " <td>" . $active . "</td>\n";
- print " <td> </td>\n";
- print " <td> </td>\n";
- }
- }
-# end diff
- }
-
- print " </tr>\n";
- }
- }
- print "</table>\n";
-}
-
-if($tCanAddAlias) {
- print "<p><a href=\"create-alias.php?domain=$fDomain\">" . $PALANG['pMenu_create_alias'] . "</a>\n";
-}
-
- print "<div id=\"nav_bar\"><a name=\"MidArrow\" /a>\n<table width=730><colgroup span=\"1\"> <col width=\"550\"></col></colgroup> <tr><td align=left >";
- if ( $limit['mbox_pgindex_count'] ) print "<b>".$PALANG['pOverview_mailbox_title']."</b>  ";
- ($tDisplay_back_show == 1) ? $highlight_at = $tDisplay_back / $CONF['page_size'] + 1 : $highlight_at = 0;
- for ($i = 0; $i < $limit['mbox_pgindex_count']; $i++)
- {
- if ( $i == $highlight_at )
- {
- print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "#MidArrow\"><b>" . $limit['mbox_pgindex'][$i] . "</b></a>\n";
- }
- else
- {
- print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "#MidArrow\">" . $limit['mbox_pgindex'][$i] . "</a>\n";
- }
- }
- print "</td><td valign=middle align=right>";
-
-if ($tDisplay_back_show == 1)
-{
- print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back#MidArrow\"><img border=\"0\" src=\"$incpath/images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n";
-}
-if ($tDisplay_up_show == 1)
-{
- print "<a href=\"$file?domain=$fDomain&limit=0#MidArrow\"><img border=\"0\" src=\"$incpath/images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n";
-}
-if ($tDisplay_next_show == 1)
-{
- print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next#MidArrow\"><img border=\"0\" src=\"$incpath/images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n";
-}
-print "</td></tr></table></div>\n";
-
-if (sizeof ($tMailbox) > 0)
-{
- $colspan=8;
- if ($CONF['vacation_control_admin'] == 'YES') $colspan=$colspan+1;
- if ($CONF['alias_control_admin'] == 'YES') $colspan=$colspan+1;
- print "<table id=\"mailbox_table\">\n";
- print " <tr>\n";
- print " <td colspan=\"$colspan\"><h3>" . $PALANG['pOverview_mailbox_title'] . "</h3></td>";
- print " </tr>";
- print " <tr class=\"header\">\n";
- if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; }
- print " <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n";
- print " <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n";
- if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pOverview_mailbox_quota'] . "</td>\n";
- print " <td>" . $PALANG['pOverview_mailbox_modified'] . "</td>\n";
- print " <td>" . $PALANG['pOverview_mailbox_active'] . "</td>\n";
- $colspan = $colspan - 6;
- print " <td colspan=\"$colspan\"> </td>\n";
- print " </tr>\n";
-
- for ($i = 0; $i < sizeof ($tMailbox); $i++)
- {
- if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0))
- {
- print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
-
- if ($CONF['show_status'] == 'YES')
- {
- print " <td>" . gen_show_status($tMailbox[$i]['username']) . "</td>\n";
- }
-
- print " <td>" . $tMailbox[$i]['username'] . "</td>\n";
- print " <td>" . $tMailbox[$i]['name'] . "</td>\n";
- if ($CONF['quota'] == 'YES')
- {
- print " <td>";
- if ($tMailbox[$i]['quota'] == 0)
- {
- print $PALANG['pOverview_unlimited'];
- }
- elseif ($tMailbox[$i]['quota'] < 0)
- {
- print $PALANG['pOverview_disabled'];
- }
- else
- {
- print divide_quota ($tMailbox[$i]['quota']);
- }
- print "</td>\n";
- }
- print " <td>" . $tMailbox[$i]['modified'] . "</td>\n";
- $active = ($tMailbox[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
- print " <td><a href=\"edit-active.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
-
- if ($CONF['vacation_control_admin'] == 'YES')
- {
- $v_active_int = $tMailbox[$i]['v_active'];
- if($v_active_int !== -1) {
- if($v_active_int == 1) {
- $v_active = $PALANG['pOverview_vacation_edit'];
- }
- else {
- $v_active = $PALANG['pOverview_vacation_option'];
- }
- print "<td><a href=\"edit-vacation.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $v_active . "</a></td>\n";
- }
- else {
- // can't tell vacation state - broken pgsql query
- echo "<td> </td>\n";
- }
- }
-
- $edit_aliases=0;
- if ( authentication_has_role('global-admin') && $CONF['alias_control_admin'] == 'YES') $edit_aliases = 1;
- if ( (! authentication_has_role('global-admin')) && $CONF['alias_control'] == 'YES') $edit_aliases = 1;
-
- if ($edit_aliases == 1)
- {
- print " <td><a href=\"edit-alias.php?address=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['pOverview_alias_edit'] . "</a></td>\n";
- }
-
- print " <td><a href=\"edit-mailbox.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
- print " <td><a href=\"delete.php?table=mailbox" . "&delete=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n";
- print " </tr>\n";
- }
- }
- print "</table>\n";
- print "<div id=\"nav_bar\"><a name=\"LowArrow\" /a>\n";
- if ($tDisplay_back_show == 1)
- {
- print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back#LowArrow\"><img border=\"0\" src=\"$incpath/images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n";
- }
- if ($tDisplay_up_show == 1)
- {
- print "<a href=\"$file?domain=$fDomain&limit=0#LowArrow\"><img border=\"0\" src=\"$incpath/images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n";
- }
- if ($tDisplay_next_show == 1)
- {
- print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next#LowArrow\"><img border=\"0\" src=\"$incpath/images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n";
- }
- print "</div>\n";
-
-}
-if($tCanAddMailbox) {
- print "<p><a href=\"create-mailbox.php?domain=$fDomain\">" . $PALANG['pMenu_create_mailbox'] . "</a>\n";
-}
-
-if ($CONF['show_status'] == 'YES' && $CONF['show_status_key'] == 'YES')
-{
- print "<br><br>";
- if ($CONF['show_undeliverable'] == 'YES')
- {
- print " <span style='background-color:" . $CONF['show_undeliverable_color'] .
- "'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_undeliverable'] . "\n";
- }
- if ($CONF['show_popimap'] == 'YES')
- {
- print " <span style='background-color:" . $CONF['show_popimap_color'] .
- "'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_popimap'] . "\n";
- }
- if ( $CONF['show_custom_count'] > 0 )
- {
- for ($i = 0; $i < sizeof ($CONF['show_custom_domains']); $i++)
- {
- print " <span style='background-color:" . $CONF['show_custom_colors'][$i] . "'>" .
- $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_custom'] .
- $CONF['show_custom_domains'][$i] . "\n";
- }
- }
-}
-
-/* vim: set ft=php expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|