host,$this->user,$this->pass) or die("Impossible de se connecter à la base de données"); @mysql_select_db("$this->bdd") or die("Impossible de se connecter à la base de données"); } function query($query) { global $NBRequest; $msql=mysql_query($query); if($msql) $NBRequest++; else { echo(mysql_error()."
"); echo($query."

"); } return($msql); } function list_tables() { $msql=mysql_list_tables($this->bdd); return($msql); } } // ******************************************************** // * CLASSE DE TEMPLATES * // ******************************************************** class Template { var $isloaded = array(); var $tplcode = array(); var $temp = array(); var $tmp = array(); var $box = array(); var $infomember = array(); var $globales = array(); // chaines des globables pour eval() var $LNG = array(); //tableau langages function evalue($name) { $glob = ""; if(!empty($this->globales[$name])) $glob = "global \$".$this->globales[$name].";"; $templ = $this->tplcode[$name]; eval("$glob \$templ=\"$templ\";"); return($templ); } function forme($templ) { $templ = preg_replace("'\/\*(.*?)\*\/'si","",$templ); // On supprimer les commentaires $templ = addslashes(addslashes($templ)); // double backslash // **** evaluation des variables de langages **** if(get_magic_quotes_runtime()==0) $templ = addslashes($templ); // 1 backslash $templ = str_replace("\$","\\\\\\\\\\\\\\$",$templ);//\\\$ $templ = preg_replace("/{%LNG\[([^\[]+)\]%}/","\".\$this->LNG['\\1'].\"",$templ); // On transforme les variables de langage eval("\$templ=\"$templ\";"); // **** éclatement du fichier **** $tpleclate = explode("",$tpleclate[$i]); $tplname = $temp[0]; $this->tplcode[$tplname]=$temp[1]; $this->tplcode[$tplname]=preg_replace("/^(\r\n)+/","",$this->tplcode[$tplname]); preg_match_all("/{%::(.*?)%}/",$this->tplcode[$tplname],$out,PREG_PATTERN_ORDER); if(count($out[1])>0) { for($j=0;$j<(count($out[1]));$j++) { $out[1][$j] = preg_replace("'\[(.*?)\]'","",$out[1][$j]); $tabl[$out[1][$j]] = $out[1][$j]; } $this->globales[$tplname] = implode(",\$",$tabl); } $this->tplcode[$tplname] = preg_replace("/{%([^\[]+)\[([^\]]+)\]%}/","{%\\1['\\2']%}", $this->tplcode[$tplname]); $this->tplcode[$tplname] = preg_replace("/{%::(.*?)%}/","\".\$\\1.\"",$this->tplcode[$tplname]); // On transforme les variables globales $this->tplcode[$tplname] = preg_replace("/{%(.*?)%}/","\".\$this->\\1.\"",$this->tplcode[$tplname]); // On transforme les variables de classe unset($out); } } function gettemplate($filename,$tpl) { if(empty($this->isloaded[$filename])) $this->loadfile($filename); $chaine = $this->evalue($tpl); return($chaine); } function loadfile($file) { global $_SKIN,$_SERVER; if(ereg("admin/",$_SERVER['REQUEST_URI'])) $prefix="../"; else $prefix=""; $temp = implode("",file($prefix."templates/".$_SKIN['reptpl']."/tpl_".$file.".html")); $this->forme($temp); $this->isloaded[$file] = true; } function attlang($param) { return($this->LNG[$param]); } function output($tmpl) { echo(stripslashes(stripslashes($tmpl))); } } // ******************************************************** // * FONCTIONS SYSTEMES * // ******************************************************** function get_microtime() { list($tps_usec, $tps_sec) = explode(" ",microtime()); return ((float)$tps_usec + (float)$tps_sec); } function get_rightfromint($tableau,$int) { $i = 20; $Mask = 1 << $i; while($Mask>0) { if($int >= $Mask) { $tableau[$i] = 'true'; $int -= $Mask; } $Mask = $Mask >> 1; $i--; } return($tableau); } function get_intfromright($tableau) { $i = 1; $int = 0; foreach($tableau as $key => $value) { if($value == 'true') $int += $i << $key; } return($int); } function addToArray(&$array, $key, $val) { $tempArray = array($key => $val); $array = array_merge ($array, $tempArray); } function array_rempl(&$array, $start, $end, $value) { for($i = $start; $i < $end+1; $i++) $array[$i] = $value; } function stopaction($msg='') { if(strlen($msg) > 0) echo("> $msg"); else echo("script stoppé"); die; } //********** FONCTION GESTION MESSAGES D'ERREUR ********** function geterror($error) { global $tpl,$cache,$_FORUMCFG,$tps,$tps_start,$_PRE; getlangage("error"); if($error == "closedforum") $tpl->box['errorcontent'] = $_FORUMCFG['closeforummsg']; elseif($error == "initcookie") { sendcookie("CoolForumID","",0); sendcookie("listeforum_coolforum","",0); sendcookie("nbpmvu","0",-1); $sql = mysql_query("SELECT forumid FROM ".$_PRE."forums"); $nb = mysql_numrows($sql); if($nb>0) { while($j = mysql_fetch_array($sql)) { $name = "CoolForumDetails".$j['forumid']; sendcookie($name,"",0); } } sendcookie("CF_LastINI",time(),-1); $tpl->box['errorcontent'] = $tpl->gettemplate("error","initcookie"); } else $tpl->box['errorcontent'] = $tpl->gettemplate("error",$error); $cache .= $tpl->gettemplate("error","errorbox"); $tps = number_format(get_microtime() - $tps_start,4); $cache .= $tpl->gettemplate("baspage","endhtml"); $tpl->output($cache); exit; } //********** FONCTION D'ENVOI DE COOKIES ********** function sendcookie($name,$value,$expire) { global $_FORUMCFG; if($expire==-1) $expire=mktime(0,0,0,1,1,2010); if(empty($_FORUMCFG['cookiedomain'])) setcookie($name,$value,$expire,$_FORUMCFG['cookierep']); else setcookie($name,$value,$expire,$_FORUMCFG['cookierep'],".".$_FORUMCFG['cookiedomain']); } //********** FONCTION D'ENVOI DE MAILS ********** function sendmail($To,$Subject,$Msg) { global $_FORUMCFG; switch ($_FORUMCFG['mailfunction']) { case "normal": if(!mail($To,$Subject,$Msg,"From: ".inversemail($_FORUMCFG['contactmail'])."\nReply-To: ".inversemail($_FORUMCFG['contactmail'])."\nX-Priority: 1")) return false; break; case "online": if(!email("webmaster",$To,$Subject,$Msg)) return false; break; case "nexen": if(!email($To,$Subject,$Msg,"From: ".inversemail($_FORUMCFG['contactmail']))) return false; break; } return true; } //********** FONCTIONS ENCODAGE/DECODAGE ********** function getencrypt($txt,$cle) { srand((double)microtime()*1000000); $getencrypt_key = md5(rand(0,32000)); $ctr=0; $tmp = ""; for ($i=0;$iquery("SELECT * FROM ".$_PRE."config"); while($j=mysql_fetch_array($result)) { $tableau[$j['options']]=$j['valeur']; } $tableau['catseparate']=htmlentities($tableau['catseparate']); return($tableau); } function getlangage($file) { global $_USER,$_FORUMCFG,$tpl,$_SERVER; if(ereg("admin/",$_SERVER['REQUEST_URI'])) $prefix="../"; else $prefix=""; if(!isset($_USER['lng'])) $lng=$_FORUMCFG['defaultlangage']; else $lng=$_USER['lng']; include($prefix."lng/$lng/lng_$file.php"); } function getforumname($id) { global $_USER, $sql, $_PRE, $_GENERAL; $id = intval($id); $query = $sql->query("SELECT ".$_PRE."forums.forumid,".$_PRE."forums.forumtitle,".$_PRE."forums.forumcat,".$_PRE."forums.openforum,".$_PRE."forums.forumtopic,".$_PRE."forums.forumposts,".$_PRE."categorie.cattitle,".$_PRE."categorie.catid FROM ".$_PRE."forums,".$_PRE."categorie WHERE ".$_PRE."forums.forumid='$id' AND ".$_PRE."categorie.catid=".$_PRE."forums.forumcat"); $nb = mysql_numrows($query); if($nb==0) geterror("novalidlink"); else { $j = mysql_fetch_array($query); if($j['openforum']=="N" && !$_GENERAL[20]) geterror("forumclosed"); else return($j); } } function getnumberpages($nb,$template,$nbmax,&$page) { global $_GET,$nbpages,$_FORUMCFG,$tpl; $chaine=""; /*if (empty($_GET['page'])) $page=1; else $page=$_GET['page'];*/ $nbpages=Ceil($nb/$nbmax); if($nbpages>1) { if($page>1) { $tpl->box['pagebefore']=$page-1; $chaine.=$tpl->gettemplate($template,"leftpagearrowlink"); } else $chaine.=$tpl->gettemplate($template,"leftpagearrow"); if($page<6) $debut=1; else $debut=$page-4; if($nbpages-$page<5) $fin=$nbpages; else $fin=$page+5; for($i=$debut; $i<($fin+1); $i++) { $tpl->box['pagenumber']=$i; if ($i==$page) $chaine.=$tpl->gettemplate($template,"ourpage"); else $chaine.=$tpl->gettemplate($template,"otherpage"); if ($i<$fin) $chaine.=" | "; } if($page<$nbpages) { $tpl->box['pageafter']=$page+1; $chaine.=$tpl->gettemplate($template,"rightpagearrowlink"); } else $chaine.=$tpl->gettemplate($template,"rightpagearrow"); } return($chaine); } function getpagestopic($nb,$id,$page) { global $forumid,$nbpagepost,$_FORUMCFG,$tpl; $chaine=""; $nb++; if(empty($forumid)) $forumid=$tpl->tmp['forumid']; $nbpagepost=Ceil($nb/$_FORUMCFG['msgparpage']); if($nbpagepost>1) { $flagpoint=0; //$chaine.=" (aller page: "; $tpl->box['cachepages'] = ""; for($i=1; $i<($nbpagepost+1); $i++) { if($i>3 && $i<$nbpagepost && $nbpagepost>4) { if($flagpoint==0) { $tpl->box['cachepages'] .=" ..."; $flagpoint=1; } } else { $tpl->tmp['i'] = $i; $tpl->tmp['id'] = $id; $tpl->tmp['page'] = $page; //$chaine.=" $i"; $tpl->box['cachepages'] .= $tpl->gettemplate("entete","topicgotopagelink"); } } //$chaine.=")"; $chaine = $tpl->gettemplate("entete","topicgotopage"); } return($chaine); } // #### CHARGEMENT IDENTIFICATION MEMBRE #### function getuserid() { global $_COOKIE, $tpl, $sql, $_FORUMCFG, $_PERMFORUM, $_FORUMINTER, $_PRE, $_GENERAL; $user = array(); $errorset = false; if(isset($_COOKIE['CoolForumID'])) { $j = unserialize(urldecode($_COOKIE['CoolForumID'])); $j['userpass'] = getdecrypt(rawurldecode($j['userpass']),$_FORUMCFG['chainecodage']); $j['userid'] = intval($j['userid']); $query = $sql->query("SELECT ".$_PRE."user.userid, ".$_PRE."user.login AS username, ".$_PRE."user.password, ".$_PRE."user.userstatus, ".$_PRE."user.skin AS userskin, ".$_PRE."user.timezone, ".$_PRE."user.lng, ".$_PRE."user.popuppm, ".$_PRE."user.lastpost, ".$_PRE."user.lastvisit, ".$_PRE."user.nbpmtot, ".$_PRE."user.nbpmvu, ".$_PRE."user.wysiwyg, ".$_PRE."groups.* FROM ".$_PRE."user LEFT JOIN ".$_PRE."groups ON ".$_PRE."groups.id_group = ".$_PRE."user.userstatus WHERE ".$_PRE."user.userid=".$j['userid']); $x = mysql_fetch_array($query); $temppass = getdecrypt(rawurldecode($x['password']),$_FORUMCFG['chainecodage']); if($j['userpass'] == $temppass) { $user = $x; $user['password'] = ""; } else $errorset = true; } else $errorset = true; if($errorset) { $query = $sql->query("SELECT * FROM ".$_PRE."groups WHERE id_group = 1"); $user = mysql_fetch_array($query); $user['username'] = NULLSTR; $user['userstatus'] = 1; $user['userid'] = 0; $user['lastvisit'] = 0; $user['userskin'] = $_FORUMCFG['defaultskin']; $user['timezone'] = $_FORUMCFG['defaulttimezone']; $user['popuppm'] = "N"; $user['lastpost'] = 0; $user['wysiwyg'] = "N"; } // Chargement droits généraux $_GENERAL = get_rightfromint($_GENERAL,$user['Droits_generaux']); // Chargement droits des forums $request = $sql->query("SELECT * FROM ".$_PRE."groups_perm WHERE id_group=".$user['userstatus']); $nb = mysql_numrows($request); if($nb>0) while($i = mysql_fetch_array($request)) { $temp_array = array(); $temp_array = get_rightfromint($temp_array,$i['droits']); $_PERMFORUM[$i['id_forum']] = $temp_array; $_PERMFORUM[$i['id_forum']]['MaxChar'] = $i['MaxChar']; } return($user); } // #### LE MEMBRE EST-IL MODERATEUR POUR CE FORUM? #### function getismodo($forum) { global $_MODORIGHTS, $_USER, $sql, $_PRE, $_GENERAL; array_rempl($_MODORIGHTS,0,8,false); if($_GENERAL[19]) { if($_GENERAL[20]) { $_MODORIGHTS = get_rightfromint($_MODORIGHTS,511); return true; } else { $query = $sql->query("SELECT idusermodo, modorights FROM ".$_PRE."moderateur WHERE idusermodo=".$_USER['userid']." AND forumident='$forum'"); $nb = mysql_numrows($query); if($nb>0) { $j = mysql_fetch_array($query); $_MODORIGHTS = get_rightfromint($_MODORIGHTS,$j['modorights']); return true; } else return false; } } else return false; } // #### CHARGEMENT DES DROITS POUR L'EDITION D'UN MESSAGE #### function getrightedit($idpost,$forumid) { global $_MODORIGHTS, $sql, $_USER, $_FORUMCFG, $_PRE, $_GENERAL, $_PERMFORUM; $query = $sql->query("SELECT idforum,idmembre,parent FROM ".$_PRE."posts WHERE idpost=".$idpost); $j = mysql_fetch_array($query); $ismodo = false; $ismodo = getismodo($forumid); if($_GENERAL[20]) return true; elseif($ismodo && $forumid==$j['idforum']) return true; elseif($_USER['userstatus']>1) { $parent = $j['parent']; if($j['idmembre']==$_USER['userid']) { if(!isset($_PERMFORUM[$forumid][6]) || !$_PERMFORUM[$forumid][6]) { $query = $sql->query("SELECT idpost FROM ".$_PRE."posts WHERE parent='$parent' ORDER BY date DESC"); $i = mysql_fetch_array($query); if($i['idpost']==$idpost) return true; else return false; } else return true; } else return false; } else return false; } function init_session() { srand((double)microtime()*1000000); $session = md5(rand(0,32000)); return($session); } // #### ENREGISTRMEMENT DE LA SESSION POUR CHAQUE MEMBRE / INVITE #### function getsession() { global $_COOKIE, $_USER, $sql, $_PRE, $SessLieu, $SessForum, $SessTopic; $tablename = array(); if(!empty($SessLieu)) { $pseudo = getformatdbtodb($_USER['username']); if(!isset($_COOKIE['CF_sessionID'])) $_COOKIE['CF_sessionID'] = init_session(); $now = time(); $perim = $now - 300; $delsql = $sql->query("DELETE FROM ".$_PRE."session WHERE time<".$perim); $query = $sql->query("SELECT sessionID, username, userid, userstatus, typelieu, forumid, topicid FROM ".$_PRE."session"); $nb = mysql_numrows($query); $found = false; $i = 0; if($nb>0) { while($j=mysql_fetch_array($query)) { if($_USER['userid']>0 && $_USER['username']==$j['username']) // si trouvé membre { $updsess = $sql->query("UPDATE ".$_PRE."session SET sessionID='".$_COOKIE['CF_sessionID']."', time=$now, typelieu='$SessLieu', forumid=$SessForum, topicid=$SessTopic WHERE username='".$pseudo."'"); $tablename[$i]['name'] = $j['username']; $tablename[$i]['status'] = $j['userstatus']; $tablename[$i]['userid'] = $j['userid']; $found = true; $tablename[$i]['typelieu'] = $SessLieu; $tablename[$i]['forumid'] = $SessForum; $tablename[$i]['topicid'] = $SessTopic; } elseif($j['sessionID']==$_COOKIE['CF_sessionID']) // sinon si les sessions concordent => soit invité soit vient de se logguer { $updsess = $sql->query("UPDATE ".$_PRE."session SET username='".$pseudo."', userid=".$_USER['userid'].", userstatus=".$_USER['userstatus'].", time=$now, typelieu='$SessLieu', forumid=$SessForum, topicid=$SessTopic WHERE sessionID='".$_COOKIE['CF_sessionID']."'"); $tablename[$i]['name'] = $_USER['username']; $tablename[$i]['status'] = $_USER['userstatus']; $tablename[$i]['userid'] = $_USER['userid']; $found = true; $tablename[$i]['typelieu'] = $SessLieu; $tablename[$i]['forumid'] = $SessForum; $tablename[$i]['topicid'] = $SessTopic; } else //sinon ce n'est pas moi { $tablename[$i]['name'] = $j['username']; $tablename[$i]['status'] = $j['userstatus']; $tablename[$i]['userid'] = $j['userid']; $tablename[$i]['typelieu'] = $j['typelieu']; $tablename[$i]['forumid'] = $j['forumid']; $tablename[$i]['topicid'] = $j['topicid']; } $i++; } } if(!$found) { $query = $sql->query("INSERT into ".$_PRE."session (sessionID, username, userid, userstatus, time, typelieu, forumid, topicid) VALUES ('".$_COOKIE['CF_sessionID']."','$pseudo', ".$_USER['userid'].",'".$_USER['userstatus']."','$now','$SessLieu','$SessForum','$SessTopic')"); $tablename[$i]['name'] = $_USER['username']; $tablename[$i]['status'] = $_USER['userstatus']; $tablename[$i]['userid'] = $_USER['userid']; $tablename[$i]['typelieu'] = $SessLieu; $tablename[$i]['forumid'] = $SessForum; $tablename[$i]['topicid'] = $SessTopic; $LastINI = intval($_COOKIE['CF_LastINI']); if($_USER['userid'] > 0) $query = $sql->query("UPDATE ".$_PRE."user SET lastvisit = $LastINI WHERE userid = ".$_USER['userid']); } sendcookie("CF_sessionID",$_COOKIE['CF_sessionID'],-1); sendcookie("CF_LastINI",$now,-1); } return($tablename); } function get_connected($Lieu = "",$forumid = 0, $topicid = 0) { global $NombreConnectes, $tpl; $InfoMember['nbmembres'] = 0; $InfoMember['nbguests'] = 0; $InfoMember['nbtotalvisit'] = 0; $NbTotalcon = count($NombreConnectes); $ListMembres = array(); $nameconnect = array(); // **** Définition du nbre de membres et d'invités selon le lieu **** for($i = 0; $i < $NbTotalcon; $i++) { $mbvalid = false; if($Lieu == "TOP" && $Lieu == $NombreConnectes[$i]['typelieu'] && $forumid == $NombreConnectes[$i]['forumid'] && $topicid == $NombreConnectes[$i]['topicid']) $mbvalid = true; elseif($Lieu == "FOR" && ($Lieu == $NombreConnectes[$i]['typelieu'] || $NombreConnectes[$i]['typelieu'] == "TOP") && $forumid == $NombreConnectes[$i]['forumid']) $mbvalid = true; elseif(strlen($Lieu) > 0 && $Lieu != "TOP" && $Lieu != "FOR" && $Lieu == $NombreConnectes[$i]['typelieu']) $mbvalid = true; if(strlen($Lieu) == 0) $mbvalid = true; if($mbvalid) { if(!empty($NombreConnectes[$i]['name'])) { $InfoMember['nbmembres']++; $ListMembres[] = $i; } else $InfoMember['nbguests']++; } } $InfoMember['nbtotalvisit'] = $InfoMember['nbmembres'] + $InfoMember['nbguests']; // **** Formattage des membres pour affichage **** if($InfoMember['nbmembres']>0) { foreach($ListMembres as $val) $nameconnect[] = "".getformatpseudo($NombreConnectes[$val]['name'],$NombreConnectes[$val]['status'],$NombreConnectes[$val]['userid']).""; $InfoMember['listconnected'] = implode(", ",$nameconnect); } return($InfoMember); } function getjumpforum($template="entete") { global $_USER, $tpl, $sql, $_PRE, $_PERMFORUM; $query = $sql->query("SELECT * FROM ".$_PRE."categorie ORDER BY catorder"); $nb = mysql_numrows($query); $tpl->box['forumlist'] = ""; if($nb>0) { $sqlforums = $sql->query("SELECT forumid,forumcat,forumtitle FROM ".$_PRE."forums ORDER BY forumcat,forumorder"); $nbforums = mysql_numrows($sqlforums); if($nbforums>0) while($TabForum[] = mysql_fetch_array($sqlforums)); $i = 0; while($Cats = mysql_fetch_array($query)) { $chaine = ""; for($i = 0; $i < count($TabForum); $i++) { if($Cats['catid'] == $TabForum[$i]['forumcat'] && !empty($_PERMFORUM[$TabForum[$i]['forumid']][0]) && $_PERMFORUM[$TabForum[$i]['forumid']][0]) { $tpl->box['FJforumname']=getformatrecup($TabForum[$i]['forumtitle']); $tpl->box['FJforumid']=$TabForum[$i]['forumid']; $chaine.=$tpl->gettemplate($template,"forumjumpfor"); } } if(strlen($chaine)>0) { $tpl->box['FJcatname']=getformatrecup($Cats['cattitle']); $tpl->box['forumlist'].=$tpl->gettemplate($template,"forumjumpcat").$chaine; } } $tpl->box['forumjump']=$tpl->gettemplate($template,"structforumjump"); } } function getskin() { global $_SKIN, $_USER, $sql, $_POST, $_FORUMCFG, $_PRE, $ListColorGroup; if($_FORUMCFG['defaultskin']<$_USER['userskin']) $order="DESC"; else $order="ASC"; $query=$sql->query("SELECT propriete,valeur FROM ".$_PRE."skins WHERE id=".$_USER['userskin']." OR id=".$_FORUMCFG['defaultskin']." ORDER BY id ".$order); while(list($skcle,$skvalue)=mysql_fetch_array($query)) { if(empty($_SKIN[$skcle])) addToArray($_SKIN,$skcle,$skvalue); //$_SKIN[$skcle]=$skvalue; if(ereg("^grp",$skcle)) $ListColorGroup[] = intval(str_replace("grp","",$skcle)); } if(!empty($_POST['skins']) && count($_POST['skins'])>0 && isset($_POST['act']) && $_POST['act']=="preview") { for($i=0;$i0) if(empty($_SKIN[$skcle])) addToArray($_SKIN,$valeur['key'],$valeur['value']); else $_SKIN[$valeur['key']]=$valeur['value']; } } } function getloadsmileys() { global $sql,$_PRE; $query=$sql->query("SELECT imgsmile,codesmile FROM ".$_PRE."smileys ORDER BY ordersmile ASC"); $i=0; while($j=mysql_fetch_array($query)) { $tplable_smileys[$i]['code']=getformatrecup($j['codesmile']); $tplable_smileys[$i]['img']=$j['imgsmile']; $i++; } return($tplable_smileys); } function getreturnsmilies($msg) { global $table_smileys,$_SERVER; if(ereg("admin/",$_SERVER['REQUEST_URI'])) $prefix="../"; else $prefix=""; for($i=0;$i", $msg); } return($msg); } function InitBBcode() { global $BBcodeHTML,$tpl, $_FORUMCFG, $ListWords, $ListWordsRpl; $BBcodeHTML['codeopen'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbcodeopen")))); $BBcodeHTML['codeclose'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbcodeclose")))); $BBcodeHTML['urlauto1'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bburlauto1")))); $BBcodeHTML['urlauto2'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bburlauto2")))); $BBcodeHTML['swf'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbswf")))); $BBcodeHTML['mail'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbmail")))); $BBcodeHTML['img'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbimg")))); $BBcodeHTML['bold'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbbold")))); $BBcodeHTML['ita'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbita")))); $BBcodeHTML['under'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbunder")))); $BBcodeHTML['center'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbcenter")))); $BBcodeHTML['left'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbleft")))); $BBcodeHTML['right'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbright")))); $BBcodeHTML['fontopen'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbfontopen")))); $BBcodeHTML['fontclose'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbfontclose")))); $BBcodeHTML['sizeopen'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbsizeopen")))); $BBcodeHTML['sizeclose'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbsizeclose")))); $BBcodeHTML['coloropen'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbcoloropen")))); $BBcodeHTML['colorclose'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbcolorclose")))); $BBcodeHTML['url'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bburl")))); $BBcodeHTML['quoteopen'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbquoteopen")))); $BBcodeHTML['quoteclose'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","bbquoteclose")))); $BBcodeHTML['msgcache1'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","msgcache1")))); $BBcodeHTML['msgcache2'] = trim(stripslashes(stripslashes($tpl->gettemplate("entete","msgcache2")))); if(strlen($_FORUMCFG['censuredwords'])>0) { $Rpl="**************************************************************************************************"; $ListWords = explode(", ",$_FORUMCFG['censuredwords']); for($i=0;$i0) return(str_replace($SearchOrig,$SearchReplace,$chain)); else return($chain); } // ******************************************************* // * FONCTIONS WYSIWYG * // ******************************************************* function get_htmlmoztocss($color) { $color = strtolower($color); switch($color) { case 'aqua': $rgb = '0, 255, 255'; break; case 'black': $rgb = '0, 0, 0'; break; case 'blue': $rgb = '0, 0, 255'; break; case 'fuchsia': $rgb = '255, 0, 255'; break; case 'gray': $rgb = '128, 128, 128'; break; case 'green': $rgb = '0, 128, 0'; break; case 'lime': $rgb = '0, 255, 0'; break; case 'maroon': $rgb = '128, 0, 0'; break; case 'navy': $rgb = '0, 0, 128'; break; case 'olive': $rgb = '128, 128, 0'; break; case 'purple': $rgb = '128, 0, 128'; break; case 'red': $rgb = '255, 0, 0'; break; case 'silver': $rgb = '192, 192, 192'; break; case 'teal': $rgb = '0, 128, 128'; break; case 'white': $rgb = '255, 255, 255'; break; case 'yellow': $rgb = '255, 255, 0'; break; default: $array_dec = array(); $color = substr($color,1,strlen($color)); $array_dec[0] = hexdec(substr($color,0,2)); $array_dec[1] = hexdec(substr($color,2,2)); $array_dec[2] = hexdec(substr($color,4,2)); $rgb = implode(", ",$array_dec); break; } $text = ""; return($text); } // #### PARSER CSS #### function css_process($chaine, $statut='') { static $close_tag = ""; $to_return = ""; if($statut == 'open') { if(NAVIGATEUR == "MOZILLA") { $css = preg_replace("/<(span|font|br) (.*?)>/si","\\2",$chaine); $css = str_replace("\" ","\"----",$css); $temp_options = explode("----",$css); foreach($temp_options AS $html_options) { if(substr($html_options,0,6) == "style=") { $html_options = preg_replace("/style=\"(.*?);\"/si","\\1",$html_options); $temp_array = explode("; ",$html_options); foreach($temp_array AS $value) { switch ($value) { case 'font-weight: bold' : $to_return .= '[bold]'; $close_tag = '[/bold]'.$close_tag; break; case 'font-style: italic' : $to_return .= '[ita]'; $close_tag = '[/ita]'.$close_tag; break; case 'text-decoration: underline' : $to_return .= '[under]'; $close_tag = '[/under]'.$close_tag; break; default : if(substr($value,0,11)=="font-family") { $font = preg_replace("/font-family: (.*?)/si","\\1",$value); $to_return .= '[font='.$font.']'; $close_tag = '[/font]'.$close_tag; } if(substr($value,0,5)=="color") { $decstring = preg_replace("/color: rgb\((.*?)\)/","\\1",$value); $array_dec = explode(", ",$decstring); $hexstring = ""; foreach($array_dec AS $dec_value) { $tempvalue = dechex($dec_value); if(strlen($tempvalue)==1) $tempvalue = "0".$tempvalue; $hexstring .= $tempvalue; } $to_return .= '[color=#'.$hexstring.']'; $close_tag = '[/color]'.$close_tag; } break; } } } elseif(substr($html_options,0,5) == "size=") { $html_options = preg_replace("/size=\"(.*?)\"/si","\\1",$html_options); $to_return .= '[size='.$html_options.']'; $close_tag = '[/size]'.$close_tag; } } } elseif(NAVIGATEUR == "MSIE") { $css = preg_replace("//si","\\1",$chaine); $temp_options = explode(" ",$css); foreach($temp_options AS $html_options) { if(substr($html_options,0,5) == "face=") { $html_options = preg_replace("/face=(.*?)/si","\\1",$html_options); $to_return .= '[font='.$html_options.']'; $close_tag = '[/font]'.$close_tag; } elseif(substr($html_options,0,5) == "size=") { $html_options = preg_replace("/size=(.*?)/si","\\1",$html_options); $to_return .= '[size='.$html_options.']'; $close_tag = '[/size]'.$close_tag; } elseif(substr($html_options,0,6) == "color=") { $html_options = preg_replace("/color=(.*?)/si","\\1",$html_options); $to_return .= '[color='.$html_options.']'; $close_tag = '[/color]'.$close_tag; } } } } elseif($statut == 'close') { $to_return = $close_tag; $close_tag = ""; } else $to_return = $chaine; return($to_return); } // #### PARSER BALISE DIV #### function div_process($chaine, $statut='') { static $active_tag = ""; if($statut == 'open') { $chaine = preg_replace("/

/si","\\1",$chaine); $chaine = str_replace("\"","",$chaine); // **** si CODE **** if(ereg("class=code_class",$chaine)) { $active_tag = "code"; return("[code]"); } // **** si QUOTE **** elseif(ereg("class=quote_class",$chaine)) { $active_tag = "quote"; return("[quote]"); } // **** si ALIGN **** elseif(ereg("text-align",$chaine)) { $chaine = preg_replace("/style=text-align: (.*?);/si","\\1",$chaine); switch($chaine) { case 'left': $active_tag = "left"; $to_return = "[left]"; break; case 'center': $active_tag = "center"; $to_return = "[center]"; break; case 'right': $active_tag = "right"; $to_return = "[right]"; break; } return($to_return); } } elseif($statut == 'close') { $to_return = ""; switch($active_tag) { case 'code': $to_return = "[/code]"; break; case 'quote': $to_return = "[/quote]"; break; case 'left': $to_return = "[/left]"; break; case 'center': $to_return = "[/center]"; break; case 'right': $to_return = "[/right]"; break; } $active_tag = ""; return($to_return); } else return($chaine); } function code_process($chaine, $statut='') { global $BBcodeHTML; if($statut == 'open') return($BBcodeHTML['codeopen']); elseif($statut == 'close') return($BBcodeHTML['codeclose']); else return(strip_tags($chaine)); } function quote_process($chaine, $statut='') { global $BBcodeHTML; if($statut == 'open') return($BBcodeHTML['quoteopen']); elseif($statut == 'close') return($BBcodeHTML['quoteclose']); else return($chaine); } function color_process($chaine, $statut='') { global $BBcodeHTML; if($statut == 'open') { $chaine = preg_replace("/\[color=(.*?)\]/si",$BBcodeHTML['coloropen'],$chaine); return($chaine); } elseif($statut == 'close') return($BBcodeHTML['colorclose']); else return($chaine); } function size_process($chaine, $statut='') { global $BBcodeHTML; if($statut == 'open') { $chaine = preg_replace("/\[size=(.*?)\]/si",$BBcodeHTML['sizeopen'],$chaine); return($chaine); } elseif($statut == 'close') return($BBcodeHTML['sizeclose']); else return($chaine); } function font_process($chaine, $statut='') { global $BBcodeHTML; if($statut == 'open') { $chaine = preg_replace("/\[font=(.*?)\]/si",$BBcodeHTML['fontopen'],$chaine); return($chaine); } elseif($statut == 'close') return($BBcodeHTML['fontclose']); else return($chaine); } function code_edit_process($chaine, $statut='') { global $_SKIN; if($statut == 'open') { if(NAVIGATEUR == "MSIE") $chaine = "
"; elseif(NAVIGATEUR == "MOZILLA") $chaine = "
"; } elseif($statut == 'close') $chaine = "

"; else { if(NAVIGATEUR == "MSIE") $chaine = str_replace("
","
",$chaine); $chaine = str_replace(" "," ",$chaine); $chaine = htmlentities($chaine); if(NAVIGATEUR == "MSIE") $chaine = str_replace("<br>","
",$chaine); } return($chaine); } function quote_edit_process($chaine, $statut='') { global $_SKIN; if($statut == 'open') { if(NAVIGATEUR == "MSIE") $chaine = "
"; elseif(NAVIGATEUR == "MOZILLA") $chaine = "
"; } elseif($statut == 'close') $chaine = "

"; return($chaine); } function font_edit_process($chaine, $statut='') { global $_SKIN; if($statut == 'open') { if(NAVIGATEUR == "MSIE") $chaine = preg_replace("/\[font=(.*?)\]/si","",$chaine); elseif(NAVIGATEUR == "MOZILLA") $chaine = preg_replace("/\[font=(.*?)\]/si","",$chaine); } elseif($statut == 'close') $chaine = ""; return($chaine); } function size_edit_process($chaine, $statut='') { global $_SKIN; if($statut == 'open') { if(NAVIGATEUR == "MSIE") $chaine = preg_replace("/\[size=(.*?)\]/si","",$chaine); elseif(NAVIGATEUR == "MOZILLA") $chaine = preg_replace("/\[size=(.*?)\]/si","",$chaine); } elseif($statut == 'close') $chaine = ""; return($chaine); } function color_edit_process($chaine, $statut='') { global $_SKIN; if($statut == 'open') { if(NAVIGATEUR == "MSIE") $chaine = preg_replace("/\[color=(.*?)\]/si","",$chaine); elseif(NAVIGATEUR == "MOZILLA") $chaine = preg_replace("/\[color=(.*?)\]/sie","get_htmlmoztocss('\\1')",$chaine); } elseif($statut == 'close') { if(NAVIGATEUR == "MSIE") $chaine = ""; elseif(NAVIGATEUR == "MOZILLA") $chaine = ""; } return($chaine); } // #### PARSER HTML #### function parser($tableau, $chaine) { $tabl = preg_split("/(".$tableau['open']."|".$tableau['close'].")/si", $chaine, -1, PREG_SPLIT_DELIM_CAPTURE); $process_list = array(); $start = array(); $niv = 0; foreach($tabl AS $key => $value) { if(preg_match("/".$tableau['open']."/si",$value) == 1) { $niv++; $start[$niv] = $key; } elseif(preg_match("/".$tableau['close']."/si",$value) == 1) { if(isset($start[$niv])) { $end = $key; $tabl[$start[$niv]] = $tableau['function']($tabl[$start[$niv]],'open'); if(strlen($tableau['function']) > 0 && !in_array($key, $process_list)) { for($i = $start[$niv]+1; $i < $end; $i++) { $tabl[$i] = $tableau['function']($tabl[$i]); $process_list[] = $i; } } $tabl[$end] = $tableau['function']($tabl[$end],'close'); $process_list[] = $start[$niv]; $process_list[] = $end; unset($start[$niv]); $niv--; } } } return(implode("",$tabl)); } // ########################################################### // #### TRANSFORME LE CODE HTML ISSU DU WYSIWYG EN BBCODE #### // ########################################################### function change_smilies_to_code($msg) { global $_SERVER, $_FORUMCFG; $table_smileys = getloadsmileys(); for($i=0;$i'si",$table_smileys[$i]['code'],$msg); return($msg); } function convert_html_to_bbcode($msg) { if(get_magic_quotes_gpc()==1) $msg = stripslashes($msg); // #### TRANSFORMATION DES SMILEYS #### $msg = change_smilies_to_code($msg); $msg = str_replace("&","&",$msg); $regex = array(); if(NAVIGATEUR == "MSIE") { $_parser[0]['open'] = "
"; $_parser[0]['close'] = "<\/div>"; $_parser[0]['function'] = "div_process"; $_parser[1]['open'] = ""; $_parser[1]['close'] = "<\/font>"; $_parser[1]['function'] = "css_process"; $regex['bold']['mask'] = "/(.*?)<\/STRONG>/si"; $regex['bold']['replace'] = "[bold]\\1[/bold]"; $regex['ita']['mask'] = "/(.*?)<\/EM>/si"; $regex['ita']['replace'] = "[ita]\\1[/ita]"; $regex['under']['mask'] = "/(.*?)<\/U>/si"; $regex['under']['replace'] = "[under]\\1[/under]"; $regex['left']['mask'] = "/

(.*?)<\/P>/si"; $regex['left']['replace'] = "[left]\\1[/left]"; $regex['center']['mask'] = "/

(.*?)<\/P>/si"; $regex['center']['replace'] = "[center]\\1[/center]"; $regex['right']['mask'] = "/

(.*?)<\/P>/si"; $regex['right']['replace'] = "[right]\\1[/right]"; $regex['mail']['mask'] = "/(.*?)<\/A>/si"; $regex['mail']['replace'] = "[mail]\\1[/mail]"; $regex['url']['mask'] = "/(.*?)<\/A>/si"; $regex['url']['replace'] = "[url=\\1]\\2[/url]"; $regex['img']['mask'] = "//si"; $regex['img']['replace'] = "[img]\\1[/img]"; $msg = parser($_parser[0],$msg); $msg = parser($_parser[1],$msg); $msg = preg_replace($regex['bold']['mask'],$regex['bold']['replace'],$msg); $msg = preg_replace($regex['ita']['mask'],$regex['ita']['replace'],$msg); $msg = preg_replace($regex['under']['mask'],$regex['under']['replace'],$msg); $msg = preg_replace($regex['left']['mask'],$regex['left']['replace'],$msg); $msg = preg_replace($regex['center']['mask'],$regex['center']['replace'],$msg); $msg = preg_replace($regex['right']['mask'],$regex['right']['replace'],$msg); $msg = preg_replace($regex['mail']['mask'],$regex['mail']['replace'],$msg); $msg = preg_replace($regex['url']['mask'],$regex['url']['replace'],$msg); $msg = preg_replace($regex['img']['mask'],$regex['img']['replace'],$msg); $msg = str_replace("

","",$msg); $msg = str_replace("

","\n",$msg); $msg = str_replace("
","\n",$msg); $msg = str_replace(" "," ",$msg); $msg = strip_tags($msg); } elseif(NAVIGATEUR == "MOZILLA") { // #### OK pour le moment #### // #### voir à débugguer si on met du texte en formattage + ensuite citation, le formattage disparaît #### $_parser[0]['open'] = "
"; $_parser[0]['close'] = "<\/div>"; $_parser[0]['function'] = "div_process"; $_parser[1]['open'] = ""; $_parser[1]['close'] = "<\/font>"; $_parser[1]['function'] = "css_process"; $_parser[2]['open'] = ""; $_parser[2]['close'] = "<\/span>"; $_parser[2]['function'] = "css_process"; $_parser[3]['open'] = "
"; $_parser[3]['close'] = "<\/br>"; $_parser[3]['function'] = "css_process"; $regex['mail']['mask'] = "/
(.*?)<\/A>/si"; $regex['mail']['replace'] = "[mail]\\1[/mail]"; $regex['url']['mask'] = "/(.*?)<\/A>/si"; $regex['url']['replace'] = "[url=\\1]\\2[/url]"; $regex['img']['mask'] = "//si"; $regex['img']['replace'] = "[img]\\1[/img]"; $msg = parser($_parser[0],$msg); $msg = parser($_parser[1],$msg); $msg = parser($_parser[2],$msg); $msg = parser($_parser[3],$msg); $msg = preg_replace($regex['mail']['mask'],$regex['mail']['replace'],$msg); $msg = preg_replace($regex['url']['mask'],$regex['url']['replace'],$msg); $msg = preg_replace($regex['img']['mask'],$regex['img']['replace'],$msg); $msg = strip_tags($msg); $msg = str_replace(" "," ",$msg); } return($msg); } // ################################################################################ // #### TRANSFORME DU BBCODE EN HTML SELON LE NAVIGATEUR POUR L'EDITION DE MSG #### // ################################################################################ function change_code_to_smileys($msg) { global $table_smileys, $_SERVER, $_FORUMCFG; for($i=0;$i", $msg); } return($msg); } function get_html_from_bbcode($chaine) { global $_SKIN; // #### TRANSFORMATION DES SMILEYS #### $chaine = change_code_to_smileys($chaine); $regex = array(); $_parser[0]['open'] = "\[code\]"; $_parser[0]['close'] = "\[\/code\]"; $_parser[0]['function'] = "code_edit_process"; $_parser[1]['open'] = "\[quote\]"; $_parser[1]['close'] = "\[\/quote\]"; $_parser[1]['function'] = "quote_edit_process"; $_parser[2]['open'] = "\[font=.*?\]"; $_parser[2]['close'] = "\[\/font\]"; $_parser[2]['function'] = "font_edit_process"; $_parser[3]['open'] = "\[size=.*?\]"; $_parser[3]['close'] = "\[\/size\]"; $_parser[3]['function'] = "size_edit_process"; $_parser[4]['open'] = "\[color=.*?\]"; $_parser[4]['close'] = "\[\/color\]"; $_parser[4]['function'] = "color_edit_process"; if(NAVIGATEUR == "MSIE") { $search = array( "/\[bold\](.*?)\[\/bold\]/si", "/\[ita\](.*?)\[\/ita\]/si", "/\[under\](.*?)\[\/under\]/si", "/\[left\](.*?)\[\/left\]/si", "/\[center\](.*?)\[\/center\]/si", "/\[right\](.*?)\[\/right\]/si", "/\[mail\](.*?)\[\/mail\]/si", "/\[url=(.*?)\](.*?)\[\/url\]/si", "/\[img\](.*?)\[\/img\]/si"); $replace = array( "\\1", "\\1", "\\1", "

\\1

", "

\\1

", "

\\1

", "
\\1", "\\2", ""); } elseif(NAVIGATEUR == "MOZILLA") { $search = array( "/\[bold\](.*?)\[\/bold\]/si", "/\[ita\](.*?)\[\/ita\]/si", "/\[under\](.*?)\[\/under\]/si", "/\[left\](.*?)\[\/left\]/si", "/\[center\](.*?)\[\/center\]/si", "/\[right\](.*?)\[\/right\]/si", "/\[mail\](.*?)\[\/mail\]/si", "/\[url=(.*?)\](.*?)\[\/url\]/si", "/\[img\](.*?)\[\/img\]/si"); $replace = array( "\\1", "\\1", "\\1", "
\\1
", "
\\1
", "
\\1
", "\\1", "\\2", ""); } $chaine = parser($_parser[0],$chaine); $chaine = parser($_parser[1],$chaine); $chaine = parser($_parser[2],$chaine); $chaine = parser($_parser[3],$chaine); $chaine = parser($_parser[4],$chaine); $chaine = preg_replace($search,$replace,$chaine); return($chaine); } // ################################################################## // #### TRANSFORME LE BBCODE EN HTML POUR AFFICHAGE SUR LE FORUM #### // ################################################################## function format_bbcode_to_html($chaine) { global $BBcodeHTML; $chaine = trim($chaine); $chaine = str_replace('
','',$chaine); $chaine = str_replace('\\\"','\"',$chaine); return $chaine; } function getreturnbbcode($msg,$topic=false) { global $bground, $_SKIN, $_USER, $_FORUMCFG, $DetailMsg, $sql, $BBcodeHTML, $_PRE; $regex = array(); $_parser[0]['open'] = "\[code\]"; $_parser[0]['close'] = "\[\/code\]"; $_parser[0]['function'] = "code_process"; $_parser[1]['open'] = "\[quote\]"; $_parser[1]['close'] = "\[\/quote\]"; $_parser[1]['function'] = "quote_process"; $_parser[2]['open'] = "\[color=.*?\]"; $_parser[2]['close'] = "\[\/color\]"; $_parser[2]['function'] = "color_process"; $_parser[3]['open'] = "\[size=[\d]\]"; $_parser[3]['close'] = "\[\/size\]"; $_parser[3]['function'] = "size_process"; $_parser[4]['open'] = "\[font=.*?\]"; $_parser[4]['close'] = "\[\/font\]"; $_parser[4]['function'] = "font_process"; $msg = parser($_parser[0],$msg); $msg = parser($_parser[1],$msg); $msg = parser($_parser[2],$msg); $msg = parser($_parser[3],$msg); $msg = parser($_parser[4],$msg); // **** transformation autres balises **** $search=array("/(?query("SELECT COUNT(*) AS present FROM ".$_PRE."posts WHERE parent='".$DetailMsg['parent']."' AND idmembre=".$_USER['userid']); $isrespond=mysql_fetch_array($isposter); if($isrespond['present']>0) $msg=preg_replace("/\[cache\](.*?)\[\/cache\]/si",$BBcodeHTML['msgcache1'],$msg); else $msg=preg_replace("/\[cache\](.*?)\[\/cache\]/si",$BBcodeHTML['msgcache2'],$msg); } return($msg); } function censuredwords($msg) { global $_FORUMCFG, $ListWords, $ListWordsRpl; if(strlen($_FORUMCFG['censuredwords'])>0) $msg=preg_replace($ListWords,$ListWordsRpl,$msg); return($msg); } function getquote($id) { global $_PRE, $sql, $tpl, $QuoteName, $OrigMsg, $QuoteMsg, $_USER; $query = $sql->query("SELECT pseudo,msg FROM ".$_PRE."posts WHERE idpost='$id'"); list($QuoteName,$OrigMsg) = mysql_fetch_array($query); $QuoteName = getformatrecup($QuoteName); $OrigMsg = getformatrecup($OrigMsg); $QuoteMsg = preg_replace("/\[quote\](.*?)\[\/quote\]/si","",$OrigMsg); $QuoteMsg = preg_replace("/\[cache\](.*?)\[\/cache\]/si",$tpl->gettemplate("repondre","msgcache"),$QuoteMsg); $msg = $tpl->gettemplate("repondre","origmsg"); return($msg); } function gettopictitle($id,$annonce=false) { global $sql, $_PRE; if($annonce) $query = $sql->query("SELECT sujet FROM ".$_PRE."annonces WHERE idpost=".$id); else $query = $sql->query("SELECT idforum,sujet,nbrep,opentopic,poll FROM ".$_PRE."topics WHERE idtopic=".$id); $nb = mysql_numrows($query); if($nb==0) return false; else { $j = mysql_fetch_array($query); return($j); } } function updateforumlastposter($idforum) { global $sql, $_PRE; $query = $sql->query("SELECT COUNT(*) AS nbtopic FROM ".$_PRE."topics WHERE idforum='$idforum'"); list($nbtopic)=mysql_fetch_array($query); $query = $sql->query("SELECT COUNT(*) AS nbmsg FROM ".$_PRE."posts WHERE idforum='$idforum'"); list($nbmsg)=mysql_fetch_array($query); $nbmsg = $nbmsg - $nbtopic; if($nbtopic>0) { $query = $sql->query("SELECT idpost,date,idmembre,pseudo FROM ".$_PRE."posts WHERE idforum='$idforum' ORDER BY date DESC"); $i=mysql_fetch_array($query); } else { $i['pseudo']=""; $i['date']=0; $i['idpost']=0; } $i['pseudo'] = getformatdbtodb($i['pseudo']); $query=$sql->query("UPDATE ".$_PRE."forums SET forumtopic='$nbtopic' ,forumposts='$nbmsg' ,lastforumposter='".$i['pseudo']."', lastdatepost='".$i['date']."', lastidpost='".$i['idpost']."' WHERE forumid='$idforum'"); } function updatetopiclastposter($idpost) { global $sql, $_PRE; $query = $sql->query("SELECT COUNT(*) AS nbpost FROM ".$_PRE."posts WHERE parent='$idpost'"); list($nbpost) = mysql_fetch_array($query); $nbpost--; $query = $sql->query("SELECT idpost,date,idmembre,pseudo FROM ".$_PRE."posts WHERE parent='$idpost' ORDER BY date DESC"); $j = mysql_fetch_array($query); //à voir !! $j['pseudo'] = getformatdbtodb($j['pseudo']); $query = $sql->query("UPDATE ".$_PRE."topics SET nbrep='$nbpost', derposter='".$j['pseudo']."', idderpost='".$j['idmembre']."', datederrep='".$j['date']."', idderpost='".$j['idpost']."' WHERE idtopic='$idpost'"); } function updatenbtopics() { global $sql, $_PRE, $_FORUMCFG; $query=$sql->query("SELECT COUNT(*) AS nbtopics FROM ".$_PRE."topics"); list($nbtopics)=mysql_fetch_array($query); $query=$sql->query("UPDATE ".$_PRE."config SET valeur='$nbtopics' WHERE options='statnbtopics'"); $_FORUMCFG['statnbtopics'] = $nbtopics; } function updatenbposts() { global $sql,$_FORUMCFG, $_PRE; $query=$sql->query("SELECT COUNT(*) AS nbposts FROM ".$_PRE."posts"); list($nbposts)=mysql_fetch_array($query); $nbposts = $nbposts - $_FORUMCFG['statnbtopics']; $query=$sql->query("UPDATE ".$_PRE."config SET valeur='$nbposts' WHERE options='statnbposts'"); } function updatemembers() { global $sql, $_PRE; $query = $sql->query("SELECT login FROM ".$_PRE."user WHERE userstatus<>'0' ORDER BY registerdate DESC"); $nbuser=mysql_numrows($query); list($lastmember)=mysql_fetch_array($query); $lastmember = getformatdbtodb($lastmember); $query=$sql->query("UPDATE ".$_PRE."config SET valeur='$nbuser' WHERE options='statnbuser'"); $query=$sql->query("UPDATE ".$_PRE."config SET valeur='$lastmember' WHERE options='statlastmember'"); } // A supprimer ????????????????????? function updatestatsmembers() { global $sql, $_PRE; $query=$sql->query("SELECT COUNT(*) AS nbmb FROM ".$_PRE."user"); list($nbmb)=mysql_fetch_array($query); $query=$sql->query("SELECT login FROM ".$_PRE."user ORDER BY registerdate DESC LIMIT 0,1"); list($lastpseudo)=mysql_fetch_array($query); $query=$sql->query("UPDATE ".$_PRE."config SET valeur='$nbmb' WHERE options='statnbuser'"); $query=$sql->query("UPDATE ".$_PRE."config SET valeur='$lastpseudo' WHERE options='statlastmember'"); } function updatepmstats($user) { global $sql,$_PRE,$_USER; $query=$sql->query("SELECT COUNT(*) AS nbpm,vu FROM ".$_PRE."privatemsg WHERE iddest='$user' GROUP BY vu"); $nb=mysql_numrows($query); $nbpmtot=0; $nbpmnew=0; if($nb>0) { while($j=mysql_fetch_array($query)) { if($j['vu']==0) $nbpmnew=$j['nbpm']; $nbpmtot+=$j['nbpm']; } } $query=$sql->query("UPDATE ".$_PRE."user SET nbpmtot='$nbpmtot', nbpmvu='$nbpmnew' WHERE userid='$user'"); if($user==$_USER['userid'] && $nbpmnew<$_USER['nbpmvu']) sendcookie("nbpmvu",$nbpmnew,-1); } function getfuseauhoraire() { global $_USER,$_FORUMCFG; $zone=$_USER['timezone']; $fuseaux = array(); $fuseaux[-12] = "GMT -12:00, Eniwetok"; $fuseaux[-11] = "GMT -11:00, Samoa"; $fuseaux[-10] = "GMT -10:00, Hawaii"; $fuseaux[-9] = "GMT -9:00, Alaska"; $fuseaux[-8] = "GMT -8:00, PST, Pacific US"; $fuseaux[-7] = "GMT -7:00, MST, Mountain US"; $fuseaux[-6] = "GMT -6:00, CST, Central US"; $fuseaux[-5] = "GMT -5:00, EST, Eastern US"; $fuseaux[-4] = "GMT -4:00, Atlantic, Canada"; $fuseaux[-3] = "GMT -3:00, Brazilia, Buenos Aries"; $fuseaux[-2] = "GMT -2:00, Mid-Atlantic"; $fuseaux[-1] = "GMT -1:00, Cape Verdes"; $fuseaux[0] = "GMT, Greenwich, London, Lisbon, Casablanca"; $fuseaux[1] = "GMT +1:00, Berlin, Rome, Madrid, Paris"; $fuseaux[2] = "GMT +2:00, Israel, Cairo"; $fuseaux[3] = "GMT +3:00, Moscow, Kuwait, Baghdad"; $fuseaux[4] = "GMT +4:00, Abu Dhabi, Muscat"; $fuseaux[5] = "GMT +5:00, Islamabad, Karachi"; $fuseaux[6] = "GMT +6:00, Almaty, Dhaka"; $fuseaux[7] = "GMT +7:00, Bangkok, Jakarta"; $fuseaux[8] = "GMT +8:00, Hong Kong, Beijing"; $fuseaux[9] = "GMT +9:00, Tokyo, Osaka"; $fuseaux[10] = "GMT +10:00, Sydney, Melbourne, Guam"; $fuseaux[11] = "GMT +11:00, Magadan, Soloman Is."; $fuseaux[12] = "GMT +12:00, Fiji, Wellington, Auckland"; return($fuseaux[$zone]); } function updatebirth() { global $sql,$tpl,$_FORUMCFG,$_PRE; $day = gmstrftime("%d-%m",time()+(($_FORUMCFG['defaulttimezone'] + intval(date("I")))*3600)); $year = gmstrftime("%Y",time()+(($_FORUMCFG['defaulttimezone'] + intval(date("I")))*3600)); $query = $sql->query("SELECT ".$_PRE."userplus.birth, ".$_PRE."user.userid, ".$_PRE."user.login, ".$_PRE."user.userstatus FROM ".$_PRE."userplus LEFT JOIN ".$_PRE."user ON ".$_PRE."user.userid = ".$_PRE."userplus.idplus WHERE ".$_PRE."userplus.birth LIKE \"$day-%\""); $nb = mysql_numrows($query); if($nb>0) { while($j=mysql_fetch_array($query)) { $j['birth'] = explode("-",$j['birth']); $j['login'] = getformatrecup($j['login']); $tpl->box['age'] = $year-$j['birth'][2]; $tpl->box['user'] = getformatpseudo($j['login'],$j['userstatus'],$j['userid']); // tpl: 2 x addslashes $birth[] = $tpl->gettemplate("entete","formatbirth"); } $birth = implode(", ",$birth); } else $birth = ""; $_FORUMCFG['birth'] = stripslashes(stripslashes($birth)); $sql->query("UPDATE ".$_PRE."config SET valeur='".stripslashes($birth)."' WHERE options='birth'"); } // ******************************************************** // * FONCTIONS DE FORMATTAGE DES DONNEES * // ******************************************************** function getformatpreview($msg) { $msg=htmlentities($msg); if(get_magic_quotes_gpc()==0) $msg=addslashes($msg); $msg=addslashes($msg); $msg=nl2br($msg); return($msg); } function getformathtml($msg) { if(get_magic_quotes_gpc()==0) $msg=addslashes($msg); return($msg); } function getformatmsg($msg,$activenl2br=true) { if(get_magic_quotes_gpc()==0) $msg=addslashes($msg); $msg=htmlentities($msg); if($activenl2br) $msg=nl2br($msg); return($msg); } function getformatmsghtml($msg,$activenl2br=true) { $msg=htmlentities($msg); $msg=addslashes($msg); $msg = str_replace("&lt;","<",$msg); $msg = str_replace("&gt;",">",$msg); if($activenl2br) $msg=nl2br($msg); return($msg); } function getformatrecup($msg,$strip=false) { if($strip) $msg=strip_tags($msg); if(get_magic_quotes_runtime()==0) $msg=addslashes($msg); $msg=addslashes($msg); return($msg); } function getformatdbtodb($msg) { if(get_magic_quotes_runtime()==0) $msg=addslashes($msg); return($msg); } function getrecupforform($msg, $squote = false) { if($squote) $msg = htmlentities($msg, ENT_QUOTES); else $msg = htmlentities($msg); if(get_magic_quotes_gpc()==1 & get_magic_quotes_runtime()==0) $msg=stripslashes($msg); elseif(get_magic_quotes_gpc()==0 & get_magic_quotes_runtime()==1) $msg=addslashes($msg); return($msg); } function getrecupfromcookie($cook) { if(get_magic_quotes_gpc()==0) $cook = addslashes($cook); return($cook); } function getlocaltime($time,$format=0) { global $_USER; $decalage = ($_USER['timezone']+intval(date("I"))) * 3600; if($format==1) $result = gmstrftime("%d/%m/%Y",$time+$decalage); else $result = gmstrftime("%d/%m/%Y %H:%M",$time+$decalage); return($result); } function getformatpseudo($pseudo,$status,$userid) { global $tpl; if($status<0) $tpl->box['mbstatus']="ban"; else $tpl->box['mbstatus']=$status; $tpl->box['mbpseudo']=getformatrecup($pseudo); $tpl->box['mbuserid']=$userid; if($status>1 || $status<0) $chaine=$tpl->gettemplate("entete","mbpseudolink"); else $chaine=$tpl->gettemplate("entete","mbpseudo"); return($chaine); } function cookdecode($tabl) { $transfert=explode("_",$tabl); for($i=0;$i0) $chaine=implode("_",$transfert); return($chaine); } function getemail($email) { global $_FORUMCFG; $email=str_replace("@",$_FORUMCFG['emailmask'],$email); return($email); } function inversemail($email) { global $_FORUMCFG; $email=str_replace($_FORUMCFG['emailmask'],"@",$email); return($email); } function formatstrformail($str) { $trans = get_html_translation_table(HTML_ENTITIES); $trans = array_flip($trans); $encoded = strtr($str, $trans); return($encoded); } function recupDBforMail($msg) { if(get_magic_quotes_runtime()==1) $msg=stripslashes($msg); //$msg=stripslashes($msg); return($msg); } function testemail($email) { return( ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]{2,}\.){1,3}'. '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]{2,4}$', $email) ); } function testurl($url) { if(preg_match("/^(http|ftp|https):\/\/([a-z0-9-\/\.@:%=?&;]+(?0) { $testchain=preg_replace("/([\s]{1,})/","",$_POST[$var]); if(strlen($testchain)==0) $error=$tpl->attlang($null); } if($maxlength > 0 && strlen($_POST[$var])>$maxlength) { if(strlen($max)>0) $error=$tpl->attlang($max); else $_POST[$var]=substr($_POST[$var],0,$maxlength); } } function test_max_length($msg, $maxlength) { $chaine = strip_tags($msg); // Supprime les balises HTML $chaine = preg_replace("/(\r\n|\n)/si","",$chaine); // Supprime les retour à la ligne // Supprime les \ if(get_magic_quotes_gpc()==1 & get_magic_quotes_runtime()==0) // Supprime les \ $chaine=stripslashes($chaine); $trans = get_html_translation_table(HTML_ENTITIES); // | $trans = array_flip($trans); // > Remplace les entitées HTML par leur caractère équivalent $chaine = strtr($chaine,$trans); // | $trop_plein = strlen($chaine) - $maxlength; if($trop_plein > 0 && $maxlength > 0) $msg = substr($msg,0,-($trop_plein)); return($msg); } // ******************************************************** // * FORMATTAGE DE FORMULAIRES / TABLEAUX * // ******************************************************** function return_int($nombre) { return(intval($nombre)); } function Return_Checked($value) { if($value) return(" CHECKED"); else return(""); } // ******************************************************** // * FONCTIONS D'AFFICHAGE * // ******************************************************** function affforumlist($cat) { global $zecook,$tpl,$Forums,$TabForum,$TabModos,$_USER,$_PERMFORUM,$_FORUMRIGHTS, $modoname; $chaine=""; for($cpt=0;$cpt0) { $Forums['lastdatepost']=getlocaltime($Forums['lastdatepost']); $Forums['lastforumposter'] = getformatrecup($Forums['lastforumposter']); $tpl->box['infolastpost']=$tpl->gettemplate("forumlist","iflastpost"); } else $tpl->box['infolastpost']=$tpl->gettemplate("forumlist","ifnolastpost"); $modoname = ""; $tpl->box['modonames'] = ""; for($cpt2=0;$cpt2box['modonames'] .= $tpl->gettemplate("forumlist","modonames"); } if(strlen($modoname)>0) { $tpl->box['modolist'] = $tpl->gettemplate("forumlist","modolist"); } else $tpl->box['modolist']=" "; $chaine.=$tpl->gettemplate("forumlist","ifforum"); } } return($chaine); } function affwritebox($cancache="Y") { global $table_smileys, $cachedir, $tpl, $_FORUMCFG, $Parent, $_USER; // On définit le template selon wysiwyg ou non if($_USER['wysiwyg']=="Y") $tpl_writebox = "writebox_wysiwyg"; else $tpl_writebox = "writebox"; if (!empty($tpl->box['quotemsg']) && strlen($tpl->box['quotemsg'])>0) { if($_USER['wysiwyg'] == "Y") $tpl->box['quotemsg'] = get_html_from_bbcode($tpl->box['quotemsg']); else $tpl->box['quotemsg']=strip_tags($tpl->box['quotemsg']); } else $tpl->box['quotemsg']=NULLSTR; $compt=0; $tpl->box['smileybox']=""; for($zz=0;$zz<18;$zz++) { $tpl->box['smileybox'].="\t\t"; if($compt%3!=0) $tpl->box['smileybox'].="   "; if($_USER['wysiwyg']=="Y") $tpl->box['smileybox'].=""; else $tpl->box['smileybox'].=""; $compt++; if($compt%3==0) $tpl->box['smileybox'].="

\n\n"; else $tpl->box['smileybox'].="\n"; } if($_FORUMCFG['canpostmsgcache']=="Y" && $cancache=="Y" && $Parent==0) $tpl->box['cancache']=$tpl->gettemplate($tpl_writebox,"addcachebutton"); else $tpl->box['cancache']=NULLSTR; $chaine=$tpl->gettemplate($tpl_writebox,"wrtboxaccueil"); return($chaine); } function afftopiclist($annonce=0,$template="list") { global $cookiespost,$_GET,$page,$tpl,$Topics; $chaine=""; if($annonce==1) $Topics['icontopic']="annonce.gif"; else { if(!empty($Topics['opentopic']) && $Topics['opentopic'] == 'N') $Topics['icontopic']="closed.gif"; else { $IdString = $Topics['idtopic']; settype($IdString,"string"); if (empty($cookiespost[$IdString."m"]) || $cookiespost[$IdString."m"]<($Topics['nbrep']+1)) $Topics['icontopic']="on.gif"; else $Topics['icontopic']="off.gif"; } } $tpl->box['pretopic']=""; if(!empty($Topics['postit']) && $Topics['postit']=="1") $tpl->box['pretopic'].=$tpl->gettemplate($template,"ifpostittopic"); if(!empty($Topics['poll']) && $Topics['poll']>0) $tpl->box['pretopic'].=$tpl->gettemplate($template,"iftopicpoll"); if($annonce==1) { $Topics['idtopic'] = $Topics['idpost']; $tpl->box['pretopic']=$tpl->gettemplate($template,"iftopicannonce"); $tpl->box['linkpage']="readannonce"; } else $tpl->box['linkpage']="detail"; $Topics['sujet']=getformatrecup($Topics['sujet']); $tpl->box['topic']=$tpl->gettemplate($template,"topiclinktomsg"); if(empty($Topics['nbrep'])) $Topics['nbrep'] = 0; $tpl->box['affichepages']=getpagestopic($Topics['nbrep'],$Topics['idtopic'],$page); if($Topics['userid']==0) $Topics['userstatus'] = 0; $Topics['loginposter']=getformatpseudo($Topics['pseudo'],$Topics['userstatus'],$Topics['userid']); $Topics['derposter'] = getformatrecup($Topics['derposter']); $Topics['datederrep']=getlocaltime($Topics['datederrep']); if($annonce==0) $tpl->box['gotobutton']=$tpl->gettemplate($template,"linklastmsg"); else $tpl->box['gotobutton']= NULLSTR; $chaine=$tpl->gettemplate($template,"lignetopic"); unset($tpl->box['pretopic'],$tpl->box['gotobutton']); return($chaine); } // #### AFFICHAGE DU DETAIL D'UN MESSAGE #### function affdetailtopic($annonce=0,$cit=true) { global $tpl,$DetailMsg,$_FORUMCFG, $IdTopic, $NombreConnectes, $SearchOrig, $SearchReplace, $Grades; // **** Initialisation variables **** $chaine = NULLSTR; $tpl->box['affusergrade'] = NULLSTR; $tpl->box['affpins'] = NULLSTR; $tpl->box['affusergrade'] = NULLSTR; $tpl->box['grade'] = NULLSTR; $tpl->box['affusersign'] = NULLSTR; $tpl->box['buttonmail'] = NULLSTR; $tpl->box['affuserlogo'] = NULLSTR; $tpl->box['affsujetpost'] = NULLSTR; $tpl->box['buttonsearch'] = NULLSTR; $tpl->box['affregisterdate'] = NULLSTR; $tpl->box['isconnected'] = NULLSTR; $tpl->box['buttonpm'] = NULLSTR; // **** Si c'est un membre **** if($DetailMsg['posterid']>0) { // **** initialisation des variables **** $connected = false; $DetailMsg['pseudo'] = $DetailMsg['login']; $Key_Grade = 0; // **** gestion des grades **** if($_FORUMCFG['use_grades'] == "Y" && is_array($Grades)) { foreach($Grades AS $key => $value) { $Key_Grade = $key; if($DetailMsg['usermsg'] < $value[1]) { $Key_Grade --; break; } } $tpl->box['grade'] = $Grades[$Key_Grade][0]; for($i=0; $i< $Grades[$Key_Grade][2];$i++) $tpl->box['affpins'] .= trim($tpl->gettemplate("detail", "imgpins")); $tpl->box['affusergrade'] = $tpl->gettemplate("detail", "usergrade"); } // **** connecté ou pas ? **** for($i = 0; $i < count($NombreConnectes); $i++) if($NombreConnectes[$i]['userid'] == $DetailMsg['posterid']) $connected = true; if($connected) $tpl->box['isconnected'] = $tpl->gettemplate("detail","connecty"); else $tpl->box['isconnected'] = $tpl->gettemplate("detail","connectn"); // **** gestion du logo **** if(ereg("^\"http://",$DetailMsg['userlogo'])) { if($_FORUMCFG['logos'][6] == "Y" && $_FORUMCFG['logos'][0] == "Y") $tpl->box['affuserlogo'] = $tpl->gettemplate("detail","extuserlogo"); } elseif(!empty($DetailMsg['userlogo']) && $_FORUMCFG['logos'][0] == "Y") $tpl->box['affuserlogo'] = $tpl->gettemplate("detail","userlogo"); // **** gestion date d'enregistrement **** if (!empty($DetailMsg['registerdate'])) { $DetailMsg['registerdate']=getlocaltime($DetailMsg['registerdate'],1); $tpl->box['affregisterdate']=$tpl->gettemplate("detail","userinfo"); } } else $DetailMsg['usercitation']=$tpl->attlang("guestcit"); // **** gestion de la citation **** if (!empty($DetailMsg['usercitation'])) { $DetailMsg['usercitation'] = getformatrecup($DetailMsg['usercitation']); $tpl->box['affusercitation'] = $tpl->gettemplate("detail","usercitation"); } else $tpl->box['affusercitation'] = NULLSTR; $DetailMsg['formatpseudo']=getformatpseudo($DetailMsg['pseudo'],$DetailMsg['userstatus'],$DetailMsg['userid']); if(!empty($DetailMsg['sujetpost'])) { $DetailMsg['sujetpost']=getformatrecup($DetailMsg['sujetpost']); $tpl->box['affsujetpost']=$tpl->gettemplate("detail","msgsujet"); } $DetailMsg['datepost']=getlocaltime($DetailMsg['datepost']); if($DetailMsg['smiles']=="Y") $DetailMsg['msgpost']=getreturnsmilies($DetailMsg['msgpost']); if($DetailMsg['afbbcode']=="Y") { if($DetailMsg['idpost']==$IdTopic) $DetailMsg['msgpost']=getreturnbbcode($DetailMsg['msgpost'],true); else $DetailMsg['msgpost']=getreturnbbcode($DetailMsg['msgpost']); } if(count($SearchOrig)>0) $DetailMsg['msgpost'] = preg_replace("/(.+?)((<(.*?)>)|$)/sie","getcolorsearch('\\1').stripslashes('\\2')",$DetailMsg['msgpost']); $DetailMsg['msgpost'] = censuredwords($DetailMsg['msgpost']); $tpl->box['affmessage']=getformatrecup($DetailMsg['msgpost']); if(!empty($DetailMsg['usersign'])) { $DetailMsg['usersign']=getformatrecup($DetailMsg['usersign']); if($_FORUMCFG['smileinsign']=="Y") $DetailMsg['usersign']=getreturnsmilies($DetailMsg['usersign']); if($_FORUMCFG['bbcodeinsign']=="Y") $DetailMsg['usersign']=getreturnbbcode($DetailMsg['usersign']); $tpl->box['affusersign']=$tpl->gettemplate("detail","usersignature"); } if (!empty($DetailMsg['guestmail'])) $DetailMsg['postermail']=getemail($DetailMsg['guestmail']); elseif(!empty($DetailMsg['usermail']) && $DetailMsg['showmail']=="Y") $DetailMsg['postermail']=getemail($DetailMsg['usermail']); if(!empty($DetailMsg['postermail'])) $tpl->box['buttonmail']=$tpl->gettemplate("detail","buttonmail"); if (!empty($DetailMsg['guestsite'])) $DetailMsg['postersite']=$DetailMsg['guestsite']; elseif(!empty($DetailMsg['usersite']) && $DetailMsg['showusersite']=="Y") $DetailMsg['postersite']=$DetailMsg['usersite']; if(!empty($DetailMsg['postersite'])) $tpl->box['buttonsite']=$tpl->gettemplate("detail","buttonweb"); else $tpl->box['buttonsite']=NULLSTR; /*if (!empty($DetailMsg['usericq']) && $DetailMsg['showicq']=="Y") $tpl->box['buttonicq']=$tpl->gettemplate("detail","buttonicq");*/ if($DetailMsg['posterid']>0) { $tpl->box['buttonpm']=$tpl->gettemplate("detail","buttonpm"); $tpl->box['buttonsearch']=$tpl->gettemplate("detail","buttonsearch"); } if($annonce==0) { if($cit == true) $tpl->box['buttonquote']=$tpl->gettemplate("detail","buttonquote"); else $tpl->box['buttonquote']=""; $tpl->box['buttonedit']=$tpl->gettemplate("detail","buttonedit"); $tpl->box['buttonip']=$tpl->gettemplate("detail","buttonip"); $tpl->box['buttonalert']=$tpl->gettemplate("detail","buttonalert"); } $chaine=$tpl->gettemplate("detail","boxmsg"); $tpl->box['affsujetpost']=$tpl->box['affusercitation']=$tpl->box['affuserlogo']=$tpl->box['affregisterdate']=$tpl->box['affsujetpost']=$tpl->box['affusersign']=$tpl->box['isconnected']=""; $tpl->box['buttonmail']=$tpl->box['buttonsite']=$tpl->box['buttonicq']=$tpl->box['buttonpm']=$tpl->box['buttonsearch']=$tpl->box['buttonquote']=$tpl->box['buttonedit']=$tpl->box['buttonip']=$tpl->box['buttonalert']=""; unset($DetailMsg); return($chaine); } // ***************************************************** // * FONCTIONS JAVASCRIPT * // ***************************************************** function getjsredirect($url,$tplime) { global $tpl; $tpl->box['urlredirect'] = $url; $tpl->box['timeredirect'] = $tplime; $chaine = $tpl->gettemplate("entete","getjsredirect"); return($chaine); } // ******************************************************** // * INITIALISATION DU FORUM * // ******************************************************** $tps_start = get_microtime(); $NbRequest = 0; $sql = new SQLConnect; $tpl = new Template; $_FORUMCFG = getconfig(); addToArray($_FORUMCFG, 'mailforumname', formatstrformail(recupDBforMail($_FORUMCFG['forumname']))); $_FORUMCFG['contactmail'] = getemail($_FORUMCFG['contactmail']); $_FORUMCFG['forumname'] = getformatrecup($_FORUMCFG['forumname']); $_FORUMCFG['sitename'] = getformatrecup($_FORUMCFG['sitename']); define("NULLSTR",""); if(!isset($_SERVER)) { $_SERVER = $HTTP_SERVER_VARS; $_ENV = $HTTP_ENV_VARS; $_COOKIE = $HTTP_COOKIE_VARS; $_GET = $HTTP_GET_VARS; $_POST = $HTTP_POST_VARS; $_FILES = $HTTP_POST_FILES; $_SESSION = $HTTP_SESSION_VARS; $_REQUEST = array_merge($_GET,$_POST); } $ForumVersion = "0.8.4 beta"; $ForumDBVersion = "0.8 beta"; ?>box['affdegrad'] = $tpl->gettemplate("entete","affdegrad"); else $tpl->box['affdegrad'] = NULLSTR; //Initialisation des couleurs des groupes $tpl->box['grpcolor'] = NULLSTR; foreach($ListColorGroup AS $gpcolor) { $groupcolor = $_SKIN['grp'.$gpcolor]; $tpl->box['grpcolor'] .= $tpl->gettemplate("entete","groupscolor"); } //////////////////////////////////////////////////////////////////////////////// // #### Update session #### //////////////////////////////////////////////////// if(!ereg("popup.php",$_SERVER['REQUEST_URI'])) $NombreConnectes = getsession(); // #### Définition navigateur #### ///////////////////////////////////////////// if(ereg("MSIE", $_SERVER['HTTP_USER_AGENT'])) { define("NAVIGATEUR","MSIE"); $tpl->box['cssform'] = $tpl->gettemplate("entete","formie"); } elseif(ereg("Mozilla/5.0", $_SERVER['HTTP_USER_AGENT'])) { define("NAVIGATEUR","MOZILLA"); $tpl->box['cssform'] = $tpl->gettemplate("entete","formie"); } else $tpl->box['cssform'] = $tpl->gettemplate("entete","formns"); //////////////////////////////////////////////////////////////////////////////// /* if(isset($GetWYSIWYG) && $GetWYSIWYG) { $tpl->box['javascript'] = $tpl->gettemplate("writebox_wysiwyg","wysiwygjs"); //$tpl->box[onload] = $tpl->gettemplate("writebox","wysiwygonload"); } */ // #### Chargement en-tête du forum #### /////////////////////////////////////// if (isset($TopicInfo)) $TopicName = ": ".$TopicInfo['sujet']; $cache.=$tpl->gettemplate("entete","htmlheader"); //////////////////////////////////////////////////////////////////////////////// if(!isset($nocache)) { // #### Utilisation gestionnaire de pub #### /////////////////////////////// if($_FORUMCFG['usepub']=="Y") { $date = time(); $result = array(); $query = $sql->query("SELECT * FROM ".$_PRE."campagnes WHERE dtedebut<$date"); if(mysql_numrows($query)>0) { while($i = mysql_fetch_array($query)) if(($i['typefin'] == "aff" && $i['nbaffichages'] < $i['fincamp']) || ($i['typefin'] == "click" && $i['clicks'] < $i['fincamp']) || ($i['typefin'] == "date" && $date < $i['fincamp'])) for($x = 0; $x < $i['ratio']; $x++) $result[] = $i; if(count($result)>0) { $nocamp = rand(0,(count($result)-1)); $date_derniere_vue_camp = strftime("%Y-%m-%d",$result[$nocamp]['lastvue']); $date_maintenant = strftime("%Y-%m-%d",$date); $inserchampcamp = $result[$nocamp]['id']."-".strftime("%Y%m%d",$result[$nocamp]['lastvue']); if($date_derniere_vue_camp == $date_maintenant) $query = $sql->query("UPDATE ".$_PRE."campagnes SET nbaffichages=nbaffichages+1, lastvue='$date', todayvue=todayvue+1 WHERE id='".$result[$nocamp]['id']."'"); else { $query = $sql->query("INSERT INTO ".$_PRE."statcamp (iddate,vu,clicks) VALUES ('$inserchampcamp','".$result[$nocamp]['todayvue']."','".$result[$nocamp]['todayclick']."')"); $query = $sql->query("UPDATE ".$_PRE."campagnes SET nbaffichages=nbaffichages+1, lastvue='$date', todayvue=1, todayclick=0 WHERE id='".$result[$nocamp]['id']."'"); } if(strlen($result[$nocamp]['regie'])==0) { $idads = $result[$nocamp]['id']; $adsban = $result[$nocamp]['banniere']; $tpl->box['ajouthtml'] = $tpl->gettemplate("entete","ads"); } else $tpl->box['ajouthtml'] = stripslashes($result[$nocamp]['regie']); } else $tpl->box['ajouthtml'] = " "; } else $tpl->box['ajouthtml'] = " "; } //////////////////////////////////////////////////////////////////////////// // #### Affichage de HTML haut #### /////////////////////////////////////// else { if(!empty($_FORUMCFG['ajouthtml'])) $tpl->box['ajouthtml'] = stripslashes($_FORUMCFG['ajouthtml']); else $tpl->box['ajouthtml'] = " "; } //////////////////////////////////////////////////////////////////////////// $cache .= $tpl->gettemplate("entete","logo"); if($_GENERAL[20]) $tpl->box['administrer'] = $tpl->gettemplate("entete","administrer"); else $tpl->box['administrer'] = NULLSTR; if($_GENERAL[0]) $tpl->box['affstatlink'] = trim($tpl->gettemplate("entete","affstatlink")); else $tpl->box['affstatlink'] = NULLSTR; $cache .= $tpl->gettemplate("entete","navbar"); } // #### Série de tests sur le forum #### /////////////////////////////////////// // **** Mise en forme du nom du site **** if(strlen($_FORUMCFG['sitename'])>0 && strlen($_FORUMCFG['siteurl'])>0) $tpl->box['forumsite'] = $tpl->gettemplate("baspage","siteurl"); else $tpl->box['forumsite'] = NULLSTR; // **** La version de DB est-elle bonne? **** if($_FORUMCFG['ForumDBVersion']!=$ForumDBVersion) geterror("notgoodDB"); // **** test de la dernière initialisation cookie du forum **** if(isset($_COOKIE['CF_LastINI']) && $_COOKIE['CF_LastINI'] < $_FORUMCFG['initialise']) geterror("initcookie"); // **** Le board est-il ouvert? **** if($_FORUMCFG['openforum']=="N" && !$_GENERAL[20]) geterror("closedforum"); // **** Le visiteur est-il bannit? **** if($_USER['userstatus']<0) geterror("mbbanned"); // **** Le forum oblige-t-il à être identifié? **** if($_USER['userid'] == 0 && $_FORUMCFG['mustbeidentify'] == "Y" && !ereg("identify.php",$_SERVER['REQUEST_URI']) && !ereg("register.php",$_SERVER['REQUEST_URI'])) geterror("call_loginbox"); // **** Popup sur les nouveux PM **** if(!isset($_COOKIE['nbpmvu'])) $_COOKIE['nbpmvu'] = 0; if($_USER['popuppm']=="Y" && $_USER['nbpmvu']>$_COOKIE['nbpmvu']) { $cache .= $tpl->gettemplate("entete","jspopuppm"); sendcookie("nbpmvu",$_USER['nbpmvu'],-1); } if(!isset($_REQUEST['action'])) $_REQUEST['action'] = NULLSTR; //////////////////////////////////////////////////////////////////////////////// ?>
Fatal error: Call to undefined function getlangage() in /var/www/alternc/n/notreinternet/Mobil-Home/Forum/index.php on line 16