$random";
}; // function buildFlirtpowerLink(){
function random_array_element($a){
mt_srand((double)microtime()*1000000);
// get all array keys:
$k = array_keys($a);
// find a random array key:
$r = mt_rand(0, count($k)-1);
$rk = $k[$r];
// return the random key (if exists):
return isset($a[$rk]) ? $a[$rk] : '';
}; // function random_array_element($a){
// $text_to_highlight = highlight_this($text_to_highlight, $search_text);
function highlight_this($text, $words) {
$words = trim($words);
$wordsArray = explode(' ', $words);
foreach($wordsArray as $word) {
if(strlen(trim($word)) != 0){
$text = str_ireplace($word, "".strtoupper($word)."", $text);
};
};
return $text;
}; // function highlight_this($text, $words) {
// get Balken color
function getBalkenColor(){
$rand = rand(1,4);
if ( $rand == 1 ){
return "barGreen.gif";
} elseif ( $rand == 2 ){
return "barGreen2.gif";
} elseif ( $rand == 3 ){
return "barYellowGreen.gif";
} elseif ( $rand == 4 ){
return "barYellow.gif";
} elseif ( $rand == 5 ){
return "barYellowOrange.gif";
} elseif ( $rand == 6 ){
return "barOrangeRed.gif";
} elseif ( $rand == 7 ){
return "barRed.gif";
} elseif ( $rand == 8 ){
return "barRed2.gif";
} else {
return "barGreen2.gif";
};
}; // function getBalkenColor(){
// print out the tag cloud
function printTagCloud($tags) {
// $tags is the array
$NoDoubleTags = array();
$min_size = 11; // min font size in %
$max_size = 36; // max font size in %
$pattern = "(\.com|\.net|\.de|\.to|\.+[a-z]|\s+com|\s+net|\s+de|\s+to|www)"; # match a domain
// Mod begin
$DESC_last = "";
$len_last = 0;
// Mod end
echo <<
Fresh Torrent News
END;
// loop through the tag array
foreach ($tags as $keyword ) {
// calculate font-size
$size = rand($min_size, $max_size) . "px;";
$DESC1 = trim($keyword);
$DESC = str_replace("%20", "+", $DESC1);
$DESC = preg_replace('/\s\s+/', '+', $DESC1);
$DESC = ereg_replace("[ \t\n\r]+", "+", $DESC1);
$DESC = title_plus($DESC1);
$DESC = deleteSpecialChars($DESC); # sonderzeichen entfernen
if (!in_array($keyword, $NoDoubleTags)) { # dublicates filtern
if ( strlen($DESC) >= 3 && strlen($DESC) <= 55 ) { # wort darf nur max 40 zeichen lang sein
if( !preg_match($pattern, $DESC) ){ # domain dateien filtern
if (preg_match('/^[\w+]+$/', $DESC) ) {
//Mod begin
$len = strlen($DESC);
$len = round($len*0.5, 0);
if ($len_last != 0 AND (substr(strtolower($DESC), 0, $len) == substr(strtolower($DESC_last), 0, $len) OR substr(strtolower($DESC), 0, $len_last) == substr(strtolower($DESC_last), 0, $len_last))) {
continue;
};
$DESC_last = $DESC;
$len_last = $len;
//Mod end
$NumberOfWords = count(explode(" ",$keyword));
$lower_desc = strtolower($DESC);
$rageurl = "http://www.torrentrage.com/torrent/$lower_desc".".html";
if ( $NumberOfWords >= 2 && $NumberOfWords <= 4 ) {
echo "- $keyword
| ";
} else {
echo "- $keyword
| ";
} # if ( $NumberOfWords >= 2 && $NumberOfWords <= 4 ) {
}; # if (preg_match('/^[\w+]+$/', $DESC) {
}; # if( !preg_match($pattern, $DESC) ){
}; # if ( strlen($DESC) >= 5 && strlen($DESC) <= 40 ) {
}; # if (!in_array($keyword, $NoDoubleTags)) {
array_push($NoDoubleTags,$keyword );
}; # foreach ($tags as $keyword ) {
echo '
';
}; # function printTagCloud($tags,$catg) {
// add plus signs between strings where once space signs have been
function title_plus( $string ){
$string = deleteSpecialChars($string); # sonderzeichen entfernen: security.inc.php
$string = preg_replace('/\s\s+/', '+', $string);
$string = preg_replace('/\++/', '+', $string);
$string = ereg_replace("[ \t\n\r]+", "+", $string);
$tmp = $string;
$flet = substr($tmp, 0,1); # get first char
$last = $tmp[strlen($tmp)-1]; # get last char
if ( preg_match("/\+/", $flet ) ) {
#echo "PLus sign in front\n";
$string = substr($string, 1);
};
if ( preg_match("/\+/", $last ) ) {
#echo "PLus sign at last\n";
$string = substr_replace($string ,"",-1); # remove last char from string
};
return $string;
}; # function title_plus7( $string ){
// reduce more than one space character to exact one space char
function trim_spaces( $string ){
$string = preg_replace('/\s\s+/', '+', $string);
$string = preg_replace('/\++/', '+', $string);
$string = ereg_replace("[ \t\n\r]+", "+", $string);
$tmp = $string;
$flet = substr($tmp, 0,1); # get first char
$last = $tmp[strlen($tmp)-1]; # get last char
if ( preg_match("/\+/", $flet ) ) {
#echo "PLus sign in front\n";
$string = substr($string, 1);
};
if ( preg_match("/\+/", $last ) ) {
#echo "PLus sign at last\n";
$string = substr_replace($string ,"",-1); # remove last char from string
};
return str_replace("+"," ",$string);
}; # function trim_spaces( $string ){
// helper function for file_backread()
function __file_backread_helper(&$haystack,$needle,$x) {
$pos=0;$cnt=0;
while( $cnt < $x && ($pos=strpos($haystack,$needle,$pos)) !==false ){$pos++;$cnt++;}
return $pos==false ? false:substr($haystack,$pos,strlen($haystack));
}; # function __file_backread_helper(&$haystack,$needle,$x) {
// read last given number of lines from file
function file_backread($file,$lines,&$fsize=0){
$f=fopen($file,'r');
if(!$f)return Array();
$splits=$lines*50;
if($splits>10000)$splits=10000;
$fsize=filesize($file);
$pos=$fsize;
$buff1=Array();
$cnt=0;
while($pos)
{
$pos=$pos-$splits;
if($pos<0){ $splits+=$pos; $pos=0;}
fseek($f,$pos);
$buff=fread($f,$splits);
if(!$buff)break;
$lines -= substr_count($buff, "\n");
if($lines <= 0)
{
$buff1[] = __file_backread_helper($buff,"\n",abs($lines)+1);
break;
}
$buff1[] = $buff;
}
# return str_replace("\r",'',implode('',array_reverse($buff1)));
return implode('',array_reverse($buff1));
}; # function file_backread($file,$lines,&$fsize=0){
// get current full url
function selfURL(){
if(!isset($_SERVER['REQUEST_URI'])){
$serverrequri = $_SERVER['PHP_SELF'];
} else{
$serverrequri = $_SERVER['REQUEST_URI'];
};
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return "http://".$_SERVER['SERVER_NAME'].$port.$serverrequri;
}; # function selfURL(){
// generate html tail of web document
function GenerateTail(){
$CloundTagCountEnries = 35;
$KeyWordStoreDir = date("n.Y");
$KeywordDate = date("j.n.Y");
$FileStorePath = LOGLINKSSTORE."/" . $KeyWordStoreDir ."/". $KeywordDate . ".".LOGNORMALSUFIX.".txt"; // linux version
$stringCloud = file_backread($FileStorePath, $CloundTagCountEnries+1); // functions.inc.php
$arrayCloud = explode("\n",$stringCloud );
shuffle($arrayCloud);
printTagCloud($arrayCloud); // functions.inc.php und normale suchanfragen verlinken
/*
echo <<
Latest indexed Torrent Files
END;
$SqlQuery = _buildQueryTop1000(); # sql.inc.php
$MySqlArray = doSQLQuery( $SqlQuery );
$min_size = 11; // min font size in %
$max_size = 36; // max font size in %
$max_entry = 25;
if ( $MySqlArray ) {
$count = 0;
while( $sql_results = mysql_fetch_array($MySqlArray)) {
if ( $count < $max_entry ){
$desc = $sql_results["DESC"];
$id = $sql_results["ID"];
$url_desc = strtolower(title_plus($desc));
$size = rand($min_size, $max_size) . "px;";
//$rageurl = "http://www.torrentrage.com/$id/download/$url_desc".".html";
$rageurl = "http://www.torrentrage.com/torrent/$url_desc.html";
echo "- $desc
| ";
}; // if ( $count < $max_entry ){
$count++;
}; // while( $sql_results = mysql_fetch_array($MySqlArray)) {
}; // if ( $MySqlArray ) {
echo "
";
*/
$currentmonate = mktime(0, 0, 0, date("m"), date("j"), date("Y"));
$einsbackmonate = mktime(0, 0, 0, date("m")-1, date("j"), date("Y"));
$zweibackmonate = mktime(0, 0, 0, date("m")-2, date("j"), date("Y"));
$eins = date("m-Y", $currentmonate);
$zwei = date("m-Y", $einsbackmonate);
$drei = date("m-Y", $zweibackmonate);
echo <<