/** * @return int or false * @param User $user * @desc Save the supplied object to the database, and return the id */ public function SaveUser($user) { # check parameters if (!$user instanceof User) { throw new Exception('Unable to save person'); } # build query $table = $this->GetSettings()->GetTable('User'); $this->Lock($table); $s_sql = "UPDATE {$table} SET " . "known_as = " . Sql::ProtectString($this->GetDataConnection(), $user->GetName()) . ", " . "name_first = " . Sql::ProtectString($this->GetDataConnection(), $user->GetFirstName()) . ", " . "name_last = " . Sql::ProtectString($this->GetDataConnection(), $user->GetLastName()) . ", " . "name_sort = " . Sql::ProtectString($this->GetDataConnection(), $user->GetSortName()) . ", " . "email = " . Sql::ProtectString($this->GetDataConnection(), $user->GetEmail()) . ", " . 'date_changed = ' . gmdate('U') . ' ' . 'WHERE user_id = ' . Sql::ProtectNumeric($user->GetId()); $result = $this->GetDataConnection()->query($s_sql); $this->Unlock(); $success = !$this->GetDataConnection()->isError(); return $success ? $user->GetId() : false; }