From 208033d7889f5c0c04868ab81c2e6181701abc4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Sat, 21 Apr 2007 17:50:44 +0000 Subject: [PATCH] Add and use distribution::mustBeQueued() --- include/distribution.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/include/distribution.php b/include/distribution.php index b717f63..1c9e45b 100644 --- a/include/distribution.php +++ b/include/distribution.php @@ -92,16 +92,11 @@ class distribution { return false; } - // Security, if we are not an administrator the Distributions must be queued. - if(!$_SESSION['current']->hasPriv("admin")) - $this->sQueued = 'true'; - else - $this->sQueued = 'false'; - $hResult = query_parameters("INSERT INTO distributions (name, url, submitterId, queued) ". "VALUES ('?', '?', '?', '?')", - $this->sName, $this->sUrl, $_SESSION['current']->iUserId, - $this->sQueued); + $this->sName, $this->sUrl, + $_SESSION['current']->iUserId, + $this->mustBeQueued() ? "true" : "false"); if($hResult) { $this->iDistributionId = mysql_insert_id(); @@ -488,6 +483,14 @@ class distribution { return FALSE; } + function mustBeQueued() + { + if($_SESSION['current']->hasPriv("admin")) + return FALSE; + else + return TRUE; + } + function objectHideDelete() { return TRUE;