Empty commit

This commit is contained in:
Git 2013-04-26 08:00:25 +00:00
parent afecab6f2f
commit 0a565870d9
15 changed files with 376 additions and 84 deletions

View File

@ -558,6 +558,19 @@ CREATE TABLE `reports` (
KEY `ResolverID` (`ResolverID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE `reports_email_blacklist` (
`ID` int(10) NOT NULL AUTO_INCREMENT,
`Type` tinyint(4) NOT NULL DEFAULT '0',
`UserID` int(10) NOT NULL,
`Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Checked` tinyint(4) NOT NULL DEFAULT '0',
`ResolverID` int(10) DEFAULT '0',
`Email` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`ID`),
KEY `Time` (`Time`),
KEY `UserID` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE `reportsv2` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ReporterID` int(10) unsigned NOT NULL DEFAULT '0',

View File

@ -588,14 +588,14 @@ function compare($X, $Y){
</div>
<? if ($NumGroups > $CollageCovers) { ?>
<div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;">&lt;&lt; First</a> | </span>
<span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;">&lt; Prev</a> | </span>
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;"><strong>&lt;&lt; First</strong></a> | </span>
<span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;"><strong>&lt; Prev</strong></a> | </span>
<? for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><?=$CollageCovers * $i + 1?>-<?=min($NumGroups,$CollageCovers * ($i + 1))?></a><?=($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : ''?></span>
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups,$CollageCovers * ($i + 1))?></strong></a><?=($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : ''?></span>
<? } ?>
<span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
<span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;">Next &gt;</a></span>
<span id="lastpage" class="<?=ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : ''?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;">Last &gt;&gt;</a></span>
<span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;"><strong>Next &gt;</strong></a></span>
<span id="lastpage" class="<?=ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : ''?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;"><strong>Last &gt;&gt;</strong></a></span>
</div>
<script type="text/javascript">//<![CDATA[
collageShow.init(<?=json_encode($CollagePages)?>);

View File

@ -379,6 +379,10 @@
include('misc/analysis.php');
break;
case 'rerender_gallery':
include('misc/rerender_gallery.php');
break;
case 'sandbox1':
include('misc/sandbox1.php');
break;

View File

@ -0,0 +1,106 @@
<?
if (!(check_perms('users_mod') || check_perms('admin_clear_cache'))) {
error(403);
}
// If this is accessed by itself through AJAX (e.g. when already rerendering images)
if (isset($_POST['ajax']) && isset($_POST['image'])) {
if (!isset($_POST['stylesheet']) ) {
echo json_encode(array('status' => "-2"));
die();
}
//Get the actual image data from the sent data string.
$FullData = $_POST['image'];
list($type, $ImageData) = explode(';', $FullData);
list(, $Base64Data) = explode(',', $ImageData);
$Image = base64_decode($Base64Data);
//Save the image to a file
file_put_contents(STATIC_SERVER.'thumb_'.$_POST['stylesheet'].'.png', $Image);
//Check if the file got saved properly, return status message.
if (!file_exists(STATIC_SERVER.'thumb_'.$_POST['stylesheet'].'.png')) {
echo json_encode(array('status' => "-1"));
die();
} else {
echo json_encode(array('status' => "0"));
die();
}
} elseif (!isset($_POST['ajax'])) {
// If this is accessed by the administrating user, display the page (creates calls to itself through AJAX).
View::show_header('Rerender stylesheet gallery images', 'jquery,stylesheetgallery_rerender_queue');
?>
<style>
#protected {
position: relative;
}
#protecting_overlay {
display: block;
opacity: 0.01;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.statusbutton > iframe { border: none; }
.statusbutton > iframe[src^="queue_"] { background: none repeat scroll 0 0 gray !important; }
.statusbutton > iframe.finished { background: none repeat scroll 0 0 yellowgreen !important; }
.statusbutton {
overflow: hidden;
width: 10px;
height: 10px;
border-radius: 10px;
display: inline-block;
border: 0px none;
background: red;
box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
margin: 0 2px -1px 0;
}
</style>
<div class="thin">
<h2>Rerender stylesheet gallery images</h2>
<div class="sidebar">
<div class="box box_info box_userinfo_stats">
<div class="head colhead_dark">Color codes</div>
<ul class="stats nobullet">
<li><div class="statusbutton" style="background: gray;"></div> <span> - Queued</span></li>
<li><div class="statusbutton" style="background: yellow;"></div> <span> - Currently encoding render</span></li>
<li><div class="statusbutton" style="background: yellowgreen;"></div> <span> - Rendered successfully</span></li>
<li><div class="statusbutton" style="background: red;"></div> <span> - Rendering returned an error, check console</span></li>
<li><div class="statusbutton" style="background: blue;"></div> <span> - Storage returned an error</span></li>
<li><div class="statusbutton" style="background: purple;"></div> <span> - Incomplete data error</span></li>
</ul>
</div>
</div>
<div class="main_column">
<div class="box">
<div class="head">
<span>About rendering</span>
</div>
<div class="pad">
<p>You are currently rerendering the stylesheet gallery images. Please don't close this page until rendering is finished or some images may be left unrendered.</p>
<p>This is a processing-intensive operation; you're likely to see a spike in your CPU &amp; RAM usage.</p>
<p>Tested and debugged on up-to-date Webkit and Gecko browsers; Opera will result in undefined behavior.</p>
<p><strong>Important:</strong> Be sure to double-check the gallery once all rendering is finished.</p>
<br />
<a href="#" class="brackets" id="start_rerendering">Begin rendering</a>
</div>
</div>
<div class="box">
<div class="head">
<span>Rendering status</span>
</div>
<div class="pad" id="protected">
<div id="protecting_overlay"></div>
<? foreach ($Stylesheets as $Style) { ?>
<p><span class="statusbutton" style="background: gray;"><iframe src="#" data-src="user.php?action=stylesheetgallery&amp;name=<?= $Style['Name'] ?>&amp;save=true" width="100%" height="100%"></iframe></span> - <?=$Style['Name']?></p>
<? } ?>
</div>
</div>
</div>
</div>
<? View::show_footer();
} else {
// Faulty operation, too many parameters or too few, error out.
error(500);
}
?>

View File

@ -95,11 +95,11 @@
<tr><td><a href="tools.php?action=sandbox8">Sandbox (8)</a></td></tr>
<tr><td><a href="schedule.php?auth=<?=$LoggedUser['AuthKey']?>">Schedule</a></td></tr>
<? } ?>
<? if (check_perms('users_mod')) { ?>
<? } if (check_perms('admin_clear_cache') || check_perms('users_mod')) { ?>
<tr><td><a href="tools.php?action=rerender_gallery">Rerender stylesheet gallery images</a></td></tr>
<? } if (check_perms('users_mod')) { ?>
<tr><td><strong><a href="tools.php?action=public_sandbox">Public sandbox</a></strong></td></tr>
<? } ?>
<? if (check_perms('users_mod')) { ?>
<? } if (check_perms('users_mod')) { ?>
<tr><td><strong><a href="tools.php?action=mod_sandbox">Mod-level sandbox</a></strong></td></tr>
<? } ?>
</table>

View File

@ -48,7 +48,6 @@
if ($T['FreeLeech'] == '1') {
$Announce .= ' / Freeleech!';
}
$Title = $Announce;
$AnnounceSSL = $Announce . ' - https://' . SSL_SITE_URL . "/torrents.php?id=$GroupID / https://" . SSL_SITE_URL . "/torrents.php?action=download&id=$ExtraTorrentID";
$Announce .= ' - https://' . SSL_SITE_URL . "/torrents.php?id=$GroupID / https://" . SSL_SITE_URL . "/torrents.php?action=download&id=$ExtraTorrentID";
@ -56,9 +55,9 @@
$AnnounceSSL .= ' - ' . trim($Properties['TagList']);
$Announce .= ' - ' . trim($Properties['TagList']);
send_irc('PRIVMSG #' . NONSSL_SITE_URL . '-announce :' . html_entity_decode($Announce));
send_irc('PRIVMSG #' . SSL_SITE_URL . '-announce-ssl :' . $AnnounceSSL);
//send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce :'.html_entity_decode($Announce));
// ENT_QUOTES is needed to decode single quotes/apostrophes
send_irc('PRIVMSG #' . NONSSL_SITE_URL . '-announce :' . html_entity_decode($Announce, ENT_QUOTES));
send_irc('PRIVMSG #' . SSL_SITE_URL . '-announce-ssl :' . html_entity_decode($AnnounceSSL, ENT_QUOTES));
}
?>

View File

@ -761,9 +761,9 @@
$AnnounceSSL .= " - ".trim($Properties['TagList']);
$Announce .= " - ".trim($Properties['TagList']);
send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce :'.html_entity_decode($Announce));
send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce-ssl :'.$AnnounceSSL);
//send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce :'.html_entity_decode($Announce));
// ENT_QUOTES is needed to decode single quotes/apostrophes
send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce :'.html_entity_decode($Announce, ENT_QUOTES));
send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce-ssl :'.html_entity_decode($AnnounceSSL, ENT_QUOTES));
$Debug->set_flag('upload: announced on irc');
// Manage notifications

View File

@ -4,6 +4,7 @@
error(404);
}
global $Cache;
$DB->query("SELECT
@ -97,8 +98,7 @@ function checked($Checked) {
<div id="css_gallery">
<? foreach ($Stylesheets as $Style) { ?>
<div class="preview_wrapper">
<div class="preview_overlay"></div>
<div class="preview_frame_wrapper"><iframe class="preview_frame" src="user.php?action=stylesheetgallery&amp;name=<?= $Style['Name'] ?>" width="588%" height="588%"></iframe></div>
<div class="preview_image" name="<?=$Style['Name']?>" style="background: url('<?=STATIC_SERVER.'thumb_'.$Style['Name'].'.png'?>') no-repeat scroll center top #CCC"></div>
<p class="preview_name"><input type="radio" name="stylesheet_gallery" value="<?= $Style['ID'] ?>" /> <?= $Style["ProperName"] ?></p>
</div>
<? } ?>

View File

@ -1,4 +1,5 @@
<?
if (!isset($_GET['name'])) {
if (!isset($Err)) {
error(404);
@ -12,18 +13,32 @@
if (!$Name) {
error(404);
}
if (isset($_GET['format']) && $_GET['format'] === "data"){
global $Cache;
$ImageData = $Cache->get_value("cssgallery_".$Name);
if(!empty($ImageData)){
echo json_encode(array('data' => $ImageData, 'status' => "0"));
die();
} else {
echo json_encode(array('status' => "-1"));
die();
}
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" style="overflow:hidden !important; margin: 0 !important; padding: 0 !important;">
<head>
<title>Stylesheet Gallery</title>
<meta http-equiv="X-UA-Compatible" content="chrome=1;IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="static/styles/global.css" rel="stylesheet" type="text/css" />
<link href="static/styles/<?= $Name ?>/style.css" title="<?= $Name ?>" rel="stylesheet" type="text/css" media="screen" />
<link href="<? echo STATIC_SERVER; ?>styles/global.css?v=<?=filemtime(STATIC_SERVER.'styles/global.css')?>" rel="stylesheet" type="text/css" />
<link href="<? echo STATIC_SERVER; ?>styles/<?= $Name ?>/style.css?v=<?=filemtime(STATIC_SERVER.'styles/'.$Name.'/style.css')?>" title="<?= $Name ?>" rel="stylesheet" type="text/css" media="screen" />
<? if (isset($_GET['save']) && $_GET['save']==="true" && check_perms('admin_clear_cache')) { ?>
<script src="<? echo STATIC_SERVER; ?>functions/jquery.js?v=<?=filemtime(STATIC_SERVER.'functions/jquery.js')?>"></script>
<script src="<? echo STATIC_SERVER; ?>functions/stylesheetgallery.js?v=<?=filemtime(STATIC_SERVER.'functions/stylesheetgallery.js')?>"></script>
<? } ?>
</head>
<body id="user" style="overflow:hidden;">
<body id="user" style="overflow:hidden !important; margin: 0 !important; padding: 0 !important; position: absolute !important;" stylesheet="<?= $Name ?>">
<div id="wrapper">
<h1 class="hidden">Gazelle</h1>
<div id="header">
@ -36,14 +51,14 @@
</ul>
<ul id="userinfo_major">
<li id="nav_upload" class="brackets"><a href="#">Upload</a></li>
<li id="nav_invite" class="brackets"><a href="#">Invite ()</a></li>
<li id="nav_invite" class="brackets"><a href="#">Invite (6)</a></li>
<li id="nav_donate" class="brackets"><a href="#">Donate</a></li>
</ul>
<ul id="userinfo_stats">
<li id="stats_seeding"><a href="#">Up</a>: <span class="stat" title="300.00000 MB">300.00 MB</span></li>
<li id="stats_leeching"><a href="#">Down</a>: <span class="stat" title="0.00000 B">0.00 B</span></li>
<li id="stats_ratio">Ratio: <span class="stat"><span class="r99" title="Infinite"></span></span></li>
<li id="stats_leeching"><a href="#">Down</a>: <span class="stat" title="10.00000 B">0.00 B</span></li>
<li id="stats_ratio">Ratio: <span class="stat"><span class="r99" title="30">30</span></span></li>
<li id="stats_required"><a href="#">Required</a>: <span class="stat" title="0.00000">0.00</span></li>
</ul>
@ -329,3 +344,6 @@
</div>
</body>
</html>
<?
}
}

View File

@ -9,7 +9,8 @@
View::show_header($Title);
$sql = "SELECT SQL_CALC_FOUND_ROWS
$sql = "
SELECT SQL_CALC_FOUND_ROWS
w.ID,
w.Title,
w.Date,

View File

@ -1,23 +1,36 @@
(function($) {
/*! jQuery Ajax Queue v0.1.2pre | (c) 2013 Corey Frang | Licensed MIT */
(function(e){var r=e({});e.ajaxQueue=function(n){function t(r){u=e.ajax(n),u.done(a.resolve).fail(a.reject).then(r,r)}var u,a=e.Deferred(),i=a.promise();return r.queue(t),i.abort=function(o){if(u)return u.abort(o);var c=r.queue(),f=e.inArray(t,c);return f>-1&&c.splice(f,1),a.rejectWith(n.context||n,[i,o,""]),i},i}})(jQuery);
//@ sourceMappingURL=dist/jquery.ajaxQueue.min.map
$(document).ready(function () {
// If the custom stylesheet field is empty, select the current style from the previews
if(!$('input#styleurl').val()){
$('input[name="stylesheet_gallery"][value="'+$('select#stylesheet').val()+'"]').click();
var radiobutton = $('input[name="stylesheet_gallery"][value="'+$('select#stylesheet').val()+'"]');
radiobutton.click();
$('.preview_wrapper').removeClass('selected');
radiobutton.parent().parent().addClass('selected');
}
// If an overlay is clicked, select the right item in the dropdown and clear the custom CSS field
$('div.preview_overlay').click(function() {
var radiobutton = $(this).parent().find('input');
// If an overlay is clicked, select the right item in the dropdown and clear the custom css field
$('div.preview_image').click(function() {
$('.preview_wrapper').removeClass('selected');
var parent = $(this).parent();
parent.addClass('selected');
var radiobutton = parent.find('input');
radiobutton.prop('checked', true);
$('select#stylesheet').val(radiobutton.attr('value'));
$('input#styleurl').val('');
})
// If the input is clicked, redirect it to the overlay click event
$('input[name="stylesheet_gallery"]').change(function() {
$(this).parent().parent().find('div.preview_overlay').click();
$(this).parent().parent().find('div.preview_image').click();
})
// If the dropdown is changed, select the appropriate item in gallery, clear the custom CSS field
$('select#stylesheet').change(function() {
$('input[name="stylesheet_gallery"][value="'+$(this).val()+'"]').prop('checked', true);
var radiobutton = $('input[name="stylesheet_gallery"][value="'+$(this).val()+'"]');
radiobutton.prop('checked', true);
$('.preview_wrapper').removeClass('selected');
radiobutton.parent().parent().addClass('selected');
$('input#styleurl').val('');
})
// If the custom CSS field is changed, clear radio buttons
@ -25,6 +38,7 @@
$('input[name="stylesheet_gallery"]').each(function() {
$(this).prop('checked', false);
})
$('.preview_wrapper').removeClass('selected');
})
// If the input is empty, select appropriate gallery item again by the dropdown
$('input#styleurl').keyup(function() {
@ -39,6 +53,5 @@
$('#toggle_css_gallery').text($(this).is(':visible') ? 'Hide gallery' : 'Show gallery');
});
});
});
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,42 @@
(function ($){
// Work through the queue of stylesheets
function recursivelyProcessQueue(queue){
// If our work here is done, call it a day.
if(queue.length < 1) return 0;
var nextTarget = queue.pop();
var originalSrc = nextTarget.attr('src');
nextTarget.attr('src', nextTarget.attr('data-src'));
nextTarget.load(function() {
var targetHtml = $(this).contents().find("html");
targetHtml.on('click', function() {
targetHtml.unbind();
recursivelyProcessQueue(queue);
// Avoid unnecessary caching, cahce might lead to undefined behavior.
nextTarget.attr('src', '#');
nextTarget.addClass('finished');
return 0;
})
});
// Be sure to close off.
return 0;
}
$(document).ready(function (){
// Build a queue of stylesheets to be rendered
var queue = [];
$('.statusbutton').children('iframe').each(function() {
var targetDiv = $(this);
queue.push(targetDiv);
});
// We'd prefer to work from top-down, not bottom-up.
queue = queue.reverse();
$('#start_rerendering').click(function(event) {
event.preventDefault();
recursivelyProcessQueue(queue);
$(this).css('text-decoration', 'line-through');
$(this).unbind();
return false;
});
});
})(jQuery);

View File

@ -474,48 +474,22 @@ tr.torrent .bookmark>a:after {
#css_gallery {
display: none;
overflow: hidden;
margin-top: 10px;
}
.preview_wrapper{
position: relative;
display: inline-block;
width: 29%;
height: 120px;
margin: 10px;
margin: 0 10px;
overflow: hidden;
}
.preview_overlay {
.preview_image{
display: block;
width: 100%;
height: 80px;
position: absolute;
background: transparent;
z-index: 1;
right: 0;
left: 0;
background-size: 100% auto !important;
cursor: pointer;
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
/* IE 5-7 */
filter: alpha(opacity=0);
/* Netscape */
-moz-opacity: 0;
/* Safari 1.x */
-khtml-opacity: 0;
/* Good browsers */
opacity: 0;
}
.preview_frame_wrapper {
width: 100%;
height: 80px;
overflow: hidden;
}
.preview_frame {
-ms-zoom: 0.17;
-moz-transform: scale(0.17);
-moz-transform-origin: 0 0;
-o-transform: scale(0.17);
-o-transform-origin: 0 0;
-webkit-transform: scale(0.17);
-webkit-transform-origin: 0 0;
}
.preview_name {
text-align: center;