Exemplo n.º 1
0
 public function getLastInsertID($table, $where = array())
 {
     $table_whitelist = array("team", "organization_user", "feed_entry");
     if (!in_array($table, $table_whitelist)) {
         return array();
     }
     $where["organization_id"] = $this->organization_id;
     if ($table !== "organization_user") {
         $where["organization_domain_id"] = $this->organization_domain_id;
     }
     $fields = DBHandler::createFieldString($fields, "t", $safe_fields);
     $where = DBHandler::createWhereString($where, "t");
     $res = $this->dbh->query("SELECT MAX(t.`id`) as id FROM `{$table}` t WHERE {$where[0]}", $where[1]);
     return isset($res[0]) ? $res[0]['id'] : 0;
 }