Version 0.7

This commit is contained in:
nemunaire 2007-11-20 12:00:00 +01:00
commit c117da6d77
148 changed files with 1914 additions and 801 deletions

View file

@ -14,7 +14,7 @@ function vais_tempsDeplacement($start_galaxie,$start_ss,$start_position,$end_gal
}
function vais_conso($tempsDeplacement,$nbvais = 1){
return intval($tempsDeplacement*11.5*$nbvais);
return intval($tempsDeplacement*$nbvais/20);
}
function vais_tempsArrivee($start_time,$start_galaxie,$start_ss,$start_position,$end_galaxie,$end_ss,$end_position,$vitesse,$chauffe = 0){
@ -53,4 +53,78 @@ function trouvNom($id_user){
$resultat = mysql_fetch_array($req);
return $resultat['pseudo'];
}
function separerNombres($nombre) {
$j=0;
$lgr=strlen($nombre);
$chaine = '';
for($i = $lgr-1; $i >= 0; $i--) {
$chaine .= substr($nombre,$i,1);
$j+=1;
if($j == 3 and $i >0) {
$chaine .= ".";
$j = 0;
}
}
$nombre="";
$lgr=strlen($chaine);
$j=$lgr;
for($i = $lgr+1; $i > 0; $i--) {
$nombre .= substr($chaine,$j,1);
$j -=1;
}
return $nombre;
}
function bbcode($text) {
$text = htmlentities($text);
$text = nl2br($text);
$text = str_replace("[b]", "<b>", $text);
$text = str_replace("[/b]", "</b>", $text);
$text = str_replace("[u]", "<u>", $text);
$text = str_replace("[/u]", "</u>", $text);
$text = str_replace("[i]", "<i>", $text);
$text = str_replace("[/i]", "</i>", $text);
$text = str_replace("[center]", "<center>", $text);
$text = str_replace("[/center]", "</center>", $text);
$text = str_replace(" ", "&nbsp;&nbsp;", $text);
$patterns = array();
$replacements = array();
$patterns[] = "#\[img\](.*?)\[/img\]#si";
$replacements[] = "<img src=\"\\1\" border=\"0\" />";
$patterns[] = "#\[quote=(.*?)\](.*?)\[/quote\]#si";
$replacements[] = "<div class=\"centre\"><table width=\"90%\" border=\"1\" color=\"#C6C6C6\" bgcolor=\"#4D4D4D\" style=\"margin-left: auto; margin-right: auto;\"><tr><td><b><i><font color=\"#C6C6C6\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\\1 à dit :</i></b><br><i>\\2 </i></font></td></tr></table></div>";
$patterns[] = "#\[color=(.*?)\](.*?)\[/color\]#si";
$replacements[] = "<font color=\"\\1\">\\2</font>";
$patterns[] = "#\[quote\](.*?)\[/quote\]#si";
$replacements[] = "<div class=\"centre\"><table width=\"90%\" border=\"1\" color=\"#C6C6C6\" bgcolor=\"#4D4D4D\" style=\"margin-left: auto; margin-right: auto;\"><tr><td><i><font color=\"#C6C6C6\">\\1</font></i></td></tr></table></div>";
$patterns[] = "#\[url\]([a-z0-9]+?://){1}([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\[/url\]#is";
$replacements[] = "<a href=\"\1\2\" target=\"_blank\" class=\"postlink\">\1\2</a>";
$patterns[] = "#\[url\]((www|ftp)\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\[/url\]#si";
$replacements[] = "<a href=\"http://\\1\" target=\"_blank\" class=\"postlink\">\\1</a>";
$patterns[] = "#\[url=([a-z0-9]+://)([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\](.*?)\[/url\]#si";
$replacements[] = "<a href=\"\\1\\2\" target=\"_blank\">\\6</a>";
$patterns[] = "#\[url=(([\w\-]+\.)*?[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\](.*?)\[/url\]#si";
$replacements[] = "<a href=\"http://\\1\" target=\"_blank\">\\5</a>";
$patterns[] = "#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
$replacements[] = "<a href=\"mailto:\\1\">\\1</A>";
return preg_replace($patterns, $replacements, $text);
}
?>