[art-web] Sort by popularity by default
- From: Thomas Wood <thos src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [art-web] Sort by popularity by default
- Date: Mon, 4 Jan 2010 22:47:46 +0000 (UTC)
commit d944903248221c5e7f08ed51d53cf9bab2dfe65e
Author: Thomas Wood <thos gnome org>
Date: Mon Jan 4 22:47:37 2010 +0000
Sort by popularity by default
Move the GET_COOKIE function to common.inc.php and sort by popularity by
default.
common.inc.php | 15 +++++++++++++++
controllers/backgrounds.php | 16 +---------------
controllers/themes.php | 9 +--------
3 files changed, 17 insertions(+), 23 deletions(-)
---
diff --git a/common.inc.php b/common.inc.php
index fd50ce7..5fff4ee 100644
--- a/common.inc.php
+++ b/common.inc.php
@@ -473,6 +473,21 @@ function GET ($var)
else
return null;
}
+
+function GET_COOKIE ($name, $default=null)
+{
+ $set = GET ($name);
+ if ($set)
+ {
+ setcookie ($name, $set, 0, '/');
+ $value = $set;
+ }
+ else
+ $value = (array_key_exists ($name, $_COOKIE)) ? $_COOKIE[$name] : $default;
+
+ return $value;
+}
+
function validate_input_regexp_default ($input, $regexp, $default)
{
if (ereg ($regexp, $input))
diff --git a/controllers/backgrounds.php b/controllers/backgrounds.php
index 8bc472c..dba3788 100644
--- a/controllers/backgrounds.php
+++ b/controllers/backgrounds.php
@@ -49,21 +49,7 @@ $limit = GET ('limit');
if (!is_numeric ($limit))
$limit = 12;
-function GET_COOKIE ($name, $default)
-{
- $set = GET ($name);
- if ($set)
- {
- setcookie ($name, $set, 0, '/');
- $value = $set;
- }
- else
- $value = (array_key_exists ($name, $_COOKIE)) ? $_COOKIE[$name] : $default;
-
- return $value;
-}
-
-$sort = GET_COOKIE ('sort', 'name');
+$sort = GET_COOKIE ('sort', 'popularity');
if ($sort)
{
diff --git a/controllers/themes.php b/controllers/themes.php
index b45f2bd..4fb25a3 100644
--- a/controllers/themes.php
+++ b/controllers/themes.php
@@ -50,14 +50,7 @@ $limit = GET ('limit');
if (!is_numeric ($limit))
$limit = 12;
-$set_sort = GET ('sort');
-if ($set_sort)
-{
- setcookie ('sort', $set_sort);
- $sort = $set_sort;
-}
-else
- $sort = (array_key_exists ('sort', $_COOKIE)) ? $_COOKIE['sort'] : 'name';
+$sort = GET_COOKIE ('sort', 'popularity');
if ($sort)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]