From 93ddbc3a2f6dcffa5feb3ec261ba5a0323b35244 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonas=20H=C3=A4ggqvist?= Date: Thu, 19 Mar 2009 19:21:33 +0100 Subject: [PATCH] Make the rbutil page a bit smarter. --- public/rbutilqt.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) 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'); ?> -- 2.11.4.GIT