public function getClientHubs($username) { if (isset($username)) { $stmt = $this->db_connection->prepare('SELECT id FROM clients WHERE username = ?'); if ($stmt->execute(array($username))) { $userid = null; if ($userid = $stmt->fetchColumn()) { if ($stmt = $this->db_connection->query('SELECT * FROM hubs WHERE client_id_fk = ' . $userid)) { if ($hubs = $stmt->fetchAll(PDO::FETCH_ASSOC)) { $allHubs = array(); foreach ($hubs as $hub) { if (isset($hub['password'])) { // Decrypt the hub password $hub['password'] = Crypto::cust_decrypt($hub['password']); } $allHubs[] = $hub; } return $allHubs; } } } } } return array(); }