]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
use common_database_tablename instead of repeating that if structure everywhere
authorBrenda Wallace <shiny@cpan.org>
Mon, 16 Mar 2009 21:36:12 +0000 (10:36 +1300)
committerBrenda Wallace <shiny@cpan.org>
Mon, 16 Mar 2009 21:36:12 +0000 (10:36 +1300)
actions/featured.php
lib/util.php

index 14d653cea20a9bef8696425b74a19335fa3158de..86fd3f374aa37e221e691f83aaf0c78cc8195f9b 100644 (file)
@@ -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();
 
index 6341438caef1ed570314708ca90420d4c9e42f12..19637d546562792c25a7e6bc021cb10c8fd5018f 100644 (file)
@@ -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