Thread: SF.net SVN: postfixadmin:[404] trunk/list-virtual.php
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2008-07-18 22:35:24
|
Revision: 404 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=404&view=rev Author: christian_boltz Date: 2008-07-18 22:35:33 +0000 (Fri, 18 Jul 2008) Log Message: ----------- list-virtual.php: - always initialize $tAliasDomains and $tTargetDomain (makes sure no evil data comes in, and also fixes the PHP notice) Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2008-07-17 20:58:03 UTC (rev 403) +++ trunk/list-virtual.php 2008-07-18 22:35:33 UTC (rev 404) @@ -82,6 +82,7 @@ $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE target_domain='$fDomain' ORDER BY alias_domain LIMIT $page_size OFFSET $fDisplay"; } $result = db_query ($query); +$tAliasDomains = array(); if ($result['rows'] > 0) { while ($row = db_array ($result['result'])) @@ -101,6 +102,7 @@ $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE alias_domain='$fDomain'"; } $result = db_query ($query); +$tTargetDomain = ""; if ($result['rows'] > 0) { if($row = db_array ($result['result'])) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2008-08-16 12:05:34
|
Revision: 447 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=447&view=rev Author: christian_boltz Date: 2008-08-16 12:05:44 +0000 (Sat, 16 Aug 2008) Log Message: ----------- list-virtual.php: - show links to create mailboxes or alias even on disabled domains https://sourceforge.net/tracker/?func=detail&atid=937967&aid=2054502&group_id=191583 (Only the first two lines and the last } (both removed) are real changes, everything else is a whitespace fix) Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2008-08-14 22:08:38 UTC (rev 446) +++ trunk/list-virtual.php 2008-08-16 12:05:44 UTC (rev 447) @@ -190,23 +190,20 @@ $tDisplay_next = $fDisplay + $page_size; } - $active = $limit['active']; - if($active == 't' || $active == 1) { - $backup_mx = $limit['backupmx']; - if($backup_mx == 'f' || $backup_mx == 0) { - if($limit['aliases'] == 0) { - $tCanAddAlias = true; - } - elseif($limit['alias_count'] < $limit['aliases']) { - $tCanAddAlias = true; - } - if($limit['mailboxes'] == 0) { - $tCanAddMailbox = true; - } - elseif($limit['mailbox_count'] < $limit['mailboxes']) { - $tCanAddMailbox = true; - } + $backup_mx = $limit['backupmx']; + if($backup_mx == 'f' || $backup_mx == 0) { + if($limit['aliases'] == 0) { + $tCanAddAlias = true; } + elseif($limit['alias_count'] < $limit['aliases']) { + $tCanAddAlias = true; + } + if($limit['mailboxes'] == 0) { + $tCanAddMailbox = true; + } + elseif($limit['mailbox_count'] < $limit['mailboxes']) { + $tCanAddMailbox = true; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-01-25 22:22:10
|
Revision: 553 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=553&view=rev Author: christian_boltz Date: 2009-01-25 21:37:42 +0000 (Sun, 25 Jan 2009) Log Message: ----------- list-virtual.php - switch to boolconf() to avoid "undefined variable" warning Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2009-01-25 21:36:08 UTC (rev 552) +++ trunk/list-virtual.php 2009-01-25 21:37:42 UTC (rev 553) @@ -139,7 +139,7 @@ if ($CONF['vacation_control_admin'] == 'YES') { - if ($CONF['used_quotas'] == 'YES') + if (boolconf('used_quotas')) $query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota.current FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username WHERE $table_mailbox.domain='$fDomain' AND $table_quota.path='quota/storage' ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; else $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 $page_size OFFSET $fDisplay"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-04-18 19:38:24
|
Revision: 630 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=630&view=rev Author: GingerDog Date: 2009-04-18 19:38:20 +0000 (Sat, 18 Apr 2009) Log Message: ----------- reindent; fix postgres date formatting issue with +01 times Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2009-04-15 23:32:45 UTC (rev 629) +++ trunk/list-virtual.php 2009-04-18 19:38:20 UTC (rev 630) @@ -36,11 +36,11 @@ $SESSID_USERNAME = authentication_get_username(); if (authentication_has_role('global-admin')) { - $list_domains = list_domains (); - $is_superadmin = 1; + $list_domains = list_domains (); + $is_superadmin = 1; } else { - $list_domains = list_domains_for_admin(authentication_get_username()); - $is_superadmin = 0; + $list_domains = list_domains_for_admin(authentication_get_username()); + $is_superadmin = 0; } $tAlias = array(); @@ -50,153 +50,156 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") { - if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']); - if (isset ($_GET['limit'])) $fDisplay = intval ($_GET['limit']); + if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']); + if (isset ($_GET['limit'])) $fDisplay = intval ($_GET['limit']); } else { - if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']); - if (isset ($_POST['limit'])) $fDisplay = intval ($_POST['limit']); + if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']); + 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 + # 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 (!check_owner(authentication_get_username(), $fDomain)) { -# die($PALANG['invalid_parameter']); - header("Location: list-domain.php"); # domain not owned by this admin - exit(0); + # die($PALANG['invalid_parameter']); + header("Location: list-domain.php"); # domain not owned by this admin + exit(0); } if (boolconf('alias_domain')) { - # Alias-Domains - # first try to get a list of other domains pointing - # to this currently chosen one (aka. alias domains) - $query = "SELECT $table_alias_domain.alias_domain,$table_alias_domain.target_domain,$table_alias_domain.modified,$table_alias_domain.active FROM $table_alias_domain WHERE target_domain='$fDomain' ORDER BY $table_alias_domain.alias_domain LIMIT $fDisplay, $page_size"; - if ('pgsql'==$CONF['database_type']) - { - $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE target_domain='$fDomain' ORDER BY alias_domain LIMIT $page_size OFFSET $fDisplay"; - } - $result = db_query ($query); - $tAliasDomains = array(); - 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; - } - $tAliasDomains[] = $row; - } - } - # now let's see if the current domain itself is an alias for another domain - $query = "SELECT $table_alias_domain.alias_domain,$table_alias_domain.target_domain,$table_alias_domain.modified,$table_alias_domain.active FROM $table_alias_domain WHERE alias_domain='$fDomain'"; - if ('pgsql'==$CONF['database_type']) - { - $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE alias_domain='$fDomain'"; - } - $result = db_query ($query); - $tTargetDomain = ""; - if ($result['rows'] > 0) - { - if($row = db_array ($result['result'])) - { - if ('pgsql'==$CONF['database_type']) - { - $row['modified']=gmstrftime('%c %Z',$row['modified']); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tTargetDomain = $row; - } - } + # Alias-Domains + # first try to get a list of other domains pointing + # to this currently chosen one (aka. alias domains) + $query = "SELECT $table_alias_domain.alias_domain,$table_alias_domain.target_domain,$table_alias_domain.modified,$table_alias_domain.active FROM $table_alias_domain WHERE target_domain='$fDomain' ORDER BY $table_alias_domain.alias_domain LIMIT $fDisplay, $page_size"; + if ('pgsql'==$CONF['database_type']) + { + $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE target_domain='$fDomain' ORDER BY alias_domain LIMIT $page_size OFFSET $fDisplay"; + } + $result = db_query ($query); + $tAliasDomains = array(); + 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; + } + $tAliasDomains[] = $row; + } + } + # now let's see if the current domain itself is an alias for another domain + $query = "SELECT $table_alias_domain.alias_domain,$table_alias_domain.target_domain,$table_alias_domain.modified,$table_alias_domain.active FROM $table_alias_domain WHERE alias_domain='$fDomain'"; + if ('pgsql'==$CONF['database_type']) + { + $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE alias_domain='$fDomain'"; + } + $result = db_query ($query); + $tTargetDomain = ""; + if ($result['rows'] > 0) + { + if($row = db_array ($result['result'])) + { + if ('pgsql'==$CONF['database_type']) + { + $row['modified']=gmstrftime('%c %Z',$row['modified']); + $row['active']=('t'==$row['active']) ? 1 : 0; + } + $tTargetDomain = $row; + } + } } $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) - OR - ($table_alias.domain='$fDomain' - AND $table_alias.goto LIKE '%,%' - AND $table_mailbox.maildir IS NOT NULL) - ORDER BY $table_alias.address LIMIT $fDisplay, $page_size"; + $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) + OR + ($table_alias.domain='$fDomain' + AND $table_alias.goto LIKE '%,%' + AND $table_mailbox.maildir IS NOT NULL) + ORDER BY $table_alias.address LIMIT $fDisplay, $page_size"; if ('pgsql'==$CONF['database_type']) { - $query = "SELECT address, - goto, - modified, - active - FROM $table_alias WHERE domain='$fDomain' - AND NOT EXISTS(SELECT 1 FROM $table_mailbox - WHERE username=$table_alias.address - AND $table_alias.goto NOT LIKE '%,%') - ORDER BY address LIMIT $page_size OFFSET $fDisplay"; + $query = "SELECT address, + goto, + modified, + active + FROM $table_alias WHERE domain='$fDomain' + AND NOT EXISTS(SELECT 1 FROM $table_mailbox + WHERE username=$table_alias.address + AND $table_alias.goto NOT LIKE '%,%') + ORDER BY address LIMIT $page_size OFFSET $fDisplay"; } $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; - } + while ($row = db_array ($result['result'])) + { + if ('pgsql'==$CONF['database_type']) + { + //. at least in my database, $row['modified'] already looks like : 2009-04-11 21:38:10.75586+01, + // while gmstrftime expects an integer value. strtotime seems happy though. + //$row['modified']=gmstrftime('%c %Z',$row['modified']); + $row['modified'] = date('Y-m-d H:i', strtotime($row['modified'])); + $row['active']=('t'==$row['active']) ? 1 : 0; + } - /* Has a real mailbox as well? Remove the address from $row['goto'] in order to edit just the real aliases */ - if (strstr ($row['goto'], ',') != FALSE) - { - $row['goto'] = preg_replace ('/\s*,*\s*' . $row['address'] . '\s*,*\s*/', '', $row['goto']); - } + /* Has a real mailbox as well? Remove the address from $row['goto'] in order to edit just the real aliases */ + if (strstr ($row['goto'], ',') != FALSE) + { + $row['goto'] = preg_replace ('/\s*,*\s*' . $row['address'] . '\s*,*\s*/', '', $row['goto']); + } - $tAlias[] = $row; - } + $tAlias[] = $row; + } } if ($CONF['vacation_control_admin'] == 'YES') { - if (boolconf('used_quotas')) - $query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota.current FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username WHERE $table_mailbox.domain='$fDomain' AND $table_quota.path='quota/storage' ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; - else - $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 $page_size OFFSET $fDisplay"; + if (boolconf('used_quotas')) + $query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota.current FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username WHERE $table_mailbox.domain='$fDomain' AND $table_quota.path='quota/storage' ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; + else + $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 $page_size OFFSET $fDisplay"; } else { - $query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $fDisplay, $page_size"; - 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 $page_size OFFSET $fDisplay"; - } + $query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $fDisplay, $page_size"; + 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 $page_size OFFSET $fDisplay"; + } } $result = db_query ($query); if ($result['rows'] > 0) { - while ($row = db_array ($result['result'])) - { - if ('pgsql'==$CONF['database_type']) - { - //var_dump($row); - $row['created']=gmstrftime('%c %Z',strtotime($row['created'])); - $row['modified']=gmstrftime('%c %Z',strtotime($row['modified'])); - $row['active']=('t'==$row['active']) ? 1 : 0; - if($row['v_active'] == NULL) { - $row['v_active'] = 'f'; - } - $row['v_active']=('t'==$row['v_active']) ? 1 : 0; - } - $tMailbox[] = $row; - } + while ($row = db_array ($result['result'])) + { + if ('pgsql'==$CONF['database_type']) + { + // XXX + $row['modified'] = date('Y-m-d H:i', strtotime($row['modified'])); + $row['created'] = date('Y-m-d H:i', strtotime($row['created'])); + $row['active']=('t'==$row['active']) ? 1 : 0; + if($row['v_active'] == NULL) { + $row['v_active'] = 'f'; + } + $row['v_active']=('t'==$row['v_active']) ? 1 : 0; + } + $tMailbox[] = $row; + } } $tCanAddAlias = false; @@ -204,32 +207,32 @@ $limit = get_domain_properties($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; - } + 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; + } - if($limit['aliases'] == 0) { - $tCanAddAlias = true; - } - elseif($limit['alias_count'] < $limit['aliases']) { - $tCanAddAlias = true; - } - if($limit['mailboxes'] == 0) { - $tCanAddMailbox = true; - } - elseif($limit['mailbox_count'] < $limit['mailboxes']) { - $tCanAddMailbox = true; - } + if($limit['aliases'] == 0) { + $tCanAddAlias = true; + } + elseif($limit['alias_count'] < $limit['aliases']) { + $tCanAddAlias = true; + } + if($limit['mailboxes'] == 0) { + $tCanAddMailbox = true; + } + elseif($limit['mailbox_count'] < $limit['mailboxes']) { + $tCanAddMailbox = true; + } } // this is why we need a proper template layer. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2011-04-24 14:23:38
|
Revision: 1053 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=1053&view=rev Author: christian_boltz Date: 2011-04-24 14:23:32 +0000 (Sun, 24 Apr 2011) Log Message: ----------- list-virtual.php: - lots of whitespace fixes to use 4 spaces everywhere (which list-virtual.php has in its vim: comment since a long time) Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2011-04-24 14:08:11 UTC (rev 1052) +++ trunk/list-virtual.php 2011-04-24 14:23:32 UTC (rev 1053) @@ -37,35 +37,32 @@ $SESSID_USERNAME = authentication_get_username(); if (authentication_has_role('global-admin')) { - $list_domains = list_domains (); - $is_superadmin = 1; + $list_domains = list_domains (); + $is_superadmin = 1; } else { - $list_domains = list_domains_for_admin(authentication_get_username()); - $is_superadmin = 0; + $list_domains = list_domains_for_admin(authentication_get_username()); + $is_superadmin = 0; } $tAlias = array(); $tMailbox = array(); $fDisplay = 0; $page_size = $CONF['page_size']; -if ($_SERVER['REQUEST_METHOD'] == "GET") -{ - if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']); - if (isset ($_GET['limit'])) $fDisplay = intval ($_GET['limit']); - $search = escape_string(safeget('search')); +if ($_SERVER['REQUEST_METHOD'] == "GET") { + if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']); + if (isset ($_GET['limit'])) $fDisplay = intval ($_GET['limit']); + $search = escape_string(safeget('search')); +} else { + if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']); + if (isset ($_POST['limit'])) $fDisplay = intval ($_POST['limit']); + $search = escape_string(safepost('search')); } -else -{ - if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']); - if (isset ($_POST['limit'])) $fDisplay = intval ($_POST['limit']); - $search = escape_string(safepost('search')); -} if (count($list_domains) == 0) { # die("no domains"); - flash_error( $PALANG['invalid_parameter'] ); - header("Location: list-domain.php"); # no domains (for this admin at least) - redirect to domain list - exit; + flash_error( $PALANG['invalid_parameter'] ); + header("Location: list-domain.php"); # no domains (for this admin at least) - redirect to domain list + exit; } if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) { @@ -75,15 +72,15 @@ } if(!in_array($fDomain, $list_domains)) { - flash_error( $PALANG['invalid_parameter'] ); - header("Location: list-domain.php"); # invalid domain, or not owned by this admin - exit; + flash_error( $PALANG['invalid_parameter'] ); + header("Location: list-domain.php"); # 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 - header("Location: list-domain.php"); # domain not owned by this admin - exit(0); + 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 + header("Location: list-domain.php"); # domain not owned by this admin + exit(0); } // store fDomain in $_SESSION so after adding/editing aliases/mailboxes we can @@ -102,7 +99,7 @@ $modified_field = 'modified'; if ('pgsql'==$CONF['database_type']) { # TODO: do we really need the extract(epoch from modified) for pgsql? We ust gmstrftime anyway (see below) $modified_field = 'extract(epoch from modified) as modified'; - } + } $query = " SELECT alias_domain,target_domain,$modified_field,active FROM $table_alias_domain @@ -111,35 +108,32 @@ LIMIT $page_size OFFSET $fDisplay "; - $result = db_query ($query); - $tAliasDomains = array(); + $result = db_query ($query); + $tAliasDomains = array(); $can_create_alias_domain = 1; - 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; - } - $tAliasDomains[] = $row; + 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; + } + $tAliasDomains[] = $row; if ($row['target_domain'] == $fDomain) $can_create_alias_domain = 0; - } - } + } + } # TODO: set $can_create_alias_domain = 0; if all domains (of this admin) are already used as alias domains - } +} # # aliases # if ($search == "") { - $sql_domain = " $table_alias.domain='$fDomain' "; - $sql_where = ""; + $sql_domain = " $table_alias.domain='$fDomain' "; + $sql_where = ""; } else { - $sql_domain = db_in_clause("$table_alias.domain", $list_domains); - $sql_where = " AND ( address LIKE '%$search%' OR goto LIKE '%$search%' ) "; + $sql_domain = db_in_clause("$table_alias.domain", $list_domains); + $sql_where = " AND ( address LIKE '%$search%' OR goto LIKE '%$search%' ) "; } $alias_pagebrowser_query = " @@ -155,20 +149,17 @@ "; $result = db_query ($query); -if ($result['rows'] > 0) -{ - while ($row = db_array ($result['result'])) - { - if ('pgsql'==$CONF['database_type']) - { - //. at least in my database, $row['modified'] already looks like : 2009-04-11 21:38:10.75586+01, - // while gmstrftime expects an integer value. strtotime seems happy though. - //$row['modified']=gmstrftime('%c %Z',$row['modified']); - $row['modified'] = date('Y-m-d H:i', strtotime($row['modified'])); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tAlias[] = $row; - } +if ($result['rows'] > 0) { + while ($row = db_array ($result['result'])) { + if ('pgsql'==$CONF['database_type']) { + //. at least in my database, $row['modified'] already looks like : 2009-04-11 21:38:10.75586+01, + // while gmstrftime expects an integer value. strtotime seems happy though. + //$row['modified']=gmstrftime('%c %Z',$row['modified']); + $row['modified'] = date('Y-m-d H:i', strtotime($row['modified'])); + $row['active']=('t'==$row['active']) ? 1 : 0; + } + $tAlias[] = $row; + } } @@ -222,11 +213,9 @@ $result = db_query ($query); -if ($result['rows'] > 0) -{ - while ($row = db_array ($result['result'])) - { - if ($display_mailbox_aliases) { +if ($result['rows'] > 0) { + while ($row = db_array ($result['result'])) { + if ($display_mailbox_aliases) { $goto_split = explode(",", $row['goto']); $row['goto_mailbox'] = 0; $row['goto_other'] = array(); @@ -240,20 +229,19 @@ $row['goto_other'][] = $goto_single; } } - } - if ('pgsql'==$CONF['database_type']) - { - // XXX - $row['modified'] = date('Y-m-d H:i', strtotime($row['modified'])); - $row['created'] = date('Y-m-d H:i', strtotime($row['created'])); - $row['active']=('t'==$row['active']) ? 1 : 0; - if($row['v_active'] == NULL) { - $row['v_active'] = 'f'; - } - $row['v_active']=('t'==$row['v_active']) ? 1 : 0; - } - $tMailbox[] = $row; - } + } + if ('pgsql'==$CONF['database_type']) { + // XXX + $row['modified'] = date('Y-m-d H:i', strtotime($row['modified'])); + $row['created'] = date('Y-m-d H:i', strtotime($row['created'])); + $row['active']=('t'==$row['active']) ? 1 : 0; + if($row['v_active'] == NULL) { + $row['v_active'] = 'f'; + } + $row['v_active']=('t'==$row['v_active']) ? 1 : 0; + } + $tMailbox[] = $row; + } } $tCanAddAlias = false; @@ -261,53 +249,52 @@ $limit = get_domain_properties($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; - } + 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; + } - if($limit['aliases'] == 0) { - $tCanAddAlias = true; - } - elseif($limit['alias_count'] < $limit['aliases']) { - $tCanAddAlias = true; - } - if($limit['mailboxes'] == 0) { - $tCanAddMailbox = true; - } - elseif($limit['mailbox_count'] < $limit['mailboxes']) { - $tCanAddMailbox = true; - } + if($limit['aliases'] == 0) { + $tCanAddAlias = true; + } + elseif($limit['alias_count'] < $limit['aliases']) { + $tCanAddAlias = true; + } + if($limit['mailboxes'] == 0) { + $tCanAddMailbox = true; + } + elseif($limit['mailbox_count'] < $limit['mailboxes']) { + $tCanAddMailbox = true; + } - $limit ['aliases'] = eval_size ($limit ['aliases']); - $limit ['mailboxes'] = eval_size ($limit ['mailboxes']); - $limit ['maxquota'] = eval_size ($limit ['maxquota']); + $limit ['aliases'] = eval_size ($limit ['aliases']); + $limit ['mailboxes'] = eval_size ($limit ['mailboxes']); + $limit ['maxquota'] = eval_size ($limit ['maxquota']); } $gen_show_status = array (); $check_alias_owner = array (); if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) - for ($i = 0; $i < sizeof ($tAlias); $i++) - { - $gen_show_status [$i] = gen_show_status($tAlias[$i]['address']); - $check_alias_owner [$i] = check_alias_owner($SESSID_USERNAME, $tAlias[$i]['address']); - } + for ($i = 0; $i < sizeof ($tAlias); $i++) { + $gen_show_status [$i] = gen_show_status($tAlias[$i]['address']); + $check_alias_owner [$i] = check_alias_owner($SESSID_USERNAME, $tAlias[$i]['address']); + } $gen_show_status_mailbox = array (); $divide_quota = array ('current' => array(), 'quota' => array()); if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) - for ($i = 0; $i < sizeof ($tMailbox); $i++) - { + for ($i = 0; $i < sizeof ($tMailbox); $i++) { $gen_show_status_mailbox [$i] = gen_show_status($tMailbox[$i]['username']); if(isset($tMailbox[$i]['current'])) { $divide_quota ['current'][$i] = divide_quota ($tMailbox[$i]['current']); @@ -315,98 +302,98 @@ if(isset($tMailbox[$i]['quota'])) { $divide_quota ['quota'][$i] = divide_quota ($tMailbox[$i]['quota']); } - } - + } + class cNav_bar { - var $count, $title, $limit, $page_size, $pages, $search; //* arguments - var $url; //* manually - var $fInit, $arr_prev, $arr_next, $arr_top; //* internal - var $anchor; - function cNav_bar ($aTitle, $aLimit, $aPage_size, $aPages, $aSearch) - { - $this->count = count($aPages); - $this->title = $aTitle; - $this->limit = $aLimit; - $this->page_size = $aPage_size; - $this->pages = $aPages; + var $count, $title, $limit, $page_size, $pages, $search; //* arguments + var $url; //* manually + var $fInit, $arr_prev, $arr_next, $arr_top; //* internal + var $anchor; + + function cNav_bar ($aTitle, $aLimit, $aPage_size, $aPages, $aSearch) { + $this->count = count($aPages); + $this->title = $aTitle; + $this->limit = $aLimit; + $this->page_size = $aPage_size; + $this->pages = $aPages; if ($aSearch == "") { $this->search = ""; } else { $this->search = "&search=" . htmlentities($aSearch); } - $this->url = ''; - $this->fInit = false; - } - function init () - { - $this->anchor = 'a'.substr ($this->title, 3); - $this->url .= '#'.$this->anchor; - ($this->limit >= $this->page_size) ? $this->arr_prev = ' <a href="?limit='.($this->limit - $this->page_size).$this->search.$this->url.'"><img border="0" src="images/arrow-l.png" title="'.$GLOBALS ['PALANG']['pOverview_left_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_left_arrow'].'"/></a> ' : $this->arr_prev = ''; - ($this->limit > 0) ? $this->arr_top = ' <a href="?limit=0' .$this->search.$this->url.'"><img border="0" src="images/arrow-u.png" title="'.$GLOBALS ['PALANG']['pOverview_up_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_up_arrow'].'"/></a> ' : $this->arr_top = ''; - (($this->limit + $this->page_size) < ($this->count * $this->page_size)) ? $this->arr_next = ' <a href="?limit='.($this->limit + $this->page_size).$this->search.$this->url.'"><img border="0" src="images/arrow-r.png" title="'.$GLOBALS ['PALANG']['pOverview_right_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_right_arrow'].'"/></a> ' : $this->arr_next = ''; - $this->fInit = true; - } - function display_pre () - { - $ret_val = '<div class="nav_bar"'; -//$ret_val .= ' style="background-color:#ffa;"'; - $ret_val .= '>'; - $ret_val .= '<table width="730"><colgroup span="1"><col width="550"></col></colgroup> '; - $ret_val .= '<tr><td align="left">'; - return $ret_val; - } - function display_post () - { - $ret_val = '</td></tr></table></div>'; - return $ret_val; - } - function display_top () - { - $ret_val = ''; - if ($this->count < 1) - return $ret_val; - if (!$this->fInit) - $this->init (); - - $ret_val .= '<a name="'.$this->anchor.'"></a>'; - $ret_val .= $this->display_pre (); - $ret_val .= '<b>'.$this->title.'</b> '; - ($this->limit >= $this->page_size) ? $highlight_at = $this->limit / $this->page_size : $highlight_at = 0; + $this->url = ''; + $this->fInit = false; + } - for ($i = 0; $i < count ($this->pages); $i++) - { - $lPage = $this->pages [$i]; - if ($i == $highlight_at) - $lPage = '<b>'.$lPage.'</b>'; - $ret_val .= '<a href="?limit='.($i * $this->page_size).$this->search.$this->url.'">'.$lPage.'</a>'."\n"; - } - $ret_val .= '</td><td valign="middle" align="right">'; + function init () { + $this->anchor = 'a'.substr ($this->title, 3); + $this->url .= '#'.$this->anchor; + ($this->limit >= $this->page_size) ? $this->arr_prev = ' <a href="?limit='.($this->limit - $this->page_size).$this->search.$this->url.'"><img border="0" src="images/arrow-l.png" title="'.$GLOBALS ['PALANG']['pOverview_left_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_left_arrow'].'"/></a> ' : $this->arr_prev = ''; + ($this->limit > 0) ? $this->arr_top = ' <a href="?limit=0' .$this->search.$this->url.'"><img border="0" src="images/arrow-u.png" title="'.$GLOBALS ['PALANG']['pOverview_up_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_up_arrow'].'"/></a> ' : $this->arr_top = ''; + (($this->limit + $this->page_size) < ($this->count * $this->page_size)) ? $this->arr_next = ' <a href="?limit='.($this->limit + $this->page_size).$this->search.$this->url.'"><img border="0" src="images/arrow-r.png" title="'.$GLOBALS ['PALANG']['pOverview_right_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_right_arrow'].'"/></a> ' : $this->arr_next = ''; + $this->fInit = true; + } - $ret_val .= $this->arr_prev; - $ret_val .= $this->arr_top; - $ret_val .= $this->arr_next; + function display_pre () { + $ret_val = '<div class="nav_bar"'; + //$ret_val .= ' style="background-color:#ffa;"'; + $ret_val .= '>'; + $ret_val .= '<table width="730"><colgroup span="1"><col width="550"></col></colgroup> '; + $ret_val .= '<tr><td align="left">'; + return $ret_val; + } - $ret_val .= $this->display_post (); - return $ret_val; - } - function display_bottom () - { - $ret_val = ''; - if ($this->count < 1) - return $ret_val; - if (!$this->fInit) - $this->init (); - $ret_val .= $this->display_pre (); - $ret_val .= '</td><td valign="middle" align="right">'; + function display_post () { + $ret_val = '</td></tr></table></div>'; + return $ret_val; + } - $ret_val .= $this->arr_prev; - $ret_val .= $this->arr_top; - $ret_val .= $this->arr_next; + function display_top () { + $ret_val = ''; + if ($this->count < 1) + return $ret_val; + if (!$this->fInit) + $this->init (); + + $ret_val .= '<a name="'.$this->anchor.'"></a>'; + $ret_val .= $this->display_pre (); + $ret_val .= '<b>'.$this->title.'</b> '; + ($this->limit >= $this->page_size) ? $highlight_at = $this->limit / $this->page_size : $highlight_at = 0; - $ret_val .= $this->display_post (); - return $ret_val; - } + for ($i = 0; $i < count ($this->pages); $i++) + { + $lPage = $this->pages [$i]; + if ($i == $highlight_at) + $lPage = '<b>'.$lPage.'</b>'; + $ret_val .= '<a href="?limit='.($i * $this->page_size).$this->search.$this->url.'">'.$lPage.'</a>'."\n"; + } + $ret_val .= '</td><td valign="middle" align="right">'; + + $ret_val .= $this->arr_prev; + $ret_val .= $this->arr_top; + $ret_val .= $this->arr_next; + + $ret_val .= $this->display_post (); + return $ret_val; + } + + function display_bottom () { + $ret_val = ''; + if ($this->count < 1) + return $ret_val; + if (!$this->fInit) + $this->init (); + $ret_val .= $this->display_pre (); + $ret_val .= '</td><td valign="middle" align="right">'; + + $ret_val .= $this->arr_prev; + $ret_val .= $this->arr_top; + $ret_val .= $this->arr_next; + + $ret_val .= $this->display_post (); + return $ret_val; + } } $pagebrowser_alias = create_page_browser("$table_alias.address", $alias_pagebrowser_query); @@ -418,7 +405,7 @@ $nav_bar_mailbox->url = '&domain='.$fDomain; //print $nav_bar_alias->display_top (); - + // this is why we need a proper template layer. $fDomain = htmlentities($fDomain, ENT_QUOTES); @@ -442,7 +429,7 @@ $smarty->assign ('tDisplay_next', $tDisplay_next); if(sizeof ($tAliasDomains) > 0) - $smarty->assign ('tAliasDomains', $tAliasDomains); + $smarty->assign ('tAliasDomains', $tAliasDomains); $smarty->assign ('can_create_alias_domain', $can_create_alias_domain); $smarty->assign ('tAlias', $tAlias); @@ -456,11 +443,11 @@ $smarty->assign ('tCanAddMailbox', $tCanAddMailbox); $smarty->assign ('display_mailbox_aliases', $display_mailbox_aliases); if (isset ($_GET ['tab'])) - $_SESSION ['tab'] = $_GET ['tab']; + $_SESSION ['tab'] = $_GET ['tab']; //if (empty ($_GET ['tab'])) -// unset ($_SESSION ['tab']); +// unset ($_SESSION ['tab']); if (!isset ($_SESSION ['tab'])) - $_SESSION ['tab'] = 'mailbox'; + $_SESSION ['tab'] = 'mailbox'; $smarty->assign ('tab', $_SESSION ['tab']); $smarty->assign ('smarty_template', 'list-virtual'); $smarty->display ('index.tpl'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2012-04-08 23:18:35
|
Revision: 1355 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=1355&view=rev Author: christian_boltz Date: 2012-04-08 23:18:29 +0000 (Sun, 08 Apr 2012) Log Message: ----------- list-virtual.php: - pagebrowser: current page is no longer a link Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2012-04-08 23:11:46 UTC (rev 1354) +++ trunk/list-virtual.php 2012-04-08 23:18:29 UTC (rev 1355) @@ -378,9 +378,11 @@ for ($i = 0; $i < count ($this->pages); $i++) { $lPage = $this->pages [$i]; - if ($i == $highlight_at) - $lPage = '<b>'.$lPage.'</b>'; - $ret_val .= '<a href="?limit='.($i * $this->page_size).$this->search.$this->url.'">'.$lPage.'</a>'."\n"; + if ($i == $highlight_at) { + $ret_val .= '<b>'.$lPage.'</b>'."\n"; + } else { + $ret_val .= '<a href="?limit='.($i * $this->page_size).$this->search.$this->url.'">'.$lPage.'</a>'."\n"; + } } $ret_val .= '</td><td valign="middle" align="right">'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-11-30 14:07:03
|
Revision: 779 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=779&view=rev Author: christian_boltz Date: 2009-11-30 14:06:51 +0000 (Mon, 30 Nov 2009) Log Message: ----------- list-virtual.php - add in_array check to avoid that superadmins can enter invalid domains - the check_owner check is probably obsolete after this change. I left it in (with a clear message) until I'm 100% sure that it's really unneeded. - move sticky domain code below error checking - the session should only include valid domains ;-) Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2009-11-30 12:48:25 UTC (rev 778) +++ trunk/list-virtual.php 2009-11-30 14:06:51 UTC (rev 779) @@ -62,12 +62,6 @@ $search = escape_string(safepost('search')); } -// store fDomain in $_SESSION so after adding/editing aliases/mailboxes we can -// take the user back to the appropriate domain listing. (see templates/menu.php) -if($fDomain) { - $_SESSION['list_virtual_sticky_domain'] = $fDomain; -} - if (count($list_domains) == 0) { # die("no domains"); flash_error( $PALANG['invalid_parameter'] ); @@ -77,13 +71,24 @@ if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[0]; -if (!check_owner(authentication_get_username(), $fDomain)) { -# die($PALANG['invalid_parameter']); +if(!in_array($fDomain, $list_domains)) { flash_error( $PALANG['invalid_parameter'] ); + header("Location: list-domain.php"); # 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 header("Location: list-domain.php"); # domain not owned by this admin exit(0); } +// store fDomain in $_SESSION so after adding/editing aliases/mailboxes we can +// take the user back to the appropriate domain listing. (see templates/menu.php) +if($fDomain) { + $_SESSION['list_virtual_sticky_domain'] = $fDomain; +} + # # alias domain # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-12-07 09:21:45
|
Revision: 787 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=787&view=rev Author: GingerDog Date: 2009-12-07 09:21:38 +0000 (Mon, 07 Dec 2009) Log Message: ----------- a) PHP != python; use brackets :) b) fix invalid SQL (at least for postgresql) - list-virtual is broken though in not displaying any mailboxes/aliases Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2009-12-06 01:02:42 UTC (rev 786) +++ trunk/list-virtual.php 2009-12-07 09:21:38 UTC (rev 787) @@ -43,7 +43,6 @@ $list_domains = list_domains_for_admin(authentication_get_username()); $is_superadmin = 0; } - $tAlias = array(); $tMailbox = array(); $fDisplay = 0; @@ -69,7 +68,11 @@ exit; } -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[0]; + } +} if(!in_array($fDomain, $list_domains)) { flash_error( $PALANG['invalid_parameter'] ); @@ -199,14 +202,14 @@ $sql_select = " SELECT $table_mailbox.* "; $sql_from = " FROM $table_mailbox "; $sql_join = ""; -$sql_where = " WHERE 1 "; +$sql_where = " WHERE "; $sql_order = " ORDER BY $table_mailbox.username "; $sql_limit = " LIMIT $page_size OFFSET $fDisplay"; if ($search == "") { - $sql_where .= " AND $table_mailbox.domain='$fDomain' "; + $sql_where .= " $table_mailbox.domain='$fDomain' "; } else { - $sql_where .= " AND " . db_in_clause("$table_mailbox.domain", $list_domains) . " "; + $sql_where .= db_in_clause("$table_mailbox.domain", $list_domains) . " "; $sql_where .= " AND ( $table_mailbox.username LIKE '%$search%' OR $table_mailbox.name LIKE '%$search%' "; if ($display_mailbox_aliases) { $sql_where .= " OR $table_alias.goto LIKE '%$search%' "; @@ -231,12 +234,13 @@ if (boolconf('used_quotas') && ( ! boolconf('new_quota_table') ) ) { $sql_select .= ", $table_quota.current "; $sql_join .= " LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username "; - $sql_where .= " AND ( $table_quota.path='quota/storage' OR $table_quota.path IS NULL ) "; + $sql_where .= " ( $table_quota.path='quota/storage' OR $table_quota.path IS NULL ) "; } $query = "$sql_select\n$sql_from\n$sql_join\n$sql_where\n$sql_order\n$sql_limit"; $result = db_query ($query); + if ($result['rows'] > 0) { while ($row = db_array ($result['result'])) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2010-09-28 20:31:03
|
Revision: 870 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=870&view=rev Author: christian_boltz Date: 2010-09-28 20:30:56 +0000 (Tue, 28 Sep 2010) Log Message: ----------- list-virtual.php: - include $search in pagebrowser navigation links - replace deprecated split() with explode() - fix typo - $GLOABLS instead of $GLOBALS Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2010-09-27 00:13:28 UTC (rev 869) +++ trunk/list-virtual.php 2010-09-28 20:30:56 UTC (rev 870) @@ -246,7 +246,7 @@ while ($row = db_array ($result['result'])) { if ($display_mailbox_aliases) { - $goto_split = split(",", $row['goto']); + $goto_split = explode(",", $row['goto']); $row['goto_mailbox'] = 0; $row['goto_other'] = array(); @@ -345,17 +345,22 @@ class cNav_bar { - var $count, $title, $limit, $page_size, $pages; //* arguments + var $count, $title, $limit, $page_size, $pages, $search; //* arguments var $url; //* manually var $fInit, $arr_prev, $arr_next, $arr_top; //* internal var $anchor; - function cNav_bar ($aCount, $aTitle, $aLimit, $aPage_size, $aPages) + function cNav_bar ($aCount, $aTitle, $aLimit, $aPage_size, $aPages, $aSearch) { $this->count = $aCount; $this->title = $aTitle; $this->limit = $aLimit; $this->page_size = $aPage_size; $this->pages = $aPages; + if ($aSearch == "") { + $this->search = ""; + } else { + $this->search = "&search=$aSearch"; + } $this->url = ''; $this->fInit = false; } @@ -363,9 +368,9 @@ { $this->anchor = 'a'.substr ($this->title, 3); $this->url .= '#'.$this->anchor; - ($this->limit >= $this->page_size) ? $this->arr_prev = ' <a href="?limit='.($this->limit - $this->page_size).$this->url.'"><img border="0" src="images/arrow-l.png" title="'.$GLOBALS ['PALANG']['pOverview_left_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_left_arrow'].'"/></a> ' : $this->arr_prev = ''; - ($this->limit > 0) ? $this->arr_top = ' <a href="?limit=0'.$this->url.'"><img border="0" src="images/arrow-u.png" title="'.$GLOBALS ['PALANG']['pOverview_up_arrow'].'" alt="'.$GLOABLS ['PALANG']['pOverview_up_arrow'].'"/></a> ' : $this->arr_top = ''; - (($this->limit + $this->page_size) < ($this->count * $this->page_size)) ? $this->arr_next = ' <a href="?limit='.($this->limit + $this->page_size).$this->url.'"><img border="0" src="images/arrow-r.png" title="'.$GLOBALS ['PALANG']['pOverview_right_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_right_arrow'].'"/></a> ' : $this->arr_next = ''; + ($this->limit >= $this->page_size) ? $this->arr_prev = ' <a href="?limit='.($this->limit - $this->page_size).$this->search.$this->url.'"><img border="0" src="images/arrow-l.png" title="'.$GLOBALS ['PALANG']['pOverview_left_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_left_arrow'].'"/></a> ' : $this->arr_prev = ''; + ($this->limit > 0) ? $this->arr_top = ' <a href="?limit=0' .$this->search.$this->url.'"><img border="0" src="images/arrow-u.png" title="'.$GLOBALS ['PALANG']['pOverview_up_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_up_arrow'].'"/></a> ' : $this->arr_top = ''; + (($this->limit + $this->page_size) < ($this->count * $this->page_size)) ? $this->arr_next = ' <a href="?limit='.($this->limit + $this->page_size).$this->search.$this->url.'"><img border="0" src="images/arrow-r.png" title="'.$GLOBALS ['PALANG']['pOverview_right_arrow'].'" alt="'.$GLOBALS ['PALANG']['pOverview_right_arrow'].'"/></a> ' : $this->arr_next = ''; $this->fInit = true; } function display_pre () @@ -400,7 +405,7 @@ $lPage = $this->pages [$i]; if ($i == $highlight_at) $lPage = '<b>'.$lPage.'</b>'; - $ret_val .= '<a href="?limit='.($i * $this->page_size).$this->url.'">'.$lPage.'</a>'."\n"; + $ret_val .= '<a href="?limit='.($i * $this->page_size).$this->search.$this->url.'">'.$lPage.'</a>'."\n"; } $ret_val .= '</td><td valign="middle" align="right">'; @@ -430,10 +435,10 @@ } } -$nav_bar_alias = new cNav_bar ($limit['alias_pgindex_count'], $PALANG['pOverview_alias_title'], $fDisplay, $CONF['page_size'], $limit['alias_pgindex']); +$nav_bar_alias = new cNav_bar ($limit['alias_pgindex_count'], $PALANG['pOverview_alias_title'], $fDisplay, $CONF['page_size'], $limit['alias_pgindex'], $search); $nav_bar_alias->url = '&domain='.$fDomain; -$nav_bar_mailbox = new cNav_bar ($limit['mbox_pgindex_count'], $PALANG['pOverview_mailbox_title'], $fDisplay, $CONF['page_size'], $limit['mbox_pgindex']); +$nav_bar_mailbox = new cNav_bar ($limit['mbox_pgindex_count'], $PALANG['pOverview_mailbox_title'], $fDisplay, $CONF['page_size'], $limit['mbox_pgindex'], $search); $nav_bar_mailbox->url = '&domain='.$fDomain; //print $nav_bar_alias->display_top (); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2010-10-12 20:45:30
|
Revision: 874 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=874&view=rev Author: christian_boltz Date: 2010-10-12 20:45:24 +0000 (Tue, 12 Oct 2010) Log Message: ----------- list-virtual.php: - fix displaying of 'modified' column for aliases when using postgres (bugreport mailed by Dominic, neocoretech @SF) - drop MySQL variant of the alias query, the fixed postgres variant works for both - fixed wrong position of $sql_where (search string) - must be outside the sub-query - escape search string in page browser - even if it is unlikely that enough mail adresses contain funny chars to let the pagebrowser appear ;-) Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2010-09-30 22:11:18 UTC (rev 873) +++ trunk/list-virtual.php 2010-10-12 20:45:24 UTC (rev 874) @@ -155,24 +155,13 @@ $sql_where = " AND ( address LIKE '%$search%' OR goto LIKE '%$search%' ) "; } -$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 ($sql_domain AND $table_mailbox.maildir IS NULL $sql_where) - ORDER BY $table_alias.address LIMIT $fDisplay, $page_size"; -if ('pgsql'==$CONF['database_type']) -{ - # TODO: is the different query for pgsql really needed? The mailbox query below also works with both... $query = "SELECT address, goto, - extract(epoch from modified) as modified, + modified, active FROM $table_alias - WHERE $sql_domain AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address $sql_where) + WHERE $sql_domain AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) $sql_where ORDER BY address LIMIT $page_size OFFSET $fDisplay"; -} $result = db_query ($query); if ($result['rows'] > 0) @@ -359,7 +348,7 @@ if ($aSearch == "") { $this->search = ""; } else { - $this->search = "&search=$aSearch"; + $this->search = "&search=" . htmlentities($aSearch); } $this->url = ''; $this->fInit = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2011-02-07 23:26:23
|
Revision: 947 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=947&view=rev Author: GingerDog Date: 2011-02-07 23:26:17 +0000 (Mon, 07 Feb 2011) Log Message: ----------- fix some undefined variables Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2011-02-06 19:07:44 UTC (rev 946) +++ trunk/list-virtual.php 2011-02-07 23:26:17 UTC (rev 947) @@ -323,13 +323,17 @@ } $gen_show_status_mailbox = array (); -$divide_quota = array (); +$divide_quota = array ('current' => array(), 'quota' => array()); if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) for ($i = 0; $i < sizeof ($tMailbox); $i++) { - $gen_show_status_mailbox [$i] = gen_show_status($tMailbox[$i]['username']); - $divide_quota ['current'][$i] = divide_quota ($tMailbox[$i]['current']); - $divide_quota ['quota'][$i] = divide_quota ($tMailbox[$i]['quota']); + $gen_show_status_mailbox [$i] = gen_show_status($tMailbox[$i]['username']); + if(isset($tMailbox[$i]['current'])) { + $divide_quota ['current'][$i] = divide_quota ($tMailbox[$i]['current']); + } + if(isset($tMailbox[$i]['quota'])) { + $divide_quota ['quota'][$i] = divide_quota ($tMailbox[$i]['quota']); + } } class cNav_bar @@ -435,6 +439,9 @@ // this is why we need a proper template layer. $fDomain = htmlentities($fDomain, ENT_QUOTES); +if(empty($_GET['domain'])) { + $_GET['domain'] = ''; +} $smarty->assign ('select_options', select_options ($list_domains, array ($fDomain)), false); $smarty->assign ('nav_bar_alias', array ('top' => $nav_bar_alias->display_top (), 'bottom' => $nav_bar_alias->display_bottom ()), false); $smarty->assign ('nav_bar_mailbox', array ('top' => $nav_bar_mailbox->display_top (), 'bottom' => $nav_bar_mailbox->display_bottom ()), false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2011-07-18 22:24:39
|
Revision: 1083 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=1083&view=rev Author: christian_boltz Date: 2011-07-18 22:24:33 +0000 (Mon, 18 Jul 2011) Log Message: ----------- list-virtual.php - removed superfluous reference to tMessage (not used anywhere) This commit is part of the huge cleanup patch by Dale Blount (lnxus@SF), https://sourceforge.net/tracker/?func=detail&atid=937966&aid=3370510&group_id=191583 Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2011-07-18 22:23:33 UTC (rev 1082) +++ trunk/list-virtual.php 2011-07-18 22:24:33 UTC (rev 1083) @@ -19,7 +19,6 @@ * * Template Variables: * - * tMessage * tAlias * tMailbox * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2011-10-07 22:57:49
|
Revision: 1198 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=1198&view=rev Author: christian_boltz Date: 2011-10-07 22:57:43 +0000 (Fri, 07 Oct 2011) Log Message: ----------- list-virtual.php: - delivery to mailbox with a recipient delimiter (mailbox+foo@domain) was marked as "forward only" This fixes https://sourceforge.net/tracker/?func=detail&aid=3420440&group_id=191583&atid=937964 reported by <stderr1> on #postfixadmin Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2011-09-29 22:39:44 UTC (rev 1197) +++ trunk/list-virtual.php 2011-10-07 22:57:43 UTC (rev 1198) @@ -216,6 +216,9 @@ $result = db_query ($query); if ($result['rows'] > 0) { + $delimiter = preg_quote($CONF['recipient_delimiter'], "/"); + $goto_single_rec_del = ""; + while ($row = db_array ($result['result'])) { if ($display_mailbox_aliases) { $goto_split = explode(",", $row['goto']); @@ -223,7 +226,11 @@ $row['goto_other'] = array(); foreach ($goto_split as $goto_single) { - if ($goto_single == $row['username']) { # delivers to mailbox + if (!empty($CONF['recipient_delimiter'])) { + $goto_single_rec_del = preg_replace('/' .$delimiter. '[^' .$delimiter. '@]*@/', "@", $goto_single); + } + + if ($goto_single == $row['username'] || $goto_single_rec_del == $row['username']) { # delivers to mailbox $row['goto_mailbox'] = 1; } elseif (boolconf('vacation') && strstr($goto_single, '@' . $CONF['vacation_domain']) ) { # vacation alias - TODO: check for full vacation alias # skip the vacation alias, vacation status is detected otherwise This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2011-10-29 22:16:23
|
Revision: 1246 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=1246&view=rev Author: christian_boltz Date: 2011-10-29 22:16:16 +0000 (Sat, 29 Oct 2011) Log Message: ----------- list-virtual.php: - display everything by default, not only mailboxes Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2011-10-25 21:55:28 UTC (rev 1245) +++ trunk/list-virtual.php 2011-10-29 22:16:16 UTC (rev 1246) @@ -467,7 +467,7 @@ //if (empty ($_GET ['tab'])) // unset ($_SESSION ['tab']); if (!isset ($_SESSION ['tab'])) - $_SESSION ['tab'] = 'mailbox'; + $_SESSION ['tab'] = 'all'; $smarty->assign ('tab', $_SESSION ['tab']); $smarty->assign ('smarty_template', 'list-virtual'); $smarty->display ('index.tpl'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2012-04-09 17:55:06
|
Revision: 1362 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=1362&view=rev Author: christian_boltz Date: 2012-04-09 17:55:00 +0000 (Mon, 09 Apr 2012) Log Message: ----------- list-virtual: - if used quota is unknown, display "unknown" instead of "undefined index" Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2012-04-09 15:41:39 UTC (rev 1361) +++ trunk/list-virtual.php 2012-04-09 17:55:00 UTC (rev 1362) @@ -315,6 +315,9 @@ { $divide_quota ['percent'][$i] = min(100, round(($divide_quota ['current'][$i]/max(1,$divide_quota ['quota'][$i]))*100)); $divide_quota ['quota_width'][$i] = ($divide_quota ['percent'][$i] / 100 * 120); + } else { + $divide_quota ['current'][$i] = 'unknown'; # TODO: make translateable + $divide_quota ['quota_width'][$i] = 0; # TODO: use special value? } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gin...@us...> - 2014-02-17 13:44:25
|
Revision: 1640 http://sourceforge.net/p/postfixadmin/code/1640 Author: gingerdog Date: 2014-02-17 13:44:20 +0000 (Mon, 17 Feb 2014) Log Message: ----------- add missing { } Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2014-02-17 13:43:47 UTC (rev 1639) +++ trunk/list-virtual.php 2014-02-17 13:44:20 UTC (rev 1640) @@ -272,17 +272,19 @@ $gen_show_status = array (); $check_alias_owner = array (); -if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) +if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) { foreach (array_keys($tAlias) as $i) { $gen_show_status [$i] = gen_show_status($tAlias[$i]['address']); $check_alias_owner [$i] = check_alias_owner($admin_username, $tAlias[$i]['address']); } +} $gen_show_status_mailbox = array (); $divide_quota = array ('current' => array(), 'quota' => array()); -if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) - for ($i = 0; $i < sizeof ($tMailbox); $i++) { +if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) { + for ($i = 0; $i < sizeof ($tMailbox); $i++) { $gen_show_status_mailbox [$i] = gen_show_status($tMailbox[$i]['username']); + if(isset($tMailbox[$i]['current'])) { $divide_quota ['current'][$i] = divide_quota ($tMailbox[$i]['current']); } @@ -298,7 +300,9 @@ $divide_quota ['quota_width'][$i] = 0; # TODO: use special value? } } - +} + + class cNav_bar { var $count, $title, $limit, $page_size, $pages, $search; //* arguments This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2015-02-28 22:44:53
|
Revision: 1746 http://sourceforge.net/p/postfixadmin/code/1746 Author: christian_boltz Date: 2015-02-28 22:44:51 +0000 (Sat, 28 Feb 2015) Log Message: ----------- list-virtual.php: - replace redirects to list-domain.php with list.php Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2015-02-28 22:42:11 UTC (rev 1745) +++ trunk/list-virtual.php 2015-02-28 22:44:51 UTC (rev 1746) @@ -46,7 +46,7 @@ } 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(!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); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2017-01-26 18:22:56
|
Revision: 1888 http://sourceforge.net/p/postfixadmin/code/1888 Author: christian_boltz Date: 2017-01-26 18:22:55 +0000 (Thu, 26 Jan 2017) Log Message: ----------- Set alias domain-related smarty variables only if alias domains are enabled This avoids "undefined variable" warnings. Reported by Kalavera on IRC. Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2016-12-21 21:32:15 UTC (rev 1887) +++ trunk/list-virtual.php 2017-01-26 18:22:55 UTC (rev 1888) @@ -450,8 +450,10 @@ $smarty->assign ('tDisplay_next_show', $tDisplay_next_show); $smarty->assign ('tDisplay_next', $tDisplay_next); -$smarty->assign ('tAliasDomains', $tAliasDomains); -$smarty->assign ('aliasdomain_data', $aliasdomain_data); +if (Config::bool('alias_domain')) { + $smarty->assign ('tAliasDomains', $tAliasDomains); + $smarty->assign ('aliasdomain_data', $aliasdomain_data); +} $smarty->assign ('tAlias', $tAlias); $smarty->assign ('alias_data', $alias_data); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |