Exemplo n.º 1
0
    return date('H', $Hour);
}
if ((!isset($argv[1]) || $argv[1] != SCHEDULE_KEY) && !check_perms('admin_schedule')) {
    // authorization, Fix to allow people with perms hit this page.
    error(403);
}
if (check_perms('admin_schedule')) {
    authorize();
    View::show_header();
    echo '<pre>';
}
$DB->query("\n\tSELECT NextHour, NextDay, NextBiWeekly\n\tFROM schedule");
list($Hour, $Day, $BiWeek) = $DB->next_record();
$NextHour = next_hour();
$NextDay = next_day();
$NextBiWeek = next_biweek();
$DB->query("\n\tUPDATE schedule\n\tSET\n\t\tNextHour = {$NextHour},\n\t\tNextDay = {$NextDay},\n\t\tNextBiWeekly = {$NextBiWeek}");
$NoDaily = isset($argv[2]) && $argv[2] == 'nodaily';
$sqltime = sqltime();
echo "{$sqltime}\n";
/*************************************************************************\
//--------------Run every time ------------------------------------------//

These functions are run every time the script is executed (every 15
minutes).

\*************************************************************************/
echo "Ran every-time functions\n";
//------------- Freeleech -----------------------------------------------//
//We use this to control 6 hour freeleeches. They're actually 7 hours, but don't tell anyone.
/*
Exemplo n.º 2
0
	$DB->query("CREATE TEMPORARY TABLE u
		SELECT SUM(Uploaded) AS Upload,SUM(Downloaded) AS Download,Inviter
		FROM users_main AS um JOIN users_info AS ui ON ui.UserID=um.ID
		GROUP BY Inviter");
	
	foreach ($BonusReqs as $BonusReq) {
		list($Ratio, $Upload) = $BonusReq;
		$DB->query("SELECT ID FROM users_main AS um JOIN users_info AS ui on ui.UserID=um.ID JOIN u ON u.Inviter = um.ID WHERE u.Upload/u.Download>$Ratio AND um.PermissionID IN (".POWER.", ".ELITE.") AND um.Enabled = '1' AND ui.DisableInvites = '0' AND um.Invites<10");
		$UserIDs = $DB->collect('ID');
		if (count($UserIDs) > 0) {
			foreach($UserIDs as $UserID) {
					$Cache->begin_transaction('user_info_heavy_'.$UserID);
					$Cache->update_row(false, array('Invites' => '+1'));
					$Cache->commit_transaction(0);
			}
			$DB->query("UPDATE users_main SET Invites=Invites+1 WHERE ID IN (".implode(',',$UserIDs).")");
		}
	}
	$BiWeek = next_biweek();
}

$DB->query("UPDATE schedule SET NextHour = $Hour, NextDay = $Day, NextBiWeekly = $BiWeek");

echo "-------------------------\n\n";
if (check_perms('admin_schedule')) {	
	echo '<pre>';
	show_footer();
}
?>