Thread: SF.net SVN: postfixadmin: [193] trunk/search.php
Brought to you by:
christian_boltz,
gingerdog
From: <Gin...@us...> - 2007-11-04 19:46:33
|
Revision: 193 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=193&view=rev Author: GingerDog Date: 2007-11-04 11:46:37 -0800 (Sun, 04 Nov 2007) Log Message: ----------- search.php: remove dead code, fix for pgsql Modified Paths: -------------- trunk/search.php Modified: trunk/search.php =================================================================== --- trunk/search.php 2007-11-04 19:35:09 UTC (rev 192) +++ trunk/search.php 2007-11-04 19:46:37 UTC (rev 193) @@ -89,23 +89,14 @@ } -/* - - */ - if ($CONF['vacation_control_admin'] == 'YES') + if ($CONF['vacation_control_admin'] == 'YES' && $CONF['vacation'] == '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.username LIKE '%$fSearch%' OR $table_mailbox.name LIKE '%$fSearch%' ORDER BY $table_mailbox.username"); - # TODO: special query for pgsql needed? + echo $query; } else { $query = "SELECT * FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username"; - /* TODO: special query for pgsql really needed? - 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 username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username"; - } - */ } $result = db_query ($query); @@ -117,15 +108,9 @@ { if ('pgsql'==$CONF['database_type']) { - $row['created']=gmstrftime('%c %Z',$row['created']); - $row['modified']=gmstrftime('%c %Z',$row['modified']); - # TODO: code from admin/search.php - # $row['created']=gmstrftime('%c %Z',$row['uts_created']); - # $row['modified']=gmstrftime('%c %Z',$row['uts_modified']); + $row['created']=gmstrftime('%c %Z',strtotime($row['created'])); + $row['modified']=gmstrftime('%c %Z',strtotime($row['modified'])); $row['active']=('t'==$row['active']) ? 1 : 0; - # TODO: code from admin/search.php - # unset($row['uts_created']); - # unset($row['uts_modified']); } $tMailbox[] = $row; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-04 19:53:40
|
Revision: 194 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=194&view=rev Author: christian_boltz Date: 2007-11-04 11:53:45 -0800 (Sun, 04 Nov 2007) Log Message: ----------- - removed forgotten debugging code Modified Paths: -------------- trunk/search.php Modified: trunk/search.php =================================================================== --- trunk/search.php 2007-11-04 19:46:37 UTC (rev 193) +++ trunk/search.php 2007-11-04 19:53:45 UTC (rev 194) @@ -92,7 +92,6 @@ if ($CONF['vacation_control_admin'] == 'YES' && $CONF['vacation'] == '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.username LIKE '%$fSearch%' OR $table_mailbox.name LIKE '%$fSearch%' ORDER BY $table_mailbox.username"); - echo $query; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-12-06 21:40:39
|
Revision: 259 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=259&view=rev Author: GingerDog Date: 2007-12-06 13:40:43 -0800 (Thu, 06 Dec 2007) Log Message: ----------- search.php: reindent; and merge patch from amsys - see http://sourceforge.net/tracker/index.php?func=detail&aid=1845743&group_id=191583&atid=937966 Modified Paths: -------------- trunk/search.php Modified: trunk/search.php =================================================================== --- trunk/search.php 2007-12-06 13:03:36 UTC (rev 258) +++ trunk/search.php 2007-12-06 21:40:43 UTC (rev 259) @@ -57,68 +57,77 @@ if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']); } - if (empty ($fSearch) /* && !empty ($fGo) */) - { - header("Location: list-virtual.php?domain=" . $fDomain ) && exit; - } +if (empty ($fSearch) /* && !empty ($fGo) */) +{ + header("Location: list-virtual.php?domain=" . $fDomain ) && exit; +} - if ($CONF['alias_control_admin'] == "YES") - { - $query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.domain,$table_alias.active FROM $table_alias WHERE $table_alias.address LIKE '%$fSearch%' OR $table_alias.goto LIKE '%$fSearch%' ORDER BY $table_alias.address"; - } - else - { - $query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.domain,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.address LIKE '%$fSearch%' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address"; - } +if ($CONF['alias_control_admin'] == "YES") +{ + $query = "SELECT $table_alias.address AS address, $table_alias.goto AS goto, + $table_alias.modified AS modified, $table_alias.domain AS domain, $table_alias.active AS active + FROM $table_alias + WHERE address LIKE '%$fSearch%' OR goto LIKE '%$fSearch%' ORDER BY address"; +} +else +{ + // find all aliases which don't have a matching entry in table_mailbox + $query = "SELECT $table_alias.address AS address, $table_alias.goto AS goto, + $table_alias.modified AS modified, $table_alias.domain AS domain, $table_alias.active AS active + FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username + WHERE address LIKE '%$fSearch%' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address"; - $result = db_query ($query); - if ($result['rows'] > 0) +} + +$result = db_query ($query); +if ($result['rows'] > 0) +{ + while ($row = db_array ($result['result'])) { - while ($row = db_array ($result['result'])) + if (check_owner ($SESSID_USERNAME, $row['domain']) || authentication_has_role('global-admin')) { - if (check_owner ($SESSID_USERNAME, $row['domain']) || authentication_has_role('global-admin')) + if ('pgsql'==$CONF['database_type']) { - if ('pgsql'==$CONF['database_type']) - { - $row['modified']=gmstrftime('%c %Z',$row['modified']); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tAlias[] = $row; - } + $row['modified']=gmstrftime('%c %Z',$row['modified']); + $row['active']=('t'==$row['active']) ? 1 : 0; + } + $tAlias[] = $row; } } +} - if ($CONF['vacation_control_admin'] == 'YES' && $CONF['vacation'] == '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.username LIKE '%$fSearch%' OR $table_mailbox.name LIKE '%$fSearch%' ORDER BY $table_mailbox.username"); - } - else - { - $query = "SELECT * FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username"; - } +if ($CONF['vacation_control_admin'] == 'YES' && $CONF['vacation'] == '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.username LIKE '%$fSearch%' OR $table_mailbox.name LIKE '%$fSearch%' ORDER BY $table_mailbox.username"); +} +else +{ + $query = "SELECT * FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username"; +} - $result = db_query ($query); - if ($result['rows'] > 0) +$result = db_query ($query); +if ($result['rows'] > 0) +{ + while ($row = db_array ($result['result'])) { - while ($row = db_array ($result['result'])) + if (check_owner ($SESSID_USERNAME, $row['domain']) || authentication_has_role('global-admin')) { - if (check_owner ($SESSID_USERNAME, $row['domain']) || authentication_has_role('global-admin')) + if ('pgsql'==$CONF['database_type']) { - if ('pgsql'==$CONF['database_type']) - { - $row['created']=gmstrftime('%c %Z',strtotime($row['created'])); - $row['modified']=gmstrftime('%c %Z',strtotime($row['modified'])); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tMailbox[] = $row; - } + $row['created']=gmstrftime('%c %Z',strtotime($row['created'])); + $row['modified']=gmstrftime('%c %Z',strtotime($row['modified'])); + $row['active']=('t'==$row['active']) ? 1 : 0; + } + $tMailbox[] = $row; } } +} include ("templates/header.php"); include ("templates/menu.php"); include ("templates/search.php"); include ("templates/footer.php"); +// vim:ts=4:sw=4:et ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |