mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-19 04:31:36 +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) {
|
function set_filter($Name, $Vals, $Exclude=false) {
|
||||||
foreach($Vals as $Val) {
|
foreach($Vals as $Val) {
|
||||||
$this->Filters[$Name][] = $Val;
|
if($Exclude) {
|
||||||
|
$this->Filters[$Name][] = "!$Val";
|
||||||
|
} else {
|
||||||
|
$this->Filters[$Name][] = $Val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->SetFilter($Name, $Vals, $Exclude);
|
$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>
|
<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) { ?>
|
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>
|
</ul>
|
||||||
<?
|
<?
|
||||||
|
@ -61,62 +61,152 @@
|
|||||||
$SS->set_filter('torrentid', array(0));
|
$SS->set_filter('torrentid', array(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($_GET['search'])) {
|
$EnableNegation = false; // Sphinx needs at least one positive search condition to support the NOT operator
|
||||||
$Words = explode(' ', $_GET['search']);
|
|
||||||
foreach($Words as $Key => &$Word) {
|
if(!empty($_GET['formats'])) {
|
||||||
if($Word[0] == '!' && strlen($Word) > 2) {
|
$FormatArray = $_GET['formats'];
|
||||||
if(strpos($Word,'!',1) === false) {
|
if(count($FormatArray) != count($Formats)) {
|
||||||
$Word = '!'.$SS->EscapeString(substr($Word,1));
|
$FormatNameArray = array();
|
||||||
} else {
|
foreach($FormatArray as $Index => $MasterIndex) {
|
||||||
$Word = $SS->EscapeString($Word);
|
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'])){
|
if(!empty($_GET['tags'])){
|
||||||
$Tags = explode(',', $_GET['tags']);
|
$Tags = explode(',', $_GET['tags']);
|
||||||
$TagNames = array();
|
$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);
|
$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);
|
$Tag = sanitize_tag($Tag);
|
||||||
if(!empty($Tag)) {
|
if(!empty($Tag)) {
|
||||||
$TagNames[] = $Tag;
|
$TagNames[] = $Tag;
|
||||||
$TagsExclude[$Tag] = $Exclude;
|
$TagsExclude[$Tag] = $Exclude;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$AllNegative = !in_array(false, $TagsExclude);
|
||||||
$Tags = get_tags($TagNames);
|
$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
|
// Replace the ! characters that sanitize_tag removed
|
||||||
foreach($TagNames as &$TagName) {
|
if($TagType == 1 || $AllNegative) {
|
||||||
if($TagsExclude[$TagName]) {
|
foreach($TagNames as &$TagName) {
|
||||||
$TagName = '!'.$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)) {
|
// 'All' tags
|
||||||
$_GET['tags_type'] = '0';
|
if($TagType == 1 && !empty($Tags)) {
|
||||||
$SS->set_filter('tagid', array_keys($Tags));
|
|
||||||
} elseif(!empty($Tags)) {
|
|
||||||
foreach($Tags as $TagID => $TagName) {
|
foreach($Tags as $TagID => $TagName) {
|
||||||
$SS->set_filter('tagid', array($TagID), $TagsExclude[$TagName]);
|
$SS->set_filter('tagid', array($TagID), $TagsExclude[$TagName]);
|
||||||
}
|
}
|
||||||
} else {
|
} elseif(!empty($Tags)) {
|
||||||
$_GET['tags_type'] = '1';
|
$SS->set_filter('tagid', array_keys($Tags), $AllNegative);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($_GET['filter_cat'])) {
|
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(!empty($_GET['requestor']) && check_perms('site_see_old_requests')) {
|
||||||
if(is_number($_GET['requestor'])) {
|
if(is_number($_GET['requestor'])) {
|
||||||
$SS->set_filter('userid', array($_GET['requestor']));
|
$SS->set_filter('userid', array($_GET['requestor']));
|
||||||
@ -396,6 +439,7 @@
|
|||||||
<td class="label">Formats</td>
|
<td class="label">Formats</td>
|
||||||
<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="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) {
|
<? foreach ($Formats as $Key => $Val) {
|
||||||
if($Key % 8 == 0) echo "<br />";?>
|
if($Key % 8 == 0) echo "<br />";?>
|
||||||
<input type="checkbox" name="formats[]" value="<?=$Key?>" id="format_<?=$Key?>"
|
<input type="checkbox" name="formats[]" value="<?=$Key?>" id="format_<?=$Key?>"
|
||||||
@ -408,6 +452,7 @@
|
|||||||
<td class="label">Bitrates</td>
|
<td class="label">Bitrates</td>
|
||||||
<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="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) {
|
<? foreach ($Bitrates as $Key => $Val) {
|
||||||
if($Key % 8 == 0) echo "<br />";?>
|
if($Key % 8 == 0) echo "<br />";?>
|
||||||
<input type="checkbox" name="bitrates[]" value="<?=$Key?>" id="bitrate_<?=$Key?>"
|
<input type="checkbox" name="bitrates[]" value="<?=$Key?>" id="bitrate_<?=$Key?>"
|
||||||
@ -420,6 +465,7 @@
|
|||||||
<td class="label">Media</td>
|
<td class="label">Media</td>
|
||||||
<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="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) {
|
<? foreach ($Media as $Key => $Val) {
|
||||||
if($Key % 8 == 0) echo "<br />";?>
|
if($Key % 8 == 0) echo "<br />";?>
|
||||||
<input type="checkbox" name="media[]" value="<?=$Key?>" id="media_<?=$Key?>"
|
<input type="checkbox" name="media[]" value="<?=$Key?>" id="media_<?=$Key?>"
|
||||||
|
@ -45,6 +45,8 @@ function next_hour() {
|
|||||||
list($Hour, $Day, $BiWeek) = $DB->next_record();
|
list($Hour, $Day, $BiWeek) = $DB->next_record();
|
||||||
$DB->query("UPDATE schedule SET NextHour = ".next_hour().", NextDay = ".next_day().", NextBiWeekly = ".next_biweek());
|
$DB->query("UPDATE schedule SET NextHour = ".next_hour().", NextDay = ".next_day().", NextBiWeekly = ".next_biweek());
|
||||||
|
|
||||||
|
$NoDaily = isset($argv[2]) && $argv[2] == 'nodaily';
|
||||||
|
|
||||||
$sqltime = sqltime();
|
$sqltime = sqltime();
|
||||||
|
|
||||||
echo "$sqltime\n";
|
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";
|
echo "Ran daily functions\n";
|
||||||
if($Day%2 == 0) { // If we should generate the drive database (at the end)
|
if($Day%2 == 0) { // If we should generate the drive database (at the end)
|
||||||
$GenerateDriveDB = true;
|
$GenerateDriveDB = true;
|
||||||
|
@ -114,108 +114,166 @@ function header_link($SortKey,$DefaultWay="desc") {
|
|||||||
|
|
||||||
$Queries = array();
|
$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
|
//Simple search
|
||||||
if(!empty($_GET['searchstr'])) {
|
if(!empty($_GET['searchstr'])) {
|
||||||
$Words = explode(' ',strtolower($_GET['searchstr']));
|
$SearchString = trim($_GET['searchstr']);
|
||||||
$FilterBitrates = array_intersect($Words, $SearchBitrates);
|
$Words = explode(' ',strtolower($SearchString));
|
||||||
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);
|
|
||||||
if(!empty($Words)) {
|
if(!empty($Words)) {
|
||||||
foreach($Words as $Key => &$Word) {
|
$FilterBitrates = $FilterFormats = array();
|
||||||
if($Word[0] == '!' && strlen($Word) >= 3 && count($Words) >= 2) {
|
$BasicSearch = array('include' => array(), 'exclude' => array());
|
||||||
if(strpos($Word,'!',1) === false) {
|
foreach($Words as $Word) {
|
||||||
$Word = '!'.$SS->EscapeString(substr($Word,1));
|
$Word = trim($Word);
|
||||||
|
if($Word[0] == '!' && strlen($Word) >= 2) {
|
||||||
|
if($Word == '!100%') {
|
||||||
|
$_GET['haslog'] = '-1';
|
||||||
|
} elseif(strpos($Word,'!',1) === false) {
|
||||||
|
$BasicSearch['exclude'][] = $Word;
|
||||||
} else {
|
} else {
|
||||||
$Word = $SS->EscapeString($Word);
|
$BasicSearch['include'][] = $Word;
|
||||||
|
$EnableNegation = true;
|
||||||
}
|
}
|
||||||
} elseif(strlen($Word) >= 2) {
|
} elseif(in_array($Word, $SearchBitrates)) {
|
||||||
$Word = $SS->EscapeString($Word);
|
$FilterBitrates[] = $Word;
|
||||||
} else {
|
$EnableNegation = true;
|
||||||
unset($Words[$Key]);
|
} elseif(in_array($Word, $SearchFormats)) {
|
||||||
|
$FilterFormats[] = $Word;
|
||||||
|
$EnableNegation = true;
|
||||||
|
} elseif($Word == '100%') {
|
||||||
|
$_GET['haslog'] = '100';
|
||||||
|
} elseif($Word != '') {
|
||||||
|
$BasicSearch['include'][] = $Word;
|
||||||
|
$EnableNegation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($Word);
|
if(!$EnableNegation && !empty($BasicSearch['exclude'])) {
|
||||||
$Words = trim(implode(' ',$Words));
|
$BasicSearch['include'] = array_merge($BasicSearch['include'], $BasicSearch['exclude']);
|
||||||
if(!empty($Words)) {
|
unset($BasicSearch['exclude']);
|
||||||
$Queries[]='@(groupname,artistname,yearfulltext) '.$Words;
|
}
|
||||||
|
$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'])) {
|
// Tag list
|
||||||
$_GET['taglist'] = str_replace('.','_',$_GET['taglist']);
|
if(!empty($SearchWords['taglist'])) {
|
||||||
$TagList = explode(',',$_GET['taglist']);
|
$Tags = $SearchWords['taglist'];
|
||||||
$TagListEx = array();
|
if(!$EnableNegation && !empty($Tags['exclude'])) {
|
||||||
foreach($TagList as $Key => &$Tag) {
|
$Tags['include'] = array_merge($Tags['include'], $Tags['exclude']);
|
||||||
$Tag = trim($Tag);
|
unset($Tags['exclude']);
|
||||||
if(strlen($Tag) >= 2) {
|
}
|
||||||
if($Tag[0] == '!' && strlen($Tag) >= 3) {
|
foreach($Tags['include'] as &$Tag) {
|
||||||
$TagListEx[] = '!'.$SS->EscapeString(substr($Tag,1));
|
$Tag = $SS->EscapeString($Tag);
|
||||||
unset($TagList[$Key]);
|
}
|
||||||
} else {
|
if(!empty($Tags['exclude'])) {
|
||||||
$Tag = $SS->EscapeString($Tag);
|
foreach($Tags['exclude'] as &$Tag) {
|
||||||
}
|
$Tag = '!'.$SS->EscapeString(substr($Tag,1));
|
||||||
} else {
|
|
||||||
unset($TagList[$Key]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($Tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(empty($_GET['tags_type']) && !empty($TagList) && count($TagList) > 1) {
|
$QueryParts = array();
|
||||||
$_GET['tags_type'] = '0';
|
// 'All' tags
|
||||||
if(!empty($TagListEx)) {
|
if(!isset($_GET['tags_type']) || $_GET['tags_type'] == 1) {
|
||||||
$Queries[]='@taglist ( '.implode(' | ', $TagList).' ) '.implode(' ', $TagListEx);
|
$_GET['tags_type'] = '1';
|
||||||
} else {
|
$Tags = array_merge($Tags['include'], $Tags['exclude']);
|
||||||
$Queries[]='@taglist ( '.implode(' | ', $TagList).' )';
|
if(!empty($Tags)) {
|
||||||
|
$QueryParts[] = implode(' ', $Tags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} elseif(!empty($TagList)) {
|
// 'Any' tags
|
||||||
$Queries[]='@taglist '.implode(' ', array_merge($TagList,$TagListEx));
|
else {
|
||||||
} 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';
|
$_GET['tags_type'] = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(array('artistname','groupname', 'recordlabel', 'cataloguenumber',
|
foreach($SearchWords as $Search => $Words) {
|
||||||
'remastertitle', 'remasteryear', 'remasterrecordlabel', 'remastercataloguenumber',
|
$QueryParts = array();
|
||||||
'filelist', 'format', 'media') as $Search) {
|
if(!$EnableNegation && !empty($Words['exclude'])) {
|
||||||
if(!empty($_GET[$Search])) {
|
$Words['include'] = array_merge($Words['include'], $Words['exclude']);
|
||||||
$_GET[$Search] = str_replace(array('%'), '', $_GET[$Search]);
|
unset($Words['exclude']);
|
||||||
if($Search == 'filelist') {
|
}
|
||||||
$Queries[]='@filelist "'.$SS->EscapeString($_GET['filelist']).'"~20';
|
foreach($Words['include'] as $Word) {
|
||||||
} else {
|
$QueryParts[] = $SS->EscapeString($Word);
|
||||||
$Words = explode(' ', $_GET[$Search]);
|
}
|
||||||
foreach($Words as $Key => &$Word) {
|
if(!empty($Words['exclude'])) {
|
||||||
if($Word[0] == '!' && strlen($Word) >= 3 && count($Words) >= 2) {
|
foreach($Words['exclude'] as $Word) {
|
||||||
if(strpos($Word,'!',1) === false) {
|
$QueryParts[] = '!'.$SS->EscapeString(substr($Word,1));
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!empty($QueryParts)) {
|
||||||
|
$Queries[] = "@$Search ".implode(' ', $QueryParts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($_GET['year'])) {
|
if(!empty($_GET['year'])) {
|
||||||
@ -316,9 +374,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
|||||||
$SS->set_index(SPHINX_INDEX.' delta');
|
$SS->set_index(SPHINX_INDEX.' delta');
|
||||||
$Results = $SS->search($Query, '', 0, array(), '', '');
|
$Results = $SS->search($Query, '', 0, array(), '', '');
|
||||||
if(check_perms('site_search_many')) {
|
if(check_perms('site_search_many')) {
|
||||||
|
|
||||||
$TorrentCount = $SS->TotalResults;
|
$TorrentCount = $SS->TotalResults;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$TorrentCount = min($SS->TotalResults, SPHINX_MAX_MATCHES);
|
$TorrentCount = min($SS->TotalResults, SPHINX_MAX_MATCHES);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user