SF.net SVN: postfixadmin:[1601] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2013-12-08 19:41:05
|
Revision: 1601 http://sourceforge.net/p/postfixadmin/code/1601 Author: christian_boltz Date: 2013-12-08 19:41:01 +0000 (Sun, 08 Dec 2013) Log Message: ----------- various files: - get rid of global $table_* variables, use table_by_key() instead Modified Paths: -------------- trunk/functions.inc.php trunk/list-virtual.php trunk/scripts/postfixadmin-cli.php trunk/viewlog.php Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2013-12-08 18:45:26 UTC (rev 1600) +++ trunk/functions.inc.php 2013-12-08 19:41:01 UTC (rev 1601) @@ -538,7 +538,7 @@ // Call: check_owner (string admin, string domain) // function check_owner ($username, $domain) { - global $table_domain_admins; + $table_domain_admins = table_by_key('domain_admins'); $E_username = escape_string($username); $E_domain = escape_string($domain); $result = db_query ("SELECT 1 FROM $table_domain_admins WHERE username='$E_username' AND (domain='$E_domain' OR domain='ALL') AND active='1'"); @@ -580,7 +580,8 @@ * @return array of domain names. */ function list_domains_for_admin ($username) { - global $table_domain, $table_domain_admins; + $table_domain = table_by_key('domain'); + $table_domain_admins = table_by_key('domain_admins'); $E_username = escape_string($username); @@ -618,9 +619,9 @@ // Call: list_domains () // function list_domains () { - global $table_domain; $list = array(); + $table_domain = table_by_key('domain'); $result = db_query ("SELECT domain FROM $table_domain WHERE domain!='ALL' ORDER BY domain"); if ($result['rows'] > 0) { $i = 0; @@ -1535,7 +1536,7 @@ * Possible actions are defined in $action_list */ function db_log ($domain,$action,$data) { - global $table_log; + $table_log = table_by_key('log'); $REMOTE_ADDR = getRemoteAddr(); $username = authentication_get_username(); @@ -1663,7 +1664,8 @@ // Call: gen_show_status (string alias_address) // function gen_show_status ($show_alias) { - global $CONF, $table_alias; + global $CONF; + $table_alias = table_by_key('alias'); $stat_string = ""; $stat_goto = ""; @@ -1753,17 +1755,4 @@ return $REMOTE_ADDR; } - - -#$table_admin = table_by_key ('admin'); -$table_alias = table_by_key ('alias'); -#$table_alias_domain = table_by_key ('alias_domain'); -$table_domain = table_by_key ('domain'); -$table_domain_admins = table_by_key ('domain_admins'); -$table_log = table_by_key ('log'); -$table_mailbox = table_by_key ('mailbox'); -$table_vacation = table_by_key ('vacation'); -$table_vacation_notification = table_by_key('vacation_notification'); -$table_quota = table_by_key ('quota'); -$table_quota2 = table_by_key ('quota2'); /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2013-12-08 18:45:26 UTC (rev 1600) +++ trunk/list-virtual.php 2013-12-08 19:41:01 UTC (rev 1601) @@ -108,6 +108,9 @@ # aliases # +$table_alias = table_by_key('alias'); +$table_mailbox = table_by_key('mailbox'); + if ($search == "") { $list_param = "domain='$fDomain'"; $sql_domain = " $table_alias.domain='$fDomain' "; @@ -158,16 +161,19 @@ } if (Config::bool('vacation_control_admin')) { + $table_vacation = table_by_key('vacation'); $sql_select .= ", $table_vacation.active AS v_active "; $sql_join .= " LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email "; } if (Config::bool('used_quotas') && Config::bool('new_quota_table')) { + $table_quota2 = table_by_key('quota2'); $sql_select .= ", $table_quota2.bytes as current "; $sql_join .= " LEFT JOIN $table_quota2 ON $table_mailbox.username=$table_quota2.username "; } if (Config::bool('used_quotas') && ( ! Config::bool('new_quota_table') ) ) { + $table_quota = table_by_key('quota'); $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 ) "; Modified: trunk/scripts/postfixadmin-cli.php =================================================================== --- trunk/scripts/postfixadmin-cli.php 2013-12-08 18:45:26 UTC (rev 1600) +++ trunk/scripts/postfixadmin-cli.php 2013-12-08 19:41:01 UTC (rev 1601) @@ -544,19 +544,7 @@ $CONF = Config::read('all'); -//bugfix shitty globals and OOP..... +$dispatcher->dispatch(); -#$table_admin = table_by_key ('admin'); -$table_alias = table_by_key ('alias'); -#$table_alias_domain = table_by_key ('alias_domain'); -$table_domain = table_by_key ('domain'); -$table_domain_admins = table_by_key ('domain_admins'); -$table_log = table_by_key ('log'); -$table_mailbox = table_by_key ('mailbox'); -$table_vacation = table_by_key ('vacation'); -$table_vacation_notification = table_by_key('vacation_notification'); -$table_quota = table_by_key ('quota'); -$table_quota2 = table_by_key ('quota2'); - -$dispatcher->dispatch(); +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ ?> Modified: trunk/viewlog.php =================================================================== --- trunk/viewlog.php 2013-12-08 18:45:26 UTC (rev 1600) +++ trunk/viewlog.php 2013-12-08 19:41:01 UTC (rev 1601) @@ -56,6 +56,7 @@ if ($error != 1) { + $table_log = table_by_key('log'); $query = "SELECT timestamp,username,domain,action,data FROM $table_log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10"; if (db_pgsql()) { $query = "SELECT extract(epoch from timestamp) as timestamp,username,domain,action,data FROM $table_log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |