Fix appData's objectGetEntries*()

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-03-11 20:40:11 +00:00
committed by WineHQ
parent 43ac9708ca
commit 4a3f570cb0

View File

@@ -105,20 +105,45 @@ class appData
if(($sQueued == "true" || $sQueued == "all") && !appData::canEdit($sType)) if(($sQueued == "true" || $sQueued == "all") && !appData::canEdit($sType))
return FALSE; return FALSE;
/* if(($sQueued == "true" || $sQueued == "all") && if(($sQueued == "true" || $sQueued == "all") &&
!$_SESSION['current']->hasPriv("admin")) !$_SESSION['current']->hasPriv("admin"))
{ {
$sQuery = "SELECT COUNT(DISTINCT id) as count FROM appData, appMaintainers, $sQuery = "SELECT COUNT(DISTINCT id) as count FROM appData, appMaintainers,
appVersion, appFamily appVersion, appFamily WHERE
WHERE appMaintainers.userId = '?' AND appFamily.appId = appVersion.appId
((((appMaintainers.appId = appFamily.appId) OR appMaintainers.appId = AND
appVersion.appId) AND appMaintainers.userId = '?'
appMaintainers.superMaintainer = '1' AND (appData.appId = AND
appMaintainers.appId OR (appData.versionId = appVersion.versionId (
AND appVersion.appId = appMaintainers.appId)) (
) OR (appMaintainers.superMaintainer = '0' AND appMaintainers.versionId = appMaintainers.appId = appFamily.appId
appVersion.versionId AND appMaintainers.versionId = appData.versionId)) OR
AND appVersion.queued = 'false' AND appMaintainers.appId = appVersion.appId
)
AND
appMaintainers.superMaintainer = '1'
AND
(
appData.appId = appMaintainers.appId
OR
(
appData.versionId = appVersion.versionId
AND
appVersion.appId = appMaintainers.appId
)
)
OR
(
appMaintainers.superMaintainer = '0'
AND
appMaintainers.versionId = appVersion.versionId
AND
appMaintainers.versionId = appData.versionId
)
)
AND
appVersion.queued = 'false'
AND
appFamily.queued = 'false'"; appFamily.queued = 'false'";
if($sQueued == "true") if($sQueued == "true")
@@ -135,34 +160,29 @@ class appData
} else } else
{ {
$sQuery = "SELECT COUNT(DISTINCT id) as count FROM appData, $sQuery = "SELECT COUNT(DISTINCT id) as count FROM appData,
appFamily, appVersion appFamily, appVersion WHERE
WHERE ((appData.appId = appFamily.appId) OR (appData.versionId = appFamily.appId = appVersion.appId
appVersion.versionId)) AND appVersion.queued = 'false' AND AND
appFamily.queued = 'false'";*/ (
appData.appId = appFamily.appId
$sQuery = "SELECT COUNT(*) as count FROM appData WHERE 1"; OR
appData.versionId = appVersion.versionId
)
AND
appVersion.queued = 'false'
AND
appFamily.queued = 'false'";
if($sQueued == "true" || $sQueued == "false") if($sQueued == "true" || $sQueued == "false")
$sQuery .= " AND appData.queued = '$sQueued'"; $sQuery .= " AND appData.queued = '$sQueued'";
if($_SESSION['current']->hasPriv("admin"))
{
if($sType) if($sType)
{ {
$sQuery .= " AND type = '?'"; $sQuery .= " AND type = '?'";
$hResult = query_parameters($sQuery, $sType); $hResult = query_parameters($sQuery, $sType);
} else } else
$hResult = query_parameters($sQuery); $hResult = query_parameters($sQuery);
} else
{
$sQuery .= " AND submitterId = '?'";
if($sType)
{
$sQuery .= " AND type = '?'";
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
$sType);
} else
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId);
} }
if(!$hResult) if(!$hResult)
@@ -193,44 +213,77 @@ class appData
{ {
if($bQueued && !appData::canEdit($sType)) if($bQueued && !appData::canEdit($sType))
return FALSE; return FALSE;
/*
if($bQueued && !$_SESSION['current']->hasPriv("admin")) if($bQueued && !$_SESSION['current']->hasPriv("admin"))
{ {
$sQuery = "SELECT DISTINCT appData.* FROM appData, appMaintainers, $sQuery = "SELECT DISTINCT appData.* FROM appData, appMaintainers,
appVersion, appFamily appVersion, appFamily WHERE
WHERE appMaintainers.userId = '?' AND appFamily.appId = appVersion.appId
((((appMaintainers.appId = appFamily.appId) OR appMaintainers.appId = AND
appVersion.appId) AND appMaintainers.userId = '?'
appMaintainers.superMaintainer = '1' AND (appData.appId = AND
appMaintainers.appId OR (appData.versionId = appVersion.versionId (
AND appVersion.appId = appMaintainers.appId)) (
) OR (appMaintainers.superMaintainer = '0' AND appMaintainers.versionId = (
appVersion.versionId AND appMaintainers.versionId = appData.versionId)) appMaintainers.appId = appFamily.appId
AND appVersion.queued = 'false' AND OR
appFamily.queued = 'false' AND appData.queued = '?' AND appMaintainers.appId = appVersion.appId
)
AND
appMaintainers.superMaintainer = '1'
AND
(
appData.appId = appMaintainers.appId
OR
(
appData.versionId = appVersion.versionId
AND
appVersion.appId = appMaintainers.appId
)
)
)
OR
(
appMaintainers.superMaintainer = '0'
AND
appMaintainers.versionId = appVersion.versionId
AND
appMaintainers.versionId = appData.versionId
)
)
AND
appVersion.queued = 'false'
AND
appFamily.queued = 'false'
AND
appData.queued = '?'
AND
appData.type = '?'"; appData.type = '?'";
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
$bQueued ? "true" : "false", $sType); $bQueued ? "true" : "false", $sType);
} else } else
{ {
$sQuery = "SELECT DISTINCT appData.* FROM appData, appFamily, appVersion $sQuery = "SELECT DISTINCT appData.* FROM appData, appFamily, appVersion
WHERE ((appData.appId = appFamily.appId) OR (appData.versionId = WHERE
appVersion.versionId)) AND appVersion.queued = 'false' AND appVersion.appId = appFamily.appId
appFamily.queued = 'false' AND appData.queued = '?' AND AND
appData.type = '?'"; */ (
appData.appId = appFamily.appId
$sQuery = "SELECT * FROM appData WHERE queued = '?' AND type = '?'"; OR
appData.versionId = appVersion.versionId
if($_SESSION['current']->hasPriv("admin")) )
AND
appVersion.queued = 'false'
AND
appFamily.queued = 'false'
AND
appData.queued = '?'
AND
appData.type = '?'";
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType); $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType);
else
{
$sQuery .= " AND submitterId = '?'";
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
$_SESSION['current']->iUserId);
} }
if(!$hResult) if(!$hResult)
return FALSE; return FALSE;
return $hResult; return $hResult;