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"; } } }
$q->row_count = $rowcount; } // 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"));
} get_request_values("x,domain"); // 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 ($x) { $query = $q->where("x", 1); } if ($submit == 'Search') { $query = $q->search($t->map_cols); } if (empty($query)) { $query = "email like '%" . $domain . "'"; } $db->query("SELECT COUNT(*) as total from postfix_virtual 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) { $q->start_row = 0; } if ($q->start_row < 2) { $q->start_row = 0; } if (!$q->row_count) { $q->row_count = 50; } if (!$sortorder) { $sortorder = "id";
} if (!empty($rowcount)) { $q->start_row = $startingwith; $q->row_count = $rowcount; } // 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 (!$query) { $query = "id!='0'"; } $db->query("SELECT COUNT(*) as total from postfix_external_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; } $sortorder = str_replace("address", "INET_ATON(address),address", $sortorder); if (!$sortorder) { $sortorder = "inet_aton(address),reverse(address)"; } if (!strpos("order by", $query)) { $query .= " order by {$sortorder}"; } $query .= " LIMIT " . $q->start_row . "," . $q->row_count;
if ($domain) { $query = "email like '%" . $domain . "'"; } else { $query = "id!=0"; } } } if ($auth) { if ($domain) { if (in_array($domain, $domains)) { $query = "email like '%" . $domain . "'"; } } } } $db->query("SELECT COUNT(*) as total from vacation 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 .= " Order By " . $sortorder . " 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. if ($perm) {
$q->row_count = $rowcount; } // 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 (isset($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_transport 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 = "domain"; } // $query .= " LIMIT ".$q->start_row.",".$q->row_count; // $query = "id!='0' order by domain"; // 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.
switch ($cmd) { case "View": case "Delete": $f->freeze(); case "Add": case "Edit": $origcmd = $cmd; echo "<font class=bigTextBold>{$cmd} postfix _mailbox</font>\n"; echo "<table><tr><td>"; $f->display(); echo "</td><td>"; if ($origcmd != 'Add') { $t = new table(); $t->heading = 'on'; $sql = "select email as `Email Aliases` from postfix_virtual where destination like '%{$email}%'"; $db->query($sql); $t->show_result($db, "default"); } echo "</td></tr></table><pre>"; if ($maildir) { system("/usr/bin/ssh vmail\\@mail.accessplus.com.au 'du -h {$maildir}; echo \"\n\"; ls -lh " . $maildir . "*'"); } echo "</pre>"; break; default: $cmd = "Query"; class my_postfix_mailboxTable extends Table { var $classname = "postfix_mailboxTable"; function table_row_add_extra($row, $row_key, $data, $class = "") {