Empty commit

This commit is contained in:
Git 2013-06-27 08:01:06 +00:00
parent f8540013d6
commit defe05e12a
85 changed files with 480 additions and 962 deletions

View File

@ -27,12 +27,20 @@ function check_name($Name) {
if (preg_match('/INCOMPLETE~\*/i', $Name)) {
forbidden_error($Name);
}
// Disallow the following characters, which are invalid in NTFS on Windows systems.
// : ? / < > \ * | "
$AllBlockedChars = ' : ? / < > \ * | " ';
// Only the following characters need to be escaped:
// \ - ^ ]
if (preg_match('/[\/\\:?<>*|"]*/', $Name, $Matches)) {
/*
* These characters are invalid in NTFS on Windows systems:
* : ? / < > \ * | "
*
* TODO: Add "/" to the blacklist. Adding "/" to the blacklist causes problems with nested dirs, apparently.
*
* Only the following characters need to be escaped (see the link below):
* \ - ^ ]
*
* http://www.php.net/manual/en/regexp.reference.character-classes.php
*/
$AllBlockedChars = ' : ? < > \ * | " ';
if (preg_match('/[\\:?<>*|"]/', $Name, $Matches)) {
character_error($Matches[0], $AllBlockedChars);
}
}
@ -66,5 +74,5 @@ function forbidden_error($Name) {
function character_error($Character, $AllBlockedChars) {
global $Err;
$Err = "One or more of the files in the torrent has a name that contains the forbidden character '$Character'. Please rename the files as necessary and recreate the torrent.\n\nNote: The complete list of characters that are disallowed are shown below:\n\n\t$AllBlockedChars";
$Err = "One or more of the files or folders in the torrent has a name that contains the forbidden character '$Character'. Please rename the files as necessary and recreate the torrent.<br /><br />\nNote: The complete list of characters that are disallowed are shown below:<br />\n\t\t$AllBlockedChars";
}

View File

@ -467,6 +467,18 @@ public static function search_array($Array, $Key, $Value) {
return $Results;
}
/**
* Search for $Needle in the string $Haystack which is a list of values separated by $Separator.
* @param string $Haystack
* @param string $Needle
* @param string $Separator
* @param boolean $Strict
* @return boolean
*/
public static function search_joined_string($Haystack, $Needle, $Separator = '|', $Strict = true) {
return (array_search($Needle, explode($Separator, $Haystack), $Strict) !== false);
}
/**
* Check for a : in the beginning of a torrent meta data string
* to see if it's stored in the old base64-encoded format

View File

@ -26,8 +26,7 @@ class TEXTAREA_PREVIEW_SUPER {
* This method should only run once with $all as true and should be placed
* in the header or footer.
*
* If $all is true, it includes TextareaPreview and jQuery with noConflict()
* for use with Sizzle.
* If $all is true, it includes TextareaPreview and jQuery
*
* jQuery is required for this to work, include it in the headers.
*
@ -56,7 +55,7 @@ public static function JavaScript ($all = true) {
* @static
* @return void
*/
private static function iterator () {
private static function iterator() {
$script = array();
for ($i = 0; $i < self::$Textareas; $i++) {
if (isset(self::$_ID[$i]) && is_string(self::$_ID[$i])) {
@ -148,7 +147,7 @@ class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER {
*
* It's important to have the right IDs as they make the JS function properly.
*/
public function __construct ($Name, $ID = '', $Value = '', $Cols = 50, $Rows = 10,
public function __construct($Name, $ID = '', $Value = '', $Cols = 50, $Rows = 10,
$Preview = true, $Buttons = true, $Buffer = false,
array $ExtraAttributes = array()
) {
@ -189,7 +188,7 @@ public function __construct ($Name, $ID = '', $Value = '', $Cols = 50, $Rows = 1
* Outputs the divs required for previewing the AJAX content
* Will only output once
*/
public function preview () {
public function preview() {
if (!$this->preview) {
View::parse('generic/textarea/preview.phtml', array('ID' => $this->id));
}
@ -200,14 +199,14 @@ public function preview () {
* Outputs the preview and edit buttons
* Can be called many times to place buttons in different areas
*/
public function buttons () {
public function buttons() {
View::parse('generic/textarea/buttons.phtml', array('ID' => $this->id));
}
/**
* Returns the textarea's numeric ID.
*/
public function getID () {
public function getID() {
return $this->id;
}
@ -215,7 +214,7 @@ public function getID () {
* Returns textarea string when buffer is enabled in the constructor
* @return string
*/
public function getBuffer () {
public function getBuffer() {
return $this->buffer;
}
}

View File

@ -47,6 +47,7 @@ function TORRENT_FORM($Torrent = false, $Error = false, $NewTorrent = true) {
function head() {
global $LoggedUser;
?>
<div class="thin">
<? if ($this->NewTorrent) { ?>
<p style="text-align: center;">
@ -55,7 +56,7 @@ function head() {
</p>
<? }
if ($this->Error) {
echo '<p style="color: red; text-align: center;">'.$this->Error.'</p>';
echo "\t".'<p style="color: red; text-align: center;">'.$this->Error."</p>\n";
}
?>
<form class="create_form" name="torrent" action="" enctype="multipart/form-data" method="post" id="upload_table" onsubmit="$('#post').raw().disabled = 'disabled'">

View File

@ -68,7 +68,7 @@
}
?>
<script src="<?=STATIC_SERVER?>functions/sizzle.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/jquery.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/script_start.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/script_start.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/ajax.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/ajax.class.js')?>" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
@ -86,12 +86,6 @@
?>
<script src="<?=STATIC_SERVER?>functions/<?=$Script?>.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/'.$Script.'.js')?>" type="text/javascript"></script>
<?
if ($Script == 'jquery') { ?>
<script type="text/javascript">
$.noConflict();
</script>
<?
}
}
if ($Mobile) { ?>
<script src="<?=STATIC_SERVER?>styles/mobile/style.js" type="text/javascript"></script>

View File

@ -17,7 +17,7 @@
<? } else { ?>
<link href="<?=STATIC_SERVER ?>styles/public/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/public/style.css')?>" rel="stylesheet" type="text/css" />
<? } ?>
<script src="<?=STATIC_SERVER?>functions/sizzle.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/jquery.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/script_start.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/script_start.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/ajax.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/ajax.class.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/cookie.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/cookie.class.js')?>" type="text/javascript"></script>

View File

@ -20,6 +20,6 @@
<input type="button" value="Preview" class="hidden button_preview_<?=$TextPrev->getID()?>" title="Preview text" />
<input type="submit" value="Send message" />
<input type="button" value="Hide" onclick="$('#compose').toggle();return false;" />
<input type="button" value="Hide" onclick="$('#compose').gtoggle();return false;" />
</form>
</div>

View File

@ -1,4 +1,4 @@
<script type="text/javascript" class="preview_code">
jQuery(document).ready(function () { TextareaPreview.factory([<?=$script?>]); });
$(document).ready(function () { TextareaPreview.factory([<?=$script?>]); });
</script>

View File

@ -40,10 +40,10 @@
$DB->query("INSERT INTO artists_similar_votes (SimilarID, UserID, way) VALUES ('$SimilarID', '$UserID', 'up')");
}
$Cache->delete('artist_'.$Artist1ID); // Delete artist cache
$Cache->delete('artist_'.$Artist2ID); // Delete artist cache
$Cache->delete('similar_positions_'.$Artist1ID); // Delete artist's similar map cache
$Cache->delete('similar_positions_'.$Artist2ID); // Delete artist's similar map cache
$Cache->delete_value('artist_'.$Artist1ID); // Delete artist cache
$Cache->delete_value('artist_'.$Artist2ID); // Delete artist cache
$Cache->delete_value('similar_positions_'.$Artist1ID); // Delete artist's similar map cache
$Cache->delete_value('similar_positions_'.$Artist2ID); // Delete artist's similar map cache
}

View File

@ -467,7 +467,7 @@ function compare($X, $Y) {
//----------------- End building list and getting stats
View::show_header($Name, 'browse,requests,bbcode,comments,voting,jquery,recommend');
View::show_header($Name, 'browse,requests,bbcode,comments,voting,recommend');
?>
<div class="thin">
<div class="header">
@ -855,7 +855,7 @@ function compare($X, $Y) {
<div id="flipper_head" class="head">
<a href="#">&uarr;</a>&nbsp;
<strong id="flipper_title">Similar artist map</strong>
<a id="flip_to" class="brackets" href="#null" onclick="flipView();">Switch to cloud</a>
<a id="flip_to" class="brackets" href="#" onclick="flipView(); return false;">Switch to cloud</a>
</div>
<div id="flip_view_1" style="display: block; width: <?=(WIDTH)?>px; height: <?=(HEIGHT)?>px; position: relative; background-image: url(static/similar/<?=($ArtistID)?>.png?t=<?=(time())?>);">
<?
@ -884,10 +884,8 @@ function flipView() {
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 () {
});
require("static/functions/tagcanvas.js", function () {
require("static/functions/artist_cloud.js", function () {
});
});
cloudLoaded = true;

View File

@ -145,11 +145,11 @@
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete('artist_comments_' . $ArtistID . '_catalogue_' . $i);
$Cache->delete_value('artist_comments_' . $ArtistID . '_catalogue_' . $i);
}
// Delete thread info cache (eg. number of pages)
$Cache->delete('artist_comments_' . $ArtistID);
$Cache->delete_value('artist_comments_' . $ArtistID);
break;

View File

@ -19,7 +19,7 @@
// Require the table class
// require_once SERVER_ROOT . '/classes/mass_user_torrents_table_view.class.php';
View::show_header('Organize Bookmarks', 'browse,jquery,jquery-ui,jquery.tablesorter,sort');
View::show_header('Organize Bookmarks', 'browse,jquery-ui,jquery.tablesorter,sort');
$EditType = isset($_GET['type']) ? $_GET['type'] : 'torrents';

View File

@ -46,7 +46,7 @@
list($Name) = $DB->next_record();
// Start printing
View::show_header('Comments for collage '.$Name, 'comments,bbcode,jquery');
View::show_header('Comments for collage '.$Name, 'comments,bbcode');
?>
<div class="thin">
<div class="header">

View File

@ -90,7 +90,7 @@
$CollagePages[] = $CollagePage;
}
View::show_header($Name,'browse,collage,bbcode,voting,jquery,recommend');
View::show_header($Name,'browse,collage,bbcode,voting,recommend');
?>
<div class="thin">

View File

@ -36,6 +36,6 @@
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete('collage_comments_'.$CollageID.'_catalogue_'.$i);
$Cache->delete_value('collage_comments_'.$CollageID.'_catalogue_'.$i);
}
?>

View File

@ -1,47 +1,40 @@
<?php
<?
$CollageID = $_GET['collageid'];
if (!is_number($CollageID)) {
error(0);
}
$CollageID = $_GET['collageid'];
if (!is_number($CollageID)) {
error(0);
}
$DB->query("SELECT Name, UserID, CategoryID FROM collages WHERE ID='$CollageID'");
list($Name, $UserID, $CategoryID) = $DB->next_record();
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
$DB->query("
SELECT
ct.GroupID,
um.ID,
um.Username,
ct.Sort,
tg.CatalogueNumber
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID
LEFT JOIN users_main AS um ON um.ID=ct.UserID
WHERE ct.CollageID='$CollageID'
ORDER BY ct.Sort");
$DB->query("SELECT Name, UserID, CategoryID FROM collages WHERE ID='$CollageID'");
list($Name, $UserID, $CategoryID) = $DB->next_record();
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
$DB->query("
SELECT
ct.GroupID,
um.ID,
um.Username,
ct.Sort,
tg.CatalogueNumber
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID
LEFT JOIN users_main AS um ON um.ID=ct.UserID
WHERE ct.CollageID='$CollageID'
ORDER BY ct.Sort");
$GroupIDs = $DB->collect('GroupID');
$GroupIDs = $DB->collect('GroupID');
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
}
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
}
View::show_header('Manage collage '.$Name);
View::show_header('Manage collage '.$Name, 'jquery-ui,jquery.tablesorter.min,sort');
?>
<script src="static/functions/jquery.js" type="text/javascript"></script>
<script type="text/javascript">$.noConflict();</script>
<script src="static/functions/jquery-ui.js" type="text/javascript"></script>
<script src="static/functions/jquery.tablesorter.min.js" type="text/javascript"></script>
<script src="static/functions/sort.js" type="text/javascript"></script>
<div class="thin">
<div class="header">
<h2>Manage collage <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a></h2>

View File

@ -29,15 +29,10 @@
$Artists = $DB->to_array('ArtistID', MYSQLI_ASSOC);
View::show_header('Manage collage '.$Name);
View::show_header('Manage collage '.$Name, 'jquery-ui,jquery.tablesorter.min,sort');
?>
<script src="static/functions/jquery.js" type="text/javascript"></script>
<script type="text/javascript">$.noConflict();</script>
<script src="static/functions/jquery-ui.js" type="text/javascript"></script>
<script src="static/functions/jquery.tablesorter.min.js" type="text/javascript"></script>
<script src="static/functions/sort.js" type="text/javascript"></script>
<div class="thin">
<div class="header">
<h2>Manage collage <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a></h2>

View File

@ -270,7 +270,7 @@
$CollagePages[] = $CollagePage;
}
View::show_header($Name,'browse,collage,bbcode,voting,jquery,recommend');
View::show_header($Name,'browse,collage,bbcode,voting,recommend');
?>
<div class="thin">
<div class="header">

View File

@ -122,7 +122,7 @@
$ThisCatalogue = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE);
$LastCatalogue = floor((POSTS_PER_PAGE * $Pages - POSTS_PER_PAGE) / THREAD_CATALOGUE);
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete('thread_'.$TopicID.'_catalogue_'.$i);
$Cache->delete_value('thread_'.$TopicID.'_catalogue_'.$i);
}
$Cache->begin_transaction('thread_'.$TopicID.'_info');
@ -133,5 +133,5 @@
$Cache->update_row($ForumID, $UpdateArrayForums);
$Cache->commit_transaction();
$Cache->delete('forums_'.$ForumID);
$Cache->delete_value('forums_'.$ForumID);
?>

View File

@ -101,7 +101,7 @@
LastPostTime='$NewLastAddedTime'
WHERE ID='$ForumID'");
$Cache->delete('thread_'.$TopicID);
$Cache->delete_value('thread_'.$TopicID);
$Cache->begin_transaction('forums_list');

View File

@ -22,7 +22,7 @@
if (!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) {
error(403);
}
View::show_header('Forums &gt; '.$Forum['Name'].' &gt; New Topic','comments,bbcode,jquery,jquery.validate,form_validate');
View::show_header('Forums &gt; '.$Forum['Name'].' &gt; New Topic','comments,bbcode,jquery.validate,form_validate');
?>
<div class="thin">
<h2><a href="forums.php">Forums</a> &gt; <a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$Forum['Name']?></a> &gt; <span id="newthreadtitle">New Topic</span></h2>

View File

@ -86,7 +86,7 @@
}
// Let's hope we got some results - start printing out the content.
View::show_header('Forums &gt; Search', 'bbcode,jquery,forum_search');
View::show_header('Forums &gt; Search', 'bbcode,forum_search');
?>
<div class="thin">
<div class="header">

View File

@ -38,7 +38,7 @@
$ThisCatalogue = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE);
$LastCatalogue = floor((POSTS_PER_PAGE * $Pages - POSTS_PER_PAGE) / THREAD_CATALOGUE);
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete('thread_'.$ThreadID.'_catalogue_'.$i);
$Cache->delete_value('thread_'.$ThreadID.'_catalogue_'.$i);
}
}

View File

@ -71,7 +71,7 @@
$Cache->begin_transaction('thread_' . $TopicID . '_catalogue_' . $CatalogueID);
if ($Cache->MemcacheDBArray[$Key]['ID'] != $PostID) {
$Cache->cancel_transaction();
$Cache->delete('thread_' . $TopicID . '_catalogue_' . $CatalogueID);
$Cache->delete_value('thread_' . $TopicID . '_catalogue_' . $CatalogueID);
//just clear the cache for would be cache-screwer-uppers
} else {
$Cache->update_row($Key, array(

View File

@ -90,7 +90,7 @@
$Cache->begin_transaction('thread_'.$TopicID.'_catalogue_'.$CatalogueID);
if ($Cache->MemcacheDBArray[$Key]['ID'] != $PostID) {
$Cache->cancel_transaction();
$Cache->delete('thread_'.$TopicID.'_catalogue_'.$CatalogueID); //just clear the cache for would be cache-screwer-uppers
$Cache->delete_value('thread_'.$TopicID.'_catalogue_'.$CatalogueID); //just clear the cache for would be cache-screwer-uppers
} else {
$Cache->update_row($Key, array(
'ID'=>$Cache->MemcacheDBArray[$Key]['ID'],

View File

@ -164,7 +164,7 @@
*/
// Start printing
View::show_header($ThreadInfo['Title'] . ' &lt; '.$Forums[$ForumID]['Name'].' &lt; Forums','comments,subscriptions,bbcode,jquery');
View::show_header($ThreadInfo['Title'] . ' &lt; '.$Forums[$ForumID]['Name'].' &lt; Forums','comments,subscriptions,bbcode');
?>
<div class="thin">
<h2>

View File

@ -24,7 +24,7 @@
if (!$Username) {
error(404);
}
View::show_header('Compose', 'inbox,bbcode,jquery,jquery.validate,form_validate');
View::show_header('Compose', 'inbox,bbcode,jquery.validate,form_validate');
?>
<div class="thin">
<div class="header">

View File

@ -66,7 +66,7 @@
$Cache->decrement('inbox_new_'.$UserID);
}
View::show_header('View conversation '.$Subject, 'comments,inbox,bbcode,jquery,jquery.validate,form_validate');
View::show_header('View conversation '.$Subject, 'comments,inbox,bbcode,jquery.validate,form_validate');
// Get messages
$DB->query("

View File

@ -29,7 +29,7 @@
$LoggedUser['LastReadNews'] = $News[0][0];
}
View::show_header('News','bbcode,jquery,news_ajax');
View::show_header('News','bbcode,news_ajax');
?>
<div class="thin">
<div class="sidebar">

View File

@ -1,8 +1,8 @@
<?
View::show_header('Recover Password','validate');
View::show_header('Recover Password');
echo $Validate->GenerateJS('recoverform');
?>
<script src="<?=(STATIC_SERVER)?>functions/jquery.js" type="text/javascript"></script>
<script src="<?=(STATIC_SERVER)?>functions/validate.js" type="text/javascript"></script>
<script src="<?=(STATIC_SERVER)?>functions/password_validate.js" type="text/javascript"></script>
<form class="auth_form" name="recovery" id="recoverform" method="post" action="" onsubmit="return formVal();">
<input type="hidden" name="key" value="<?=display_str($_REQUEST['key'])?>" />

View File

@ -1,8 +1,8 @@
<?
View::show_header('Register','validate');
View::show_header('Register');
echo $Val->GenerateJS('registerform');
?>
<script src="<?=STATIC_SERVER?>functions/jquery.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/validate.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/password_validate.js" type="text/javascript"></script>
<form class="create_form" name="user" id="registerform" method="post" action="" onsubmit="return formVal();">
<div style="width: 500px;">

View File

@ -113,7 +113,7 @@
break;
}
View::show_header('Report a '.$Type['title'],'bbcode,jquery,jquery.validate,form_validate');
View::show_header('Report a '.$Type['title'],'bbcode,jquery.validate,form_validate');
?>
<div class="thin">
<div class="header">

View File

@ -65,7 +65,7 @@
}
}
View::show_header('Report', 'reportsv2,jquery,browse,torrent,bbcode,recommend');
View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
?>
<div class="thin">

View File

@ -58,6 +58,11 @@
$TorrentID = $Escaped['torrentid'];
$RawName = $Escaped['raw_name'];
if (isset($Escaped['delete']) && $Cache->get_value('torrent_'.$TorrentID.'_lock')) {
echo 'You requested to delete the torrent '.$TorrentID.', but this is currently not possible because the upload process is still running. Please try again later.';
die();
}
if (($Escaped['resolve_type'] == "manual" || $Escaped['resolve_type'] == "dismiss" ) && $Report) {
if ($Escaped['comment']) {
$Comment = $Escaped['comment'];

View File

@ -210,11 +210,11 @@
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete('request_comments_'.$RequestID.'_catalogue_'.$i);
$Cache->delete_value('request_comments_'.$RequestID.'_catalogue_'.$i);
}
// Delete thread info cache (eg. number of pages)
$Cache->delete('request_comments_'.$GroupID);
$Cache->delete_value('request_comments_'.$GroupID);
break;
case 'warn' :
include(SERVER_ROOT.'/sections/requests/warn.php');

View File

@ -80,7 +80,7 @@
$UserCanEdit = (!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2);
$CanEdit = ($UserCanEdit || $ProjectCanEdit || check_perms('site_moderate_requests'));
View::show_header('View request: '.$FullName, 'comments,requests,bbcode,jquery');
View::show_header('View request: '.$FullName, 'comments,requests,bbcode');
?>
<div class="thin">

View File

@ -133,20 +133,14 @@
if ($Bitrate === 'Lossless' || $Bitrate === 'APS (VBR)' || $Bitrate === 'V2 (VBR)' || $Bitrate === 'V1 (VBR)' || $Bitrate === '256' || $Bitrate === 'APX (VBR)' || $Bitrate === 'V0 (VBR)' || $Bitrate === 'q8.x (VBR)' || $Bitrate === '320' || $Bitrate === '24bit Lossless') {
$Err = "$Bitrate is not an allowed bitrate for this request.";
}
} elseif ($BitrateList && $BitrateList != 'Any') {
if (strpos($BitrateList, $Bitrate) === false) {
$Err = "$Bitrate is not an allowed bitrate for this request.";
}
} elseif ($BitrateList && $BitrateList != 'Any' && !Misc::search_joined_string($BitrateList, $Bitrate)) {
$Err = "$Bitrate is not an allowed bitrate for this request.";
}
if ($FormatList && $FormatList != 'Any') {
if (strpos($FormatList, $Format) === false) {
$Err = "$Format is not an allowed format for this request.";
}
if ($FormatList && $FormatList != 'Any' && !Misc::search_joined_string($FormatList, $Format)) {
$Err = "$Format is not an allowed format for this request.";
}
if ($MediaList && $MediaList != 'Any') {
if (strpos($MediaList, $Media) === false) {
$Err = "$Media is not allowed media for this request.";
}
if ($MediaList && $MediaList != 'Any' && !Misc::search_joined_string($MediaList, $Media)) {
$Err = "$Media is not allowed media for this request.";
}
}

View File

@ -145,7 +145,7 @@
}
//$Bitrates[1] = FLAC
if (!empty($FormatArray) && in_array(1, $FormatArray)) {
if (!empty($FormatArray) && in_array(array_search('FLAC', $Formats), $FormatArray)) {
$NeedLog = empty($_POST['needlog']) ? false : true;
if ($NeedLog) {
if ($_POST['minlogscore']) {
@ -159,7 +159,7 @@
}
$NeedCue = empty($_POST['needcue']) ? false : true;
//FLAC was picked, require either Lossless or 24 bit Lossless
if (!$AllBitrates && !in_array(8, $BitrateArray) && !in_array(9, $BitrateArray)) {
if (!$AllBitrates && !in_array(array_search('Lossless', $Bitrates), $BitrateArray) && !in_array(array_search('24bit Lossless', $Bitrates), $BitrateArray)) {
$Err = 'You selected FLAC as a format but no possible bitrate to fill it (Lossless or 24bit Lossless)';
}

View File

@ -1,43 +1,7 @@
<?
//Include the header
View::show_header('Uploading Rules');
View::show_header('Uploading Rules', 'rules');
?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript">//<![CDATA[
$(document).ready(function() {
var original_value = $('#search_string').val();
$('#search_string').keyup(function() {
var query_string = $('#search_string').val();
var q = query_string.replace(/\s+/gm, '').split('+');
var regex = new Array();
for (var i = 0; i < q.length; i++) {
regex[i] = new RegExp(q[i], 'mi');
}
$('#actual_rules li').each(function() {
var show = true;
for (var i = 0; i < regex.length; i++) {
if (!regex[i].test($(this).html())) {
show = false;
break;
}
}
$(this).toggle(show);
});
$('.before_rules').toggle(query_string.length == 0);
});
$('#search_string').focus(function() {
if ($(this).val() == original_value) {
$(this).val('');
}
});
$('#search_string').blur(function() {
if ($(this).val() == '') {
$(this).val(original_value);
$('.before_rules').show();
}
})
});
//]]></script>
<!-- Uploading Rules -->
<div class="thin">
<div class="header">

View File

@ -1,6 +1,6 @@
<?
enforce_login();
View::show_header('Staff', 'jquery');
View::show_header('Staff');
include(SERVER_ROOT.'/sections/staff/functions.php');
@ -18,7 +18,7 @@
<h3>Contact Staff</h3>
<div id="below_box">
<p>If you are looking for help with a general question, we appreciate it if you would only message through the staff inbox, where we can all help you.</p>
<p>You can do that by <strong><a href="#" onclick="$('#compose').gtoggle();">sending a message to the Staff Inbox</a></strong>.</p>
<p>You can do that by <strong><a href="#" onclick="$('#compose').gtoggle(); return false;">sending a message to the Staff Inbox</a></strong>.</p>
</div>
<? View::parse('generic/reply/staffpm.php', array('Hidden' => true)); ?>
<br />

View File

@ -2,7 +2,7 @@
include(SERVER_ROOT.'/sections/staffpm/functions.php');
View::show_header('Staff PMs', 'staffpm,jquery');
View::show_header('Staff PMs', 'staffpm');
// Get messages
$StaffPMs = $DB->query("

View File

@ -20,7 +20,7 @@
$Cache->delete_value('staff_pm_new_'.$LoggedUser['ID']);
}
View::show_header('Staff PM', 'staffpm,bbcode,jquery');
View::show_header('Staff PM', 'staffpm,bbcode');
$UserInfo = Users::user_info($UserID);
$UserStr = Users::format_username($UserID, true, true, true, true);

View File

@ -62,7 +62,7 @@
}
}
$Cache->delete('forums_list'); // Clear cache
$Cache->delete_value('forums_list'); // Clear cache
// Go back
header('Location: tools.php?action=forum')

View File

@ -47,7 +47,7 @@
}
}
$Cache->delete('whitelisted_clients');
$Cache->delete_value('whitelisted_clients');
// Go back
header('Location: tools.php?action=whitelist')

View File

@ -9,7 +9,7 @@
<style>
html, body {
width: 1200px !important;
height: 1000px !important;
height: 800px !important;
overflow: hidden !important;
}
</style>

View File

@ -31,7 +31,7 @@ page.open('preview.html', function () {
}
page.viewportSize = {
width: 1200,
height: 1000
height: 800
};
// Save files to static
fs.changeWorkingDirectory(rootPath + '/' + staticPath + '/stylespreview');
@ -48,23 +48,11 @@ page.open('preview.html', function () {
console.log(JSON.stringify(returnStatus));
phantom.exit();
}
page.viewportSize = {
width: 600,
height: 500
};
page.zoomFactor = 0.5;
page.render('thumb_' + system.args[3] + '.png');
if (!fs.isFile('thumb_' + system.args[3] + '.png')) {
// Failed to store thumbnail image.
returnStatus.status = -6;
console.log(JSON.stringify(returnStatus));
phantom.exit();
}
// Remove temp files
fs.changeWorkingDirectory(rootPath + '/' + staticPath + 'styles/' + system.args[3] + '/');
if (!fs.isFile('preview.html') || !fs.isWritable('preview.html')) {
// Can't find temp file to remove. Are the paths correct?
returnStatus.status = -7;
returnStatus.status = -6;
console.log(JSON.stringify(returnStatus));
phantom.exit();
}

View File

@ -1,6 +1,11 @@
<?
View::show_header('Rerender stylesheet gallery images', 'jquery');
global $DB;
/*
* This page creates previews of all supported stylesheets
* SERVER_ROOT . '/' . STATIC_SERVER . 'stylespreview' must exist and be writable
* Dependencies are PhantomJS (http://phantomjs.org/) and
* ImageMagick (http://www.imagemagick.org/script/index.php)
*/
View::show_header('Rerender stylesheet gallery images');
$DB->query('
SELECT
ID,
@ -8,6 +13,7 @@
Name AS ProperName
FROM stylesheets');
$Styles = $DB->to_array('ID', MYSQLI_BOTH);
$ImagePath = SERVER_ROOT . '/' . STATIC_SERVER . 'stylespreview';
?>
<div class="thin">
<h2>Rerender stylesheet gallery images</h2>
@ -20,7 +26,6 @@
<li>Whoami: <? echo(shell_exec('whoami')); ?></li>
<li>Path: <? echo dirname(__FILE__); ?></li>
<li>Phantomjs ver: <? echo (shell_exec('/usr/bin/phantomjs -v;')); ?></li>
<li>Styles: <? var_dump($Styles) ?></li>
</ul>
</div>
</div>
@ -36,77 +41,79 @@
<div class="head">Rendering status</div>
<div class="pad">
<?
//set_time_limit(0);
foreach ($Styles as $Style) {
?>
//set_time_limit(0);
foreach ($Styles as $Style) {
?>
<div class="box">
<h6><?= $Style['Name'] ?></h6>
<p>Build preview:
<?
$BuildResult = json_decode(shell_exec('/usr/bin/phantomjs ' . dirname(__FILE__) . '/render_build_preview.js ' . SERVER_ROOT . ' ' . STATIC_SERVER . ' ' . $Style['Name'] . ' ' . dirname(__FILE__) . ';'), true);
switch ($BuildResult["status"]) {
case 0:
echo "Success.";
break;
case -1:
echo "Err -1: Incorrect paths, are they passed correctly?";
break;
case -2:
echo "Err -2: Rendering base doesn't exist, who broke things?";
break;
case -3:
echo "Err -3: Don't have disk write access.";
break;
case -4:
echo "Err -4: Failed to store specific preview file.";
break;
default:
echo "Err: Unknown error returned";
} ?>
$CmdLine = '/usr/bin/phantomjs "' . dirname(__FILE__) . '/render_build_preview.js" "' . SERVER_ROOT . '" "' . STATIC_SERVER . '" "' . $Style['Name'] . '" "' . dirname(__FILE__) . '"';
$BuildResult = json_decode(shell_exec(escapeshellcmd($CmdLine)), true);
switch ($BuildResult['status']) {
case 0:
echo 'Success.';
break;
case -1:
echo 'Err -1: Incorrect paths, are they passed correctly?';
break;
case -2:
echo 'Err -2: Rendering base does not exist. Who broke things?';
break;
case -3:
echo 'Err -3: No permission to write to preview folder.';
break;
case -4:
echo 'Err -4: Failed to store specific preview file.';
break;
default:
echo 'Err: Unknown error returned';
}
?>
</p>
<?
//If build was successful, snap a preview.
if ($BuildResult["status"] == 0) { ?>
//If build was successful, snap a preview.
if ($BuildResult['status'] === 0) {
?>
<p>Snap preview:
<?
$SnapResult = json_decode(shell_exec('/usr/bin/phantomjs ' . dirname(__FILE__) . '/render_snap_preview.js ' . SERVER_ROOT . ' ' . STATIC_SERVER . ' ' . $Style['Name'] . ' ' . dirname(__FILE__) . ';'), true);
switch ($SnapResult["status"]) {
case 0:
echo 'Success.';
break;
case -1:
echo 'Err -1: Incorrect paths. Are they passed correctly? Do all folders exist?';
break;
case -2:
echo 'Err -2: Preview file does not exist; running things in the wrong order perhaps?';
break;
case -3:
echo 'Err -3: Preview is empty; did it get created properly?';
break;
case -4:
echo 'Err -4: Do not have disk write access.';
break;
case -5:
echo 'Err -5: Failed to store full image.';
break;
case -6:
echo 'Err -6: Failed to store thumbnail image.';
break;
case -7:
echo 'Err -7: Cannot find temp file to remove; are the paths correct?';
break;
default:
echo 'Err: Unknown error returned.';
}
?>
</p>
<?
$CmdLine = '/usr/bin/phantomjs "' . dirname(__FILE__) . '/render_snap_preview.js" "' . SERVER_ROOT . '" "' . STATIC_SERVER . '" "' . $Style['Name'] . '" "' . dirname(__FILE__) . '"';
$SnapResult = json_decode(shell_exec(escapeshellcmd($CmdLine)), true);
switch ($SnapResult['status']) {
case 0:
echo 'Success.';
$CmdLine = '/usr/bin/convert "' . $ImagePath . '/full_' . $Style['Name'] . '.png" -filter Box -resize 40% -quality 94 "' . $ImagePath . '/thumb_' . $Style['Name'] . '.png"';
$ResizeResult = shell_exec(escapeshellcmd($CmdLine));
if ($ResizeResult !== null) {
echo ' But failed to resize image';
}
?>
break;
case -1:
echo 'Err -1: Incorrect paths. Are they passed correctly? Do all folders exist?';
break;
case -2:
echo 'Err -2: Preview file does not exist; running things in the wrong order perhaps?';
break;
case -3:
echo 'Err -3: Preview is empty; did it get created properly?';
break;
case -4:
echo 'Err -4: No permission to write to preview folder.';
break;
case -5:
echo 'Err -5: Failed to store full image.';
break;
case -6:
echo 'Err -6: Cannot find temp file to remove; are the paths correct?';
break;
default:
echo 'Err: Unknown error returned.';
}
?>
</p>
<? } ?>
</div>
<?
};
?>
<? } ?>
</div>
</div>
</div>

View File

@ -19,6 +19,10 @@
error('Torrent already deleted.');
}
if ($Cache->get_value('torrent_'.$TorrentID.'_lock')) {
error('Torrent cannot be deleted because the upload process is not completed yet. Please try again later.');
}
list($UserID, $Time, $Snatches) = $DB->next_record();

View File

@ -96,7 +96,7 @@ function compare($X, $Y) {
// Start output
View::show_header($Title,'jquery,browse,comments,torrent,bbcode,recommend,cover_art');
View::show_header($Title,'browse,comments,torrent,bbcode,recommend,cover_art');
?>
<div class="thin">
<div class="header">

View File

@ -336,11 +336,11 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete('torrent_comments_'.$GroupID.'_catalogue_'.$i);
$Cache->delete_value('torrent_comments_'.$GroupID.'_catalogue_'.$i);
}
// Delete thread info cache (eg. number of pages)
$Cache->delete('torrent_comments_'.$GroupID);
$Cache->delete_value('torrent_comments_'.$GroupID);
break;
case 'regen_filelist' :

View File

@ -6,6 +6,10 @@
error(404);
}
if ($Cache->get_value('torrent_'.$TorrentID.'_lock')) {
error('Torrent cannot be deleted because the upload process is not completed yet. Please try again later.');
}
$DB->query("SELECT
t.UserID,
t.GroupID,

View File

@ -10,7 +10,7 @@
//**********************************************************************//
ini_set('max_file_uploads','100');
View::show_header('Upload','upload,jquery,validate_upload,valid_tags,musicbrainz,multiformat_uploader');
View::show_header('Upload','upload,validate_upload,valid_tags,musicbrainz,multiformat_uploader');
if (empty($Properties) && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
$DB->query('
@ -124,10 +124,11 @@
list($Name, $Comment, $Updated) = $BadUpload;
?>
<tr>
<td><?=$Text->full_format($Name)?>
<td>
<?=$Text->full_format($Name) . "\n" ?>
<? if ($TimeDiff < strtotime($Updated)) { ?>
<strong class="important_text">(New!)</strong>
<? } ?>
<strong class="important_text">(New!)</strong>
<? } ?>
</td>
<td><?=$Text->full_format($Comment)?></td>
</tr>

View File

@ -6,7 +6,10 @@
// the data to the database and the torrent to the disk. //
//******************************************************************************//
ini_set('upload_max_filesize', 2097152);
// Maximum allowed size for uploaded files.
// http://php.net/upload-max-filesize
ini_set('upload_max_filesize', 2097152); // 2 Mibibytes
ini_set('max_file_uploads', 100);
define(MAX_FILENAME_LENGTH, 180);
include(SERVER_ROOT.'/classes/validate.class.php');
@ -389,6 +392,7 @@
$TmpFileList = array();
$TooLongPaths = array();
$DirName = (isset($Tor->Dec['info']['files']) ? Format::make_utf8($Tor->get_name()) : '');
check_name($DirName); // check the folder name against the blacklist
foreach ($FileList as $File) {
list($Size, $Name) = $File;
// add +log to encoding
@ -664,6 +668,10 @@
Tracker::update_tracker('add_torrent', array('id' => $TorrentID, 'info_hash' => rawurlencode($InfoHash), 'freetorrent' => $T['FreeLeech']));
$Debug->set_flag('upload: ocelot updated');
// Prevent deletion of this torrent until the rest of the upload process is done
// (expire the key after 10 minutes to prevent locking it for too long in case there's a fatal error below)
$Cache->cache_value('torrent_'.$TorrentID.'_lock', true, 600);
//******************************************************************************//
//--------------- Write torrent file -------------------------------------------//
@ -1032,4 +1040,7 @@
}
// Clear Cache
$Cache->delete('torrents_details_'.$GroupID);
$Cache->delete_value('torrents_details_'.$GroupID);
// Allow deletion of this torrent now
$Cache->delete_value('torrent_'.$TorrentID.'_lock');

View File

@ -58,7 +58,7 @@ function checked($Checked) {
$SiteOptions = array();
}
View::show_header($Username.' &gt; Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings,cssgallery,preview_paranoia,bbcode');
View::show_header($Username.' &gt; Settings','user,jquery-ui,release_sort,password_validate,validate,push_settings,cssgallery,preview_paranoia,bbcode');

View File

@ -2,7 +2,7 @@
if (!check_perms('site_torrents_notify')) {
error(403);
}
View::show_header('Manage notifications', 'jquery,jquery.validate,form_validate');
View::show_header('Manage notifications', 'jquery.validate,form_validate');
?>
<div class="thin">
<div class="header">

View File

@ -174,7 +174,7 @@ function check_paranoia_here($Setting) {
$Badges .= (($Warned != '0000-00-00 00:00:00') ? '<img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" />' : '');
$Badges .= (($Enabled == '1' || $Enabled == '0' || !$Enabled) ? '' : '<img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" />');
View::show_header($Username, 'user,bbcode,requests,jquery,lastfm');
View::show_header($Username, 'user,bbcode,requests,lastfm');
?>
<div class="thin">

View File

@ -1,5 +1,5 @@
<?
View::show_header('Create an article', 'jquery');
View::show_header('Create an article');
?>
<div class="thin">
<div class="box pad">

View File

@ -10,7 +10,7 @@
error('You do not have access to edit this article.');
}
View::show_header('Edit '.$Title, 'jquery');
View::show_header('Edit '.$Title);
?>
<div class="thin">
<div class="box pad">

View File

@ -119,8 +119,8 @@ function Bookmark(type, id, newName) {
if (window.location.pathname.indexOf('top10.php') != -1 || window.location.search.indexOf('?action=notify') != -1) {
var oldName = $('#bookmarklink_' + type + '_' + id).raw().innerHTML;
ajax.get("bookmarks.php?action=add&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
var bookmarklinks = $('#bookmarklink_' + type + '_' + id).objects;
for (var i = 0; i < bookmarklinks.length; i++) {
var bookmarklinks = $('#bookmarklink_' + type + '_' + id);
for (var i = 0; i < bookmarklinks.results(); i++) {
$(bookmarklinks[i].parentNode.parentNode.parentNode).add_class('bookmarked');
bookmarklinks[i].onclick = function() { Unbookmark(type, id, oldName); return false; };
bookmarklinks[i].innerHTML = newName;
@ -148,8 +148,8 @@ function Unbookmark(type, id, newName) {
} else if (window.location.pathname.indexOf('top10.php') != -1 || window.location.search.indexOf('?action=notify') != -1) {
var oldName = $('#bookmarklink_' + type + '_' + id).raw().innerHTML;
ajax.get("bookmarks.php?action=remove&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
var bookmarklinks = $('#bookmarklink_' + type + '_' + id).objects;
for (var i = 0; i < bookmarklinks.length; i++) {
var bookmarklinks = $('#bookmarklink_' + type + '_' + id);
for (var i = 0; i < bookmarklinks.results(); i++) {
$(bookmarklinks[i].parentNode.parentNode.parentNode).remove_class('bookmarked');
bookmarklinks[i].onclick = function() { Bookmark(type, id, oldName); return false; };
bookmarklinks[i].innerHTML = newName;

View File

@ -1,4 +1,4 @@
(function($) {
(function() {
var LIMIT = 10;
var artistId, artistName;
@ -101,4 +101,4 @@ function createCloud() {
}
}
} ) ( jQuery );
})();

View File

@ -1,457 +0,0 @@
var dragObjects = null;
var dragObjectPlaceholder = null;
function editOrdering() {
$('#editlayout').ghide();
$('#releasetypes').ghide();
$('#linkbox').ghide();
$('.sidebar').ghide();
$('.main_column > .box').ghide(); // Artist info
$('.main_column > #requests').ghide();
$('#savelayout').gshow();
$('#emptylinkbox').gshow();
$('#torrents_allopenclose').gshow();
dragObjects = new Array();
var elems = $('#torrents_tables table').objects;
for (i in elems) {
var elemID = elems[i].id;
if (elemID == undefined) {
continue;
}
if (elemID.indexOf('torrents_') == 0) {
$('#' + elemID).gshow();
dragObjects[elemID] = new dragObject(elemID, elemID+'_handle', startDrag, moveDrag, endDrag);
var classes = elems[i].className.split(' ');
for (var j = 0; classes.length; j++) {
if (classes[j].indexOf('releases_') == 0) {
$('.'+classes[j].replace('_table', '')).ghide();
$('.artist_editcol').gshow();
$('.artist_normalcol').ghide();
break;
}
}
}
}
for (i in dragObjects) {
dragObjects[i].StartListening();
}
}
function saveOrdering() {
$('#savelayout').ghide();
$('#savinglayout').gshow();
var elems = $('#torrents_tables table').objects;
var releaseTypes = "{";
for (i in elems) {
var elemID = elems[i].id;
var releaseType = null;
if (elemID == undefined) {
continue;
}
if (elemID.indexOf('torrents_') == 0) {
var classes = elems[i].className.split(' ');
for(var j=0; classes.length; j++) {
if (classes[j] == null) {
break;
}
if (classes[j].indexOf('releases_') == 0) {
releaseType = classes[j].split('_')[1];
}
}
}
if (releaseType != null) {
releaseTypes += '"' + releaseType + '":' + ($('#releases_' + releaseType + '_defaultopen').raw().checked ? 1 : 0) + ",";
}
}
releaseTypes = releaseTypes.substring(0, releaseTypes.length-1) + '}';
var postData = new Array();
postData['layoutdefaults'] = releaseTypes;
ajax.post("artist.php?action=ajax_edit_artistlayout", postData, saveOrderingCallback);
}
function saveOrderingCallback(response) {
//Let's do what the user asked for, shall we.
//Show/hide
var releaseTypes = json.decode(response);
for(releaseType in releaseTypes) {
if (releaseTypes[releaseType] == 1) {
setShow(releaseType, true);
} else {
setShow(releaseType, false);
}
}
//Ordering in linkbox
var prevOrderedLink = null;
for (releaseType in releaseTypes) {
var elem = $('#torrents_' + releaseType + '_anchorlink').raw();
if (elem == undefined) {
continue;
}
if (prevOrderedLink == null) {
prevOrderedLink = elem;
} else {
prevOrderedLink.parentNode.insertBefore(elem, prevOrderedLink.nextSibling);
prevOrderedLink = elem;
}
}
//Now let's return to the non editing layout.
var elems = $('#torrents_tables table').objects;
for (i in elems) {
var elemID = elems[i].id;
if (elemID == undefined) {
continue;
}
if (elemID.indexOf('torrents_') == 0) {
var classes = elems[i].className.split(' ');
var empty = false;
for (var j = 0; classes.length; j++) {
if (classes[j] == null) {
break;
}
if (classes[j].indexOf('releases_') == 0) {
$('.artist_editcol').ghide();
$('.artist_normalcol').gshow();
}
if (classes[j].indexOf('empty') == 0) {
empty = true;
}
}
if (empty) {
$('#' + elemID).ghide();
}
}
}
for (i in dragObjects) {
dragObjects[i].StopListening();
}
dragObjects = null;
$('#savinglayout').ghide();
$('#emptylinkbox').ghide();
$('#torrents_allopenclose').ghide();
$('#editlayout').gshow();
$('#releasetypes').gshow();
$('#linkbox').gshow();
$('.sidebar').gshow();
$('.main_column > .box').gshow(); // Artist info
$('.main_column > #requests').gshow();
}
function setDefaultShow(id, show) {
if (id == 'all') {
var elems = $('#torrents_tables table').objects;
for (i in elems) {
var elemID = elems[i].id;
var releaseType = null;
if (elemID == undefined) {
continue;
}
if (elemID.indexOf('torrents_') == 0) {
var classes = elems[i].className.split(' ');
for (var j = 0; classes.length; j++) {
if (classes[j] == null) {
break;
}
if (classes[j].indexOf('releases_') == 0) {
releaseType = classes[j].split('_')[1];
}
}
}
setDefaultShow(releaseType, show);
}
} else if (show) {
$('#releases_'+id+'_openlink').ghide();
$('#releases_'+id+'_closedlink').gshow();
$('#releases_'+id+'_defaultopen').raw().checked = 'checked';
} else {
$('#releases_'+id+'_openlink').gshow();
$('#releases_'+id+'_closedlink').ghide();
$('#releases_'+id+'_defaultopen').raw().checked = '';
}
}
function setShow(id, show) {
if (show) {
$('#releases_'+id+'_viewlink').ghide();
$('#releases_'+id+'_hidelink').gshow();
$('.releases_'+id).gshow();
} else {
$('#releases_'+id+'_viewlink').gshow();
$('#releases_'+id+'_hidelink').ghide();
$('.releases_'+id).ghide();
}
}
function startDrag(element) {
element.style.top = element.offsetTop + 'px';
element.style.left = element.offsetLeft + 'px';
element.style.height = element.offsetHeight + 'px';
element.style.width = element.offsetWidth + 'px';
element.style.position = 'absolute';
element.style.zIndex = '100';
$('body').objects[0].style.cursor = 'move';
dragObjectPlaceholder = document.createElement('TABLE');
dragObjectPlaceholder.style.backgroundColor = '#DDDDDD';
dragObjectPlaceholder.style.height = element.style.height;
dragObjectPlaceholder.style.width = element.style.width;
element.parentNode.insertBefore(dragObjectPlaceholder, element);
}
function moveDrag(element) {
if (
(element.offsetTop > (dragObjectPlaceholder.offsetTop + parseInt(dragObjectPlaceholder.style.height))) ||
((element.offsetTop + parseInt(dragObjectPlaceholder.style.height)) < dragObjectPlaceholder.offsetTop)
) {
var bestItem = 'END';
elems = element.parentNode.childNodes;
for (var i = 0; i < elems.length; i++) {
elem = elems[i];
if (elem == element || elem.nodeName != 'TABLE') {
continue;
}
if ((element.offsetTop > dragObjectPlaceholder.offsetTop) && (elem.offsetTop - element.offsetTop) > parseInt(element.style.height)) {
bestItem = elem;
break;
} else if ((element.offsetTop < dragObjectPlaceholder.offsetTop) && (elem.offsetTop + parseInt(element.style.height)) > element.offsetTop) {
bestItem = elem;
break;
}
}
if (bestItem == dragObjectPlaceholder) {
return;
}
if (bestItem != 'END') {
element.parentNode.insertBefore(dragObjectPlaceholder, element.parentNode.childNodes[i]);
} else {
element.parentNode.appendChild(dragObjectPlaceholder);
}
}
}
function endDrag(element) {
$('body').objects[0].style.cursor = '';
element.style.top = '';
element.style.left = '';
element.style.zIndex = '';
element.style.position = '';
element.parentNode.replaceChild(element, dragObjectPlaceholder);
dragObjectPlaceholder = null;
}
//Slightly modified from: http://www.switchonthecode.com/tutorials/javascript-draggable-elements
function addEvent(element, eventName, callback) {
if (element.addEventListener) {
element.addEventListener(eventName, callback, false);
} else if (element.attachEvent) {
element.attachEvent("on" + eventName, callback);
}
}
function removeEvent(element, eventName, callback) {
if (element.removeEventListener) {
element.removeEventListener(eventName, callback, false);
} else if (element.detachEvent) {
element.detachEvent("on" + eventName, callback);
}
}
function cancelEvent(e) {
e = e ? e : window.event;
if (e.stopPropagation) {
e.stopPropagation();
}
if (e.preventDefault) {
e.preventDefault();
}
e.cancelBubble = true;
e.cancel = true;
e.returnValue = false;
return false;
}
function Position(x, y) {
this.X = x;
this.Y = y;
this.Add = function(val) {
var newPos = new Position(this.X, this.Y);
if (val != null) {
if (!isNaN(val.X)) {
newPos.X += val.X;
}
if (!isNaN(val.Y)) {
newPos.Y += val.Y;
}
}
return newPos;
}
this.Subtract = function(val) {
var newPos = new Position(this.X, this.Y);
if (val != null) {
if (!isNaN(val.X)) {
newPos.X -= val.X;
}
if (!isNaN(val.Y)) {
newPos.Y -= val.Y;
}
}
return newPos;
}
this.Check = function() {
var newPos = new Position(this.X, this.Y);
if (isNaN(newPos.X)) {
newPos.X = 0;
}
if (isNaN(newPos.Y)) {
newPos.Y = 0;
}
return newPos;
}
this.Apply = function(element, horizontal, vertical) {
if (!isNaN(this.X) && horizontal) {
element.style.left = this.X + 'px';
}
if (!isNaN(this.Y) && vertical) {
element.style.top = this.Y + 'px';
}
}
}
function absoluteCursorPostion(eventObj) {
eventObj = eventObj ? eventObj : window.event;
if (isNaN(window.scrollX)) {
return new Position(eventObj.clientX + document.documentElement.scrollLeft + document.body.scrollLeft, eventObj.clientY + document.documentElement.scrollTop + document.body.scrollTop);
} else {
return new Position(eventObj.clientX + window.scrollX, eventObj.clientY + window.scrollY);
}
}
function dragObject(element, handlerElement, startCallback, moveCallback, endCallback) {
if (typeof(element) == "string") {
element = $('#' + element).raw();
}
if (element == null) {
return;
}
if (typeof(handlerElement) == "string") {
handlerElement = $('#' + handlerElement).raw();
}
if (handlerElement == null) {
handlerElement = element;
}
var cursorStartPos = null;
var elementStartPos = null;
var dragging = false;
var listening = false;
var disposed = false;
function dragStart(eventObj) {
if (dragging || !listening || disposed) {
return;
}
dragging = true;
cursorStartPos = absoluteCursorPostion(eventObj);
elementStartPos = new Position(parseInt(element.offsetLeft), parseInt(element.offsetTop));
elementStartPos = elementStartPos.Check();
if (startCallback != null) {
startCallback(element);
}
addEvent(document, "mousemove", dragGo);
addEvent(document, "mouseup", dragStopHook);
return cancelEvent(eventObj);
}
function dragGo(eventObj) {
if (!dragging || disposed) {
return;
}
var newPos = absoluteCursorPostion(eventObj);
newPos = newPos.Add(elementStartPos).Subtract(cursorStartPos);
newPos.Apply(element, false, true);
if (moveCallback != null) {
moveCallback(element);
}
return cancelEvent(eventObj);
}
function dragStop() {
if (!dragging || disposed) {
return;
}
removeEvent(document, "mousemove", dragGo);
removeEvent(document, "mouseup", dragStopHook);
cursorStartPos = null;
elementStartPos = null;
if (endCallback != null) {
endCallback(element);
}
dragging = false;
}
function dragStopHook(eventObj) {
dragStop();
return cancelEvent(eventObj);
}
this.Dispose = function() {
if (disposed) {
return;
}
this.StopListening(true);
element = null;
handlerElement = null
startCallback = null;
moveCallback = null
endCallback = null;
disposed = true;
}
this.StartListening = function() {
if (listening || disposed) {
return;
}
listening = true;
addEvent(handlerElement, "mousedown", dragStart);
}
this.StopListening = function(stopCurrentDragging) {
if (!listening || disposed) {
return;
}
removeEvent(handlerElement, "mousedown", dragStart);
listening = false;
if (stopCurrentDragging && dragging) {
dragStop();
}
}
}

View File

@ -1,13 +1,13 @@
function show_peers (TorrentID, Page) {
if (Page > 0) {
ajax.get('torrents.php?action=peerlist&page='+Page+'&torrentid=' + TorrentID,function(response) {
$('#peers_' + TorrentID).gshow().raw().innerHTML=response;
ajax.get('torrents.php?action=peerlist&page=' + Page + '&torrentid=' + TorrentID, function(response) {
$('#peers_' + TorrentID).gshow().raw().innerHTML = response;
});
} else {
if ($('#peers_' + TorrentID).raw().innerHTML === '') {
$('#peers_' + TorrentID).gshow().raw().innerHTML = '<h4>Loading...</h4>';
ajax.get('torrents.php?action=peerlist&torrentid=' + TorrentID,function(response) {
$('#peers_' + TorrentID).gshow().raw().innerHTML=response;
ajax.get('torrents.php?action=peerlist&torrentid=' + TorrentID, function(response) {
$('#peers_' + TorrentID).gshow().raw().innerHTML = response;
});
} else {
$('#peers_' + TorrentID).gtoggle();
@ -21,14 +21,14 @@ function show_peers (TorrentID, Page) {
function show_snatches (TorrentID, Page) {
if (Page > 0) {
ajax.get('torrents.php?action=snatchlist&page='+Page+'&torrentid=' + TorrentID,function(response) {
$('#snatches_' + TorrentID).gshow().raw().innerHTML=response;
ajax.get('torrents.php?action=snatchlist&page=' + Page + '&torrentid=' + TorrentID, function(response) {
$('#snatches_' + TorrentID).gshow().raw().innerHTML = response;
});
} else {
if ($('#snatches_' + TorrentID).raw().innerHTML === '') {
$('#snatches_' + TorrentID).gshow().raw().innerHTML = '<h4>Loading...</h4>';
ajax.get('torrents.php?action=snatchlist&torrentid=' + TorrentID,function(response) {
$('#snatches_' + TorrentID).gshow().raw().innerHTML=response;
ajax.get('torrents.php?action=snatchlist&torrentid=' + TorrentID, function(response) {
$('#snatches_' + TorrentID).gshow().raw().innerHTML = response;
});
} else {
$('#snatches_' + TorrentID).gtoggle();
@ -42,14 +42,14 @@ function show_snatches (TorrentID, Page) {
function show_downloads (TorrentID, Page) {
if (Page > 0) {
ajax.get('torrents.php?action=downloadlist&page='+Page+'&torrentid=' + TorrentID,function(response) {
$('#downloads_' + TorrentID).gshow().raw().innerHTML=response;
ajax.get('torrents.php?action=downloadlist&page=' + Page + '&torrentid=' + TorrentID, function(response) {
$('#downloads_' + TorrentID).gshow().raw().innerHTML = response;
});
} else {
if ($('#downloads_' + TorrentID).raw().innerHTML === '') {
$('#downloads_' + TorrentID).gshow().raw().innerHTML = '<h4>Loading...</h4>';
ajax.get('torrents.php?action=downloadlist&torrentid=' + TorrentID,function(response) {
$('#downloads_' + TorrentID).raw().innerHTML=response;
ajax.get('torrents.php?action=downloadlist&torrentid=' + TorrentID, function(response) {
$('#downloads_' + TorrentID).raw().innerHTML = response;
});
} else {
$('#downloads_' + TorrentID).gtoggle();
@ -101,7 +101,7 @@ function toggle_group(groupid, link, event) {
if (row.has_class('colhead')) {
continue;
}
var relevantRow = row.has_class('group') ? $(group_rows[i+1]) : row;
var relevantRow = row.has_class('group') ? $(group_rows[i + 1]) : row;
if (allGroups || relevantRow.has_class('groupid_' + groupid)) {
row = $(group_rows[i]); // idk why we need this :S
if (row.has_class('group')) {
@ -169,7 +169,8 @@ function toggleTorrentSearch(mode) {
var link = $('#ft_toggle').raw();
$('#ft_container').gtoggle();
link.innerHTML = link.textContent == 'Hide' ? 'Show' : 'Hide';
} if (mode == 'basic') {
}
if (mode == 'basic') {
$('.fti_advanced').disable();
$('.fti_basic').enable();
$('.ftr_advanced').ghide(true);
@ -246,7 +247,7 @@ function addCoverField() {
x.appendChild(summary);
coverFieldCount++;
if(!hasCoverAddButton) {
if (!hasCoverAddButton) {
x = $('#add_covers_form').raw();
field = document.createElement("input");
field.type = "submit";
@ -263,8 +264,8 @@ function ToggleEditionRows() {
}
function check_private(TorrentID) {
$('#checkprivate-'+TorrentID).raw().innerHTML = "Checking...";
$('#checkprivate-' + TorrentID).raw().innerHTML = "Checking...";
ajax.get('ajax.php?action=checkprivate&torrentid=' + TorrentID,function(response) {
$('#checkprivate-'+TorrentID).raw().innerHTML = response;
$('#checkprivate-' + TorrentID).raw().innerHTML = response;
});
}

View File

@ -62,11 +62,7 @@ var collageShow = {
}
}
lists = $('.collage_images').objects;
i = lists.length;
while (i--) {
$(lists[i]).ghide();
}
$('.collage_images').ghide();
$(ul).gshow();
if (s) {

View File

@ -37,7 +37,7 @@ function Quote(post, user, link) {
function Edit_Form(post,key) {
postid = post;
//If no edit is already going underway or a previous edit was finished, make the necessary dom changes.
if (!$('#editbox' + postid).objects[0] || $('#editbox' + postid + '.hidden').objects[0]) {
if (!$('#editbox' + postid).results() || $('#editbox' + postid + '.hidden').results()) {
$('#reply_box').ghide();
if (location.href.match(/torrents\.php/) ||
location.href.match(/artist\.php/)) {
@ -45,12 +45,7 @@ function Edit_Form(post,key) {
} else {
boxWidth = "80";
}
postuserid = $('#post' + postid + ' strong a').raw().getAttribute('href').split('=')[1]
/* jQuery isnt enabled on comments, artist comments, or basically anywhere but thread.php
Re-enable this clause as soon as hateradio's "bye sizzle" changes go into effect, changing
the jQuery object to $ (which will, then, be jQuery rather than sizzle)
postuserid = jQuery('#post' + postid + ' strong a').attr('href').split('=')[1];
*/
postuserid = $('#post' + postid + ' strong a').attr('href').split('=')[1];
if (postuserid != userid) {
pmbox = '<span id="pmbox' + postid + '"><label>PM user on edit? <input type="checkbox" name="pm" value="1" /></label></span>';
} else {
@ -315,7 +310,7 @@ StoreText.prototype = {
sessionStorage.setItem(this.key, this.field.value);
},
autosave : function () {
jQuery(this.field).on(this.getInputEvent(), jQuery.proxy(this.save, this));
$(this.field).on(this.getInputEvent(), $.proxy(this.save, this));
},
getInputEvent : function () {
var e;
@ -329,6 +324,6 @@ StoreText.prototype = {
return e;
},
clearForm : function () {
jQuery(this.form).submit(jQuery.proxy(this.remove, this));
$(this.form).submit($.proxy(this.remove, this));
}
};

View File

@ -1,4 +1,4 @@
(function ($) {
(function () {
var show_all = false;
var current;
$(document).ready(function() {
@ -45,7 +45,7 @@
$(this).text("Show all");
$("#covers div").each(function() {
if ($(this).attr("class") != "head") {
if($(this).attr("id") != current) {
if ($(this).attr("id") != current) {
$(this).hide();
}
$(".next_cover").show();
@ -57,4 +57,4 @@
});
});
}(jQuery));
})();

View File

@ -1,54 +1,51 @@
(function($) {
$(document).ready(function () {
// If the custom stylesheet field is empty, select the current style from the previews
if (!$('input#styleurl').val()){
var radiobutton = $('input[name="stylesheet_gallery"][value="' + $('select#stylesheet').val() + '"]');
radiobutton.click();
$('.preview_wrapper').removeClass('selected');
radiobutton.parent().parent().addClass('selected');
$(document).ready(function () {
// If the custom stylesheet field is empty, select the current style from the previews
if (!$('input#styleurl').val()){
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 drop-down 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_image').click();
})
// If the drop-down is changed, select the appropriate item in gallery, clear the custom CSS field
$('select#stylesheet').change(function() {
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
$('input#styleurl').keydown(function() {
$('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 drop-down
$('input#styleurl').keyup(function() {
if (!$(this).val()){
$('select#stylesheet').change();
}
// If an overlay is clicked, select the right item in the drop-down 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_image').click();
})
// If the drop-down is changed, select the appropriate item in gallery, clear the custom CSS field
$('select#stylesheet').change(function() {
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
$('input#styleurl').keydown(function() {
$('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 drop-down
$('input#styleurl').keyup(function() {
if (!$(this).val()){
$('select#stylesheet').change();
}
})
// Allow the CSS gallery to be expanded/contracted
$('#toggle_css_gallery').click(function (e) {
e.preventDefault();
$('#css_gallery').slideToggle(function () {
$('#toggle_css_gallery').text($(this).is(':visible') ? 'Hide gallery' : 'Show gallery');
});
})
// Allow the CSS gallery to be expanded/contracted
$('#toggle_css_gallery').click(function (e) {
e.preventDefault();
$('#css_gallery').slideToggle(function () {
$('#toggle_css_gallery').text($(this).is(':visible') ? 'Hide gallery' : 'Show gallery');
});
});
})(jQuery);
});

View File

@ -1,37 +1,35 @@
(function ($) {
$(document).ready(function() {
var parts = window.location.pathname.split('/');
var page = parts[parts.length - 1].split(".")[0];
var splitted = window.location.search.substr(1).split("&");
var query = {};
for (var i = 0; i < splitted.length; i++) {
var q = splitted[i].split("=");
query[q[0]] = q[1];
};
$(document).ready(function() {
var parts = window.location.pathname.split('/');
var page = parts[parts.length - 1].split(".")[0];
var splitted = window.location.search.substr(1).split("&");
var query = {};
for (var i = 0; i < splitted.length; i++) {
var q = splitted[i].split("=");
query[q[0]] = q[1];
};
switch(page) {
case "forums":
if(query['action'] == "new") {
$("#newthreadform").validate();
}
break;
case "reports":
if(query['action'] == "report") {
$("#report_form").validate();
}
break;
case "inbox":
if(query['action'] == "viewconv" || query['action'] == "compose") {
$("#messageform").validate();
}
break;
case "user":
if(query['action'] == "notify") {
$("#filter_form").validate();
}
break;
default:
break;
}
});
} (jQuery));
switch (page) {
case "forums":
if (query['action'] == "new") {
$("#newthreadform").validate();
}
break;
case "reports":
if (query['action'] == "report") {
$("#report_form").validate();
}
break;
case "inbox":
if (query['action'] == "viewconv" || query['action'] == "compose") {
$("#messageform").validate();
}
break;
case "user":
if (query['action'] == "notify") {
$("#filter_form").validate();
}
break;
default:
break;
}
});

View File

@ -1,11 +1,9 @@
(function ($) {
$(document).ready(function() {
$(".forum_category").click(function(e) {
var id = this.id;
var isChecked = $(this).text() != "Check all";
isChecked ? $(this).text("Check all") : $(this).text("Uncheck all");
$("input[data-category='" + id + "']").attr("checked", !isChecked);
e.preventDefault();
});
$(document).ready(function() {
$(".forum_category").click(function(e) {
var id = this.id;
var isChecked = $(this).text() != "Check all";
isChecked ? $(this).text("Check all") : $(this).text("Uncheck all");
$("input[data-category='" + id + "']").attr("checked", !isChecked);
e.preventDefault();
});
}(jQuery));
});

View File

@ -1,5 +1,4 @@
(function ($) {
(function() {
var username;
// How many entries to show per category before expanding
var initialCount = 3;
@ -14,7 +13,7 @@
var flag = 0;
$(document).ready(function () {
// Avoid conflicting with other jQuery instances (userscripts et al).
$.noConflict();
// $.noConflict(); // Why is this needed?
// Fetch the username (appended from php) to base all get requests on.
username = $('#lastfm_username').text();
var div = $('#lastfm_stats');
@ -356,4 +355,4 @@
});
}
})(jQuery);
})();

View File

@ -1,4 +1,4 @@
(function ($) {
(function() {
var count = 1;
var MAX_EXTRAS = 5;
var FORMATS = [ 'MP3', 'FLAC', 'AAC', 'AC3', 'DTS' ];
@ -114,4 +114,4 @@
}
})(jQuery);
})();

View File

@ -8,7 +8,7 @@
*/
(function($) {
(function() {
//global variables
var $year_release_group;
var $release_type;
@ -426,4 +426,4 @@ function loadCSS() {
$link = null;
}
} ) ( jQuery );
})();

View File

@ -4,11 +4,7 @@ function news_ajax(event, count, offset, privileged) {
* count - Number of news items to fetch.
* offset - Database offset for fetching news.
* privilege - Gotta check your privilege (used to show/hide [Edit] on news).
*
* This function isn't wrapped in jQuery, be sure we use it
* instead of the mix-mashed Gazelle $ function.
*/
var $ = jQuery.noConflict();
// Unbind onclick to avoid spamclicks.
$(event.target).attr('onclick', 'return false;');
// Fetch news data, check for errors etc.

View File

@ -7,10 +7,10 @@ function clearItem(torrentId) {
function clearSelected(filterId) {
var checkBoxes, checkedBoxes = [];
if (filterId) {
var filterForm = $('#notificationform_'+filterId).raw();
checkBoxes = $('.notify_box_'+filterId, filterForm).objects;
var filterForm = $('#notificationform_'+filterId);
checkBoxes = $('.notify_box_'+filterId, filterForm);
} else {
checkBoxes = $('.notify_box').objects;
checkBoxes = $('.notify_box');
}
for (var i = checkBoxes.length - 1; i >= 0; i--) {
if (checkBoxes[i].checked) {
@ -25,10 +25,10 @@ function clearSelected(filterId) {
}
function toggleBoxes(filterId, value) {
var filterForm = $('#notificationform_'+filterId).raw();
var checkBoxes = $('.notify_box_'+filterId, filterForm).objects;
var filterForm = $('#notificationform_'+filterId);
var checkBoxes = $('.notify_box_'+filterId, filterForm);
for (var i = checkBoxes.length - 1; i >= 0; i--) {
checkBoxes[i].checked = value;
$(checkBoxes[i]).prop('checked', value);
}
}

View File

@ -3,7 +3,7 @@
* Validates passwords to make sure they are powerful
**/
(function($) {
(function() {
var CLEAR = 0;
var WEAK = 1;
var STRONG = 3;
@ -192,5 +192,5 @@ function isUserPage() {
return window.location.pathname.indexOf(USER_PATH) != -1;
}
} ) ( jQuery );
})();

View File

@ -1,4 +1,4 @@
(function($){
(function() {
// Used to get user ID from URL.
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
@ -41,4 +41,4 @@
window.open('user.php?id=' + encodeURIComponent(userId) + '&preview=1&paranoia=' + encodeURIComponent(paranoiaString), '_blank');
});
});
})(jQuery);
})();

View File

@ -1,4 +1,4 @@
(function ($) {
(function() {
var PUSHOVER = 5;
var TOASTY = 4;
$(document).ready(function() {
@ -21,4 +21,4 @@
}
});
});
}(jQuery));
})();

View File

@ -1,4 +1,4 @@
(function($) {
(function() {
var sent = new Array();
var loaded = false;
var type;
@ -69,4 +69,4 @@
});
}
}
}(jQuery));
})();

View File

@ -1,6 +1,6 @@
//Couldn't use an associative array because JavaScript sorting is stupid http://dev-answers.blogspot.com/2012/03/javascript-object-keys-being-sorted-in.html
jQuery(document).ready(function ($) {
$(document).ready(function() {
var serialize = function () {
var a = [];
$('#sortable input').each(function () {

35
static/functions/rules.js Normal file
View File

@ -0,0 +1,35 @@
function findRule() {
var query_string = $('#search_string').val();
var q = query_string.replace(/\s+/gm, '').split('+');
var regex = new Array();
for (var i = 0; i < q.length; i++) {
regex[i] = new RegExp(q[i], 'mi');
}
$('#actual_rules li').each(function() {
var show = true;
for (var i = 0; i < regex.length; i++) {
if (!regex[i].test($(this).html())) {
show = false;
break;
}
}
$(this).toggle(show);
});
$('.before_rules').toggle(query_string.length == 0);
}
$(document).ready(function() {
var original_value = $('#search_string').val();
$('#search_string').keyup(findRule);
$('#search_string').focus(function() {
if ($(this).val() == original_value) {
$(this).val('');
}
});
$('#search_string').blur(function() {
if ($(this).val() == '') {
$(this).val(original_value);
$('.before_rules').show();
}
})
});

View File

@ -25,7 +25,40 @@ var listener = {
// http://www.thefutureoftheweb.com/blog/adddomloadevent
// retrieved 2010-08-12
var addDOMLoadEvent=(function(){var e=[],t,s,n,i,o,d=document,w=window,r='readyState',c='onreadystatechange',x=function(){n=1;clearInterval(t);while(i=e.shift())i();if(s)s[c]=''};return function(f){if(n)return f();if(!e[0]){d.addEventListener&&d.addEventListener("DOMContentLoaded",x,false);/*@cc_on@*//*@if(@_win32)d.write("<script id=__ie_onload defer src=//0><\/scr"+"ipt>");s=d.getElementById("__ie_onload");s[c]=function(){s[r]=="complete"&&x()};/*@end@*/if(/WebKit/i.test(navigator.userAgent))t=setInterval(function(){/loaded|complete/.test(d[r])&&x()},10);o=w.onload;w.onload=function(){x();o&&o()}}e.push(f)}})();
var addDOMLoadEvent = (
function() {
var e = [], t, s, n, i, o, d = document, w = window, r = 'readyState', c = 'onreadystatechange',
x = function() {
n = 1;
clearInterval(t);
while (i = e.shift()) {
i();
}
if (s) {
s[c] = ''
}
};
return function(f) {
if (n) {
return f();
}
if (!e[0]) {
d.addEventListener && d.addEventListener("DOMContentLoaded", x, false);
/*@cc_on@*//*@if(@_win32)d.write("<script id=__ie_onload defer src=//0><\/scr"+"ipt>");s=d.getElementById("__ie_onload");s[c]=function(){s[r]=="complete"&&x()};/*@end@*/
if (/WebKit/i.test(navigator.userAgent))
t = setInterval(function() {
/loaded|complete/.test(d[r]) && x()
}, 10);
o = w.onload;
w.onload = function() {
x();
o && o()
}
}
e.push(f)
}
}
)();
//PHP ports
function isset(variable) {
@ -56,7 +89,7 @@ function get_size(size) {
size = size / 1024;
}
var ext;
switch(steps) {
switch (steps) {
case 1: ext = ' B';
break;
case 1: ext = ' KB';
@ -111,7 +144,7 @@ function ratio(dividend, divisor, color) {
if (color) {
var col = get_ratio_color(rat);
if (col) {
rat = '<span class="'+col+'">'+rat+'</span>';
rat = '<span class="' + col + '">' + rat + '</span>';
}
}
return rat;
@ -161,43 +194,19 @@ var util = function (selector, context) {
return new util.fn.init(selector, context);
}
util.fn = util.prototype = {
objects: new Array(),
init: function (selector, context) {
if (typeof(selector) == 'object') {
this.objects[0] = selector;
} else {
this.objects = Sizzle(selector, context);
}
return this;
},
jQuery.extend(jQuery.prototype, {
results: function () {
return this.objects.length;
},
show: function () {
return this.remove_class('hidden');
return this.size();
},
gshow: function () {
return this.remove_class('hidden');
},
hide: function (force) {
return this.add_class('hidden', force);
},
ghide: function (force) {
return this.add_class('hidden', force);
},
toggle: function (force) {
//Should we interate and invert all entries, or just go by the first?
if (!in_array('hidden', this.objects[0].className.split(' '))) {
this.add_class('hidden', force);
} else {
this.remove_class('hidden');
}
return this;
},
gtoggle: function (force) {
//Should we interate and invert all entries, or just go by the first?
if (!in_array('hidden', this.objects[0].className.split(' '))) {
if (!in_array('hidden', this[0].className.split(' '))) {
this.add_class('hidden', force);
} else {
this.remove_class('hidden');
@ -205,8 +214,8 @@ util.fn = util.prototype = {
return this;
},
listen: function (event, callback) {
for (var i = 0, il = this.objects.length; i < il; i++) {
var object = this.objects[i];
for (var i=0,il=this.size();i<il;i++) {
var object = this[i];
if (document.addEventListener) {
object.addEventListener(event, callback, false);
} else {
@ -215,27 +224,9 @@ util.fn = util.prototype = {
}
return this;
},
unbind: function (event, callback) {
for (var i = 0, il = this.objects.length; i < il; i++) {
var object = this.objects[i];
if (document.addEventListener) {
object.removeEventListener(event, callback, false);
} else {
object.detachEvent('on' + event, callback);
}
}
return this;
},
remove: function () {
for (var i = 0, il = this.objects.length; i < il; i++) {
var object = this.objects[i];
object.parentNode.removeChild(object);
}
return this;
},
add_class: function (class_name, force) {
for (var i = 0, il = this.objects.length; i < il; i++) {
var object = this.objects[i];
for (var i=0,il=this.size();i<il;i++) {
var object = this[i];
if (object.className === '') {
object.className = class_name;
} else if (force || !in_array(class_name, object.className.split(' '))) {
@ -245,8 +236,8 @@ util.fn = util.prototype = {
return this;
},
remove_class: function (class_name) {
for (var i = 0, il = this.objects.length; i < il; i++) {
var object = this.objects[i];
for (var i=0,il=this.size();i<il;i++) {
var object = this[i];
var classes = object.className.split(' ');
var result = array_search(class_name, classes);
if (result !== false) {
@ -257,8 +248,8 @@ util.fn = util.prototype = {
return this;
},
has_class: function(class_name) {
for (var i = 0, il = this.objects.length; i < il; i++) {
var object = this.objects[i];
for (var i=0,il=this.size();i<il;i++) {
var object = this[i];
var classes = object.className.split(' ');
if (array_search(class_name, classes)) {
return true;
@ -267,8 +258,8 @@ util.fn = util.prototype = {
return false;
},
toggle_class: function(class_name) {
for (var i = 0, il = this.objects.length; i < il; i++) {
var object = this.objects[i];
for (var i=0,il=this.size();i<il;i++) {
var object = this[i];
var classes = object.className.split(' ');
var result = array_search(class_name, classes);
if (result !== false) {
@ -285,33 +276,27 @@ util.fn = util.prototype = {
return this;
},
disable : function () {
for (var i = 0, il = this.objects.length; i < il; i++) {
this.objects[i].disabled = true;
for (var i=0,il=this.size();i<il;i++) {
this[i].disabled = true;
}
return this;
},
enable : function () {
for (var i = 0, il = this.objects.length; i < il; i++) {
if (this.objects[i].disabled == true) {
this.objects[i].disabled = false;
for (var i=0,il=this.size();i<il;i++) {
if (this[i].disabled == true) {
this[i].disabled = false;
}
}
return this;
},
html : function (html) {
for (var i = 0, il = this.objects.length; i < il; i++) {
this.objects[i].innerHTML = html;
}
return this;
},
raw: function (number) {
if (number === undefined) {
number = 0;
}
return this.objects[number];
return this[number];
},
nextElementSibling: function () {
var here = this.objects[0];
var here = this[0];
if (here.nextElementSibling) {
return $(here.nextElementSibling);
}
@ -321,7 +306,7 @@ util.fn = util.prototype = {
return $(here);
},
previousElementSibling: function () {
var here = this.objects[0];
var here = this[0];
if (here.previousElementSibling) {
return $(here.previousElementSibling);
}
@ -330,7 +315,4 @@ util.fn = util.prototype = {
} while (here.nodeType != 1);
return $(here);
}
}
util.fn.init.prototype = util.fn;
var $ = util;
});

View File

@ -1,5 +1,5 @@
var sortableTable;
jQuery(document).ready(function ($) {
$(document).ready(function () {
$.tablesorter.addParser({
id: 'relative_time',
@ -111,4 +111,4 @@ jQuery(document).ready(function ($) {
}
};
sortableTable.init();
});
});

View File

@ -1,5 +1,5 @@
var TextareaPreview;
jQuery(document).ready(function ($) {
$(document).ready(function () {
'use strict';
TextareaPreview = function (id, textarea_id) {
if (!isNaN(+id)) {

View File

@ -2,7 +2,7 @@ function Categories() {
ajax.get('ajax.php?action=upload_section&categoryid=' + $('#categories').raw().value, function (response) {
$('#dynamic_form').raw().innerHTML = response;
// Evaluate the code that generates previews.
eval(jQuery('#dynamic_form script.preview_code').html());
eval($('#dynamic_form script.preview_code').html());
});
}

View File

@ -157,7 +157,7 @@ function ToggleIdenticons() {
}
function userform_submit() {
if (jQuery('#resetpasskey').is(':checked')) {
if ($('#resetpasskey').is(':checked')) {
if (!confirm('Are you sure you want to reset your passkey?')) {
return false;
}

View File

@ -1,4 +1,4 @@
(function ($) {
(function () {
$(document).ready(function () {
// Upload button is clicked
$("#post").click(function(e) {
@ -25,4 +25,4 @@
}
}
});
})(jQuery);
})();