/** * Get all the fetchmail account configured (can specify a user id to retrieve only account for a single user) * @param MDB2 $dbm database connection * @param int $user_id */ public function __construct($dbm, $user_id = -1) { $this->dbm = $dbm; $this->position = 0; // Retrieve the accounts list if ($user_id != -1) { $sql_result = $this->dbm->query("SELECT * FROM " . get_table_name('fetchmail_rc') . " WHERE fk_user=?", $user_id); } else { $sql_result = $this->dbm->query("SELECT * FROM " . get_table_name('fetchmail_rc')); } while ($account = $this->dbm->fetch_assoc($sql_result)) { $fetchmailRc = new fetchMailRc(); $fetchmailRc->from_array($account); $this->datas[] = $fetchmailRc; } }