[ PHPXref.com ] [ Generated: Sun Jul 20 18:04:10 2008 ] [ GuppY 4.5.12 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/install/ -> functions22.php (source)

   1  <?
   2  /*

   3      Functions - miniPortail PHP Script version 2.2

   4      CeCILL Copyright (C) 2004-2005 by Laurent Duveau

   5      Initiated by Laurent Duveau and Nicolas Alvès,

   6      followed by Albert Aymard, Jean Michel Misrachi and all the Team

   7        Web site = http://www.aldweb.com/

   8        e-mail   = info@aldweb.com

   9  

  10      Version History :

  11        v1.0 (30 December 2002) : initial release

  12        v1.1 (02 January 2003)  : added AppendDBFields() function

  13                                  replaced WriteDBFields() by AppendDBFields() where appropriate

  14                                    (in order to avoid overwrites when more users perform "add" simultaneously)

  15        v1.2 (05 January 2003)   : created database art.dtb for quicker display

  16                                     this new database is managed by the UpdateDBart() function => see update v1.7

  17                                   created databases thread.dtb and forum.dtb for quicker display of forum threads

  18                                     these new databases are managed by the UpdateDBforum() function

  19        v1.3 (06 January 2003)   : moved InitDBlog() function from log.inc

  20                                   added eMailTo() function

  21        v1.4 (07 January 2003)   : introduced logh.dtb for not loosing all of logd.dtb data

  22                                     in case of accidental erasal of logd.dtb file

  23        v1.5 (10 January 2003)   : no change

  24        v1.6 (23 January 2003)   : added option to hide on the site the e-mail address of poster

  25                                     that is insertion of a new field ($fieldd1) in database and

  26                                     update in UpdateDBforum() and ActionOnFields() functions

  27                                   added StartTimer() and StopTimer() functions

  28        v1.7 (28 January 2003)   : updated the eMailTo() function to add destination e-mail for recommend to a friend option

  29                                   created databases links.dtb and dnload.dtb files for category sorting of links and downloads

  30                                     these new databases (and art.dtb) are managed by the UpdateDBdtb() function

  31                                     insertion of a new field ($fieldd2) in database

  32                                   migrated news.dat management from admin.inc and upgraded it

  33        v1.8 (05 February 2003)  : added category for forum

  34                                     that is update in UpdateDBforum() function

  35        v1.9 (11 February 2003)  : moved make_seed() function (renamed as MakeSeed) from boxcita.inc (also used by

  36                                     the new boxban.inc banner management)

  37        v2.0 (27 February 2003)  : added advanced photo service, that is ActionOnFields() function small update

  38                                   added BreakEMail() function

  39        v2.1 (10 March 2003)     : no change

  40        v2.2 (22 April 2003)     : added INCREP variable (needed for boxes free positionning)

  41                                   updated UpdateDBdtb() function for left and right articles boxes management

  42                                   upgraded CompteVisites() function to have it compliant to the miniPortail DB

  43                                   added bmp type in IsImage() function

  44                                   updated souriez array definition for management of smileys themes

  45                                   added DrawSmileys() function

  46                                   cleanup in the images organization (Smileys)

  47  */
  48  
  49  if (stristr($_SERVER["SCRIPT_NAME"], "functions22.php")) {
  50    header("location:../index.php");
  51    die();
  52  }
  53  define("CONNECTOR", "||");
  54  define("DATAREP", "data/");
  55  define("INCREP", "inc/");
  56  define("DBEXT", ".dtb");
  57  define("INCEXT", ".inc");
  58  define("DBBASE", CHEMIN.DATAREP."doc");
  59  define("NEXTID", CHEMIN.DATAREP."nextid".DBEXT);
  60  define("DOCID", CHEMIN.DATAREP."docid".DBEXT);
  61  define("DBART", CHEMIN.DATAREP.TYP_ART.DBEXT);
  62  define("DBLINKS", CHEMIN.DATAREP.TYP_LINKS.DBEXT);
  63  define("DBDNLOAD", CHEMIN.DATAREP.TYP_DNLOAD.DBEXT);
  64  define("DBTHREAD", CHEMIN.DATAREP.TYP_THREAD.DBEXT);
  65  define("DBFORUM", CHEMIN.DATAREP.TYP_FORUM.DBEXT);
  66  define("DBFORUMCAT", CHEMIN.DATAREP.TYP_FORUM."cat".DBEXT);
  67  define("DBPHOTO", CHEMIN.DATAREP.TYP_PHOTO.DBEXT);
  68  define("DBLOGH", CHEMIN.DATAREP."logh".DBEXT);
  69  define("DBLOGD", CHEMIN.DATAREP."logd".DBEXT);
  70  define("DBLOGM", CHEMIN.DATAREP."logm".DBEXT);
  71  define("DBLOGY", CHEMIN.DATAREP."logy".DBEXT);
  72  define("DBLOGP", CHEMIN.DATAREP."logp".DBEXT);
  73  
  74  define("HIT_TIME", 1800);
  75  
  76  $couleurs = array("bleu", "jaune", "marron", "or", "orange", "outremer", "rose", "rouge", "vert", "violet");
  77  $souriez = array(
  78               array("|:-)", "inc/img/smileys/cool.gif"),
  79               array(";-)", "inc/img/smileys/wink.gif"),
  80               array(":-))", "inc/img/smileys/biggrin.gif"),
  81               array(":-)", "inc/img/smileys/smile.gif"),
  82               array(":-o", "inc/img/smileys/frown.gif"),
  83               array(":o)", "inc/img/smileys/eek.gif"),
  84               array(":-((", "inc/img/smileys/mad.gif"),
  85               array(":-(", "inc/img/smileys/confused.gif"),
  86               array("8-)", "inc/img/smileys/rolleyes.gif"),
  87               array(":-p", "inc/img/smileys/tongue.gif"),
  88               array(";-(", "inc/img/smileys/cry.gif")
  89             );
  90  
  91  function htable($tblti, $largeur) {
  92    global $texte;
  93    echo "<table cellspacing=\"0\" cellpadding=\"1\" border=\"0\" align=\"center\" width=\"".$largeur."\" class=\"bordure\"><tr><td>\n";
  94    echo "<table cellspacing=\"1\" cellpadding=\"5\" border=\"".$texte[4]."\" align=\"center\" width=\"100%\">\n";
  95    echo "<tr><td nowrap class=\"tbl1\"><p class=\"titre\"><b>".$tblti."</b></p></td></tr>\n";
  96    echo "<tr><td class=\"tbl2\">\n\n";
  97  }
  98  
  99  function htable1($tblti) {
 100    global $texte;
 101    echo "<table cellspacing=\"0\" cellpadding=\"1\" border=\"0\" align=\"center\" width=\"100%\" class=\"bordure\"><tr><td>\n";
 102    echo "<table cellspacing=\"1\" cellpadding=\"5\" border=\"".$texte[4]."\" align=\"center\" width=\"100%\">\n";
 103    echo "<tr><td nowrap class=\"tbl1\"><p class=\"mtitre\" align=\"center\"><b>".$tblti."</b></p></td></tr>\n";
 104    echo "<tr><td class=\"tbl2\" onMouseOver=\"this.className = 'tbl2over';\" onMouseOut=\"this.className = 'tbl2';\">\n\n";
 105  }
 106  
 107  function btable() {
 108    echo "\n</td></tr></table>\n";
 109    echo "\n</td></tr></table>\n";
 110  }
 111  
 112  function IsImage($extn) {
 113    $imgok = 0;
 114    $extn = strtolower($extn);
 115    if ($extn == "gif" || $extn == "jpg" || $extn == "jpeg") {
 116      $imgok = 1;
 117    }
 118    return $imgok;
 119  }
 120  
 121  function ExtImage($extn){
 122    $extn = strtolower($extn);
 123    if ($extn == "php"){ return "php"; }
 124    if ($extn == "php3"){ return "php"; }
 125    if ($extn == "phtml"){ return "php"; }
 126    if ($extn == "htm"){ return "html"; }
 127    if ($extn == "html"){ return "html"; }
 128    if ($extn == "js"){ return "js"; }
 129    if ($extn == "css"){ return "css"; }
 130  
 131    if ($extn == "gif"){ return "gif"; }
 132    if ($extn == "jpg"){ return "jpg"; }
 133    if ($extn == "jpeg"){ return "jpg"; }
 134    if ($extn == "png"){ return "png"; }
 135    if ($extn == "bmp"){ return "bmp"; }
 136  
 137    if ($extn == "cab"){ return "zip"; }
 138    if ($extn == "zip"){ return "zip"; }
 139    if ($extn == "ace"){ return "zip"; }
 140    if ($extn == "tgz"){ return "zip"; }
 141    if ($extn == "gz"){ return "zip"; }
 142    if ($extn == "tar"){ return "zip"; }
 143    if ($extn == "rar"){ return "zip"; }
 144  
 145    if ($extn == "wav"){ return "wav"; }
 146    if ($extn == "mid"){ return "mid"; }
 147    if ($extn == "mp3"){ return "mp3"; }
 148  
 149    if ($extn == "exe"){ return "exe"; }
 150    if ($extn == "bat"){ return "bat"; }
 151    if ($extn == "com"){ return "com"; }
 152    if ($extn == "pif"){ return "com"; }
 153  
 154    if ($extn == "mov"){ return "wav"; }
 155    if ($extn == "avi"){ return "wav"; }
 156    if ($extn == "mpg"){ return "wav"; }
 157    if ($extn == "mpeg"){ return "wav"; }
 158    if ($extn == "swf"){ return "swf"; }
 159  
 160    if ($extn == "txt"){ return "txt"; }
 161    if ($extn == "nfo"){ return "txt"; }
 162    return "inconnu";
 163  }
 164  
 165  function FileSizeInKb($fic) {
 166    global $size_unit;
 167    $taille=filesize($fic);
 168    $taille = round($taille/1024);
 169    return $taille;
 170  }
 171  
 172  function ReadCounter($fic) {
 173    $fhandle = fopen($fic, "r");
 174    $DataDB = trim(fgets($fhandle, filesize($fic)));
 175    fclose($fhandle);
 176    return $DataDB;
 177  }
 178  
 179  function WriteCounter($fic,$DataDB) {
 180    $fhandle = fopen($fic, "w");
 181    fputs($fhandle, $DataDB."\n");
 182    fclose($fhandle);
 183  }
 184  
 185  function ReadFullDB($fic) {
 186    $DataDB = implode("", file($fic));
 187    return $DataDB;
 188  }
 189        
 190  function WriteFullDB($fic,$DataDB) {
 191    $fhandle = fopen($fic, "w");
 192    fputs($fhandle, $DataDB);
 193    fclose($fhandle);
 194  }
 195  
 196  function AppendFullDB($fic,$DataDB) {
 197    $fhandle = fopen($fic, "a");
 198    fputs($fhandle, $DataDB);
 199    fclose($fhandle);
 200  }
 201  
 202  function ReadDBFields($fic) {
 203    $DataDB = file($fic);
 204    for ($i = 0; $i < count($DataDB); $i++) {
 205      $Fields[$i] = explode(CONNECTOR,trim($DataDB[$i]));
 206    }
 207    return $Fields;
 208  }
 209  
 210  function WriteDBFields($fic,$Fields) {
 211    $fhandle = fopen($fic, "w");
 212    $DataDB = "";
 213    for ($i = 0; $i < count($Fields); $i++) {
 214      for ($j = 0 ; $j < (count($Fields[$i])-1); $j++) {
 215        $DataDB .= trim($Fields[$i][$j]).CONNECTOR;
 216      }
 217      $DataDB .= trim($Fields[$i][count($Fields[$i])-1])."\n";
 218    }
 219    fputs($fhandle, $DataDB);
 220    fclose($fhandle);
 221  }
 222  
 223  function AppendDBFields($fic,$Fields) {
 224    $fhandle = fopen($fic, "a");
 225    $DataDB = "";
 226    for ($i = 0 ; $i < (count($Fields)-1); $i++) {
 227      $DataDB .= trim($Fields[$i]).CONNECTOR;
 228    }
 229    $DataDB .= trim($Fields[count($Fields)-1])."\n";
 230    fputs($fhandle, $DataDB);
 231    fclose($fhandle);
 232  }
 233  
 234  function SelectDBFieldsByID($Fields,$id) {
 235    $DataDB = array();
 236    $k = 0;
 237    for ($i = 0; $i < count($Fields); $i++) {
 238      if ($Fields[$i][1] == $id) {
 239        for ($j = 0 ; $j < count($Fields[$i]); $j++) {
 240          $DataDB[$k][$j] = $Fields[$i][$j];
 241        }
 242        $k++;
 243      }
 244    }
 245    return $DataDB;
 246  }
 247  
 248  function SelectDBFieldsByType($Fields,$type) {
 249    $DataDB = array();
 250    $k = 0;
 251    for ($i = 0; $i < count($Fields); $i++) {
 252      if ($Fields[$i][0] == $type) {
 253        for ($j = 0 ; $j < count($Fields[$i]); $j++) {
 254          $DataDB[$k][$j] = $Fields[$i][$j];
 255        }
 256        $k++;
 257      }
 258    }
 259    return $DataDB;
 260  }
 261  
 262  function SelectDBFieldsByNotStatus($Fields,$status) {
 263    $DataDB = array();
 264    $k = 0;
 265    for ($i = 0; $i < count($Fields); $i++) {
 266      if ($Fields[$i][2] != $status) {
 267        for ($j = 0 ; $j < count($Fields[$i]); $j++) {
 268          $DataDB[$k][$j] = $Fields[$i][$j];
 269        }
 270      $k++;
 271      }
 272    }
 273    return $DataDB;
 274  }
 275  
 276  function SelectDBFieldsByStatus($Fields,$status) {
 277    $DataDB = array();
 278    $k = 0;
 279    for ($i = 0; $i < count($Fields); $i++) {
 280      if ($Fields[$i][2] == $status) {
 281        for ($j = 0 ; $j < count($Fields[$i]); $j++) {
 282          $DataDB[$k][$j] = $Fields[$i][$j];
 283        }
 284        $k++;
 285      }
 286    }
 287    return $DataDB;
 288  }
 289  
 290  function SelectDBFields($type,$status,$id) {
 291    $DataDB = array();
 292    if (!empty($status) && !empty($id)) {
 293      $DataDB = SelectDBFieldsByID(SelectDBFieldsByStatus(SelectDBFieldsByType(ReadDBFields(DOCID),$type),$status),$id);
 294    }
 295    elseif (!empty($status)) {
 296      $DataDB = SelectDBFieldsByStatus(SelectDBFieldsByType(ReadDBFields(DOCID),$type),$status);
 297    }
 298    elseif (!empty($id)) {
 299      $DataDB = SelectDBFieldsByID(SelectDBFieldsByType(ReadDBFields(DOCID),$type),$id);
 300    }
 301    else {
 302      $DataDB = SelectDBFieldsByType(ReadDBFields(DOCID),$type);
 303    }
 304    return $DataDB;
 305  }
 306  
 307  function RemoveConnector($chaine) {
 308    $traite = str_replace(CONNECTOR, "", $chaine);
 309    return $traite;
 310  }
 311  
 312  function RemoveBR($chaine) {
 313    $traite = str_replace("<br />", "\n", $chaine);
 314    $traite = str_replace("<br />", "\n", $traite);
 315    $traite = str_replace("<br />", "\n", $traite);
 316    $traite = str_replace("<br />", "\n", $traite);
 317    return $traite;
 318  }
 319      
 320  function PutBR($chaine) {
 321    $traite = str_replace(chr(10),"<br />",$chaine);
 322    $traite = str_replace(chr(13),"",$traite);
 323    return $traite;
 324  }
 325  
 326  function RemoveHR($chaine) {
 327    $traite = str_replace("</p><hr /><p>", "<hr />", $chaine);
 328    return $traite;
 329  }
 330  
 331  function PutHR($chaine) {
 332    $traite = str_replace("<hr />", "</p><hr /><p>", $chaine);
 333    $traite = str_replace("<hr />", "</p><hr /><p>", $traite);
 334    $traite = str_replace("<hr />", "</p><hr /><p>", $traite);
 335    $traite = str_replace("<hr />", "</p><hr /><p>", $traite);
 336    return $traite;
 337  }
 338  
 339  function souriez($chaine) {
 340    global $souriez;
 341    $traite = str_replace($souriez[0][0], "<img src=\\\"".$souriez[0][1]."\\\" border=\\\"0\\\">", $chaine);
 342    $traite = str_replace($souriez[1][0], "<img src=\\\"".$souriez[1][1]."\\\" border=\\\"0\\\">", $traite);
 343    $traite = str_replace($souriez[2][0], "<img src=\\\"".$souriez[2][1]."\\\" border=\\\"0\\\">", $traite);
 344    $traite = str_replace($souriez[3][0], "<img src=\\\"".$souriez[3][1]."\\\" border=\\\"0\\\">", $traite);
 345    $traite = str_replace($souriez[4][0], "<img src=\\\"".$souriez[4][1]."\\\" border=\\\"0\\\">", $traite);
 346    $traite = str_replace($souriez[5][0], "<img src=\\\"".$souriez[5][1]."\\\" border=\\\"0\\\">", $traite);
 347    $traite = str_replace($souriez[6][0], "<img src=\\\"".$souriez[6][1]."\\\" border=\\\"0\\\">", $traite);
 348    $traite = str_replace($souriez[7][0], "<img src=\\\"".$souriez[7][1]."\\\" border=\\\"0\\\">", $traite);
 349    $traite = str_replace($souriez[8][0], "<img src=\\\"".$souriez[8][1]."\\\" border=\\\"0\\\">", $traite);
 350    $traite = str_replace($souriez[9][0], "<img src=\\\"".$souriez[9][1]."\\\" border=\\\"0\\\">", $traite);
 351    $traite = str_replace($souriez[10][0], "<img src=\\\"".$souriez[10][1]."\\\" border=\\\"0\\\">", $traite);
 352    return $traite;
 353  }
 354  
 355  function UpdateDBnews() {
 356    global $lang,$lng,$site,$serviz;
 357    if ($serviz[16] == "on") {
 358      $dbwork1 = SelectDBFields("news","a","");
 359      if ($lang[1] != "") {
 360        include(CHEMIN."inc/lang/".$lang[1]."-web.inc");
 361        $par2 = $web6;
 362        $le2 = $web7;
 363      }
 364      include(CHEMIN."inc/lang/".$lng."-web.inc");
 365      $par1 = $web6;
 366      $le1 = $web7;
 367      $sito = $site[3];
 368      if ($sito[strlen($sito)] != "/") {
 369        $sito .= "/";
 370      }
 371      for ($i = 0; $i < count($dbwork1); $i++) {
 372        include(DBBASE.$dbwork1[$i][1].INCEXT);
 373        $dbwork2[$i][0] = $fieldb1." - ".$par1." ".$author." ".$le1." ".$creadate;
 374        $dbwork2[$i][1] = $fieldc1;
 375        $dbwork2[$i][2] = $sito."news.php?lng=".$lng."&id=".$fileid;
 376        if ($lang[1] != "") {
 377          $dbwork2[$i][3] = $fieldb2." - ".$par2." ".$author." ".$le2." ".$creadate;
 378          $dbwork2[$i][4] = $fieldc2;
 379          $dbwork2[$i][5] = $sito."news.php?lng=".$lang[1]."&id=".$fileid;
 380        }
 381        else {
 382          $dbwork2[$i][3] = "";
 383          $dbwork2[$i][4] = "";
 384          $dbwork2[$i][5] = "";
 385        }
 386      }
 387      WriteDBFields(CHEMIN.DATAREP."news.dat",$dbwork2);
 388    }
 389    else {
 390      WriteFullDB(CHEMIN.DATAREP."news.dat","\n");
 391    }
 392  }
 393  
 394  function UpdateDBdtb($dtb) {
 395    $db = SelectDBFields($dtb,"a","");
 396    $dba = array();
 397    $j = 0;
 398    for ($i = 0; $i < count($db); $i++) {
 399      include(DBBASE.$db[$i][1].INCEXT);
 400      if (!($dtb == "art" && trim($fielda1).trim($fielda2) == "")) {
 401        $dba[$j][0] = RemoveConnector($fielda1);
 402        $dba[$j][1] = RemoveConnector($fielda2);
 403        $dba[$j][2] = RemoveConnector($fieldb1);
 404        $dba[$j][3] = RemoveConnector($fieldb2);
 405        $dba[$j][4] = $fileid;
 406        if ($dtb == "art") {
 407          $dba[$j][5] = RemoveConnector($fieldd1);
 408        }
 409        $j++;
 410      }
 411    }
 412    WriteDBFields(CHEMIN.DATAREP.$dtb.DBEXT,$dba);
 413  }
 414  
 415  function UpdateDBforum($action,$id) {
 416    $db = array();
 417    if ($action == "add") {
 418      include(DBBASE.$id.INCEXT);
 419      $db[0] = substr($creadate,6,4).substr($creadate,3,2).substr($creadate,0,2); // date du thread

 420      $db[1] = substr($creadate,13);                    // heure du thread

 421      $db[2] = $creadate;                               // date @ heure du thread

 422      $db[3] = $fielda1;                                // numéro de thread

 423      $db[4] = $fielda2;                                // numéro de réponse ou "new" si nouveau thread

 424      $db[5] = $fileid;                                 // id du thread

 425      $db[6] = RemoveConnector($author);                // auteur

 426      $db[7] = RemoveConnector($email);                 // e-mail auteur

 427      $db[8] = RemoveConnector($fieldb1);               // titre

 428      $db[9] = $fieldd1;                                // show or hide e-mail auteur

 429      $db[10] = $fieldb2;                               // ID catégorie thread

 430      AppendDBFields(DBTHREAD,$db);
 431    }
 432    else {
 433      $db = SelectDBFields("forum","a","");
 434      sort($db);
 435      $dbf = array();
 436      for ($i = 0; $i < count($db); $i++) {
 437        include(DBBASE.$db[$i][1].INCEXT);
 438        $dbf[$i][0] = substr($creadate,6,4).substr($creadate,3,2).substr($creadate,0,2); // date du thread

 439        $dbf[$i][1] = substr($creadate,13);             // heure du thread

 440        $dbf[$i][2] = $creadate;                        // date @ heure du thread

 441        $dbf[$i][3] = $fielda1;                         // numéro de thread

 442        $dbf[$i][4] = $fielda2;                         // numéro de réponse ou "new" si nouveau thread

 443        $dbf[$i][5] = $fileid;                          // id du thread

 444        $dbf[$i][6] = RemoveConnector($author);         // auteur

 445        $dbf[$i][7] = RemoveConnector($email);          // e-mail auteur

 446        $dbf[$i][8] = RemoveConnector($fieldb1);        // titre

 447        $dbf[$i][9] = $fieldd1;                         // show or hide e-mail auteur

 448        $dbf[$i][10] = $fieldb2;                        // ID catégorie thread

 449      }
 450      @sort($dbf,SORT_REGULAR);
 451      WriteDBFields(DBTHREAD,$dbf);
 452    }
 453    $db = array();
 454    $db = ReadDBFields(DBTHREAD);
 455    $dbf = array();
 456    $j = 0;
 457    for ($i = 0; $i < count($db); $i++) {
 458      if ($db[$i][4] == "new") {
 459        $dbf[$j][0] = $db[$i][0];            // date de la dernière réponse

 460        $dbf[$j][1] = $db[$i][1];            // heure de la dernière réponse

 461        $dbf[$j][2] = $db[$i][2];            // date @ heure de la dernière réponse

 462        $dbf[$j][3] = $db[$i][3];            // numéro de thread

 463        $dbf[$j][4] = $db[$i][5];            // id de début du thread

 464        $dbf[$j][5] = $db[$i][6];            // auteur

 465        $dbf[$j][6] = $db[$i][7];            // e-mail auteur

 466        $dbf[$j][7] = $db[$i][8];            // titre

 467        $dbf[$j][8] = $db[$i][2];            // date @ heure de création du thread

 468        $dbf[$j][9] = 0;                     // nombre de réponses

 469        $dbf[$j][10] = "";                   // auteur de la dernière réponse

 470        $dbf[$j][11] = "";                   // e-mail auteur de la dernière réponse

 471        $dbf[$j][12] = $db[$i][9];           // show or hide e-mail auteur

 472        $dbf[$j][13] = "";                   // show or hide e-mail auteur de la dernière réponse

 473        $dbf[$j][14] = $db[$i][10];          // ID catégorie thread

 474        for ($k = $i+1; $k < count($db); $k++) {
 475          if ($db[$k][3] == $dbf[$j][3]) {
 476            $dbf[$j][0] = $db[$k][0];
 477            $dbf[$j][1] = $db[$k][1];
 478            $dbf[$j][2] = $db[$k][2];
 479            $dbf[$j][9] = $dbf[$j][9]+1;
 480            $dbf[$j][10] = $db[$k][6];
 481            $dbf[$j][11] = $db[$k][7];
 482            $dbf[$j][13] = $db[$k][9];
 483          }
 484        }
 485        $j++;
 486      }
 487    }
 488    @rsort($dbf,SORT_REGULAR);
 489    WriteDBFields(DBFORUM,$dbf);
 490  }
 491  
 492  function ActionOnFields($action,$data) {
 493    if ($action == "del") {
 494      $id = $data[1];
 495      $db = ReadDBFields(DOCID);
 496      for ($i = 0; $i < count($db); $i++) {
 497        if ($db[$i][1] == $id) {
 498          $db[$i][2] = "d";
 499        }
 500      }
 501      WriteDBFields(DOCID,$db);
 502      include(DBBASE.$id.INCEXT);
 503      $status = "d";
 504      $author = addslashes($author);
 505      $email = addslashes($email);
 506      $fielda1 = addslashes($fielda1);
 507      $fielda2 = addslashes($fielda2);
 508      $fieldb1 = addslashes($fieldb1);
 509      $fieldb2 = addslashes($fieldb2);
 510      $fieldc1 = addslashes($fieldc1);
 511      $fieldc2 = addslashes($fieldc2);
 512      $fieldd1 = addslashes($fieldd1);
 513      $fieldd2 = addslashes($fieldd2);
 514      $rec = "<?
 515  \$type = \"$type\";
 516  \$fileid = \"$fileid\";
 517  \$status = \"$status\";
 518  \$creadate = \"$creadate\";
 519  \$moddate = \"$moddate\";
 520  \$author = stripslashes(\"$author\");
 521  \$email = stripslashes(\"$email\");
 522  \$fielda1 = stripslashes(\"$fielda1\");
 523  \$fielda2 = stripslashes(\"$fielda2\");
 524  \$fieldb1 = stripslashes(\"$fieldb1\");
 525  \$fieldb2 = stripslashes(\"$fieldb2\");
 526  \$fieldc1 = stripslashes(\"$fieldc1\");
 527  \$fieldc2 = stripslashes(\"$fieldc2\");
 528  \$fieldd1 = stripslashes(\"$fieldd1\");
 529  \$fieldd2 = stripslashes(\"$fieldd2\");
 530  ?>"; ?> <?
 531      WriteFullDB(DBBASE.$fileid.INCEXT,$rec);
 532    }
 533    elseif ($action == "act") {
 534      $id = $data[1];
 535      $db = ReadDBFields(DOCID);
 536      for ($i = 0; $i < count($db); $i++) {
 537        if ($db[$i][1] == $id) {
 538            $db[$i][2] = $data[2];
 539        }
 540      }
 541      WriteDBFields(DOCID,$db);
 542      include(DBBASE.$id.INCEXT);
 543      $status = $data[2];
 544      $author = addslashes($author);
 545      $email = addslashes($email);
 546      $fielda1 = addslashes($fielda1);
 547      $fielda2 = addslashes($fielda2);
 548      $fieldb1 = addslashes($fieldb1);
 549      $fieldb2 = addslashes($fieldb2);
 550      $fieldc1 = addslashes($fieldc1);
 551      $fieldc2 = addslashes($fieldc2);
 552      $fieldd1 = addslashes($fieldd1);
 553      $fieldd2 = addslashes($fieldd2);
 554      $rec = "<?
 555  \$type = \"$type\";
 556  \$fileid = \"$fileid\";
 557  \$status = \"$status\";
 558  \$creadate = \"$creadate\";
 559  \$moddate = \"$moddate\";
 560  \$author = stripslashes(\"$author\");
 561  \$email = stripslashes(\"$email\");
 562  \$fielda1 = stripslashes(\"$fielda1\");
 563  \$fielda2 = stripslashes(\"$fielda2\");
 564  \$fieldb1 = stripslashes(\"$fieldb1\");
 565  \$fieldb2 = stripslashes(\"$fieldb2\");
 566  \$fieldc1 = stripslashes(\"$fieldc1\");
 567  \$fieldc2 = stripslashes(\"$fieldc2\");
 568  \$fieldd1 = stripslashes(\"$fieldd1\");
 569  \$fieldd2 = stripslashes(\"$fieldd2\");
 570  ?>"; ?> <?
 571      WriteFullDB(DBBASE.$fileid.INCEXT,$rec);
 572    }
 573    elseif ($action == "add") {
 574      $id = ReadCounter(NEXTID);
 575      $id = $id+1;
 576      WriteCounter(NEXTID,$id);
 577      $db = array();
 578      $db[0] = $data[0];
 579      $db[1] = $id;
 580      $db[2] = $data[2];
 581      AppendDBFields(DOCID,$db);
 582      $type = $data[0];
 583      $fileid = $id;
 584      $status = $data[2];
 585      $creadate = date("d/m/Y")." @ ".date("H:i");
 586      $moddate = $creadate;
 587      $author = addslashes(stripslashes($data[5]));
 588      $email = addslashes(stripslashes($data[6]));
 589      $fielda1 = addslashes(stripslashes($data[7]));
 590      $fielda2 = addslashes(stripslashes($data[8]));
 591      $fieldb1 = addslashes(stripslashes($data[9]));
 592      $fieldb2 = addslashes(stripslashes($data[10]));
 593      $fieldc1 = addslashes(stripslashes(souriez(PutHR(PutBR($data[11])))));
 594      $fieldc2 = addslashes(stripslashes(souriez(PutHR(PutBR($data[12])))));
 595      $fieldd1 = addslashes(stripslashes($data[13]));
 596      $fieldd2 = addslashes(stripslashes($data[14]));
 597      $rec = "<?
 598  \$type = \"$type\";
 599  \$fileid = \"$fileid\";
 600  \$status = \"$status\";
 601  \$creadate = \"$creadate\";
 602  \$moddate = \"$moddate\";
 603  \$author = stripslashes(\"$author\");
 604  \$email = stripslashes(\"$email\");
 605  \$fielda1 = stripslashes(\"$fielda1\");
 606  \$fielda2 = stripslashes(\"$fielda2\");
 607  \$fieldb1 = stripslashes(\"$fieldb1\");
 608  \$fieldb2 = stripslashes(\"$fieldb2\");
 609  \$fieldc1 = stripslashes(\"$fieldc1\");
 610  \$fieldc2 = stripslashes(\"$fieldc2\");
 611  \$fieldd1 = stripslashes(\"$fieldd1\");
 612  \$fieldd2 = stripslashes(\"$fieldd2\");
 613  ?>"; ?> <?
 614      WriteFullDB(DBBASE.$fileid.INCEXT,$rec);
 615    }
 616    elseif ($action == "mod") {
 617      $id = $data[1];
 618      include(DBBASE.$id.INCEXT);
 619      $moddate = date("d/m/Y")." @ ".date("H:i");
 620      $author = addslashes(stripslashes($data[5]));
 621      $email = addslashes(stripslashes($data[6]));
 622      $fielda1 = addslashes(stripslashes($data[7]));
 623      $fielda2 = addslashes(stripslashes($data[8]));
 624      $fieldb1 = addslashes(stripslashes($data[9]));
 625      $fieldb2 = addslashes(stripslashes($data[10]));
 626      $fieldc1 = addslashes(stripslashes(souriez(PutHR(PutBR($data[11])))));
 627      $fieldc2 = addslashes(stripslashes(souriez(PutHR(PutBR($data[12])))));
 628      $fieldd1 = addslashes(stripslashes($data[13]));
 629      $fieldd2 = addslashes(stripslashes($data[14]));
 630      $rec = "<?
 631  \$type = \"$type\";
 632  \$fileid = \"$fileid\";
 633  \$status = \"$status\";
 634  \$creadate = \"$creadate\";
 635  \$moddate = \"$moddate\";
 636  \$author = stripslashes(\"$author\");
 637  \$email = stripslashes(\"$email\");
 638  \$fielda1 = stripslashes(\"$fielda1\");
 639  \$fielda2 = stripslashes(\"$fielda2\");
 640  \$fieldb1 = stripslashes(\"$fieldb1\");
 641  \$fieldb2 = stripslashes(\"$fieldb2\");
 642  \$fieldc1 = stripslashes(\"$fieldc1\");
 643  \$fieldc2 = stripslashes(\"$fieldc2\");
 644  \$fieldd1 = stripslashes(\"$fieldd1\");
 645  \$fieldd2 = stripslashes(\"$fieldd2\");
 646  ?>"; ?> <?
 647      WriteFullDB(DBBASE.$fileid.INCEXT,$rec);
 648    }
 649    if ($data[0] == "art" || $data[0] == "links" || $data[0] == "dnload" || $data[0] == "photo") {
 650      UpdateDBdtb($data[0]);
 651    }
 652    elseif ($data[0] == "forum") {
 653      UpdateDBforum($action,$id);
 654    }
 655    elseif ($data[0] == "news") {
 656      UpdateDBnews();
 657    }
 658  }
 659  
 660  function AfficheCompteur($chemino, $hits, $grow = 1) {
 661    $spot = '<A HREF="'.$chemino.'">';
 662    for ($lecon = 0; $lecon < $grow - strlen($hits); $lecon++ ) {
 663      $spot .= '<IMG SRC="'.$chemino.'cnt0.gif" BORDER=0>';
 664    }
 665    for ($lecon = 0; $lecon < strlen($hits); $lecon++) {
 666      $cols = substr($hits, $lecon, 1);
 667      $spot .= '<IMG SRC="'.$chemino.'cnt'.$cols.'.gif" BORDER=0>';
 668    }
 669    echo $spot.'</A>';
 670  }
 671  
 672  function CompteVisites($chemino, $file_ip, $file_counter) {
 673    global $REMOTE_ADDR;
 674    $nbr_connect = 0;
 675    $var_bool = false;
 676    $subdata = array();
 677    $var_ip = array();
 678    $k = 0;
 679    $subdata = ReadDBFields($chemino.$file_ip);
 680    $now_time = time();
 681    for ($i = 0; $i < count($subdata); $i++) {
 682      list($jour, $mois, $annee) = explode("/", substr($subdata[$i][1], 0, 10));
 683      list($heure, $minute, $seconde) = explode(":", substr($subdata[$i][1], 10, 18));
 684      if ($now_time < mktime($heure, $minute, $seconde, $mois, $jour, $annee) + HIT_TIME) {
 685        $nbr_connect++;
 686        $var_ip[$k][0] = $subdata[$i][0];
 687        $var_ip[$k][1] = $subdata[$i][1];
 688        $k++;
 689        if ($REMOTE_ADDR == $subdata[$i][0]) {
 690          $var_bool = true;
 691        }
 692      }
 693    }
 694    $nbr_visit = ReadCounter($chemino.$file_counter);
 695    if (!$var_bool) {
 696      $nbr_visit++;
 697      WriteCounter($chemino.$file_counter,$nbr_visit);
 698      $var_ip[$k][0] = $REMOTE_ADDR;
 699      $var_ip[$k][1] = date("d/m/Y H:i:s");
 700      WriteDBFields($chemino.$file_ip,$var_ip);
 701      $nbr_connect++;
 702    }
 703    $retcmpt[0] = $nbr_visit;
 704    $retcmpt[1] = $nbr_connect;
 705    return $retcmpt;
 706  }
 707  
 708  function InitDBlog($typ) {
 709    $db = array();
 710    $db[0][0] = 0;
 711    for ($i = 0; $i < 12; $i++) {$db[1][$i] = 0;}
 712    for ($i = 0; $i < 2; $i++) {$db[2][$i] = 0;}
 713    for ($i = 0; $i < 9; $i++) {$db[3][$i] = 0;}
 714    for ($i = 0; $i < 10; $i++) {$db[4][$i] = 0;}
 715    for ($i = 0; $i < $typ; $i++) {$db[5][$i] = 0;}
 716    for ($i = 0; $i < $typ; $i++) {$db[6][$i] = 0;}
 717    $db[7][0] = 1;
 718    return $db;
 719  }
 720  
 721  function eMailTo($eSubject,$eMessage,$eTo) {
 722    global $supervision,$user;
 723    if ($eTo == "") {
 724      $eTo = trim($user[1]);
 725    }
 726    if ($supervision[5] == "standard") {
 727      @mail($eTo,$eSubject,$eMessage,"From: ".trim($user[1]));
 728    }
 729    elseif ($supervision[5] == "online") {
 730      $eFrom = trim(substr($user[1],0,strpos($user[1],"@")));
 731      @email($eFrom,$eTo,$eSubject,$eMessage);
 732    }
 733    elseif ($supervision[5] == "nexen") {
 734      @include("mail.inc");
 735      @email($eTo,$eSubject,$eMessage,"From: ".trim($user[1]));
 736    }                   
 737  }
 738  
 739  function BreakEMail($eminput) {
 740    $eminput = trim($eminput);
 741    $em1 = strpos($eminput,"@");
 742    $em2 = strrpos($eminput,".");
 743    $emoutput[0] = substr($eminput,0,$em1);
 744    $emoutput[1] = substr($eminput,$em1+1,$em2-$em1-1);
 745    $emoutput[2] = substr($eminput,$em2+1);
 746    return $emoutput;
 747  }
 748  
 749  function StartTimer() {
 750   global $starttime;
 751   $mtime = microtime ();
 752   $mtime = explode (' ', $mtime);
 753   $mtime = $mtime[1] + $mtime[0];
 754   $starttime = $mtime;
 755  }
 756  
 757  function StopTimer() {
 758    global $starttime;
 759    $mtime = microtime ();
 760    $mtime = explode (' ', $mtime);
 761    $mtime = $mtime[1] + $mtime[0];
 762    $stoptime = round (($mtime - $starttime), 2);
 763    return $stoptime;
 764  }
 765  
 766  function MakeSeed() {
 767    list($usec, $sec) = explode(' ', microtime());
 768    return (float) $sec + ((float) $usec * 100000);
 769  }
 770  
 771  function DrawSmileys($num) {
 772    global $souriez;
 773    echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\">\n";
 774    echo "<tr>\n";
 775    for ($i = 0; $i < count($souriez); $i++) {
 776      echo "<td align=\"center\"><p align=\"center\">".$souriez[$i][0]."</p></td>\n";
 777    }
 778    echo "</tr><tr>\n";
 779    for ($i = 0; $i < count($souriez); $i++) {
 780      echo "<td align=\"center\"><a href=\"JavaScript:AddSmiley".$num."('".$souriez[$i][0]."')\"><img src=\"".CHEMIN.$souriez[$i][1]."\" border=\"0\" alt=\"".$souriez[$i][0]."\"></a></td>\n";
 781    }
 782    echo "</tr>\n";
 783    echo "<tr><td>&nbsp;</td></tr>\n";
 784    echo "</table>\n";
 785  }
 786  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]