Make the rbutil page a bit smarter.
[rockboxthemes.git] / public / rbutilqt.php
blob5982befe2dab91692656e54b41898c88d6a441ec
1 <?php
2 /***************************************************************************
3 * __________ __ ___.
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * \/ \/ \/ \/ \/
9 * $Id$
11 * Copyright (C) 2009 Jonas Häggqvist
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
23 require_once('preconfig.inc.php');
24 header('Content-type: text/plain');
26 $themes = array();
27 if (!isset($_REQUEST['res'])) {
28 $t->assign('errno', 1);
29 $t->assign('errmsg', "Invalid URL");
31 else {
32 $mainlcd = substr($_REQUEST['res'], 0, strrpos($_REQUEST['res'], 'x'));
33 $themes = $site->listthemes($mainlcd);
36 if (count($themes) == 0) {
37 $t->assign('errno', 1);
38 $t->assign('errmsg', "No themes available for the selected target");
40 else {
41 $t->assign('themes', $themes);
42 /* Not sure what kind of error message we would want to send? */
43 $t->assign('errno', 0);
44 $t->assign('errmsg', 'Rocking da boxes');
47 $t->render('rbutil.tpl');