".''.$line.''; } else { /* bar */ $line = ereg_replace( "^<([^&]*)>(.*)", '<\\1>\\2', $line ); /* -+- foo bar */ $line = ereg_replace( "^-\+- ([^&]*)(.*)", '-+- \\1\\2', $line ); /* -*- foo bar */ $line = ereg_replace( "^-\*- ([^&]*)(.*)", '-*- \\1\\2', $line ); /* * foo bar */ $line = ereg_replace( "^\* ([^&]*)(.*)", '* \\1\\2', $line ); $string .= $br.$line; $br = "
\n"; } } return $string; } function boxify($string) { if($string=="") { return; } ?>

vote: [ MegA-SuX0r | naze!!! | mouais | hahaha, lol | ROx0r dA W0rlD ] 0)?'+':'')."$karma[0] ($karma[1] vote".(($karma[1]!=1)?'s':'').")"; ?>

$count) $top = $count; } else if(ereg('^[0-9][0-9]*(-a|-b|-c|-d|-e)$',$q)) { $result = ereg_replace("[0-9]","",$q); $q = ereg_replace("[^0-9]","",$q); if($q >= 1 && $q <= $count) { $hostname = gethostbyaddr($_SERVER["REMOTE_ADDR"]); $fd = fopen("karma/$q","a"); fwrite($fd, $hostname.":".$result."\n"); fclose($fd); header("Location: http://".$_SERVER["HTTP_HOST"]."/random"); die(); } $q = ""; } else if(ereg("^[0-9][0-9]*$",$q)) { if($q >= 1 && $q <= $count) { $n = $q; $q = ""; } } else if ($q == "random.txt") { header("Content-Type: text/plain; charset=utf-8"); $n = get_random($count); $array=$fortune[$n]; for($i=0; $i;:,.!()|_]*","",$q); } if ($q == "" && $n == "") { $n = get_random($count); } header("Content-Type: text/html; charset=utf-8"); ?> Sam's #linuxfr fortune cookies <?php if($top) { echo "- top $top"; } else if($n == "") { echo "- search for ".htmlspecialchars($q); } else { echo "#$n"; } ?>

#linuxfr fortune cookies - top

#linuxfr fortune cookie - search for

#linuxfr fortune cookie (/)

[ home ] [ 1) { ?> first first | 1) { ?> prev prev | random | next next | last last ]

$tab[$j][1]) { $a = $tab[$j][0]; $b = $tab[$j][1]; $tab[$j][0] = $tab[$j + 1][0]; $tab[$j][1] = $tab[$j + 1][1]; $tab[$j + 1][0] = $a; $tab[$j + 1][1] = $b; } } } /* Top x */ for($i = 0; $i < $top; $i++) { $j = $tab[$i][0]; echo "
".boxify(format_fortune($fortune[$count - $j]))."
"; print_karma($j); } } else if ($n != "") { echo "
".boxify(format_fortune($fortune[$count - $n])); print_karma($n); echo "
"; } else { /* Special case: *foo* becomes [[:<]]foo[[:>:]] (\ in grep-style) */ $q = ereg_replace("^\\*([^*]*)\\*$", "[[:<:]]\\1[[:>:]]", $q); /* Check that the regexp is valid */ $olderr = error_reporting(); error_reporting(0); $valid=ereg_replace("$q", "foo", "bar"); error_reporting($olderr); if($valid=="") { echo "

invalid regexp

"; } else { $found = 0; $lastfound = 0; for($i = 0; $i < $count; $i++) { for($j = 0; $j < count($fortune[$i]); $j++) { if(eregi($q, $fortune[$i][$j])){ echo "
".boxify(format_fortune($fortune[$i]))."
"; $found++; $lastfound = $count - $i; break; } } } if(!$found) { echo "

no matches found

"; } else if ($found == 1) { print_karma($lastfound); } } } ?>