From eda7041336760bacb92f56bedfd794159935b4eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonas=20H=C3=A4ggqvist?= Date: Fri, 13 Mar 2009 00:15:07 +0100 Subject: [PATCH] Show unverified themes in the admin panel. --- private/templates/TODO | 1 - private/themesite.class.php | 15 +++++++++++---- public/admin.php | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/private/templates/TODO b/private/templates/TODO index 534b22f..f77bbf4 100644 --- a/private/templates/TODO +++ b/private/templates/TODO @@ -1,6 +1,5 @@ SHORT TERM - Do checkwps on upload and by request (from cronjob or similar) (nearly done) - - Show unverified uploads in the admin panel - Implement deleting themes - Mail people when hiding/deleting their theme. - Store hidden/unverified .zip files in the private dir, with an option for diff --git a/private/themesite.class.php b/private/themesite.class.php index 51b750a..aca5299 100644 --- a/private/themesite.class.php +++ b/private/themesite.class.php @@ -61,21 +61,28 @@ class themesite { return $result['count'] == 1 ? true : false; } - public function listthemes($target, $orderby = 'timestamp DESC', $approved = 'approved') { + public function listthemes($target, $orderby = 'timestamp DESC', $approved = 'approved', $onlyverified = true) { $ret = array(); switch($approved) { case 'any': $approved_clause = ""; break; case 'hidden': - $approved_clause = "AND th.approved = 0"; + $approved_clause = " AND th.approved = 0 "; break; case 'approved': default: - $approved_clause = "AND th.approved = 1"; + $approved_clause = " AND th.approved = 1 "; break; } - $sql = sprintf("SELECT name, approved, reason, description, th.RowID as id, th.shortname AS shortname, zipfile, sshot_wps, sshot_menu FROM themes th, targets ta WHERE th.emailverification=1 %s AND th.mainlcd=ta.mainlcd and ta.shortname='%s' AND (ta.remotelcd IS NULL OR ta.remotelcd=th.remotelcd) ORDER BY %s", + if ($onlyverified == true) { + $verified = " AND th.emailverification = 1 "; + } + else { + $verified = ""; + } + $sql = sprintf("SELECT name, approved, reason, description, th.RowID as id, th.shortname AS shortname, zipfile, sshot_wps, sshot_menu, emailverification = 1 as verified FROM themes th, targets ta WHERE 1 %s %s AND th.mainlcd=ta.mainlcd and ta.shortname='%s' AND (ta.remotelcd IS NULL OR ta.remotelcd=th.remotelcd) ORDER BY %s", + $verified, $approved_clause, db::quote($target), $orderby diff --git a/public/admin.php b/public/admin.php index b514754..efe52c3 100644 --- a/public/admin.php +++ b/public/admin.php @@ -59,7 +59,7 @@ else { } $approved = isset($_REQUEST['approved']) ? $_REQUEST['approved'] : 'any'; $template = 'adminlist.tpl'; - $themes = $site->listthemes($_REQUEST['target'], 'timestamp DESC',$approved); + $themes = $site->listthemes($_REQUEST['target'], 'timestamp DESC',$approved, $onlyverified = false); $lcd = $site->target2lcd($_REQUEST['target']); $t->assign('mainlcd', $lcd['mainlcd']); $t->assign('themes', $themes); -- 2.11.4.GIT