function table_row_add_extra($row, $row_key, $data, $class = "") { global $sess, $auth, $perm, $Path; $db = new DB_postfix(); echo "<td class='btable'>"; echo " <a href=\"" . $sess->url('postfix_mailbox.php') . $sess->add_query(array("domain" => $data["domain"])) . "\">mailboxes"; $db->query("select count(*) from postfix_mailbox where email like '%@" . $data["domain"] . "'"); if ($db->next_record()) { echo "(" . $db->f(0) . ")"; } echo "</a>"; echo " <a href=\"" . $sess->url('postfix_virtual.php') . $sess->add_query(array("domain" => $data["domain"])) . "\">aliases"; $db->query("select count(*) from postfix_virtual where email like '%@" . $data["domain"] . "'"); if ($db->next_record()) { echo "(" . $db->f(0) . ")"; } echo "</a>"; if ($perm) { if ($perm->have_perm("admin")) { echo " <a href=\"" . $sess->url('postfix_virtual_domains.php') . $sess->add_query(array("cmd" => "Delete", "id" => $data["id"])) . "\">delete</a>"; } } if ($this->edit) { echo "<input type='submit' value='Save' name='submit' class='ipeh'> "; echo "<input type='hidden' value='" . $data["id"] . "' name='id'> "; } echo "</td>"; }
function ListDomains($db, $sql, $title) { global $sess; $db2 = new DB_postfix(); $db->query($sql); echo "<tr><td colspan=4><h3>{$title}</h3></td></tr>\n"; $count = 0; while ($db->next_record()) { if ($domain = $db->f(0)) { $count++; $db2->query("select count(*) from postfix_vacation where email like '%" . $domain . "'"); $db2->next_record(); $vacount = $db2->f(0); $db2->query("select count(*) from postfix_mailbox where domain='" . $domain . "'"); $db2->next_record(); $mbcount = $db2->f(0); $db2->query("select count(*) from postfix_virtual where email='@" . $domain . "'"); $db2->next_record(); $cacount = $db2->f(0); $db2->query("select count(*) from postfix_virtual where email like '%" . $domain . "'"); $db2->next_record(); $fwcount = $db2->f(0); $query = $sess->add_query(array("domain" => $domain)); printf("<tr><td>%s</td><td><a href=%s%s>Mailboxes (%d)</a></td>" . "<td><a href=%s%s>Forwards (%d)</a></td><td><a href=%s%s>Vacation (%d)</a></td>\n", $domain, $sess->url("postfix_mailbox.php"), $query, $mbcount, $sess->url("postfix_virtual.php"), $query, $fwcount, $sess->url("Vacation.php"), $query, $vacount); printf("<td><a href=%s>Logs</a></td>", $sess->url("postfix_logs.php") . $sess->add_query(array("domain" => $domain))); if ($cacount) { printf("<td> <a href=%s>Recipient Access</a></td>", $sess->url("postfix_recip_access.php") . $sess->add_query(array("domain" => $domain))); } echo "</tr>\n"; } } }
} // When we hit that page a second time, the array named // by $base will be set and we must generate the $query. // Ah, and don\'t set $base to "q" when $q is your Sql_Query // object... :-) if (!empty($x)) { $query = $q->where("x", 1); } if ($submit == 'Search') { $query = $q->search($t->map_cols); } if (!$query) { $query = "id!='0'"; } $db->query("SELECT COUNT(*) as total from postfix_sender_access where " . $query); $db->next_record(); if ($db->f("total") < $q->start_row - $q->row_count) { $q->start_row = $db->f("total") - $q->row_count; } if ($q->start_row < 0) { $q->start_row = 0; } if (!$sortorder) { $sortorder = "id"; } $query .= " LIMIT " . $q->start_row . "," . $q->row_count; // In any case we must display that form now. Note that the // "x" here and in the call to $q->where must match. // Tag everything as a CSS "query" class. //printf($q->form("x", $t->map_cols, "query")); //printf("<hr>");