, Modded by: Tapac * - * Description: * Miscellaneous functions needed for my plugins. * *** DO NOT EDIT THIS FILE *** */ function downloadCounter_check_table() { global $downloadCounter_table; $query=mysql_query("SHOW TABLES Like '".$downloadCounter_table."'"); if (mysql_affected_rows($query) > 0) { return; } else mysql_query( " CREATE TABLE IF NOT EXISTS `$downloadCounter_table` ( `id` int(11) NOT NULL auto_increment, `label` varchar(50) NOT NULL default '', `date` int(11) NOT NULL default '0', `file` varchar(255) NOT NULL default '', `downloads` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM; "); } // really old duration function i took from one of my old projects. // i promise i'll make a much cleaner version of this in the next imageCounter released. function duration($time,$d) { $text=array('year' => "year(s)", 'week' => "week(s)", 'day' => "day(s)"); $c_time=time(0); $d_time=$c_time-$time; if (!$d) { $time=localtime($d_time,"1"); $year=31536000; $year=floor($d_time / $year); $years=$year." ".$text[year]; $week="604800"; $week=floor($d_time / $week); $week_=52*$year; $week=$week-$week_; $weeks=$week." ".$text[week]; $day="86400"; $day=floor($d_time / $day); $day_=7*$week; $day=$day-$day_; $days=$day." ".$text[day]; if ($years != "0 $text[year]" && $year > "0") { $duration.="$years"; } if ($weeks != "0 $text[week]" && $week < 52) { $duration.="$weeks"; } if ($days != "0 $text[day]" && $day < 7 && $day > 0) { $duration.="$days"; } } else { $duration=floor($d_time / 86400); } return $duration; } function dCounter_broken($file,$mode) { $exists = @fopen(str_replace(' ', '%20', $file), "r"); if (!$mode && !$exists) { return "файл не найден по указаному адресу!"; } if ($mode && !$exists) { return true; } fclose($exists); return false; } ?>