Index: androidthememanager.php
===================================================================
--- androidthememanager.php	(revision 0)
+++ androidthememanager.php	(revision 0)
@@ -0,0 +1,63 @@
+<?php
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id$
+ *
+ * Copyright (C) 2011 Maurus Cuelenaere
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+require_once('preconfig.inc.php');
+
+function die_json($str) {
+    die(json_encode(array("error" => $str)));
+}
+
+header('Content-type: application/json');
+
+if (!isset($_GET['resolution']))
+    die_json("Invalid URL");
+
+$themes = $site->listthemesbyresolution($_GET['resolution']);
+
+if (count($themes) == 0)
+    die_json("No themes available for that resolution");
+
+$output = array();
+foreach ($themes as $theme) {
+    $ret = array(
+        "name" => $theme['name'],
+        "author" => $theme['author'],
+        "date" => $theme['timestamp'],
+        "description" => $theme['description'],
+        "filesize" => $theme['size'],
+        "images" => array(),
+        "link" => sprintf("%s/download.php?themeid=%d", config::path, $theme['id']),
+        "pass_release" => $theme['release_pass'],
+        "pass_current" => $theme['current_pass'],
+    );
+    foreach (array($theme['sshot_wps'], $theme['sshot_menu'], $theme['sshot_1'], $theme['sshot_2'], $theme['sshot_3']) as $image) {
+        if (empty($image))
+            continue;
+
+        $ret["images"][] = sprintf("%s/%s/%s/%s/%s", config::path, config::datadir, $theme['mainlcd'], $theme['shortname'], $image);
+    }
+
+    $output[] = $ret;
+}
+
+echo json_encode($output);
+?>
\ No newline at end of file
Index: themesite.class.php
===================================================================
--- themesite.class.php	(revision 27198)
+++ themesite.class.php	(working copy)
@@ -347,7 +347,42 @@
         return $ret;
     }
 
+    public function listthemesbyresolution($mainlcd = false, $remotelcd = false) {
+        $ret = array();
 
+        $lcd = '';
+        if ($mainlcd)
+            $lcd .= sprintf(" AND mainlcd = '%s' ", db::quote($mainlcd));
+
+        if ($remotelcd)
+            $lcd .= sprintf(" AND remotelcd = '%s' ", db::quote($remotelcd));
+
+        $sql = sprintf("SELECT name, author, timestamp, mainlcd, approved, reason, description, shortname,
+            zipfile, sshot_wps, sshot_menu, sshot_1, sshot_2, sshot_3,
+            email, downloadcnt, ratings, numratings, filesize as size,
+            emailverification = 1 as verified,
+            themes.RowId as id,
+            c.version_number AS current_version,
+            c.pass AS current_pass,
+            r.version_number as release_version,
+            r.pass as release_pass,
+            c.output as checkwps_output
+            FROM themes
+            LEFT OUTER JOIN checkwps c ON (themes.rowid=c.themeid and c.version_type='current')
+            LEFT OUTER JOIN checkwps r ON (themes.rowid=r.themeid and r.version_type='release') 
+            WHERE (current_pass=1 OR release_pass=1) AND emailverification = 1 AND approved >= 1 %s GROUP BY name ORDER BY timestamp DESC",
+            $lcd
+        );
+
+        $themes = $this->db->query($sql);
+        /* create additional data */
+        while ($theme = $themes->next()) {
+            if($theme['numratings'] > 0) $theme['ratings'] = $theme['ratings'] / $theme['numratings']; 
+            $ret[] = $theme;
+        }
+        return $ret;
+    }
+
     public function downloadUrl($themeid) {
         $sql = sprintf("SELECT mainlcd, shortname, zipfile FROM themes WHERE RowId='%s'",
             db::quote($themeid)
