mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 02:46:30 +00:00
Empty commit
This commit is contained in:
parent
b07b557f88
commit
ce4905e534
@ -149,7 +149,11 @@ function set_index($Index) {
|
||||
|
||||
function set_filter($Name, $Vals, $Exclude=false) {
|
||||
foreach($Vals as $Val) {
|
||||
$this->Filters[$Name][] = $Val;
|
||||
if($Exclude) {
|
||||
$this->Filters[$Name][] = "!$Val";
|
||||
} else {
|
||||
$this->Filters[$Name][] = $Val;
|
||||
}
|
||||
}
|
||||
$this->SetFilter($Name, $Vals, $Exclude);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@
|
||||
<li id="stats_required"><a href="rules.php?p=ratio">Required</a>: <span class="stat"><?=number_format($LoggedUser['RequiredRatio'], 2)?></span></li>
|
||||
<? }
|
||||
if($LoggedUser['FLTokens'] > 0) { ?>
|
||||
<li id="fl_tokens">Tokens: <span class="stat"><?=$LoggedUser['FLTokens']?></span></li>
|
||||
<li id="fl_tokens"><a href="wiki.php?action=article&id=754">Tokens: </a><span class="stat"><a href="userhistory.php?action=token_history&userid=<?=$LoggedUser['ID']?>"><?=$LoggedUser['FLTokens']?></a></span></li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
<?
|
||||
|
@ -61,62 +61,152 @@
|
||||
$SS->set_filter('torrentid', array(0));
|
||||
}
|
||||
|
||||
if(!empty($_GET['search'])) {
|
||||
$Words = explode(' ', $_GET['search']);
|
||||
foreach($Words as $Key => &$Word) {
|
||||
if($Word[0] == '!' && strlen($Word) > 2) {
|
||||
if(strpos($Word,'!',1) === false) {
|
||||
$Word = '!'.$SS->EscapeString(substr($Word,1));
|
||||
} else {
|
||||
$Word = $SS->EscapeString($Word);
|
||||
$EnableNegation = false; // Sphinx needs at least one positive search condition to support the NOT operator
|
||||
|
||||
if(!empty($_GET['formats'])) {
|
||||
$FormatArray = $_GET['formats'];
|
||||
if(count($FormatArray) != count($Formats)) {
|
||||
$FormatNameArray = array();
|
||||
foreach($FormatArray as $Index => $MasterIndex) {
|
||||
if(isset($Formats[$MasterIndex])) {
|
||||
$FormatNameArray[$Index] = '"'.strtr($Formats[$MasterIndex], '-.', ' ').'"';
|
||||
}
|
||||
}
|
||||
if(count($FormatNameArray) >= 1) {
|
||||
$EnableNegation = true;
|
||||
if(!empty($_GET['formats_strict'])) {
|
||||
$Queries[]='@formatlist ('.implode(' | ', $FormatNameArray).')';
|
||||
} else {
|
||||
$Queries[]='@formatlist (any | '.implode(' | ', $FormatNameArray).')';
|
||||
}
|
||||
} elseif(strlen($Word) >= 2) {
|
||||
$Word = $SS->EscapeString($Word);
|
||||
} else {
|
||||
unset($Words[$Key]);
|
||||
}
|
||||
}
|
||||
if(!empty($Words)) {
|
||||
$Queries[] = "@* ".implode(' ', $Words);
|
||||
}
|
||||
|
||||
if(!empty($_GET['media'])) {
|
||||
$MediaArray = $_GET['media'];
|
||||
if(count($MediaArray) != count($Media)) {
|
||||
$MediaNameArray = array();
|
||||
foreach($MediaArray as $Index => $MasterIndex) {
|
||||
if(isset($Media[$MasterIndex])) {
|
||||
$MediaNameArray[$Index] = '"'.strtr($Media[$MasterIndex], '-.', ' ').'"';
|
||||
}
|
||||
}
|
||||
|
||||
if(count($MediaNameArray) >= 1) {
|
||||
$EnableNegation = true;
|
||||
if(!empty($_GET['media_strict'])) {
|
||||
$Queries[]='@medialist ('.implode(' | ', $MediaNameArray).')';
|
||||
} else {
|
||||
$Queries[]='@medialist (any | '.implode(' | ', $MediaNameArray).')';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['bitrates'])) {
|
||||
$BitrateArray = $_GET['bitrates'];
|
||||
if(count($BitrateArray) != count($Bitrates)) {
|
||||
$BitrateNameArray = array();
|
||||
foreach($BitrateArray as $Index => $MasterIndex) {
|
||||
if(isset($Bitrates[$MasterIndex])) {
|
||||
$BitrateNameArray[$Index] = '"'.strtr($SS->EscapeString($Bitrates[$MasterIndex]), '-.', ' ').'"';
|
||||
}
|
||||
}
|
||||
|
||||
if(count($BitrateNameArray) >= 1) {
|
||||
$EnableNegation = true;
|
||||
if(!empty($_GET['bitrate_strict'])) {
|
||||
$Queries[]='@bitratelist ('.implode(' | ', $BitrateNameArray).')';
|
||||
} else {
|
||||
$Queries[]='@bitratelist (any | '.implode(' | ', $BitrateNameArray).')';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['search'])) {
|
||||
$SearchString = trim($_GET['search']);
|
||||
if($SearchString != '') {
|
||||
$SearchWords = array('include' => array(), 'exclude' => array());
|
||||
$Words = explode(' ', $SearchString);
|
||||
foreach($Words as $Word) {
|
||||
$Word = trim($Word);
|
||||
if($Word[0] == '!' && strlen($Word) >= 2) {
|
||||
if(strpos($Word,'!',1) === false) {
|
||||
$SearchWords['exclude'][] = $Word;
|
||||
} else {
|
||||
$SearchWords['include'][] = $Word;
|
||||
$EnableNegation = true;
|
||||
}
|
||||
} elseif($Word != '') {
|
||||
$SearchWords['include'][] = $Word;
|
||||
$EnableNegation = true;
|
||||
}
|
||||
}
|
||||
$QueryParts = array();
|
||||
if(!$EnableNegation && !empty($SearchWords['exclude'])) {
|
||||
$SearchWords['include'] = array_merge($SearchWords['include'], $SearchWords['exclude']);
|
||||
unset($SearchWords['exclude']);
|
||||
}
|
||||
foreach($SearchWords['include'] as $Word) {
|
||||
$QueryParts[] = $SS->EscapeString($Word);
|
||||
}
|
||||
if(!empty($SearchWords['exclude'])) {
|
||||
foreach($SearchWords['exclude'] as $Word) {
|
||||
$QueryParts[] = '!'.$SS->EscapeString(substr($Word,1));
|
||||
}
|
||||
}
|
||||
if(!empty($QueryParts)) {
|
||||
$Queries[] = "@* ".implode(' ', $QueryParts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['tags'])){
|
||||
$Tags = explode(',', $_GET['tags']);
|
||||
$TagNames = array();
|
||||
foreach ($Tags as $Tag) {
|
||||
if(!isset($_GET['tags_type']) || $_GET['tags_type'] == 1) {
|
||||
$TagType = 1;
|
||||
$_GET['tags_type'] = '1';
|
||||
} else {
|
||||
$TagType = 0;
|
||||
$_GET['tags_type'] = '0';
|
||||
}
|
||||
foreach($Tags as $Tag) {
|
||||
$Tag = ltrim($Tag);
|
||||
$Exclude = (!empty($_GET['tags_type']) && $Tag[0] == '!'); // Negations aren't supported in the "any" mode
|
||||
$Exclude = ($Tag[0] == '!');
|
||||
$Tag = sanitize_tag($Tag);
|
||||
if(!empty($Tag)) {
|
||||
$TagNames[] = $Tag;
|
||||
$TagsExclude[$Tag] = $Exclude;
|
||||
}
|
||||
}
|
||||
$AllNegative = !in_array(false, $TagsExclude);
|
||||
$Tags = get_tags($TagNames);
|
||||
|
||||
// Sphinx can't handle queries consisting of only exclusions
|
||||
if(!in_array(false, $TagsExclude)) {
|
||||
$TagsExclude = array();
|
||||
}
|
||||
// Replace the ! characters that sanitize_tag removed
|
||||
foreach($TagNames as &$TagName) {
|
||||
if($TagsExclude[$TagName]) {
|
||||
$TagName = '!'.$TagName;
|
||||
if($TagType == 1 || $AllNegative) {
|
||||
foreach($TagNames as &$TagName) {
|
||||
if($TagsExclude[$TagName]) {
|
||||
$TagName = '!'.$TagName;
|
||||
}
|
||||
}
|
||||
unset($TagName);
|
||||
}
|
||||
unset($TagName);
|
||||
} elseif(!isset($_GET['tags_type']) || $_GET['tags_type'] != 0) {
|
||||
$_GET['tags_type'] = 1;
|
||||
} else {
|
||||
$_GET['tags_type'] = 0;
|
||||
}
|
||||
|
||||
if(empty($_GET['tags_type']) && !empty($Tags)) {
|
||||
$_GET['tags_type'] = '0';
|
||||
$SS->set_filter('tagid', array_keys($Tags));
|
||||
} elseif(!empty($Tags)) {
|
||||
// 'All' tags
|
||||
if($TagType == 1 && !empty($Tags)) {
|
||||
foreach($Tags as $TagID => $TagName) {
|
||||
$SS->set_filter('tagid', array($TagID), $TagsExclude[$TagName]);
|
||||
}
|
||||
} else {
|
||||
$_GET['tags_type'] = '1';
|
||||
} elseif(!empty($Tags)) {
|
||||
$SS->set_filter('tagid', array_keys($Tags), $AllNegative);
|
||||
}
|
||||
|
||||
if(!empty($_GET['filter_cat'])) {
|
||||
@ -148,53 +238,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['formats'])) {
|
||||
$FormatArray = $_GET['formats'];
|
||||
if(count($FormatArray) != count($Formats)) {
|
||||
$FormatNameArray = array();
|
||||
foreach($FormatArray as $Index => $MasterIndex) {
|
||||
if(isset($Formats[$MasterIndex])) {
|
||||
$FormatNameArray[$Index] = '"'.strtr($Formats[$MasterIndex], '-.', ' ').'"';
|
||||
}
|
||||
}
|
||||
if(count($FormatNameArray) >= 1) {
|
||||
$Queries[]='@formatlist (any | '.implode(' | ', $FormatNameArray).')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['media'])) {
|
||||
$MediaArray = $_GET['media'];
|
||||
if(count($MediaArray) != count($Media)) {
|
||||
$MediaNameArray = array();
|
||||
foreach($MediaArray as $Index => $MasterIndex) {
|
||||
if(isset($Media[$MasterIndex])) {
|
||||
$MediaNameArray[$Index] = '"'.strtr($Media[$MasterIndex], '-.', ' ').'"';
|
||||
}
|
||||
}
|
||||
|
||||
if(count($MediaNameArray) >= 1) {
|
||||
$Queries[]='@medialist (any | '.implode(' | ', $MediaNameArray).')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['bitrates'])) {
|
||||
$BitrateArray = $_GET['bitrates'];
|
||||
if(count($BitrateArray) != count($Bitrates)) {
|
||||
$BitrateNameArray = array();
|
||||
foreach($BitrateArray as $Index => $MasterIndex) {
|
||||
if(isset($Bitrates[$MasterIndex])) {
|
||||
$BitrateNameArray[$Index] = '"'.strtr($SS->EscapeString($Bitrates[$MasterIndex]), '-.', ' ').'"';
|
||||
}
|
||||
}
|
||||
|
||||
if(count($BitrateNameArray) >= 1) {
|
||||
$Queries[]='@bitratelist (any | '.implode(' | ', $BitrateNameArray).')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['requestor']) && check_perms('site_see_old_requests')) {
|
||||
if(is_number($_GET['requestor'])) {
|
||||
$SS->set_filter('userid', array($_GET['requestor']));
|
||||
@ -396,6 +439,7 @@
|
||||
<td class="label">Formats</td>
|
||||
<td>
|
||||
<input type="checkbox" id="toggle_formats" onchange="Toggle('formats', 0);" <?=(!$Submitted || !empty($FormatArray) && count($FormatArray) == count($Formats) ? ' checked="checked"' : '')?>/> <label for="toggle_formats">All</label>
|
||||
<input type="checkbox" id="formats_strict" name="formats_strict"<?=(!empty($_GET['formats_strict']) ? ' checked="checked"' : '')?> /> <label for="formats_strict">Only selected</label>
|
||||
<? foreach ($Formats as $Key => $Val) {
|
||||
if($Key % 8 == 0) echo "<br />";?>
|
||||
<input type="checkbox" name="formats[]" value="<?=$Key?>" id="format_<?=$Key?>"
|
||||
@ -408,6 +452,7 @@
|
||||
<td class="label">Bitrates</td>
|
||||
<td>
|
||||
<input type="checkbox" id="toggle_bitrates" onchange="Toggle('bitrates', 0);"<?=(!$Submitted || !empty($BitrateArray) && count($BitrateArray) == count($Bitrates) ? ' checked="checked"' : '')?> /> <label for="toggle_bitrates">All</label>
|
||||
<input type="checkbox" id="bitrate_strict" name="bitrate_strict"<?=(!empty($_GET['bitrate_strict']) ? ' checked="checked"' : '')?>/> <label for="bitrate_strict">Only selected</label>
|
||||
<? foreach ($Bitrates as $Key => $Val) {
|
||||
if($Key % 8 == 0) echo "<br />";?>
|
||||
<input type="checkbox" name="bitrates[]" value="<?=$Key?>" id="bitrate_<?=$Key?>"
|
||||
@ -420,6 +465,7 @@
|
||||
<td class="label">Media</td>
|
||||
<td>
|
||||
<input type="checkbox" id="toggle_media" onchange="Toggle('media', 0);"<?=(!$Submitted || !empty($MediaArray) && count($MediaArray) == count($Media) ? ' checked="checked"' : '')?> /> <label for="toggle_media">All</label>
|
||||
<input type="checkbox" id="media_strict" name="media_strict"<?=(!empty($_GET['media_strict']) ? ' checked="checked"' : '')?> /> <label for="media_strict">Only selected</label>
|
||||
<? foreach ($Media as $Key => $Val) {
|
||||
if($Key % 8 == 0) echo "<br />";?>
|
||||
<input type="checkbox" name="media[]" value="<?=$Key?>" id="media_<?=$Key?>"
|
||||
|
@ -45,6 +45,8 @@ function next_hour() {
|
||||
list($Hour, $Day, $BiWeek) = $DB->next_record();
|
||||
$DB->query("UPDATE schedule SET NextHour = ".next_hour().", NextDay = ".next_day().", NextBiWeekly = ".next_biweek());
|
||||
|
||||
$NoDaily = isset($argv[2]) && $argv[2] == 'nodaily';
|
||||
|
||||
$sqltime = sqltime();
|
||||
|
||||
echo "$sqltime\n";
|
||||
@ -326,7 +328,7 @@ function next_hour() {
|
||||
|
||||
\*************************************************************************/
|
||||
|
||||
if($Day != next_day() || $_GET['runday']){
|
||||
if(!$NoDaily && $Day != next_day() || $_GET['runday']){
|
||||
echo "Ran daily functions\n";
|
||||
if($Day%2 == 0) { // If we should generate the drive database (at the end)
|
||||
$GenerateDriveDB = true;
|
||||
|
@ -114,108 +114,166 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
|
||||
$Queries = array();
|
||||
|
||||
$EnableNegation = false; // Sphinx needs at least one positive search condition to support the NOT operator
|
||||
|
||||
// Filelist searches makes use of the proximity operator to ensure that all keywords match the same file
|
||||
if(!empty($_GET['filelist'])) {
|
||||
$SearchString = trim($_GET['filelist']);
|
||||
if($SearchString != '') {
|
||||
$Queries[] = '@filelist "'.$SS->EscapeString($_GET['filelist']).'"~20';
|
||||
$EnableNegation = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Collect all entered search terms to find out whether to enable the NOT operator
|
||||
foreach(array('artistname','groupname', 'recordlabel', 'cataloguenumber',
|
||||
'remastertitle', 'remasteryear', 'remasterrecordlabel', 'remastercataloguenumber',
|
||||
'format', 'media', 'taglist') as $Search) {
|
||||
if(!empty($_GET[$Search])) {
|
||||
$SearchString = trim($_GET[$Search]);
|
||||
if($SearchString != '') {
|
||||
$SearchWords[$Search] = array('include' => array(), 'exclude' => array());
|
||||
if($Search == 'taglist') {
|
||||
$SearchString = strtr($SearchString, '.', '_');
|
||||
$Words = explode(',', $SearchString);
|
||||
} else {
|
||||
$Words = explode(' ', $SearchString);
|
||||
}
|
||||
foreach($Words as $Word) {
|
||||
$Word = trim($Word);
|
||||
if($Word[0] == '!' && strlen($Word) >= 2) {
|
||||
if(strpos($Word,'!',1) === false) {
|
||||
$SearchWords[$Search]['exclude'][] = $Word;
|
||||
} else {
|
||||
$SearchWords[$Search]['include'][] = $Word;
|
||||
$EnableNegation = true;
|
||||
}
|
||||
} elseif($Word != '') {
|
||||
$SearchWords[$Search]['include'][] = $Word;
|
||||
$EnableNegation = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Simple search
|
||||
if(!empty($_GET['searchstr'])) {
|
||||
$Words = explode(' ',strtolower($_GET['searchstr']));
|
||||
$FilterBitrates = array_intersect($Words, $SearchBitrates);
|
||||
if(count($FilterBitrates)>0) {
|
||||
$Queries[]='@encoding '.implode(' ',$FilterBitrates);
|
||||
}
|
||||
|
||||
$FilterFormats = array_intersect($Words, $SearchFormats);
|
||||
if(count($FilterFormats)>0) {
|
||||
$Queries[]='@format '.implode(' ',$FilterFormats);
|
||||
}
|
||||
|
||||
if(in_array('100%', $Words)) {
|
||||
$_GET['haslog'] = '100';
|
||||
unset($Words[array_search('100%',$Words)]);
|
||||
}
|
||||
|
||||
$Words = array_diff($Words, $FilterBitrates, $FilterFormats);
|
||||
$SearchString = trim($_GET['searchstr']);
|
||||
$Words = explode(' ',strtolower($SearchString));
|
||||
if(!empty($Words)) {
|
||||
foreach($Words as $Key => &$Word) {
|
||||
if($Word[0] == '!' && strlen($Word) >= 3 && count($Words) >= 2) {
|
||||
if(strpos($Word,'!',1) === false) {
|
||||
$Word = '!'.$SS->EscapeString(substr($Word,1));
|
||||
$FilterBitrates = $FilterFormats = array();
|
||||
$BasicSearch = array('include' => array(), 'exclude' => array());
|
||||
foreach($Words as $Word) {
|
||||
$Word = trim($Word);
|
||||
if($Word[0] == '!' && strlen($Word) >= 2) {
|
||||
if($Word == '!100%') {
|
||||
$_GET['haslog'] = '-1';
|
||||
} elseif(strpos($Word,'!',1) === false) {
|
||||
$BasicSearch['exclude'][] = $Word;
|
||||
} else {
|
||||
$Word = $SS->EscapeString($Word);
|
||||
$BasicSearch['include'][] = $Word;
|
||||
$EnableNegation = true;
|
||||
}
|
||||
} elseif(strlen($Word) >= 2) {
|
||||
$Word = $SS->EscapeString($Word);
|
||||
} else {
|
||||
unset($Words[$Key]);
|
||||
} elseif(in_array($Word, $SearchBitrates)) {
|
||||
$FilterBitrates[] = $Word;
|
||||
$EnableNegation = true;
|
||||
} elseif(in_array($Word, $SearchFormats)) {
|
||||
$FilterFormats[] = $Word;
|
||||
$EnableNegation = true;
|
||||
} elseif($Word == '100%') {
|
||||
$_GET['haslog'] = '100';
|
||||
} elseif($Word != '') {
|
||||
$BasicSearch['include'][] = $Word;
|
||||
$EnableNegation = true;
|
||||
}
|
||||
}
|
||||
unset($Word);
|
||||
$Words = trim(implode(' ',$Words));
|
||||
if(!empty($Words)) {
|
||||
$Queries[]='@(groupname,artistname,yearfulltext) '.$Words;
|
||||
if(!$EnableNegation && !empty($BasicSearch['exclude'])) {
|
||||
$BasicSearch['include'] = array_merge($BasicSearch['include'], $BasicSearch['exclude']);
|
||||
unset($BasicSearch['exclude']);
|
||||
}
|
||||
$QueryParts = array();
|
||||
foreach($BasicSearch['include'] as $Word) {
|
||||
$QueryParts[] = $SS->EscapeString($Word);
|
||||
}
|
||||
if(!empty($BasicSearch['exclude'])) {
|
||||
foreach($BasicSearch['exclude'] as $Word) {
|
||||
$QueryParts[] = '!'.$SS->EscapeString(substr($Word,1));
|
||||
}
|
||||
}
|
||||
if(!empty($FilterBitrates)) {
|
||||
$Queries[] = "@encoding ".implode(' ', $FilterBitrates);
|
||||
}
|
||||
if(!empty($FilterFormats)) {
|
||||
$Queries[] = "@format ".implode(' ', $FilterFormats);
|
||||
}
|
||||
if(!empty($QueryParts)) {
|
||||
$Queries[] = "@(groupname,artistname,yearfulltext) ".implode(' ', $QueryParts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['taglist'])) {
|
||||
$_GET['taglist'] = str_replace('.','_',$_GET['taglist']);
|
||||
$TagList = explode(',',$_GET['taglist']);
|
||||
$TagListEx = array();
|
||||
foreach($TagList as $Key => &$Tag) {
|
||||
$Tag = trim($Tag);
|
||||
if(strlen($Tag) >= 2) {
|
||||
if($Tag[0] == '!' && strlen($Tag) >= 3) {
|
||||
$TagListEx[] = '!'.$SS->EscapeString(substr($Tag,1));
|
||||
unset($TagList[$Key]);
|
||||
} else {
|
||||
$Tag = $SS->EscapeString($Tag);
|
||||
}
|
||||
} else {
|
||||
unset($TagList[$Key]);
|
||||
// Tag list
|
||||
if(!empty($SearchWords['taglist'])) {
|
||||
$Tags = $SearchWords['taglist'];
|
||||
if(!$EnableNegation && !empty($Tags['exclude'])) {
|
||||
$Tags['include'] = array_merge($Tags['include'], $Tags['exclude']);
|
||||
unset($Tags['exclude']);
|
||||
}
|
||||
foreach($Tags['include'] as &$Tag) {
|
||||
$Tag = $SS->EscapeString($Tag);
|
||||
}
|
||||
if(!empty($Tags['exclude'])) {
|
||||
foreach($Tags['exclude'] as &$Tag) {
|
||||
$Tag = '!'.$SS->EscapeString(substr($Tag,1));
|
||||
}
|
||||
}
|
||||
unset($Tag);
|
||||
}
|
||||
|
||||
if(empty($_GET['tags_type']) && !empty($TagList) && count($TagList) > 1) {
|
||||
$_GET['tags_type'] = '0';
|
||||
if(!empty($TagListEx)) {
|
||||
$Queries[]='@taglist ( '.implode(' | ', $TagList).' ) '.implode(' ', $TagListEx);
|
||||
} else {
|
||||
$Queries[]='@taglist ( '.implode(' | ', $TagList).' )';
|
||||
$QueryParts = array();
|
||||
// 'All' tags
|
||||
if(!isset($_GET['tags_type']) || $_GET['tags_type'] == 1) {
|
||||
$_GET['tags_type'] = '1';
|
||||
$Tags = array_merge($Tags['include'], $Tags['exclude']);
|
||||
if(!empty($Tags)) {
|
||||
$QueryParts[] = implode(' ', $Tags);
|
||||
}
|
||||
}
|
||||
} elseif(!empty($TagList)) {
|
||||
$Queries[]='@taglist '.implode(' ', array_merge($TagList,$TagListEx));
|
||||
} else {
|
||||
// 'Any' tags
|
||||
else {
|
||||
$_GET['tags_type'] = '0';
|
||||
if(!empty($Tags['include'])) {
|
||||
$QueryParts[] = '( '.implode(' | ', $Tags['include']).' )';
|
||||
}
|
||||
if(!empty($Tags['exclude'])) {
|
||||
$QueryParts[] = implode(' ', $Tags['exclude']);
|
||||
}
|
||||
}
|
||||
if(!empty($QueryParts)) {
|
||||
$Queries[] = "@taglist ".implode(' ', $QueryParts);
|
||||
}
|
||||
unset($SearchWords['taglist']);
|
||||
}
|
||||
elseif(!isset($_GET['tags_type'])) {
|
||||
$_GET['tags_type'] = '1';
|
||||
}
|
||||
|
||||
foreach(array('artistname','groupname', 'recordlabel', 'cataloguenumber',
|
||||
'remastertitle', 'remasteryear', 'remasterrecordlabel', 'remastercataloguenumber',
|
||||
'filelist', 'format', 'media') as $Search) {
|
||||
if(!empty($_GET[$Search])) {
|
||||
$_GET[$Search] = str_replace(array('%'), '', $_GET[$Search]);
|
||||
if($Search == 'filelist') {
|
||||
$Queries[]='@filelist "'.$SS->EscapeString($_GET['filelist']).'"~20';
|
||||
} else {
|
||||
$Words = explode(' ', $_GET[$Search]);
|
||||
foreach($Words as $Key => &$Word) {
|
||||
if($Word[0] == '!' && strlen($Word) >= 3 && count($Words) >= 2) {
|
||||
if(strpos($Word,'!',1) === false) {
|
||||
$Word = '!'.$SS->EscapeString(substr($Word,1));
|
||||
} else {
|
||||
$Word = $SS->EscapeString($Word);
|
||||
}
|
||||
} elseif(strlen($Word) >= 2) {
|
||||
$Word = $SS->EscapeString($Word);
|
||||
} else {
|
||||
unset($Words[$Key]);
|
||||
}
|
||||
}
|
||||
$Words = trim(implode(' ',$Words));
|
||||
if(!empty($Words)) {
|
||||
$Queries[]="@$Search ".$Words;
|
||||
}
|
||||
foreach($SearchWords as $Search => $Words) {
|
||||
$QueryParts = array();
|
||||
if(!$EnableNegation && !empty($Words['exclude'])) {
|
||||
$Words['include'] = array_merge($Words['include'], $Words['exclude']);
|
||||
unset($Words['exclude']);
|
||||
}
|
||||
foreach($Words['include'] as $Word) {
|
||||
$QueryParts[] = $SS->EscapeString($Word);
|
||||
}
|
||||
if(!empty($Words['exclude'])) {
|
||||
foreach($Words['exclude'] as $Word) {
|
||||
$QueryParts[] = '!'.$SS->EscapeString(substr($Word,1));
|
||||
}
|
||||
}
|
||||
if(!empty($QueryParts)) {
|
||||
$Queries[] = "@$Search ".implode(' ', $QueryParts);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['year'])) {
|
||||
@ -316,9 +374,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
$SS->set_index(SPHINX_INDEX.' delta');
|
||||
$Results = $SS->search($Query, '', 0, array(), '', '');
|
||||
if(check_perms('site_search_many')) {
|
||||
|
||||
$TorrentCount = $SS->TotalResults;
|
||||
|
||||
} else {
|
||||
$TorrentCount = min($SS->TotalResults, SPHINX_MAX_MATCHES);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user