git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 18c8a55b authored by Brenda Wallace's avatar Brenda Wallace

use common_database_tablename instead of repeating that if structure everywhere

parent c2e529c7
......@@ -116,15 +116,10 @@ class FeaturedAction extends Action
$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();
......
......@@ -1300,3 +1300,16 @@ function common_compatible_license($from, $to)
// 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment