Fix Potential Duplicates table when viewing a non-queued app
This commit is contained in:
@@ -291,10 +291,10 @@ class application_queue
|
|||||||
function displayDuplicates()
|
function displayDuplicates()
|
||||||
{
|
{
|
||||||
echo "<b>Like matches</b><br />\n";
|
echo "<b>Like matches</b><br />\n";
|
||||||
$this->displayDuplicateTable(searchForApplication($this->oApp->sName));
|
$this->displayDuplicateTable(searchForApplication($this->oApp->sName, $this->oApp->objectGetId()));
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo "<b>Partial matches</b><br />\n";
|
echo "<b>Partial matches</b><br />\n";
|
||||||
$this->displayDuplicateTable(searchForApplicationPartial($this->oApp->sName));
|
$this->displayDuplicateTable(searchForApplicationPartial($this->oApp->sName, $this->oApp->objectGetId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayDuplicateTable($hResult)
|
function displayDuplicateTable($hResult)
|
||||||
|
|||||||
@@ -443,8 +443,9 @@ function cleanupSearchWords($search_words)
|
|||||||
|
|
||||||
/* A common error for users is to submit a new app entry for a new app version,
|
/* A common error for users is to submit a new app entry for a new app version,
|
||||||
such as C&C Red Alert 2 Yuri's Revenge when we already have C&C Red Alert 2.
|
such as C&C Red Alert 2 Yuri's Revenge when we already have C&C Red Alert 2.
|
||||||
Search for the first word in the search query */
|
Search for the first word in the search query.
|
||||||
function searchForApplicationPartial($sSearchWords)
|
iExcludeAppId can be useful when showing a list of duplicate entries */
|
||||||
|
function searchForApplicationPartial($sSearchWords, $iExcludeAppId = null)
|
||||||
{
|
{
|
||||||
/* This would yield too many results and stress MySQL */
|
/* This would yield too many results and stress MySQL */
|
||||||
if(strlen($sSearchWords) < 4)
|
if(strlen($sSearchWords) < 4)
|
||||||
@@ -474,14 +475,18 @@ function searchForApplicationPartial($sSearchWords)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sExcludeApps = '';
|
||||||
|
if($iExcludeAppId && is_numeric($iExcludeAppId))
|
||||||
|
$sExcludeApps = " AND appId != '$iExcludeAppId' ";
|
||||||
|
|
||||||
$hResult = query_parameters("SELECT * FROM appFamily WHERE state = 'accepted' AND
|
$hResult = query_parameters("SELECT * FROM appFamily WHERE state = 'accepted' AND
|
||||||
(appName LIKE '?%' OR appName LIKE '?')", $sSearchString.$sEnsureExactWord, $sSearchString);
|
(appName LIKE '?%' OR appName LIKE '?')$sExcludeApps", $sSearchString.$sEnsureExactWord, $sSearchString);
|
||||||
|
|
||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search the database and return a hResult from the query_appdb() */
|
/* search the database and return a hResult from the query_appdb() */
|
||||||
function searchForApplication($search_words)
|
function searchForApplication($search_words, $iExcludeAppId = null)
|
||||||
{
|
{
|
||||||
/* This would yield too many results and stress MySQL */
|
/* This would yield too many results and stress MySQL */
|
||||||
if(strlen($search_words) < 4)
|
if(strlen($search_words) < 4)
|
||||||
@@ -505,6 +510,10 @@ function searchForApplication($search_words)
|
|||||||
|
|
||||||
$search_words = str_replace(' ', '%', query_escape_string($search_words));
|
$search_words = str_replace(' ', '%', query_escape_string($search_words));
|
||||||
|
|
||||||
|
$sExcludeApps = '';
|
||||||
|
if($iExcludeAppId && is_numeric($iExcludeAppId))
|
||||||
|
$sExcludeApps = " AND appId != '$iExcludeAppId' ";
|
||||||
|
|
||||||
/* base query */
|
/* base query */
|
||||||
$sQuery = "SELECT *
|
$sQuery = "SELECT *
|
||||||
FROM appFamily
|
FROM appFamily
|
||||||
@@ -513,7 +522,7 @@ function searchForApplication($search_words)
|
|||||||
AND (appName LIKE '%?%'
|
AND (appName LIKE '%?%'
|
||||||
OR keywords LIKE '%?%'";
|
OR keywords LIKE '%?%'";
|
||||||
|
|
||||||
$sQuery.=" ) ORDER BY appName";
|
$sQuery.=" ) $sExcludeApps ORDER BY appName";
|
||||||
|
|
||||||
$hResult = query_parameters($sQuery, $search_words, $search_words);
|
$hResult = query_parameters($sQuery, $search_words, $search_words);
|
||||||
return $hResult;
|
return $hResult;
|
||||||
|
|||||||
Reference in New Issue
Block a user