This code is for TBDev09 some changes we must make to work on TBDev 08
announce.php
Code:
if ( strtoupper( substr(PHP_OS, 0, 3) ) == 'WIN' )
{
$file_path = str_replace( "\\", "/", dirname(__FILE__) );
$file_path = str_replace( "/include", "", $file_path );
}
else
{
$file_path = dirname(__FILE__);
$file_path = str_replace( "/include", "", $file_path );
}
define('ROOT_PATH', $file_path);
and this
Code:
$BASEURL["cache"] = ROOT_PATH.'cache';
and this too
Code:
$crazyhour = crazyhour_announce();
if ($upthis > 0 || $downthis > 0)
mysql_query("UPDATE users SET uploaded = uploaded + ".(!$crazyhour?"$upthis":"$upthis*3").(!$crazyhour?", downloaded = downloaded + $downthis ":'')." WHERE id=$userid") or err("Tracker error 3");
then in fuctions.php add
Code:
if (isset($CURUSER)) {
$transfer_filename = $BASEURL['cache'].'/transfer_crazyhour.txt';
$crazyhour_filename = $BASEURL['cache'].'/crazy_hour.txt';
$crazyhour_cache = fopen($crazyhour_filename,'r+');
$crazyhour_var = fread($crazyhour_cache, filesize($BASEURL['cache'].'/crazy_hour.txt'));
fclose($crazyhour_cache);
$cimg = '<img src=\''.$BASEURL["pic_base_url"].'cat_free.gif\' alt=\'FREE!\' />';
if ($crazyhour_var >= TIME_NOW && $crazyhour_var < TIME_NOW + 3600) { // is crazyhour
$htmlout .="<table width='50%'><tr><td class='colhead' colspan='3' align='center'>
w00t It's Crazyhour! Ends in ".mkprettytime($crazyhour_var - TIME_NOW)."</td></tr>
<tr><td width='42px' align='center' valign='middle'>". $cimg."</td>
<td><div align='center'>All torrents are FREE and upload stats are TRIPLED!</div></td>
<td width='42px' align='center' valign='middle'>".$cimg."</td></tr></table><br />";
if (is_file($transfer_filename))
unlink($transfer_filename);
}
elseif ($crazyhour_var < TIME_NOW + 3600 && !is_file($transfer_filename)) { //== crazyhour over
$transfer_file_created = fopen($transfer_filename, 'w') or die('no perms?');
fclose($transfer_file_created);
$crazyhour['crazyhour_new'] = mktime(23, 59, 59, date('m'), date('d'), date('y'));
$crazyhour['crazyhour']['var'] = mt_rand($crazyhour['crazyhour_new'], ($crazyhour['crazyhour_new'] + 86400));
$fp = fopen($crazyhour_filename, 'w');
fwrite($fp, $crazyhour['crazyhour']['var']);
fclose($fp);
write_log('Next Crazyhour is at '.date('F j, g:i a T', $crazyhour['crazyhour'] ['var']));
$htmlout .="<table cellpadding='3'><tr><td class='colhead' colspan='3' align='center'>"." Crazyhour will be ".get_date($crazyhour['crazyhour']['var'], '')." ".mkprettytime($crazyhour['crazyhour']['var'] - TIME_NOW)." remaining till Crazyhour</td></tr></table><br />";
}
else // make date look prettier with countdown etc even :]
$htmlout .="<table cellpadding='3'><tr><td class='colhead' colspan='3' align='center'>"." Crazyhour will be ".get_date($crazyhour_var, '')." ".mkprettytime($crazyhour_var - TIME_NOW)." remaining till Crazyhour</td></tr></table><br />";
} }