Empty commit

This commit is contained in:
Git 2012-06-13 08:00:16 +00:00
parent 24a2f6fe4c
commit b11239da33
4 changed files with 24 additions and 27 deletions

View File

@ -44,10 +44,10 @@
if (stripos($Name,$FullName) === 0) { if (stripos($Name,$FullName) === 0) {
$Suggestions[] = display_str($Name); $Suggestions[] = display_str($Name);
$Snatches[] = number_format($Snatch).' snatches'; $Snatches[] = number_format($Snatch).' snatches';
$Links[] = 'http'.($SSL?'s':'').'://'.$_SERVER['HTTP_HOST'].'/artist.php?id='.$ID; $ArtistIDs[] = $ID;
if (++$Matched > 9) { if (++$Matched > 9) {
break; break;
} }
} }
} }
echo json_encode(array($FullName,$Suggestions,$Snatches,$Links)); echo json_encode(array($FullName,$Suggestions,$Snatches,$ArtistIDs));

View File

@ -389,19 +389,17 @@
FROM artists_alias AS aa FROM artists_alias AS aa
WHERE aa.Name = '".db_string($Artist['name'])."'"); WHERE aa.Name = '".db_string($Artist['name'])."'");
if($DB->record_count() > 0) { while(list($ArtistID, $AliasID, $AliasName, $Redirect) = $DB->next_record(MYSQLI_NUM, false)) {
while($Result = $DB->next_record(MYSQLI_NUM, false)) {
list($ArtistID, $AliasID, $AliasName, $Redirect) = $Result;
if(!strcasecmp($Artist['name'], $AliasName)) { if(!strcasecmp($Artist['name'], $AliasName)) {
if($Redirect) { if($Redirect) {
$AliasID = $Redirect; $AliasID = $Redirect;
} }
$ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $AliasName);
$Cache->delete_value('artist_'.$ArtistID);
break; break;
} }
} }
$ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $AliasName); if(!$ArtistID) {
$Cache->delete_value('artist_'.$ArtistID);
} else {
//2. For each artist that didn't exist, create an artist. //2. For each artist that didn't exist, create an artist.
$DB->query("INSERT INTO artists_group (Name) VALUES ('".db_string($Artist['name'])."')"); $DB->query("INSERT INTO artists_group (Name) VALUES ('".db_string($Artist['name'])."')");
$ArtistID = $DB->inserted_id(); $ArtistID = $DB->inserted_id();

View File

@ -516,16 +516,15 @@
FROM artists_alias AS aa FROM artists_alias AS aa
WHERE aa.Name = '".db_string($Artist['name'])."'"); WHERE aa.Name = '".db_string($Artist['name'])."'");
if($DB->record_count() > 0) { if($DB->record_count() > 0) {
while($Result = $DB->next_record(MYSQLI_NUM, false)) { while(list($ArtistID, $AliasID, $AliasName, $Redirect) = $DB->next_record(MYSQLI_NUM, false)) {
list($ArtistID, $AliasID, $AliasName, $Redirect) = $Result;
if(!strcasecmp($Artist['name'], $AliasName)) { if(!strcasecmp($Artist['name'], $AliasName)) {
if($Redirect) { if($Redirect) {
$AliasID = $Redirect; $AliasID = $Redirect;
} }
$ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $AliasName);
break; break;
} }
} }
$ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $AliasName);
} }
} }
} }

View File

@ -5,7 +5,7 @@ Spent hours debugging opera, turns out they reserve the global variable autocomp
var autocomp = { var autocomp = {
id: "", id: "",
value: "", value: "",
href: null, artistid: null,
timer: null, timer: null,
input: null, input: null,
list: null, list: null,
@ -23,7 +23,7 @@ var autocomp = {
}, },
end: function () { end: function () {
//this.input.value = this.value; //this.input.value = this.value;
this.href = null; this.artistid = null;
this.highlight(-1); this.highlight(-1);
this.list.style.visibility = 'hidden'; this.list.style.visibility = 'hidden';
clearTimeout(this.timer); clearTimeout(this.timer);
@ -35,7 +35,7 @@ var autocomp = {
case 27: //esc case 27: //esc
break; break;
case 8: //backspace case 8: //backspace
this.href = null; this.artistid = null;
this.list.style.visibility = 'hidden'; this.list.style.visibility = 'hidden';
this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",500); this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",500);
break; break;
@ -43,17 +43,17 @@ var autocomp = {
case 40: //down case 40: //down
this.highlight(key); this.highlight(key);
if(this.pos !== -1) { if(this.pos !== -1) {
this.href = this.list.children[this.pos].href; this.artistid = this.list.children[this.pos].artistid;
this.input.value = this.list.children[this.pos].textContent || this.list.children[this.pos].value; this.input.value = this.list.children[this.pos].textContent || this.list.children[this.pos].value;
} }
break; break;
case 13: case 13:
if(this.href != null) { if(this.artistid != null) {
window.location = this.href; window.location = this.id + '.php?id='+this.artistid;
} }
return 0; return 0;
default: default:
this.href = null; this.artistid = null;
this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",300); this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",300);
return 1; return 1;
} }
@ -107,7 +107,7 @@ var autocomp = {
if (this.pos !== -1) { if (this.pos !== -1) {
this.list.children[this.pos].className = "highlight"; this.list.children[this.pos].className = "highlight";
} else { } else {
this.href = null; this.artistid = null;
this.input.value = this.value; this.input.value = this.value;
} }
}, },
@ -133,12 +133,12 @@ var autocomp = {
li = document.createElement('li'); li = document.createElement('li');
li.innerHTML = data[1][i]; li.innerHTML = data[1][i];
li.i = i; li.i = i;
li.href = data[3][i]; li.artistid = data[3][i];
listener.set(li,'mouseover',function(){ listener.set(li,'mouseover',function(){
autocomp.highlight(this.i); autocomp.highlight(this.i);
}); });
listener.set(li,'click',function(){ listener.set(li,'click',function(){
window.location = this.href; window.location = autocomp.id + '.php?id='+this.artistid;
}); });
this.list.appendChild(li); this.list.appendChild(li);
} }