quoted the users table

This commit is contained in:
Brenda Wallace 2009-03-17 10:25:47 +13:00
parent ea5e7ed2ff
commit c2e529c72b
1 changed files with 8 additions and 2 deletions

View File

@ -107,6 +107,7 @@ class FeaturedAction extends Action
$featured_nicks = common_config('nickname', 'featured'); $featured_nicks = common_config('nickname', 'featured');
if (count($featured_nicks) > 0) { if (count($featured_nicks) > 0) {
$quoted = array(); $quoted = array();
@ -115,10 +116,15 @@ class FeaturedAction extends Action
$quoted[] = "'$nick'"; $quoted[] = "'$nick'";
} }
$table = "user";
if(common_config('db','quote_identifiers')) {
$table = '"' . $table . '"';
}
$user = new User; $user = new User;
$user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted))); $user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted)));
$user->limit(($this->page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1); $user->limit(($this->page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
$user->orderBy('user.nickname ASC'); $user->orderBy($table .'.nickname ASC');
$user->find(); $user->find();
@ -145,4 +151,4 @@ class FeaturedAction extends Action
$this->page, 'featured'); $this->page, 'featured');
} }
} }
} }