mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-07 06:50:10 +00:00
Empty commit
This commit is contained in:
parent
b8d11cc6b0
commit
2ce7e0cae9
@ -50,7 +50,11 @@
|
|||||||
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false);
|
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false);
|
||||||
|
|
||||||
if ($Page == 1) {
|
if ($Page == 1) {
|
||||||
$DB->query("SELECT COUNT(ID) FROM forums_topics WHERE ForumID='$ForumID' AND IsSticky='1'");
|
$DB->query("
|
||||||
|
SELECT COUNT(ID)
|
||||||
|
FROM forums_topics
|
||||||
|
WHERE ForumID='$ForumID'
|
||||||
|
AND IsSticky='1'");
|
||||||
list($Stickies) = $DB->next_record();
|
list($Stickies) = $DB->next_record();
|
||||||
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
|
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
|
||||||
}
|
}
|
||||||
@ -123,7 +127,11 @@
|
|||||||
<?
|
<?
|
||||||
/*
|
/*
|
||||||
if (check_perms('users_mod')) {
|
if (check_perms('users_mod')) {
|
||||||
$DB->query("SELECT ForumID from subscribed_forums WHERE ForumID='$ForumID' AND SubscriberID='$LoggedUser[ID]'");
|
$DB->query("
|
||||||
|
SELECT ForumID
|
||||||
|
FROM subscribed_forums
|
||||||
|
WHERE ForumID='$ForumID'
|
||||||
|
AND SubscriberID='$LoggedUser[ID]'");
|
||||||
if ($DB->record_count() == 0) { ?>
|
if ($DB->record_count() == 0) { ?>
|
||||||
<a href="forums.php?action=forum_subscribe&perform=add&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Subscribe to forum</a>
|
<a href="forums.php?action=forum_subscribe&perform=add&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Subscribe to forum</a>
|
||||||
<? } else { ?>
|
<? } else { ?>
|
||||||
@ -199,7 +207,7 @@
|
|||||||
$Row = 'a';
|
$Row = 'a';
|
||||||
foreach ($Forum as $Topic) {
|
foreach ($Forum as $Topic) {
|
||||||
list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
|
list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
|
||||||
$Row = ($Row == 'a') ? 'b' : 'a';
|
$Row = (($Row == 'a') ? 'b' : 'a');
|
||||||
// Build list of page links
|
// Build list of page links
|
||||||
// Only do this if there is more than one page
|
// Only do this if there is more than one page
|
||||||
$PageLinks = array();
|
$PageLinks = array();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
set_time_limit(50000);
|
set_time_limit(50000);
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
gc_enable();
|
gc_enable();
|
||||||
@ -9,8 +9,17 @@
|
|||||||
die("schedule.php is already running. Exiting ($PCount)\n");
|
die("schedule.php is already running. Exiting ($PCount)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: make it awesome, make it flexible!
|
/*TODO: make it awesome, make it flexible!
|
||||||
//INSERT INTO users_geodistribution (Code, Users) SELECT g.Code, COUNT(u.ID) AS Users FROM geoip_country AS g JOIN users_main AS u ON INET_ATON(u.IP) BETWEEN g.StartIP AND g.EndIP WHERE u.Enabled='1' GROUP BY g.Code ORDER BY Users DESC
|
INSERT INTO users_geodistribution
|
||||||
|
(Code, Users)
|
||||||
|
SELECT g.Code, COUNT(u.ID) AS Users
|
||||||
|
FROM geoip_country AS g
|
||||||
|
JOIN users_main AS u ON INET_ATON(u.IP) BETWEEN g.StartIP AND g.EndIP
|
||||||
|
WHERE u.Enabled='1'
|
||||||
|
GROUP BY g.Code
|
||||||
|
ORDER BY Users DESC
|
||||||
|
*/
|
||||||
|
|
||||||
/*************************************************************************\
|
/*************************************************************************\
|
||||||
//--------------Schedule page -------------------------------------------//
|
//--------------Schedule page -------------------------------------------//
|
||||||
|
|
||||||
@ -75,7 +84,8 @@ function next_hour() {
|
|||||||
/*
|
/*
|
||||||
$TimeMinus = time_minus(3600 * 7);
|
$TimeMinus = time_minus(3600 * 7);
|
||||||
|
|
||||||
$DB->query("SELECT DISTINCT GroupID
|
$DB->query("
|
||||||
|
SELECT DISTINCT GroupID
|
||||||
FROM torrents
|
FROM torrents
|
||||||
WHERE FreeTorrent='1'
|
WHERE FreeTorrent='1'
|
||||||
AND FreeLeechType='3'
|
AND FreeLeechType='3'
|
||||||
@ -84,7 +94,8 @@ function next_hour() {
|
|||||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||||
$Cache->delete_value('torrent_group_'.$GroupID);
|
$Cache->delete_value('torrent_group_'.$GroupID);
|
||||||
}
|
}
|
||||||
$DB->query("UPDATE torrents
|
$DB->query("
|
||||||
|
UPDATE torrents
|
||||||
SET FreeTorrent='0',
|
SET FreeTorrent='0',
|
||||||
FreeLeechType='0',
|
FreeLeechType='0',
|
||||||
flags='2'
|
flags='2'
|
||||||
@ -98,19 +109,28 @@ function next_hour() {
|
|||||||
|
|
||||||
//------------- Expire old FL Tokens and clear cache where needed ------//
|
//------------- Expire old FL Tokens and clear cache where needed ------//
|
||||||
$sqltime = sqltime();
|
$sqltime = sqltime();
|
||||||
$DB->query("SELECT DISTINCT UserID from users_freeleeches WHERE Expired = FALSE AND Time < '$sqltime' - INTERVAL 4 DAY");
|
$DB->query("
|
||||||
|
SELECT DISTINCT UserID
|
||||||
|
FROM users_freeleeches
|
||||||
|
WHERE Expired = FALSE
|
||||||
|
AND Time < '$sqltime' - INTERVAL 4 DAY");
|
||||||
while (list($UserID) = $DB->next_record()) {
|
while (list($UserID) = $DB->next_record()) {
|
||||||
$Cache->delete_value('users_tokens_'.$UserID[0]);
|
$Cache->delete_value('users_tokens_'.$UserID[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT uf.UserID, t.info_hash
|
$DB->query("
|
||||||
|
SELECT uf.UserID, t.info_hash
|
||||||
FROM users_freeleeches AS uf
|
FROM users_freeleeches AS uf
|
||||||
JOIN torrents AS t ON uf.TorrentID = t.ID
|
JOIN torrents AS t ON uf.TorrentID = t.ID
|
||||||
WHERE uf.Expired = FALSE AND uf.Time < '$sqltime' - INTERVAL 4 DAY");
|
WHERE uf.Expired = FALSE
|
||||||
|
AND uf.Time < '$sqltime' - INTERVAL 4 DAY");
|
||||||
while (list($UserID, $InfoHash) = $DB->next_record(MYSQLI_NUM, false)) {
|
while (list($UserID, $InfoHash) = $DB->next_record(MYSQLI_NUM, false)) {
|
||||||
Tracker::update_tracker('remove_token', array('info_hash' => rawurlencode($InfoHash), 'userid' => $UserID));
|
Tracker::update_tracker('remove_token', array('info_hash' => rawurlencode($InfoHash), 'userid' => $UserID));
|
||||||
}
|
}
|
||||||
$DB->query("UPDATE users_freeleeches SET Expired = True WHERE Time < '$sqltime' - INTERVAL 4 DAY");
|
$DB->query("
|
||||||
|
UPDATE users_freeleeches
|
||||||
|
SET Expired = True
|
||||||
|
WHERE Time < '$sqltime' - INTERVAL 4 DAY");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -136,7 +156,8 @@ function next_hour() {
|
|||||||
$Cache->cache_value('stats_snatches', $SnatchStats, 0);
|
$Cache->cache_value('stats_snatches', $SnatchStats, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type,
|
$DB->query("
|
||||||
|
SELECT IF(remaining=0,'Seeding','Leeching') AS Type,
|
||||||
COUNT(uid)
|
COUNT(uid)
|
||||||
FROM xbt_files_users
|
FROM xbt_files_users
|
||||||
WHERE active=1
|
WHERE active=1
|
||||||
@ -160,7 +181,8 @@ function next_hour() {
|
|||||||
//------------- Record who's seeding how much, used for ratio watch
|
//------------- Record who's seeding how much, used for ratio watch
|
||||||
|
|
||||||
$DB->query("TRUNCATE TABLE users_torrent_history_temp");
|
$DB->query("TRUNCATE TABLE users_torrent_history_temp");
|
||||||
$DB->query("INSERT INTO users_torrent_history_temp
|
$DB->query("
|
||||||
|
INSERT INTO users_torrent_history_temp
|
||||||
(UserID, NumTorrents)
|
(UserID, NumTorrents)
|
||||||
SELECT uid,
|
SELECT uid,
|
||||||
COUNT(DISTINCT fid)
|
COUNT(DISTINCT fid)
|
||||||
@ -168,13 +190,15 @@ function next_hour() {
|
|||||||
WHERE mtime>unix_timestamp(now()-interval 1 hour)
|
WHERE mtime>unix_timestamp(now()-interval 1 hour)
|
||||||
AND Remaining=0
|
AND Remaining=0
|
||||||
GROUP BY uid;");
|
GROUP BY uid;");
|
||||||
$DB->query("UPDATE users_torrent_history AS h
|
$DB->query("
|
||||||
|
UPDATE users_torrent_history AS h
|
||||||
JOIN users_torrent_history_temp AS t ON t.UserID=h.UserID AND t.NumTorrents=h.NumTorrents
|
JOIN users_torrent_history_temp AS t ON t.UserID=h.UserID AND t.NumTorrents=h.NumTorrents
|
||||||
SET h.Finished='0',
|
SET h.Finished='0',
|
||||||
h.LastTime=unix_timestamp(now())
|
h.LastTime=unix_timestamp(now())
|
||||||
WHERE h.Finished='1'
|
WHERE h.Finished='1'
|
||||||
AND h.Date=UTC_DATE()+0;");
|
AND h.Date=UTC_DATE()+0;");
|
||||||
$DB->query("INSERT INTO users_torrent_history
|
$DB->query("
|
||||||
|
INSERT INTO users_torrent_history
|
||||||
(UserID, NumTorrents, Date)
|
(UserID, NumTorrents, Date)
|
||||||
SELECT UserID, NumTorrents, UTC_DATE()+0
|
SELECT UserID, NumTorrents, UTC_DATE()+0
|
||||||
FROM users_torrent_history_temp
|
FROM users_torrent_history_temp
|
||||||
@ -189,8 +213,38 @@ function next_hour() {
|
|||||||
$Criteria[] = array('From'=>MEMBER, 'To'=>POWER, 'MinUpload'=>25 * 1024 * 1024 * 1024, 'MinRatio'=>1.05, 'MinUploads'=>5, 'MaxTime'=>time_minus(3600 * 24 * 7 * 2));
|
$Criteria[] = array('From'=>MEMBER, 'To'=>POWER, 'MinUpload'=>25 * 1024 * 1024 * 1024, 'MinRatio'=>1.05, 'MinUploads'=>5, 'MaxTime'=>time_minus(3600 * 24 * 7 * 2));
|
||||||
$Criteria[] = array('From'=>POWER, 'To'=>ELITE, 'MinUpload'=>100 * 1024 * 1024 * 1024, 'MinRatio'=>1.05, 'MinUploads'=>50, 'MaxTime'=>time_minus(3600 * 24 * 7 * 4));
|
$Criteria[] = array('From'=>POWER, 'To'=>ELITE, 'MinUpload'=>100 * 1024 * 1024 * 1024, 'MinRatio'=>1.05, 'MinUploads'=>50, 'MaxTime'=>time_minus(3600 * 24 * 7 * 4));
|
||||||
$Criteria[] = array('From'=>ELITE, 'To'=>TORRENT_MASTER, 'MinUpload'=>500 * 1024 * 1024 * 1024, 'MinRatio'=>1.05, 'MinUploads'=>500, 'MaxTime'=>time_minus(3600 * 24 * 7 * 8));
|
$Criteria[] = array('From'=>ELITE, 'To'=>TORRENT_MASTER, 'MinUpload'=>500 * 1024 * 1024 * 1024, 'MinRatio'=>1.05, 'MinUploads'=>500, 'MaxTime'=>time_minus(3600 * 24 * 7 * 8));
|
||||||
$Criteria[]=array('From'=>TORRENT_MASTER, 'To'=>POWER_TM, 'MinUpload'=>500*1024*1024*1024, 'MinRatio'=>1.05, 'MinUploads'=>500, 'MaxTime'=>time_minus(3600*24*7*8), 'Extra'=>'(SELECT COUNT(DISTINCT GroupID) FROM torrents WHERE UserID=users_main.ID) >= 500');
|
$Criteria[] = array(
|
||||||
$Criteria[]=array('From'=>POWER_TM, 'To'=>ELITE_TM, 'MinUpload'=>500*1024*1024*1024, 'MinRatio'=>1.05, 'MinUploads'=>500, 'MaxTime'=>time_minus(3600*24*7*8), 'Extra'=>"(SELECT COUNT(ID) FROM torrents WHERE ((LogScore = 100 AND Format = 'FLAC') OR (Media = 'Vinyl' AND Format = 'FLAC') OR (Media = 'WEB' AND Format = 'FLAC') OR (Media = 'DVD' AND Format = 'FLAC') OR (Media = 'Soundboard' AND Format = 'FLAC') OR (Media = 'Cassette' AND Format = 'FLAC') OR (Media = 'SACD' AND Format = 'FLAC') OR (Media = 'Blu-ray' AND Format = 'FLAC') OR (Media = 'DAT' AND Format = 'FLAC')) AND UserID = users_main.ID) >= 500");
|
'From'=>TORRENT_MASTER,
|
||||||
|
'To'=>POWER_TM,
|
||||||
|
'MinUpload'=>500 * 1024 * 1024 * 1024,
|
||||||
|
'MinRatio'=>1.05,
|
||||||
|
'MinUploads'=>500,
|
||||||
|
'MaxTime'=>time_minus(3600 * 24 * 7 * 8),
|
||||||
|
'Extra'=>'( SELECT COUNT(DISTINCT GroupID)
|
||||||
|
FROM torrents
|
||||||
|
WHERE UserID=users_main.ID
|
||||||
|
) >= 500');
|
||||||
|
$Criteria[] = array(
|
||||||
|
'From'=>POWER_TM,
|
||||||
|
'To'=>ELITE_TM,
|
||||||
|
'MinUpload'=>500 * 1024 * 1024 * 1024,
|
||||||
|
'MinRatio'=>1.05,
|
||||||
|
'MinUploads'=>500,
|
||||||
|
'MaxTime'=>time_minus(3600 * 24 * 7 * 8),
|
||||||
|
'Extra'=>"( SELECT COUNT(ID)
|
||||||
|
FROM torrents
|
||||||
|
WHERE ((LogScore = 100 AND Format = 'FLAC')
|
||||||
|
OR (Media = 'Vinyl' AND Format = 'FLAC')
|
||||||
|
OR (Media = 'WEB' AND Format = 'FLAC')
|
||||||
|
OR (Media = 'DVD' AND Format = 'FLAC')
|
||||||
|
OR (Media = 'Soundboard' AND Format = 'FLAC')
|
||||||
|
OR (Media = 'Cassette' AND Format = 'FLAC')
|
||||||
|
OR (Media = 'SACD' AND Format = 'FLAC')
|
||||||
|
OR (Media = 'Blu-ray' AND Format = 'FLAC')
|
||||||
|
OR (Media = 'DAT' AND Format = 'FLAC')
|
||||||
|
)
|
||||||
|
AND UserID = users_main.ID
|
||||||
|
) >= 500");
|
||||||
|
|
||||||
foreach ($Criteria as $L) { // $L = Level
|
foreach ($Criteria as $L) { // $L = Level
|
||||||
$Query = "
|
$Query = "
|
||||||
@ -225,11 +279,15 @@ function next_hour() {
|
|||||||
$Cache->delete_value('user_info_heavy_'.$UserID);
|
$Cache->delete_value('user_info_heavy_'.$UserID);
|
||||||
$Cache->delete_value('user_stats_'.$UserID);
|
$Cache->delete_value('user_stats_'.$UserID);
|
||||||
$Cache->delete_value('enabled_'.$UserID);
|
$Cache->delete_value('enabled_'.$UserID);
|
||||||
$DB->query("UPDATE users_info
|
$DB->query("
|
||||||
|
UPDATE users_info
|
||||||
SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($L['To'])." by System\n\n', AdminComment)
|
SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($L['To'])." by System\n\n', AdminComment)
|
||||||
WHERE UserID = ".$UserID);
|
WHERE UserID = $UserID");
|
||||||
}
|
}
|
||||||
$DB->query("UPDATE users_main SET PermissionID=".$L['To']." WHERE ID IN(".implode(',',$UserIDs).")");
|
$DB->query("
|
||||||
|
UPDATE users_main
|
||||||
|
SET PermissionID=".$L['To']."
|
||||||
|
WHERE ID IN(".implode(',', $UserIDs).')');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Demote users with less than the required uploads
|
// Demote users with less than the required uploads
|
||||||
@ -243,11 +301,13 @@ function next_hour() {
|
|||||||
OR (
|
OR (
|
||||||
SELECT COUNT(ID)
|
SELECT COUNT(ID)
|
||||||
FROM torrents
|
FROM torrents
|
||||||
WHERE UserID=users_main.ID)<'$L[MinUploads]'";
|
WHERE UserID=users_main.ID
|
||||||
|
) < '$L[MinUploads]'";
|
||||||
if (!empty($L['Extra'])) {
|
if (!empty($L['Extra'])) {
|
||||||
$Query .= " OR NOT ".$L['Extra'];
|
$Query .= " OR NOT ".$L['Extra'];
|
||||||
}
|
}
|
||||||
$Query .= ")
|
$Query .= "
|
||||||
|
)
|
||||||
AND Enabled='1'";
|
AND Enabled='1'";
|
||||||
|
|
||||||
$DB->query($Query);
|
$DB->query($Query);
|
||||||
@ -262,11 +322,15 @@ function next_hour() {
|
|||||||
$Cache->delete_value('user_info_heavy_'.$UserID);
|
$Cache->delete_value('user_info_heavy_'.$UserID);
|
||||||
$Cache->delete_value('user_stats_'.$UserID);
|
$Cache->delete_value('user_stats_'.$UserID);
|
||||||
$Cache->delete_value('enabled_'.$UserID);
|
$Cache->delete_value('enabled_'.$UserID);
|
||||||
$DB->query("UPDATE users_info
|
$DB->query("
|
||||||
|
UPDATE users_info
|
||||||
SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($L['From'])." by System\n\n', AdminComment)
|
SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($L['From'])." by System\n\n', AdminComment)
|
||||||
WHERE UserID = ".$UserID);
|
WHERE UserID = $UserID");
|
||||||
}
|
}
|
||||||
$DB->query("UPDATE users_main SET PermissionID=".$L['From']." WHERE ID IN(".implode(',',$UserIDs).")");
|
$DB->query("
|
||||||
|
UPDATE users_main
|
||||||
|
SET PermissionID=".$L['From']."
|
||||||
|
WHERE ID IN(".implode(',', $UserIDs).')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,34 +449,45 @@ function next_hour() {
|
|||||||
//------------- Ratio requirements
|
//------------- Ratio requirements
|
||||||
|
|
||||||
|
|
||||||
$DB->query("DELETE FROM users_torrent_history WHERE Date<date('".sqltime()."'-interval 7 day)+0");
|
$DB->query("
|
||||||
|
DELETE FROM users_torrent_history
|
||||||
|
WHERE Date < date('".sqltime()."'-interval 7 day) + 0");
|
||||||
$DB->query("TRUNCATE TABLE users_torrent_history_temp;");
|
$DB->query("TRUNCATE TABLE users_torrent_history_temp;");
|
||||||
$DB->query("INSERT INTO users_torrent_history_temp
|
$DB->query("
|
||||||
|
INSERT INTO users_torrent_history_temp
|
||||||
(UserID, SumTime)
|
(UserID, SumTime)
|
||||||
SELECT UserID, SUM(Time) FROM users_torrent_history
|
SELECT UserID, SUM(Time)
|
||||||
|
FROM users_torrent_history
|
||||||
GROUP BY UserID;");
|
GROUP BY UserID;");
|
||||||
$DB->query("INSERT INTO users_torrent_history
|
$DB->query("
|
||||||
|
INSERT INTO users_torrent_history
|
||||||
(UserID, NumTorrents, Date, Time)
|
(UserID, NumTorrents, Date, Time)
|
||||||
SELECT UserID, 0, UTC_DATE()+0, 259200-SumTime
|
SELECT UserID, 0, UTC_DATE()+0, 259200-SumTime
|
||||||
FROM users_torrent_history_temp
|
FROM users_torrent_history_temp
|
||||||
WHERE SumTime<259200;");
|
WHERE SumTime<259200;");
|
||||||
$DB->query("UPDATE users_torrent_history SET Weight=NumTorrents*Time;");
|
$DB->query("
|
||||||
|
UPDATE users_torrent_history
|
||||||
|
SET Weight = NumTorrents * Time;");
|
||||||
$DB->query("TRUNCATE TABLE users_torrent_history_temp;");
|
$DB->query("TRUNCATE TABLE users_torrent_history_temp;");
|
||||||
$DB->query("INSERT INTO users_torrent_history_temp
|
$DB->query("
|
||||||
|
INSERT INTO users_torrent_history_temp
|
||||||
(UserID, SeedingAvg)
|
(UserID, SeedingAvg)
|
||||||
SELECT UserID, SUM(Weight)/SUM(Time) FROM users_torrent_history
|
SELECT UserID, SUM(Weight)/SUM(Time)
|
||||||
|
FROM users_torrent_history
|
||||||
GROUP BY UserID;");
|
GROUP BY UserID;");
|
||||||
$DB->query("DELETE FROM users_torrent_history WHERE NumTorrents='0'");
|
$DB->query("DELETE FROM users_torrent_history WHERE NumTorrents='0'");
|
||||||
$DB->query("TRUNCATE TABLE users_torrent_history_snatch;");
|
$DB->query("TRUNCATE TABLE users_torrent_history_snatch;");
|
||||||
$DB->query("INSERT INTO users_torrent_history_snatch(UserID, NumSnatches)
|
$DB->query("
|
||||||
|
INSERT INTO users_torrent_history_snatch
|
||||||
|
(UserID, NumSnatches)
|
||||||
SELECT
|
SELECT
|
||||||
xs.uid,
|
xs.uid,
|
||||||
COUNT(DISTINCT xs.fid)
|
COUNT(DISTINCT xs.fid)
|
||||||
FROM
|
FROM xbt_snatched AS xs
|
||||||
xbt_snatched AS xs
|
JOIN torrents on torrents.ID=xs.fid
|
||||||
join torrents on torrents.ID=xs.fid
|
|
||||||
GROUP BY xs.uid;");
|
GROUP BY xs.uid;");
|
||||||
$DB->query("UPDATE users_main AS um
|
$DB->query("
|
||||||
|
UPDATE users_main AS um
|
||||||
JOIN users_torrent_history_temp AS t ON t.UserID=um.ID
|
JOIN users_torrent_history_temp AS t ON t.UserID=um.ID
|
||||||
JOIN users_torrent_history_snatch AS s ON s.UserID=um.ID
|
JOIN users_torrent_history_snatch AS s ON s.UserID=um.ID
|
||||||
SET um.RequiredRatioWork = (1 - (t.SeedingAvg / s.NumSnatches))
|
SET um.RequiredRatioWork = (1 - (t.SeedingAvg / s.NumSnatches))
|
||||||
@ -429,7 +504,10 @@ function next_hour() {
|
|||||||
array(5 * 1024 * 1024 * 1024, 0.15, 0.0)
|
array(5 * 1024 * 1024 * 1024, 0.15, 0.0)
|
||||||
);
|
);
|
||||||
|
|
||||||
$DB->query("UPDATE users_main SET RequiredRatio=0.60 WHERE Downloaded>100*1024*1024*1024");
|
$DB->query("
|
||||||
|
UPDATE users_main
|
||||||
|
SET RequiredRatio = 0.60
|
||||||
|
WHERE Downloaded > 100*1024*1024*1024");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -437,22 +515,34 @@ function next_hour() {
|
|||||||
foreach ($RatioRequirements as $Requirement) {
|
foreach ($RatioRequirements as $Requirement) {
|
||||||
list($Download, $Ratio, $MinRatio) = $Requirement;
|
list($Download, $Ratio, $MinRatio) = $Requirement;
|
||||||
|
|
||||||
$DB->query("UPDATE users_main
|
$DB->query("
|
||||||
|
UPDATE users_main
|
||||||
SET RequiredRatio = RequiredRatioWork * $Ratio
|
SET RequiredRatio = RequiredRatioWork * $Ratio
|
||||||
WHERE Downloaded >= '$Download' AND Downloaded < '$DownloadBarrier'");
|
WHERE Downloaded >= '$Download'
|
||||||
|
AND Downloaded < '$DownloadBarrier'");
|
||||||
|
|
||||||
$DB->query("UPDATE users_main
|
$DB->query("
|
||||||
|
UPDATE users_main
|
||||||
SET RequiredRatio = $MinRatio
|
SET RequiredRatio = $MinRatio
|
||||||
WHERE Downloaded >= '$Download' AND Downloaded < '$DownloadBarrier' AND RequiredRatio<$MinRatio");
|
WHERE Downloaded >= '$Download'
|
||||||
|
AND Downloaded < '$DownloadBarrier'
|
||||||
//$DB->query("UPDATE users_main
|
AND RequiredRatio < $MinRatio");
|
||||||
// SET RequiredRatio=$Ratio
|
|
||||||
// WHERE Downloaded >= '$Download' AND Downloaded < '$DownloadBarrier' AND can_leech='0' AND Enabled='1'");
|
|
||||||
|
|
||||||
|
/*$DB->query("
|
||||||
|
UPDATE users_main
|
||||||
|
SET RequiredRatio=$Ratio
|
||||||
|
WHERE Downloaded >= '$Download'
|
||||||
|
AND Downloaded < '$DownloadBarrier'
|
||||||
|
AND can_leech='0'
|
||||||
|
AND Enabled='1'");
|
||||||
|
*/
|
||||||
$DownloadBarrier = $Download;
|
$DownloadBarrier = $Download;
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("UPDATE users_main SET RequiredRatio=0.00 WHERE Downloaded<5*1024*1024*1024");
|
$DB->query("
|
||||||
|
UPDATE users_main
|
||||||
|
SET RequiredRatio=0.00
|
||||||
|
WHERE Downloaded < 5*1024*1024*1024");
|
||||||
|
|
||||||
// Here is where we manage ratio watch
|
// Here is where we manage ratio watch
|
||||||
|
|
||||||
@ -472,7 +562,8 @@ function next_hour() {
|
|||||||
AND m.Enabled='1'");
|
AND m.Enabled='1'");
|
||||||
$OffRatioWatch = $DB->collect('ID');
|
$OffRatioWatch = $DB->collect('ID');
|
||||||
if (count($OffRatioWatch) > 0) {
|
if (count($OffRatioWatch) > 0) {
|
||||||
$DB->query("UPDATE users_info AS ui
|
$DB->query("
|
||||||
|
UPDATE users_info AS ui
|
||||||
JOIN users_main AS um ON um.ID = ui.UserID
|
JOIN users_main AS um ON um.ID = ui.UserID
|
||||||
SET ui.RatioWatchEnds='0000-00-00 00:00:00',
|
SET ui.RatioWatchEnds='0000-00-00 00:00:00',
|
||||||
ui.RatioWatchDownload='0',
|
ui.RatioWatchDownload='0',
|
||||||
@ -506,12 +597,13 @@ function next_hour() {
|
|||||||
AND m.Enabled='1'");
|
AND m.Enabled='1'");
|
||||||
$OffRatioWatch = $DB->collect('ID');
|
$OffRatioWatch = $DB->collect('ID');
|
||||||
if (count($OffRatioWatch) > 0) {
|
if (count($OffRatioWatch) > 0) {
|
||||||
$DB->query("UPDATE users_info AS ui
|
$DB->query("
|
||||||
|
UPDATE users_info AS ui
|
||||||
JOIN users_main AS um ON um.ID = ui.UserID
|
JOIN users_main AS um ON um.ID = ui.UserID
|
||||||
SET ui.RatioWatchEnds='0000-00-00 00:00:00',
|
SET ui.RatioWatchEnds='0000-00-00 00:00:00',
|
||||||
ui.RatioWatchDownload='0',
|
ui.RatioWatchDownload='0',
|
||||||
um.can_leech='1'
|
um.can_leech='1'
|
||||||
WHERE ui.UserID IN(".implode(",", $OffRatioWatch).")");
|
WHERE ui.UserID IN(".implode(',', $OffRatioWatch).')');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($OffRatioWatch as $UserID) {
|
foreach ($OffRatioWatch as $UserID) {
|
||||||
@ -575,8 +667,14 @@ function next_hour() {
|
|||||||
$Details[] = "Ripped with EAC v0.95, -1 point [1]";
|
$Details[] = "Ripped with EAC v0.95, -1 point [1]";
|
||||||
$Details = serialize($Details);
|
$Details = serialize($Details);
|
||||||
while (list($TorrentID) = $DB->next_record()) {
|
while (list($TorrentID) = $DB->next_record()) {
|
||||||
$DB->query("UPDATE torrents SET LogScore = 99 WHERE ID = ".$TorrentID);
|
$DB->query("
|
||||||
$DB->query("UPDATE torrents_logs_new SET Score = 99, Details = '$Details' WHERE TorrentID = ".$TorrentID);
|
UPDATE torrents
|
||||||
|
SET LogScore = 99
|
||||||
|
WHERE ID = $TorrentID");
|
||||||
|
$DB->query("
|
||||||
|
UPDATE torrents_logs_new
|
||||||
|
SET Score = 99, Details = '$Details'
|
||||||
|
WHERE TorrentID = $TorrentID");
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(5);
|
sleep(5);
|
||||||
@ -600,10 +698,10 @@ function next_hour() {
|
|||||||
JOIN users_main AS m ON m.ID=i.UserID
|
JOIN users_main AS m ON m.ID=i.UserID
|
||||||
SET m.can_leech='0',
|
SET m.can_leech='0',
|
||||||
i.AdminComment=CONCAT('$sqltime - Leeching ability disabled by ratio watch system - required ratio: ', m.RequiredRatio,'', i.AdminComment)
|
i.AdminComment=CONCAT('$sqltime - Leeching ability disabled by ratio watch system - required ratio: ', m.RequiredRatio,'', i.AdminComment)
|
||||||
WHERE m.ID IN(".implode(',',$UserIDs).")");
|
WHERE m.ID IN(".implode(',', $UserIDs).')');
|
||||||
|
|
||||||
|
|
||||||
$DB->query("DELETE FROM users_torrent_history WHERE UserID IN (".implode(',',$UserIDs).")");
|
$DB->query("DELETE FROM users_torrent_history WHERE UserID IN (".implode(',', $UserIDs).')');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($UserIDs as $UserID) {
|
foreach ($UserIDs as $UserID) {
|
||||||
@ -623,7 +721,8 @@ function next_hour() {
|
|||||||
//------------- Disable inactive user accounts --------------------------//
|
//------------- Disable inactive user accounts --------------------------//
|
||||||
sleep(5);
|
sleep(5);
|
||||||
// Send email
|
// Send email
|
||||||
$DB->query("SELECT um.Username, um.Email
|
$DB->query("
|
||||||
|
SELECT um.Username, um.Email
|
||||||
FROM users_info AS ui
|
FROM users_info AS ui
|
||||||
JOIN users_main AS um ON um.ID=ui.UserID
|
JOIN users_main AS um ON um.ID=ui.UserID
|
||||||
LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
|
LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
|
||||||
@ -639,7 +738,8 @@ function next_hour() {
|
|||||||
$Body = "Hi $Username, \n\nIt has been almost 4 months since you used your account at https://".SSL_SITE_URL.". This is an automated email to inform you that your account will be disabled in 10 days if you do not sign in. ";
|
$Body = "Hi $Username, \n\nIt has been almost 4 months since you used your account at https://".SSL_SITE_URL.". This is an automated email to inform you that your account will be disabled in 10 days if you do not sign in. ";
|
||||||
Misc::send_email($Email, 'Your '.SITE_NAME.' account is about to be disabled', $Body);
|
Misc::send_email($Email, 'Your '.SITE_NAME.' account is about to be disabled', $Body);
|
||||||
}
|
}
|
||||||
$DB->query("SELECT um.ID
|
$DB->query("
|
||||||
|
SELECT um.ID
|
||||||
FROM users_info AS ui
|
FROM users_info AS ui
|
||||||
JOIN users_main AS um ON um.ID=ui.UserID
|
JOIN users_main AS um ON um.ID=ui.UserID
|
||||||
LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
|
LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
|
||||||
@ -657,7 +757,8 @@ function next_hour() {
|
|||||||
|
|
||||||
//------------- Disable unconfirmed users ------------------------------//
|
//------------- Disable unconfirmed users ------------------------------//
|
||||||
sleep(10);
|
sleep(10);
|
||||||
$DB->query("UPDATE users_info AS ui
|
$DB->query("
|
||||||
|
UPDATE users_info AS ui
|
||||||
JOIN users_main AS um ON um.ID=ui.UserID
|
JOIN users_main AS um ON um.ID=ui.UserID
|
||||||
SET um.Enabled='2',
|
SET um.Enabled='2',
|
||||||
ui.BanDate='$sqltime',
|
ui.BanDate='$sqltime',
|
||||||
@ -673,7 +774,8 @@ function next_hour() {
|
|||||||
|
|
||||||
//------------- Demote users --------------------------------------------//
|
//------------- Demote users --------------------------------------------//
|
||||||
sleep(10);
|
sleep(10);
|
||||||
$DB->query('SELECT um.ID
|
$DB->query('
|
||||||
|
SELECT um.ID
|
||||||
FROM users_main AS um
|
FROM users_main AS um
|
||||||
WHERE PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
|
WHERE PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
|
||||||
AND Uploaded/Downloaded < 0.95
|
AND Uploaded/Downloaded < 0.95
|
||||||
@ -687,7 +789,8 @@ function next_hour() {
|
|||||||
$Cache->update_row(false, array('PermissionID'=>MEMBER));
|
$Cache->update_row(false, array('PermissionID'=>MEMBER));
|
||||||
$Cache->commit_transaction(2592000);
|
$Cache->commit_transaction(2592000);
|
||||||
}
|
}
|
||||||
$DB->query('UPDATE users_main
|
$DB->query('
|
||||||
|
UPDATE users_main
|
||||||
SET PermissionID='.MEMBER.'
|
SET PermissionID='.MEMBER.'
|
||||||
WHERE PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
|
WHERE PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
|
||||||
AND Uploaded/Downloaded < 0.95
|
AND Uploaded/Downloaded < 0.95
|
||||||
@ -695,7 +798,8 @@ function next_hour() {
|
|||||||
AND Uploaded < 25*1024*1024*1024');
|
AND Uploaded < 25*1024*1024*1024');
|
||||||
echo "demoted 2\n";
|
echo "demoted 2\n";
|
||||||
|
|
||||||
$DB->query('SELECT um.ID
|
$DB->query('
|
||||||
|
SELECT um.ID
|
||||||
FROM users_main AS um
|
FROM users_main AS um
|
||||||
WHERE PermissionID IN('.MEMBER.', '.POWER.', '.ELITE.', '.TORRENT_MASTER.')
|
WHERE PermissionID IN('.MEMBER.', '.POWER.', '.ELITE.', '.TORRENT_MASTER.')
|
||||||
AND Uploaded/Downloaded < 0.65');
|
AND Uploaded/Downloaded < 0.65');
|
||||||
@ -705,7 +809,8 @@ function next_hour() {
|
|||||||
$Cache->update_row(false, array('PermissionID'=>USER));
|
$Cache->update_row(false, array('PermissionID'=>USER));
|
||||||
$Cache->commit_transaction(2592000);
|
$Cache->commit_transaction(2592000);
|
||||||
}
|
}
|
||||||
$DB->query('UPDATE users_main
|
$DB->query('
|
||||||
|
UPDATE users_main
|
||||||
SET PermissionID='.USER.'
|
SET PermissionID='.USER.'
|
||||||
WHERE PermissionID IN('.MEMBER.', '.POWER.', '.ELITE.', '.TORRENT_MASTER.')
|
WHERE PermissionID IN('.MEMBER.', '.POWER.', '.ELITE.', '.TORRENT_MASTER.')
|
||||||
AND Uploaded/Downloaded < 0.65');
|
AND Uploaded/Downloaded < 0.65');
|
||||||
@ -713,10 +818,12 @@ function next_hour() {
|
|||||||
|
|
||||||
//------------- Lock old threads ----------------------------------------//
|
//------------- Lock old threads ----------------------------------------//
|
||||||
sleep(10);
|
sleep(10);
|
||||||
$DB->query("SELECT t.ID, t.ForumID
|
$DB->query("
|
||||||
|
SELECT t.ID, t.ForumID
|
||||||
FROM forums_topics AS t
|
FROM forums_topics AS t
|
||||||
JOIN forums AS f ON t.ForumID = f.ID
|
JOIN forums AS f ON t.ForumID = f.ID
|
||||||
WHERE t.IsLocked='0' AND t.IsSticky='0'
|
WHERE t.IsLocked='0'
|
||||||
|
AND t.IsSticky='0'
|
||||||
AND DATEDIFF(CURDATE(),DATE(t.LastPostTime)) / 7 > f.AutoLockWeeks
|
AND DATEDIFF(CURDATE(),DATE(t.LastPostTime)) / 7 > f.AutoLockWeeks
|
||||||
AND f.AutoLock = '1'");
|
AND f.AutoLock = '1'");
|
||||||
$IDs = $DB->collect('ID');
|
$IDs = $DB->collect('ID');
|
||||||
@ -754,7 +861,8 @@ function next_hour() {
|
|||||||
|
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$DB->query("SELECT
|
$DB->query("
|
||||||
|
SELECT
|
||||||
t.ID,
|
t.ID,
|
||||||
t.GroupID,
|
t.GroupID,
|
||||||
tg.Name,
|
tg.Name,
|
||||||
@ -794,7 +902,7 @@ function next_hour() {
|
|||||||
$Name.= ' ['.(empty($Media) ? '' : "$Media / ").$Format.' / '.$Encoding.']';
|
$Name.= ' ['.(empty($Media) ? '' : "$Media / ").$Format.' / '.$Encoding.']';
|
||||||
}
|
}
|
||||||
Torrents::delete_torrent($ID, $GroupID);
|
Torrents::delete_torrent($ID, $GroupID);
|
||||||
$LogEntries[] = "Torrent ".$ID." (".$Name.") (".strtoupper($InfoHash).") was deleted for inactivity (unseeded)";
|
$LogEntries[] = "Torrent $ID ($Name) (".strtoupper($InfoHash).") was deleted for inactivity (unseeded)";
|
||||||
|
|
||||||
if (!array_key_exists($UserID, $DeleteNotes))
|
if (!array_key_exists($UserID, $DeleteNotes))
|
||||||
$DeleteNotes[$UserID] = array('Count' => 0, 'Msg' => '');
|
$DeleteNotes[$UserID] = array('Count' => 0, 'Msg' => '');
|
||||||
@ -810,13 +918,13 @@ function next_hour() {
|
|||||||
echo "$i torrents deleted for inactivity.\n";
|
echo "$i torrents deleted for inactivity.\n";
|
||||||
|
|
||||||
foreach ($DeleteNotes as $UserID => $MessageInfo) {
|
foreach ($DeleteNotes as $UserID => $MessageInfo) {
|
||||||
$Singular = ($MessageInfo['Count'] == 1) ? true : false;
|
$Singular = (($MessageInfo['Count'] == 1) ? true : false);
|
||||||
Misc::send_pm($UserID, 0, $MessageInfo['Count'].' of your torrents '.($Singular ? 'has' : 'have').' been deleted for inactivity', ($Singular ? 'One' : 'Some').' of your uploads '.($Singular ? 'has' : 'have').' been deleted for being unseeded. Since '.($Singular ? 'it' : 'they').' didn\'t break any rules (we hope), please feel free to re-upload '.($Singular ? 'it' : 'them').".\n\nThe following torrent".($Singular ? ' was' : 's were').' deleted:'.$MessageInfo['Msg']);
|
Misc::send_pm($UserID, 0, $MessageInfo['Count'].' of your torrents '.($Singular ? 'has' : 'have').' been deleted for inactivity', ($Singular ? 'One' : 'Some').' of your uploads '.($Singular ? 'has' : 'have').' been deleted for being unseeded. Since '.($Singular ? 'it' : 'they').' didn\'t break any rules (we hope), please feel free to re-upload '.($Singular ? 'it' : 'them').".\n\nThe following torrent".($Singular ? ' was' : 's were').' deleted:'.$MessageInfo['Msg']);
|
||||||
}
|
}
|
||||||
unset($DeleteNotes);
|
unset($DeleteNotes);
|
||||||
|
|
||||||
if (count($LogEntries) > 0) {
|
if (count($LogEntries) > 0) {
|
||||||
$Values = "('".implode("', '".$sqltime."'), ('",$LogEntries)."', '".$sqltime."')";
|
$Values = "('".implode("', '".$sqltime."'), ('",$LogEntries)."', '$sqltime')";
|
||||||
$DB->query('INSERT INTO log (Message, Time) VALUES '.$Values);
|
$DB->query('INSERT INTO log (Message, Time) VALUES '.$Values);
|
||||||
echo "\nDeleted $i torrents for inactivity\n";
|
echo "\nDeleted $i torrents for inactivity\n";
|
||||||
}
|
}
|
||||||
@ -833,12 +941,15 @@ function next_hour() {
|
|||||||
|
|
||||||
|
|
||||||
// Daily top 10 history.
|
// Daily top 10 history.
|
||||||
$DB->query("INSERT INTO top10_history (Date, Type) VALUES ('".$sqltime."', 'Daily')");
|
$DB->query("
|
||||||
|
INSERT INTO top10_history (Date, Type)
|
||||||
|
VALUES ('$sqltime', 'Daily')");
|
||||||
$HistoryID = $DB->inserted_id();
|
$HistoryID = $DB->inserted_id();
|
||||||
|
|
||||||
$Top10 = $Cache->get_value('top10tor_day_10');
|
$Top10 = $Cache->get_value('top10tor_day_10');
|
||||||
if ($Top10 === false) {
|
if ($Top10 === false) {
|
||||||
$DB->query("SELECT
|
$DB->query("
|
||||||
|
SELECT
|
||||||
t.ID,
|
t.ID,
|
||||||
g.ID,
|
g.ID,
|
||||||
g.Name,
|
g.Name,
|
||||||
@ -906,24 +1017,28 @@ function next_hour() {
|
|||||||
|
|
||||||
$TitleString = $DisplayName.' '.$ExtraInfo;
|
$TitleString = $DisplayName.' '.$ExtraInfo;
|
||||||
|
|
||||||
$TagString = str_replace("|", " ", $TorrentTags);
|
$TagString = str_replace('|', ' ', $TorrentTags);
|
||||||
|
|
||||||
$DB->query("INSERT INTO top10_history_torrents
|
$DB->query("
|
||||||
|
INSERT INTO top10_history_torrents
|
||||||
(HistoryID, Rank, TorrentID, TitleString, TagString)
|
(HistoryID, Rank, TorrentID, TitleString, TagString)
|
||||||
VALUES
|
VALUES
|
||||||
(".$HistoryID.", ".$i.", ".$TorrentID.", '".db_string($TitleString)."', '".db_string($TagString)."')");
|
($HistoryID, $i, $TorrentID, '".db_string($TitleString)."', '".db_string($TagString)."')");
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Weekly top 10 history.
|
// Weekly top 10 history.
|
||||||
// We need to haxxor it to work on a Sunday as we don't have a weekly schedule
|
// We need to haxxor it to work on a Sunday as we don't have a weekly schedule
|
||||||
if (date('w') == 0) {
|
if (date('w') == 0) {
|
||||||
$DB->query("INSERT INTO top10_history (Date, Type) VALUES ('".$sqltime."', 'Weekly')");
|
$DB->query("
|
||||||
|
INSERT INTO top10_history (Date, Type)
|
||||||
|
VALUES ('$sqltime', 'Weekly')");
|
||||||
$HistoryID = $DB->inserted_id();
|
$HistoryID = $DB->inserted_id();
|
||||||
|
|
||||||
$Top10 = $Cache->get_value('top10tor_week_10');
|
$Top10 = $Cache->get_value('top10tor_week_10');
|
||||||
if ($Top10 === false) {
|
if ($Top10 === false) {
|
||||||
$DB->query("SELECT
|
$DB->query("
|
||||||
|
SELECT
|
||||||
t.ID,
|
t.ID,
|
||||||
g.ID,
|
g.ID,
|
||||||
g.Name,
|
g.Name,
|
||||||
@ -946,7 +1061,7 @@ function next_hour() {
|
|||||||
FROM torrents AS t
|
FROM torrents AS t
|
||||||
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID
|
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID
|
||||||
WHERE t.Seeders>0
|
WHERE t.Seeders>0
|
||||||
AND t.Time > ('".$sqltime."' - INTERVAL 1 WEEK)
|
AND t.Time > ('$sqltime' - INTERVAL 1 WEEK)
|
||||||
ORDER BY (t.Seeders + t.Leechers) DESC
|
ORDER BY (t.Seeders + t.Leechers) DESC
|
||||||
LIMIT 10;");
|
LIMIT 10;");
|
||||||
|
|
||||||
@ -1014,12 +1129,13 @@ function next_hour() {
|
|||||||
|
|
||||||
$TitleString = $DisplayName.' '.$ExtraInfo;
|
$TitleString = $DisplayName.' '.$ExtraInfo;
|
||||||
|
|
||||||
$TagString = str_replace("|", " ", $TorrentTags);
|
$TagString = str_replace('|', ' ', $TorrentTags);
|
||||||
|
|
||||||
$DB->query('INSERT INTO top10_history_torrents
|
$DB->query("
|
||||||
|
INSERT INTO top10_history_torrents
|
||||||
(HistoryID, Rank, TorrentID, TitleString, TagString)
|
(HistoryID, Rank, TorrentID, TitleString, TagString)
|
||||||
VALUES
|
VALUES
|
||||||
('.$HistoryID.", ".$i.", ".$TorrentID.", '".db_string($TitleString)."', '".db_string($TagString)."')");
|
($HistoryID, $i, $TorrentID, ".db_string($TitleString)."', '".db_string($TagString)."')");
|
||||||
$i++;
|
$i++;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
@ -1067,13 +1183,13 @@ function next_hour() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("UPDATE staff_pm_conversations
|
$DB->query("
|
||||||
|
UPDATE staff_pm_conversations
|
||||||
SET Status = 'Resolved', ResolverID = '0'
|
SET Status = 'Resolved', ResolverID = '0'
|
||||||
WHERE Date < NOW() - INTERVAL 1 MONTH
|
WHERE Date < NOW() - INTERVAL 1 MONTH
|
||||||
AND Status = 'Open'
|
AND Status = 'Open'
|
||||||
AND AssignedToUser IS NULL");
|
AND AssignedToUser IS NULL");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/*************************************************************************\
|
/*************************************************************************\
|
||||||
//--------------Run twice per month -------------------------------------//
|
//--------------Run twice per month -------------------------------------//
|
||||||
@ -1087,7 +1203,8 @@ function next_hour() {
|
|||||||
|
|
||||||
//------------- Cycle auth keys -----------------------------------------//
|
//------------- Cycle auth keys -----------------------------------------//
|
||||||
|
|
||||||
$DB->query("UPDATE users_info
|
$DB->query("
|
||||||
|
UPDATE users_info
|
||||||
SET AuthKey =
|
SET AuthKey =
|
||||||
MD5(
|
MD5(
|
||||||
CONCAT(
|
CONCAT(
|
||||||
@ -1119,7 +1236,8 @@ function next_hour() {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$DB->query("SELECT ID
|
$DB->query("
|
||||||
|
SELECT ID
|
||||||
FROM users_main AS um
|
FROM users_main AS um
|
||||||
JOIN users_info AS ui on ui.UserID=um.ID
|
JOIN users_info AS ui on ui.UserID=um.ID
|
||||||
WHERE um.Enabled='1'
|
WHERE um.Enabled='1'
|
||||||
@ -1136,7 +1254,10 @@ function next_hour() {
|
|||||||
$Cache->update_row(false, array('Invites' => '+1'));
|
$Cache->update_row(false, array('Invites' => '+1'));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
}
|
}
|
||||||
$DB->query("UPDATE users_main SET Invites=Invites+1 WHERE ID IN (".implode(',',$UserIDs).")");
|
$DB->query('
|
||||||
|
UPDATE users_main
|
||||||
|
SET Invites=Invites+1
|
||||||
|
WHERE ID IN ('.implode(',', $UserIDs).')');
|
||||||
}
|
}
|
||||||
|
|
||||||
$BonusReqs = array(
|
$BonusReqs = array(
|
||||||
@ -1146,7 +1267,8 @@ function next_hour() {
|
|||||||
|
|
||||||
// Since MySQL doesn't like subselecting from the target table during an update, we must create a temporary table.
|
// Since MySQL doesn't like subselecting from the target table during an update, we must create a temporary table.
|
||||||
|
|
||||||
$DB->query("CREATE TEMPORARY TABLE temp_sections_schedule_index
|
$DB->query("
|
||||||
|
CREATE TEMPORARY TABLE temp_sections_schedule_index
|
||||||
SELECT SUM(Uploaded) AS Upload,SUM(Downloaded) AS Download,Inviter
|
SELECT SUM(Uploaded) AS Upload,SUM(Downloaded) AS Download,Inviter
|
||||||
FROM users_main AS um
|
FROM users_main AS um
|
||||||
JOIN users_info AS ui ON ui.UserID=um.ID
|
JOIN users_info AS ui ON ui.UserID=um.ID
|
||||||
@ -1154,7 +1276,8 @@ function next_hour() {
|
|||||||
|
|
||||||
foreach ($BonusReqs as $BonusReq) {
|
foreach ($BonusReqs as $BonusReq) {
|
||||||
list($Ratio, $Upload) = $BonusReq;
|
list($Ratio, $Upload) = $BonusReq;
|
||||||
$DB->query("SELECT ID
|
$DB->query("
|
||||||
|
SELECT ID
|
||||||
FROM users_main AS um
|
FROM users_main AS um
|
||||||
JOIN users_info AS ui ON ui.UserID=um.ID
|
JOIN users_info AS ui ON ui.UserID=um.ID
|
||||||
JOIN temp_sections_schedule_index AS u ON u.Inviter = um.ID
|
JOIN temp_sections_schedule_index AS u ON u.Inviter = um.ID
|
||||||
@ -1173,14 +1296,18 @@ function next_hour() {
|
|||||||
$Cache->update_row(false, array('Invites' => '+1'));
|
$Cache->update_row(false, array('Invites' => '+1'));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
}
|
}
|
||||||
$DB->query("UPDATE users_main SET Invites=Invites+1 WHERE ID IN (".implode(',',$UserIDs).")");
|
$DB->query('
|
||||||
|
UPDATE users_main
|
||||||
|
SET Invites=Invites+1
|
||||||
|
WHERE ID IN ('.implode(',', $UserIDs).')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($BiWeek == 8) {
|
if ($BiWeek == 8) {
|
||||||
$DB->query('TRUNCATE TABLE top_snatchers;');
|
$DB->query('TRUNCATE TABLE top_snatchers;');
|
||||||
|
|
||||||
$DB->query("INSERT INTO top_snatchers (UserID)
|
$DB->query("
|
||||||
|
INSERT INTO top_snatchers (UserID)
|
||||||
SELECT uid
|
SELECT uid
|
||||||
FROM xbt_snatched
|
FROM xbt_snatched
|
||||||
GROUP BY uid
|
GROUP BY uid
|
||||||
|
@ -42,11 +42,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// defaults to 10 (duh)
|
// defaults to 10 (duh)
|
||||||
$Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;
|
$Limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 10);
|
||||||
$Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10;
|
$Limit = (in_array($Limit, array(10, 100, 250)) ? $Limit : 10);
|
||||||
}
|
}
|
||||||
$Filtered = !empty($Where);
|
$Filtered = !empty($Where);
|
||||||
View::show_header('Top '.$Limit.' Torrents');
|
View::show_header("Top $Limit Torrents");
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -121,7 +121,7 @@
|
|||||||
|
|
||||||
$FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName;
|
$FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName;
|
||||||
|
|
||||||
$GroupByToggleName = ($_GET['groups'] == "show" ? 'hide' : 'show');
|
$GroupByToggleName = ($_GET['groups'] == 'show' ? 'hide' : 'show');
|
||||||
$GroupByToggleQuery = Format::get_url(array('freeleech', 'groups'));
|
$GroupByToggleQuery = Format::get_url(array('freeleech', 'groups'));
|
||||||
|
|
||||||
if (!empty($GroupByToggleQuery))
|
if (!empty($GroupByToggleQuery))
|
||||||
|
Loading…
Reference in New Issue
Block a user