public function user_get_preferences(array $keys, $userId = null)
{
if ($userId === null) {
$userId = $this->kga['user']['userID'];
}
$table = $this->kga['server_prefix'] . "preferences";
$userId = MySQL::SQLValue($userId, MySQL::SQLVALUE_NUMBER);
$preparedKeys = array();
foreach ($keys as $key) {
$preparedKeys[] = MySQL::SQLValue($key);
}
$keysString = implode(",", $preparedKeys);
$query = "SELECT `option`,`value` FROM {$table} WHERE userID = {$userId} AND `option` IN ({$keysString})";
$this->conn->Query($query);
$preferences = array();
while (!$this->conn->EndOfSeek()) {
$row = $this->conn->RowArray();
$preferences[$row['option']] = $row['value'];
}
return $preferences;
}