- while ($row = $result->fetch_object()) {
- $all[] = $row->id;
- }
- }
-
- return $all;
- }
-
- public function getQMails($offset = -1, $rowsPerPage = -1, $recipient = 'all') {
- $row = array();
- $this->changeCharset();
- $query = "SELECT DISTINCT quarantine.mail_id, secret_id, rs, bspam_level, ";
- $query .= "(UNIX_TIMESTAMP(time_iso) + (3600 * 2)) AS time_iso, ";
- $query .= "SUBSTRING(sender.email,1,35) AS sender, ";
- $query .= "SUBSTRING(recipient.email,1,28) AS recipient, size, msgrcpt.content ";
- $query .= "AS quaratinefor, SUBSTRING( subject, 1, 25) AS subject FROM ";
- $query .= "`quarantine` LEFT JOIN msgrcpt ON msgrcpt.mail_id = quarantine.mail_id ";
- $query .= "LEFT JOIN msgs ON msgs.mail_id = quarantine.mail_id LEFT JOIN maddr AS ";
- $query .= "recipient ON msgrcpt.rid = recipient.id LEFT JOIN maddr AS sender ON ";
- $query .= "msgs.sid = sender.id WHERE msgrcpt.rs != 'R' AND msgrcpt.rs != 'D'";
-
- if ($recipient != 'all') {
- $query .= " and recipient.email = '$recipient'";
- }
-
- if ($offset >= 0 && $rowsPerPage >= 0) {
- $result = $this->con->query($query, MYSQLI_STORE_RESULT);
- if ($result) {
- $this->numRows = $result->num_rows;
- $result->free();
- } else {
- $this->numRows = 0;
- }
- $query .= " ORDER BY time_iso DESC LIMIT $offset, $rowsPerPage";
- }
-
- if ($result = $this->con->query($query, MYSQLI_USE_RESULT)) {
- if ($this->numRows < 0)
- $this->numRows = $result->num_rows;
- while ($obj = $result->fetch_object()) {
- $row[] = $obj;
- }
- $result->free();
- }
-
- return $row;
- }
-
- public function numRows() {
- return $this->numRows;
- }
-
- public function getMail($id) {
- $row = null;
-
- $this->changeCharset();
- $query = "SELECT * FROM quarantine WHERE mail_id = '$id'";
- if ($result = $this->con->query($query, MYSQLI_USE_RESULT)) {
- $row = $result->fetch_object();
- }
-
- return $row;
- }
+ while ($row = $result->fetch_object()) {
+ $all[] = $row->id;
+ }
+ }
+
+ return $all;
+ }
+
+ public function getQMails($offset = -1, $rowsPerPage = -1, $recipient = 'all') {
+ $row = array();
+ $this->changeCharset();
+ $query = "SELECT DISTINCT quarantine.mail_id, secret_id, rs, bspam_level, ";
+ $query .= "(UNIX_TIMESTAMP(time_iso) + (3600 * 2)) AS time_iso, ";
+ $query .= "SUBSTRING(sender.email,1,35) AS sender, ";
+ $query .= "SUBSTRING(recipient.email,1,28) AS recipient, size, msgrcpt.content ";
+ $query .= "AS quaratinefor, SUBSTRING( subject, 1, 25) AS subject FROM ";
+ $query .= "`quarantine` LEFT JOIN msgrcpt ON msgrcpt.mail_id = quarantine.mail_id ";
+ $query .= "LEFT JOIN msgs ON msgs.mail_id = quarantine.mail_id LEFT JOIN maddr AS ";
+ $query .= "recipient ON msgrcpt.rid = recipient.id LEFT JOIN maddr AS sender ON ";
+ $query .= "msgs.sid = sender.id WHERE msgrcpt.rs != 'R' AND msgrcpt.rs != 'D'";
+
+ if ($recipient != 'all') {
+ $query .= " and recipient.email = '$recipient'";
+ }
+
+ if ($offset >= 0 && $rowsPerPage >= 0) {
+ $result = $this->con->query($query, MYSQLI_STORE_RESULT);
+ if ($result) {
+ $this->numRows = $result->num_rows;
+ $result->free();
+ } else {
+ $this->numRows = 0;
+ }
+ $query .= " ORDER BY time_iso DESC LIMIT $offset, $rowsPerPage";
+ }
+
+ if ($result = $this->con->query($query, MYSQLI_USE_RESULT)) {
+ if ($this->numRows < 0)
+ $this->numRows = $result->num_rows;
+ while ($obj = $result->fetch_object()) {
+ $row[] = $obj;
+ }
+ $result->free();
+ }
+
+ return $row;
+ }
+
+ public function numRows() {
+ return $this->numRows;
+ }
+
+ public function getMail($id) {
+ $row = null;
+
+ $this->changeCharset();
+ $query = "SELECT * FROM quarantine WHERE mail_id = '$id'";
+ if ($result = $this->con->query($query, MYSQLI_USE_RESULT)) {
+ $row = $result->fetch_object();
+ }
+
+ return $row;
+ }