From: Jonas Häggqvist Date: Thu, 19 Mar 2009 18:21:33 +0000 (+0100) Subject: Make the rbutil page a bit smarter. X-Git-Url: https://repo.or.cz/w/rockboxthemes.git/commitdiff_plain/93ddbc3a2f6dcffa5feb3ec261ba5a0323b35244 Make the rbutil page a bit smarter. --- diff --git a/public/rbutilqt.php b/public/rbutilqt.php index e49f00e..5982bef 100644 --- a/public/rbutilqt.php +++ b/public/rbutilqt.php @@ -23,11 +23,26 @@ require_once('preconfig.inc.php'); header('Content-type: text/plain'); -$mainlcd = substr($_REQUEST['res'], 0, strrpos($_REQUEST['res'], 'x')); -$themes = $site->listthemes($mainlcd); -$t->assign('themes', $themes); -/* Not sure what kind of error message we would want to send? */ -$t->assign('errno', 0); -$t->assign('errmsg', 'Rocking da boxes'); +$themes = array(); +if (!isset($_REQUEST['res'])) { + $t->assign('errno', 1); + $t->assign('errmsg', "Invalid URL"); +} +else { + $mainlcd = substr($_REQUEST['res'], 0, strrpos($_REQUEST['res'], 'x')); + $themes = $site->listthemes($mainlcd); +} + +if (count($themes) == 0) { + $t->assign('errno', 1); + $t->assign('errmsg', "No themes available for the selected target"); +} +else { + $t->assign('themes', $themes); + /* Not sure what kind of error message we would want to send? */ + $t->assign('errno', 0); + $t->assign('errmsg', 'Rocking da boxes'); +} + $t->render('rbutil.tpl'); ?>