Empty commit

This commit is contained in:
Git 2013-02-10 08:00:29 +00:00
parent 98bc98ed16
commit 35473bd15d
15 changed files with 350 additions and 359 deletions

View File

@ -98,7 +98,7 @@ public function __construct ($TOC = false) {
reset($this->Smileys);
}
/**
/**
* Output BBCode as XHTML
* @param string $Str BBCode text
* @param bool $OutputTOC Ouput TOC near (above) text
@ -434,9 +434,9 @@ private function parse ($Str) {
case 'tex':
$Array[$ArrayPos] = array('Type'=>'tex', 'Val'=>$Block);
break;
case 'rule':
$Array[$ArrayPos] = array('Type'=>'rule', 'Val'=>$Block);
break;
case 'rule':
$Array[$ArrayPos] = array('Type'=>'rule', 'Val'=>$Block);
break;
case 'pre':
case 'code':
case 'plain':
@ -529,10 +529,10 @@ public function parse_toc ($Min = 3)
/**
* Generates the list items and proper depth
*
* First check if the item should be higher than the current level
* First check if the item should be higher than the current level
* - Close the list and previous lists
*
* Then check if the item should go lower than the current level
* Then check if the item should go lower than the current level
* - If the list doesn't open on level one, use the Offset
* - Open appropriate sub lists
*
@ -584,7 +584,7 @@ private function to_html ($Array) {
$Str.='<em>'.$this->to_html($Block['Val'])."</em>";
break;
case 's':
$Str.='<span style="text-decoration: line-through">'.$this->to_html($Block['Val']).'</span>';
$Str.='<span style="text-decoration: line-through;">'.$this->to_html($Block['Val']).'</span>';
break;
case 'important':
$Str.='<strong class="important_text">'.$this->to_html($Block['Val']).'</strong>';
@ -595,13 +595,13 @@ private function to_html ($Array) {
case 'artist':
$Str.='<a href="artist.php?artistname='.urlencode(Format::undisplay_str($Block['Val'])).'">'.$Block['Val'].'</a>';
break;
case 'rule':
$Rule = trim(strtolower($Block['Val']));
if($Rule[0] != 'r' && $Rule[0] != 'h') {
$Rule = 'r'.$Rule;
}
$Str.='<a href="rules.php?p=upload#'.urlencode(Format::undisplay_str($Rule)).'">'.preg_replace('/[aA-zZ]/', '', $Block['Val']).'</a>';
break;
case 'rule':
$Rule = trim(strtolower($Block['Val']));
if($Rule[0] != 'r' && $Rule[0] != 'h') {
$Rule = 'r'.$Rule;
}
$Str.='<a href="rules.php?p=upload#'.urlencode(Format::undisplay_str($Rule)).'">'.preg_replace('/[aA-zZ]/', '', $Block['Val']).'</a>';
break;
case 'torrent':
$Pattern = '/('.NONSSL_SITE_URL.'\/torrents\.php.*[\?&]id=)?(\d+)($|&|\#).*/i';
$Matches = array();
@ -635,7 +635,7 @@ private function to_html ($Array) {
$Str.='<code>'.$Block['Val'].'</code>';
break;
case 'list':
$Str .= '<'.$Block['ListType'].'>';
$Str.='<'.$Block['ListType'].'>';
foreach($Block['Val'] as $Line) {
$Str.='<li>'.$this->to_html($Line).'</li>';
@ -686,12 +686,12 @@ private function to_html ($Array) {
$this->InQuotes++;
if(!empty($Block['Attr'])) {
$Exploded = explode("|", $this->to_html($Block['Attr']));
if(isset($Exploded[1]) && is_numeric($Exploded[1])) {
if(isset($Exploded[1]) && is_numeric($Exploded[1])) {
$PostID = trim($Exploded[1]);
$Str.= '<a href="#" onclick="QuoteJump(event, '.$PostID.'); return false;"><strong class="quoteheader">'.$Exploded[0].'</strong> wrote: </a>';
$Str.='<a href="#" onclick="QuoteJump(event, '.$PostID.'); return false;"><strong class="quoteheader">'.$Exploded[0].'</strong> wrote: </a>';
}
else {
$Str.= '<strong class="quoteheader">'.$Exploded[0].'</strong> wrote: ';
$Str.='<strong class="quoteheader">'.$Exploded[0].'</strong> wrote: ';
}
}
$Str.='<blockquote>'.$this->to_html($Block['Val']).'</blockquote>';
@ -710,11 +710,11 @@ private function to_html ($Array) {
$Str.='<blockquote class="hidden spoiler">'.$this->to_html($Block['Val']).'</blockquote>';
}
else {
$Str .= '<strong>Use of the [mature] tag requires a description.</strong> The correct format is as follows: <strong>[mature=description] ...content... [/mature]</strong>, where "description" is a mandatory description of the post. Misleading descriptions will be penalized. For further information on our mature content policies, please refer to this <a href="wiki.php?action=article&amp;id=1063">wiki</a>.';
$Str.='<strong>Use of the [mature] tag requires a description.</strong> The correct format is as follows: <strong>[mature=description] ...content... [/mature]</strong>, where "description" is a mandatory description of the post. Misleading descriptions will be penalized. For further information on our mature content policies, please refer to this <a href="wiki.php?action=article&amp;id=1063">wiki</a>.';
}
}
else {
$Str .= '<span class="mature_blocked" style="font-style:italic;"><a href="wiki.php?action=article&amp;id=1063">Mature content </a>has been blocked. You can choose to view mature content by editing your <a href="user.php?action=edit&amp;userid=' . $LoggedUser['ID'] . '">settings</a>.</span>';
$Str.='<span class="mature_blocked" style="font-style:italic;"><a href="wiki.php?action=article&amp;id=1063">Mature content </a>has been blocked. You can choose to view mature content by editing your <a href="user.php?action=edit&amp;userid=' . $LoggedUser['ID'] . '">settings</a>.</span>';
}
break;
case 'img':

View File

@ -488,7 +488,7 @@ function to_html($Array) {
$Str.='<code>'.$Block['Val'].'</code>';
break;
case 'list':
$Str .= '<ul>';
$Str.='<ul>';
foreach($Block['Val'] as $Line) {
$Str.='<li>'.$this->to_html($Line).'</li>';
@ -524,7 +524,7 @@ function to_html($Array) {
case 'quote':
$this->NoImg++; // No images inside quote tags
if(!empty($Block['Attr'])) {
$Str.= '<strong>'.$this->to_html($Block['Attr']).'</strong> wrote: ';
$Str.='<strong>'.$this->to_html($Block['Attr']).'</strong> wrote: ';
}
$Str.='<blockquote>'.$this->to_html($Block['Val']).'</blockquote>';
$this->NoImg--;
@ -542,7 +542,7 @@ function to_html($Array) {
$Str.='[img]'.$Block['Val'].'[/img]';
} else {
if(check_perms('site_proxy_images')) {
$Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="http://'.SITE_URL.'/image.php?i='.urlencode($Block['Val']).'" />';
$Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="https://'.SITE_URL.'/image.php?i='.urlencode($Block['Val']).'" />';
} else {
$Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.$Block['Val'].'" />';
}

View File

@ -449,7 +449,7 @@ function to_html($Array) {
$Str.='<pre>'.$Block['Val'].'</pre>';
break;
case 'list':
$Str .= '<ul>';
$Str.='<ul>';
foreach($Block['Val'] as $Line) {
$Str.='<li>'.$this->to_html($Line).'</li>';
@ -485,7 +485,7 @@ function to_html($Array) {
case 'quote':
$this->NoImg++; // No images inside quote tags
if(!empty($Block['Attr'])) {
$Str.= '<strong>'.$this->to_html($Block['Attr']).'</strong> wrote: ';
$Str.='<strong>'.$this->to_html($Block['Attr']).'</strong> wrote: ';
}
$Str.='<blockquote>'.$this->to_html($Block['Val']).'</blockquote>';
$this->NoImg--;

View File

@ -48,7 +48,11 @@ public static function geoip($IP) {
if (isset($IPs[$IP])) {
return $IPs[$IP];
}
$Long = Tools::ip_to_unsigned($IP);
if (is_number($IP)) {
$Long = $IP;
} else {
$Long = Tools::ip_to_unsigned($IP);
}
if(!$Long || $Long == 2130706433) { // No need to check cc for 127.0.0.1
return false;
}
@ -126,7 +130,7 @@ public static function lookup_ip($IP) {
*/
public static function display_ip($IP) {
$Line = display_str($IP).' ('.Tools::get_country_code_by_ajax($IP).') ';
$Line .= '[<a href="user.php?action=search&amp;ip_history=on&amp;ip='.display_str($IP).'&amp;matchtype=strict" title="Search">S</a>]';
$Line .= '<a href="user.php?action=search&amp;ip_history=on&amp;ip='.display_str($IP).'&amp;matchtype=strict" title="Search" class="brackets">S</a>';
return $Line;
}

View File

@ -834,7 +834,6 @@ function compare($X, $Y){
$Cache->cache_value('similar_positions_'.$ArtistID, $SimilarData, 3600*24);
}
?>
<div id="similar_artist_map" class="box">
<div id="flipper_head" class="head">
<a href="#">&uarr;</a>&nbsp;
@ -855,60 +854,55 @@ function compare($X, $Y){
</div>
</div>
<script type="text/javascript">
//<![CDATA[
<script type="text/javascript">//<![CDATA[
var cloudLoaded = false;
function flipView() {
var state = document.getElementById('flip_view_1').style.display == 'block';
var state = document.getElementById('flip_view_1').style.display == 'block';
if(state) {
if(state) {
document.getElementById('flip_view_1').style.display='none';
document.getElementById('flip_view_2').style.display='block';
document.getElementById('flipper_title').innerHTML = 'Similar artist cloud';
document.getElementById('flip_to').innerHTML = 'Switch to map';
document.getElementById('flip_view_1').style.display='none';
document.getElementById('flip_view_2').style.display='block';
document.getElementById('flipper_title').innerHTML = 'Similar Artist Cloud';
document.getElementById('flip_to').innerHTML = ' [Switch to Map]';
if(!cloudLoaded) {
require("static/functions/jquery.js", function () {
require("static/functions/tagcanvas.js", function () {
require("static/functions/artist_cloud.js", function () {
});
if(!cloudLoaded) {
require("static/functions/jquery.js", function () {
require("static/functions/tagcanvas.js", function () {
require("static/functions/artist_cloud.js", function () {
});
});
});
});
cloudLoaded = true;
}
}
else {
document.getElementById('flip_view_1').style.display='block';
document.getElementById('flip_view_2').style.display='none';
document.getElementById('flipper_title').innerHTML = 'Similar Artist Map';
document.getElementById('flip_to').innerHTML = ' [Switch to Cloud]';
}
cloudLoaded = true;
}
}
else {
document.getElementById('flip_view_1').style.display='block';
document.getElementById('flip_view_2').style.display='none';
document.getElementById('flipper_title').innerHTML = 'Similar artist map';
document.getElementById('flip_to').innerHTML = 'Switch to cloud';
}
}
//TODO move this to global, perhaps it will be used elsewhere in the future
//http://stackoverflow.com/questions/7293344/load-javascript-dynamically
function require(file, callback) {
var script = document.getElementsByTagName('script')[0],
newjs = document.createElement('script');
var script = document.getElementsByTagName('script')[0],
newjs = document.createElement('script');
// IE
newjs.onreadystatechange = function () {
if (newjs.readyState === 'loaded' || newjs.readyState === 'complete') {
newjs.onreadystatechange = null;
callback();
}
};
// others
newjs.onload = function () {
callback();
};
newjs.src = file;
script.parentNode.insertBefore(newjs, script);
// IE
newjs.onreadystatechange = function () {
if (newjs.readyState === 'loaded' || newjs.readyState === 'complete') {
newjs.onreadystatechange = null;
callback();
}
};
// others
newjs.onload = function () {
callback();
};
newjs.src = file;
script.parentNode.insertBefore(newjs, script);
}
//]]>
</script>

View File

@ -290,8 +290,8 @@ function compare($X, $Y){
<a href="bookmarks.php?type=requests" class="brackets">Requests</a>
<? if (count($TorrentList) > 0) { ?>
<br /><br />
<a href="bookmarks.php?action=remove_snatched&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to remove the bookmarks for all items you\'ve snatched?');">Remove Snatched</a>
<a href="bookmarks.php?action=edit&amp;type=torrents" class="brackets">Manage Torrents</a>
<a href="bookmarks.php?action=remove_snatched&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to remove the bookmarks for all items you\'ve snatched?');">Remove snatched</a>
<a href="bookmarks.php?action=edit&amp;type=torrents" class="brackets">Manage torrents</a>
<? } ?>
</div>
</div>

View File

@ -18,7 +18,7 @@
$Conditions = "WHERE t.UserID = $UserID AND tc.AuthorID != t.UserID AND tc.AddedTime > t.Time";
$Title = 'Comments left on your torrents';
$Header = 'Comments left on your uploads';
if($Self) $OtherLink = '<a href="comments.php?action=torrents">Display comments you\'ve made</a>';
if($Self) $OtherLink = '<a href="comments.php?action=torrents" class="brackets">Display comments you have made</a>';
}
else {
$Conditions = "WHERE tc.AuthorID = $UserID";

View File

@ -55,6 +55,7 @@
}
}
if(!isset($Forums[$ForumID])) { error(404); }
// Make sure they're allowed to look at the page
if (!check_perms('site_moderate_forums')) {

View File

@ -36,8 +36,6 @@
$ThreadID = $_GET['threadid'];
}
if (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage'];
} else {
@ -165,7 +163,7 @@
<div class="center">
<a href="reports.php?action=report&amp;type=thread&amp;id=<?=$ThreadID?>" class="brackets">Report Thread</a>
<a href="#" onclick="Subscribe(<?=$ThreadID?>);return false;" id="subscribelink<?=$ThreadID?>" class="brackets"><?=(in_array($ThreadID, $UserSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
<a href="#" class="brackets" onclick="$('#searchthread').toggle(); this.innerHTML = (this.innerHTML == 'Search this Thread'?'Hide Search':'Search this Thread'); return false;">Search this Thread</a>
<a href="#" onclick="$('#searchthread').toggle(); this.innerHTML = (this.innerHTML == 'Search this Thread'?'Hide Search':'Search this Thread'); return false;" class="brackets">Search this Thread</a>
</div>
<div id="searchthread" class="hidden center">
<div style="display: inline-block;">

View File

@ -172,7 +172,10 @@
// Function to log a user's login attempt
function log_attempt($UserID) {
global $DB, $Cache, $AttemptID, $Attempts, $Bans, $BannedUntil, $Time;
global $DB, $Cache, $AttemptID, $Attempts, $Bans, $BannedUntil, $Time, $UserID;
$IPStr = $_SERVER['REMOTE_ADDR'];
$IPA = substr($IPStr, 0, strcspn($IPStr, '.'));
$IP = Tools::ip_to_unsigned($IPStr);
if($AttemptID) { // User has attempted to log in recently
$Attempts++;
if ($Attempts>5) { // Only 6 allowed login attempts, ban user's IP
@ -185,7 +188,6 @@ function log_attempt($UserID) {
WHERE ID='".db_string($AttemptID)."'");
if ($Bans>9) { // Automated bruteforce prevention
$IP = Tools::ip_to_unsigned($_SERVER['REMOTE_ADDR']);
$DB->query("SELECT Reason FROM ip_bans WHERE ".$IP." BETWEEN FromIP AND ToIP");
if($DB->record_count() > 0) {
//Ban exists already, only add new entry if not for same reason
@ -200,8 +202,7 @@ function log_attempt($UserID) {
$DB->query("INSERT IGNORE INTO ip_bans
(FromIP, ToIP, Reason) VALUES
('$IP','$IP', 'Automated ban per >60 failed login attempts')");
$A = substr($_SERVER['REMOTE_ADDR'], 0, strcspn($_SERVER['REMOTE_ADDR'], '.'));
$Cache->delete_value('ip_bans_'.$A);
$Cache->delete_value('ip_bans_'.$IPA);
}
}
} else {
@ -216,12 +217,16 @@ function log_attempt($UserID) {
$Attempts=1;
$DB->query("INSERT INTO login_attempts
(UserID,IP,LastAttempt,Attempts) VALUES
('".db_string($UserID)."','".db_string($_SERVER['REMOTE_ADDR'])."','".sqltime()."',1)");
('".db_string($UserID)."','".db_string($IPStr)."','".sqltime()."',1)");
}
} // end log_attempt function
// If user has submitted form
if(isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])) {
if (strtotime($BannedUntil) > time()) {
header("Location: login.php");
die();
}
$Err=$Validate->ValidateForm($_POST);
if(!$Err) {

View File

@ -95,13 +95,13 @@
<a href="requests.php?action=delete&amp;id=<?=$RequestID?>" class="brackets">Delete</a>
<? } ?>
<? if(has_bookmarked('request', $RequestID)) { ?>
<a href="#" id="bookmarklink_request_<?=$RequestID?>" onclick="Unbookmark('request', <?=$RequestID?>,'[Bookmark]');return false;" class="brackets">Remove bookmark</a>
<a href="#" id="bookmarklink_request_<?=$RequestID?>" onclick="Unbookmark('request', <?=$RequestID?>,'Bookmark');return false;" class="brackets">Remove bookmark</a>
<? } else { ?>
<a href="#" id="bookmarklink_request_<?=$RequestID?>" onclick="Bookmark('request', <?=$RequestID?>,'[Remove bookmark]');return false;" class="brackets">Bookmark</a>
<a href="#" id="bookmarklink_request_<?=$RequestID?>" onclick="Bookmark('request', <?=$RequestID?>,'Remove bookmark');return false;" class="brackets">Bookmark</a>
<? } ?>
<a href="reports.php?action=report&amp;type=request&amp;id=<?=$RequestID?>" class="brackets">Report request</a>
<? if(!$IsFilled) { ?>
<a href="upload.php?requestid=<?=$RequestID?><?=($GroupID?"&groupid=$GroupID":'')?>" class="brackets">Upload request</a>
<a href="upload.php?requestid=<?=$RequestID?><?= ($GroupID ? "&amp;groupid=$GroupID" : '') ?>" class="brackets">Upload request</a>
<? }
if(!$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0))) { ?>
<a href="reports.php?action=report&amp;type=request_update&amp;id=<?=$RequestID?>" class="brackets">Request update</a>

View File

@ -404,7 +404,7 @@
</table>
<table class="layout">
<tr id="release_list">
<td class="label">Release Types</td>
<td class="label">Release types</td>
<td>
<input type="checkbox" id="toggle_releases" onchange="Toggle('releases', 0)" <?=(!$Submitted || !empty($ReleaseArray) && count($ReleaseArray) == count($ReleaseTypes) ? ' checked="checked"' : '')?>/> <label for="toggle_releases">All</label>
<? $i = 0;
@ -495,7 +495,7 @@
<table id="request_table" class="request_table border" cellpadding="6" cellspacing="1" border="0" width="100%">
<tr class="colhead_dark">
<td style="width: 38%;" class="nobr">
<strong>Request Name</strong> / <a href="?order=year&amp;sort=<?=(($CurrentOrder == 'year') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Year</strong></a>
<strong>Request name</strong> / <a href="?order=year&amp;sort=<?=(($CurrentOrder == 'year') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Year</strong></a>
</td>
<td class="nobr">
<a href="?order=votes&amp;sort=<?=(($CurrentOrder == 'votes') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Votes</strong></a>
@ -516,7 +516,7 @@
<a href="?order=created&amp;sort=<?=(($CurrentOrder == 'created') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Created</strong></a>
</td>
<td class="nobr">
<a href="?order=lastvote&amp;sort=<?=(($CurrentOrder == 'lastvote') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Last Vote</strong></a>
<a href="?order=lastvote&amp;sort=<?=(($CurrentOrder == 'lastvote') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Last vote</strong></a>
</td>
</tr>
<? if($NumResults == 0) { ?>

View File

@ -536,20 +536,13 @@ h3{margin:10px 0}
font-weight: bold;
}
tr.torrent .bookmark > a:before { content:""; }
tr.torrent .bookmark > a:after { content:""; }
tr.torrent .bookmark > a:before { content: ""; }
tr.torrent .bookmark > a:after { content: ""; }
.sidebar .navigation_list li {
margin-left: 20px;
}
.linkbox .brackets:before {
content: "[ ";
color: #757575;
}
.linkbox .brackets:after {
content: " ]";
.linkbox .brackets:before, .linkbox .brackets:after {
color: #757575;
}

View File

@ -466,12 +466,6 @@ h3{margin:10px 0}
.cats_comedy{width:30px; height:30px; background:url(https://what.cd/static/styles/minimal/images/icons/comedy.png) top left no-repeat}
.cats_comics{width:30px; height:30px; background:url(https://what.cd/static/styles/minimal/images/icons/comics.png) top left no-repeat}
.linkbox .brackets:before {
content: "[ ";
color: #757575;
}
.linkbox .brackets:after {
content: " ]";
.linkbox .brackets:before, .linkbox .brackets:after {
color: #757575;
}

View File

@ -489,6 +489,8 @@ table tr td.edition_info {
position:absolute;
top:0;
left:734px;
right:0;
width: 300px;
}
#artist #content .linkbox:first-of-type a {
margin-right:5px;