issue125, make initial sort-order configureable
[phpfspot.git] / phpfspot.class.php
index 2b5e180d4a985fa077c61e1bbefe759cee01523a..4bc3266d734731a10025f44d9c528d7f0193438e 100644 (file)
@@ -122,7 +122,7 @@ class PHPFSPOT {
 
       /* set application name and version information */
       $this->cfg->product = "phpfspot";
-      $this->cfg->version = "1.5";
+      $this->cfg->version = "1.6";
 
       $this->sort_orders= array(
          'date_asc' => 'Date ↑',
@@ -227,8 +227,9 @@ class PHPFSPOT {
       if(!isset($_SESSION['tag_condition']))
          $_SESSION['tag_condition'] = 'or';
 
+      /* if sort-order has not been set yet, get the one specified in the config */
       if(!isset($_SESSION['sort_order']))
-         $_SESSION['sort_order'] = 'date_desc';
+         $_SESSION['sort_order'] = $this->cfg->sort_order;
 
       if(!isset($_SESSION['searchfor_tag']))
          $_SESSION['searchfor_tag'] = '';
@@ -2722,10 +2723,10 @@ class PHPFSPOT {
             return " ORDER BY t.name DESC ,p.time ASC";
             break;
          case 'rate_asc':
-            return " ORDER BY t.name ASC, p.rating ASC";
+            return " ORDER BY p.rating ASC, t.name ASC";
             break;
          case 'rate_desc':
-            return " ORDER BY t.name DESC, p.rating DESC";
+            return " ORDER BY p.rating DESC, t.name DESC";
             break;
       }