1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
<?PHP
function hiddenField($var,$value=""){
global $$var;
if ($value==""){
$value=$$var;
}
return '<input type="hidden" name="'.$var.'" value="'.$value.'">';
}
function randID(){
srand((double)microtime()*1000000);
for ($i=0;$i<7;$i++){
if ($i==0){
$randval.=rand(1,9);
}else{
$randval.=rand(0,9);
}
}
return $randval;
}
function smiley($s){
global $skinroot;
$s=eregi_replace('(:\)\))', "<img src=\"".$skinroot."smiley_super.gif"."\" width=\"15\" height=\"15\">", $s);
$s=eregi_replace('(:-\)\))', "<img src=\"".$skinroot."smiley_super.gif"."\" width=\"15\" height=\"15\">", $s);
$s=eregi_replace('(:\))', "<img src=\"".$skinroot."smiley_content.gif"."\" width=\"15\" height=\"15\">", $s);
$s=eregi_replace('(:-\))', "<img src=\"".$skinroot."smiley_content.gif"."\" width=\"15\" height=\"15\">", $s);
$s=eregi_replace('(:\(\()', "<img src=\"".$skinroot."smiley_trestriste.gif"."\" width=\"15\" height=\"15\">", $s);
$s=eregi_replace('(:-\(\()', "<img src=\"".$skinroot."smiley_trestriste.gif"."\" width=\"15\" height=\"15\">", $s);
$s=eregi_replace('(:\()', "<img src=\"".$skinroot."smiley_triste.gif"."\" width=\"15\" height=\"15\">", $s);
$s=eregi_replace('(:-\()', "<img src=\"".$skinroot."smiley_triste.gif"."\" width=\"15\" height=\"15\">", $s);
$s=eregi_replace('(:p)', "<img src=\"".$skinroot."smiley_grimace.gif"."\" width=\"15\" height=\"15\">", $s);
$s=eregi_replace('(:-p)', "<img src=\"".$skinroot."smiley_grimace.gif"."\" width=\"15\" height=\"15\">", $s);
return $s;
}
function getParent($num){
global $id;
$query="Select parent from cats WHERE num=$num";
$result = mysql_query($query);
$row=mysql_fetch_row($result);
mysql_freeresult($result);
list($parent)=$row;
return $parent;
}
function getNom($num){
global $id;
$query="Select nom from cats WHERE num=$num";
$result = mysql_query($query);
$row=mysql_fetch_row($result);
mysql_freeresult($result);
list($nom)=$row;
if ($nom=="zzAutres") $nom="Autres";
//$nom=eregi_replace(" ", " ", $nom);
return $nom;
}
function haveChild($num){ //Utilisé pour savoir si il y aura une sous catégories
global $id;
$query="Select num from cats WHERE parent=$num";
$result = mysql_query($query);
$count=mysql_num_rows($result);
mysql_freeresult($result);
if ($count != 0) return true;
return false;
}
function getList($lst,$sep){
$i=0;
$p1=0;
$p2=0;
$seplen=strlen($sep);
$lst.=$sep;
while(1){
$p2=strpos($lst,$sep,$p1);
if (is_string($p2) && !$p2){
break;
}
$newstr=substr($lst,$p1,$p2-$p1);
if ($newstr != ""){
$ab[$i]=$newstr;
$i++;
}
$p1=$p2+$seplen;
}
return $ab;
}
?> |
Partager