see update v1.7 created databases thread.dtb and forum.dtb for quicker display of forum threads these new databases are managed by the UpdateDBforum() function v1.3 (06 January 2003) : moved InitDBlog() function from log.inc added eMailTo() function v1.4 (07 January 2003) : introduced logh.dtb for not loosing all of logd.dtb data in case of accidental erasal of logd.dtb file v1.5 (10 January 2003) : no change v1.6 (23 January 2003) : added option to hide on the site the e-mail address of poster that is insertion of a new field ($fieldd1) in database and update in UpdateDBforum() and ActionOnFields() functions added StartTimer() and StopTimer() functions v1.7 (28 January 2003) : updated the eMailTo() function to add destination e-mail for recommend to a friend option created databases links.dtb and dnload.dtb files for category sorting of links and downloads these new databases (and art.dtb) are managed by the UpdateDBdtb() function insertion of a new field ($fieldd2) in database migrated news.dat management from admin.inc and upgraded it v1.8 (05 February 2003) : added category for forum that is update in UpdateDBforum() function v1.9 (11 February 2003) : moved make_seed() function (renamed as MakeSeed) from boxcita.inc (also used by the new boxban.inc banner management) v2.0 (27 February 2003) : added advanced photo service, that is ActionOnFields() function small update added BreakEMail() function v2.1 (10 March 2003) : no change v2.2 (22 April 2003) : added INCREP variable (needed for boxes free positionning) updated UpdateDBdtb() function for left and right articles boxes management upgraded CompteVisites() function to have it compliant to the GuppY DB added bmp type in IsImage() function updated souriez array definition for management of smileys themes added DrawSmileys() function cleanup in the images organization (Smileys) v2.3 (27 July 2003) : replaced mtitre class by titre class in htable1() background of central boxes also change color according to mouse move in htable() removed link on counters numbers in counter box in the AfficheCompteur() function added US date format management modified DrawSmileys() function added PathToImage() function added $ special character management in PutHR() v2.4 (24 September 2003) : upgraded CompteVisites() function to capture user pseudo of registered users added SplitText() function added react to an article option , that is new UpdateDBreact() function slightly upgraded the FileSizeInKb() function upgraded eMailTo() function to accept additional specific e-mailing according to webhosters added ReadDoc() and WriteDoc() functions and upgraded all required functions accordingly added ReadDocCounter(), WriteDocCounter() and UpdateDocCounter() functions created many new $d[something] variables and upgraded all required functions accordingly added GetCurrentDateTime(), FormatDate() and FormatDateStamp() functions to ease various date and time formatings reviewed all Files Read & Write functions added lookup for png and bmp images in IsImage() function added FileDBExist() and DestroyDBFile() functions added RemoveQuote() function added 3 additional free boxes (by Nicolas Alves and Laurent Duveau) created $typ_[name] variables and updated all scripts & functions accordingly upgraded forum indexes for a smaller size moved DejaVote() function from poll.php to functions.php (now also used for documents counters) and upgraded CompteVisites() function accordingly v3.0 (25 February 2004) : added CheckDB1Field(), CheckDB2Fields(), CountDBFields(), DeleteDBFieldById(), CutLongWords() and WrapLongWords() functions added GenerateUID() and KeepGoodChars() function modified ReadDoc() and ReadDocCounter() functions to take into account new forum archiving module, upgraded in all scripts accordingly news are now published in the RSS standard Web content syndication format instead of a GuppY specific format v4.0 (06 December 2004) : added new function Drawsmileys2() for new wywiwyg editors (by Icare) added new items and updated write and read functions for planner management (by Nicolas Alves) added new items and updated write and read functions for mails forum management (by Nicolas Alves) added name of smiley in souriez (by Icare) corrected PathToImage() (by Icare) added mail $eFrom (webmaster e-mail) in eMailTo function to prevent ineffective mail and added Content-Type to prevent excessive xmailer tags in the message (by Icare) v4.5 (07 June 2005) : corrected function readDoc(), conversion of "constant" variables in constants PHP, added IsFlash(), compare_XXX(), MakeRadioGroup() and GetNavBar() (by Jean-Mi) updated eMailTo, added optimized eMailHtmlTo (by JeanMi and Icare) */ if (stristr($_SERVER["SCRIPT_NAME"], "functions.php")) { header("location:../index.php"); die(); } define("CONNECTOR", "||"); define("TYP_ART", "ar"); define("TYP_BANNER", "ba"); define("TYP_DNLOAD", "dn"); define("TYP_FAQ", "fa"); define("TYP_FOOTER", "ft"); define("TYP_FORUM", "fr"); define("TYP_THREAD", "frth"); define("TYP_FREEBOX1", "f1"); define("TYP_FREEBOX2", "f2"); define("TYP_FREEBOX3", "f3"); define("TYP_FREEBOX4", "f4"); define("TYP_GUESTBK", "gb"); define("TYP_HOMEPG", "ed"); define("TYP_LINKS", "li"); define("TYP_MAIL", "ma"); define("TYP_NEWS", "ne"); define("TYP_NWL", "nl"); define("TYP_PHOTO", "ph"); define("TYP_REACT", "ra"); define("TYP_RECO", "re"); define("TYP_RSS", "rs"); define("TYP_SPECIAL", "sp"); define("TYP_THINK", "ci"); define("TYP_AGENDA", "ag"); define("DATAREP", "data/"); define("ARCHREP", CHEMIN.DATAREP."archive/"); define("CACHEREP", CHEMIN.DATAREP."cache/"); define("USEREP", CHEMIN.DATAREP."usermsg/"); define("FILECOUNTMSG", CHEMIN.DATAREP."countmsg/"); define("REDACREP", "redac/"); define("INCREP", "inc/"); define("DBEXT", ".dtb"); define("INCEXT", ".inc"); define("DBBASE", CHEMIN.DATAREP."doc"); define("DBIPBASE", CHEMIN.DATAREP."ipdoc"); define("DBPLUGIN", CHEMIN.DATAREP."plugin".DBEXT); define("CONFIG", CHEMIN.DATAREP."config".INCEXT); define("NEXTID", CHEMIN.DATAREP."nextid".DBEXT); define("NEXTIDBK", CHEMIN.DATAREP."nextidbk".DBEXT); define("DOCID", CHEMIN.DATAREP."docid".DBEXT); define("DBNEWSLETTER", CHEMIN.DATAREP."nwlist".DBEXT); define("DBNEWS", CHEMIN.DATAREP."news"); define("DBLOGBOOK", CHEMIN.DATAREP."logbook".DBEXT); define("DBAGENDA", CHEMIN.DATAREP.TYP_AGENDA.DBEXT); define("DBART", CHEMIN.DATAREP.TYP_ART.DBEXT); define("DBDNLOAD", CHEMIN.DATAREP.TYP_DNLOAD.DBEXT); define("DBFAQ", CHEMIN.DATAREP.TYP_FAQ.DBEXT); define("DBFORUMCAT", CHEMIN.DATAREP.TYP_FORUM."cat".DBEXT); define("DBFORUM", CHEMIN.DATAREP.TYP_FORUM.DBEXT); define("DBFORUMCOUNTER", CHEMIN.DATAREP.TYP_FORUM."count".DBEXT); define("DBTHREAD", CHEMIN.DATAREP.TYP_THREAD.DBEXT); define("DBFORUMARCHDATE", ARCHREP.TYP_FORUM."arch".DBEXT); define("DBFORUMARCH", ARCHREP.TYP_FORUM.DBEXT); define("DBTHREADARCH", ARCHREP.TYP_THREAD.DBEXT); define("DBLINKS", CHEMIN.DATAREP.TYP_LINKS.DBEXT); define("DBPHOTO", CHEMIN.DATAREP.TYP_PHOTO.DBEXT); define("DBPOLL", CHEMIN.DATAREP."poll".DBEXT); define("DBIPPOLL", CHEMIN.DATAREP."ippoll".DBEXT); define("DBREACT", CHEMIN.DATAREP.TYP_REACT.DBEXT); define("DBRSS", CHEMIN.DATAREP.TYP_RSS.DBEXT); define("DBCOUNTER", CHEMIN.DATAREP."counter".DBEXT); define("DBSTATS", CHEMIN.DATAREP."stats".DBEXT); define("DBSTATSBK", CHEMIN.DATAREP."statsbk".DBEXT); define("DBIPSTATS", CHEMIN.DATAREP."ipstats".DBEXT); define("DBLOGH", CHEMIN.DATAREP."logh".DBEXT); define("DBLOGD", CHEMIN.DATAREP."logd".DBEXT); define("DBLOGM", CHEMIN.DATAREP."logm".DBEXT); define("DBLOGY", CHEMIN.DATAREP."logy".DBEXT); define("DBLOGP", CHEMIN.DATAREP."logp".DBEXT); define("DBLOGDATE", CHEMIN.DATAREP."log_date".DBEXT); define("DBLOGFILES", CHEMIN.DATAREP."log_files".DBEXT); define("DBLOGSTATS", CHEMIN.DATAREP."log_stats".DBEXT); define("DBHOMEPAGE", CHEMIN.DATAREP.TYP_HOMEPG.INCEXT); define("DBFOOT", CHEMIN.DATAREP.TYP_FOOTER.INCEXT); define("DBSPECIAL", CHEMIN.DATAREP.TYP_SPECIAL.INCEXT); define("DBFREEBOX1", CHEMIN.DATAREP.TYP_FREEBOX1.INCEXT); define("DBFREEBOX2", CHEMIN.DATAREP.TYP_FREEBOX2.INCEXT); define("DBFREEBOX3", CHEMIN.DATAREP.TYP_FREEBOX3.INCEXT); define("DBFREEBOX4", CHEMIN.DATAREP.TYP_FREEBOX4.INCEXT); define("DBANTISPAM", CHEMIN.DATAREP."antispam".DBEXT); define("HIT_TIME", 1800); define('ANTISPAM_COUNT', 100); define('ANTISPAM_DELAY', 30); $couleurs = array("bleu", "jaune", "marron", "or", "orange", "outremer", "rose", "rouge", "vert", "violet"); $souriez = array( array("|:-)", "inc/img/smileys/cool.gif", "cool"), array(";-)", "inc/img/smileys/wink.gif", "wink"), array(":-))", "inc/img/smileys/biggrin.gif", "biggrin"), array(":-)", "inc/img/smileys/smile.gif", "smile"), array(":-o", "inc/img/smileys/frown.gif", "frown"), array(":o)", "inc/img/smileys/eek.gif", "eek"), array(":-((", "inc/img/smileys/mad.gif", "mad"), array(":-(", "inc/img/smileys/confused.gif", "confused"), array("8-)", "inc/img/smileys/rolleyes.gif", "rolleyes"), array(":-p", "inc/img/smileys/tongue.gif", "tongue"), array(";-(", "inc/img/smileys/cry.gif", "cry") ); function souriez($chaine) { global $souriez; $traite = str_replace($souriez[0][0], "\"cool\"", $chaine); $traite = str_replace($souriez[1][0], "\"wink\"", $traite); $traite = str_replace($souriez[2][0], "\"biggrin\"", $traite); $traite = str_replace($souriez[3][0], "\"smile\"", $traite); $traite = str_replace($souriez[4][0], "\"frown\"", $traite); $traite = str_replace($souriez[5][0], "\"eek\"", $traite); $traite = str_replace($souriez[6][0], "\"mad\"", $traite); $traite = str_replace($souriez[7][0], "\"confused\"", $traite); $traite = str_replace($souriez[8][0], "\"rolleyes\"", $traite); $traite = str_replace($souriez[9][0], "\"tongue\"", $traite); $traite = str_replace($souriez[10][0], "\"cry\"", $traite); return $traite; } function replaceimg($chaine) { global $souriez,$site; $traite = str_replace($souriez[0][0],"", $chaine); $traite = str_replace($souriez[1][0],"", $traite); $traite = str_replace($souriez[2][0],"", $traite); $traite = str_replace($souriez[3][0],"", $traite); $traite = str_replace($souriez[4][0],"", $traite); $traite = str_replace($souriez[5][0],"", $traite); $traite = str_replace($souriez[6][0],"", $traite); $traite = str_replace($souriez[7][0],"", $traite); $traite = str_replace($souriez[8][0],"", $traite); $traite = str_replace($souriez[9][0],"", $traite); $traite = str_replace($souriez[10][0],"", $traite); return $traite; } function DrawSmileys($num) { global $souriez; for ($i = 0; $i < count($souriez); $i++) { echo "\"".$souriez[$i][0]."\" "; } } function DrawSmileys2() { global $souriez; echo " "; for ($i = 0; $i < count($souriez); $i++) { echo " \"".$souriez[$i][2]."\""; } } function AfficheCompteur($chemino, $hits, $grow = 1) { $spot = ""; for ($lecon = 0; $lecon < $grow - strlen($hits); $lecon++ ) { $spot .= "\"\""; } for ($lecon = 0; $lecon < strlen($hits); $lecon++) { $cols = substr($hits, $lecon, 1); $spot .= "\"\""; } echo $spot; } function DejaVote($file_ip, $d_time = 0) { global $REMOTE_ADDR, $userprefs; $remoteadr = $REMOTE_ADDR; $nbr_connect = 0; $var_bool = false; $user_bool = false; $subdata = array(); $var_ip = array(); $k = 0; if ($d_time == 0) { $d_time = HIT_TIME; } $subdata = ReadDBFields($file_ip); $now_time = time(); for ($i = 0; $i < count($subdata); $i++) { list($jour, $mois, $annee) = explode("/", substr($subdata[$i][1], 0, 10)); list($heure, $minute, $seconde) = explode(":", substr($subdata[$i][1], 10, 18)); if ($now_time < mktime($heure, $minute, $seconde, $mois, $jour, $annee) + $d_time) { $nbr_connect++; $var_ip[$k][0] = $subdata[$i][0]; if ($remoteadr == $subdata[$i][0]) { $var_bool = true; } $var_ip[$k][1] = $subdata[$i][1]; if ($userprefs[5] != "") { $uprefname = $userprefs[1]; } else { $uprefname = ""; } if ($remoteadr == $subdata[$i][0] && $uprefname != $subdata[$i][2]) { $user_bool = true; $var_ip[$k][2] = $uprefname; } else { $var_ip[$k][2] = $subdata[$i][2]; } $k++; } } if (!$var_bool) { $var_ip[$k][0] = $remoteadr; $var_ip[$k][1] = date("d/m/Y H:i:s"); $var_ip[$k][2] = $userprefs[1]; WriteDBFields($file_ip,$var_ip); $nbr_connect++; } elseif ($user_bool) { WriteDBFields($file_ip,$var_ip); } $retcmpt[0] = $var_bool; $retcmpt[1] = $nbr_connect; return $retcmpt; } function CompteVisites($file_ip, $file_counter) { $subdata = DejaVote($file_ip); $nbr_visit = ReadCounter($file_counter); if (!$subdata[0] && ($nbr_visit > 0)) { $nbr_visit++; WriteCounter($file_counter,$nbr_visit); } $retcmpt[0] = $nbr_visit; $retcmpt[1] = $subdata[1]; return $retcmpt; } function IsImage($extn) { $imgok = 0; $extn = strtolower($extn); if ($extn == "gif" || $extn == "jpg" || $extn == "jpeg" || $extn == "png" || $extn == "bmp") { $imgok = 1; } return $imgok; } function IsFlash($extn) { $imgok = 0; $extn = strtolower($extn); if ($extn == "swf") { $imgok = 1; } return $imgok; } function ExtImage($extn){ $extn = strtolower($extn); if ($extn == "js"){ return "js"; } if ($extn == "css"){ return "css"; } if ($extn == "php"){ return "php"; } if ($extn == "php3"){ return "php"; } if ($extn == "htm"){ return "html"; } if ($extn == "html"){ return "html"; } if ($extn == "phtml"){ return "php"; } if ($extn == "gif"){ return "gif"; } if ($extn == "jpg"){ return "jpg"; } if ($extn == "png"){ return "png"; } if ($extn == "bmp"){ return "bmp"; } if ($extn == "jpeg"){ return "jpg"; } if ($extn == "gz"){ return "zip"; } if ($extn == "cab"){ return "zip"; } if ($extn == "zip"){ return "zip"; } if ($extn == "ace"){ return "zip"; } if ($extn == "tgz"){ return "zip"; } if ($extn == "tar"){ return "zip"; } if ($extn == "rar"){ return "zip"; } if ($extn == "wav"){ return "wav"; } if ($extn == "mid"){ return "mid"; } if ($extn == "mp3"){ return "mp3"; } if ($extn == "exe"){ return "exe"; } if ($extn == "bat"){ return "bat"; } if ($extn == "com"){ return "com"; } if ($extn == "pif"){ return "com"; } if ($extn == "mov"){ return "wav"; } if ($extn == "avi"){ return "wav"; } if ($extn == "mpg"){ return "wav"; } if ($extn == "swf"){ return "swf"; } if ($extn == "mpeg"){ return "wav"; } if ($extn == "txt"){ return "txt"; } if ($extn == "nfo"){ return "txt"; } return "inconnu"; } function PathAbs($matches) { if(!preg_match("`^(https?|ftp|mailto|javascript)\://`i", $matches[3])) { $matches[0] = $matches[1].$matches[2].CHEMIN.$matches[3]; } return $matches[0]; } function PathToImage($text) { return preg_replace_callback("`( href=|src=)(\"|')?([^ >]+)`i", 'PathAbs', $text); } function SplitText($textin,$textlen) { $textout = array(); $out1 = $textin; $out2 = ""; if (strlen($textin) > $textlen) { $tempout = strrpos(substr($textin,0,$textlen)," "); if ($tempout < 1) { $tempout = strpos($textin," "); } if ($tempout > 0) { $out1 = substr($textin,0,$tempout); $out2 = substr($textin,$tempout+1,strlen($textin)-$tempout); } } $textout[0] = $out1; $textout[1] = $out2; return $textout; } function CutLongWord($textin,$textlen=50) { $textout = substr($textin,0,$textlen); return $textout; } function WrapLongWords($textin,$textlen=50,$textrep=" ") { $textout = wordwrap($textin,$textlen,$textrep,1); return $textout; } function FormatDateStamp($datein) { global $site; if ($site[19] == "E1") { $formatout = "d/m/Y"; } elseif ($site[19] == "E2") { $formatout = "d.m.Y"; } elseif ($site[19] == "U1") { $formatout = "m/d/Y"; } elseif ($site[19] == "U2") { $formatout = "m.d.Y"; } elseif ($site[19] == "C1") { $formatout = "Y/m/d"; } else { $formatout = "Y.m.d"; } $formatout .= " ".$site[23]." "; if ($site[22] == "H1") { $formatout .= "H:i"; } elseif ($site[22] == "H2") { $formatout .= "H\hi"; } else { $formatout .= "h:i A"; } $dateout = date($formatout,$datein); return $dateout; } function FormatDate($datein) { global $site; $jour = substr($datein,6,2); $mois = substr($datein,4,2); $annee = substr($datein,0,4); $heure = substr($datein,8,2); $minute = substr($datein,10,2); if ($site[19] == "E1") { $dateout = $jour."/".$mois."/".$annee; } elseif ($site[19] == "E2") { $dateout = $jour.".".$mois.".".$annee; } elseif ($site[19] == "U1") { $dateout = $mois."/".$jour."/".$annee; } elseif ($site[19] == "U2") { $dateout = $mois.".".$jour.".".$annee; } elseif ($site[19] == "C1") { $dateout = $annee."/".$mois."/".$jour; } else { $dateout = $annee.".".$mois.".".$jour; } $dateout .= " ".$site[23]." "; if ($site[22] == "H1") { $dateout .= $heure.":".$minute; } elseif ($site[22] == "H2") { $dateout .= $heure."h".$minute; } else { if ($heure < 12) { $dateout .= $heure.":".$minute." AM"; } else { $dateout .= ($heure-12).":".$minute." PM"; } } return $dateout; } function GetCurrentDateTime() { $dateout = date("YmdHi"); return $dateout; } function FileSizeInKb($fic) { $taille=@filesize($fic); if ($taille !== false) { $taille = round($taille/1024); } return $taille; } function FileDBExist($fic) { $filetest = is_file($fic); return $filetest; } function DestroyDBFile($fic) { @chmod($fic,0755); @chmod($fic,0777); @unlink($fic); } function ReadCounter($fic) { $DataDB = 0; if (FileDBExist($fic)) { $fhandle = fopen($fic, "r"); if (filesize($fic)) { $DataDB = trim(fgets($fhandle, filesize($fic))); } fclose($fhandle); } return $DataDB; } function WriteCounter($fic,$DataDB) { $fhandle = fopen($fic, "w"); fputs($fhandle, $DataDB."\n"); fclose($fhandle); } function ReadFullDB($fic) { $DataDB = Array(); if (FileDBExist($fic)) { $DataDB = implode("", file($fic)); } return $DataDB; } function WriteFullDB($fic,$DataDB) { $fhandle = fopen($fic, "w"); fputs($fhandle, $DataDB); fclose($fhandle); } function AppendFullDB($fic,$DataDB) { $fhandle = fopen($fic, "a"); fputs($fhandle, $DataDB); fclose($fhandle); } function CountDBFields($fic) { $DataNB = 0; if (FileDBExist($fic)) { $DataDB = file($fic); $DataNB = count($DataDB); } return $DataNB; } function ReadDBFields($fic) { $DataDB = array(); $Fields = array(); if (FileDBExist($fic)) { $DataDB = file($fic); for ($i = 0; $i < count($DataDB); $i++) { $Fields[$i] = explode(CONNECTOR,trim($DataDB[$i])); } } return $Fields; } function WriteDBFields($fic,$Fields) { $fhandle = fopen($fic, "w"); $DataDB = ""; for ($i = 0; $i < count($Fields); $i++) { for ($j = 0 ; $j < (count($Fields[$i])-1); $j++) { $DataDB .= trim($Fields[$i][$j]).CONNECTOR; } $DataDB .= trim($Fields[$i][count($Fields[$i])-1])."\n"; } fputs($fhandle, $DataDB); fclose($fhandle); } function AppendDBFields($fic,$Fields) { $fhandle = fopen($fic, "a"); $DataDB = ""; for ($i = 0 ; $i < (count($Fields)-1); $i++) { $DataDB .= trim($Fields[$i]).CONNECTOR; } $DataDB .= trim($Fields[count($Fields)-1])."\n"; fputs($fhandle, $DataDB); fclose($fhandle); } function DeleteDBFieldById($fic, $id=0) { $array = explode("\n", fread(fopen($fic, "r"), filesize($fic))); $delete = array_pop($array); unset($array[$id]); $newarray = array_values($array); $fhandle = fopen($fic,"w"); for($i=0; $i< count($newarray); $i++){ fwrite($fhandle,$newarray[$i]."\n"); } fclose($fhandle); } function CheckDB1Field($fic,$submit,$FieldNB) { $controle = False; if (FileDBExist($fic)) { $DataDB = ReadDBFields($fic); for ($i = 0; $i < count($DataDB); $i++) { if (@stristr($DataDB[$i][$FieldNB],$submit)) { $controle = True; } } } return $controle; } function CheckDB2Fields($fic,$submit1,$FieldNB1,$submit2,$FieldNB2) { $controle = False; if (FileDBExist($fic)) { $DataDB = ReadDBFields($fic); for ($i = 0; $i < count($DataDB); $i++) { if (@stristr($DataDB[$i][$FieldNB1],$submit1) && @stristr($DataDB[$i][$FieldNB2],$submit2)) { $controle = True; } } } return $controle; } function SelectDBFieldsByID($Fields,$id) { $DataDB = array(); $k = 0; for ($i = 0; $i < count($Fields); $i++) { if ($Fields[$i][1] == $id) { for ($j = 0 ; $j < count($Fields[$i]); $j++) { $DataDB[$k][$j] = $Fields[$i][$j]; } $k++; } } return $DataDB; } function SelectDBFieldsByType($Fields,$type) { $DataDB = array(); $k = 0; for ($i = 0; $i < count($Fields); $i++) { if ($Fields[$i][0] == $type) { for ($j = 0 ; $j < count($Fields[$i]); $j++) { $DataDB[$k][$j] = $Fields[$i][$j]; } $k++; } } return $DataDB; } function SelectDBFieldsByNotStatus($Fields,$status) { $DataDB = array(); $k = 0; for ($i = 0; $i < count($Fields); $i++) { if ($Fields[$i][2] != $status) { for ($j = 0 ; $j < count($Fields[$i]); $j++) { $DataDB[$k][$j] = $Fields[$i][$j]; } $k++; } } return $DataDB; } function SelectDBFieldsByStatus($Fields,$status) { $DataDB = array(); $k = 0; for ($i = 0; $i < count($Fields); $i++) { if ($Fields[$i][2] == $status) { for ($j = 0 ; $j < count($Fields[$i]); $j++) { $DataDB[$k][$j] = $Fields[$i][$j]; } $k++; } } return $DataDB; } function SelectDBFields($type,$status,$id) { $DataDB = array(); if (!empty($status) && !empty($id)) { $DataDB = SelectDBFieldsByID(SelectDBFieldsByStatus(SelectDBFieldsByType(ReadDBFields(DOCID),$type),$status),$id); } elseif (!empty($status)) { $DataDB = SelectDBFieldsByStatus(SelectDBFieldsByType(ReadDBFields(DOCID),$type),$status); } elseif (!empty($id)) { $DataDB = SelectDBFieldsByID(SelectDBFieldsByType(ReadDBFields(DOCID),$type),$id); } else { $DataDB = SelectDBFieldsByType(ReadDBFields(DOCID),$type); } return $DataDB; } function RemoveQuote($chaine) { $traite = str_replace("'", "", $chaine); return $traite; } function RemoveConnector($chaine) { $traite = str_replace(CONNECTOR, "", $chaine); return $traite; } function RemoveBR($chaine) { $traite = eregi_replace("
", "\n", $chaine); return $traite; } function PutBR($chaine) { $traite = str_replace(chr(10),"
",$chaine); $traite = str_replace(chr(13),"",$traite); return $traite; } function RemoveHR($chaine) { $traite = str_replace("


", "


", $chaine); return $traite; } function PutHR($chaine) { $traite = eregi_replace("
", "


", $chaine); $traite = str_replace("$","$­",$traite); return $traite; } function ReadDocCounter($dirid) { $DataDB = ReadCounter($dirid.DBEXT); return $DataDB; } function WriteDocCounter($dirid,$DataDB) { WriteCounter($dirid.DBEXT,$DataDB); } function UpdateDocCounter($id) { $DataDB = ReadDocCounter(DBBASE.$id); $vote = DejaVote(DBIPBASE.$id.DBEXT,300); if ($vote[0] == false) { $DataDB++; WriteDocCounter(DBBASE.$id,$DataDB); } return $DataDB; } function ReadDoc($dirid) { global $type,$fileid,$status,$creadate,$moddate,$author,$email, $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldc1,$fieldc2,$fieldd1,$fieldd2,$fieldweb,$fieldmail; $type = ""; $fileid = ""; $status = ""; $creadate = ""; $moddate = ""; $author = ""; $email = ""; $fielda1 = ""; $fielda2 = ""; $fieldb1 = ""; $fieldb2 = ""; $fieldc1 = ""; $fieldc2 = ""; $fieldd1 = ""; $fieldd2 = ""; $fieldweb = ""; $fieldmail = ""; if (FileDBExist($dirid.INCEXT)) { include($dirid.INCEXT); } } function WriteDoc() { global $type,$fileid,$status,$creadate,$moddate,$author,$email, $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldc1,$fieldc2,$fieldd1,$fieldd2,$fieldweb,$fieldmail; $rec = ""; ?> |
|

", "\n", eregi_replace("
|
", "\n \n", $eMsgHtml))); if ($eMsgHtml == '') $eMsgHtml = eregi_replace("\n", "
", eregi_replace("\n \n", "
", $eMsgTxt)); $eHeadersText = "Content-Type: text/plain; charset=".$charset."\n"; $eHeadersText .= "Content-Transfer-Encoding: 8bit\n\n"; $eHeadersHtml = "Content-Type: text/html; charset=".$charset."\n"; $eHeadersHtml .= "Content-Transfer-Encoding: 8bit\n\n"; $eSeparator = "==S=E=P=A=R=A=T=O=R=="; $eHeadersMixt = "MIME-Version: 1.0\n"; $eHeadersMixt .= "Content-Type: multipart/alternative; boundary=\"".$eSeparator."\"\n\n"; $eHeaders = $eHeadersMixt; $eMessage = "--".$eSeparator."\n".$eHeadersText."\n".$eMsgText."\n\n"; $eMessage .= "--".$eSeparator."\n".$eHeadersHtml."\n".$eMsgHtml."\n\n"; $eMessage .= "--".$eSeparator."--\n"; if ($supervision[5] == "standard") { @mail($eTo, $eSubject, $eMessage, "From :".$eFrom."\n".$eHeaders); } else { include (CHEMIN.INCREP."mail/".$supervision[5].INCEXT); } } function BreakEMail($eminput) { $eminput = trim($eminput); $em1 = strpos($eminput,"@"); $em2 = strrpos($eminput,"."); $emoutput[0] = substr($eminput,0,$em1); $emoutput[1] = substr($eminput,$em1+1,$em2-$em1-1); $emoutput[2] = substr($eminput,$em2+1); return $emoutput; } function StartTimer() { global $starttime; $mtime = microtime(); $mtime = explode(' ', $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; } function StopTimer() { global $starttime; $mtime = microtime(); $mtime = explode(' ', $mtime); $mtime = $mtime[1] + $mtime[0]; $stoptime = round (($mtime - $starttime), 2); return $stoptime; } function MakeSeed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } function GenerateUID() { srand(MakeSeed()); $gene = rand(1,9); for ($i = 0; $i <9; $i++) { $gene .= rand(0,9); } return $gene; } function KeepGoodChars($textin) { $textout = eregi_replace("[^a-zA-Z0-9_]","",$textin); return $textout; } function ValUnique($tableau) { for ($i = 0, $n = count($tableau); $i < $n; $i++) $NewTableau[$tableau[$i]] = 1; @reset($NewTableau); for ($i = 0, $n = count($NewTableau); $i < $n; $i++) { $KeyUnique[] = key($NewTableau); @next($NewTableau); } return $KeyUnique; } function compare_id1($a, $b) { return ($a[1] < $b[1] ? -1 : +1 ); } function compare_db2($a, $b) { if ($a[1] == $b[1]) { return($a[2] < $b[2] ? -1 : +1); } else { return($a[1] < $b[1] ? -1 : +1); } } function GetNavBar( $url, $maxItem, $currentPage = 1, $nbItemPage = 10, $imgBegin = 'inc/img/general/debut.gif', $imgPrev = 'inc/img/general/precedent.gif', $imgNext = 'inc/img/general/suivant.gif', $imgEnd = 'inc/img/general/fin.gif', $imgBeginN = 'inc/img/general/debut_n.gif', $imgPrevN = 'inc/img/general/precedent_n.gif', $imgNextN = 'inc/img/general/suivant_n.gif', $imgEndN = 'inc/img/general/fin_n.gif', $imgMinus = 'inc/img/general/minuspg.gif', $imgPlus = 'inc/img/general/pluspg.gif', $decade = 10 ) { global $page, $web32, $web34, $web336, $web337, $web338, $web339, $web340, $web341; $out = ''; if ($maxItem > $nbItemPage) { $nbPage=(ceil($maxItem/$nbItemPage)); $out .= '
'; $out .= ''; if ($currentPage > 1) { $out .= ''; $out .= ''; } else { $out .= ''; $out .= ''; } $out .= ''; if ($currentPage < $nbPage) { $out .= ''; $out .= ''; } else { $out .= ''; $out .= ''; } $out .= '
'.$web339.''.$web32.''.$web339.''.$web32.''; $nbpg = 1; $pgDebut = floor($currentPage / $decade) * $decade; $pgFin = ceil($currentPage / $decade) * $decade; if ($pgDebut == $pgFin) { $pgDebut = $pgFin - $decade; } if ($currentPage > $pgDebut && $currentPage <= $pgFin) { $decadeDebut = $pgDebut; $decadeFin = $pgFin; if ($nbPage >= $decadeFin) { $paq = $decade; } else{ $paq = $nbPage - $decadeDebut; } } if ($currentPage > $decade && $decadeDebut < $nbPage) { if ($nbPage - $decade + $decadeFin > $decade) { $nbPrevPage = $decade; } else { $nbPrevPage = $nbPage - $decade + $decadeFin; } if ($nbPrevPage > 1) { $txtPrevPage = $nbPrevPage." ".$web340; } else { $txtPrevPage = $nbPrevPage." ".$web341; } $out .= ''.$txtPrevPage.''; } $out .= ' [ '; for($i = 1; $i <= $paq; $i++) { if ($i + $decadeDebut <> $currentPage) { $out .= ''.($nbpg + $decadeDebut).' '; } else { $out .= ''.($nbpg + $decadeDebut).' '; } $nbpg++; } $out .= '] '; if($currentPage <= $decadeFin && $decadeFin < $nbPage) { if($nbPage - $decade - $decadeDebut > $decade) { $nbSuivPage = $decade; } else { $nbSuivPage = $nbPage - $decade - $decadeDebut; } if ($nbSuivPage > 1) { $txtSuivPage = $nbSuivPage." ".$web337; } else { $txtSuivPage = $nbSuivPage." ".$web336; } $out .= ''.$txtSuivPage.''; } $out .=''.$web34.''.$web338.''.$web34.''.$web338.'
'; } return $out; } function MakeRadioGroup($groupe) { global $admin31, $admin32, $admin34, $admin60, $admin89; foreach ($groupe as $index=>$element) { $present = $element[0]; $futur = $element[1]; $id = $element[2]; switch ($present.$futur) { case "ai" : $img1 = 'admin/inc/img/files/on1.gif'; $img2 = 'admin/inc/img/files/off2.gif'; $alt = $admin32; break; case "ia" : $img1 = 'admin/inc/img/files/off1.gif'; $img2 = 'admin/inc/img/files/on2.gif'; $alt = $admin34; break; case "ad" : $img1 = 'admin/inc/img/files/supa1.gif'; $img2 = 'admin/inc/img/files/sup2.gif'; $alt = $admin31; break; case "id" : $img1 = 'admin/inc/img/files/supi1.gif'; $img2 = 'admin/inc/img/files/sup2.gif'; $alt = $admin31; break; case "ds" : $img1 = 'admin/inc/img/files/sup1.gif'; $img2 = 'admin/inc/img/files/sup2.gif'; $alt = $admin60; break; case "di" : $img1 = 'admin/inc/img/files/save1.gif'; $img2 = 'admin/inc/img/files/save2.gif'; $alt = $admin89; break; } $name1 = $futur . '_' . $id; echo " "; $args = "'rb".$id."o', 'rb".$id."x', 0, ".count($groupe).", ".$index.", 'inline'" ; $name = 'rb' . $id . 'o' . $index; echo "\"".$alt."\""; $args = "'rb".$id."o', 'rb".$id."x', ".$index.", 'inline'" ; $name = 'rb' . $id . 'x' . $index; echo "\"".$alt."\""; } } function attribut($attribut, $value) { if (!empty($value)) { return $attribut.'="'.$value.'"'; } return ""; } function Formatage($format, $in) { $out = ""; if (!empty($in) && !empty($format)) $out = str_replace(" ", " ", sprintf($format, $in)); return($out); } function IncrNextID() { $nextidbk = ReadCounter(NEXTIDBK); $nextid = ReadCounter(NEXTID) + 1; if ($nextid < $nextidbk) $nextid = $nextidbk + 1; while (file_exists(DBBASE.$nextid.INCEXT)) $nextid++; WriteCounter(NEXTID, $nextid); if ($nextid > $nextidbk + 10) WriteCounter(NEXTIDBK, $nextid); return $nextid; } ?>