Empty commit

This commit is contained in:
Git 2011-09-30 08:00:12 +00:00
parent db0f891b08
commit 1b99f62706
8 changed files with 175 additions and 163 deletions

View File

@ -597,7 +597,7 @@ function audiobook_form() {
<select id="bitrate" name="bitrate" onchange="Bitrate()">
<option value="">---</option>
<?
if($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates)) {
if(!$Torrent['Bitrate'] || ($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates))) {
$OtherBitrate = true;
if(substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(" (VBR)")) == " (VBR)") {
$Torrent['Bitrate'] = substr($Torrent['Bitrate'], 0, strlen($Torrent['Bitrate'])-6);
@ -608,7 +608,7 @@ function audiobook_form() {
}
foreach(display_array($this->Bitrates) as $Bitrate) {
echo "<option value='$Bitrate'";
if($Bitrate == $Torrent['Bitrate'] || (!$OtherBitrate || $Bitrate == "Other")) {
if($Bitrate == $Torrent['Bitrate'] || ($OtherBitrate && $Bitrate == "Other")) {
echo " selected='selected'";
}
echo ">";

View File

@ -19,6 +19,5 @@
$DB->query("UPDATE forums_topics SET StickyPostID = ".$PostID." WHERE ID = ".$ThreadID);
}
$Cache->delete_value('thread_'.$ThreadID.'_info');
$Cache->delete_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID);
header('Location: forums.php?action=viewthread&threadid='.$ThreadID);

View File

@ -73,7 +73,7 @@
}
if(!empty($_POST['image'])) {
if(preg_match("/^(".IMAGE_REGEX.")( ".IMAGE_REGEX.")*$/is", $_POST['image'], $Matches)) {
if(preg_match("/^(".IMAGE_REGEX.")( ".IMAGE_REGEX.")*$/is", trim($_POST['image']), $Matches)) {
$Images = $Matches[0];
} else {
$Err = "The extra image links you provided weren't links to images...";

View File

@ -14,12 +14,21 @@
$CountryMax = ceil(log(Max(1,$Data[0][1]))/log(2))+1;
$CountryMin = floor(log(Max(1,$Data[$CountryMinThreshold][1]))/log(2));
$CountryRegions = array('RS' => array('RS-KM')); // Count Kosovo as Serbia as it doesn't have a TLD
foreach ($Data as $Key => $Item) {
list($Country,$UserCount) = $Item;
$Countries[] = $Country;
$CountryUsers[] = number_format((((log($UserCount)/log(2))-$CountryMin)/($CountryMax-$CountryMin))*100,2);
$Rank[] = number_format((1-($Key/$Count))*100,4);
$Rank[] = round((1-($Key/$Count))*100);
if(isset($CountryRegions[$Country])) {
foreach($CountryRegions[$Country] as $Region) {
$Countries[] = $Region;
$Rank[] = end($Rank);
}
}
}
reset($Rank);
for ($i=$CountryMin;$i<=$CountryMax;$i++) {
$LogIncrements[] = human_format(pow(2,$i));
@ -132,14 +141,14 @@
<br />
<h3>Geographical Distribution Map</h3>
<div class="box center">
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=world&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=europe&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=map:fixed=-55,-180,73,180&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=map:fixed=37,-26,65,67&chs=440x220&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" />
<br />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=south_america&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=asia&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=map:fixed=-46,-132,24,21.5&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=map:fixed=-11,22,50,160&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" />
<br />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=africa&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('',$Countries)?>&chtm=middle_east&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=map:fixed=-36,-57,37,100&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" />
<img src="http://chart.apis.google.com/chart?cht=map:fixed=14.8,15,45,86&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" />
<br />
<img src="http://chart.apis.google.com/chart?chxt=y,x&chg=0,-1,1,1&chxs=0,h&cht=bvs&chco=76A4FB&chs=880x300&chd=t:<?=implode(',',array_slice($CountryUsers,0,31))?>&chxl=1:|<?=implode('|',array_slice($Countries,0,31))?>|0:|<?=implode('|',$LogIncrements)?>&amp;chf=bg,s,FFFFFF00" />
</div>

View File

@ -713,9 +713,9 @@ function header_link($SortKey,$DefaultWay="desc") {
<td colspan="2">
<?=$DisplayName?>
<? if(in_array($GroupID, $Bookmarks)) { ?>
<span style="float:right;"><a href="#showimg_<?=$GroupID?>" id="bookmarklink_torrent_<?=$GroupID?>" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<span style="float:right;"><a href="#" id="bookmarklink_torrent_<?=$GroupID?>" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<? } else { ?>
<span style="float:right;"><a href="#showimg_<?=$GroupID?>" id="bookmarklink_torrent_<?=$GroupID?>" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<span style="float:right;"><a href="#" id="bookmarklink_torrent_<?=$GroupID?>" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<? } ?>
<br />
<div class="tags">

View File

@ -32,7 +32,7 @@
$Properties=array();
$Type = $Categories[(int)$_POST['type']];
$TypeID = $_POST['type'] + 1;
$Properties['CategoryName'] = $_POST['type'];
$Properties['CategoryName'] = $Type;
$Properties['Title'] = $_POST['title'];
$Properties['Remastered'] = (isset($_POST['remaster'])) ? 1 : 0;
if($Properties['Remastered'] || isset($_POST['unknown'])) {

View File

@ -1,149 +1,151 @@
/*
Spent hours debugging opera, turns out they reserve the global variable autocomplete. Bitches.
*/
"use strict";
var autocomp = {
id: "",
value: "",
href: null,
timer: null,
input: null,
list: null,
pos: -1,
cache: [],
start: function (id) {
this.id = id;
this.cache[id] = ["",[],[],[]];
this.input = document.getElementById(id + "search");
this.list = document.getElementById(id + "complete");
listener.set(document.body,'click',function(){
autocomp.value = autocomp.input.value;
autocomp.end();
});
},
end: function () {
//this.input.value = this.value;
this.href = null;
this.highlight(-1);
this.list.style.visibility = 'hidden';
clearTimeout(this.timer);
},
keyup: function (e) {
clearTimeout(this.timer);
var key = (window.event)?window.event.keyCode:e.keyCode;
switch (key) {
case 27: //esc
break;
case 8: //backspace
this.href = null;
this.list.style.visibility = 'hidden';
this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",500);
break;
case 38: //up
case 40: //down
this.highlight(key);
this.href = this.list.children[this.pos].href;
this.input.value = this.list.children[this.pos].textContent || this.list.children[this.pos].innerText;
break;
case 13:
if(this.href != null) {
window.location = this.href;
}
return 0;
default:
this.href = null;
this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",300);
return 1;
}
return 0;
},
keydown: function (e) {
switch ((window.event)?window.event.keyCode:e.keyCode) {
case 9: //tab
this.value = this.input.value;
case 27: //esc
this.end();
break;
case 38:
e.preventDefault();
break;
case 13: //enter
return 0;
}
return 1;
},
highlight: function(change) {
//No highlights on no list
if (this.list.children.length === 0) {
return;
}
//Show me the
this.list.style.visibility = 'visible';
//Remove the previous highlight
if (this.pos !== -1) {
this.list.children[this.pos].className = "";
}
//Change position
if (change === 40) {
++this.pos;
} else if (change === 38) {
--this.pos;
} else {
this.pos = change;
}
//Wrap arounds
if (this.pos >= this.list.children.length) {
this.pos = -1;
} else if (this.pos < -1) {
this.pos = this.list.children.length-1;
}
if (this.pos !== -1) {
this.list.children[this.pos].className = "highlight";
} else {
this.href = null;
this.input.value = this.value;
}
},
get: function (value) {
this.pos = -1;
this.value = value;
if (typeof this.cache[this.id+value] === 'object') {
this.display(this.cache[this.id+value]);
return;
}
ajax.get(this.id+'.php?action=autocomplete&name='+this.input.value,function(jstr){
var data = json.decode(jstr);
autocomp.cache[autocomp.id+data[0]] = data;
autocomp.display(data);
});
},
display: function (data) {
var i,il,li;
this.list.innerHTML = '';
for (i=0,il=data[1].length;i<il;++i) {
li = document.createElement('li');
li.innerHTML = data[1][i];
li.i = i;
li.href = data[3][i];
listener.set(li,'mouseover',function(){
autocomp.highlight(this.i);
});
listener.set(li,'click',function(){
window.location = this.href;
});
this.list.appendChild(li);
}
if (i > 0) {
this.list.style.visibility = 'visible';
} else {
this.list.style.visibility = 'hidden';
}
}
};
/*
Spent hours debugging opera, turns out they reserve the global variable autocomplete. Bitches.
*/
"use strict";
var autocomp = {
id: "",
value: "",
href: null,
timer: null,
input: null,
list: null,
pos: -1,
cache: [],
start: function (id) {
this.id = id;
this.cache[id] = ["",[],[],[]];
this.input = document.getElementById(id + "search");
this.list = document.getElementById(id + "complete");
listener.set(document.body,'click',function(){
autocomp.value = autocomp.input.value;
autocomp.end();
});
},
end: function () {
//this.input.value = this.value;
this.href = null;
this.highlight(-1);
this.list.style.visibility = 'hidden';
clearTimeout(this.timer);
},
keyup: function (e) {
clearTimeout(this.timer);
var key = (window.event)?window.event.keyCode:e.keyCode;
switch (key) {
case 27: //esc
break;
case 8: //backspace
this.href = null;
this.list.style.visibility = 'hidden';
this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",500);
break;
case 38: //up
case 40: //down
this.highlight(key);
if(this.pos !== -1) {
this.href = this.list.children[this.pos].href;
this.input.value = this.list.children[this.pos].textContent || this.list.children[this.pos].value;
}
break;
case 13:
if(this.href != null) {
window.location = this.href;
}
return 0;
default:
this.href = null;
this.timer = setTimeout("autocomp.get('" + escape(this.input.value) + "');",300);
return 1;
}
return 0;
},
keydown: function (e) {
switch ((window.event)?window.event.keyCode:e.keyCode) {
case 9: //tab
this.value = this.input.value;
case 27: //esc
this.end();
break;
case 38:
e.preventDefault();
break;
case 13: //enter
return 0;
}
return 1;
},
highlight: function(change) {
//No highlights on no list
if (this.list.children.length === 0) {
return;
}
//Show me the
this.list.style.visibility = 'visible';
//Remove the previous highlight
if (this.pos !== -1) {
this.list.children[this.pos].className = "";
}
//Change position
if (change === 40) {
++this.pos;
} else if (change === 38) {
--this.pos;
} else {
this.pos = change;
}
//Wrap arounds
if (this.pos >= this.list.children.length) {
this.pos = -1;
} else if (this.pos < -1) {
this.pos = this.list.children.length-1;
}
if (this.pos !== -1) {
this.list.children[this.pos].className = "highlight";
} else {
this.href = null;
this.input.value = this.value;
}
},
get: function (value) {
this.pos = -1;
this.value = unescape(value);
if (typeof this.cache[this.id+value] === 'object') {
this.display(this.cache[this.id+value]);
return;
}
ajax.get(this.id+'.php?action=autocomplete&name='+this.input.value,function(jstr){
var data = json.decode(jstr);
autocomp.cache[autocomp.id+data[0]] = data;
autocomp.display(data);
});
},
display: function (data) {
var i,il,li;
this.list.innerHTML = '';
for (i=0,il=data[1].length;i<il;++i) {
li = document.createElement('li');
li.innerHTML = data[1][i];
li.i = i;
li.href = data[3][i];
listener.set(li,'mouseover',function(){
autocomp.highlight(this.i);
});
listener.set(li,'click',function(){
window.location = this.href;
});
this.list.appendChild(li);
}
if (i > 0) {
this.list.style.visibility = 'visible';
} else {
this.list.style.visibility = 'hidden';
}
}
};

View File

@ -121,6 +121,7 @@ function Bookmark(type, id, newName) {
ajax.get("bookmarks.php?action=add&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
lnk.onclick = function() { Unbookmark(type, id, oldName); return false; };
lnk.innerHTML = newName;
lnk.title = 'Remove bookmark';
});
}
@ -137,6 +138,7 @@ function Unbookmark(type, id, newName) {
ajax.get("bookmarks.php?action=remove&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
lnk.onclick = function() { Bookmark(type, id, oldName); return false; };
lnk.innerHTML = newName;
lnk.title = 'Add bookmark';
});
}
}