$quoted[] = "'$nick'";
}
- $table = "user";
- if(common_config('db','quote_identifiers')) {
- $table = '"' . $table . '"';
- }
-
$user = new User;
$user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted)));
$user->limit(($this->page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
- $user->orderBy($table .'.nickname ASC');
+ $user->orderBy(common_database_tablename('user') .'.nickname ASC');
$user->find();
// XXX: better compatibility check needed here!
return ($from == $to);
}
+
+/**
+ * returns a quoted table name, if required according to config
+ */
+function common_database_tablename($tablename)
+{
+
+ if(common_config('db','quote_identifiers')) {
+ $tablename = '"'. $tablename .'"';
+ }
+ //table prefixes could be added here later
+ return $tablename;
+}
\ No newline at end of file