PHPIndex

This page lists files in the current directory. You can view content, get download/execute commands for Wget, Curl, or PowerShell, or filter the list using wildcards (e.g., `*.sh`).

PHPMailer
ckeditor
ckeditor_config
colorpicker
crypt
csshead
htmlpurifier
img
incfoot
inchead
incpage
jshead
lang
liquidslider
mail
photo
tarteaucitron
unitegallery
.htaccess
wget 'https://sme10.lists2.roe3.org/guppy/inc/.htaccess'
View Content
Options -Indexes
agenda.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/agenda.inc'
View Content
<?php
/*******************************************************************************
 *   Agenda display
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2021 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.04 (December 14, 2021) : Correction event calendar
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'agenda.inc')) {
    header('location:../index.php');
    die();
}

class GY_agenda {
    public $tconfig;
    public $topmess;
    protected $monthlist;
    protected $daylist;
    protected $an;
    protected $mois;
    protected $id;
    protected $idpg;
    protected $agv;
    
    public function __construct() {
        global $web, $serviz;
        $this->an        = import('an');
        $this->mois      = import('mois');
        $this->id        = import('id');
        $this->idpg      = import('idpg');
        $this->tconfig   = $serviz[171] == 'ALL' ? import('tconfig', '', true, 0) : $serviz[171];
        $this->agv       = import('agv');
        $this->monthlist = array($web[268], $web[269], $web[270], $web[271], $web[272], $web[273],
                                 $web[274], $web[275], $web[276], $web[277], $web[278], $web[279]);
        $this->daylist   = array(0 => $web[532], $web[533], $web[534], $web[535], $web[536], $web[537], $web[538]);
    }
    
    public function AGV_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $this->topmess = $web[436];
        if ($serviz[47] != 'on') {
            $out = '
    <div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array('AGV0', $out);
        }
        elseif (!isAccessGranted($members[14])) 
		{
				$out = '
		<div class="web342 text-center">'.$web[342];
				if ($members[19] != '0' && $members[19] != '3') 
				{
					$href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 : 'connect.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2);
					$href2 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$this->tconfig.$z2);
					$out .= '
		  <p class="text-center">
			'.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
			  (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
		  </p>';
				}
				$out .= '
		</div>';
				return array('AGV0', $out);
        }
        return $this->agv;
    }
    
    public function AGV_day($lng) {
        global $web, $site, $serviz, $urlrw, $prt, $z2, $pg, $lang;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $pgid = explode('-', $this->idpg);
        $wag  = array();
        for ($a = 0; $a < count($pgid) - 1; $a++) {
            if (!is_file(DBBASE.TestFileId($pgid[$a]).INCEXT)) continue;
            ReadDoc($pgid[$a]);
            if ($type != TYP_AGENDA) continue;
            if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) continue;
            $wag[$a][0] = $fielda2;
            $wag[$a][1] = $fileid;
        }
        if (empty($wag)) {
            $this->topmess = $web[436];
            return array('AGV1', '<p class="text-center">'.$web[290].'</p>');
        }
        sort($wag);
        for ($jj = 0; $jj < count($wag); $jj++) {
            ReadDoc($wag[$jj][1]);
			$datcre = $creadate;
			$datmod = $moddate;
            $agtxt1 = substr($fielda1, 6, 2);
            $agtxt2 = substr($fielda1, 4, 2);
            $agtxt3 = substr($fielda1, 0, 4);
            $agtime = array();
            $agtime = explode('-', $fielda2);
			$agtime = array_pad($agtime, 2, '');
            if ($agtime[0] < '10:00') $agtime[0] = substr($agtime[0], 1, 7);
            if ($agtime[1] < '10:00') $agtime[1] = substr($agtime[1], 1, 7);
            if ($site[22] == 'H2'){
                $agtime[0] = str_replace(':', 'h', $agtime[0]);
                $agtime[1] = str_replace(':', 'h', $agtime[1]);
            }
            if ($agtime[0] != '' && $agtime[1] != '') $til = '<br />&darr;<br />';
            elseif ($agtime[0] != '' && $agtime[1] == '') $til= '<br />&darr;<br />&#133;';
            elseif ($agtime[0] == '' && $agtime[1] != '') $til = '&#133;<br />&darr;<br />';
            else $til = '';
            $mthname = $this->monthlist[$agtxt2-1];
            $dd      = date('w', mktime(0, 0, 0, (int)$agtxt2, (int)$agtxt1, (int)$agtxt3));
            $dayname = $this->daylist[$dd];
            if ($lng == $lang[0]) {
                $agtxt4 = $fieldc1;
            } else {
                $agtxt4 = empty($fieldc2) ? '<em>'.$web[442].'</em><br /><br />'.$fieldc1 : $fieldc2;
            }
            if ($jj == 0 ) {
                if ($web[284] == '0') {
                    $datecountry = $dayname.' '.$agtxt1.' '.$mthname.' '.$agtxt3;
                } elseif ($web[284] == '1') {
                    $datecountry = $mthname.' '.$agtxt1.' '.$agtxt3.', '.$dayname;
                } elseif ($web[284] == '2') {
                    $datecountry = $agtxt3.' '.$mthname.' '.$agtxt1.', '.$dayname;
                } else {
                    $datecountry = '';
                }
                if (!empty($datecountry)) {
                    $datecountry = '
                    <a href="'.$site[3].($site['URLR'] == 'on' 
                        ? $lng.'-'.$urlrw[17].'-22-'.$this->idpg.'-'.$pg.'-1-'.$this->tconfig.$z2 
                        : 'agenda.php?lng='.$lng.'&amp;idpg='.$this->idpg.'&amp;pg='.$pg.'&amp;agv=1&amp;tconfig='.$this->tconfig.$z2).'" title="'.$web[511].'">
                      '.$datecountry.'
                    </a>';
                }
                $out = '
    <br />';
            }
            $out .= '
    <div class="table-responsive-md">
    <div class="bord d-table m-auto w-98">
      <div class="d-table-row">
        <div class="quest d-table-cell text-center align-top calagvL font-weight-bold">'.$agtime[0].$til.$agtime[1].'</div>
        <div class="rep d-table-cell text-left align-top calagvR w-100">'.getNewUpdateDoc($datcre, $datmod, $serviz[145]).$agtxt4;
            if (empty($prt)) $out .= displayQuickConfig(NULL, $pgid[$jj], 'agenda&amp;form=2&amp;id='.$pgid[$jj], '', '', 37);
            $out .= '
        </div>
      </div>
    </div>
    </div>';
        }
        $out .= '
    <p class="text-center">
      <a href="'.($site['URLR'] == 'on' ? 
          $lng.'-'.$urlrw[17].'-21-'.$agtxt2.'-'.$agtxt3.'-2-'.$this->tconfig.$z2 : 
          'agenda.php?lng='.$lng.'&amp;mois='.$agtxt2.'&amp;an='.$agtxt3.'&amp;agv=2&amp;tconfig='.$this->tconfig.$z2).'">
        '.$web[286].' '.$mthname.' '.$agtxt3.'
      </a>
    </p>
    <br />';
        $this->topmess = $web[285].' '.$datecountry;
        return array('AGV1', $out);
    }
    
    public function AGV_month($lng) {
        global $web, $site, $serviz, $urlrw, $prt, $z2, $pg, $lang;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        if (empty($this->id)) $this->id = 1;
        if (!$this->mois && !$this->an) {
            $this->mois = date('m');
            $this->an   = date('Y');
        }
        if ($this->mois < 1) {
            $this->mois = 12;
            $this->an--;
        }
        if ($this->mois > 12) {
            $this->mois = 1;
            $this->an++;
        }
        $mthname   = $this->monthlist[$this->mois - 1];
        $permalink = '
          <a href="'.$site[3].($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[17].'-21-'.$this->mois.'-'.$this->an.'-2-'.$this->tconfig.$z2 
              : 'agenda.php?lng='.$lng.'&amp;mois='.$this->mois.'&amp;an='.$this->an.'&amp;agv=2&amp;tconfig='.$this->tconfig.$z2).'" title="'.$web[511].'">
            '.$mthname.' '.$this->an.'
          </a>';
        $dbwork = ReadDBFields(DBAGENDA);
        @sort($dbwork);
		$dbannee = array();
		foreach($dbwork as $dbw) {
			$ann = substr($dbw[2], -4);
			if (!in_array($ann, $dbannee)) $dbannee[] = $ann;
		}
		$ann = date('Y');
		if (!in_array($this->an, $dbannee)) $dbannee[] = $ann;
		@sort($dbannee);
        $out = '
    <br />
    <div class="table-responsive-md">
    <div class="d-table m-auto">
      <div class="d-table-row">
        <div class="d-table-cell calendarg">';
		$ann_p = $this->an - ($this->mois == 1 ? 1 : 0);
		$ann_s = $this->an + ($this->mois == 12 ? 1 : 0);
		if ($dbannee[0] <= $ann_p) {
			$out .= '
          <a href="'.($site['URLR'] == 'on' ? 
              $lng.'-'.$urlrw[17].'-21-'.sprintf('%02d', $this->mois-1).'-'.$this->an.'-2-'.$this->tconfig.$z2 : 
              'agenda.php?lng='.$lng.'&amp;mois='.sprintf('%02d', $this->mois-1).'&amp;an='.$this->an.'&amp;agv=2&amp;tconfig='.$this->tconfig.$z2).'">
            <i class="fas fa-arrow-left"></i>
          </a>';
		}
		$out .= '
        </div>
        <div class="d-table-cell calendard"><b>'.$permalink.'</b></div>
        <div class="d-table-cell calendard">';
		if ($dbannee[count($dbannee)-1] >= $ann_s) {
			$out .= '
          <a href="'.($site['URLR'] == 'on' ? 
              $lng.'-'.$urlrw[17].'-21-'.sprintf('%02d', $this->mois + 1).'-'.$this->an.'-2-'.$this->tconfig.$z2 : 
              'agenda.php?lng='.$lng.'&amp;mois='.sprintf('%02d', $this->mois + 1).'&amp;an='.$this->an.'&amp;agv=2&amp;tconfig='.$this->tconfig.$z2).'">
            <i class="fas fa-arrow-right"></i>
          </a>';
		}
		$out .= '
        </div>
      </div>
    </div>
    </div>';
        $mthag = array();
        for ($i = 0; $i < count($dbwork); $i++) {
            if ($dbwork[$i][2] == $this->mois.$this->an && isAccessGranted($dbwork[$i][6]) && isAuthorizedPublication($dbwork[$i][5])) {
                $mthag[] = $dbwork[$i][4];
            }
        }
        $controle = CheckDB1Field(DBAGENDA, $this->mois.$this->an, 2);
        if ($controle) {
            $lastday    = '';
            $currentday = '';
            $k          = 0;
            if (3 == abs($prt)) {
                $this->id   = 1;
                $serviz[46] = 99999;
            }
            for ($i = $serviz[46]*($this->id - 1); $i < Min($serviz[46] * $this->id, count($mthag)); $i++) {
                $k++;
                ReadDoc($mthag[$i]);
				$datcre     = $creadate;
				$datmod     = $moddate;
                $currentday = $fielda1;
                $agtime     = array();
                $agtime     = explode('-', $fielda2);
				$agtime     = array_pad($agtime, 2, '');
                if ($agtime[0] < '10:00') $agtime[0] = substr($agtime[0], 1, 7);
                if ($agtime[1] < '10:00') $agtime[1] = substr($agtime[1], 1, 7);
                if ($site[22] == 'H2'){
                    $agtime[0] = str_replace(':', 'h', $agtime[0]);
                    $agtime[1] = str_replace(':', 'h', $agtime[1]);
                }
                if ($agtime[0] != '' && $agtime[1] != '') $til = '<br />&darr;<br />';
                elseif ($agtime[0] != '' && $agtime[1] == '') $til= '<br />&darr;<br />&#133;';
                elseif ($agtime[0] == '' && $agtime[1] != '') $til = '&#133;<br />&darr;<br />';
                else $til = '';
				$agtxt1 = substr($fielda1, 6, 2);
				$agtxt2 = substr($fielda1, 4, 2);
				$agtxt3 = substr($fielda1, 0, 4);
                $dd = date('w', mktime(0, 0, 0, (int)$agtxt2, (int)$agtxt1, (int)$agtxt3));
                $dayname = $this->daylist[$dd];
                if ($lng == $lang[0]) {
                    $agtxt4 = $fieldc1;
                } else {
                    $agtxt4 = empty($fieldc2) ? '<em>'.$web[442].'</em><br /><br />'.$fieldc1 : $fieldc2;
                }
                if ($web[284]=='0') {
                    $datecountry = $dayname.' '.$agtxt1.' '.$mthname.' '.$agtxt3;
                }
                if ($web[284]=='1') {
                    $datecountry = $mthname.' '.$agtxt1.' '.$agtxt3.', '.$dayname;
                }
                if ($web[284]=='2') {
                    $datecountry = $agtxt3.' '.$mthname.' '.$agtxt1.', '.$dayname;
                }
                if ($currentday != $lastday) {
                    $out .= '
    <div class="table-responsive-md">
    <div class="bord d-table w-98 m-auto">
      <div class="d-table-row">
        <div class="forum2 d-table-cell"><b>'.$datecountry.'</b></div>
      </div>
    </div>
    </div>';
                }
                $out .= '
    <div class="table-responsive-md">
    <div class="bord d-table w-98 m-auto">
      <div class="d-table-row">
        <div class="quest d-table-cell text-center align-top calagvL font-weight-bold">'.$agtime[0].$til.$agtime[1].'<br /></div>
        <div class="rep d-table-cell text-left align-top calagvR w-100">'.getNewUpdateDoc($datcre, $datmod, $serviz[145]).$agtxt4;
                if (empty($prt)) $out .= displayQuickConfig(NULL, $mthag[$i], 'agenda&amp;form=2&amp;id='.$mthag[$i], '', '', 37);
                $out .= '
        </div>
      </div>
    </div>
    </div>';
                $lastday = $currentday;
            }
        } else {
            $out .= '
    <p class="text-center">'.$web[290].'</p>';
        }
        $out .= GetNavBar(($site['URLR'] == 'on' ? 
          $lng.'-'.$urlrw[17].'-23-'.$this->mois.'-'.$this->an.'-2-'.$this->tconfig.'-' : 
          'agenda.php?lng='.$lng.'&amp;mois='.$this->mois.'&amp;an='.$this->an.'&amp;agv=2&amp;tconfig='.$this->tconfig.'&amp;id='), count($mthag), $this->id, $serviz[46], $z2);
		$this->topmess = $web[287].' '.$mthname.' '.$this->an;
        return array('AGV2', $out);
    }
}
?>
articles.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/articles.inc'
View Content
<?php
/*******************************************************************************
 *   Articles
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.11 (March 09, 2023) : adaptation to php 8
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'articles.inc')) {
    header('location:../index.php');
    die();
}

class GY_articles {
    public $tconfig;
    public $topmess;
    public $userprefs3;
    public $widepage;
    public $countit;
    public $txtart2;
    public $img;
    public $urltitre;
    protected $mnuid;
    protected $pg;
    protected $id;
    protected $txtart102;
    
    public function __construct() {
        global $templates, $widepage;
        $tconfig        = import('tconfig', '', true, 0);
        $this->tconfig  = !isset($templates[$tconfig]) ? 0 : $tconfig;
        $this->widepage = $widepage;
        $this->mnuid    = import('mnuid', '', true, 0);
        $this->pg       = import('pg');
        $this->id       = import('id');
    }

    protected function GetOptionCateg($mnu, $id) {
        global $lang, $fielda1, $fielda2, $fieldd1, $fieldd2, $lng;
        if (substr($mnu, 0, 3) == 'MNU') {
            $mnu_id = substr($mnu, 4);
            $dbw    = SelectDbFieldsByField(ReadDBFields(DBOPTMENU), 5, $mnu_id);
            foreach ($dbw as $item) {
                ReadDoc($item[4]);
                $urls = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
                $pg   = substr($urls[0], strpos($urls[0], 'pg=') + 3);
                $pos  = strpos($pg, '&');
                $pg   = $pos === false ? $pg : substr($pg, 0, $pos);
                if ($pg == $id) return ($lng == $lang[0] ? $fielda1 : $fielda2);
            }
        }
        return '';
    }

    protected function GetOptionBoxes($mnu, $id) {
        global $lang, $fieldc2, $fieldd1, $fieldd2, $lng;
        if (substr($mnu, 0, 3) == 'MNU') {
            $mnu_id = substr($mnu, 4);
            $dbw    = SelectDbFieldsByField(ReadDBFields(DBOPTMENU), 5, $mnu_id);
            foreach ($dbw as $item) {
                ReadDoc($item[4]);
                $urls = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
                $pg   = substr($urls[0], strpos($urls[0], 'pg=') + 3);
                $pos  = strpos($pg, '&');
                $pg   = $pos === false ? $pg : substr($pg, 0, $pos);
                if ($pg == $id) return $fieldc2;
            }
        }
        return '';
    }

    protected function ArtNavbar($mnu, $cat, $titre) {
        global $lang, $web, $site, $urlrw, $xposbox, $z2, $lng, 
               $fieldb1, $fieldb2, $fieldc1, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod, $creadate;
        $imgPrev = '<i class="fas fa-caret-left align-middle mr-2" title="'.$web[32].'"></i>';
        $imgNext = '<i class="fas fa-caret-right align-middle ml-2" title="'.$web[34].'"></i>';
        $nav     = $navp = $navn = $navs = $categ = '';
        $cat     = stripslashes($cat);
        $titre   = stripslashes($titre);
        if (substr($mnu, 0, 3) == 'MNU') {
            $mnu_id = substr($mnu, 4);
            $dbw    = SelectDbFieldsByField(ReadDBFields(DBOPTMENU), 5, $mnu_id);
            $dbart  = array();
            $cmd    = $site['URLR'] == 'on' ? $lng.'-'.$urlrw[20].'-103' : 'articles.php';
            foreach ($dbw as $item) {
                ReadDoc($item[4]);
                if (!isAuthorizedPublication($creadate) || !isAccessGranted($fieldmod)) continue;
                if (strtolower($fieldc1) != '_self' || $fieldweb != $mnu_id) continue;
                $urls1 = explode('||', $fieldd1);
                $urls2 = explode('||', $fieldd2);
                $url1  = $site['URLR'] == 'on' ? (empty($urls1[1]) ? '' : substr($urls1[1], 0, 7 + strlen($urlrw[20]))) : substr($urls1[0], 0, 12);
                $url2  = $site['URLR'] == 'on' ? (empty($urls2[1]) ? '' : substr($urls2[1], 0, 7 + strlen($urlrw[20]))) : substr($urls2[0], 0, 12);
                $url   = $lng == $lang[0] ? ($url1 == $cmd) : ($url2 == $cmd);
                $pg    = substr($urls1[0], strpos($urls1[0], 'pg=') + 3);
                $pos   = strpos($pg, '&');
                $pg    = $pos === false ? $pg : substr($pg, 0, $pos);
                // par défaut le titre de l'article est celui de l'option de menu
                $item[6] = $item[2];
                $item[7] = $item[3];
                if ($pg) { // récupère le titre de l'article pour la comparaison
                    ReadDoc($pg);
                    $item[6] = $fieldb1;
                    $item[7] = $fieldb2;
                }
                if ($url) $dbart[] = $item;
                unset($urls1, $urls2);
            }
            sort($dbart);
            if (count($dbart) > 1) {
                $navs = '
                <form name="selnavart" action="#" method="post" class="d-inline align-middle">
                  <select onchange="document.selnavart.action=this.value; document.selnavart.submit();" class="form-control selArtNavbar" title="">';
            }
            for ($i = 0; $i < count($dbart); $i++) {
                $sel      = '';
                $opttitre = stripslashes($dbart[$i][$lng == $lang[0] ? 2 : 3]);
                $arttitre = stripslashes($dbart[$i][$lng == $lang[0] ? 6 : 7]);
                if ($navs != '') {
                    ReadDoc($dbart[$i][4]);
                    $urls  = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
                    $pg    = substr($urls[0], strpos($urls[0], 'pg=') + 3);
                    $pos   = strpos($pg, '&');
                    $pg    = $pos === false ? $pg : substr($pg, 0, $pos);
                    $ancre = '';
                    $pos1  = strpos($urls[0], '#');
                    $ancre = empty($ancre) ? $z2 : $ancre;
                    if ($pos1 !== false) $ancre = substr($urls[0], $pos1);
                    $atconf  = explode('|', $fieldmail);
                    $sconfig = ($atconf[0] == 'ALL' ? '' : '&amp;tconfig='.$atconf[0]);
                    $iconf   = ($atconf[0] == 'ALL' ? '1031' : '103');
                    $sconf   = ($atconf[0] == 'ALL' ? '' : '-'.$atconf[0]);
                    $urls[0] = 'articles.php?lng='.$lng.'&amp;pg='.$pg.'&amp;mnuid='.$item[5].$sconfig.$ancre;
                    $urls[1] = $lng.'-'.$urlrw[20].'-'.$iconf.'-'.$pg.'-'.$item[5].$sconf.$ancre;
                    $url = empty($urls[1]) ? $urls[0] : ($site['URLR'] != 'on' ? $urls[0] : $urls[1]);
                    unset($urls);
                    // indication des catégories et sous-catégories
                    $curcat = str_replace('|', '-', strip_tags($dbart[$i][$lng == $lang[0] ? 0 : 1]));
                    if ($categ != $curcat) {
                        if ($categ != '' && $i > 0) $navs .= '
                    </optgroup>';
                        $categ = $curcat;
                        $navs .= '
                    <optgroup label="'.$categ.'">';
                    }
                    $navs .= '
                    <option value="'.$url.'"'.Selected($titre == $arttitre).'>'.strip_tags($opttitre).'</option>';
                }
                if ($titre == $arttitre) {
                    if ($i > 0) { // précédent
                        ReadDoc($dbart[$i - 1][4]);
                        $urls  = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
                        $pg    = substr($urls[0], strpos($urls[0], 'pg=') + 3);
                        $pos   = strpos($pg, '&');
                        $pg    = $pos === false ? $pg : substr($pg, 0, $pos);
                        $ancre = '';
                        $pos1  = strpos($urls[0], '#');
                        if ($pos1 !== false) $ancre = substr($urls[0], $pos1);
                        $ancre   = empty($ancre) ? $z2 : $ancre;
                        $atconf  = explode('|', $fieldmail);
                        $sconfig = ($atconf[0] == 'ALL' ? '' : '&amp;tconfig='.$atconf[0]);
                        $iconf   = ($atconf[0] == 'ALL' ? '1031' : '103');
                        $sconf   = ($atconf[0] == 'ALL' ? '' : '-'.$atconf[0]);
                        $urls[0] = 'articles.php?lng='.$lng.'&amp;pg='.$pg.'&amp;mnuid='.$item[5].$sconfig.$ancre;
                        $urls[1] = $lng.'-'.$urlrw[20].'-'.$iconf.'-'.$pg.'-'.$item[5].$sconf.$ancre;
                        $url = empty($urls[1]) ? $urls[0] : ($site['URLR'] != 'on' ? $urls[0] : $urls[1]);
                        unset($urls);
                        $navp = '<a href="'.$url.'" class="artNavP">'.$imgPrev.'</a>&nbsp;&nbsp;';
                    }
                    if ($i < count($dbart) - 1) { // suivant
                        ReadDoc($dbart[$i + 1][4]);
                        $urls  = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
                        $pg    = substr($urls[0], strpos($urls[0], 'pg=') + 3);
                        $pos   = strpos($pg, '&');
                        $pg    = $pos === false ? $pg : substr($pg, 0, $pos);
                        $ancre = '';
                        $pos1  = strpos($urls[0], '#');
                        if ($pos1 !== false) $ancre = substr($urls[0], $pos1);
                        $ancre   = empty($ancre) ? $z2 : $ancre;
                        $atconf  = explode('|', $fieldmail);
                        $sconfig = ($atconf[0] == 'ALL' ? '' : '&amp;tconfig='.$atconf[0]);
                        $iconf   = ($atconf[0] == 'ALL' ? '1031' : '103');
                        $sconf   = ($atconf[0] == 'ALL' ? '' : '-'.$atconf[0]);
                        $urls[0] = 'articles.php?lng='.$lng.'&amp;pg='.$pg.'&amp;mnuid='.$item[5].$sconfig.$ancre;
                        $urls[1] = $lng.'-'.$urlrw[20].'-'.$iconf.'-'.$pg.'-'.$item[5].$sconf.$ancre;
                        $url = empty($urls[1]) ? $urls[0] : ($site['URLR'] != 'on' ? $urls[0] : $urls[1]);
                        unset($urls);
                        $navn = '&nbsp;&nbsp;<a href="'.$url.'" class="artNavS">'.$imgNext.'</a>';
                    }
                }
            }
            if ($navs != '') {
                if ($categ != '') $navs .= '
                    </optgroup>';
                $navs .= '
                  </select>
                </form>';
            }
            $nav = '
              <div class="m-auto text-center">
                <div class="d-inline-block">'.$navp.'</div>
                <div class="d-inline-block">'.$navs.'</div>
                <div class="d-inline-block">'.$navn.'</div>
              </div>';
        }
        return $nav;
    }
    
    public function ART_content() {
        global $members, $z2, $site, $urlrw, $serviz, $web, $lang, $lng, $prt, $userprefs, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, 
               $fieldweb, $fieldmail, $fieldmod, $creadate, $moddate;
        $isdoc = count(SelectDBFields(TYP_ART, 'a', $this->pg)) == 1;
		$txtart101 = 0;
		$txtart102 = 'off';
        if ($isdoc) {
            ReadDoc($this->pg);
            $isdoc = isAuthorizedPublication($creadate);
            if ($isdoc) {
                $groupeprive     = $fieldmod;
                $txtart10        = explode('|', $fieldmail);
                $txtart10        = explode('|', $fieldmail);
                $txtart101       = isset($txtart10[1]) ? $txtart10[1] : 0;
                $txtart102       = isset($txtart10[2]) ? $txtart10[2] : 'off';
                $txtart1         = $lng == $lang[0] ? $fieldb1 : $fieldb2;
                $this->txtart2   = $lng == $lang[0] ? $fieldc1 : $fieldc2;
                $txtart3         = str_replace('|', '-', $lng == $lang[0] ? $fielda1 : $fielda2);
                $txtart4         = FormatDate($moddate);
                $txtart5         = FormatDate($creadate);
                $screadate       = $creadate;
                $smoddate        = $moddate;
                $txtart6         = $fieldd2;
                $txtart8         = $this->mnuid > 0 ? 'MNU '.$this->mnuid : $fieldd1;
                $categ           = $this->GetOptionCateg($txtart8, $this->pg);
                $boxes           = $this->GetOptionBoxes($txtart8, $this->pg);
                $txtart3         = $categ == '' ? $txtart3 : str_replace('|', '-', $categ);
                $txtart9         = $boxes == '' ? $fieldweb : $boxes;
                $this->img       = getNewUpdateDoc($screadate, $smoddate, $serviz[136]);
                $menus           = SelectDBFieldsByField(ReadDBFields(DBMENUBOX), 4, $this->mnuid);
                $txtart11        = $lng == $lang[0] ? (!isset($menus[0][2]) ? '' : $menus[0][2]) : (!isset($menus[0][3]) ? '' : $menus[0][3]);
                $txtart11        = mb_substr($txtart11, (mb_substr($txtart11, 0, 1) == '§' ? 1 : 0));
                $this->txtart102 = $txtart102;
                $this->countit   = true;
            }
        }
        if (!$isdoc) {
            $txtart1         = $web[35];
            $this->txtart2   = $web[36];
            $txtart3         = '';
            $txtart4         = $web[37];
            $txtart5         = $web[37];
            $screadate       = $web[37];
            $smoddate        = $web[37];
            $txtart6         = '';
            $txtart8         = '';
            $txtart9         = '';
            $txtart10        = array(0, 0, 'off');
            $txtart11        = '';
            $groupeprive     = '';
            $this->img       = '';
            $this->txtart102 = 'off';
            $this->countit   = false;
        }
        $this->topmess  = (!empty($txtart6) && is_file(CHEMIN.'img/'.$txtart6) 
          ? '<img src="'.CHEMIN.'img/'.$txtart6.'" class="float-right" alt="" />' 
          : '<i class="fas fa-newspaper float-right"></i>').$txtart1;
        $this->urltitre = $site['URLR'] == 'on'
            ? $lng.'-'.$urlrw[20].'-102-'.$this->pg.'-'.$this->tconfig 
            : 'articles.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;tconfig='.$this->tconfig;
        switch ($txtart9) {
        case 'W' : 
            $this->userprefs3 = '';
            $this->widepage   = 'on';
            break;
        case 'L' : 
            $this->userprefs3 = 'L';
            break;
        case 'R' : 
            $this->userprefs3 = 'R';
            break;
        default : 
            $this->userprefs3 = '';
        }
        $href1 = CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 
          : 'connect.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2);
        $href2 = CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
          : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$this->tconfig.$z2);
        if (!isAccessGranted($members[1])) {
            $out = '
    <div class="text-center web342">'.$web[342];
            if ($members[19] != '0' && $members[19] != '3') {
                $out .= '
      <p class="text-center">
        '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
          (empty($userprefs[1]) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
      </p>';
            }
            $out .= '
    </div>
';
            $this->txtart102 = 'off';
            $this->txtart2   = $out;
            return true;
        } else {
            if (!isAccessGranted($groupeprive)) {
                $out = '
    <div class="text-center web342">'.$web[444];
            if ($members[19] != '0' && $members[19] != '3') {
                $out .= '
      <p class="text-center">
        '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
          (empty($userprefs[1]) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
      </p>';
            }
            $out .= '
    </div>
';
                $this->txtart102 = 'off';
                $this->txtart2   = $out;
                return true;
            } else {
                $out = '';        
                if ($prt != -1 && $prt != 1) {
                    if ($serviz[60] == 'on') {
                        $rssartsurl = $site[3].($site['URLR'] == 'on'? DATAREP.$lng.'-'.$urlrw[19].'-28': sprintf(RSSART, $lng));
                        if (empty($prt)) $out .= '
    <style>
      .overpop { padding-top: 20px; }
    </style>
    <script>
      $(document).ready(function(){
        $(\'.rssArt\').popover({
          title:"RSS",
          content:"'.$web[406].' : <br /><b> '.$rssartsurl.'</b>",
          trigger:"hover",
          placement:"auto",
          offset:"0 10 10 10",
          html:true
        });
      });
    </script>
    <div class="overpop pt-1 pl-2 pb-5">
      <a href="'.CHEMIN.'newsrss.php?lng='.$lng.'&url=arts&tconfig='.$this->tconfig.$z2.'" class="rssArt float-left">
        <i class="fas fa-rss"></i>
      </a>
    </div>';                            
                    }
                }
                if (!empty($this->txtart2)) {
                    $max_height = $txtart101 > 0 && empty($prt) ? $txtart101 : 0;
                    $txt3 = '
    <a id="art'.$this->pg.'"></a>
    <style>
    .contentArt2 {
      height: '.($max_height > 0 ? $max_height.'px;' : 'auto;').'
      overflow: '.($max_height > 0 ? 'hidden;' : 'visible;').'
    }
    </style>
    <div id="texte30" class="pt-4 contentArt">
      <div class="contentArt2">
        '.$this->txtart2.'
      </div>
      <div class="clearfix"></div>';
                    if ($max_height > 0) $txt3 .= '
      <p class="text-right">
        <a href="javascript:ActiveMenu(\'texte3\',\'texte2\',0,1,0)" class="box" title="'.$web[296].'">
          '.$web[296].' <i class="far fa-plus-square align-middle"></i>
        </a>
      </p>';
                    $txt3 .= '
    </div>' ;
                    if ($max_height > 0) $txt3 .= '
    <div id="texte20" style="display:none;">'.$this->txtart2.'
      <p class="text-right c-pointer">
        <a href="#art'.$this->pg.'" title="'.$web[57].'" onclick="cache(\'texte20\');montre(\'texte30\')">
          '.$web[57].' <i class="far fa-minus-square align-middle"></i>
        </a>
      </p>
    </div><div class="clearfix"></div>';
                    $out .= $txt3;            
                    if ($serviz[113] != 'on') {
                        $keywords = GetKeywords($this->pg);
                        if (trim($keywords) != '') {
                            $out .= '
    <fieldset>'.legend($web[641]).$keywords.'</fieldset>';
                        }
                    }
                    $out .= '
    <hr />';
                    if ($prt == 0 && $serviz[105] == 'on') {
                        include CONFIGREP.'sncode.inc';
                        if (!empty($coders))
                            $out .= '
    <div class="row w-100">
      <div class="col-md-12 codersArt">'.$coders.'</div>
    </div>';
                    }
                    $artcounter = $serviz[33] == 'on' ? UpdateDocCounter($this->pg) : 0;
                    $svz = 0;
                    if ($this->countit) {
                            $out .= '
    <div class="row w-100">';
                        if ($serviz[64] == '' || $serviz[65] == '' || $serviz[66] == '' || $serviz[67] == '') {
                            $svz++;
                            $out .= '
      <div class="col-md-6 pl-5 propArtW">';
                            if ($serviz[64] == '') {
                                $out .= '
        <div>'.$web[95].' <b>'.$txtart5.'</b></div>';
                            }
                            $datespub = explode('-', $screadate);
                            if ($serviz[65] == '' && $smoddate > $datespub[0]) {
                                $out .= '
        <div>'.$web[20].' <b>'.$txtart4.'</b></div>';
                            }
                            if ($serviz[66] == '') {
                                $out .= '
        <div>'.$web[21].' <b>'.$txtart11.' - '.$txtart3.'</b></div>';
                            }
                            if ($serviz[67] == '' && $serviz[33] == 'on') {
                                $txtcount = $artcounter < 2 ? $web[188] : $web[189];
                                $out .= '
        <div>'.$web[190].' <b>'.$artcounter.' '.$txtcount.'</b></div>';
                            }
                            $out .= '
      </div>';
                        }
                        else $out .= '
      <div class="col-md-6">&nbsp;</div>';
                        if ($prt == 0 && ($serviz[102] == '' || $serviz[68] == '')) {
                            $svz++;
                            $out .= '
      <div class="col-md-6">';
                            if ($serviz[102] == '') {
                                $navbar = $this->ArtNavbar($txtart8, $txtart3, $txtart1);
                                if ($navbar != '') {
                                    $out .= '
        <div class="row">
          <div class="col-md-12 text-center navbarArt">'.$navbar.'</div>
        </div>';
                                }
                            }
                            if ($serviz[68] == '') {
                                $out .= '
        <div class="row">
	      <div class="col-md-12 text-center prtArt">
            <a href="'.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[20].'-1001-'.$this->pg.'--1' 
              : 'articles.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;prt=-1').'" target="_blank">
              <i class="fas fa-eye" title="'.$web[264].'"></i>&nbsp;'.$web[264].'
            </a>&nbsp;
            <a href="'.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[20].'-1001-'.$this->pg.'-1' 
              : 'articles.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;prt=1').'" target="_blank">
              <i class="fas fa-print" title="'.$web[22].'"></i>&nbsp;'.$web[22].'
            </a>
          </div>
        </div>';				
                            }
                            $out .= '
      </div>';
                        }
                        else $out .= '
      <div class="col-md-6">&nbsp;</div>';
                    }
                    $out .= '
    </div>
    <div class="clearfix"></div>';
                    if ($this->countit && $svz > 0)
                        $out .='
    <hr />';
                    if (empty($prt)) $out .= displayQuickConfig(NULL, $this->pg, 'art&amp;form=2&amp;id='.$this->pg, 
                                                                'art&amp;act=i&amp;id='.$this->pg, 'art&amp;del='.$this->pg, 15);
                } else {
                    $this->countit = false;
                }
                if ($serviz[29] != '2' && $this->txtart102 == 'on' && $this->countit && $prt == 0) {
                    // $out .= '
    // <div class="divnewline"></div>';
                    $this->txtart102 = 'on';
                    $this->txtart2   = $out;
                }
                else {
                    $this->txtart102 = 'off';
                    $this->txtart2   = $out;
                }
                return true;
            }
        }
    }
    
    public function ART_react() {
        global $serviz, $site, $page, $urlrw, $web, $prt, $z2, $lng, 
               $author, $email, $status, $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, 
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod, $creadate, $moddate;
        if ($serviz[29] == '2' || $this->countit === false || $this->txtart102 != 'on') return NULL;
        $out = '
    <a id="reactart"></a>';
        $boxtopmess = $page[9] == '' ? $web[184] : '<i class="far fa-comments float-right"></i>'.$web[184];
        $react      = import('react');
        $dbwork     = array();
        if (!empty($react))
            $dbwork[] = $react;
        elseif (!empty($this->pg)) {
            $dbreaction = ReadDBFields(DBREACT);
            for ($i = 0; $i < count($dbreaction); $i++) {
                if ($dbreaction[$i][1] == $this->pg && isAccessGranted($dbreaction[$i][6])) {
                    $dbwork[] = $dbreaction[$i][0];
                }
            }
        }
        @rsort($dbwork);
        $out .= '
    <form 
      name="react" 
      action="'.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[14].'-4-'.TYP_REACT.'-'.$this->pg.$z2 
        : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_REACT.'&amp;pg='.$this->pg.$z2).'" 
      method="post">
      <input type="hidden" name="tconfig" value="'.$this->tconfig.'">
      <div class="text-center pb-3">'.SubmitButton($web[181]).'</div>
    </form>';
        if (empty($this->id)) $this->id = 1;
        if (!empty($dbwork)) {
            if (abs($prt) == 3) {
                $this->id = 1;
                $serviz[30] = 99999;
            }
            $nbreact = count($dbwork);
            for ($i = $serviz[30]*($this->id-1); $i < Min($serviz[30]*$this->id, $nbreact); $i++) {
                ReadDoc($dbwork[$i]);
                if ($status == 'a') {
                    $out .= '
    <div class="table-responsive-md">
    <table class="w-100 headreact">
      <tr>
        <td class="forum w-15 align-top headreactleft"><p>'.$web[185].$fielda1.'&nbsp;</p></div>
        <td class="quest align-middle headreactright">'.$web[6].' ';
                    if ($fieldd1 == 'on' && empty($prt)) $out .= displayWriteEmail('react'.$i, $author, $email);
                    else $out .= '<b>'.$author.'</b> ';
                    $out .= '
          '.$web[7].' '.FormatDate($creadate).'
        </td>
      </tr>
    </table>
    </div>
    <div class="table-responsive-md">
    <table class="w-100 bodyreact">
      <tr><td class="rep">'.$fieldc1.'</td></tr>
    </table>
    </div>
    <div class="table-responsive-md">
    <table class="w-100">
      <tr>
        <td>';
                    if (empty($prt)) $out .= '
          '.displayQuickConfig(NULL, $dbwork[$i], 'react&amp;form=2&amp;id='.$dbwork[$i], 'react&amp;act=i&amp;id='.$dbwork[$i], 'react&amp;del='.$dbwork[$i], 16);
                        $out .= '
        </td>
      </tr>
    </table>
    </div>
    <br />';
                }
            }
        } else {
            $out .= '
    <div class="table-responsive-md">
    <table class="text-center border-0 m-auto">
      <tr>
        <td><p class="text-center">'.$web[186].'</p></div>
      </td>
    </table>
    </div>';
        }
        $out .= 
    GetNavBar(($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[20].'-1003-'.$this->pg.'-'.$this->tconfig.'-' 
      : 'articles.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;tconfig='.$this->tconfig.'&amp;id='), count($dbwork), $this->id, $serviz[30], '#reactart');
        return array($boxtopmess, $out);
    }
}
?>
blog.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/blog.inc'
View Content
<?php
/*******************************************************************************
 *   Blog
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2022 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.15 (November 29, 2023) : correction illegal variable
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'blog.inc')) {
    header('location:../index.php');
    die();
}

class GY_blog {
    public $tconfig;
    public $topmess;
    public $userprefs3;
    public $typ;
    public $txtart2;
    protected $pg;
    protected $id;
    protected $sel;
    protected $cat;
    protected $datej;
    protected $date;
    protected $smois;
    protected $sannee;
    protected $react;

    public function __construct() {
        global $nom, $menuico, $page, $lang, $lng, $web, $charset, $userprefs;
        static $nbox = 0;
        $this->tconfig    = $menuico[13] == 'ALL' ? import('tconfig', '', true, 0) : $menuico[13];
        $this->pg         = import('pg', '', true, '0');
        $this->id         = import('id');
        $this->react      = import('react');        
        $this->userprefs3 = $userprefs[3] == '' || $userprefs[3] == BOX_LEFT.BOX_RIGHT ? BOX_LEFT : $userprefs3;
        $this->sel        = import('sel', '', true, 'none');
        $this->cat        = import('cat', '', true, '0');
        $this->datej      = import('datej', '', true, '0');
        $this->smois      = import('smois');
        $this->sannee     = import('sannee');
        $date             = import('date', '', true, '0');
        $this->date       = $date == '0' && !empty($this->sannee) && !empty($this->smois) ? $this->sannee.$this->smois : $date;
        $topmess          = getLabel($nom[$lng == $lang[0] ? 42 : 43]);
        $topmess          = $page[9] == '' ? $topmess : '<i class="fas fa-blog float-right pr-2"></i>'.$topmess;
        $this->topmess    = !empty($this->datej) || !empty($this->date) ? $topmess.' - '.$web[399] : $topmess;
        $this->nbox       = $nbox++;
    }
    
    public function BLS_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        if ($serviz[53] != 'on') {
            $out = '
    <div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array($this->typ, $out);
        }
        elseif (!isAccessGranted($members[15])) {
            $out = '
	<div class="web342 text-center">'.$web[342];
            if ($members[19] != '0' && $members[19] != '3') {
                $href1 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 
                  : 'connect.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2);
                $href2 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
                  : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$this->tconfig.$z2);
                $out .= '
      <p class="text-center">
        '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
          (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
      </p>';
            }
            $out .= '
	</div>';
            return array($this->typ, $out);
        }
        elseif (!empty($this->pg)) {
            $dbwork = SelectDBFields(TYP_BLOG, 'a', $this->pg);
            $isdoc  = (count($dbwork) != 0);
            if ($isdoc) {
                $isdoc = isAuthorizedPublication(@$dbwork[0][5]);
                if (!isAccessGranted(@$dbwork[0][6])) return array('h0', '');
            }
            if (!$isdoc) {
                $dbwork = array();
                if ($site[10] != '') return array('h1', '');
                else return array('h2', '');
            }
        }
        return array('');
    }

    public function BLS_content() {
        global $lng, $lang, $drtuser, $page, $site, $serviz, $userprefs, $web, $urlrw, 
               $charset, $prt, $headinc, $titre, $xposbox, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, 
               $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $out         = '';
        $max_height  = isset($site[33]) && $site[33] > 0 && empty($prt) ? $site[33] : 0;
        $max_height2 = isset($site[36]) && $site[36] > 0 && empty($prt) ? $site[36] : 0;
        $xdbw        = array();
        $dbwork      = array();
        switch ($this->sel) {
        case 'pg': // cas billet unique ---------------------
            if (!empty($this->pg)) {
                $stitre = '';
                $xdbw   = SelectDBFields(TYP_BLOG, 'a', $this->pg);
                ReadDoc($this->pg);
            }
            break;
        case 'cat': // cas liste catégorie -----------------
            if (!empty($this->cat)) {
                $stitre = $this->cat;
                $dbwork = ReadDBFields(DBBLOG);
                if (!empty($dbwork)) {
                    $j = $lng == $lang[0]? 0 : 1;
                    for ($i = 0; $i < count($dbwork); $i++) {
                        if ($cat == strip_tags($dbwork[$i][0+$j]) && isAccessGranted($dbwork[$i][6]) && isAuthorizedPublication($dbwork[$i][5])) {
                            $xdbw[$i][0] = TYP_BLOG;
                            $xdbw[$i][2] = $dbwork[$i][4];
                        }
                    }
                }
            }
            break;
        case 'jour': // cas liste jour ---------------------
            if (!empty($this->datej)) {
                $stitre     = $web[403].substr(FormatDate($this->datej), 0, 10);
                $this->date = $this->datej;
                $dbwork     = ReadDBFields(DBBLOG);
                for ($i = 0; $i < count($dbwork); $i++) {
                    if (!isAccessGranted($dbwork[$i][6])) continue;
                    ReadDoc($dbwork[$i][4]);
                    $datebi = substr($creadate, 0, 8);
                    if ($datebi == $this->datej && isAuthorizedPublication($creadate)) {
                        $xdbw[$i][0] = TYP_BLOG;
                        $xdbw[$i][2] = $fileid;
                    }
                }
            }
            break;
        case 'mois': // cas liste mois ---------------------
            if (!empty($this->date)) {
                $stitre = $web[403].' '.substr(FormatDate($this->date), 1, 7);
                $dbwork = ReadDBFields(DBBLOG);
                for ($i = 0; $i < count($dbwork); $i++) {
                    if (!isAccessGranted($dbwork[$i][6])) continue;
                    ReadDoc($dbwork[$i][4]);
                    $datebi = substr($creadate, 0, 6);
                    if ($datebi == $this->date && isAuthorizedPublication($creadate)) {
                        $xdbw[$i][0] = TYP_BLOG;
                        $xdbw[$i][2] = $fileid;
                    }
                }
            }
            break;
        default: // cas liste globlale ---------------------
            $stitre = ' - '.$web[383];
            $dbwork = ReadDBFields(DBBLOG);
            foreach ($dbwork as $db) {
                if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                    $xdbw[] = array(TYP_BLOG, $db[5], $db[4], 'a');
                }
            }
        }
        unset($dbwork);
        @rsort($xdbw);
        if (empty($this->id)) $this->id = 1;
        $minblog = $serviz[55];
        $maxblog = Min(intval($serviz[55])*$this->id,count($xdbw));
        if (isset($prt) && 3 == abs($prt)) {
            $this->id = 1;
            $minblog  = 99999;
            $maxblog  = min($minblog, count($xdbw));
        }
        if (abs($prt) != 1) $out .= $this->topblog();
        $out .= '
    <div class="w-100">
          <div class="text-center headCenterBlog">';
        if ($serviz[54] == 'on' && empty($prt)) {
            $rssblogurl = $site[3].sprintf(RSSBLOG, $lng);
            $out .= '
            <style>
              .headCenterBlog .overpop { padding-top: 20px; }
              .overpop a i { margin-top: -20px; }
            </style>
            <script>
              $(document).ready(function(){
                $(\'.rssBlog\').popover({
                  title:"RSS",
                  content:"'.$web[398].' : <br /><b> '.$rssblogurl.'</b>",
                  trigger:"hover",
                  placement:"auto",
                  offset:"0 10 10 10",
                  html:true
                });
              });
            </script>
            <div class="overpop pt-0 pl-2">
              <a href="'.CHEMIN.'newsrss.php?lng='.$lng.'&url=blog&tconfig='.$this->tconfig.$z2.'" class="rssBlog float-left">
                <i class="fas fa-rss"></i>
              </a>
            </div>';                            
        }
        if ($site[30] != '2' && empty($prt)) $out .= '
            <form 
              name="postblog'.$this->nbox.'" 
              action="'.CHEMIN.($site['URLR'] == 'on' 
                ? $lng.'-'.$urlrw[14].'-'.TYP_BLOG.$z2 
                : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_BLOG.$z2).'" 
              method="post">
              <div class="text-center'.($serviz[54] == 'on' ? ' postBlog' : '').'">'.SubmitButton($web[386]).'</div>
            </form>';
        else $out .= '
            <div class="divnewline"></div>';
        $out .= '
          </div>';
        $out .= GetNavBar(($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[1].'-31-'.$this->sel.'-'.$this->pg.'-'.$this->cat.'-'.$this->datej.'-'.$this->date.'-' 
          : $site['BLS'].'.php?lng='.$lng.'&amp;sel='.$this->sel.'&amp;pg='.$this->pg.'&amp;cat='.$this->cat.
            '&amp;datej='.$this->datej.'&amp;date='.$this->date.'&amp;id='), 
          count($xdbw), $this->id, $minblog, $z2);
        $nbrnvisi = count($xdbw) > $site[31] ? $site[31] : count($xdbw);
        if (count($xdbw) == 0) { // Cas particuliers
            if ($this->sel == 'mois') $out .= '
            <p class="text-center font-weight-bold">'.$web[438].'</p>';
            else $out .= '
            <p class="text-center font-weight-bold">'.$web[439].($site[30] == '2'? '' : '<br />'.$web[440]).'</p>';
        }
        else {
            for ($i = $minblog*($this->id-1); $i < $maxblog; $i++) {
                ReadDoc($xdbw[$i][2]);
                $txt0 = $fileid;
                $img  = getNewUpdateDoc($creadate, $moddate, $serviz[138]);
                if ($lng == $lang[0]) {
                    $txt1    = $fieldb1;
                    $txtart2 = $fieldc1;
                }
                else {
                    $txt1    = $fieldb2;
                    $txtart2 = $fieldc2;
                }
                if (!empty($txtart2)) {
                    if (!empty($fieldd2)) 
                        $txt1 = '<img src="'.CHEMIN.'img/'.$fieldd2.'" 
                                      class="'.($serviz[153] == 'on' ? 'float-left' : 'float-right').'" 
                                      alt="'.$fieldd2.'"/>'.$txt1;
                    $out .= '
            <div class="bord">
              <div class="quest '.($serviz[153] != 'on' ? 'text-left' : 'text-right').'">
                <a href="'.$site[3].($site['URLR'] == 'on' 
                    ? $lng.'-'.$urlrw[1].'-4-'.$fileid.$z2 
                    : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2).'" title="'.$web[511].'">
                  '.$img.'<b>'.$txt1.'</b>
                </a> &nbsp;';
                    if ($serviz[114] != 'on') {
                        if ($fieldd1 == 'on' && !empty($email) && !empty($author)) 
                            $out .= '- &nbsp;'.$web[6].displayWriteEmail('blog'.$i, $author, $email);
                        elseif (!empty($author)) 
                            $out .= '- &nbsp;'.$web[6].'
                <b>'.$author.'</b>';
                    }
                    $out .= '
              </div>';
                    $txt3 = '
              <a id="billet'.$i.'"></a>
              <div id="blog3'.$i.'" class="rep blog3Blog">';
                    if (!empty($txtart2)) {
                        $txt3 .= '
<style>
.text2Blog {
  max-height: '.($max_height2 > 0 ? $max_height2.'px' : 'auto').';
  '.($max_height2 > 0 ? ' overflow: hidden;' : '').'
  padding: 4px;
}
</style>
                <div class="rep text2Blog">
                  '.$txtart2.'
                </div><div class="clearfix"></div>';
                    if ($max_height2 > 0) $txt3 .= '
                <p class="text-right"> 
                  <a href="javascript:ActiveMenu(\'blog3\',\'blog2\',0,'.$nbrnvisi.','.$i.')" class="box" title="'.$web[296].'">'.$web[296].' 
                    <i class="far fa-plus-square"></i>
                  </a>
                </p>';
                        $txt3 .= '
              </div>';
                    if ($max_height2 > 0) $txt3 .= '
              <div id="blog2'.$i.'" class="rep blog2Blog" style="display:none;">'.$txtart2.'<div class="clearfix"></div>
                <p class="text-right c-pointer">
                  <a href="#billet'.$i.'" title="'.$web[57].'" onclick="cache(\'blog2'.$i.'\');montre(\'blog3'.$i.'\')">
                    '.$web[57].' <i class="far fa-minus-square"></i>
                  </a>
                </p>
              </div>';
                    }
                    $out .= $txt3;
                    if ($prt == 0 && $serviz[104] == 'on') {
                        include CONFIGREP.'sncode.inc';
                        if (!empty($coders))
                            $out .= '
              <div class="text-left codersBlog">'.$coders.'</div>';
                    }
                    $out .= '
              <div class="text-right align-middle footerItemBlog">
                <form name="formblog'.$i.'" 
                      action="'.CHEMIN.($site['URLR'] == 'on' 
                        ? $lng.'-'.$urlrw[1].'-4-'.$fileid.$z2 
                        : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2).'" 
                      method="post">
                  <b>'.$web[394].'</b>'.FormatDate($creadate).'&nbsp;';
                    if ($serviz[57] != "") {
                        $dbcom = ReadDBFields(DBREBLOG);
                        $nbcom = 0;
                        for ($k = 0; $k < count($dbcom); $k++) {
                            if ($dbcom[$k][1] == $txt0) {
                                ReadDoc($dbcom[$k][0]);
                                if ($status == 'a') {
                                    $nbcom++;
                                }
                            }
                        }
                        $fileid = $txt0;
                        if ($nbcom == 0) $nbcom = $web[430].' '.$web[379];
                        elseif ($nbcom == 1) $nbcom = $nbcom.' '.$web[379];
                        else $nbcom = $nbcom.' '.$web[379].'s';
                        if ($serviz[57] != '2')
                            $out .= '
                  <a href="'.CHEMIN.($site['URLR'] == 'on' 
                      ? $lng.'-'.$urlrw[1].'-4-'.$fileid.$z2 
                      : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2).'" title="'.$nbcom.' - '.$web[297].' '.$web[385].'">
                    <span class="commentBlog"> - '.$nbcom.' -  </span>
 			        <i class="far fa-comment align-middle commentBlogW" title="'.$nbcom.' - '.$web[297].' '.$web[385].'"></i>
                  </a>';
                    }
                    $out .= '
                  <input type="hidden" name="cat" value="'.$this->cat.'"/>
                  <input type="hidden" name="sel" value="'.$this->sel.'"/>';
                    $rank     = ReadDBFields(ADMINS);
                    $modadmin = '';
                    for ($y = 0; $y < count($rank); $y++) {
                        if ($rank[$y][0] == $userprefs[1] && $rank[$y][2] == 'on') {
                            $modadmin = 'yes';
                            break;
                        }
                    }
                    if (($author == $userprefs[1] || $modadmin == 'yes' || $serviz[31] == $userprefs[1] || $serviz[176] == $userprefs[1]) && $site[30] != '2') {
                        $urlb = $site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[14].'-11-'.TYP_BLOG.'-maj-'.$fileid.$z2 
                          : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_BLOG.'&amp;mod=maj&amp;pg='.$fileid.$z2;
                        $out .= '
                  &nbsp;| <a href="'.$urlb.'" title="'.$web[369].'"><i class="far fa-edit"></i></a>&nbsp;';
                    }
                    if (empty($serviz[76]) && empty($prt)) {
                        $out .= '| 
                  <a href="'.CHEMIN.($site['URLR'] == 'on' 
                      ? $lng.'-'.$urlrw[1].'-41-'.$fileid.'--1'
                      : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;prt=-1').'" target="_blank">
                    <i class="far fa-eye align-middle" title="'.$web[264].'"></i>
                  </a>&nbsp;
                  <a href="'.CHEMIN.($site['URLR'] == 'on' 
                      ? $lng.'-'.$urlrw[1].'-41-'.$fileid.'-1' 
                      : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;prt=1').'" target="_blank">
                    <i class="fas fa-print align-middle" title="'.$web[22].'"></i>
                  </a>&nbsp;';
                    }
                    if (empty($prt)) $out .= '
                  <a href="#top">| <i class="fas fa-arrow-up align-middle"></i></a>';
                        $out .= '
                </form>
              </div>
            </div>';
                    if (empty($prt)) $out .= '
            <div class="qcItemBlog">
              '.displayQuickConfig(null, $xdbw[$i][2], 'blog&amp;form=2&amp;id='.$xdbw[$i][2], 
                  'blog&amp;act=i&amp;id='.$xdbw[$i][2], 'blog&amp;del='.$xdbw[$i][2], 39).'
            </div>';
                }
            }
            $out .= GetNavBar(($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[1].'-31-'.$this->sel.'-'.$this->pg.'-'.$this->cat.'-'.$this->datej.'-'.$this->date.'-' 
              : $site['BLS'].'.php?lng='.$lng.'&amp;sel='.$this->sel.'&amp;pg='.$this->pg.'&amp;cat='.$this->cat.
                '&amp;datej='.$this->datej.'&amp;date='.$this->date.'&amp;id='), 
              count($xdbw), $this->id, $minblog, $z2);
        }
        if ($site[30] != "2") {
                $out .= '
            <form 
              action="'.CHEMIN.($site['URLR'] == 'on' 
                ? $lng.'-'.$urlrw[14].'-'.TYP_BLOG.$z2 
                : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_BLOG.$z2).'" 
              method="post">
              <div class="text-center">'.SubmitButton($web[386]).'</div>
            </form>';
        }
        $out .= '
    </div>
    ';
        $this->topmess .= $stitre;
        $this->txtart2  = $out;
        return true;
    }
    
    private function topblog() {
        global $lng, $lang, $nom, $site, $urlrw, $serviz, $userprefs, $members, $web, $z2, $tconfig;
        $out = '';
        if (($serviz[28] == 'on' || $serviz[24] == 'on') && $serviz[181] != 'on') {
            $out .= '
<div class="row p-0 m-0 mt-3">';
            $dossier_users = MSGREP;
            $file_users    = opendir($dossier_users);
            $nbr_membres   = 0;
            while ($nomfichier = readdir($file_users)) 
                if (substr($nomfichier,-3) == "dtb") $nbr_membres++;
            closedir($file_users);
            if ($serviz[28] == 'on' && !empty($nbr_membres)) {
                $out .= '
  <div class="col-md-4 p-0">';
                if (!empty($userprefs[1])) {
                    if ($serviz[18] != 'on') $out .= '
    <div class="d-inline-block pb-3">
      <form 
        name="usermsg" 
        action="'.CHEMIN.($site['URLR'] =='on' 
          ? $lng.'-'.$urlrw[13].'-'.$this->tconfig.$z2 
          : 'tinymsg.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
        method="post" >
        <input type="hidden" name="action" value="3" />
        '.SubmitButton($web[318]).'
      </form>
    </div>';
                    $nbrmsg = array();
                    if (FileDBExist(MSGREP.$userprefs[1].DBEXT)) {
                        $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
                        if ($dbmsg[0][0] == $userprefs[7]) 
                            for ($i = 2; $i < count($dbmsg); $i++) 
                                if ($dbmsg[$i][3] == "new") $nbrmsg[] = $dbmsg[$i][3];
                        if (count($nbrmsg)!= 0) {
                            $out .= '
    <div class="d-inline-block userWaveBlog">
      <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[13].'-3-3-'.$this->tconfig.$z2 
          : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;tconfig='.$this->tconfig.$z2).'">
        <i class="far fa-envelope blink display-4 text-success align-middle" title="'.$web[319].'"></i>
      </a>
    </div>';
                        }
                    }
                } elseif ($members[19] != '0' && $members[19] != '3') 
                    $out .= '
    <div class="d-inline-block pb-3">
      <form 
        name="userpref" 
        action="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
          : $site['USR'].'.php?lng='.$lng.'&amp;uuser=new&amp;tconfig='.$this->tconfig.$z2).'" 
          method="post">
        '.SubmitButton($web[160]).'
      </form>
    </div>';
                    if ($nbr_membres > 0 && empty($userprefs[1]))
                        $out .= '
    <div class="d-inline-block">
	  <form 
        name="userconnect" 
        action="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 
          : 'connect.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
        method="post">
	    '.SubmitButton($web[373]).'
	  </form>
    </div>';
                $out .= '
  </div>';
            }
            $out .= '
  <div class="col-md-2 p-0">';
            if ($nbr_membres > 0) $out .= '
	<div class="d-inline-block text-center membersTopBlog">';
            if ($serviz[158] == '') {
                $text_nbr_membres = $web[$nbr_membres > 1 ? 321: 322];
                $out .= '
	  <i class="fas fa-users" title="'.$web[320].'"></i>&nbsp;<b>'.$nbr_membres.' '.$text_nbr_membres.'</b>'."\n";
            }
            $out .= '
	</div>
  </div>';
            $out .= '
  <div class="col-md-4 p-0">';
            if ($serviz[159] == '') {
                $regusers    = ReadDBFields(DBIPSTATS);
                $usersonline = array();
                for ($i = 0; $i < count($regusers); $i++) 
                    if (!empty($regusers[$i][2])) $usersonline[] = $regusers[$i][2];
                @sort($usersonline);
                $uniqueusers = array();
                if (!empty($usersonline)) $uniqueusers[] = $usersonline[0];
                for ($i = 1; $i < count($usersonline); $i++) 
                    if ($usersonline[$i] != $usersonline[$i-1]) $uniqueusers[] = $usersonline[$i];
                if (empty($usersonline)) $out .= '
	<div class="d-inline-block align-top text-center membersTopBlog">
      <b>'.$web[175].'</b> '.$web[176].'
    </div>';
                else {
                    $out .= '
	<div class="d-inline-block text-center membersTopBlog">
      <b>'.$web[175].'</b> '.count($uniqueusers).'&nbsp;';
                    if ($userprefs[1] != "") {
                        $from = $userprefs[1];
                        $out .= '
		&nbsp;<i class="fas fa-caret-right connectedImg" title="'.$web[321].'"></i>'.$userprefs[1].' &nbsp;';
                    }
                    if (count($uniqueusers) > '1' && $serviz[18] != 'on') {
                        $out .= '
      <form name="tinysend" 
            method="post" 
            action="'.CHEMIN.($site['URLR'] =='on' 
              ? $lng.'-'.$urlrw[13].'-'.$this->tconfig.$z2 
              : 'tinymsg.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'">
		<input type="hidden" name="from" value="'.@$from.'" />
        <input type="hidden" name="action" value="1" />
        <div class="d-inline-block">&nbsp;+&nbsp;</div>
		<div class="d-inline-block">
          <select name="to" onchange="this.form.submit" class="form-control align-middle" style="max-width: 128px;">';
                        for ($i = 0; $i < count($uniqueusers); $i++) 
                            if ($uniqueusers[$i] != $userprefs[1]) $out .= '
		    <option value="'.$uniqueusers[$i].'">&nbsp;'.$uniqueusers[$i].'</option>';
                        $out .= '
		  </select>
        </div>';
                        if ($userprefs[1] != '' && count($uniqueusers) > '1') $out .= '
	    <div class="d-inline-block">
          <button type="submit" class="mailsubmitTopForum" style="width: 56px;" title="'.$web[214].'"><i class="far fa-envelope"></i></button>
        </div>';
                        $out .= '
	  </form>';
                    }
                    $out .= '
	</div>';
                }
            }
            $out .= '
  </div>
  <div class="col-md-2 p-0 text-right searchTopBlog">';
            if ($serviz[24] == 'on') {
                include CONFIGREP.'searchconfig.inc';
                $tconfig = $confpage == 'ALL' ? $this->tconfig : $confpage;
                $out .= '
	<form 
        name="what"
        action="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[12].'-'.$tconfig.$z2 
          : 'search.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" 
        method="post">
	  <input name="searchin" type="hidden" value="'.TYP_BLOG.'" />
      <div class="input-group mb-3 m-auto">
        <input name="search" class="texte form-control" type="text" placeholder="'.$web[58].'" value="" />
        <div class="input-group-append c-pointer" onclick="javascript:what.submit();">
          <span class="input-group-text">
            <i class="fas fa-search" title="'.$web[58].' '.getLabel($nom[$lng == $lang[0] ? 42 : 43]).'"></i>
          </span>
        </div>
      </div>
	</form>';
            }
            else $out .= '&nbsp;';
        $out .= '
  </div>
</div>
<div class="clearfix"></div>';
        }
        return $out;
    }
    
    public function BL_content() {
        global $lng, $lang, $drtuser, $site, $serviz, $userprefs, $web, $urlrw, $charset, $prt, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, 
               $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $out   = '';
        $dbw   = SelectDBFields(TYP_BLOG, 'a', $this->pg);
        $isdoc = count($dbw) == 1;
        if ($isdoc) {
            ReadDoc($this->pg);
            $isdoc = isAuthorizedPublication($creadate);
            if ($isdoc) {
                $countit = 1;
                if ($lng == $lang[0]) {
                    $txtart1 = $fieldb1;
                    $txtprt  = strip_tags($fieldb1);
                    $txtart2 = $fieldc1;
                    $txtart3 = $fielda1;
                }
                else {
                    $txtart1 = $fieldb2;
                    $txtprt  = strip_tags($fieldb2);
                    $txtart2 = $fieldc2;
                    $txtart3 = $fielda2;
                }
                $txtart4 = FormatDate($moddate);
                $txtart5 = FormatDate($creadate);
                $txtart6 = $author;
                $txtart7 = $fieldd1 != 'on' ? $email : '';
                $txtart8 = $fieldd2;
            }
        }
        if (!$isdoc) {
            $countit = 0;
            $txtart1 = $web[35];
            $txtart2 = $web[36];
            $txtart3 = $web[37];
            $txtart4 = $web[37];
            $txtart5 = $web[37];
            $txtart6 = '';
            $txtart7 = '';
            $txtart8 = '';
        }
        $max_height2 = isset($site[36]) && $site[36] > 0 && empty($prt) ? $site[36] : 0;
        if (!empty($txtprt)) $this->topmess .= ' - '.$txtart3;
        if (abs($prt) != 1) $out .= $this->topblog();
        $out .= '
    <div class="text-center headCenterBlog">';
        if ($serviz[54] == 'on') {
            $rssblogurl = $site[3].sprintf(RSSBLOG, $lng);
            $out .= '
      <style>
        .headCenterBlog .overpop { padding-top: 20px; }
        .overpop a i { margin-top: -20px; }
      </style>
      <script>
        $(document).ready(function(){
          $(\'.rssBlog\').popover({
            title:"RSS",
            content:"'.$web[398].' : <br /><b> '.$rssblogurl.'</b>",
            trigger:"hover",
            placement:"auto",
            offset:"0 10 10 10",
            html:true
          });
        });
      </script>
      <div class="overpop pt-0 pl-2">
        <a href="'.CHEMIN.'newsrss.php?lng='.$lng.'&url=blog&tconfig='.$this->tconfig.$z2.'" class="rssBlog float-left">
          <i class="fas fa-rss"></i>
        </a>
      </div>';                            
        }
        if ($site[30] != '2' && abs($prt) != 1) $out .= '
      <form 
        name="comment" 
        action="'.($site['URLR'] == 'on' 
          ? $site[3].$lng.'-'.$urlrw[14].'-'.TYP_BLOG.$z2 
          : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_BLOG.$z2).'" 
        method="post">
        <p class="text-center">'.SubmitButton($web[386]).'</p>
      </form>';
        else $out .= '
      <div class="divnewline"></div>';
        $out .= '
    </div>';
        if (!empty($txtart1)) {
            $out .= '
    <a id="hautbillet"></a>';
            if (!empty($txtart8)) 
                $txtart1 = '<img src="'.CHEMIN.'img/'.$txtart8.'" class="'.($serviz[153] == 'on' ? 'float-left' : 'float-right').'" alt=""/>'.$txtart1;
            $out .= '
    <div class="quest '.($serviz[153] != 'on' ? 'text-left' : 'text-right').'"><b>'.$txtart1.'</b> &nbsp;';
            if ($serviz[114] != 'on') {
                if (!empty($txtart6) && !empty($txtart7)) 
                    $out .= '- &nbsp;'.$web[6].displayWriteEmail('blog', $txtart6, $txtart7);
                elseif (!empty($txtart6)) $out .= '- &nbsp;'.$web[6].'
      <b>'.$txtart6.'</b>';
            }
            $out .= '
    </div>
    <div class="bord bordBillet">
      <div class="rep text-left billetBlog">';
            $txt3 = '
        <div id="blog31" class="rep blog3Blog">
<style>
.text2Blog {
  max-height: '.($max_height2 > 0 ? $max_height2.'px' : 'auto').';
  '.($max_height2 > 0 ? ' overflow: hidden;' : '').'
  padding: 4px;
}
</style>';
            if (mb_strlen($txtart2, $charset) >= 0) {
                $txt3 .= '
          <div class="rep text2Blog">'.$txtart2.'</div><div class="clearfix"></div>';
                if ($max_height2 > 0) $txt3 .= '
          <p class="text-right"> 
            <a href="javascript:ActiveMenu(\'blog3\',\'blog2\',0,1,1)" class="box" title="'.$web[296].'">'.$web[296].' 
			  <i class="far fa-plus-square"></i>
		    </a>
          </p>';
            }
            else $txt3 .= '
          <div class="rep txt2Blog">'.$txtart2.'</div><div class="clearfix"></div>';
            $out .= $txt3.'
		</div>
	    <div id="blog21" class="rep blog2Blog" style="display:none;">'.$txtart2.'
		  <p class="text-right c-pointer">
            <a href="#hautbillet" title="'.$web[57].'" onclick="cache(\'blog21\');montre(\'blog31\')">
	          '.$web[57].' <i class="far fa-minus-square"></i>
            </a>
	      </p>
		</div><div class="clearfix"></div>
      </div>';
            if ($prt == 0 && $serviz[104] = 'on') {
                include CONFIGREP.'sncode.inc';
                if (!empty($coders))
                    $out .= '
	  <div class="text-left codersBlog">'.$coders.'</div>';
            }
            $out .= '
      <div id="action" class="float-right text-right align-middle footerBillet">
        <b>'.$web[394].'</b> '.$txtart5.'&nbsp;&nbsp;';
            if ($serviz[33] == 'on' && $countit == 1) {
                $artcounter = UpdateDocCounter($this->pg);
                $txtcount   = $artcounter <= 1 ? $web[188] : $web[189];
            }
            if ($countit == 1) {
                $dbw = array();
                $dbw = SelectDBFields(TYP_BLOG, 'a', '');
                @rsort($dbw);
                for ($i = 0; $i < count($dbw) ; $i++) {
                    if ($dbw[$i][1] == $this->pg){
                        $idb = floor(1+($i/$serviz[55]));
                        break;
                    }
                }
                $out .= '
        <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[1].'-'.$this->tconfig.$z2 
            : $site['BLS'].'.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'">
          | <i class="far fa-file-alt align-middle commentBlogW" title="'.$web[383].'"></i>
        </a>';
                $rank     = ReadDBFields(ADMINS);
                $modadmin = '';
                for ($y = 0; $y < count($rank); $y++) {
                    if ($rank[$y][0] == $userprefs[1] && $rank[$y][2] == 'on') {
                        $modadmin = 'yes';
                        break;
                    }
                }
                if (($txtart6 == $userprefs[1] || $modadmin == 'yes' || $serviz[31] == $userprefs[1] || $serviz[176] == $userprefs[1]) && $site[30] != 2) {
                    $urlb = $site['URLR'] == 'on' 
                      ? $lng.'-'.$urlrw[14].'-11-'.TYP_BLOG.'-maj-'.$this->pg.$z2 
                      : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_BLOG.'&amp;mod=maj&amp;pg='.$this->pg.$z2;
                    $out .= '
        &nbsp;| <a href="'.$urlb.'" title="'.$web[369].'"><i class="far fa-edit"></i></a>&nbsp;';
                }
                if ($prt == 0) {
                    if (empty($serviz[76])) {
                        $out .= '
        <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[1].'-41-'.$this->pg.'--1' 
            : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;prt=-1').'" target="_blank">
          | <i class="far fa-eye align-middle" title="'.$web[264].'"></i>
        </a>&nbsp;
        <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[1].'-41-'.$this->pg.'-1' 
            : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;prt=1').'" target="_blank">
          <i class="fas fa-print align-middle" title="'.$web[22].'"></i>
        </a>&nbsp;';
                    }
                    $out .= '| <a href="#top" title="'.$web[136].'"><i class="fas fa-arrow-up align-middle"></i></a>';
                }
            }
            $out .= '
      </div>
      <div class="clearfix"></div>
    </div>';
            if (empty($prt) && $countit == 1) 
                $out .= displayQuickConfig(NULL, $this->pg, 'blog&amp;form=2&amp;id='.$this->pg, 
                  'blog&amp;act=i&amp;id='.$this->pg, 'blog&amp;del='.$this->pg, 39);
        } 
        else $countit = 0;
        if ($serviz[57] != '2' && $countit == 1 && 1 != abs($prt)) {
            $out .= '
            <input type="hidden" name="cat" value="'.$txtart3.'"/><br /><br />';
            $dbwork = array();
            if (!empty($this->react)) $dbwork[0] = $this->react;
            elseif (!empty($this->pg)) {
                $dbreaction = ReadDBFields(DBREBLOG);
                for ($i = 0; $i < count($dbreaction); $i++) {
                    if ($dbreaction[$i][1] == $this->pg && isAccessGranted($dbreaction[$i][6])) {
                        $dbwork[] = $dbreaction[$i][0];
                    }
                }
            }
            @sort($dbwork);
            $out .= '
    <div class="titrebox">'.$web[407].'</div>
    <div>
      <form 
        name="formreblog1" 
        action="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[14].'-4-'.TYP_REBLOG.'-'.$this->pg.$z2 
          : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_REBLOG.'&amp;pg='.$this->pg.$z2).'" 
        method="post">
        <p class="text-center">'.SubmitButton($web[380]).'</p>
      </form>';
            if (empty($this->id)) $this->id = 1;
            if (!empty($dbwork)) {
                if (3 == abs($prt)) {
                    $this->id   = 1;
                    $serviz[30] = 99999;
                }
                $out .= GetNavBar(($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[1].'-45-'.$this->pg.'-' 
                  : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;id='), count($dbwork), $this->id, $serviz[30], $z2);
                for ($i = $serviz[30]*($this->id-1); $i < Min($serviz[30]*$this->id, count($dbwork)); $i++) {
                    ReadDoc($dbwork[$i]);
                    if ($status == 'a') {
                        $out .= '
      <div class="table-responsive-md">
      <div class="d-table w-100 boxreBlog">
        <div class="d-table-row text-left">
          <div class="forum d-table-cell w-15 align-top boxreBlog2"><p>'.$web[185].$fielda1.'&nbsp;</p></div>
          <div class="quest d-table-cell align-middle boxreBlog3">&nbsp;'.$web[6].' ';
                        if ($fieldd1 == 'on') $out .= displayWriteEmail('reblog'.$i, $author, $email);
                        else $out .= '
            <b>'.$author.'</b> ';
                    $out .= '
            '.$web[7].' '.FormatDate($creadate).'
          </div>
        </div>
      </div>
      </div>
      <div class="table-responsive-md">
      <div class="d-table w-100 bodyreBlog">
        <div class="d-table-row">
          <div class="rep d-table-cell">';
                $out .= '
            '.$fieldc1.'
          </div>
        </div>
      </div>
      </div>
      <div class="table-responsive-md">
      <div class="d-table w-100">
        <div class="d-table-row">
          <div class="d-table-cell">';
                        if (empty($prt)) $out .= '
          '.displayQuickConfig(NULL, $dbwork[$i], 'reblog&amp;form=2&amp;id='.$dbwork[$i], 
            'reblog&amp;act=i&amp;id='.$dbwork[$i], 'reblog&amp;del='.$dbwork[$i], 40);
                        $out .= '
          </div>
        </div>
      </div>
      </div>';
                    }
                }
                $out .= GetNavBar(($site['URLR'] == 'on'  
                  ? $lng.'-'.$urlrw[1].'-45-'.$this->pg.'-' 
                  : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;id='), 
                  count($dbwork), $this->id, $serviz[30], $z2);
                if (count($dbwork) > 1) $out .= '
      <form 
        name="formreblog2" 
        action="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[14].'-4'.TYP_REBLOG.'-'.$this->pg.$z2 
          : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_REBLOG.'&amp;pg='.$this->pg.$z2).'" 
        method="post">
        <p class="text-center">'.SubmitButton($web[380]).'</p>
      </form>';
            }
            else $out .= '
      <p class="text-center">'.$web[186].'</p>';
            $out .= '
    </div>';
        }
        $this->txtart2 = $out;
        return true;
    }
    
    public function BLSA_content() {
        global $lng, $lang, $drtuser, $page, $site, $serviz, $userprefs, $web, $urlrw, $z2, $prt;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email,
             $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
             $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $max_height = isset($site[36]) && $site[36] > 0 && empty($prt) ? $site[36] : 0;
        $out        = '';        
        $xdbw       = array();
        switch ($this->sel) {
        case 'pg': // cas billet unique ---------------------
            if (!empty($this->pg)) {
                $titre = '';
                $xdbw  = SelectDBFields(TYP_BLOG, 'a', $this->pg, DOCIDARCH);
                ReadDoc($pg, ARCHDBBASE);
            }
            break;
        case 'cat': // cas liste catégorie -----------------
            if (!empty($this->cat)) {
                $titre  = $cat;
                $dbwork = ReadDBFields(DBBLOGARCH);
                if (!empty($dbwork)) {
                    $j = $lng == $lang[0]? 0 : 1;
                    for ($i = 0; $i < count($dbwork); $i++) {
                        if ($this->cat == strip_tags($dbwork[$i][0+$j]) && isAcccessGranted($dbwork[$i][6])) {
                            $xdbw[$i][0] = TYP_BLOG;
                            $xdbw[$i][1] = $dbwork[$i][4];
                        }
                    }
                }
            }
            break;
        case 'jour': // cas liste jour ---------------------
            if (!empty($this->datej)) {
                $titre      = $web[403].substr(formatDate($this->datej), 0, 10);
                $this->date = $this->datej;
                $dbwork     = ReadDBFields(DBBLOGARCH);
                for ($i = 0; $i < count($dbwork); $i++) {
                    if (!isAccessGranted($dbwork[$i][6])) continue;
                    ReadDoc($dbwork[$i][4]);
                    $datebi = CutLongWord($creadate, 8);
                    if ($datebi == $this->datej) {
                        $xdbw[$i][0] = TYP_BLOG;
                        $xdbw[$i][1] = $fileid;
                    }
                }
            }
            break;
        case 'mois': // cas liste mois ---------------------
            if (!empty($this->date)) {
                $titre  = $web[399].' '.substr(FormatDate($this->date), 1, 7);
                $dbwork = ReadDBFields(DBBLOGARCH);
                for ($i = 0; $i < count($dbwork); $i++) {
                    if (!isAccessGranted($dbwork[$i][6])) continue;
                    ReadDoc($dbwork[$i][4]);
                    $datebi = CutLongWord($creadate, 6);
                    if ($datebi == $this->date) {
                        $xdbw[$i][0] = TYP_BLOG;
                        $xdbw[$i][1] = $fileid;
                    }
                }
            }
            break;
        default: // cas liste globlale ---------------------
            $titre  = $web[383];
            $dbwork = ReadDBFields(DBBLOGARCH);
            foreach ($dbwork as $db) 
                if (isAccessGranted($db[6])) 
                    $xdbw[] = array(TYP_BLOG, $db[4], 'a');
        }
        unset($dbwork);
        if (!empty($xdbw) || $this->sel == 'mois') {
            @rsort($xdbw);
            if (empty($this->id)) $this->id = 1;
            $minblog = $serviz[55];
            $maxblog = Min($serviz[55]*$this->id, count($xdbw));
            if (isset($prt) && 3 == abs($prt)) {
                $this->id = 1;
                $minblog  = 99999;
                $maxblog  = min($minblog, count($xdbw));
            }
            $out .= '
    <br />
    <div class="w-100">';
            $out .= GetNavBar(($site['URLR'] == 'on' 
                ? $lng.'-'.$urlrw[1].'-44-'.$this->sel.'-'.$this->pg.'-'.$this->cat.'-'.$this->datej.'-'.$this->date.'-' 
                : 'blogsarch.php?lng='.$lng.'&amp;sel='.$this->sel.'&amp;pg='.$this->pg.'&amp;cat='.$this->cat.
                  '&amp;datej='.$this->datej.'&amp;date='.$this->date.'&amp;id='), 
                count($xdbw), $this->id, $minblog, $z2);
            $nbrnvisi = count($xdbw) > $site[31] ? $site[31] : count($xdbw);
            if (count($xdbw) == 0) {
                if ($this->sel == 'mois') $out .= '
      <p class="text-center font-weight-bold">'.$web[438].'</p>';
                else $out .= '
      <p class="text-center font-weight-bold">'.$web[439].($site[30] == '2'? '' : '<br />'.$web[440]).'</p>';
            } 
            else {
                for ($i = $minblog*($this->id-1); $i < $maxblog; $i++) {
                    ReadDoc($xdbw[$i][1], ARCHDBBASE);
                    $txt0 = $fileid;
                    if ($lng == $lang[0]) {
                        $txt1 = $fieldb1;
                        $txt2 = $fieldc1;
                    }
                    else {
                        $txt1 = $fieldb2;
                        $txt2 = $fieldc2;
                    }
                    if (!empty($txt2)) {
                        if (!empty($fieldd2)) $txt1 = '<img src="'.CHEMIN.'img/'.$fieldd2.'" class="float-right" alt="'.$fieldd2.'"/>'.$txt1;
                        $out .= '
      <div class="quest text-left">
        <a href="'.$site[3].($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[1].'-42-'.$fileid.$z2 
            : 'blogarch.php?lng='.$lng.'&amp;pg='.$fileid.$z2).'" title="'.$web[511].'">
          <b>'.$txt1.'</b>
        </a> &nbsp;';
                        if ($serviz[114] != 'on') {
                            if ($fieldd1 == 'on' && !empty($email) && !empty($author)) 
                                $out .= '- &nbsp;'.$web[6].displayWriteEmail('blog'.$i, $author, $email);
                            elseif (!empty($author)) $out .= '- &nbsp;'.$web[6].'
                <b>'.$author.'</b>';
                        }
                        $out .= '
      </div>
          ';
                        $txt3 = '
      <a id="billet'.$i.'"></a>
      <div id="blog3'.$i.'" class="rep blog3Blog">';
                        if (!empty($txt2)) {
                            $txt3 .= '
<style>
.txt2arch {
  height: '.($max_height > 0 ? $max_height.'px' : 'auto').';
  '.($max_height > 0 ? ' overflow: hidden;' : '').'
  padding: 4px;
}
</style>
        <div class="rep txt2arch">'.$txt2.'</div>';
                        if ($max_height > 0) $txt3 .= '
        <p class="text-right"> 
          <a href="javascript:ActiveMenu(\'blog3\',\'blog2\',0,'.$nbrnvisi.','.$i.')" class="box" title="'.$web[296].'">'.$web[296].' 
            <i class="far fa-plus-square"></i>
          </a>
        </p>';
                        $txt3 .= '
      </div>';
                        if ($max_height > 0) $txt3 .= '
      <div id="blog2'.$i.'" class="rep blog2Blog" style="display:none;">'.$txt2.'
        <p class="text-right c-pointer">
          <a href="#billet'.$i.'" title="'.$web[57].'" onclick="cache(\'blog2'.$i.'\');montre(\'blog3'.$i.'\')">
            '.$web[57].' <i class="far fa-minus-square"></i>
          </a>
        </p>
      </div>';
                        }
                        $out .= $txt3;
                        $out .= '
      <div class="text-right align-middle headblogarch">
        <form 
          name="formblog'.$i.'" 
          action="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[1].'-70'.$z2 
            : 'blogarch.php?lng='.$lng.$z2).'" 
          method="post">
          <b>'.$web[394].'</b>'.FormatDate($creadate).'&nbsp;';
                        $out .= '
          <input type="hidden" name="pg" value="'.$fileid.'"/>
          <input type="hidden" name="cat" value="'.$this->cat.'"/>
          <input type="hidden" name="sel" value="'.$this->sel.'"/>';
                        if (empty($serviz[76])) $out .= '
          <a href="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[1].'-43-'.$fileid.'--1' 
              : 'blogarch.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;prt=-1').'" target="_blank">
            <i class="far fa-eye" title="'.$web[264].'"></i>
          </a>&nbsp;
          <a href="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[1].'-43-'.$fileid.'-1' 
              : 'blogarch.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;prt=1').'" target="_blank">
            <i class="fas fa-print" title="'.$web[22].'"></i>
          </a>&nbsp;';
                        $out .= '
        </form>
      </div>';
                    }
                }
                $out .= GetNavBar(($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[1].'-44-'.$this->sel.'-'.$this->pg.'-'.$this->cat.'-'.$this->datej.'-'.$this->date.'-' 
                  : 'blogsarch.php?lng='.$lng.'&amp;sel='.$this->sel.'&amp;pg='.$this->pg.'&amp;cat='.$this->cat.
                    '&amp;datej='.$this->datej.'&amp;date='.$this->date.'&amp;id='), 
                  count($xdbw), $this->id, $minblog, $z2);
            }
                $out .= '
    </div>';
        }
        $this->topmess .= ' - '.$web[399].' - '.$titre;
        $this->txtart2  = $out;
        return true;
    }

    public function BLA_content() {
        global $lng, $lang, $drtuser, $page, $site, $serviz, $userprefs, $web, $urlrw, $z2, $prt;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $out = '';
        if (count(SelectDBFields(TYP_BLOG, 'a', $this->pg, DOCIDARCH)) == 1) {
            ReadDoc($this->pg, ARCHDBBASE);
            $countit = 1;
            if ($lng == $lang[0]) {
                $txtart1 = $fieldb1;
                $txtprt  = strip_tags($fieldb1);
                $txtart2 = $fieldc1;
                $txtart3 = $fielda1;
            }
            else {
                $txtart1 = $fieldb2;
                $txtprt  = strip_tags($fieldb2);
                $txtart2 = $fieldc2;
                $txtart3 = $fielda2;
            }
            $txtart4 = FormatDate($moddate);
            $txtart5 = FormatDate($creadate);
            $txtart6 = $author;
            $txtart7 = $fieldd1 != 'on' ? $email : '';
            $txtart8 = $fieldd2;
        }
        else {
            $countit = 0;
            $txtart1 = $web[35];
            $txtart2 = $web[36];
            $txtart3 = $web[37];
            $txtart4 = $web[37];
            $txtart5 = $web[37];
            $txtart6 = '';
            $txtart7 = '';
            $txtart8 = '';
        }
        $out .= '
  <br />';
        if (!empty($txtart1)) {
            if (!empty($txtart8)) $txtart1 = '<img src="'.CHEMIN.'img/'.$txtart8.'" class="float-right" alt=""/>'.$txtart1;
            $out .= '
  <div class="text-left quest"><b>'.$txtart1.'</b> &nbsp;';
            if (!empty($txtart6)) $out .= '- &nbsp;'.$web[6].' <b>'.$txtart6.'</b>';
            $out .= '
  </div>
  <div class="bord bordTextArch">
    <div class="rep text-left textArchBlog">
          '.$txtart2.'
    </div><div class="clearfix"></div>
    <div class="float-left w-50 text-left align-middle pubArchBlog">
      <b>'.$web[394].'</b> '.$txtart5.'&nbsp;&nbsp;';
            if ($serviz[33] == 'on' && $countit == 1) {
                $artcounter = UpdateDocCounter($this->pg);
                $txtcount   = $artcounter <= 1 ? $web[188] : $web[189];
            }
            $out .= '
    </div>
    <div id="action" class="w-40 float-right text-right align-middle actionArchBlog">';
            if ($countit == 1) {
                $dbw = array();
                $dbw = SelectDBFields(TYP_BLOG, 'a', '', DOCIDARCH);
                @rsort($dbw);
                for ($i = 0; $i < count($dbw) ; $i++) {
                    if ($dbw[$i][1] == $this->pg){
                        $idb = floor(1+($i/$serviz[55]));
                        break;
                    }
                }
				if ($prt == 0) {
					$out .= '
      <a href="'.($site['URLR'] =='on' ? $lng.'-'.$urlrw[1].'-7'.$z2 : 'blogsarch.php?lng='.$lng.$z2).'">
        <i class="far fa-file-alt align-middle" title="'.$web[383].'"></i>
      </a>&nbsp;';
                    $out .= '
      <a href="'.($site['URLR'] =='on' 
          ? $lng.'-'.$urlrw[1].'-43-'.$this->pg.'--1' 
          : 'blogarch.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;prt=-1').'" target="_blank">
        <i class="far fa-eye align-middle" title="'.$web[264].'"></i>
      </a>&nbsp;
      <a href="'.($site['URLR'] =='on' 
          ? $lng.'-'.$urlrw[1].'-43-'.$this->pg.'-1' 
          : 'blogarch.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;prt=1').'" target="_blank">
        <i class="fas fa-print align-middle" title="'.$web[22].'"></i>
      </a>&nbsp;';
				}
			}
            $out .= '
    </div><div class="clearfix"></div>
  </div>';
        } 
        else $countit = 0;
        if ($serviz[57] != "" && $countit == 1 && 1 != abs($prt)) {
            $out .= '
    <input type="hidden" name="cat" value="'.$txtart3.'"/><br /><br />';
            $dbwork = array();
            if (!empty($this->react)) $dbwork[0] = $this->react;
            elseif (!empty($this->pg)) {
                $dbreaction = ReadDBFields(DBREBLOGARCH);
                for ($i = 0; $i < count($dbreaction); $i++) {
                    if ($dbreaction[$i][1] == $this->pg && isAccessGranted($dbreaction[$i][6])) 
                        $dbwork[] = $dbreaction[$i][0];
                }
            }
            @sort($dbwork);
            if (empty($this->id)) $this->id = 1;
            if (!empty($dbwork)) {
                $out .= '
  <div class="titrebox">'.$web[407].'</div>';
                if (3 == abs($prt)) {
                    $this->id   = 1;
                    $serviz[30] = 99999;
                }
                $out .= GetNavBar(($site['URLR'] == 'on' ? 
                    $lng.'-'.$urlrw[1].'-46-'.$this->pg.'-' : 
                    'blogarch.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;id='), 
                    count($dbwork), $this->id, $serviz[30], $z2);
                for ($i = $serviz[30]*($this->id-1); $i < Min($serviz[30]*$this->id, count($dbwork)); $i++) {
                    ReadDoc($dbwork[$i], ARCHDBBASE);
                    if ($status == 'a') {
                        $out .= '
  <div class="bord text-left boxreBlog">
    <p class="boxreBlog2"><b>'.$web[185].$fielda1.'</b>&nbsp; - &nbsp;'.$web[6].' ';
                        if ($fieldd1 == 'on') $out .= '<b>'.$author.'</b> ';
                        $out .= $web[7].' '.FormatDate($creadate).'
    </p>
    <div class="rep">';
                        $out .= '
                  '.$fieldc1.'
    </div>
  </div>';
                    }
                }
                $out .= GetNavBar(($site['URLR'] == 'on' ? 
                    $lng.'-'.$urlrw[1].'-46-'.$this->pg.'-' : 
                    'blogarch.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;id='), 
                    count($dbwork), $this->id, $serviz[30], $z2);
            }
        }
        $this->topmess .= ' - '.$web[399].(!empty($txtprt) ? ' - '.$txtart3 : '');
        $this->txtart2  = $out;
        return true;
    }
    
    public function BSS_content() {
        global $lng, $lang, $serviz, $nom, $web, $page, $prt, $charset;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $max_height    = isset($serviz[133]) && $serviz[133] > 0 ? $serviz[133] : 0;
        ReadDoc($this->id);
        if ($lng == $lang[0]) {
            $rssurl = $fieldb1;
            $rsstxt = $fielda1;
        }
        else {
            $rssurl = $fieldb2;
            $rsstxt = $fielda2;
        }
        $topmess       = getLabel($nom[$lng == $lang[0] ? 42 : 43]).' - '.$web[402].' - '.$rsstxt;
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fas fa-blog float-right pr-2"></i>'.$topmess;
        if (abs($prt) != 1) $out .= $this->topblog();
        $out .= '
<div class="table-responsive-md">
<div class="d-table w-100">
  <div class="d-table-row">
    <div class="d-table-cell w-100 align-top itemRssBlog">';
        include_once 'inc/lastRSS.inc';
        $rss             = new lastRSS;
        $rss->cache_dir  = substr(CACHEREP, 0, strlen(CACHEREP)-1);
        $rss->cache_time = $serviz[39];
        $rs              = $rss->Get($rssurl);
        if (FALSE !== $rs) {
            $cpin  = strtoupper($rs['encoding']);
            $cpout = strtoupper($charset);
            if ($cpin == $cpout) {
                function MyIConv($txt) { return $txt; }
            } else {
                function MyIConv($txt) {
                    global $cpin, $cpout;
                    return iconv($cpin, $cpout, $txt);
                }
            }
            if (isset($rs['image_url']) && $rs['image_url'] != '') $out .= '
      <div class="text-center"><img src="'.$rs['image_url'].'" alt="" title="" /></div>';
            $out .= '
      <p class="forum">
        <a href="'.$rs['link'].'" target="_blank"><b>'.MyIConv($rs['title']).'</b></a>
      </p>
      <br />
      <p><b>'.html_entity_decode(MyIConv($rs['description']), ENT_QUOTES, $charset).'</b></p>
      <hr class="width12" />';
            foreach($rs['items'] as $item) {
                if ($item['title'] == '' && $item['link'] == '') $txt = '';
                elseif ($item['title'] == '') $txt = '
      <a href="'.$item['link'].'" target="_blank" title="">'.$item['link'].'</a>
      <br /><br />';
                elseif ($item['link'] == "") $txt = '
      <u>'.MyIConv($item['title']).'</u>
      <br /><br />';
                else $txt = '
      <a href="'.$item['link'].'" target="_blank" title="'.$web[296].'">'.MyIConv($item['title']).'"</a>
      <br /><br />';
                $desc = html_entity_decode(MyIConv($item['description']), ENT_QUOTES, $charset);
                $txt1 = '
      <b>
'.$txt.'
      </b>'.$desc;
                if (!empty($desc)) {
                    $out .= '
<style>
.text1RssBlog {
  height: '.($max_height > 0 ? $max_height.'px;' : 'auto;').'
  overflow: '.($max_height > 0 ? 'hidden;' : 'visible;').'
}
</style>
      <div id="texte2'.$i.'" class="rep text2RssBlog">
        <div class="rep text1RssBlog">
          '.$txt1.'
        </div>';
                    if ($max_height > 0) $out .= '
        <p class="text-right">
          <a href="javascript:cache(\'texte2'.$i.'\');montre(\'texte1'.$i.'\');" class="box" title="'.$web[296].'">
            '.$web[296].' <i class="far fa-plus-square"></i>
          </a>
        </p>';
                $out .= '
      </div>';
                    if ($max_height > 0) $out .= '
      <div id="texte1'.$i.'" class="bord textRssBlog text-left" style="display: none;">'.$txt1.'
        <p class="text-right c-pointer">
          <a href="#billet'.$pos.$i.'" title="'.$web[57].'" onclick="cache(\'texte1'.$i.'\');montre(\'texte2'.$i.'\')">
	        '.$web[57].' <i class="far fa-minus-square"></i>
          </a>
        </p>
      </div>';
                }
                if ($item['pubDate'] != '') $out .= '
      <span class="pubdateRss">('.FormatDate($item['pubDate']).')</span>';
                $out .= '
      <hr />';
                $i++;
            }
            $modfl = @filemtime(CACHEREP.'rsscache_'.md5($rssurl));
            if ($modfl == false) $txt = $web[261];
            else $txt = $web[263].' <b>'.FormatDateStamp($modfl).'</b>';
            $out .= '
      <p>'.$txt.'</p>';
        }
        else $out .= '
      <p>'.$web[262].' '.$rssurl.'</p>';
        $out .= '
    </div>
  </div>
</div>
</div>';
        return array($this->typ, $out);
    }
}
?>
blogcal.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/blogcal.php'
View Content
<?php
/*******************************************************************************
 *   Integrated calendar
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2022 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.10 (September 22, 2022) : update bootstrap, font-awesome
 ******************************************************************************/

header('Pragma: no-cache');
define('CHEMIN', '../');
define('NO_CRYPT', true);
include CHEMIN.'inc/includes.inc';
$annee   = htmlentities(import('annee'), ENT_QUOTES, $charset);
$annee   = empty($annee) ? date('Y') : $annee;
$mois    = htmlentities(import('mois'), ENT_QUOTES, $charset);
$mois    = empty($mois) ? date('m') : $mois;
$tconfig = import('tconfig', '', true, 0);
$pos     = htmlentities(import('pos', '', true, 'L'), ENT_QUOTES, $charset);
$nbox    = import('nbox');

echo '<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Blog Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />
<meta name="Robots" content="None" />';

if (file_exists($meskin."style.css")) echo '
<link type="text/css" rel="stylesheet" href="'.$meskin.'style.css">';
else echo '
<link type="text/css" rel="stylesheet" href="no_skin/style.css">';
if (file_exists($meskin."styleplus.css")) echo '
<link type="text/css" rel="stylesheet" href="'.$meskin.'styleplus.css">';

echo '
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" 
  integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/css/bootstrap.min.css" 
  integrity="sha512-rt/SrQ4UNIaGfDyEXZtNcyWvQeOq0QLygHluFQcSjaGB04IxWhal71tKuzP6K8eYXYB6vJV4pHkXcmFGGQ1/0w==" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" 
  integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/js/bootstrap.bundle.min.js" 
	integrity="sha512-igl8WEUuas9k5dtnhKqyyld6TzzRjvMqLC79jkgT3z02FvJyHAuUtyemm/P/jYSne1xwFI06ezQxEwweaiV7VA==" crossorigin="anonymous">
</script>
';

echo '
</head>
<body class="bg-inherit" onload="parent.adjustMyFrameHeight'.$nbox.$pos.$tconfig.'();">';

include_once CHEMIN.'inc/lang/'.$lng.'-special.inc';
$sel    = import('sel');
$datej  = import('datej');
$jour        = date('d');
$joursmois   = date('t',mktime(0,0,0,intval($mois),1,intval($annee)));
$premierjour = date('w',mktime(0,0,0,intval($mois),1,intval($annee)));
$mois        = date('m',mktime(0,0,0,intval($mois),1,intval($annee)));
$annee       = date('Y',mktime(0,0,0,intval($mois),1,intval($annee)));
$jourj       = date('d',mktime(0,0,0,intval($mois),intval($jour),intval($annee)));
$moism       = date('m');
$anneea      = date('Y');
if ($premierjour == 0) $premierjour = 7;
$semainepays = $web[153];
$joursemaine = $semainepays == 0 ?
    array(1 => $web[147], $web[148], $web[149], $web[150], $web[151], $web[152], $web[146]) :
    array(1 => $web[146], $web[147], $web[148], $web[149], $web[150], $web[151], $web[152]);
$moispays = array(1 => $web[268], $web[269], $web[270], $web[271], $web[272], $web[273], $web[274], $web[275], $web[276], $web[277], $web[278], $web[279]);
$nommois  = $moispays[$mois*$mois/$mois];
$adate    = getdate(time());
$mois_ci  = $adate['mon'];
$ann_ci   = $adate['year'];
if ($mois == 1) {
    $mois_p = 12;
    $ann_p  = $annee - 1;
    $mois_ci = $mois_p;
    $ann_ci  = $ann_p;
}
else {
    $mois_p = $mois - 1;
    $ann_p  = $annee;
    $mois_ci = $mois_p;
    $ann_ci  = $ann_p;
}
if ($mois == 12) {
    $mois_s = 1;
    $ann_s  = $annee + 1;
    $mois_ci = $mois_s;
    $ann_ci  = $ann_s;
}
else {
    $mois_s = $mois + 1;
    $ann_s  = $annee;
    $mois_ci = $mois_s;
    $ann_ci  = $ann_s;
}
$mois_ci = sprintf('%02d', $mois_ci);
$mois_p  = sprintf('%02d', $mois_p);
$mois_s  = sprintf('%02d', $mois_s);
$nbjours = date('d',mktime(0,0,0,intval($mois_s),0,intval($annee)));
$l       = ($lng == $lang[0]) ? 0 : 1;
$asite19 = explode('|', $site[19]);
if (!function_exists('MyMonth')) {
    function MyMonth($month, $year, $separator = '-') {
        global $site;
        if ((@$asite19[$l] == 'E1') || (@$asite19[$l] == 'E2')) {
            return $month . $separator . $year;
        } else {
            return $year . $separator . $month;
        }
    }
}
$dat_max = date('Y').date('m');
$dbwork  = ReadDBFields(DBBLOG);
$dat_min = count($dbwork) == 0 ? $dat_max : substr($dbwork[0][5], 0, 6);
$dat_p   = $ann_p.$mois_p;
$dat_s   = $ann_s.$mois_s;
$out     = '';
$tdleft  = '';
if ($dat_p >= $dat_min) $tdleft = '
    <a class="btn btn-md" href="'.($site['URLR'] =='on' 
        ? $lng.'-'.$urlrw[1].'-510-'.$ann_p.'-'.$mois_p 
        : 'blogcal.php?lng='.$lng.'&amp;annee='.$ann_p.'&amp;mois='.$mois_p).'" title="'.MyMonth($mois_p, $ann_p).'">
      <i class="fas fa-caret-left"></i>
    </a>';
$tdright = '';
if ($dat_s <= $dat_max) $tdright = '
    <a class="btn btn-md" href="'.($site['URLR'] =='on' 
        ? $lng.'-'.$urlrw[1].'-510-'.$ann_s.'-'.$mois_s 
        : 'blogcal.php?lng='.$lng.'&amp;annee='.$ann_s.'&amp;mois='.$mois_s).'" title="'.MyMonth($mois_s, $ann_s).'">
      <i class="fas fa-caret-right"></i>
    </a>';
echo '
  <div class="table-responsive-md">
  <table class="cal text-center m-auto">
    <tr class="cal">
      <td class="cal3BlogW pt-2">'.$tdleft.'</td>
      <td colspan="5" class="text-center cal3BlogW pt-2">
        <strong>
          <a class="calagd" href="'.CHEMIN.($site['URLR'] =='on' 
              ? $lng.'-'.$urlrw[1].'-5-mois-'.$ann_ci.$mois 
              : $site['BLS'].'.php?lng='.$lng.'&amp;sel=mois&amp;date='.$annee.$mois).$z2.'" title="'.MyMonth($mois, $ann_ci).'">
            '.$nommois.' '.$annee.'
          </a>
        </strong>
      </td>
      <td class="cal3BlogW pt-2">'.$tdright.'</td>
    </tr>
    <tr class="cal">
      <td colspan="7" class="cal calBlogW">
	    <form name="selmois" method="POST" 
            action="'.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[1].'-510-'.$annee.'-'.$mois 
              : 'blogcal.php?lng='.$lng.'&amp;date='.$annee.$mois).'">
	      <div class="float-left">
	        <select class="form-control cal selMonthCal" name="mois" onchange="this.form.submit();">';
foreach($moispays as $key=>$mnth)
    echo '
	          <option value="'.$key.'"'.Selected($key == $mois).'>'.$mnth.'</option>';
echo '
		    </select>
		  </div>
	      <div class="float-right">
	        <select class="form-control cal selYearCal" name="annee" onchange="this.form.submit();">';
$dbannee = array();
$datesin = array();
foreach ($dbwork as $work) {
    $dbannee[] = substr($work[5], 0, 4);
    $datesin[] = substr($work[5], 0, 6);
}
$dbannee[] = date('Y');
$dbannee   = array_unique($dbannee);
$datesin[] = date('Y').date('m');
$datesin   = array_unique($datesin);
foreach($dbannee as $an)
    echo '
	          <option value="'.$an.'"'.Selected($an == $annee).'>'.$an.'</option>';
    echo '
		    </select>
		  </div>
        </form>
	  </td>
    </tr>
    <tr>';
for ($nbrejours = 1; $nbrejours < 8; $nbrejours++) {
    echo '
      <td class="cals text-center pb-2"><strong>'.$joursemaine[$nbrejours].'</strong></td>';
}
echo '
    </tr>
    <tr>';
$max = (($joursmois + $premierjour + $semainepays - 1) % 7) == 0 ?
    7 * floor(($joursmois + $premierjour + $semainepays) / 7) :
    7 * ceil(($joursmois + $premierjour + $semainepays) / 7);
for ($i = 1; $i <= $max; $i++) {
    $a = $jour = $i - $premierjour + 1 - $semainepays;
    if ($i < $premierjour || $jour > $joursmois || $a == '') {
        if  (!($premierjour == 7 && $semainepays == 1)) echo '
      <td class="cal0 cal0BlogW">&nbsp;</td>';
    }
    elseif ($jour > $nbjours) {
        echo '
      <td class="cal0 cal0BlogW">&nbsp;</td>';
    }
    else {
        $a    = sprintf('%02d', $a);
        $jour = sprintf('%02d', $jour);
        if (cal_ferie($jour, $mois, $annee)) {
            $textecal = $a;
            $stylecal = ($a == $jourj && $mois == $moism && $annee == $anneea) ? 'cal2' : 'cal3';
        }
        else {
            $textecal = $a;
			if ($jourj == $a) {
                if (($i%7) == $semainepays) $stylecal = ($mois == $moism && $annee == $anneea ? 'cal4' : 'cal3');
                else $stylecal = ($mois == $moism && $annee == $anneea ? 'cal2' : 'cal1');
            }
            else $stylecal = (($i%7) == $semainepays ? 'cal3' : 'cal1');
        }
        $jok = FALSE;
        for ($k = 0; $k < count($dbwork); $k++) {
            $datebi = substr($dbwork[$k][5], 0, 8);
            if ($datebi == $annee.$mois.$a) {
                if (isAccessGranted($dbwork[$k][6]) && isAuthorizedPublication($dbwork[$k][5])){
                    $jok = TRUE;
                    $datej = $datebi;
                }
                break;
            }
        }
        if ($jok) echo '
      <td class="calevt cal0BlogW">
        <a href="'.CHEMIN.($site['URLR'] =='on' 
            ? $lng.'-'.$urlrw[1].'-6-jour-'.$datej 
            : $site['BLS'].'.php?lng='.$lng.'&amp;sel=jour&amp;datej='.$datej).$z2.'" title="'.substr(formatDate($datej), 0, 10).'">
          '.$textecal.'
        </a>
      </td>';
        else echo '
      <td class="'.$stylecal.' cal0BlogW">'.$textecal.'</td>';
    }
    if (($i%7) == 0 and $i != $max) echo '
    </tr>
    <tr>';
}
echo '
    </tr>
  </table>
  </div>
</body>
</html>';
?>
bpage.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/bpage.inc'
View Content
<?php
/*******************************************************************************
 *   Site Bottom & Right of Page
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.18 (February 11, 2024) : add Opcache code
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'bpage.inc')) {
    header('location:../index.php');
    die();
}
if (function_exists('opcache_get_configuration'))
{
	// Ces Lignes ne peuvent être mises qu'à la fin du script
	// Clear du cache et restore de opcache.enable
	if ($site[7] == 'on')
	{
		if (OPCACHEDISABLE == 1)
		{
			if (OPCACHEINISET == 1) // Gestion des options caches enable/disable
			{	
				{	
					if (ini_get('opcache') == 1) 
					{
						ini_set('opcache.enable', '0');
	//					echo ' OPcache désactivé fait<br />';
					}
					else
					 ini_restore('opcache.enable');
				}
			}
		}
		/*
		   Clear du cache disque géré par PHP
		*/
		clearstatcache();
		// Invalidation du fichier contenant les constantes
		if (function_exists('opcache_invalidate')) {
		  opcache_invalidate(CHEMIN.INCREP.'constantes.php', TRUE);
		}
	}
}
    $imgspe = $site[24] == 'N' ? '' : '
          <a href="https://www.freeguppy.org/" target="_blank" title="GuppY site">
            <i class="gen-gy'.$site[24].'logo"></i>
          </a>';
  
    $txtspeC = '
          <span>'.html_entity_decode('© '.MP_COPYRIGHT, ENT_COMPAT, $charset).' &nbsp;</span>';

    if ($lng == 'fr') {
        $txtspeL = '
          <a class="copyright" href="https://www.freeguppy.org/" title="freeguppy.org" target="_blank">
            '.($site[35] == 'T' ? 'Propulsé par GuppY' : '<i class="gen-gypower"></i>').'
          </a>';
        $txtspeR = '
          <a class="copyright" href="http://cecill.info/index.fr.html" title="En savoir plus ..." target="_blank">
            '.($site[35] == 'T' ? 'Sous Licence Libre CeCILL' : '<i class="gen-gycecill-f"></i>').'
          </a>
          &nbsp;';
    }
    else {
        $txtspeL = '
          <a class="copyright" href="https://www.freeguppy.org/" title="freeguppy.org" target="_blank">
            '.($site[35] == 'T' ? 'Powered by GuppY' : '<i class="gen-gypower"></i>').'
          </a>';
        $txtspeR = '
          <a class="copyright" href="http://cecill.info/index.en.html" title="More info ..." target="_blank">
            '.($site[35] == 'T' ? 'Under Free License CeCILL' : '<i class="gen-gycecill-e"></i>').'
          </a>
          &nbsp;';
    }

    $under_empty = array_reduce($xposbox[$tconfig][BOX_UNDER], 'EstNonVide', true);
    if (!$under_empty) {
        echo '
            <!-- Begin of UNDER BOXES -->
            <div id="UnderBoxes" class="row mx-0 px-0 '.BOX_UNDER.$tconfig.'">
              <div id="BoxesUnder" class="col-12 mx-0 px-0">';
        foreach ($xposbox[$tconfig][BOX_UNDER] as $item) {
            $item = ExecFunctionBox(BOX_UNDER, $item);
            if (FALSE !== $item) echo '
                <div class="row mx-0 px-0 '.BOX_UNDER.'row'.$tconfig.'">
                  <div class="col-12 mx-0 px-0">
                    '.$item.'
                  </div>
                </div>';
        }
        echo '
              </div>
            </div> <!-- End of UNDER BOXES -->
        ';
    }

    echo '
            </div>
          </div> <!-- fin des boîtes seules -->
        </section> <!-- End of CENTER BOXES -->
        ';

    $userprefs3  = (isForumPage() ? ($forum[3] == '' ? $forum[4] : BOX_LEFT.BOX_RIGHT) : $userprefs3);

    if ($serviz[74] == '' || strip_tags($_SERVER['SCRIPT_NAME']) != '/index.php') {
        if (is_file($meskin.'rightside.inc')) {
            include($meskin.'rightside.inc');
        } else {
            if ($widepage == '' && $userprefs3 != BOX_LEFT && !$right_empty) {
                echo '       
        <!-- Begin of RIGHT BOXES -->
        <aside id="'.(isBlogPage() ? 'Blog' : '').'RightBoxes" class="col-md-3 mx-0 pl-4 pr-0 a-col">
          <div id="'.(isBlogPage() ? 'Blog' : '').'BoxesRight"> <!-- hauteur des boîtes seules -->';

                foreach ($xposbox[$colconf][BOX_RIGHT] as $ii => $aa) {
                    if ($userprefs3 == BOX_RIGHT && $xposbox[$colconf][BOX_LEFT][$ii] != '') {
                        $item = ExecFunctionBox(BOX_RIGHT, $xposbox[$colconf][BOX_LEFT][$ii]);
                        if (FALSE !== $item) echo $item;
                    }
                    if ($userprefs3 != BOX_LEFT && $xposbox[$colconf][BOX_RIGHT][$ii] != '') {
                        $item =  ExecFunctionBox(BOX_RIGHT, $xposbox[$colconf][BOX_RIGHT][$ii]);
                        if (FALSE !== $item) echo $item;
                    }
                }
                
                echo '
          </div>
        </aside> <!-- End of RIGHT BOXES -->
        ';
            }
        }
    }
    if (empty($prt)) 
        echo '
        </div>
      </div>
    </div> <!-- .slide_inside -->	 
  </main> <!-- #slide2 -->  <!-- End of MAIN CONTENT -->';

    if (empty($prt)) {
        echo '
  <a id="z3"></a>
  <!-- Begin of TOTAL FOOTER -->
  <footer id="slide3">
    <div class="slide_inside">
      <!-- Begin of BOTTOM BOXES -->
      <div id="BottomBoxes" class="container-fluid mx-auto px-1">';

        foreach ($xposbox[$tconfig][BOX_BOTTOM][BOX_LEFT] as $i => $aa) {
            $item4 = @ExecFunctionBox(BOX_BOTTOM, $xposbox[$tconfig][BOX_BOTTOM][BOX_LSIDE][$i]);
            $item1 = @ExecFunctionBox(BOX_BOTTOM, $xposbox[$tconfig][BOX_BOTTOM][BOX_LEFT][$i]);
            $item2 = @ExecFunctionBox(BOX_BOTTOM, $xposbox[$tconfig][BOX_BOTTOM][BOX_CENTER][$i]);
            $item3 = @ExecFunctionBox(BOX_BOTTOM, $xposbox[$tconfig][BOX_BOTTOM][BOX_RIGHT][$i]);
            $item5 = @ExecFunctionBox(BOX_BOTTOM, $xposbox[$tconfig][BOX_BOTTOM][BOX_RSIDE][$i]);
            if ($item4 || $item1 || $item2 || $item3 || $item5) {
                $w3    = (int)$wposbox[$tconfig][BOX_BOTTOM][BOX_LSIDE][$i];
                $w0    = (int)$wposbox[$tconfig][BOX_BOTTOM][BOX_LEFT][$i];
                $w1    = (int)$wposbox[$tconfig][BOX_BOTTOM][BOX_CENTER][$i];
                $w2    = (int)$wposbox[$tconfig][BOX_BOTTOM][BOX_RIGHT][$i];
                $w4    = (int)$wposbox[$tconfig][BOX_BOTTOM][BOX_RSIDE][$i];
                $sfix  = BOX_BOTTOM.$tconfig.$i;
                $wcol3 = 'col-md-'.($item4 === false ?  '0' : $w3).' mx-0 px-'.($item4 === false ?  '0' : '2').' wcol3'.$sfix;
                $wcol0 = 'col-md-'.($item1 === false ?  '0' : $w0).' mx-0 px-'.($item1 === false ?  '0' : '2').' wcol0'.$sfix;
                $wcol1 = 'col-md-'.($item2 === false ?  '0' : $w1).' mx-0 px-'.($item2 === false ?  '0' : '2').' wcol1'.$sfix;
                $wcol2 = 'col-md-'.($item3 === false ?  '0' : $w2).' mx-0 px-'.($item3 === false ?  '0' : '2').' wcol2'.$sfix;
                $wcol4 = 'col-md-'.($item5 === false ?  '0' : $w4).' mx-0 px-'.($item5 === false ?  '0' : '2').' wcol4'.$sfix;
                echo '
            <style>#B'.$tconfig.'row'.$i.' { max-width: '.$titre[80].'; } </style>
            <div class="B'.$tconfig.'entrow'.$i.'">
              <div id="B'.$tconfig.'row'.$i.'" class="row mx-auto B'.$tconfig.'row'.$i.'">
                <div class="'.$wcol3.'">'.(FALSE !== $item4 ? $item4 : '').'</div>
                <div class="'.$wcol0.'">'.(FALSE !== $item1 ? $item1 : '').'</div>
                <div class="'.$wcol1.'">'.(FALSE !== $item2 ? $item2 : '').'</div>
                <div class="'.$wcol2.'">'.(FALSE !== $item3 ? $item3 : '').'</div>
                <div class="'.$wcol4.'">'.(FALSE !== $item5 ? $item5 : '').'</div>
              </div>
            </div>';
            }
        }

        echo '
        <a id="bottom"></a>
      </div> <!-- End of BOTTOM BOXES -->';
        echo '
    </div> <!--.slide_inside-->
  </footer> <!--#slide3--> <!-- End TOTAL FOOTER -->';
    }
	
    echo '
  <section id="footer" class="mx-auto"> <!-- begin of copyright/footer -->
    <div class="row mx-auto px-1">
      <div class="col-md-12 mx-auto px-0">';

    // php or html scripts located in directory inc/incfoot are automatically include at the bottom of the page
    if (is_dir(CHEMIN.'inc/incfoot')) { 
        $hd = opendir(CHEMIN.'inc/incfoot');
        while ($file = readdir($hd)) { 
            if (1 == preg_match('!^[^_].*(\.inc|\.inc\.php)$!', $file)) {
                include(CHEMIN.'inc/incfoot/'.$file);
            }
        }
    }
  
    // Haut
    if ($body[7] != 'on') echo '
      <div class="divtop">
        <a class="top font-weight-bold" href="#top">
          <b><span>&#xe808;</span> '.$web[136].' <span>&#xe808;</span></b>
        </a>
      </div>';

///////////////////////////////////////////////////////////////////////////////////
//                                                                               //
//                GuppY is protected by the CeCILL FREE LICENSE.                 //
//  REMOVING OR MODIFYING THE FOLLOWING COPYRIGHT NOTICE IS STRICTLY FORBIDDEN.  //
//                                                                               //
///////////////////////////////////////////////////////////////////////////////////

    echo '
    <div class="txtspeG">';
    if ($site[25] == 'T') {
        echo 
        $imgspe.($site[24] == 'N' ? '' : '<br />').$txtspeL.$txtspeC.$txtspeR;
    }
    elseif ($site[25] == 'L') {
        echo 
        $imgspe.$txtspeL.$txtspeC.$txtspeR;
    }
    elseif ($site[25] == 'R') {
        echo 
        $txtspeL.$txtspeC.$txtspeR.$imgspe;
    }
    else {
        echo 
        $imgspe.$txtspeL.$txtspeC.$txtspeR.$imgspe;
    }
    echo '
    </div>';
    if (!empty($skinCopyright)) {
        echo '
    <div id="skinCopyright">
      '.html_entity_decode($skinCopyright, ENT_QUOTES, $charset).'
    </div>';
    }

///////////////////////////    END of COPYRIGHT NOTICE    /////////////////////////

    if ($page[8] == 'on') {
        $timer = StopTimer();
        echo '
        <div class="timer">
          '.$web[116].' '.$timer.' '.($timer <= 1 ? $web[117] : $web[118]).'
        </div>';
    }
    echo '
      </div>
    </div>
  </section> <!-- end copyright/footer -->';

    echo '
</body>
</html>';
    if ($obgo) { ob_end_flush(); }
?>
calendar.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/calendar.php'
View Content
<?php
/*******************************************************************************
 *   Integrated calendar
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2022 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.10 (September 22, 2022) : update font-awesome, bootstrap
 ******************************************************************************/

header('Pragma: no-cache');
define('CHEMIN', '../');
define('NO_CRYPT', true);
include CHEMIN.'inc/includes.inc';
include CHEMIN.'inc/lang/'.$lng.'-special.inc';

$annee   = htmlentities(import('annee'), ENT_QUOTES, $charset);
$mois    = htmlentities(import('mois'), ENT_QUOTES, $charset);
$tconfig = $serviz[171] == 'ALL' ? import('tconfig', '', true, 0) : $serviz[171];
$pos     = htmlentities(import('pos', '', true, 'L'), ENT_QUOTES, $charset);
$nbox    = import('nbox');

echo '<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />
<meta name="Robots" content="None" />';

if (file_exists($meskin."style.css")) echo '
<link rel="stylesheet" href="'.$meskin.'style.css">';
else echo '
<link rel="stylesheet" href="no_skin/style.css">';
if (file_exists($meskin."styleplus.css")) echo '
<link rel="stylesheet" href="'.$meskin.'styleplus.css">';

echo '
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" 
  integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/css/bootstrap.min.css" 
  integrity="sha512-rt/SrQ4UNIaGfDyEXZtNcyWvQeOq0QLygHluFQcSjaGB04IxWhal71tKuzP6K8eYXYB6vJV4pHkXcmFGGQ1/0w==" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" 
  integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/js/bootstrap.bundle.min.js" 
  integrity="sha512-igl8WEUuas9k5dtnhKqyyld6TzzRjvMqLC79jkgT3z02FvJyHAuUtyemm/P/jYSne1xwFI06ezQxEwweaiV7VA==" crossorigin="anonymous">
</script>
';

echo '
</head>
<body class="bg-inherit" onload="parent.adjustMyFrameHeight'.$nbox.$pos.$tconfig.'();">';

$l = $lng == $lang[0] ? 0 : 1;
$asite19 = explode('|', $site[19]);

if (empty($annee)) $annee = date('Y');
if (empty($mois))  $mois = date('m');
$jour           = date('d');
$joursmois      = date('t', mktime(0, 0, 0, (int)$mois, 1, (int)$annee));
$premierjour    = date('w', mktime(0, 0, 0, (int)$mois, 1, (int)$annee));
$mois           = date('m', mktime(0, 0, 0, (int)$mois, 1, (int)$annee));
$annee          = date('Y', mktime(0, 0, 0, (int)$mois, 1, (int)$annee));
$jourj          = date('d', mktime(0, 0, 0, (int)$mois, (int)$jour, (int)$annee));
if ($premierjour == 0) {
    $premierjour = 7;
}
$semainepays = $web[153];
if ($semainepays == 0) {
    $joursemaine = array(1 => $web[147], $web[148], $web[149], $web[150], $web[151], $web[152], $web[146]);
}
else {
    $joursemaine = array(1 => $web[146], $web[147], $web[148], $web[149], $web[150], $web[151], $web[152]);
}
$moispays = array(1 => $web[268], $web[269], $web[270], $web[271], $web[272], $web[273], $web[274], $web[275], $web[276], $web[277], $web[278], $web[279]);
$nommois = $moispays[$mois*$mois/$mois];
$date = getdate(time());
$mois_ci = $date['mon'];
if ($mois_ci < 10) {
    $mois_ci = '0'.$mois_ci;
}
$ann_ci = $date['year'];
if ($mois == 1) {
    $mois_p = 12;
    $ann_p = $annee - 1;
}
else {
    $mois_p = $mois - 1;
    $ann_p = $annee;
}
if ($mois_p <10) {
    $mois_p = '0'.$mois_p;
}
if ($mois == 12) {
    $mois_s = 1; $ann_s = $annee + 1;
}
else {
    $mois_s = $mois + 1;
    $ann_s = $annee;
}
if ($mois_s <10) {
    $mois_s = '0'.$mois_s;
}
$dbwork = ReadDBFields(DBAGENDA);
$dbannee = array();
$dbworkag = array();
foreach($dbwork as $dbw) {
	$an = substr($dbw[2], -4);
	$mt = substr($dbw[2], 0, 2);
	if ($an == $annee && $mt == $mois) $dbworkag[] = $dbw;
	if (!in_array($an, $dbannee)) $dbannee[] = $an;
}
$an = date('Y');
if (!in_array($an, $dbannee)) $dbannee[] = $an;
sort($dbannee);
$nbjours = date('d',mktime(0, 0, 0,(int)$mois_s, 0, (int)$annee));
$idpg = '';
echo '
<div class="table-responsive-md">
<table class="table table-borderless cal TCAL'.$pos.$tconfig.' text-center m-auto w-100">';

if (($asite19[$l] == 'E1') || ($asite19[$l] == 'E2')) {
	echo '
  <tr class="cal TCAL'.$pos.$tconfig.'">
    <td class="leftNavCalW">';
	if ($dbannee[0] <= $ann_p) { echo '
      <a class="btn btn-md" href="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[17].'-2-'.$mois_p.'-'.$ann_p 
          : 'calendar.php?lng='.$lng.'&amp;mois='.$mois_p.'&amp;annee='.$ann_p).'" title="'.$mois_p.'-'.$ann_p.'">
        <i class="fas fa-caret-left"></i>
      </a>';
	}
	echo '
    </td>
    <td colspan="5" class="midNavCalW">
      <a class="calagd" 
         href="'.CHEMIN.($site['URLR'] == 'on'         
          ? $lng.'-'.$urlrw[17].'-21-'.$mois.'-'.$annee.'-2-'.$tconfig 
          : 'agenda.php?lng='.$lng.'&amp;mois='.$mois.'&amp;an='.$annee.'&amp;agv=2&amp;tconfig='.$tconfig).$z2.'" target="_parent" title="'.$web[287].' '.$mois.'-'.$annee.'">
        <b>'.$nommois.' '.$annee.'</b>
      </a>
	</td>
    <td class="rightNavCalW">';
	if ($dbannee[count($dbannee)-1] >= $ann_s) {
		echo '
      <a class="btn btn-md" 
         href="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[17].'-2-'.$mois_s.'-'.$ann_s 
          : 'calendar.php?lng='.$lng.'&amp;mois='.$mois_s.'&amp;annee='.$ann_s).'" title="'.$mois_s.'-'.$ann_s.'">
        <i class="fas fa-caret-right"></i>
      </a>';
	}
	echo '
    </td>
  </tr>
  <tr class="cal calsel TCAL'.$pos.$tconfig.'">
    <td colspan="7" class="cal TCAL'.$pos.$tconfig.' mnthyearCalW">
	  <form name="selmois" method="POST" 
        action="'.($site['URLR'] == 'on' ? 
          $lng.'-'.$urlrw[17].'-1-'.$mois.'-'.$annee.'-'.$pos.'-'.$tconfig 
          : 'calendar.php?lng='.$lng.'&amp;mois='.$mois.'&amp;annee='.$annee.'&amp;pos='.$pos.'&amp;tconfig='.$tconfig).'"
      >
	    <div class="float-left">
	      <select class="form-control cal selMonthCal" name="mois" onchange="this.form.submit();">';
	foreach($moispays as $key=>$mnth)
		echo '
	        <option value="'.$key.'"'.Selected($key == $mois).'>'.$mnth.'</option>';
	echo '
		  </select>
		</div>
	    <div class="float-right">
	      <select class="form-control cal selYearCal" name="annee" onchange="this.form.submit();">';
	foreach($dbannee as $an)
		echo '
	        <option value="'.$an.'"'.Selected($an == $annee).'>'.$an.'</option>';
	echo '
		  </select>
		</div>
		<div class="clearfix"></div>
      </form>
	</td>
  </tr>
';
}
else {
    echo '
  <tr class="cal TCAL'.$pos.$tconfig.'">
    <td class="leftNavCalW">
      <a class="btn btn-md" href="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[17].'-2-'.$mois_p.'-'.$ann_p 
          : 'calendar.php?lng='.$lng.'&amp;mois='.$mois_p.'&amp;annee='.$ann_p).'" title="'.$ann_p.'-'.$mois_p.'">
        <i class="fas fa-caret-left"></i>
      </a>
    </td>
    <td colspan="5" class="midNavCalW">
      <a href="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[17].'-21-'.$mois.'-'.$annee.'-2-'.$tconfig 
          : 'agenda.php?lng='.$lng.'&amp;mois='.$mois.'&amp;an='.$annee.'&amp;agv=2&amp;tconfig='.$tconfig).$z2.'" target="_parent" title="'.$web[287].' '.$annee.'-'.$mois.'">
        '.$annee.' '.$nommois.'
      </a>
    </td>
    <td class="rightNavCalW">;
      <a class="btn btn-md" href="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[17].'-2-'.$mois_s.'-'.$ann_s 
          : 'calendar.php?lng='.$lng.'&amp;mois='.$mois_s.'&amp;annee='.$ann_s).'" title="'.$ann_s.'-'.$mois_s.'">
        <i class="fas fa-caret-right"></i>
      </a>
    </td>
  </tr>
  <tr class="cal calsel TCAL'.$pos.$tconfig.'">
    <td colspan="7" class="cal TCAL'.$pos.$tconfig.' mnthyearCalW">
	  <form name="selan" method="POST" 
        action="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[17].'-1-'.$mois.'-'.$annee.'-'.$pos.'-'.$tconfig 
          : 'calendar.php?lng='.$lng.'&amp;mois='.$mois.'&amp;annee='.$annee.'&amp;pos='.$pos.'&amp;tconfig='.$tconfig).'">
	    <div class="float-left">
	      <select class="form-control cal selYearCal" name="annee" onchange="this.form.submit();">';
	foreach($dbannee as $an)
		echo '
	        <option value="'.$an.'"'.Selected($an == $annee).'>'.$an.'</option>';
	echo '
		  </select>
		</div>
	    <div class="float-right">
	      <select class="form-control cal selMonthCal" name="mois" onchange="this.form.submit();">';
	foreach($moispays as $key=>$mnth)
		echo '
	        <option value="'.$key.'"'.Selected($key == $mois).'>'.$mnth.'</option>';
	echo '
		  </select>
		</div>
		<div class="clearfix"></div>
      </form>
    </td>
  </tr>';
}
echo '
  <tr class="cal TCAL'.$pos.$tconfig.'">';
for ($nbrejours = 1; $nbrejours < 8; $nbrejours++) {
    echo '
    <td class="cals"><strong>'.$joursemaine[$nbrejours].'</strong></td>';
}
echo '
  </tr>
  <tr class="cal TCAL'.$pos.$tconfig.'">';
if ((($joursmois + $premierjour + $semainepays - 1) % 7) == 0 )
    $max = 7*floor(($joursmois + $premierjour + $semainepays)/7);
else
    $max = 7*ceil(($joursmois + $premierjour + $semainepays)/7);
for ($i = 1; $i <= $max; $i++) {
    $a = $i - $premierjour + 1 - $semainepays;
    $jour = $i - $premierjour + 1 - $semainepays;
    if (strlen($a) == 0) {
        $a = $a;
    }
    if ($i < $premierjour || $jour > $joursmois || $a == '') {
        if  (!($premierjour == 7 && $semainepays == 1)) {
            $textecal = '&nbsp;';
            echo '
    <td class="cal0 cellCalW cell'.$annee.$mois.$jour.'">'.$textecal.'</td>';   // jours vides
        }
    }
    elseif ($jour > $nbjours) {
        $textecal = '&nbsp;';
        echo '
    <td class="cal0 cellCalW cell'.$annee.$mois.$jour.'">'.$textecal.'</td>';   // jours vides
    }
    else {
        if ($a <10) {
            $a = '0'.$a;
        }
        if ($jour <10) {
            $jour = '0'.$jour;
        }
        if (cal_ferie($jour, $mois, $annee)) {
            $textecal = $a;
            if (($mois == $mois_ci) && ($jourj == $a))
                $stylecal = 'cal4';
            else
                $stylecal = 'cal3';
        }
        else {
            $textecal = $a;
            if (($jourj == $a)) {
                if (($i%7) == $semainepays) {
                    if ($mois == $mois_ci) {
                        $stylecal = 'cal4';
                    }
                    else {
                        $stylecal = 'cal3';
                    }
                }
                else {
                if ($mois == $mois_ci && $annee == $ann_ci) {
                    $stylecal = 'cal2';
                }
                else {
                    $stylecal = 'cal1';
                }
                }
            }
            else {
                if (($i%7) == $semainepays) {
                    $stylecal = 'cal3';
                }
                else {
                    $stylecal = 'cal1';
                }
            }
        }
        $jagok = FALSE;
        $pgtab = array($jour => '');
        $breve = array($jour => '');
        foreach ($dbworkag as $dbw) {
			$pgag = $dbw[4];
			ReadDoc($pgag);
            if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) continue;
            if (substr($dbw[0], 0, 8) == $annee.$mois.$a) {
                $jagok = TRUE;
                $pgtab[$jour] .= $dbw[4].'-';
                $breve[$jour] .= trim(CutLongWord(strip_tags($lng == $lang[0] ? $fieldc1 : $fieldc2), 36)).'... ';
            }
        }
        if ($jagok) {
            if ($pgtab[$jour] == '') $pgtab[$jour] = $pgag.'-';
            echo '
    <td class="calevt cellCalW cell'.$annee.$mois.$jour.'">
      <span class="calevt">
        <a href="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[17].'-22-'.$pgtab[$jour].'-'.$pgag.'-1-'.$tconfig 
          : 'agenda.php?lng='.$lng.'&amp;idpg='.$pgtab[$jour].'&amp;pg='.$pgag.'&amp;agv=1&amp;tconfig='.$tconfig).$z2.'" 
          target="_parent" title="'.$breve[$jour].'">
          '.$textecal.'
        </a>
      </span>
    </td>';
        } else {
            echo '
    <td class="'.$stylecal.' cellCalW cell'.$annee.$mois.$jour.'">'.$textecal.'</td>';
        }
    }
    if (($i%7) == 0 and $i != $max) {
        echo '
  </tr>
  <tr>';
    }
}
echo '
  </tr>
</table>
</div>
</body>
</html>';
?>
constantes.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/constantes.php'
View Content
<?php
/*******************************************************************************
 *   Constantes
 *******************************************************************************
 *   GuppY PHP Script - version 6
 *   CeCILL Copyright (C) 2004-2024 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 *  v6.00.20 (November 12, 2024) : update version,date and add variables names
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'constantes.php')) {
    header('location:../index.php');
    die();
}

if (!defined('CHEMIN')) { 
    define('CHEMIN', '');
}
define ('OPCACHEDISABLE', '1'); // 1 pour enable ne pas toucher
define ('OPCACHETEMPOSECONDE', '1'); // Temporisation cache en seconde
define ('OPCACHEINISET', '0'); // 0 pour  Disable, 1 pour Enable, pour desactiver le cache

define('MP_VERSION',      '6.00.20');
define('MP_DATE',         'November 12, 2024');
define('MP_COPYRIGHT',    '2004-2024');

$keyfile = CHEMIN.'data/config/securekey.dtb';
define('CRYPT_KEY',       is_file($keyfile) ? ReadFullDB($keyfile) : 'qO_83;pwY9');

define('CONNECTOR',       '||');
define('USER_COOKIE',     'GuppYUser6');
define('PREF_COOKIE',     'GuppYPref6');
define('ADMP_COOKIE',     'GuppYAdmPref6');
define('CTCT_COOKIE',     'GuppYContact6');
define('CNCT_COOKIE',     'GuppYConnect6');
define('POST_COOKIE',     'GuppYPost6');
define('COOKIE_COOKIE',   'GuppYCookie6');

define('TYP_AGENDA',      'ag');
define('TYP_ART',         'ar');
define('TYP_ARCH',        'arch');
define('TYP_BANNER',      'ba');
define('TYP_BRUB',        'br');
define('TYP_BLOG',        'bl');
define('TYP_BSS',         'bs');
define('TYP_THINK',       'ci');
define('TYP_DNLOAD',      'dn');
define('TYP_FAQ',         'fa');
define('TYP_FREEBOX',     'fb');
define('TYP_FORUM',       'fr');
define('TYP_THREAD',      'frth');
define('TYP_GUESTBK',     'gb');
define('TYP_LINKS',       'li');
define('TYP_MAIL',        'ma');
define('TYP_MENUBOX',     'mb');
define('TYP_DDMENUBOX',   'dm');
define('TYP_MENUICO',     'mi');
define('TYP_NEWS',        'ne');
define('TYP_NWL',         'nl');
define('TYP_OPTMENU',     'om');
define('TYP_OPTDDMENU',   'od');
define('TYP_PHOTO',       'ph');
define('TYP_REACT',       'ra');
define('TYP_REBLOG',      'rb');
define('TYP_RECO',        're');
define('TYP_RSS',         'rs');
define('TYP_RULES',       'ru');
define('TYP_SOCNET',      'sn');

define('DBEXT',           '.dtb');
define('INCEXT',          '.inc');

define('DATAREP',         'data/');
define('REDACREP',        'redac/');
define('INCREP',          'inc/');

define('RSSNEWS',         DATAREP.'%s-news.xml');
define('RSSART',          DATAREP.'%s-articles.xml');
define('RSSBLOG',         DATAREP.'%s-blog.xml');
define('RSSALL',          DATAREP.'%s-all.xml');

define('CACHEREP',        CHEMIN.DATAREP.'cache/');
define('CONFIGREP',       CHEMIN.DATAREP.'config/');
define('USERREP',         CHEMIN.DATAREP.'users/');
define('DOCSREP',         CHEMIN.DATAREP.'dbdocs/');
define('TEMPREP',         CHEMIN.DATAREP.'tmp/');
define('PHOTOREP',        CHEMIN.'photo/');
define('CRYPTREP',        CHEMIN.INCREP.'crypt/');
define('SAVEREP',         CHEMIN.'save/');
define('HLPREP',          CHEMIN.'articles.php?lng=');
define('REMOTEHLP',		  'https://ghc.freeguppy.org/articles.php?lng=');

define('CONFIG',          CONFIGREP.'config'.INCEXT);
define('MAPSURLS',        CONFIGREP.'mapsurls'.DBEXT);
define('DBPLUGIN',        CONFIGREP.'plugin'.DBEXT);
define('DBANTISPAM',      CONFIGREP.'antispam'.DBEXT);
define('ADMNOTES',        CONFIGREP.'admnotes.dtb');
define('DBRULES',         CONFIGREP.TYP_RULES.INCEXT);
define('CHECK_INSTALL',   CONFIGREP.'chk_install.dtb');
define('FRSIGNS_INI',     CONFIGREP.'frsigns.ini');
define('FRSIGNS_IMG',     CHEMIN.'img/frsigns/');
define('LICENCES',        CONFIGREP.'licences.dtb');

define('MSGREP',          USERREP.'msg/');
define('COUNTMSGREP',     USERREP.'counters/');
define('ADMINS',          USERREP.'admins'.DBEXT);
define('GROUPS',          USERREP.'groups'.DBEXT);
define('MEMBERS',         USERREP.'members'.DBEXT);
define('NEWSLET_LIST',    USERREP.'nwlist'.DBEXT);
define('NEWSLET_WAIT',    USERREP.'nwlist.tmp');
define('GROUPSNWL',       USERREP.'groupsnwl'.DBEXT);
define('MEMBERSNWL',      USERREP.'membersnwl'.DBEXT);
define('GROUPSCOL',       USERREP.'groupscol'.DBEXT);
define('MEMBERSCOL',      USERREP.'memberscol'.DBEXT);

define('ARCHREP',         DOCSREP.'archive/');
define('DBBASE',          DOCSREP.'docs/');
define('DBIPBASE',        DOCSREP.'ipdocs/');
define('DBCOUNT',         DOCSREP.'counters/');
define('DBINDEX',         DOCSREP.'index/');
define('NEXTID',          DOCSREP.'nextid'.DBEXT);
define('NEXTIDBK',        DOCSREP.'nextidbk'.DBEXT);
define('DOCID',           DOCSREP.'docid'.DBEXT);
define("DOCDATES",        DOCSREP."docdates".DBEXT);
define("CHILDREN",        DOCSREP."children".DBEXT);

define('SITEMAPS',        CHEMIN.'sitemaps.xml');
define('SM_BLOG',         CHEMIN.'smblog.xml');
define('SM_ART',          CHEMIN.'smart.xml');
define('SM_NEWS',         CHEMIN.'smnews.xml');
define('SM_PHOTO',        CHEMIN.'smphoto.xml');
define('SM_DNLOAD',       CHEMIN.'smdnload.xml');
define('SM_FAQ',          CHEMIN.'smfaq.xml');
define('SM_LINKS',        CHEMIN.'smlinks.xml');
define('SM_GUESTBK',      CHEMIN.'smguestbk.xml');
define('SM_FORUM',        CHEMIN.'smforum.xml');
define('SM_AGENDA',       CHEMIN.'smagenda.xml');
define('SM_URLS',         CHEMIN.'smurls.xml');

define('DBAGENDA',        DBINDEX.TYP_AGENDA.DBEXT);
define('DBART',           DBINDEX.TYP_ART.DBEXT);
define('DBBLOG',          DBINDEX.TYP_BLOG.DBEXT);
define('DBBRUB',          DBINDEX.TYP_BRUB.DBEXT);
define('DBNEWS',          DBINDEX.TYP_NEWS.DBEXT);
define('DBDNLOAD',        DBINDEX.TYP_DNLOAD.DBEXT);
define('DBFAQ',           DBINDEX.TYP_FAQ.DBEXT);
define('DBFORUMCAT',      DBINDEX.TYP_FORUM.'cat'.DBEXT);
define('DBFORUM',         DBINDEX.TYP_FORUM.DBEXT);
define('DBFORUMCOUNTER',  DBINDEX.TYP_FORUM.'count'.DBEXT);
define('DBTHREAD',        DBINDEX.TYP_THREAD.DBEXT);
define('DBLINKS',         DBINDEX.TYP_LINKS.DBEXT);
define('DBPHOTO',         DBINDEX.TYP_PHOTO.DBEXT);
define('DBREACT',         DBINDEX.TYP_REACT.DBEXT);
define('DBREBLOG',        DBINDEX.TYP_REBLOG.DBEXT);
define('DBRSS',           DBINDEX.TYP_RSS.DBEXT);
define('DBBSS',           DBINDEX.TYP_BSS.DBEXT);
define('DBFREEBOX',       DBINDEX.TYP_FREEBOX.DBEXT);
define('DBMENUBOX',       DBINDEX.TYP_MENUBOX.DBEXT);
define('DBOPTMENU',       DBINDEX.TYP_OPTMENU.DBEXT);
define('DBARTMENU',       DBINDEX.TYP_ART.TYP_OPTMENU.DBEXT);
define('DBDDMENUBOX',     DBINDEX.TYP_DDMENUBOX.DBEXT);
define('DBOPTDDMENU',     DBINDEX.TYP_OPTDDMENU.DBEXT);
define('DBMENUICO',       DBINDEX.TYP_MENUICO.DBEXT);
define('DBSOCNET',        DBINDEX.TYP_SOCNET.DBEXT);
define('DBKEYWORDS',      DBINDEX.'kw'.DBEXT);

define('ARCHDBBASE',      ARCHREP.'docs/');
define('ARCHDBIPBASE',    ARCHREP.'ipdocs/');
define('ARCHDBCOUNT',     ARCHREP.'counters/');
define('DOCIDARCH',       ARCHREP.'docid'.DBEXT);
define('DBAGENDAARCHDATE',ARCHREP.TYP_AGENDA.'arch'.DBEXT);
define('DBAGENDAARCH',    ARCHREP.TYP_AGENDA.DBEXT);
define('DBAGENDAARCHDATEEPUR',ARCHREP.TYP_AGENDA.'archepur'.DBEXT);
define('DBBLOGARCHDATE',  ARCHREP.TYP_BLOG.'arch'.DBEXT);
define('DBBLOGARCHDATEEPUR',ARCHREP.TYP_BLOG.'archepur'.DBEXT);
define('DBBLOGARCH',      ARCHREP.TYP_BLOG.DBEXT);
define('DBREBLOGARCH',    ARCHREP.TYP_REBLOG.DBEXT);
define('DBNEWSARCHDATE',  ARCHREP.TYP_NEWS.'arch'.DBEXT);
define('DBNEWSARCH',      ARCHREP.TYP_NEWS.DBEXT);
define('DBNEWSARCHDATEEPUR',  ARCHREP.TYP_NEWS.'archepur'.DBEXT);
define('DBFORUMARCHDATE', ARCHREP.TYP_FORUM.'arch'.DBEXT);
define('DBFORUMARCHDATEEPUR', ARCHREP.TYP_FORUM.'archepur'.DBEXT);
define('DBFORUMARCH',     ARCHREP.TYP_FORUM.DBEXT);
define('DBTHREADARCH',    ARCHREP.TYP_THREAD.DBEXT);

define('STATSREP',        CHEMIN.DATAREP.'stats/'); 

define('CURRSTATSREP',    STATSREP.'current/');
define('OLDSSTATSREP',    STATSREP.'olds/');
define('DBCOUNTER',       STATSREP.'counter'.DBEXT);
define('DBSTATS',         STATSREP.'stats'.DBEXT);
define('DBSTATSBK',       STATSREP.'statsbk'.DBEXT);
define('DBIPSTATS',       STATSREP.'ipstats'.DBEXT);
define('DBLOGDATE',       STATSREP.'log_date'.DBEXT);
define('DBLOGSTATS',      STATSREP.'log_stats'.DBEXT);
define('DBLOGBOOK',       STATSREP.'logbook'.DBEXT);
define('DBCOUNTERLOGBK',  STATSREP.'counterlogbook'.DBEXT);
define('DBLOGBOOKSPAM',   STATSREP.'logbookspam'.DBEXT);

define('DBLOGH',          CURRSTATSREP.'logh'.DBEXT);
define('DBLOGD',          CURRSTATSREP.'logd'.DBEXT);
define('DBLOGM',          CURRSTATSREP.'logm'.DBEXT);
define('DBLOGY',          CURRSTATSREP.'logy'.DBEXT);

define('AOF_TYPE',   0);
define('AOF_ID',     1);
define('AOF_STATUS', 2);

define('HIT_TIME',        1800);
define('POLL_TIME',       3600*24*7);
define('ANTISPAM_COUNT',  100);
define('ANTISPAM_DELAY',  30);
define('NB_NOTES',        100);
define('DBCHK_DEFAULT',   1000);
define('DBCHK_MAX',       5000);

define('BOX_TOP',     'T');
define('BOX_BOTTOM',  'B');
define('BOX_LEFT',    'L');
define('BOX_RIGHT',   'R');
define('BOX_SIDE',    'LR');
define('BOX_CENTER',  'C');
define('BOX_ABOVE',   'A');
define('BOX_UNDER',   'U');
define('BOX_EDITO',   'E');
define('BOX_BLOG',    'B');
define('BOX_LSIDE',   'LS');
define('BOX_RSIDE',   'RS');

define('STATS_NBPAGE',    20);
define('STATS_NBLANGUE',  2);
define('STATS_NBBROWSER', 31);
define('STATS_NBOS',      10);
define('STATS_NBHEURE',   24);
define('STATS_NBJOUR',    31);
define('STATS_NBMOIS',    12);
define('MOTSINTERDITS',  CONFIGREP.'motsinterdits.inc');
?>
download.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/download.inc'
View Content
<?php
/*******************************************************************************
 *   Download
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2022 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.10 (September 22, 2021) : update bootstrap, font-awesome
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'download.inc')) {
    header('location:../index.php');
    die();
}

class GY_download {
    public $tconfig;
    public $topmess;
    protected $pg;
    protected $id;
    protected $dirdnl;
    protected $delay;
    protected $li;
    protected $dn;
    
    public function __construct() {
        global $nom, $menuico, $page, $lang, $lng, $charset;
        $topmess = getLabel($nom[$lng == $lang[0] ? 1 : 11]);
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fas fa-download float-right align-middle"></i>'.$topmess;
        $this->tconfig = $menuico[15] == 'ALL' ? import('tconfig', '', true, 0) : $menuico[15];
        $this->pg      = import('pg');
        $this->id      = import('id');
        $this->dirdnl  = import('dirdnl');
        $this->delay   = import('delay');
        $li            = import('li');
        $this->li      = htmlentities($li, ENT_QUOTES, $charset);
        $this->dn      = import('dn', 'GET');
    }
    
    public function DWNL_ok($pseudo, $lg) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $out = '';
        if ($serviz[10] != 'on') {
            $out .= '
    <div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lg.'-'.$urlrw[0] : 'index.php?lng='.$lg);
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array('DWNL', $out);
        }
        elseif (!isAccessGranted($members[7])) {
            $out .= '
	<div class="web342 text-center">'.$web[342];
            if ($members[19] != '0' && $members[19] != '3') {
                $href1 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 
                  : 'connect.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2);
                $href2 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
                  : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$this->tconfig.$z2);
                $out .= '
      <p class="text-center">
        '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
          (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
      </p>';
            }
            $out .= '
	</div>';
            return array('DWNL', $out);
        }
        elseif (!empty($this->pg)) {
            $dbwork = SelectDbFieldsByField(ReadDBFields(DBDNLOAD), 4, $this->pg);
            $isdoc  = (count($dbwork) != 0);
            if ($isdoc) {
                $isdoc = isAuthorizedPublication($dbwork[0][5]);
                if (!isAccessGranted($dbwork[0][6])) return array('h0', '');
            }
            if (!$isdoc) {
                $dbwork = array();
                if ($site[10] != '') return array('h1', '');
                else return array('h2', '');
            }
        }
        return array('');
    }
    
    public function DWNL_content() {
        global $lang, $lng, $web, $serviz, $urlrw, $site, $prt, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $k      = ($lng == $lang[0])? 0 : 1;
        $out    = '';
        $categ  = '';
        $dbwork = array();
		$dirlnk = '';
        $an     = '';
        $dbwan  = array();
        $dbw50  = array();
        if (!empty($this->pg)) {
            $dbwork = SelectDbFieldsByField(ReadDBFields(DBDNLOAD), 4, $this->pg);
        } else {
            $dbwork2 = ReadDBFields(DBDNLOAD);
            $dbwork1 = array_filter($dbwork2, 'IsNotEmptyTitle');
            unset($dbwork2);
            $dbworkR = array_slice($dbwork1, -intval($serviz[150]));
            $categR  = sprintf($web[651], min(count($dbworkR), $serviz[150]));
            sort($dbworkR);
            $dbwork2 = array();
            $dbwork3 = array();
            $nbdwnld = 0;
            foreach ($dbwork1 as $dbw) {
                $dbwork3[] = array(ReadCounter(DBCOUNT.TestFileID($dbw[4]).DBEXT), $dbw);
            }
            sort($dbwork3);
            $dbwork2 = array_slice($dbwork3, -intval($serviz[151]));
            rsort($dbwork2);
            $dbworkT = array();
            foreach ($dbwork2 as $db) $dbworkT[] = $db[1];
            unset($dbwork2, $dbwork3);
            $categT = sprintf($web[652], min(count($dbworkT), $serviz[151]));
            if (empty($this->dirdnl) || $this->dirdnl == 'no') {
                foreach ($dbwork1 as $db) {
                    if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                        $cats  = explode('|', $db[0 + $k]);
                        $catan = count($cats) > 1 ? $cats[0] : $web[649];
                        if (array_search($catan, $dbwan) === false) {
                            $dbwan[] = $catan;
                        }
                    }
                }
                if (count($dbwan) == 1 && $dbwan[0] == $web[649]) {
                    $this->dirdnl = 'no';
                    foreach ($dbwork1 as $db) {
                        if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                            $dbwork[] = $db;
                        }
                    }
                }
                sort($dbwan);
                $dbcnt = array();
                foreach ($dbwan as $db) {
                    $nb = 0;
                    foreach ($dbwork1 as $dbw) {
                        if (isAccessGranted($dbw[6]) && isAuthorizedPublication($dbw[5])) {
                            $cats  = explode('|', $dbw[0 + $k]);
                            $catan =  count($cats) > 1 ? $cats[0] : $web[649];
                            if ($db == $catan) $nb++;
                        }
                    }
                    $pos = mb_strpos($db, '-->');
                    $cat = $pos !== false ? mb_substr($db, $pos + 3) : $db;
                    $dbcnt[KeepGoodChars($cat)] = $nb;
                }
                sort($dbwork);
            }
            else {
                $dbwan = array();
                if ($this->dirdnl == 'R') {
                    $dbwork = $dbworkR;
                    $categ  = $categR;
                }
                elseif ($this->dirdnl == 'T') {
                    $dbwork = $dbworkT;
                    $categ  = $categT;
                }
                else {
                    foreach ($dbwork1 as $db) {
                        if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                            $cats  = explode('|', $db[0 + $k]);
                            $cat0  = count($cats) > 1 ? $cats[0] : $web[649];
                            $pos   = mb_strpos($cat0, '-->');
                            $cat0  = $pos !== false ? mb_substr($cat0, $pos + 3) : $cat0;
                            $catan = KeepGoodChars(count($cats) > 1 ? $cat0 : $web[649]);
                            if ($this->dirdnl == $catan) {
                                $dbwork[] = $db;
                                $categ    = $cat0;
                            }
                        }
                    }
                    $categ = $dirlnk == KeepGoodChars($web[649]) ? $web[649] : $categ;
                    sort($dbwork);
                }
            }
            unset($dbwork1);
        }
        $out .= '
<div><p class="text-center">'.$web[38].'</p></div>';
        if (empty($this->dirdnl) && empty($this->pg)) {
            if (!empty($dbwan)) {
                if (!empty($serviz[150])) $out .= '
<a href="'.($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[11].'-8-R-'.$this->tconfig.$z2 
    : $site['DN'].'.php?lng='.$lng.'&amp;dirdnl=R&amp;tconfig='.$this->tconfig.$z2).'">
  <div class="dncatdwnl">
	<i class="fas fa-download" title="'.$an.'"></i>'.$categR.'
  </div>
</a>';
                if (!empty($serviz[151])) $out .= '
<a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[11].'-8-T-'.$this->tconfig.$z2 : $site['DN'].'.php?lng='.$lng.'&amp;dirdnl=T&amp;tconfig='.$this->tconfig.$z2).'">
  <div class="dncatdwnl">
	<i class="fas fa-download" title="'.$an.'"></i>'.$categT.'
  </div>
</a>';
                if (!empty($serviz[150]) || !empty($serviz[151])) $out .= '<br />';
                foreach ($dbwan as $an) {
                    $pos = mb_strpos($an, '-->');
                    $an  = $pos !== false ? mb_substr($an, $pos + 3) : $an;
                    $out .= '
<a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[11].'-8-'.KeepGoodChars($an).'-'.$this->tconfig.$z2 : $site['DN'].'.php?lng='.$lng.'&amp;dirdnl='.KeepGoodChars($an).'&amp;tconfig='.$this->tconfig.$z2).'">
  <div class="dncatdwnl">
	<i class="fas fa-download" title="'.$an.'"></i>'.$an.' ('.$dbcnt[KeepGoodChars($an)].')
  </div>
</a>';
                }
            }
        } else {
            if (empty($this->id)) {
                $this->id = 1;
            }
            if (empty($this->pg) && $this->dirdnl != 'no') {
                if (!empty($categ)) $out .= '
<div class="dntitlecat">'.$categ.'</div>';
                $out .= '
<div class="text-center">
  <form 
    name="retandnl" 
    action="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[11].'-'.$this->tconfig.$z2 
      : $site['DN'].'.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
    method="post">
    '.SubmitButton($web[650]).'
  </form>
</div>';
            }
            if (!empty($dbwork)) {
                $typeRubrique = TYP_DNLOAD;
                $imgOpen = 'fas fa-file-download';
                $imgClose = 'far fa-minus-square';
                $subImgOpen = 'far fa-caret-square-down';
                $subImgClose = 'far fa-caret-square-up';
                $mawmenu = (count($dbwork)-($serviz[4]*($this->id-1))>$serviz[4])? $serviz[4] : count($dbwork)-($serviz[4]*($this->id-1)) ;
                $out .= BeginJavascript().'
var maxsub = '.$mawmenu.';'.EndJavascript();
                $rubr = '';
                $l    = 0;
                if (3 == abs($prt)) {
                    $this->id = 1;
                    $serviz[4] = 99999;
                }
                $isNew = false;
                for ($i = $serviz[4]*($this->id-1); $i < Min($serviz[4]*$this->id, count($dbwork)); $i++) {
                    ReadDoc($dbwork[$i][4]);
                    $img = getNewUpdateDoc($creadate, $moddate, $serviz[143]);
                    if ($img != '') $isNew = true;
                    if ($lng == $lang[0]) {
                        $txt1    = $img.$fieldb1;
                        $txt2    = $fieldc1;
                        $txt3    = $fielda1;
                        $fc      = explode(CONNECTOR, $fieldd1);
                        $file    = $fc[0];
                        $fieldd1 = $file;
                    } else {
                        $txt1    = $img.$fieldb2;
                        $txt2    = $fieldc2;
                        $txt3    = $fielda2;
                        $fc      = explode(CONNECTOR, $fieldd2);
                        $file    = $fc[0];
                        $fieldd2 = $file;
                    }
                    $txt5 = '';
                    $accessDenied = !isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate);
                    $licence = '';
                    if ($fieldweb != '') {
                        $licence = $fieldweb;
                    }
                    elseif (!preg_match('![/.]!', $file)) {
                        $licence = $fieldd2;
                    }
                    if ($licence != '') {
                        $txt5 = $licence;
                    }
                    $txtcount = '';
                    if ($serviz[35] == 'on') {
                        $downcounter  = max(0, ReadDocCounter($dbwork[$i][4]));
                        $txtcount = $web[191].'&nbsp;'.$downcounter.'&nbsp;'.($downcounter <= 1 ? $web[188] : $web[189]);
                    }
                    if (preg_match('!^(http|ftp)!i',$file)) {
                        $size = @filesize($file);
                        if ($size === false) {
                            $txt4 = '???';
                        } else {
                            $txt4 = (($lng == 'fr')? number_format($size/1000, 2, ',', ' ') : number_format($size/1000, 2, '.', ' '));
                        }
                    } else {
                        $txt4 = (($lng == 'fr') 
                          ? number_format(@filesize(CHEMIN.$file)/1000, 2, ',', ' ') 
                          : number_format(@filesize(CHEMIN.$file)/1000, 2, '.', ' '));
                    }
                    if ($accessDenied){
                        $txt4 = '';
                        $txt2 = '
<p class="text-center"><br><br>'.$web[445].'<br /><br /></p>';
                    }
                    if ($rubr != $txt3) {
                        $rubr  = $txt3;
                        $rubrs = explode('|', $rubr);
                        $srubr = count($rubrs) > 1 ? $rubrs[1] : $rubrs[0];
                        if ($l > 0) {
                            $out .= '
</div>';
                        }
                        if (trim($rubr) != "" && $this->dirdnl != 'T') {
                            $l++;
                            $out .= '
<div id="titreRubr'.$typeRubrique.$i.'" class="dnrubr font-weight-bold" 
    onclick="MontreCacheItems(\'imgOpen'.$typeRubrique.$i.'\',\'imgClose'.$typeRubrique.$i.'\',\'itemsRubr'.$typeRubrique.$i.'\',\'itemsRubrSelect\');">
  <i id="imgOpen'.$typeRubrique.$i.'" class="'.$imgOpen.'" title="'.$web[429].'" style="display: none;"></i>
  <i id="imgClose'.$typeRubrique.$i.'" class="'.$imgClose.'" title="'.$web[57].'" style="display: inline;"></i>
  &nbsp;'.$srubr.'
</div>';
                            if (count($dbwork) == 1) $out .= '
<div id="itemsRubrSelect" style="display: block;">';
                            else $out .= '
<div id="itemsRubr'.$typeRubrique.$i.'" style="display: block;">';
                        }
                    }
                    $n = (count($dbwork)>$serviz[4])? $i-$serviz[4]*$this->id+$serviz[4] : $i ;
                    if (!$accessDenied) {
                        $out .= '
  <div id="titreSubRubr'.$typeRubrique.$i.'" class="dnrubr2 font-weight-bold" 
      onclick="MontreCacheItems(\'subImgOpen'.$typeRubrique.$i.'\',\'subImgClose'.$typeRubrique.$i.'\',
        \'itemSubRubr'.$typeRubrique.$i.'\',\'itemSubRubrSelect\');">'."\n".'
	<div class="float-left text-right dnrubr3">
      <i id="subImgOpen'.$typeRubrique.$i.'" class="'.$subImgOpen.'" title="'.$web[429].'" style="display: none;"></i>
      <i id="subImgClose'.$typeRubrique.$i.'" class="'.$subImgClose.'" title="'.$web[57].'" style="display: inline;"></i>
    </div>'."\n".'
	<div class="dnsubrubr"><a id="subRubr'.$typeRubrique.$i.'">'.$txt1.'</a></div>'."\n".'
  	</div>'."\n";
                        $out .= '<div class="clearfix"></div>';
                        if (count($dbwork) == 1) {
                            $out .= '
  <div id="itemSubRubrSelect" class="bord2" style="display: block;">';
                        } else {
                           $out .= '
  <div id="itemSubRubr'.$typeRubrique.$i.'" class="bord2" style="display: block;">';
                        }
                        $out .= '
  <div class="row rep dncontent">'.$txt2.'<div class="clearfix"></div><hr />';
                        $out .= '
    <div class="col-md-7 dninfos pb-3">'.basename($file).' ('.$txt4.' '.$web[28].') '.$txtcount.'</div>
    <div class="col-md-5 pb-3">';
                        if ($prt == 0) {
                            if (in_array(strrchr($file, '.'), array('.php', '.inc', '.css', '.htm', '.html', '', '.pdf', '.txt'))) {
                                $out .= '
      <a href="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[11].($txt5 == ''? '-2' : '-3').'-0-'.$dbwork[$i][4].($txt5 != '' ? '-'.$txt5 : '') 
          : 'dwnld.php?lng='.$lng.'&amp;delay=0&amp;pg='.$dbwork[$i][4].($txt5 != ''? '&amp;li='.$txt5: '')).'"
        onclick="PopupWindow(\''.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[11].($txt5 == '' ? '-2': '-3').'-0-'.$dbwork[$i][4].($txt5 != '' ? '-'.$txt5: '') 
          : 'dwnld.php?lng='.$lng.'&amp;delay=0&amp;pg='.$dbwork[$i][4].($txt5 != '' ? '&amp;li='.$txt5 : '')).'\',
          \'dnload\',800,600,\'yes\',\'yes\');return false;"
        title="'.$web[362].'" class="dnlink" target="_blank">';
                            } else {
                                $out .= '
      <a href="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[11].($txt5 == '' ? '-2' : '-3').'-8-'.$dbwork[$i][4].($txt5 != '' ? '-'.$txt5 : '') 
          : 'dwnld.php?lng='.$lng.'&amp;delay=8&amp;pg='.$dbwork[$i][4].($txt5 != ''? '&amp;li='.$txt5: '')).'"
        onclick="PopupWindow(\''.($site['URLR'] == 'on'? $lng.'-'.$urlrw[11].($txt5 == '' 
          ? '-2': '-3').'-8-'.$dbwork[$i][4].($txt5 != '' ? '-'.$txt5 : '') 
          : 'dwnld.php?lng='.$lng.'&amp;delay=8&amp;pg='.$dbwork[$i][4].($txt5 != '' ? '&amp;li='.$txt5 : '')).'\',
          \'dnload\',540,340,\'no\',\'no\');return false;"
        title="'.$web[362].'" class="dnlink" target="_blank">';
                                }
                            $out .= '
        <i class="fas fa-download" title="'.$web[362].'"></i>
      </a>';
                            $out .= '
      <span class="f-right">';
                            $out .= '
        <a href="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[11].'-4-'.$dbwork[$i][4].'-'.$this->tconfig.$z2 
            : $site['DN'].'.php?lng='.$lng.'&amp;pg='.$dbwork[$i][4].'&amp;tconfig='.$this->tconfig.$z2).'">
          <i class="fas fa-link" title="'.$web[527].'"></i>
        </a>&nbsp;';
                            if (empty($serviz[77])) {
                                $out .= '
        <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[11].'-5-'.$dbwork[$i][4].'--1' 
            : $site['DN'].'.php?lng='.$lng.'&amp;pg='.$dbwork[$i][4].'&amp;prt=-1').'" target="_blank">
          <i class="far fa-eye" title="'.$web[264].'"></i>
        </a>&nbsp;
        <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[11].'-5-'.$dbwork[$i][4].'-1' 
            : $site['DN'].'.php?lng='.$lng.'&amp;pg='.$dbwork[$i][4].'&amp;prt=1').'" target="_blank">
          <i class="fas fa-print" title="'.$web[22].'"></i>
        </a>&nbsp;';
                            }
                            $out .= '
      </span>';
                            if (empty($prt)) $out .= 
      displayQuickConfig(NULL, $dbwork[$i][4], 'dnload&amp;form=2&amp;id='.$dbwork[$i][4], 
        'dnload&amp;act=i&amp;id='.$dbwork[$i][4], 'dnload&amp;del='.$dbwork[$i][4], 19);
                        }
                        $out .= '
    </div>
  </div><div class="clearfix"></div>';
                        $out .= '
</div>';
                    }
                }
                if ($l > 0) {
                    $out .= '
</div>';
                }
                if (0 == $prt && 'on' != $serviz[78] && !$isNew) $out .= 
BeginJavascript().'
var nbRubr = '.$i.';
var typeRubr = "'.$typeRubrique.'";
for(i = 0; i < nbRubr; i++) {
	if((document.getElementById && document.getElementById("itemsRubr"+ typeRubr + i) != null) 
      || (document.all && document.all["itemsRubr"+ typeRubr + i] != undefined ) 
      || (document.layers && document.layers["itemsRubr"+ typeRubr + i] != undefined) ) {
		cache("itemsRubr"+ typeRubr + i);
		montre("imgOpen"+ typeRubr + i,"inline");
		cache("imgClose"+ typeRubr + i);
	}
}'.EndJavascript();
                if (0 == $prt && 'on' != $serviz[78]) $out .= 
BeginJavascript().'
var nbRubr = '.$i.';
var typeRubr = "'.$typeRubrique.'";
for(i = 0; i < nbRubr; i++) {
	if((document.getElementById && document.getElementById("itemSubRubr"+ typeRubr + i) != null) 
      || (document.all && document.all["itemSubRubr"+ typeRubr + i] != undefined ) 
      || (document.layers && document.layers["itemSubRubr"+ typeRubr + i] != undefined) ) {
		cache("itemSubRubr"+ typeRubr + i);
		montre("subImgOpen"+ typeRubr + i, "inline");
		cache("subImgClose"+ typeRubr + i);
	}
}'.EndJavascript();
            } 
            elseif (!empty($this->pg)) {
                $out .= '
<p>'.$web[36].'</p>';
            }
            $out .= GetNavBar(($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[11].'-7-'.$this->dirdnl.'-'.$this->tconfig.'-' 
              : $site['DN'].'.php?lng='.$lng.'&amp;dirdnl='.$this->dirdnl.'&amp;tconfig='.$this->tconfig.'&amp;id='), 
              count($dbwork), $this->id, $serviz[4], $z2);
            if (empty($this->pg) && $this->dirdnl != 'no')
                $out .= '
<div class="text-center">
  <form 
    name="retanlnk" 
    action="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[11].'-'.$this->tconfig.$z2 
      : $site['DN'].'.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'"
    method="post">
    '.SubmitButton($web[650]).'
  </form>
</div>';
        }
        return array('DWNL', $out);
    }
               
    protected function CalcDownloadTime($file_size, $modem_speed) {
        global $web;
        if ($file_size == $web[37]) {
            $calctime = $web[37];
        }
        else {
            $secondes = round($file_size/$modem_speed/10);
            $minutes  = intval($secondes/60);
            $secondes = $secondes - 60*$minutes;
            $calctime = $minutes.' '.$web[202].' '.$secondes.' '.$web[203];
        }
        return $calctime;
    }
    
    public function DWNL2_ok() {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;        
        $out = '';
        if ($serviz[10] != 'on') { $out = '
    <div class="text-center web342">'.$web[143].'</div>';
            return array('', 'DWNL2', $out);
        }
        elseif ($this->dn != NULL) { $out = '
    <div class="text-center web342">STOP ! Variable $dn: illegal origine</div>';
            return array('', 'DWNL2', $out);
        }
        elseif (empty($this->pg)) { $out = '
    <div class="text-center web342">'.$web[35].'</div>';
            return array('', 'DWNL2', $out);
        }
        else {
            ReadDoc($this->pg);
            if ($type != "dn") { $out = '
    <div class="text-center web342">STOP ! Variable $pg : illegal value ('.$this->pg.')</div>';
                return array('', 'DWNL2', $out);
            }
            elseif (!isAccessGranted($fieldmod)) { $out = '
    <div class="text-center web342">STOP ! '.$web[445].'</div>';
                return array('', 'DWNL2', $out);
            }
        }
        return array('');
    }
    
    public function DWNL2_content() {
        global $lang, $lng, $web, $serviz, $urlrw, $site, $prt, $z2, $meskin, $charset;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        if (isset($this->dn) && $this->dn != 'yes') unset($this->dn);
        ReadDoc($this->pg);
        if ($lng == $lang[0]) {
            $nomdw = $fieldb1;
            $urls  = explode(CONNECTOR, $fieldd1);
            $urldw = $urls[0];
        }
        else {
            $nomdw = $fieldb2;
            $urls  = explode(CONNECTOR, $fieldd2);
            $urldw = $urls[0];
        }
        $licence     = $this->li;
        $nomfl       = basename($urldw);
        $sizefl      = FileSizeInKb($urldw);
 //       $sizefl      = $sizefl === FALSE ? $web[37] : $sizefl.' '.$web[28];
		$sizefl      = $sizefl === FALSE ? 0 : $sizefl;
        $modfl       = @filemtime($urldw);
        $modfl       = $modfl === FALSE ? $web[37] : FormatDateStamp($modfl);
        $dnldfl      = @filemtime(DBCOUNT.TestFileId($this->pg).DBEXT);
        $dnldfl      = $dnldfl === FALSE ? $web[37] : FormatDateStamp($dnldfl);
        $dnldcounter = UpdateDocCounter($this->pg);
        $txtcount    = $dnldcounter <= 1 ? $dnldcounter.' '.$web[188] : $dnldcounter.' '.$web[189];

        $out = '<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>'.$web[192].'</title>
<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />';
        if (isset($this->dn) || $licence == "") {
            if ($licence == '') $this->delay = 0;
            $out .= '
<meta http-equiv="refresh" content="'.$this->delay.'; URL='.$urldw.'" />';
        }
        if (file_exists($meskin."style.css")) {
            $out .= '
<link type="text/css" rel="stylesheet" href="'.$meskin.'style.css">
<link type="text/css" rel="stylesheet" href="'.$meskin.'styleplus.css">';
        }
        else {
            $out .= '
<link type="text/css" rel="stylesheet" href="no_skin/style.css">
<link type="text/css" rel="stylesheet" href="no_skin/styleplus.css">';
        }
        if (file_exists($meskin."bs4style.css")) $out .= '
<link type="text/css" rel="stylesheet" href="'.$meskin.'bs4style.css">';
        $out .=  '
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" 
  integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/css/bootstrap.min.css" 
  integrity="sha512-rt/SrQ4UNIaGfDyEXZtNcyWvQeOq0QLygHluFQcSjaGB04IxWhal71tKuzP6K8eYXYB6vJV4pHkXcmFGGQ1/0w==" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" 
  integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/js/bootstrap.bundle.min.js" 
  integrity="sha512-igl8WEUuas9k5dtnhKqyyld6TzzRjvMqLC79jkgT3z02FvJyHAuUtyemm/P/jYSne1xwFI06ezQxEwweaiV7VA==" crossorigin="anonymous">
</script>
</head>';
        if (!isset($this->dn) && $licence != '') {
            $url  = IndexDbFieldsByField(ReadDbFields(LICENCES), 0);
            $out .= '
<body class="tbl dwnld1Body">
<div class="bord2 rep maindwnld">
  <fieldset class="dwnld"><legend>'.$web[480].'</legend>
    <div class="divdwnld">'.sprintf($web[481], $licence).'</div>
    <div class="divdwnld">'.$web[482].'</div>';
        if (!empty($url[$licence][2]))
            $out .= '
    <div class="divdwnld font-weight-bold text-center">
      &bull; <a title="'.$web[483].'" target="_blank" href="'.sprintf($url[$licence][2], $lng).'"><u>'.$web[483].'</u></a> &bull;
    </div>';
        $out .= '
    <div class="divdwnld text-left"><br />'.$web[484].'</div>
    <form name="choice" 
      action="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[11].'-6-'.$this->pg : 'dwnld.php?lng='.$lng.'&amp;pg='.$this->pg).'" 
      method="post">
      <input type="hidden" name="dn" value="yes" />
      <div class="div1dwnld text-right">
'.SubmitButton($web[414], 'javascript:window.close();').' &nbsp; '.SubmitButton($web[415]).'
      </div>
    </form>
  </fieldset>
</div>';
        }
        else {
			$sizef512 = 0;
			$sizef56 = 0;	  
			$sizef336 = 0;
			$sizeflmsg = '';
//		$out .= 'sizefl: '.$sizefl.'<br />';
		if ($sizefl > 0)
		{		
			$sizef512 = $this->CalcDownloadTime($sizefl, 512).' '.$web[28];
			$sizef56 = $this->CalcDownloadTime($sizefl, 56).' '.$web[28];	  
			$sizef336 = $this->CalcDownloadTime($sizefl, 33.6).' '.$web[28];
		}
		else
			$sizeflmsg = $web[37];
            $out .= '
<body class="tbl dwnld1Body" onload="setTimeout(\'self.close();\',10000)">
  <fieldset class="rep dwnld">
    <div class="text-center m-auto;"><b>'.$web[193].'</b></div><hr />
    <div class="table-responsive-md">
    <div class="d-table text-center divdwnld">
      <div class="d-table-row">
        <div class="d-table-cell text-right">'.$web[218].'&nbsp;</div>
        <div class="d-table-cell text-left"><b>'.$nomdw.'</b></div>
      </div>
      <div class="d-table-row">
        <div class="d-table-cell text-right align-top">'.$web[194].'</div>
        <div class="d-table-cell text-left align-top"><b><a href="'.$urldw.'" target="mainFrame">'.$nomfl.'</a></b></div>
      </div>
      <div class="d-table-row">
        <div class="d-table-cell text-right">'.$web[263].'&nbsp;</div>
        <div class="d-table-cell text-left">'.$modfl.'</div>
      </div>
      <div class="d-table-row">
        <div class="d-table-cell text-right">'.$web[199].'&nbsp;</div>
        <div class="d-table-cell text-left">'.$txtcount.'</div>
      </div>
      <div class="d-table-row">
        <div class="d-table-cell text-right">'.$web[197].'&nbsp;</div>
        <div class="d-table-cell text-left">'.$dnldfl.'</div>
      </div>
      <div class="d-table-row">
        <div class="d-table-cell text-right">'.$web[195].'&nbsp;</div>
        <div class="d-table-cell text-left">'.$sizefl.'</div>
      </div>
      <div class="d-table-row">
        <div class="d-table-cell text-right">'.$web[198].'&nbsp;</div>

        <div class="d-table-cell text-left">'.$sizef512.' '.$web[28].'</div>
      </div>
      <div class="d-table-row">
        <div class="d-table-cell text-right">'.$web[200].'&nbsp;</div>
        <div class="d-table-cell text-left">'.$sizef56.' '.$web[28].'</div>
      </div>
      <div class="d-table-row">
        <div class="d-table-cell text-right">'.$web[201].'&nbsp;</div>
        <div class="d-table-cell text-left">'.$sizef336.' '.$web[28].'</div>
      </div>
    </div>
    </div>
  </fieldset>';
        }
        $out .= '
</body>
</html>';
        return array($out);
    }
}
?>
faq.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/faq.inc'
View Content
<?php
/*******************************************************************************
 *   FAQ
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.04 (December 14, 2021):  add $tconfig in function
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'faq.inc')) {
    header('location:../index.php');
    die();
}

class GY_faq {
    public $tconfig;
    public $topmess;
    protected $pg;
    protected $id;
    protected $dirfaq;

    public function __construct() {
        global $menuico, $nom, $lang, $lng, $page, $pg, $id;
        $topmess       = getLabel($nom[$lng == $lang[0] ? 24 : 25]);
        $this->topmess = $page[9] == '' ? $topmess : '<i class="far fa-question-circle float-right align-middle"></i>'.$topmess;
        $this->tconfig = $menuico[17] == 'ALL' ? import('tconfig', '', true, 0) : $menuico[17];
        $this->pg      = $pg;
        $this->id      = $id;
        $this->dirfaq  = import('dirfaq');
    }
    
    public function FAQ_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $out = '';
        if ($serviz[14] != 'on') {
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
<div class="text-center web342">'.$web[143].'
  <p class="text-center">
    '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
  </p>
</div>';
            return array('FAQ', $out);
        }
        elseif (!isAccessGranted($members[4])) {
            $out .= '
<div class="text-center web342">'.$web[342];
            $href1 = CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[3].'-0-'.$tconfig.$z2 
              : 'connect.php?lng='.$lng.'&tconfig='.$tconfig.$z2);
            $href2 = CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[15].'-5-new-'.$tconfig.$z2 
              : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$tconfig.$z2);
            if ($members[19] != '0' && $members[19] != '3') $out .= '
  <p class="text-center">
    '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
      (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
  </p>';
            $out .= '
</div>';
            return array('FAQ', $out);
        }
        elseif (!empty($this->pg)) {
            $dbwork = SelectDBFieldsByField(ReadDBFields(DBFAQ), 4, $this->pg);
            $isdoc  = (count($dbwork) > 0);
            if ($isdoc) {
                $isdoc = isAuthorizedPublication($dbwork[0][5]);
                if (!isAccessGranted($dbwork[0][6])) return array('h1', '');
            }
            if (!$isdoc) {
                if ($site[10] != '') return array('h2', '');
                else return array('h3', '');
            }
        }
        return array('');
    }
    
    public function FAQ_content() {
        global $lng, $lang, $site, $serviz, $web, $prt, $urlrw, $z2, $tconfig;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $out    = '';
        $dbwork = array();
        if (!empty($this->pg)) {
            $dbwork = SelectDBFieldsByField(ReadDBFields(DBFAQ), 4, $this->pg);
            $isdoc  = (count($dbwork) != 0);
            $dbwan  = array();
        } else {
            $dbwork2 = ReadDBFields(DBFAQ);
            $dbwork1 = array_filter($dbwork2, 'IsNotEmptyTitle');
            unset($dbwork2);
            $dbwan = array();
            $k     = $lng == $lang[0] ? 0 : 1;
            if (empty($this->dirfaq) || $this->dirfaq == 'no') {
                foreach ($dbwork1 as $db) {
                    if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                        $cats  = explode('|', $db[0 + $k]);
                        $catan =  count($cats) > 1 ? $cats[0] : $web[649];
                        if (array_search($catan, $dbwan) === false) {
                            $dbwan[] = $catan;
                        }
                    }
                }
                if (count($dbwan) == 1 && $dbwan[0] == $web[649]) {
                    $this->dirfaq = 'no';
                    foreach ($dbwork1 as $db) {
                        if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                            $dbwork[] = $db;
                        }
                    }
                }
                sort($dbwan);
            }
            else {
                $dbwan = array();
                foreach ($dbwork1 as $db) {
                    if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                        $cats  = explode('|', $db[0 + $k]);
                        $cat0  = count($cats) > 1 ? $cats[0] : $web[649];
                        $pos   = mb_strpos($cat0, '-->');
                        $cat0  = $pos !== false ? mb_substr($cat0, $pos + 3) : $cat0;
                        $catan = KeepGoodChars(count($cats) > 1 ? $cat0 : $web[649]);
                        if ($this->dirfaq == $catan) {
                            $dbwork[] = $db;
                            $categ    = $cat0;
                        }
                    }
                }
                $categ = $this->dirfaq == KeepGoodChars($web[649]) ? $web[649] : $categ;
            }
            unset($dbwork1);
        }
        sort($dbwork);
        if (empty($this->dirfaq) && empty($this->pg)) {
            if (!empty($dbwan)) {
                foreach ($dbwan as $an) {
                    $pos = mb_strpos($an, '-->');
                    $an  = $pos !== false ? mb_substr($an, $pos + 3) : $an;
                    $out .= '
<a href="'.($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[4].'-8-'.KeepGoodChars($an).'-'.$tconfig.$z2 
    : 'faq.php?lng='.$lng.'&amp;dirfaq='.KeepGoodChars($an).'&amp;tconfig='.$tconfig.$z2).'">
  <div class="facatlink">
    <i class="fas fa-question-circle" title="'.$an.'"></i>'.$an.'
  </div>
</a>';
                }
            }
        } else {
            if (empty($this->id)) $this->id = 1;
            if (empty($this->pg) && $this->dirfaq != 'no') {
                if (!empty($categ)) $out .= '
<div class="fatitlecat">'.$categ.'</div>';
                $out .= '
<div class="text-center">
  <form name="retanfaq" method="post" action="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[4].'-9-'.$this->tconfig.$z2 
      : 'faq.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'">
    '.SubmitButton($web[650]).'
  </form>
</div>';
            }
            if (!empty($dbwork)) {
                $typeRubrique = TYP_FAQ;
                $imgOpen      = "far fa-plus-square";
                $imgClose     = "far fa-minus-square";
                $subImgOpen   = "far fa-caret-square-down";
                $subImgClose  = "far fa-caret-square-up";
                $nfaqpg       = (count($dbwork)-($serviz[6]*($this->id-1))>$serviz[6])? $serviz[6] : count($dbwork)-($serviz[6]*($this->id-1)) ;
                $out .= BeginJavascript().'var maxsub = '.$nfaqpg.';'.EndJavascript();
                $rubr = '';
                $l    = 0;
                if (3 == abs($prt)) {
                    $this->id  = 1;
                    $serviz[6] = 999999;
                }
                $isNew = false;
                for ($i = $serviz[6]*($this->id-1); $i < Min($serviz[6]*$this->id, count($dbwork)); $i++) {
                    ReadDoc($dbwork[$i][4]);
                    $img = getNewUpdateDoc($creadate, $moddate, $serviz[140]);
                    if ($img != '') $isNew = true;
                    if ($lng == $lang[0]) {
                        $txt1 = $img.$fieldb1;
                        $txt2 = $fieldc1;
                        $txt3 = $fielda1;
                    } else {
                        $txt1 = $img.$fieldb2;
                        $txt2 = $fieldc2;
                        $txt3 = $fielda2;
                    }
                    $txt4 = FormatDate($moddate);
                    $txt5 = FormatDate($creadate);
                    if ($rubr <> $txt3 || $txt3 == '') {
                        $rubr  = $txt3;
                        $rubrs = explode('|', $rubr);
                        $srubr = count($rubrs) > 1 ? $rubrs[1] : $rubrs[0];
                        if ($l > 0) $out .= '
</div>';
                        if (trim($rubr) != '') {
                            $l++;
                            $out .= '
<div id="titreRubr'.$typeRubrique.$i.'" class="farubr font-weight-bold" 
    onclick="MontreCacheItems(\'imgOpen'.$typeRubrique.$i.'\',\'imgClose'.$typeRubrique.$i.'\',\'itemsRubr'.$typeRubrique.$i.'\',\'itemsRubrSelect\');">
  <i id="imgOpen'.$typeRubrique.$i.'" class="'.$imgOpen.'" title="'.$web[429].'" style="display: none;"></i>
  <i id="imgClose'.$typeRubrique.$i.'" class="'.$imgClose.'" title="'.$web[57].'" style="display: inline;"></i>
  &nbsp;'.$srubr.'
</div>';
                            if (count($dbwork) == 1) $out .= '
<div id="itemsRubrSelect" style="display: block;">';
                            else $out .= '
<div id="itemsRubr'.$typeRubrique.$i.'" style="display: block;">';
                        }
                    }
                    $n = (count($dbwork) > $serviz[6])? $i-$serviz[6]*$id+$serviz[6] : $i ;
                    $out .= '
  <div id="titreSubRubr'.$typeRubrique.$i.'" class="farubr2 font-weight-bold" 
      onclick="MontreCacheItems(\'subImgOpen'.$typeRubrique.$i.'\',\'subImgClose'.$typeRubrique.$i.'\',
        \'itemSubRubr'.$typeRubrique.$i.'\',\'itemSubRubrSelect\');">'."\n".'
	<div class="float-left text-right farubr3">
      <i id="subImgOpen'.$typeRubrique.$i.'" class="'.$subImgOpen.'" title="'.$web[429].'" style="display: none;"></i>
      <i id="subImgClose'.$typeRubrique.$i.'" class="'.$subImgClose.'" title="'.$web[57].'" style="display: inline;"></i>
	</div>'."\n".'
	<div class="fasubrubr"><a id="subRubr'.$typeRubrique.$i.'">'.$txt1.'</a></div>'."\n".'
  </div>'."\n";
                    if (count($dbwork) == 1) $out .= '
  <div class="bord2" id="itemSubRubrSelect" style="display: block;">';
                    else $out .= '
  <div class="bord2" id="itemSubRubr'.$typeRubrique.$i.'" style="display: block;">';
                    $out .= '
    <div class="rep facontent">'.$txt2.'<div class="clearfix"></div>';
                    if ($serviz[69] == '' || $serviz[70] == '' || $serviz[71] == '') {
                        $out .= '
    <hr />
    <div class="row">
      <div class="col-md-6 pb-3 fainfos">';
                        if ($serviz[69] == '') $out .= '
        '.$web[95].'<strong>'.$txt5.'</strong>';
                        if ($serviz[70] == '' && $moddate > substr($creadate,0,12)) $out .= '
        '.$web[20].'<strong>'.$txt4.'</strong>';
                        $out .= '
      </div>
      <div class="col-md-6 pb-3">';
                        if ($prt == 0) {
                            $out .= '
        <span class="float-right">
		  <a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[4].'-3-'.$dbwork[$i][4] : 'faq.php?lng='.$lng.'&amp;pg='.$dbwork[$i][4]).'">
            <i class="fas fa-link align-middle" title="'.$web[527].'"></i>
          </a>&nbsp;';
                            if ($serviz[71] == '') $out .= '
		  <a href="'.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[4].'-4-'.$dbwork[$i][4].'--1' 
              : 'faq.php?lng='.$lng.'&amp;pg='.$dbwork[$i][4].'&amp;prt=-1').'" target="_blank">
            <i class="far fa-eye align-middle" title="'.$web[264].'"></i>
          </a>&nbsp;
		  <a href="'.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[4].'-4-'.$dbwork[$i][4].'-1' 
              : 'faq.php?lng='.$lng.'&amp;pg='.$dbwork[$i][4].'&amp;prt=1').'" target="_blank">
            <i class="fas fa-print align-middle" title="'.$web[22].'"></i>
          </a>&nbsp;';
                            $out .= '
        </span>';
                        }
                        if (empty($prt)) $out .= 
        displayQuickConfig(NULL, $dbwork[$i][4], 'faq&amp;form=2&amp;id='.$dbwork[$i][4], 
          'faq&amp;act=i&amp;id='.$dbwork[$i][4], 'faq&amp;del='.$dbwork[$i][4], 21).'
      </div>
    </div>';
                    }
                    $out .= '
    </div>
  </div>';
                }
                if ($l > 0) {
                    $out .= '
</div>';
                }
                if (0 == $prt && 'on' != $serviz[79] && !$isNew) {
                    $out .= '
<script>
var nbRubr = '.$i.';
var typeRubr = "'.$typeRubrique.'";
for(i = 0; i < nbRubr; i++) {
	if((document.getElementById && document.getElementById("itemsRubr"+ typeRubr + i) != null) 
      || (document.all && document.all["itemsRubr"+ typeRubr + i] != undefined ) 
      || (document.layers && document.layers["itemsRubr"+ typeRubr + i] != undefined)) {
		cache("itemsRubr"+ typeRubr + i);
		montre("imgOpen"+ typeRubr + i,"inline");
		cache("imgClose"+ typeRubr + i);
	}
}
</script>';
                }
                if (0 == $prt && 'on' != $serviz[79]) {
                    $out .= '
<script>
var nbRubr = '.$i.';
var typeRubr = "'.$typeRubrique.'";
for(i = 0; i < nbRubr; i++) {
	if((document.getElementById && document.getElementById("itemSubRubr"+ typeRubr + i) != null) 
      || (document.all && document.all["itemSubRubr"+ typeRubr + i] != undefined ) 
      || (document.layers && document.layers["itemSubRubr"+ typeRubr + i] != undefined) ) {
		cache("itemSubRubr"+ typeRubr + i);
		montre("subImgOpen"+ typeRubr + i,"inline");
		cache("subImgClose"+ typeRubr + i);
	}
}
</script>';
                }
            } elseif (!empty($this->pg)) $out .= '
<p>'.$web[36].'</p>';
            $out .= GetNavBar(($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[4].'-7-'.$this->dirfaq.'-' 
              : 'faq.php?lng='.$lng.'&amp;dirfaq='.$this->dirfaq.'&amp;id='), 
              count($dbwork), $this->id, $serviz[6], $z2);
            if (empty($this->pg) && $this->dirfaq != 'no') $out .= '
<div class="text-center">
  <form 
      name="retanfaq" 
      action="'.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[4].'-9-'.$this->tconfig.$z2 
        : 'faq.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'"
      method="post">
    '.SubmitButton($web[650]).'
  </form>
</div>';
        }
        return array('FAQ', $out);
    }
}
?>
forum.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/forum.inc'
View Content
<?php
/*******************************************************************************
 *   Forum Topics
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.15 (November 29, 2023) : correction illegal variable and view archive post 
 ******************************************************************************/
if (stristr($_SERVER['SCRIPT_NAME'], 'faq.inc')) {
    header('location:../index.php');
    die();
}

class GY_forum {
    public $tconfig;
    public $topmess;
    public $frtyp;
    public $nom_frth;
    protected $pg;
    protected $id;
    protected $cat;
    protected $thrd;
    protected $fid;

    public function __construct() {
        global $menuico, $nom, $lang, $lng, $page, $pg, $id;
        $frcat          = explode(',', import('cat'));
        $topmess        = getLabel($nom[$lng == $lang[0] ? 22 : 23]);
        $this->nom_frth = strip_tags($topmess);
        $this->topmess  = $page[9] == '' ? $topmess : '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        $this->tconfig  = $menuico[19] == 'ALL' ? import('tconfig', '', true, 0) : $menuico[19];
        $this->pg       = $pg;
        $this->id       = import('id');
        $this->cat      = $frcat[0];
        $this->thrd     = import('thrd');
        $this->fid      = import('fid');
    }
    
   public function FR_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members, $tconfig;
        $out = '';
        if ($serviz[13] != 'on') {
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
<div class="text-center web342">'.$web[143].'
  <p class="text-center">
    '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
  </p>
</div>';
            return array($this->frtyp, $out);
        }
        elseif (!isAccessGranted($members[5])) {
            $out .= '
<div class="text-center web342">'.$web[342];
            $href1 = CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[3].'-0-'.$tconfig.$z2 
              : 'connect.php?lng='.$lng.'&tconfig='.$tconfig.$z2);
            $href2 = CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[15].'-5-new-'.$tconfig.$z2 
              : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$tconfig.$z2);
            if ($members[19] != '0' && $members[19] != '3') $out .= '
  <p class="text-center">
    '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
      (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
  </p>';
            $out .= '
</div>';
            return array($this->frtyp, $out);
        }
        $dbcat = ReadDBFields(DBFORUMCAT);
        $okfr  = false;
		if (!empty($dbcat)) 
		{
			foreach ($dbcat as $cat) 
			{
				if (!isset($cat[5])) $cat[5] = '';
				if ($cat[5] == 'on') 
				{ 
					$okfr = true; break;
				}
			}
		}
		if (!$okfr) {
			$href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
			$out .= '
		<div class="text-center web342">'.$web[143].'
		<p class="text-center">
		'.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
		</p>
		</div>';
			return array($this->frtyp, $out);
		}
        return array('');
    }
    
    public function FR_rules() {
        global $userprefs, $web, $page, $meskin, $site, $charset, $lang, $lng;
        if (is_file(DBRULES)) @include DBRULES;
        $out = '<!DOCTYPE html">
<html>
<head>
<title>'.$web[409].'</title>
<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'">';
        if(file_exists($meskin."style.css")) $out .= '
<link rel="stylesheet" href="'.$meskin.'style.css" />';
        else $out .= '
<link rel="stylesheet" href="no_skin/style.css" />';
        if(file_exists($meskin."styleplus.css")) $out .= '
<link rel="stylesheet" href="'.$meskin.'styleplus.css" />';
        else $out .= '
<link rel="stylesheet" href="no_skin/styleplus.css" />';
        if (file_exists($meskin."bs4style.css")) $out .= '
<link rel="stylesheet" href="'.$meskin.'bs4style.css" />';
        $out .=  '
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" 
  integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/css/bootstrap.min.css" 
  integrity="sha512-rt/SrQ4UNIaGfDyEXZtNcyWvQeOq0QLygHluFQcSjaGB04IxWhal71tKuzP6K8eYXYB6vJV4pHkXcmFGGQ1/0w==" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" 
  integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/js/bootstrap.bundle.min.js" 
	integrity="sha512-igl8WEUuas9k5dtnhKqyyld6TzzRjvMqLC79jkgT3z02FvJyHAuUtyemm/P/jYSne1xwFI06ezQxEwweaiV7VA==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.5.2/jquery-migrate.min.js" 
  integrity="sha512-BzvgYEoHXuphX+g7B/laemJGYFdrq4fTKEo+B3PurSxstMZtwu28FHkPKXu6dSBCzbUWqz/rMv755nUwhjQypw==" crossorigin="anonymous">
</script>
';
        $out .= '
</head>
<body class="nobackground border-0">
<br />
<div class="bord text-left mainrules">';
        if ($lng == $lang[0]) $out .= $rule1; else $out .= $rule2;
        $out .= '
</div>
<p class="text-right m-5 p-5">'.SubmitButton($web[57], 'javascript:window.close();').'</p>
</body>
</html>';
        return array($this->frtyp, $out);
    }
    
    public function FR_myposts() {
        global $userprefs, $web, $page, $meskin, $serviz, $forum, $urlrw, $site, $charset, $lng;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $dbw    = ReadDBFields(DBTHREAD);
        $dbwork = array();
        for ($i = 0; $i < count($dbw); $i++) {
            if ($dbw[$i][4] == $userprefs[1]) {
                $cat = strtoupper(substr($dbw[$i][8], 0, 2)) == 'PR' ? substr($dbw[$i][8], 2) : $dbw[$i][8];
                $dbw[$i][6] = getThreadName($dbw[$i][1]);
                $dbw[$i][7] = getForumCatName($cat);
                $dbwork[] = $dbw[$i];
            }
        }
        sort($dbwork);
        $topmess       = $web[616];
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        $out           = '<!DOCTYPE html>
<html>
<head>
<title>'.$web[616].'</title>
<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'">';
        if (file_exists($meskin.'style.css')) $out .= '
<link rel="stylesheet" href="'.$meskin.'style.css" />';
        else $out .= '
<link rel="stylesheet" href="no_skin/style.css" />';
        if (file_exists($meskin.'styleplus.css')) $out .= '
<link rel="stylesheet" href="'.$meskin.'styleplus.css" />';
        else $out .= '
<link rel="stylesheet" href="no_skin/styleplus.css" />';
        if (file_exists($meskin."bs4style.css")) $out .= '
<link rel="stylesheet" href="'.$meskin.'bs4style.css" />';
        $out .=  '
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" 
  integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.1/css/bootstrap.min.css" 
  integrity="sha512-T584yQ/tdRR5QwOpfvDfVQUidzfgc2339Lc8uBDtcp/wYu80d7jwBgAxbyMh0a9YM9F8N3tdErpFI8iaGx6x5g==" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" 
  integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.5.4/umd/popper.min.js" 
  integrity="sha512-7yA/d79yIhHPvcrSiB8S/7TyX0OxlccU8F/kuB8mHYjLlF1MInPbEohpoqfz0AILoq5hoD7lELZAYYHbyeEjag==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/js/bootstrap.min.js" 
  integrity="sha512-7rusk8kGPFynZWu26OKbTeI+QPoYchtxsmPeBqkHIEXJxeun4yJ4ISYe7C6sz9wdxeE1Gk3VxsIWgCZTc+vX3g==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.5.2/jquery-migrate.min.js" 
  integrity="sha512-BzvgYEoHXuphX+g7B/laemJGYFdrq4fTKEo+B3PurSxstMZtwu28FHkPKXu6dSBCzbUWqz/rMv755nUwhjQypw==" crossorigin="anonymous">
</script>
';
        $out .= '
</head>
<body class="bodyfrposts tblbox">
<br />
<div class="bord text-left mainfrposts">';
        if (empty($this->id)) $this->id = 1;
        if (!empty($dbwork)) {
            for ($i = $serviz[20] * ($this->id - 1); $i < Min($serviz[20] * $this->id, count($dbwork)); $i++) {
                ReadDoc($dbwork[$i][3]);
				$mrposline = stripos($fieldc1, '<p class="text-right thsign">');
				if (is_numeric($mrposline) && $mrposline > 0)
					$fieldc1 = str_replace('<p class="text-right thsign">', '<p class="text-end thsign">', $fieldc1);
                $out .= '
<div class="table-responsive-md">
<div class="d-table w-100">
  <div class="d-table-row">
    <div class="quest d-table-cell">
      <b>'.$dbwork[$i][7].'</b><br />'.$dbwork[$i][6].($forum[3] == 'on' ? ' - ' : '<br />').$web[68].$fielda2;
                $out .= '
    '.$web[7].' '.FormatDate($creadate).'
    </div>
  </div>
  <div class="d-table-row">
    <div class="rep d-table-cell">'.$fieldc1.'</div>
  </div>
</div>
</div>';
            }
        }
        if (count($dbwork) > $serviz[20]) $out .= '
<hr />
<div class="text-center">
  '.GetNavBar(($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[5].'-8-' 
    : 'formyposts.php?lng='.$lng.'&amp;id='), 
    count($dbwork), $this->id, $serviz[20]);
        $out .= '
</div>
<div class="text-right m-5 p-5">'.SubmitButton($web[57], 'javascript:window.close();').'</div>';
        $out .= '
</div>
</body>
</html>';
        return array($this->frtyp, $out);
    }
    
    protected function topforum($forumname) {
        global $lng, $lang, $site, $serviz, $web, $prt, $urlrw, $z2, $members, $forum, $userprefs, $tconfig;
        $out = '';
        if (($serviz[28] == 'on' || $serviz[24] == 'on') && $forum[15] != 'on') {
            $dossier_users = MSGREP;
            $file_users    = opendir($dossier_users);
            $nbr_membres   = 0;
            while ($nomfichier = readdir($file_users)) {
                if (substr($nomfichier,-3) == "dtb") {
                    $nbr_membres++;
                }
            }
            closedir($file_users);
            $nbrmsg = array();
            if (!empty($userprefs[1]) && FileDBExist(MSGREP.$userprefs[1].DBEXT)) {
                $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
                if ($dbmsg[0][0] == $userprefs[7]) {
                    for ($i = 2; $i < count($dbmsg); $i++) {
                        if ($dbmsg[$i][3] == "new") {
                            $nbrmsg[] = $dbmsg[$i][3];
                        }
                    }
                }
            }
            $out .= '
<div class="row p-0 m-0">
  <div class="col-md-4 p-0 m-0">';
            if ($serviz[28] == 'on' && !empty($nbr_membres)) {
                if (!empty($userprefs[1])) {
                    $out .= '
    <div class="d-inline-block pb-3 postsBtnForum">
	  <form 
        name="myposts" 
        action="" onsubmit="PopupWindow(\''.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[5].'-7' 
          : 'formyposts.php?lng='.$lng).'\', \''.($site['URLR'] == 'on'? $lng.'067': 'myposts').'\', 1024, 768, \'yes\', \'yes\');" 
        method="post">
	  '.SubmitButton($web[616]).'
	  </form>
    </div>';
                    if ($serviz[18] != 'on') $out .= '
    <div class="d-inline-block mailBtnForum'.($forum[3] == 'on' ? 'W' : 'T').'">
	  <form 
        name="usermsg" 
        action="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[13].'-3-3-'.$this->tconfig.$z2 
          : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;tconfig='.$this->tconfig.$z2).'" 
        method="post">
	    '.SubmitButton($web[318]).'
	  </form>
    </div>';
                    if (count($nbrmsg)!= 0) {
                        $act  = ($serviz[18] == 'on' ? '0' : '3');
                        $out .= '
    <div class="d-inline-block userWaveForum">
      <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[13].'-3-'.$act.'-'.$this->tconfig.$z2 
          : 'tinymsg.php?lng='.$lng.'&amp;action='.$act.'&amp;tconfig='.$this->tconfig.$z2).'">
        <i class="far fa-envelope blink display-4 text-success align-middle" title="'.$web[319].'"></i>
	  </a>
	</div>';
                    }
                }
                else {
                    if (empty($userprefs[1]) && $members[19] != '0' && $members[19] != '3') {
                        $out .= '
    <div class="d-inline-block newmembBtnForumW">
	  <form 
        name="newuser" 
        action="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
          : $site['USR'].'.php?lng='.$lng.'&amp;uuser=new&amp;tconfig='.$this->tconfig.$z2).'" 
        method="post">
	    '.SubmitButton($web[160]).'
	  </form>
    </div>';
                    }
                    if ($nbr_membres > 0 && empty($userprefs[1]))
                        $out .= '
    <div class="d-inline-block connectBtnForumW">
	  <form 
        name="userconnect" 
        action="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 
          : 'connect.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
        method="post">
	    '.SubmitButton($web[373]).'
	  </form>
    </div>';
                }
            }
            else $out .= '&nbsp;';
            $out .= '
  </div>
  <div class="col-md-2 p-0 m-0">';
            if ($serviz[28] == 'on' && !empty($nbr_membres)) {
                    $out .= '
    <div class="text-center align-middle membTopForumWW">';
                if ($serviz[158] == '') {
                    $text_nbr_membres = $web[$nbr_membres > 1 ? 321: 322];
                    $out .= '
	    <i class="fas fa-users" title="'.$web[320].'"></i>&nbsp;<b>'.$nbr_membres.' '.$text_nbr_membres.'</b>';
                }
                $out .= '
    </div>';
            }
            else $out .= '&nbsp;';
            $out .= '
  </div>
  <div class="col-md-4 p-0 m-0">';
            if ($serviz[28] == 'on' && !empty($nbr_membres)) {
                if ($serviz[159] == '') {
                    $regusers    = ReadDBFields(DBIPSTATS);
                    $usersonline = array();
                    for ($i = 0; $i < count($regusers); $i++) {
                        if (!empty($regusers[$i][2])) {
                            $usersonline[] = $regusers[$i][2];
                        }
                    }
                    @sort($usersonline);
                    if (empty($usersonline)) {
                        $out .= '
    <div class="d-inline-block text-center membTopForumWW">
	  <b>'.$web[175].'</b> '.$web[176].'
    </div>';
                    }
                    else {
                        $uniqueusers   = array();
                        $uniqueusers[] = $usersonline[0];
                        for ($i = 1; $i < count($usersonline); $i++) {
                            if ($usersonline[$i] != $usersonline[$i - 1]) {
                                $uniqueusers[] = $usersonline[$i];
                            }
                        }
                        if ($forum[3] == 'on' && $serviz[18] != 'on') {
                            $out .= '
    <div class="d-inline-block text-center membTopForumWW">
      <b>'.$web[175].'</b> '.count($uniqueusers).'&nbsp;';
                            $from = $userprefs[1];
                            if ($userprefs[1] != "") {
                                $out .= '
	  &nbsp;<i class="fas fa-caret-right" title="'.$web[321].'"></i> '.$userprefs[1].' &nbsp;';
                            }
                            $out .= '
      <form 
        name="tinysend"
        action="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[13].'-3-1-'.$this->tconfig.$z2 
          : 'tinymsg.php?lng='.$lng.'&amp;action=1&amp;tconfig='.$tconfig.$z2).'" 
        method="post">
	    <input type="hidden" name="from" value="'.$from.'" />';
                            if (count($uniqueusers) > 1) {
                                $out .= '
        <div class="d-inline-block"> + </div>
	    <div class="d-inline-block">
          <select name="to" onchange="this.form.submit" class="form-control seluserTopForum align-middle">';
                                for ($i = 0; $i < count($uniqueusers); $i++) {
                                    if ($uniqueusers[$i] != $userprefs[1]) {
                                        $out .= '
		    <option value="'.$uniqueusers[$i].'">&nbsp;'.$uniqueusers[$i].'</option>';
                                    }
                                }
                                $out .= '
	      </select>
          </div>';
                            }
                            if ($userprefs[1] != '' && count($uniqueusers) > 1) {
                                $out .= '
	    <div class="d-inline-block">
          <button type="submit" class="mailsubmitTopForum" style="width: 56px;" title="'.$web[214].'"><i class="far fa-envelope"></i></button>
        </div>';
                            }
                            $out .= '
	  </form>
    </div>';
                        }
                        else {
                            $out .= '
    <div class="d-inline-block text-center membTopForumWW">
      <b>'.$web[175].'</b> '.count($uniqueusers).'&nbsp;
    </div>';
                        }
                    }
                }
                else $out .= '&nbsp;';
            }
            else $out .= '&nbsp;';
                $out .= '
  </div>
  <div class="col-md-2 p-0 m-0 text-right searchTopForum">';
            if ($serviz[24] == 'on') {
                include CONFIGREP.'searchconfig.inc';
                $tconfig = $confpage == 'ALL' ? $this->tconfig : $confpage;
                $out .= '
	<form 
        name="what"
        action="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[12].'-'.$tconfig.$z2 
          : 'search.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" 
        method="post">
	  <input name="searchin" type="hidden" value="'.TYP_FORUM.'" />
      <div class="input-group mb-3 w-100 m-auto">
        <input name="search" class="texte form-control" type="text" placeholder="'.$web[58].'" value="" />
        <div class="input-group-append c-pointer" onclick="javascript:what.submit();">
          <span class="input-group-text">
            <i class="fas fa-search" title="'.$web[58]." ".$forumname.'"></i>
          </span>
        </div>
      </div>
	</form>';
            }
            else $out .= '&nbsp;';
        $out .= '
  </div>
</div>
<div class="clearfix"></div>';
        }
        return $out;
    }
    
    public function FRT_content() {
        global $lng, $lang, $page, $site, $nom, $serviz, $web, $prt, $urlrw, $z2, $forum, $userprefs;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $k             = $lng == $lang[0] ? 0 : 1;
        $nom_fr        = getLabel($nom[$k+22]);
        $topmess       = strip_tags($nom_fr);
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        $out           = '';
        $dbw           = ReadDBFields(DBFORUMCAT);
        $dbwork        = array();
        foreach ($dbw as $db) if (isForumAccessGranted($db[0]) && 'on' == $db[5]) $dbwork[] = $db;
        $dbworkcat = ReadDBFields(DBFORUM);
        for ($i = 0; $i < count($dbwork); $i++) {
            $prcat = explode(',', $dbwork[$i][0]);
            $dbwork[$i][0] = $prcat[0];
            $dbcat0 = $dbwork[$i][3];
            $dbcat1 = $dbwork[$i][4];
            $dbwork[$i][3] = 0;
            $dbwork[$i][4] = 0;
            $dbwork[$i] = array_pad($dbwork[$i] , 15, '');
            $dbwork[$i][14] = $dbcat0;
            $dbwork[$i][15] = $dbcat1;
            for ($j = 0; $j < count($dbworkcat); $j++) {
                $frcat = explode(',', $dbworkcat[$j][12]);
                $cat   = $frcat[0];
                $grp   = isset($frcat[1]) ? $frcat[1] : '';
                if ($cat == $dbwork[$i][0] && isForumAccessGranted($cat)) {
                    $dbwork[$i][3]++;
                    $dbwork[$i][4] = $dbwork[$i][4] + $dbworkcat[$j][7] + 1;
                    if (empty($dbwork[$i][6])) { 
                        if (!empty($dbworkcat[$j][8])) {
                            $dbwork[$i][6] = $dbworkcat[$j][8]; 
                            if ($dbworkcat[$j][11] != 'on') 
                                $dbwork[$i][7] = $dbworkcat[$j][9]; 
                            else 
                                $dbwork[$i][7] = ''; 
                            $dbwork[$i][8] = $dbworkcat[$j][0]; 
                        } 
                        else {
                            $dbwork[$i][6] = $dbworkcat[$j][3]; 
                            if ($dbworkcat[$j][10] != 'on') 
                                $dbwork[$i][7] = $dbworkcat[$j][4]; 
                            else 
                                $dbwork[$i][7] = ''; 
                            $dbwork[$i][8] = $dbworkcat[$j][0]; 
                        }
                        $dbwork[$i][9]  = $dbworkcat[$j][1]; 
                        $dbwork[$i][10] = $dbworkcat[$j][7]; 
                        $dbwork[$i][11] = ceil($dbworkcat[$j][7] / $serviz[20]); 
                        $dbwork[$i][12] = $dbworkcat[$j][2]; 
                        $dbwork[$i][13] = $dbworkcat[$j][12];
                    }
                }
            }
        }
        unset($dbworkcat);
        $dbwork    = array_values($dbwork);
        $forumname = $nom_fr;
        $archdate  = ReadCounter(DBFORUMARCHDATE);
        if ($archdate > 0) {
            $out .= '
<p class="text-center frtlnkarch">'.$web[228].' '.FormatDate($archdate).'
  <br />'.$web[227].'&nbsp;
  <a href="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[5].'-6-'.$this->tconfig.$z2 
      : 'fortopicarch.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'">
    <b>'.$web[226].'&nbsp;<i class="far fa-file-alt"></i></b>
  </a>
  <br />
</p>';
        }
        if (empty($prt)) $out .= '<p>'.$this->topforum($forumname).'</p>';
        if ($forum[9] == 'on' && $forum[10] == 'on') {
            $out .= '
<div class="font-weight-bold text-left frtlnkrules">
  <a href="javascript:PopupWindow(\'rules.php?lng='.$lng.'\',\'rules\',800,500,\'yes\',\'yes\');" title="'.$web[409].'">
    <i class="fas fa-file-alt"></i> - '.$web[409].'
  </a>
</div>';
        }
        if (!empty($dbwork)) {
            $out .= '
<div class="text-center m-auto w-100 titrefr">
  <div class="table-responsive-md">
  <div class="bord d-table d-tbl w-100">
    <div class="d-table-row d-trhfr">
      <div class="d-table-cell d-tblth"></div>
      <div class="d-table-cell d-tblth w-40">'.$web[130].'</div>
      <div class="d-table-cell d-tblth w-13">'.$web[131].'</div>
      <div class="d-table-cell d-tblth w-13">'.$web[132].'</div>
      <div class="d-table-cell d-tblth w-30">'.$web[133].'</div>
    </div>';
            for ($i = 0; $i < count($dbwork); $i++) {
                $out .= '
    <div class="'.($i %2 == 0 ? 'rep' : 'quest').' d-table-row">
      <div class="d-table-cell text-center align-middle">
        <i class="frm-msg_a" title="'.$web[367].'"></i>
      </div>
      <div class="d-table-cell w-40">
        <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[5].'-2-'.getForumCatId($dbwork[$i][0]).$z2 
            : $site['FR'].'.php?lng='.$lng.GetOptionnalArg('cat', getForumCatId($dbwork[$i][0])).$z2).'" title="'.$dbwork[$i][1].'">
          <b>'.$dbwork[$i][1+$k].'</b>
        </a>
        <br /><i>'.($lng == $lang[0] ? $dbwork[$i][14] : $dbwork[$i][15]).'</i>
      </div>';
                $out .= '
      <div class="d-table-cell text-center w-13">'.$dbwork[$i][3].'</div>
      <div class="d-table-cell text-center w-13">'.$dbwork[$i][4].'</div>';
                $out .= '
      <div class="d-table-cell w-30">';
                $url1 = $site['URLR'] == 'on'? 
                    $lng.'-'.$urlrw[5].'-5-'.$dbwork[$i][12].'-'.getForumCatId($dbwork[$i][13]).'-'.$dbwork[$i][10].'#R'.$dbwork[$i][10] : 
                    $site['TH'].'.php?lng='.$lng.'&amp;pg='.$dbwork[$i][12].GetOptionnalArg('cat', getForumCatId($dbwork[$i][13])).
                      GetOptionnalArg('id'.$dbwork[$i][11]).'#R'.$dbwork[$i][10];
                if ($dbwork[$i][7] == "on") {
                    $em = BreakEMail($dbwork[$i][7]);
                    $out .= '
        '.$web[6].' '.displayWriteEmail('fortopic'.$i, $dbwork[$i][6], $dbwork[$i][7]).'
        <a href="'.$url1.'" title ="'.$web[297].'">&nbsp;<i class="far fa-caret-square-right"></i></a>';
                } elseif ($dbwork[$i][6] != "") {
                    $out .= '
        '.$web[6].' <b>'.$dbwork[$i][6].'</b>
        <a href="'.$url1.'" title ="'.$web[297].'">&nbsp;<i class="far fa-caret-square-right"></i></a>';
                }
				$idth = 0;
                if ($dbwork[$i][8] != "") {
                    $top  = '';
                    $dbth = array();
                    $dbth = ReadDBFields(DBTHREAD);
                    for ($l = 0; $l < count($dbth); $l++) {
                        if ($dbth[$l][1] == $dbwork[$i][9] && $dbth[$l][2] == $dbwork[$i][10]) {
                            $idth = $dbth[$l][3];
                            break;
                        }
                    }
					if ($idth != 0)
					{
						ReadDoc($idth);
						$lastdate = $creadate;
						$out .= '
			<br />'.$web[7].' '.FormatDate($lastdate);
					}
                }
                $out .= '
      </div>
    </div>';
            }
            $out .='
  </div>
  </div>
  <div class="bord bottomfrt w-100">';
            if ($forum[9] == 'on' && $forum[10] == '') {
                $out .= '
    <br />
    <p class="titre text-center text-uppercase"><u>'.$web[409].'</u></p>
    <br />
    <div class="frtrules">';
                include DBRULES;
                $out .= '
      '.($lng == $lang[0] ? $rule1 : $rule2).'
      <hr />
    </div>';
                if (empty($prt)) $out .= displayQuickConfig(NULL, false, 'rules', '', '', 24);
            }
            $out .= '
    <div class="infosfrt">
      <p class="titre text-center text-underline">'.$web[410].'</p>
      <p><b>'.$web[411].'</b>
        <br />
        <i class="frm-msg_a valign-4" title="'.$web[367].'"></i> '.$web[366].$web[367].' &nbsp;
        <i class="frm-msg_c valign-4" title="'.$web[368].'"></i> '.$web[366].$web[368].' &nbsp;
        <i class="frm-msg_t valign-4" title="'.$web[370].'"></i> '.$web[370].' &nbsp;
        <i class="frm-msg_n valign-4" title="'.$web[371].'"></i> '.$web[371].' &nbsp;
        <br />
        <br />
        '.$web[412].'
        <br />
        <i class="far fa-edit" title="'.$web[334].'"></i> '.$web[369].' '.$web[334].' &nbsp;
        <i class="frm-lock valign-1" title="'.$web[363].'"></i> '.$web[363].$web[366].' &nbsp;
        <i class="frm-lockup valign-1" title="'.$web[364].'"></i> '.$web[364].$web[366].' &nbsp;'
        .($userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176] ? '
        <i class="frm-unlock valign-1" title="'.$web[621].'"></i> '.$web[621].$web[366].' &nbsp;
        <i class="frm-moveto valign-1" title="'.$web[632].'"></i> '.$web[632].$web[366]
		: '').'
        <br />
      </p>
    </div>
  </div>
</div>';
        }
        return array($this->frtyp, $out);
    }
    
    public function FRTA_content() {
        global $lng, $lang, $site, $page, $web, $prt, $urlrw, $z2, $serviz;
        $k      = $lng == $lang[0] ? 0 : 1;
        $out    = '';
        $dbw    = ReadDBFields(DBFORUMCAT);
        $dbwork = array();
        foreach ($dbw as $db) {
            $acat = explode(',', $db[0]);
            if (isForumAccessGranted($acat[0])) $dbwork[] = $db;
        }
        $dbworkcat = ReadDBFields(DBFORUMARCH);
        for ($i = 0; $i < count($dbwork); $i++) {
            $prcat = explode(',', $dbwork[$i][0]);
            $dbwork[$i][0] = $prcat[0];
            $dbwork[$i][3] = 0;
            $dbwork[$i][4] = 0;
            for ($j = 0; $j < count($dbworkcat); $j++) {
                if ($dbworkcat[$j][12] == $dbwork[$i][0]) {
                    $dbwork[$i][3]++;
                    $dbwork[$i][4] = $dbwork[$i][4] + $dbworkcat[$j][7] + 1;
                    if (empty($dbwork[$i][6])) {
                        if (!empty($dbworkcat[$j][8])) {
                            $dbwork[$i][6] = $dbworkcat[$j][8];
                            if ($dbworkcat[$j][11] != 'on') 
                                $dbwork[$i][7] = $dbworkcat[$j][9];
                            else 
                                $dbwork[$i][7] = '';
                            $dbwork[$i][8] = $dbworkcat[$j][0];
                        }
                        else {
                            $dbwork[$i][6] = $dbworkcat[$j][3];
                            if ($dbworkcat[$j][10] != 'on') 
                                $dbwork[$i][7] = $dbworkcat[$j][4];
                            else 
                                $dbwork[$i][7] = '';
                            $dbwork[$i][8] = $dbworkcat[$j][0];
                        }
                    }
                }
            }
        }
        unset($dbworkcat);
        $dbwork        = array_values($dbwork);
        $topmess       = $web[226];
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        $archdate      = ReadCounter(DBFORUMARCHDATE);
        if ($archdate > 0 && empty($prt)) {
            $out .= '
<p class="text-center">
  '.$web[225].' '.FormatDate($archdate).'<br />'.$web[224].'&nbsp;
  <a href="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[5].'-'.$this->tconfig.$z2 
      : $site['FRT'].'.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'">
    <b>'.$web[223].'</b>&nbsp;
    <i class="far fa-file-alt"></i>
  </a>.<br /><br />
</p>';
        }
        if (!empty($dbwork)) {
            $out .= '
<div class="table-responsive-md">';
		if ($serviz[34] == 'on') 
				$out .= '<div class="bord d-table d-tbl m-auto w-98">';
		else
			$out .= '<div class="bord d-table d-tbl m-auto w-50">';
        $out .= '
  <div class="d-table-row text-center;">
    <div class="d-table-cell">'.$web[130].'</div>
    <div class="d-table-cell">'.$web[131].'</div>
    <div class="d-table-cell">'.$web[132].'</div>
    <div class="d-table-cell">'.$web[133].'</div>
  </div>';
            for ($i = 0; $i < count($dbwork); $i++) {
                if ($dbwork[$i][3] > 0) {
                    $acces = 'ok';
                    $prcat = explode(',', $dbwork[$i][0]);
                    if (isset($prcat[1])) {
                        $acces = 'no';
                        include_once CHEMIN.'inc/func_groups.php';
                        if (CheckGroup($prcat[1], $userprefs[1])) $acces = 'ok';
                    }
                    if ($acces == 'ok') {
                        $out .= '
  <div class="d-table-row text-center">
    <div class="quest d-table-cell">
      <a href="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[5].'-33-'.getForumCatId($dbwork[$i][0]).$z2 
          : 'forumarch.php?lng='.$lng.GetOptionnalArg('cat', getForumCatId($dbwork[$i][0])).$z2).'">
        <b>'.$dbwork[$i][1+$k].'</b>
      </a>
    </div>
    <div class="quest d-table-cell">'.$dbwork[$i][3].'</div>
    <div class="quest d-table-cell">'.$dbwork[$i][4].'</div>
    <div class="quest d-table-cell">';
                        if (isset($dbwork[$i][7]) && $dbwork[$i][7] != "") 
                            $out .= $web[6].' '.displayWriteEmail('fortopicarch'.$i, $dbwork[$i][6], $dbwork[$i][7]);
                        elseif (isset($dbwork[$i][6]) && $dbwork[$i][6] != '') 
                            $out .= $web[6].' <b>'.$dbwork[$i][6].'</b>';
                        if (isset($dbwork[$i][8]) && $dbwork[$i][8] != '') 
                            $out .= '<br />'.$web[7].' '.FormatDate($dbwork[$i][8]);
                        $out .= '</div></div>';
                    }
                }
            }
        }
        return array($this->frtyp, $out);
    }
    
    public function FR_content() {
        global $lng, $lang, $site, $nom, $serviz, $web, $prt, $urlrw, $z2, $forum, $page;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $l             = $lng == $lang[0] ? 0 : 1;
        $nom_fr        = getLabel($nom[$l + 22]);
        $topmess       = $nom_fr;
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        $cats          = explode(',', $this->cat);
        $this->cat     = $cats[0];
        $dbwork1       = array();
        if (!empty($this->pg)) { 
            $dbwork1 = SelectDBForumByID(ReadDBFields(DBFORUM), $this->pg);
        }
        elseif (!empty($this->cat)) {
            $dbwork1 = SelectDBForumByCat(ReadDBFields(DBFORUM), $this->cat);
        }
        else {
            $dbwork1 = ReadDBFields(DBFORUM);
        }
        $out       = '';
        $dbworkcat = array();
        $dbwork    = ReadDBFields(DBFORUMCAT);
        foreach ($dbwork as $dbcat) if ($dbcat[5] != '') $dbworkcat[] = $dbcat;
        $dbwork = array();
        foreach ($dbwork1 as $db) if (isForumAccessGranted(getForumCatFull($db[12]))) $dbwork[] = $db;
        unset($dbwork1);
        if (!isForumAccessGranted(getForumCatFull($this->cat))) return array($this->frtyp, 1);
        $catxt   = '';
        $topmess = '<a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[5].$z2 : $site['FRT'].'.php?lng='.$lng.$z2).'">'.$nom_fr.'</a>';
        if (!empty($this->cat)) {
            $catxt    = getForumCatName($this->cat);
            $topmess .= ' - '.$catxt;
        }
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        $forumname = strip_tags($nom_fr);
        $archdate  = ReadCounter(DBFORUMARCHDATE);
        if ($archdate > 0) $out .= '
<p class="text-center frtlnkarch">'.$web[228].' '.FormatDate($archdate).'
  <br />'.$web[227].'&nbsp;
  <a href="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[5].'-6-'.$this->tconfig.$z2 
      : 'fortopicarch.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'">
    <b>'.$web[226].'&nbsp;<i class="far fa-file-alt"></i></b>
  </a><br />
</p>';
        if (empty($prt)) $out .= $this->topforum($forumname);
        $out .= '
<div class="table-responsive-md">
<div class="bord d-table d-tbl text-center w-100">
  <div class="d-table-row">
    <div class="d-table-cell text-left w-50">';
        if ($forum[9] == 'on') $out .= '
      <div class="font-weight-bold frtlnkrules">
		<a href="javascript:PopupWindow(\'rules.php?lng='.$lng.'\',\'rules\',800,500,\'yes\',\'yes\');" title="'.$web[409].'">
          <i class="fas fa-file-alt"></i> - '.$web[409].'
        </a>
      </div>
      <br />';
        if ($catxt != '') $out .= '
      <div class="font-weight-bold frlnkforumW">
        <a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[5].'-'.$this->tconfig.$z2 : $site['FRT'].'.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'" title="'.$forumname.'">
          <i class="fas fa-folder-open"></i> - '.$forumname.'
        </a>
      </div>
      <div class="font-weight-bold frlnkcategW">
        <i class="far fa-folder-open" title="'.$catxt.'"></i> -
        <a href="'.$site[3].($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[5].'-2-'.$this->cat.$z2 
            : $site['FR'].'.php?lng='.$lng.'&amp;cat='.$this->cat.$z2).'" title="'.$catxt.'">
          '.$catxt.'
        </a>
      </div>
    </div>
    <div class="d-table-cell text-right width50">
      <form 
          action="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[14].'-3-'.TYP_FORUM.'-'.$this->cat.$z2 
            : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_FORUM.GetOptionnalArg('cat', $this->cat).$z2).'" 
          method="post">
        <p class="text-right">
          '.SubmitButton($web[19]).'
        </p>
      </form>
    </div>';
        else $out .= '
    </div>
    <div class="d-table-cell width50">
      <form 
          action="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[14].'-'.TYP_FORUM.$z2 
            : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_FORUM.$z2).'" 
          method="post">
        <p class="text-right">
          '.SubmitButton($web[19]).'
        </p>
      </form>
    </div>';
        $out .= '
  </div>
  </div>
</div>';
        if (empty($this->id)) $this->id = 1;
        if (3 == abs($prt)) {
            $this->id   = 1;
            $serviz[17] = 99999;
        }
        $navbar = GetNavBar(($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[5].'-22-'.$this->cat.'-' 
          : $site['FR'].'.php?lng='.$lng.GetOptionnalArg('cat', $this->cat).'&amp;id='), 
          count($dbwork), $this->id, $serviz[17], $z2);
        $out   .= $navbar;
        $out   .= '
<div class="text-center m-auto">
  <div class="table-responsive-md">
  <div class="bord d-table d-tbl width98">
    <div class="d-table-row d-trhfr">
      <div class="d-table-cell d-tblth w-30">'.$web[298].'</div>
      <div class="d-table-cell d-tblth w-10">'.$web[63].'</div>
      <div class="d-table-cell d-tblth w-20">'.$web[299].'</div>';
        if ($serviz[34] == 'on') $out .= '
      <div class="d-table-cell d-tblth w-10">'.$web[217].'</div>
      <div class="d-table-cell d-tblth w-10">'.$web[67].'</div>
      <div class="d-table-cell d-tblth w-20">'.$web[66].'</div>
    </div>';
	    else $out .= '</div>';
	 
        if (count($dbwork) > 0) {
            $newdate = date('YmdHi', time()-(86400*$forum[8]));
            for ($i = $serviz[17]*($this->id-1); $i < Min($serviz[17]*$this->id, count($dbwork)); $i++) {
                $color = $i %2 == 0 ? 'rep' : 'quest';
                if ($serviz[34] == 'on') $threadcounter = ReadDocCounter($dbwork[$i][2]);
                ReadDoc($dbwork[$i][2]);
                $img = getNewUpdateDoc($creadate, $moddate, $serviz[139]);
                $st  = explode('#',$fieldmod);
                if ($st[0] == 'c') {
                    $etat    = $web[368].' '.$web[6].' '.@$st[1].((isset($st[2]))? ' '.$web[7].' '.FormatDate($st[2]) : '');
                    $img_msg = 'msg_'.$st[0];
                } 
                elseif ($st[0] == 's') {
                    $st[0]   = 'c';
                    $etat    = $web[368].' '.$web[6].' '.@$st[1].((isset($st[2]))? ' '.$web[7].' '.FormatDate($st[2]) : '');
                    $img_msg = 'msg_'.$st[0];
                } 
                elseif ($st[0] == 't' && $moddate > date('YmdHi')) {
                    $etat    = 'Top '.$web[6].' '.$st[1];
                    $img_msg = 'msg_'.$st[0];
                } 
                elseif ($st[0] == 'u' && $moddate > date('YmdHi')) {
                    $st[0]   = 't';
                    $etat    = 'Up '.$web[6].' '.$st[1].((isset($st[2]))? ' '.$web[7].' '.FormatDate($st[2]) : '');
                    $img_msg = 'msg_'.$st[0];
                } 
                elseif ($newdate < $creadate) {
                    $st[0]   = 'n';
                    $etat    = $web[371];
                    $img_msg = 'msg_'.$st[0];
                } 
                else {
                    $st[0]   = 'a';
                    $etat    = $web[367];
                    $img_msg = 'msg_'.$st[0];
                }
                $urw  = empty($this->cat) ? '-411-'.$dbwork[$i][2] : '-5-'.$dbwork[$i][2].'-'.$this->cat;
                $out .= '
    <div class="'.$color.' d-table-row">
      <div class="d-table-cell w-30">
        <i class="frm-'.$img_msg.' align-middle" title="'.$etat.'"></i>
        <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[5].$urw.'-'.$this->id.$z2 
            : $site['TH'].'.php?lng='.$lng.'&amp;pg='.$dbwork[$i][2].GetOptionnalArg('cat', $this->cat).GetOptionnalArg('fid', $this->id).$z2).'"  
            title="'.$dbwork[$i][5].'">
          '.$img.'<b>'.$dbwork[$i][5].'</b>
        </a>
      </div>
      <div class="d-table-cell text-center w-10">
        <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[5].$urw.'-'.$this->id.$z2 
            : $site['TH'].'.php?lng='.$lng.'&amp;pg='.$dbwork[$i][2].GetOptionnalArg('cat', $this->cat).GetOptionnalArg('fid', $this->id).$z2).'">
          <b>'.$dbwork[$i][1].'</b>
        </a>
      </div>
      <div class="d-table-cell w-20">';
                if ($dbwork[$i][10] == "on") $out .= displayWriteEmail('forum1'.$i, $dbwork[$i][3], $dbwork[$i][4]);
                else $out .= '
        <b>'.$dbwork[$i][3].'</b>';
            ReadDoc($dbwork[$i][2]);
            $out .= '
        <br />'.FormatDate($creadate).'
      </div>';
                if ($serviz[34] == 'on')
				{
						$txtcount = $threadcounter <= 1 ? $web[188] : $web[189];
						$out .= '
		  <div class="d-table-cell text-center w-10">'.$threadcounter.' '.$txtcount.'</div>';
					 $out .= '
		  <div class="d-table-cell text-center w-10">'.$dbwork[$i][7].'</div>';
					$out .= '
		  <div class="d-table-cell w-20">';
					if ($dbwork[$i][7] != 0) {
						$idder = (ceil($dbwork[$i][7]/ $serviz[20]));
						$urw   = empty($this->cat) ? '-411-'.$fileid : '-5-'.$fileid.'-'.$this->cat;
						if ($dbwork[$i][11] == 'on') 
							$out .= displayWriteEmail('forum2'.$i, $dbwork[$i][8], $dbwork[$i][9]).' 
			<a href="'.($site['URLR'] == 'on' 
				? $lng.'-'.$urlrw[5].$urw.'-'.$idder.'#R'.$dbwork[$i][7] 
				: $site['TH'].'.php?lng='.$lng.'&amp;pg='.$fileid.GetOptionnalArg('cat', $this->cat).GetOptionnalArg('id', $idder).'#R'.$dbwork[$i][7]).'" 
				title ="'.$web[297].'"> &nbsp;
			  <i class="far fa-caret-square-right"></i>
			</a>
			<br />';
						else $out .= '
			<b>'.$dbwork[$i][8].'</b>
			<a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[5].$urw.'-'.$idder.'#R'.$dbwork[$i][7] : $site['TH'].'.php?lng='.$lng.'&amp;pg='.$fileid.GetOptionnalArg('cat', $this->cat).GetOptionnalArg('id', $idder).'#R'.$dbwork[$i][7]).'" title ="'.$web[297].'"> &nbsp;
			  <i class="far fa-caret-square-right"></i>
			</a>
			<br />';
						$dbth = array();
						$dbth = ReadDBFields(DBTHREAD);
						for ($j = 0; $j < count($dbth); $j++) {
							if ($dbth[$j][1] == $dbwork[$i][1] && $dbth[$j][2] == $dbwork[$i][7]) {
								$th_id = $dbth[$j][3];
								break;
							}
						}
						if (isset($th_id)) {
							ReadDoc($th_id);
							$out .= FormatDate($creadate);
						}
					}
				
				$out .= '</div>';
				}
                $out .= '</div>';
            }
        }
        $out .= '
  </div>
  </div>';
        $out .= $navbar;
        $out .= '
  <div class="w-100 frbottom">
    <div class="text-left align-middle float-left frimgsbottom">
      <i class="frm-msg_a valign-4" title="'.$web[367].'"></i> '.$web[366].$web[367].' &nbsp;
      <i class="frm-msg_c valign-4" title="'.$web[368].'"></i> '.$web[366].$web[368].' &nbsp;
      <i class="frm-msg_t valign-4" title="'.$web[370].'"></i> '.$web[370].' &nbsp;
      <i class="frm-msg_n valign-4" title="'.$web[371].'"></i> '.$web[371].$web[334].' &nbsp;
    </div>
    <div class="text-right float-right frretfrt">
      <form 
          action="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[5].'-'.$this->tconfig.$z2 
            : $site['FRT'].'.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
          method="post">
        '.SubmitButton($web[134]).'
      </form>
    </div>
  </div>
</div>
<br />';
        return array($this->frtyp, $out);
    }
    
    public function FRA_content() {
        global $lng, $lang, $site, $page, $nom, $serviz, $web, $prt, $urlrw, $z2, $forum, $userprefs;
        $l       = $lng == $lang[0] ? 0 : 1;
        $out     = '';
        $dbwork1 = array();
		$dbwork = array();
		$dbthrd = array();
        if (!empty($this->pg)) $dbwork1 = SelectDBForumByID(ReadDBFields(DBFORUMARCH), $this->pg);
        elseif (!empty($this->cat)) $dbwork1 = SelectDBForumByCat(ReadDBFields(DBFORUMARCH), $this->cat);
        else $dbwork1 = ReadDBFields(DBFORUMARCH);
        $dbworkcat = array();
        $dbwork    = ReadDBFields(DBFORUMCAT);
        foreach ($dbwork as $dbcat) {
            $acat = explode(',', $dbcat[0]);
            if ($dbcat[5] == 'on' && isForumAccessGranted($acat[0])) $dbworkcat[] = $dbcat;
        }
        $dbwork = array();
        foreach ($dbwork1 as $db) {
            $dbcat = array();
            if ($db[12] != '') $dbcat = SelectDBFieldsByField($dbworkcat, 0, $db[12]);
            if (isForumAccessGranted($db[12]) && !empty($dbcat)) $dbwork[] = $db;
        }
        unset($dbwork1);
        if (empty($dbwork) || !isForumAccessGranted(getForumCatFull($this->cat))) {
            return array($this->frtyp, 1);
        }
        $topmess = '<a href="'.($site['URLR'] == 'on' ? 
          $lng.'-'.$urlrw[5].'-6-'.$z2 : 'fortopicarch.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'">'.$web[226].'</a>';
        if (!empty($this->cat)) {
            $catxt = '';
            for ($k = 0; $k < count($dbworkcat); $k++) {
                if ($dbworkcat[$k][0] == $this->cat) {
                    $catxt = $dbworkcat[$k][1 + $l];
                    break;
                }
            }
            $topmess .= ' - '.$catxt;
        }
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        include_once CHEMIN.'inc/func_groups.php';
        $acces = 'ok';
        if (!IsValidForumCat($this->cat)) $acces = 'no';
        if (IsPrivateForumCat($this->cat)) {
            $acces = 'no';
            if ($userprefs[1] != '') if (CheckGroup($this->cat, $userprefs[1])) $acces = 'ok';
        }
        if ($acces != 'ok') $out .= '
<p class="text-center font-weight-bold frnoaccess"><br />'.$web[443].'</strong><br /></p>';
        else {
            if (empty($prt)) {
                $archdate = ReadCounter(DBFORUMARCHDATE);
                if ($archdate > 0) $out .= '
<p class="text-center">
  '.$web[225].' '.FormatDate($archdate).'.<br />'.$web[224].'&nbsp;
  <a href="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[5].'-20'.$this->cat.$z2 
      : $site['FR'].'.php?lng='.$lng.'&cat='.$this->cat.$z2).'">
    <b>'.$web[223].'&nbsp;<i class="far fa-file-alt"></i></b>
  </a>.<br />
  <hr />
</p>';
            }
            if (empty($this->id)) $this->id = 1;
            if (!empty($dbwork)) {
                for ($i = $serviz[17]*($this->id-1); $i < Min($serviz[17]*$this->id, count($dbwork)); $i++) {
                    if ($serviz[34] == 'on') $threadcounter = ReadDocCounter($dbwork[$i][2], ARCHDBBASE);
                    $out .= '
<div class="table-responsive-md">
<div class="d-table">
  <div class="d-table-row">
	<div class="d-table-cell frarchsubject";>
	  <a href="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[5].'-51-'.$dbwork[$i][2].'-'.$this->cat.'-'.$this->id.$z2 
          : 'threadarch.php?lng='.$lng.'&pg='.$dbwork[$i][2].GetOptionnalArg('cat', $this->cat).GetOptionnalArg('fid', $this->id).$z2).'">
        '.$web[63].$dbwork[$i][1].'
      </a>
	</div>
	<div class="quest d-table-cell w-100 frarchbody">
	  <a href="'.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[5].'-51-'.$dbwork[$i][2].'-'.$this->cat.'-'.$this->id.$z2 
          : 'threadarch.php?lng='.$lng.'&pg='.$dbwork[$i][2].GetOptionnalArg('cat', $this->cat).GetOptionnalArg('fid', $this->id).$z2).'">
        <b>'.$dbwork[$i][5].'</b>
      </a>
	  <br />&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;'.$web[6].' ';
                    if ($dbwork[$i][10] != 'on') $out .= displayWriteEmail('forumarch1'.$i, $dbwork[$i][3], $dbwork[$i][4]);
                    else $out .= '
	  <b>'.$dbwork[$i][3].'</b>';
                    $out .= ' '.$web[7].' '.FormatDate($dbwork[$i][6]);
                    if ($dbwork[$i][7] != 0) {
                        if ($dbwork[$i][11] != 'on') 
                            $formail = displayWriteEmail('forumarch2'.$i, $dbwork[$i][8], $dbwork[$i][9]);
                        else $formail = '
	  <b>'.$dbwork[$i][8].'</b>';
                        if ($dbwork[$i][7] == 1) $out .= '
	  <br />&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;'.$web[93].' '.$formail.' '.$web[94].' '.FormatDate($dbwork[$i][0]).')';
                        else $out .= '
	  <br />&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;'.$dbwork[$i][7].' '.$web[66]." ".$formail.' '.$web[94].' '.FormatDate($dbwork[$i][0]).')';
                    }
                    else $out .= '
	  <br />&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;'.$web[67];
                    if ($serviz[34] == 'on') {
                        $txtcount = $threadcounter <= 1 ? $web[188] : $web[189];
                        $out .= '
	  <br />&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;'.$web[217].' '.$threadcounter.' '.$txtcount; 
                    }
                    $out .= '
	  <br />
	</div>
  </div>
</div>
</div>';
                    if ($i < Min($serviz[17]*$this->id, count($dbwork))-1) $out .= '
<hr />';
                }
            }
            if (count($dbwork)>$serviz[17]) $out .= '
<hr />
'.GetNavBar(($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[5].'-35-'.$this->cat.'-' 
    : 'forumarch.php?lng='.$lng.GetOptionnalArg('cat', $this->cat).'&id='), 
    count($dbwork), $this->id, $serviz[17], $z2);
            if (count($dbwork) <= $serviz[17]) $out .= '
<hr />';
            $out .= '
<p class="text-center">
  <a href="'.($site['URLR'] == 'on' ? 
    $lng.'-'.$urlrw[5].'-6-'.$this->tconfig.$z2 : 'fortopicarch.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'">'.$web[134].'
  </a>
</p>';
        }
        return array($this->frtyp, $out);
    }
    
    public function TH_content() {
        global $userprefs, $web, $page, $serviz, $forum, $urlrw, $site, $lng, $prt, $drtuser, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $out   = '';
		$dbwork = array(); 
        $acats = GetForumCat();
        $iscat = false;
        foreach($acats as $acat) {
            if (getForumCatId($acat[0]) == $this->cat) {
                $iscat = true;
                break;
            }
        }
        if (!isForumAccessGranted(getForumCatFull($this->cat)) || !$iscat) {
            $href1 = $site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng;
            return array($this->frtyp, 1, $href1);
        }
        $thread = 0;
        if (!empty($this->pg)) {
            $dbwork = SelectDBForumByID(ReadDBFields(DBFORUM), $this->pg);
            if (count($dbwork) != 0) $thread = $dbwork[0][1];
            ReadDoc($this->pg);
            $frcat     = explode(',', $fieldb2);
            $this->cat = $frcat[0];
        } 
        elseif (!empty($this->thrd)) {
            $dbwork = ReadDBFields(DBTHREAD);
            foreach ($dbwork as $dbw) {
                if ($dbw[1] == $this->thrd && $dbw[2] == '0') {
                    $thread   = $this->thrd;
                    $this->pg = $dbw[3];
                    break;
                }
            }
        }
        $activeCat = true;
        if (!empty($this->cat)) {
            $dbcat = getForumCat();
            foreach ($dbcat as $db)
                if ($db[0] == $this->cat) {
                    $activeCat = $db[5] == 'on';
                    break;
                }
        }
        if ($thread === 0 || !$activeCat) {
            $threadarch = 0;
            $dbworkarch = SelectDBForumByID(ReadDBFields(DBFORUMARCH), $this->pg);
			$threadarch = 0;
			if (is_array($dbworkarch))
			{
				if (count($dbworkarch) > 0)        	
						$threadarch = $dbwork[0][1];
				if ($threadarch !== 0) {
					return array($this->frtyp, 1, ($site['URLR'] == 'on' ? 
						$lng.'-'.$urlrw[5].'-51-'.$this->pg.'-'.$this->cat.'-'.$this->fid.$z2 : 
						'threadarch.php?lng='.$lng.'&pg='.$this->pg.'&cat='.$this->cat.'&fid='.$this->fid.$z2));
				}
			}
            if ($site[10] != '') 
                return array($this->frtyp, 1, $site[3].'error.php?lng='.$lng.'&err=404');
            else 
                return array($this->frtyp, 1, '', $web[36]);
        }
        if ($serviz[34] == 'on') $threadcounter = UpdateDocCounter($this->pg);
        $dbthrd = SelectDBThreadByThread(ReadDBFields(DBTHREAD), $thread);
        if (!isForumAccessGranted($fielda1)) {
            return array($this->frtyp, 1, 'HTTP/1.0 403 Forbidden');
        }
        $topmess = '<a href="'.($site['URLR'] == 'on' ? 
            $lng.'-'.$urlrw[5].'-21-'.$this->fid.$z2 : 
            $site['FR'].'.php?lng='.$lng.'&id='.$this->fid.$z2).'">'.$this->nom_frth.'</a>';
        if (!empty($this->cat)) {
            $dbworkcat = array();
            $dbwcat    = ReadDBFields(DBFORUMCAT);
            foreach($dbwcat as $wcat) if ($wcat[5] == 'on') $dbworkcat[] = $wcat;
            $catxt   = getForumCatName($this->cat);
            $topmess = '<a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[5].$z2 : $site['FRT'].'.php?lng='.$lng.$z2).'">'.$this->nom_frth.'</a>
            - <a href="'.($site['URLR'] == 'on' ? 
                $lng.'-'.$urlrw[5].'-22-'.$this->fid.'-'.getForumcatId($this->cat).$z2 : 
                $site['FR'].'.php?lng='.$lng.'&id='.$this->fid.'&cat='.getForumcatId($this->cat).$z2).'">'.$catxt.'</a> - ';
        }
        else {
            $dbworkcat     = array();
            $catxt         = 'unknown';
            $topmess = '<a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[5].$z2 : $site['FRT'].'.php?lng='.$lng.$z2).'">'.$this->nom_frth.'</a> - ';
        }
        $topmess      .= $fieldb1;
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        ReadDoc($this->pg);
        $out .= '<br />';
        if (empty($prt)) $out .= $this->topforum($this->nom_frth);
        if ($forum[9] == 'on' && empty($prt)) {
            $out .= '
<div class="font-weight-bold frtlnkrules">
  <a href="javascript:PopupWindow(\'rules.php?lng='.$lng.'\',\'rules\',800,500,\'yes\',\'yes\');" title="'.$web[409].'">
    <i class="fas fa-file-alt"></i> - '.$web[409].'
  </a>
</div>';
        }
        $title = '
<div class="font-weight-bold thlnkforumW">
  <a href="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[5].'-'.$this->tconfig.$z2 
      : $site['FRT'].'.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'" title="'.$this->nom_frth.'">
    <i class="fas fa-folder-open"></i> - '.$this->nom_frth.'
  </a>
</div>
<div class="font-weight-bold thlnkcateg">
  <a href="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[5].'-2-'.getForumcatId($this->cat).$z2 
      : $site['FR'].'.php?lng='.$lng.'&cat='.getForumcatId($this->cat).$z2).'" title="'.$catxt.'">
    <i class="far fa-folder-open"></i> - '.$catxt.'
  </a>
</div>';
        $out .= '
<p class="text-left">'.$title.'</p>';
        $newdate = date('YmdHi', time() - (86400 * $forum[8]));
        $st = explode('#',$fieldmod);
		if (!isset($st[1])) $st[1] = '';
		if (!isset($st[2])) $st[2] = '';
        if ($st[0] == 'c') {
            $etat = $web[368].' '.$web[6].' '.$st[1].' '.$web[7].' '.FormatDate($st[2]);
            $img_msg = 'msg_'.$st[0];
        } elseif ($st[0] == 's') {
            $st[0] = 'c';
            $etat = $web[368].' '.$web[6].' '.$st[1].' '.$web[7].' '.FormatDate($st[2]);
            $img_msg = 'msg_'.$st[0];
        } elseif ($st[0] == 't' && $moddate > date('YmdHi')) {
            $etat = $web[370].' '.$web[6].' '.$st[1].' '.$web[7].' '.FormatDate($st[2]);
            $img_msg = 'msg_'.$st[0];
        } elseif ($st[0] == 'u' && $moddate > date('YmdHi')) {
            $st[0] = 't';
            $etat = 'Up '.$web[6].' '.$st[1].' '.$web[7].' '.FormatDate($st[2]);
            $img_msg = 'msg_'.$st[0];
        } elseif ($newdate < $creadate) {
            $st[0] = 'n';
            $etat = $web[371];
            $img_msg = 'msg_'.$st[0];
        } else {
            $st[0] = 'a';
            $etat = $web[367];
            $img_msg = 'msg_'.$st[0];
        }
        $out .= '
<div class="w-100 thmainW">
  <div class="bord row w-100 thhead">
    <div class="col-md-3 p-1">
      <div class=" text-center px-2 pt-2 thheadsubjectW">
	    <i class="frm-'.$img_msg.'" title="'.$etat.'"></i>&nbsp;&nbsp;<b>'.$web[63].' '.$thread.'</b>
      </div>
	</div>
    <div class="col-md-9 p-1">
      <div class="text-left px-2 pt-2 thheadbodyW">&nbsp;
        <a href="'.$site[3].($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[5].'-4-'.$this->pg.'-'.$this->cat.$z2 
            : $site['TH'].'.php?lng='.$lng.'&pg='.$this->pg.GetOptionnalArg('cat', $this->cat).$z2).'" title="'.$web[511].'">
          <b>'.$fieldb1.'</b>
        </a>
	  </div>
    </div>
  </div>
  <div class="row w-100 thbody">
    <div class="col-md-3 rep text-center">
      <div class="row">
        <div class="col-md-12">';
        if ($fieldd2 != 'v' && $fieldd2 != '') 
            $nbrpostmsg = $fieldd2.' '.($fieldd2 > 1 ? $web[335] : $web[334]);
        else 
            $nbrpostmsg = '';
        $max = explode('-', $forum[7]);
        if ($fieldd2 == 'v') {
            $inscrit = $web[15];
        } elseif($forum[7] == '') {
            $inscrit = '';
        } elseif($fieldd2 >= $max[3]) {
            $inscrit = '<i class="frm-rank5" title="'.$nbrpostmsg.'"></i>';
        } elseif($fieldd2 >= $max[2]) {
            $inscrit = '<i class="frm-rank4" title="'.$nbrpostmsg.'"></i>';
        } elseif($fieldd2 >= $max[1]) {
            $inscrit = '<i class="frm-rank3" title="'.$nbrpostmsg.'"></i>';
        } elseif($fieldd2 >= $max[0]) {
            $inscrit = '<i class="frm-rank2" title="'.$nbrpostmsg.'"></i>';
        } else {
            $inscrit = '<i class="frm-rank1" title="'.$nbrpostmsg.'"></i>';
        }
        if ($page[23] != 'none') {
            if($fieldc2 == '') {
                $fieldc2 = '<i class="ava-00 ava-th" title="'.$web[305].'"></i>';
            } else {
                if (is_file(MSGREP.$author.DBEXT)) {
                    $userdb  = ReadDBFields(MSGREP.$author.DBEXT);
                    if (!empty($userdb[1][16]) || $userdb[1][9] != 'ava-00') {
                        if ($userdb[1][9] == 'ava-00' && !empty($userdb[1][16])) 
                            $fieldc2 = '<img class="ava-th" src="'.$userdb[1][16].'" alt="'.$author.'" title="'.$author.'" />';
                        else 
                            $fieldc2 = '<i class="'.$userdb[1][9].' ava-th" title="'.$author.'"></i>';
                    }
                    elseif ($userdb[1][9] == 'ava-00') {
                        $fieldc2 = '<i class="ava-00 ava-th" title="'.$author.'"></i>';
                    }
                } 
                else 
                    $fieldc2 = '<i class="ava-00 ava-th" title="'.$author.'"></i>';
            }
        }
        $out .= '
          <div class="">'.$web[7].' '.FormatDate($creadate).'</div>
          <div class="">'.$web[6].' <b>'.addslashes($author).'</b></div>
          <div class="my-2">'.($page[23] != 'none' ? $fieldc2 : '&nbsp;').'</div>
        </div>
        <div class="col-md-12 mt-2">';
        $rank     = ReadDBFields(ADMINS);
        $modadmin = '';
        for ($y = 0; $y < count($rank); $y++) 
            if ($rank[$y][0] == $userprefs[1] && $rank[$y][2] == 'on') {
                $modadmin = 'yes';
                break;
            }
        if ($userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176]) $modadmin = 'yes';
        if ($author == $serviz[31] || $author == $serviz[176]) $out .= '
          <div class="py-2">'.$web[418].'</div>';
        elseif (is_file(CHEMIN.'admin/redac/'.$author.'.inc')) {
            include CHEMIN.'admin/redac/'.$author.'.inc';
            if (!empty($drtuser[30])) $out .= '
          <div class="py-2">'.$drtuser[30].'</div>';
            else $out .= '
          <div class="py-2">&nbsp;</div>';
        } 
        else {
            for ($y = 0; $y < count($rank); $y++) {
                if ($rank[$y][0] == $author) {
                    switch ($rank[$y][1]) {
                    case 'admin' :
                        $out .= (empty($rank[$y][3]) ? $web[418] : $rank[$y][3]).'<br />';
                        break;
                    case 'modo' :
                        $out .= (empty($rank[$y][3]) ? $web[420] : $rank[$y][3]).'<br />';
                        break;
                    case 'redac' :
                        $out .= (empty($rank[$y][3]) ? $web[419] : $rank[$y][3]).'<br />';
                        break;
                    case 'webm' :
                        $out .= (empty($rank[$y][3]) ? $web[11] : $rank[$y][3]).'<br />';
                        break;
                    }
                }
            }
        }
        $out .= $inscrit;
        $url1 = $site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[14].'-1-'.TYP_THREAD.'-'.'maj'.'-'.$thread.'-'.$fileid 
            : $site['PG'].'.php?lng='.$lng.'&typ='.TYP_THREAD.'&amp;mod=maj&amp;num='.$thread.'&amp;pg='.$fileid;
        $url2 = $site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[14].'-1-'.TYP_THREAD.'-'.'stop'.'-'.$thread.'-'.$fileid 
            : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_THREAD.'&amp;mod=stop&amp;num='.$thread.'&amp;pg='.$fileid;
        $url3 = $site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[14].'-1-'.TYP_THREAD.'-'.'raz'.'-'.$thread.'-'.$fileid 
            : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_THREAD.'&amp;mod=raz&amp;num='.$thread.'&amp;pg='.$fileid;
        $url4 = $site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[14].'-1-'.TYP_THREAD.'-'.'lock'.'-'.$thread.'-'.$fileid 
            : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_THREAD.'&amp;mod=lock&amp;num='.$thread.'&amp;pg='.$fileid;
        $url5 = $site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[14].'-1-'.TYP_THREAD.'-'.'top'.'-'.$thread.'-'.$fileid 
            : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_THREAD.'&amp;mod=top&amp;num='.$thread.'&amp;pg='.$fileid;
        $url6 = $site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[14].'-1-'.TYP_THREAD.'-'.'up'.'-'.$thread.'-'.$fileid 
            : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_THREAD.'&amp;mod=up&amp;num='.$thread.'&amp;pg='.$fileid;
        $url7 = $site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[14].'-1-'.TYP_THREAD.'-'.'move'.'-'.$thread.'-'.$fileid 
            : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_THREAD.'&amp;mod=move&amp;num='.$thread.'&amp;pg='.$fileid;
        switch ($st[0]) {
        case 'c':
        case 's':
            if ($modadmin == 'yes') {
                $out .= '&nbsp;
          <a href="'.$url1.$z2.'" title="'.$web[369].'">
            <i class="far fa-edit"></i>
          </a>&nbsp;
          <a href="'.$url3.$z2.'" title="'.$web[621].'">
            <i class="frm-unlock"></i>
          </a>';
            }
            break;
        case 't':
        case 'u':
            if ($modadmin == 'yes') {
                $out .= '
          &nbsp;<a href="'.$url1.$z2.'" title="'.$web[369].'"><i class="far fa-edit"></i></a>
          &nbsp;<a href="'.$url2.$z2.'" title="'.$web[390].'"><i class="frm-lock"></i></a>
          &nbsp;<a href="'.$url3.$z2.'" title="'.$web[621].'"><i class="frm-unlock"></i></a>';
            }
            elseif ($userprefs[1] == $author) {
                $out .= '
          &nbsp;<a href="'.$url1.$z2.'" title="'.$web[369].'"><i class="far fa-edit"></i></a>';
                $out .= '
          &nbsp;<a href="'.$url4.$z2.'" title="'.$web[363].'"><i class="frm-lock"></i></a>';
            }
            break;
        default:
            if ($modadmin == 'yes') {
                $out .= '
          &nbsp;<a href="'.$url1.$z2.'" title="'.$web[369].'"><i class="far fa-edit"></i></a>
          &nbsp;<a href="'.$url2.$z2.'" title="'.$web[390].'"><i class="frm-lock"></i></a>';
                if ($forum[6] != '') {
                    $out .= '
	      &nbsp;<i class="frm-lockup c-pointer" title="'.$web[364].'" onmouseup="cache(\'moveto\'); montre(\'timetop\');"></i>
          <div id="timetop" class="quest position-absolute text-center thtimetop" style="display:none;">
            <form name="topval" action="'.$url5.$z2.'" method="post">
              '.$web[622].'
               <input class="form-control texte m-auto w-20" type="text" name="forum6" value="'.$forum[6].'" />
              <div class="text-center">'.SubmitButton($web[52]).'</div>
              <div class="float-right mt-n4">
                <i class="far fa-caret-square-up" title="'.$web[57].'" onmouseup="cache(\'timetop\')"></i>
              </div>
              <div class="clearfix"></div>
            </form>
          </div>';
                }
                $out .= '
          &nbsp;<i class="frm-moveto c-pointer" title="'.$web[632].'" onmouseup="cache(\'timetop\'); montre(\'moveto\');"></i>
          <div id="moveto" class="quest position-absolute text-center thmoveto" style="display:none;">
            <form name="movetoform" action="'.$url7.$z2.'" method="post">
	    '.$web[633].' 
              <select name="tocat" onchange="this.form.submit();" class="form-control m-auto thtocat">';
                for ($k = 0; $k < count($dbworkcat); $k++) {
                    $out .= '
                <option value="'.$dbworkcat[$k][0].'"'.Selected($dbworkcat[$k][0] == $this->cat).'>'.$dbworkcat[$k][1].'</option>';
                }
                $out .= '
              </select>
              <div class="float-right mt-n3">
                <i class="far fa-caret-square-up" title="'.$web[57].'" onmouseup="cache(\'moveto\')"></i>
              </div>
              <div class="clearfix"></div>
            </form>
          </div>';
            }
            elseif ($userprefs[1] == $author) {
                $out .= '
          &nbsp;<a href="'.$url1.$z2.'" title="'.$web[369].'"><i class="far fa-edit"></i>';
                $out .= '
          &nbsp;<a href="'.$url4.$z2.'" title="'.$web[363].'"><i class="frm-lock" title="'.$web[363].'"></i></a>';
                if ($forum[5] != '') {
                    $out .= '
          &nbsp;<a href="'.$url6.$z2.'" title="'.$web[364].'"><i class="frm-lockup" title="'.$web[364].'"></i></a>';
                }
            }
        }
		$mrposline = stripos($fieldc1, '<p class="text-right thsign">');
		if (is_numeric($mrposline) && $mrposline > 0)
			$fieldc1 = str_replace('<p class="text-right thsign">', '<p class="text-end thsign">', $fieldc1);
        $out .= '
        </div>
      </div>
    </div>
    <div class="col-md-9 px-0 pt-2">
      <div class="rep text-left mx-1 thbodycontentW"><br />'.$fieldc1.'</div>
      <div class="text-left thbodybottom">';
        if ($prt == 0 && $serviz[107] == 'on' && empty($prt)) {
            include CONFIGREP.'sncode.inc';
            if (!empty($coders))
                $out .= '
	    <div class="thcoders">'.$coders.'</div>';
        }
        $out .= '
	    <div class="w-100">';
        if ($fieldd1 == 'on') $out .= 
		    displayWriteEmail(TYP_THREAD, $author, $email, ' <i class="far fa-envelope m-2 mt-3 align-middle themail" title="'.$web[173].' '.$author.'"></i>');
        if ($fieldweb != '') $out .= '
          <a href="'.$fieldweb.'" target="_blank" title="">
            <i class="fas fa-globe m-2 mt-3 align-middle" title="'.$web[304].' '.$author.'"></i>
          </a>';
        if (empty($prt)) $out .= 
            displayQuickConfig(NULL, $fileid, 'forum&amp;form=2&amp;id='.$fileid, 'forum&amp;act=i&amp;id='.$fileid, 'forum&amp;del='.$fileid, 23);
        $out .= '
	      <div class="float-right m-2">';
        if ($st[0] != 'c') $out .= '
            <a class="mr-3" title="" href="'.($site['URLR'] == 'on' ? 
                $lng.'-'.$urlrw[14].'-2-'.TYP_THREAD.'-'.$thread.'-'.$fileid.$z2 : 
                $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_THREAD.'&amp;num='.$thread.'&amp;pg='.$fileid.$z2).'">
              <i class="frm-reponse align-middle m-2 thimgrepW" title="'.$web[65].'"></i>
		    </a>';
        else $out .= '
            <i class="frm-rep-lock align-middle m-2 thimgrepW" title="'.$web[366].$web[368].'"></i>';
        $out .= '
            <a href="#top" title=""><i class="far fa-caret-square-up m-2 align-middle" title="'.$web[136].'"></i></a>&nbsp;&nbsp;
	      </div>
          <div class="clearfix"> </div>
	    </div>';
        $out .= '
      </div>
    </div>
  </div>';
        $dbder = ReadDBFields(DBFORUM);
        for ($i = 0; $i < count($dbder); $i++) {
            if($fielda1 == $dbder[$i][1] && $dbder[$i][7] > 3 && empty($prt)) {
                $idder = ceil(count($dbthrd) / intval($serviz[20]));
                $out  .= '
  <form 
    action="'.($site['URLR'] == 'on' ? 
      $lng.'-'.$urlrw[5].'-5-'.$this->pg.'-'.$this->cat.'-'.$idder.'#R'.$dbder[$i][7] : 
      $site['TH'].'.php?lng='.$lng.'&amp;pg='.$this->pg.GetOptionnalArg('cat', $this->cat).GetOptionnalArg('id', $idder).'#R'.$dbder[$i][7]).'" 
    method="post">
    <p class="text-right">
      '.SubmitButton($web[283]).'
    </p>
  </form>';
                break;
            }
        }
        if (empty($this->id)) $this->id = 1;
       if (is_array($dbthrd)) {
			if (count($dbthrd) > 0)
			{
				if (3 == abs($prt)) {
					$this->id = 1;
					$serviz[20] = 99999;
				}
				$out .= GetNavBar(($site['URLR'] == 'on' 
						? $lng.'-'.$urlrw[5].'-5-'.$this->pg.'-'.$this->cat.'-' 
						: $site['TH'].'.php?lng='.$lng.'&amp;pg='.$this->pg.GetOptionnalArg('cat', $this->cat).'&amp;id='), 
						count($dbthrd), $this->id, $serviz[20], $z2);
				for ($i = $serviz[20]*($this->id-1); $i < Min($serviz[20]*$this->id, count($dbthrd)); $i++) {
					ReadDoc($dbthrd[$i][3]);
					if ($fieldd2 != 'v' && $fieldd2 != '') {
						$nbrpostmsg = $fieldd2.' '.($fieldd2 > 1 ? $web[335] : $web[334]);
					} else {
						$nbrpostmsg='';
					}
					if ($fieldd2=='v' || !FileDBExist(MSGREP.$author.DBEXT)) {
						$inscrit = $web[15];
					} elseif($forum[7] == '') {
						$inscrit = '';
					} elseif($fieldd2 >= $max[3]) {
						$inscrit = '<i class="frm-rank5" title="'.$nbrpostmsg.'"></i>';
					} elseif($fieldd2 >= $max[2]) {
						$inscrit = '<i class="frm-rank4" title="'.$nbrpostmsg.'"></i>';
					} elseif($fieldd2 >= $max[1]) {
						$inscrit = '<i class="frm-rank3" title="'.$nbrpostmsg.'"></i>';
					} elseif($fieldd2 >= $max[0]) {
						$inscrit = '<i class="frm-rank2" title="'.$nbrpostmsg.'"></i>';
					} else {
						$inscrit = '<i class="frm-rank1" title="'.$nbrpostmsg.'"></i>';
					}
					if ($page[23] != 'none') {
						if($fieldc2 == '') {
							$fieldc2 = '<i class="ava-00 ava-th" title="'.$web[305].'"></i>';
						} else {
							if (is_file(MSGREP.$author.DBEXT)) {
								$userdb  = ReadDBFields(MSGREP.$author.DBEXT);
								if (!empty($userdb[1][16]) || $userdb[1][9] != 'ava-00') {
									if ($userdb[1][9] == 'ava-00' && !empty($userdb[1][16])) 
										$fieldc2 = '<img class="ava-th" src="'.$userdb[1][16].'" alt="'.$author.'" title="'.$author.'" />';
									else 
										$fieldc2 = '<i class="'.$userdb[1][9].' ava-th" title="'.$author.'"></i>';
								}
								elseif ($userdb[1][9] == 'ava-00') {
									$fieldc2 = '<i class="ava-00 ava-th" title="'.$author.'"></i>';
								}
							} 
							else 
								$fieldc2 = '<i class="ava-00 ava-th" title="'.$author.'"></i>';
						}
					}
					$out .= '
	  <a id="R'.$fielda2.'"></a>
	  <div class="row w-100 thbody">
		<div class="col-md-3 my-2 rep text-center">
		  <div class="row">
			<div class="col-md-12">';
					$newdate = date('YmdHi', time() - (86400 * $forum[8]));
					if ($newdate < $creadate) $out .= '
			  <i class="frm-msg_n" title="'.$web[171].'"></i>';
					$out .= '
			  <div><b>'.$web[68].' '.$fielda2.'</b></div>
			  <div>--------</div>
			  <div>'.$web[7].' '.FormatDate($creadate).'</div>
			  <div>'.$web[6].' <b>'.addslashes($author).'</b></div>
			  <div class="my-2">'.($page[23] != 'none' ? $fieldc2 : '&nbsp;').'</div>
			</div>
			<div class="col-md-12">';
					if ($author == $serviz[31] || $author == $serviz[176]) 
						$out .= '
			  <div class="my-2">'.$web[418].'</div>';
					elseif (is_file(CHEMIN.'admin/redac/'.$author.'.inc')) {
						include CHEMIN.'admin/redac/'.$author.'.inc';
						if (!empty($drtuser[30])) $out .= '
			  <div class="my-2">'.$drtuser[30].'</div>';
					} 
					else {
						for ($y = 0; $y < count($rank); $y++) {
							if ($rank[$y][0] == $author) {
								switch ($rank[$y][1]) {
								case 'admin' :
									$out .= $web[418].'<br />';
									break;
								case 'modo' :
									$out .= $web[420].'<br />';
									break;
								case 'redac' :
									$out .= $web[419].'<br />';
									break;
								case 'webm' :
									$out .= $web[11].'<br />';
									break;
								}
							}
						}
					}
					$out .= $inscrit;
					if ($st[0] != 'c' && $st[0] != 's') {
						if ($author == $userprefs[1] || $modadmin == 'yes' || $serviz[31] == $userprefs[1] || $serviz[176] == $userprefs[1]) {
							if ($st[0] != 'c' && $st[0] != 's') {
								$url = $site['URLR'] == 'on' 
								  ? $lng.'-'.$urlrw[14].'-1-'.TYP_THREAD.'-maj-'.$thread.'-'.$fileid.$z2 
								  : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_THREAD.'&amp;mod=maj&amp;num='.$thread.'&amp;pg='.$fileid.$z2;
								$out .= '
			  &nbsp;<a href="'.$url.'" title="'.$web[369].'"><i class="far fa-edit"></i></a>';
							}
						}
					}
					$out .= '
			</div>
		  </div>';
			$mrposline = stripos($fieldc1, '<p class="text-right thsign">');
			if (is_numeric($mrposline) && $mrposline > 0)
				$fieldc1 = str_replace('<p class="text-right thsign">', '<p class="text-end thsign">', $fieldc1);              
			$fieldc1 = stripslashes($fieldc1);

					$out .= '
		  </div>
		  <div class="col-md-9 px-0 pt-2">
			<div class="rep text-left mx-1 thbodycontentW"><br />'.$fieldc1.'</div>
			<div class="text-left thbodybottom">';
					if ($fieldd1 == 'on') $out .= 
						displayWriteEmail('thread'.$i, $author, $email, ' <i class="far fa-envelope m-2 mt-3 align-middle themail" title="'.$web[173].' '.$author.'"></i>');
					if ($fieldweb != '') $out .= '
			  <a href="'.$fieldweb.'" target="_blank" title="">
				<i class="fas fa-globe ml-2 mt-3 align-middle thimgsiteW" title="'.$web[304].' '.$author.'"></i>
			  </a>';
					if (empty($prt)) $out .= 
						displayQuickConfig(NULL, $fileid, 'forum&amp;form=2'.GetOptionnalArg('id', $fileid), 
						  'forum&amp;act=i'.GetOptionnalArg('id', $fileid), 'forum'.GetOptionnalArg('del', $fileid), 23);
					$out .= '
			  <div class="float-right m-2">';
					if ($st[0] != 'c') $out .= '
				<a class="mr-3" title="" href="'.($site['URLR'] == 'on' 
					? $lng.'-'.$urlrw[14].'-2-'.TYP_THREAD.'-'.$thread.'-'.$fileid.$z2 
					: $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_THREAD.'&amp;num='.$thread.'&amp;pg='.$fileid.$z2).'">
				  <i class="frm-reponse m-2 align-middle thimgrepW" title="'.$web[65].'"></i> 
				</a>';
			else $out .= '
				<i class="frm-rep-lock m-2 align-middle thimgrepW" title="'.$web[366].$web[368].'"></i>';
			$out .= '
				<a href="#top" title=""><i class="far fa-caret-square-up align-middle" title="'.$web[136].'"></i></a>&nbsp;&nbsp;
			  </div>
			  <div class="clearfix"></div>
			</div>
		  </div>
		</div>';
				}
			}
		} // pas vide
		$nbrthcount = '';
       if (is_array($dbthrd))  $nbrthcount = count($dbthrd) > 0;
		$out .= GetNavBar(($site['URLR'] == 'on' 
				  ? $lng.'-'.$urlrw[5].'-5-'.$this->pg.'-'.$this->cat.'-' 
				  : $site['TH'].'.php?lng='.$lng.'&amp;pg='.$this->pg.GetOptionnalArg('cat', $this->cat).'&amp;id='), 
				  $nbrthcount, $this->id, $serviz[20], $z2);
		if (empty($this->fid)) $this->fid = 1;
				$out .= '
		  <div class="w-100 text-left thmsgicons">
			<div>
			  <i class="frm-msg_a valign-4" title="'.$web[367].'"></i> '.$web[366].$web[367].' &nbsp;
			  <i class="frm-msg_c valign-4" title="'.$web[368].'"></i> '.$web[366].$web[368].' &nbsp;
			  <i class="frm-msg_t valign-4" title="'.$web[370].'"></i> '.$web[370].' &nbsp;
			  <i class="frm-msg_n valign-4" title="'.$web[371].'"></i> '.$web[371].' &nbsp;
			</div>
			<div>
			  <i class="far fa-edit" title="'.$web[334].'"></i> '.$web[369].' '.$web[334].' &nbsp;
			  <i class="frm-lock valign-1" title="'.$web[363].'"></i> '.$web[363].$web[366].' &nbsp;
			  <i class="frm-lockup valign-1" title="'.$web[364].'"></i> '.$web[364].$web[366].' &nbsp;'
			  .($userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176] ? '
			  <i class="frm-unlock valign-1" title="'.$web[621].'"></i> '.$web[621].$web[366].' &nbsp;
			  <i class="frm-moveto valign-1" title="'.$web[632].'"></i> '.$web[632].$web[366] : '').'
			</div>
		  </div>';
				if (empty($prt)) {
				$out .= '
		  <div class="w-100 text-right">';
					if (!empty($dbworkcat)) {
						$out .= '
			<div class="d-inline-block text-right mt-2 mr-3 thselcat">
			  <div class="d-inline-block">
				<a href="'.($site['URLR'] == 'on' 
					? $lng.'-'.$urlrw[5].'-31-'.$this->tconfig.$z2 
					: $site['FR'].'.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" title="'.$web[130].'">
				  <i class="fas fa-folder-open"></i> &nbsp;<b>'.$this->nom_frth.'</b>
				</a>&nbsp;
			  </div>
			  <div class="d-inline-block">
				<form method="post" action="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[5].'-31'.$z2 : $site['FR'].'.php?lng='.$lng.$z2).'">
				  <select name="cat" onchange="this.form.submit();" class="form-control align-middle c-pointer">';
						foreach ($dbworkcat as $dbw) {
							$out .= '
					<option value="'.$dbw[0].'" '.Selected($dbw[0] == $this->cat).'>'.$dbw[1].'</option>';
						}
						$out .= '
				  </select>
				</form>
			  </div>
			</div>';
					}
					$out .= '
			<div class="d-inline-block thretbutton">
			  <form 
				action="'.($site['URLR'] == 'on' 
				  ? $lng.'-'.$urlrw[5].'-22-'.$this->cat.'-'.$this->fid.$z2 
				  : $site['FR'].'.php?lng='.$lng.GetOptionnalArg('cat', $this->cat).GetOptionnalArg('id', $this->fid).$z2).'" 
				method="post">
			  '.SubmitButton($web[70]).'
			  </form>
			</div>';
					$out .= '
		  </div>';
				}
				$out .= '
		</div>
		';
				return array($this->frtyp, $out);
    }
    
    public function THA_content() {
        global $userprefs, $web, $page, $serviz, $urlrw, $site, $lng, $prt, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $out    = '';
        $thread = 0;
        if (!empty($this->pg)) {
            $dbwork = SelectDBForumByID(ReadDBFields(DBFORUMARCH), $this->pg);
            if (count($dbwork) != 0) {
                $thread    = $dbwork[0][1];
                $this->cat = $dbwork[0][12];
            }
        }
        elseif (!empty($this->thrd)) {
            $dbwork = ReadDBFields(DBTHREADARCH);
            foreach ($dbwork as $dbw) {
                if ($dbw[1] == $thrd && $dbw[2] == '0') {
                    $thread    = $this->thrd;
                    $this->pg  = $dbw[3];
                    $this->cat = $dbw[8];
                }
            }
        }
		$dbthrd = array();
        if ($serviz[34] == 'on') $threadcounter = UpdateDocCounterArch($this->pg);
        $dbthrd = SelectDBThreadByThread(ReadDBFields(DBTHREADARCH),$thread);
        @sort($dbthrd);
        ReadDoc($this->pg, ARCHDBBASE);
        if ((CheckGroup($this->cat, $userprefs[1]) != 1 && !is_numeric($this->cat)) ||
            (preg_match('/^pr/i', $fieldb2) && (CheckGroup($fieldb2, $userprefs[1]) != 1))) {
            $href1 = $site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng;
            return array($this->frtyp, 1, $href1);
        }
        if (!empty($this->cat)) {
            $catxt   = getForumCatName($this->cat);
            $topmess = '<a href="'.($site['URLR'] == 'on' ? 
                $lng.'-'.$urlrw[5].'-6-'.$this->tconfig.$z2 : 
                'fortopicarch.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'">'.$web[226].'</a> - <a href="'.($site['URLR'] == 'on' ? 
                    $lng.'-'.$urlrw[5].'-35-'.$this->cat.$this->fid.$z2 : 
                    'forumarch.php?lng='.$lng.GetOptionnalArg('cat', $this->cat).GetOptionnalArg('id', $this->fid).$z2).'">'.$catxt.'</a> - '.$web[63].$fielda1;
        }
        else 
            $topmess = '<a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[5].'-6-'.$this->tconfig.$z2 : 
                'fortopicarch.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'">'.$web[226].'</a> - '.$web[63].$fielda1;
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        $out .= '
<div class="bord tharchmain">
  <div class="table-responsive-md">
  <div class="d-table w-100">
    <div class="d-table-row">
      <div class="forum d-table-cell width25 tharchsubject">'.$web[63].$fielda1.'</div>
      <div class="forum2 d-table-cell width75">
        <b>'.$fieldb1.'</b>
        <br />
        &nbsp;&nbsp;&nbsp;'.$web[6].' ';
        if ($fieldd1 != 'on') $out .= 
            displayWriteEmail('threadarch1', $author, $email);
        else $out .= '
        <b>'.$author.'</b>';
		$mrposline = stripos($fieldc1, '<p class="text-right thsign">');
		if (is_numeric($mrposline) && $mrposline > 0)
			$fieldc1 = str_replace('<p class="text-right thsign">', '<p class="text-end thsign">', $fieldc1);
        $out .= '
      '.$web[7].' '.FormatDate($creadate).'
      </div>
    </div>
  </div>
  </div>
  <div class="table-responsive-md">
  <div class="d-table w-100">
    <div class="d-table-row">
      <div class="quest d-table-cell w-100">'.$fieldc1.'</div>
    </div>
  </div>
  </div>
</div>';
        if (empty($this->id)) $this->id = 1;
        if (!empty($dbthrd)) {
            if (3 == abs($prt)) {
                $this->id = 1;
                $serviz[20] = 99999;
            }
            for ($i = $serviz[20]*($this->id-1); $i < Min($serviz[20]*$this->id, count($dbthrd)); $i++) {
                ReadDoc($dbthrd[$i][3], ARCHDBBASE);
                $out .= '
<div class="bord trarchmain">
  <div class="table-responsive-md">
  <div class="d-table w-100">
    <div class="d-table-row">
      <div class="quest d-table-cell text-center">'.$web[68].$fielda2.'</div>
      <div class="quest d-table-cell width85">'.$web[6].' ';
                if ($fieldd1 != "on") {
                    $out .= displayWriteEmail('threadarch2'.$i, $author, $email);
                }
                else {
                    $out .= '<b>'.$author.'</b>';
                }
		$mrposline = stripos($fieldc1, '<p class="text-right thsign">');
		if (is_numeric($mrposline) && $mrposline > 0)
			$fieldc1 = str_replace('<p class="text-right thsign">', '<p class="text-end thsign">', $fieldc1);
                $out .= '
      '.$web[7].' '.FormatDate($creadate).'
      </div>
    </div>
  </div>
  </div>
  <div class="table-responsive-md">
  <div class="d-table w-100">
    <div class="d-table-row">
      <div class="rep d-table-cell" colspan="2">'.$fieldc1.'</div>
    </div>
  </div>
  </div>
</div>';
            }
        }
        if (count($dbthrd)>$serviz[20]) $out .= '
<hr />'.GetNavBar(($site['URLR'] == 'on' ? 
    $lng.'-'.$urlrw[5].'-52-'.$this->pg.'-'.$this->cat.'-' : 
    'threadarch.php?lng='.$lng.'&amp;pg='.$this->pg.GetOptionnalArg('cat', $this->cat).'&amp;id='), count($dbthrd), $this->id, $serviz[20], $z2);
        $out .= '
<p class="text-center">
  <a href="'.($site['URLR'] == 'on' ? 
    $lng.'-'.$urlrw[5].'-35-'.$this->cat.'-'.$this->fid.$z2 : 
    'forumarch.php?lng='.$lng.GetOptionnalArg('cat', $this->cat).GetOptionnalArg('id', $this->fid).$z2).'">'.$web[70].'</a>
</p>';
        return array($this->frtyp, $out);
    }
}
?>
func_blogboxes.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/func_blogboxes.php'
View Content
<?php
/*******************************************************************************
 *   Functions for blog boxes
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.07 (February 24, 2022) : adaptation to php 8.1
 ******************************************************************************/
 
if (stristr($_SERVER['SCRIPT_NAME'], 'func_blogboxes.php')) {
  header('location:../index.php');
  die();
}

################################################################################

function isBlogPage() {
    global $site;
    $sname = substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '/') + 1, -4);
    return 1 == preg_match('!'.$site['BLS'].'|'.$site['BL'].'|blogsarch|blogarch|blogrss!', $sname);
}

################################################################################

function fbox_blogcat($pos = NULL, $args = NULL) {
    global $pg, $lng, $lang, $drtuser, $serviz, $texte, $userprefs, $web, $dynabox, $site, $urlrw, 
           $page, $tconfig, $creadate, $moddate, $members, $z2;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[15])) return FALSE;
    if ($serviz[53] != 'on') return FALSE;
    $dbr = ReadDBFields(DBBRUB);
    sort($dbr);
    $j    = ($lng == $lang[0]) ? 0 : 1 ;
    $dbw  = array();
    $dbw0 = ReadDBFields(DBBLOG);
    $dbw1 = array();
    foreach ($dbr as $rub) {
        $dbw2 = SelectDBFieldsByField($dbw0, $j, $rub[$j]);
        @rsort($dbw2);
        $dbw1 = array_merge($dbw1, $dbw2);
    }
    unset($dbw0);
    foreach ($dbw1 as $db) {
        if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
            $dbw[] = $db;
        }
    }
    unset($dbw1);
    if (!empty($dbw) && NULL != $pos) {
        $out       = '';
     	$k         = 0;
     	$txtbi     = array();
     	$curr_rubr = '';
     	$curr_bi   = '';
     	for ($i = 0; $i < count($dbw); $i++) {
            if (trim($dbw[$i][0+$j]) != '') {
                $dates = explode('-', $dbw[$i][5]);
                $txtbi[$k][0] = trim($dbw[$i][0+$j]).$dates[0];
                $txtbi[$k][1] = trim($dbw[$i][0+$j]);
                $txtbi[$k][2] = trim($dbw[$i][2+$j]);
                $txtbi[$k][3] = $dbw[$i][4];
                if ($pg == $dbw[$i][4]) {
                    $curr_rubr = $txtbi[$k][1];
                    $curr_bi = $txtbi[$k][3];
                }
                $k++;
            }
     	}
     	@rsort($txtbi);
    	$typeRubrique = 'blog'.$nbox;
     	$rubr         = '';
     	$marqueur     = $texte[3];
     	$curr_marq    = '<i class="fas fa-caret-right puce"></i>';
     	$url          = CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[1].'-2-pg-'.$tconfig.'-' 
          : $site['BL'].'.php?lng='.$lng.'&amp;sel=pg&amp;tconfig='.$tconfig.'&amp;pg=');
     	$out .= '';
        switch ($serviz[59]) {
        case "0" : // liste de menu
            for ($i = 0; $i < count($txtbi); $i++) {
				ReadDoc($txtbi[$i][3]);
				$img = getNewUpdateDoc($creadate, $moddate, $serviz[138]);
				if ($rubr <> $txtbi[$i][1]) {
					if (!empty($rubr)) {
						$out .= '
  </ul>';
					}
					$rubr = $txtbi[$i][1];
					$out .= '
  <p class="item">'.$rubr.'</p>
  <ul class="item">';
				}
				if ($curr_bi == $txtbi[$i][3]) {
					$out .= '
    <li class="curr_item">'.$curr_marq.' <a href="'.$url.$txtbi[$i][3].$z2.'">'.$img.$txtbi[$i][2].'</a>';
				}
				else {
                $out .= '
    <li class="item">'.$marqueur.' <a href="'.$url.$txtbi[$i][3].$z2.'">'.$img.$txtbi[$i][2].'</a>';
				}
				$out .= '
    </li>';
			}
        $out .= '
  </ul>';
            break;

     	case "1" : // menu dynamique
       	    $out .= '
  <form name="blog'.$nbox.'" action="" method="post">
    <p class="text-center">';
            for ($i = 0; $i < count($txtbi); $i++) {
				ReadDoc($txtbi[$i][3]);
				$img = getNewUpdateDoc($creadate, $moddate, $serviz[138]);
            	if ($rubr <> strip_tags($txtbi[$i][1])) {
            		if (!empty($rubr)) {
                        $out .= '
      </select>';
                    }
                    $rubr   = strip_tags($txtbi[$i][1]);
                    $maxlen = max(strlen($rubr), 25);
                    $out   .= '
      <select size="1" onchange="document.blog'.$nbox.'.action=this.value; document.blog'.$nbox.'.submit();" class="form-control c-pointer selBlogCat">
        <option>'.$rubr.'</option>';
                }
                $out .= '
        <option value="'.$url.$txtbi[$i][3].$z2.'">&nbsp;&nbsp;'.$marqueur.'&nbsp;'.$img.substr(strip_tags($txtbi[$i][2]), 0, $maxlen).'</option>';
            }
            if (!empty($rubr)) {
                $out .= '
      </select>';
            }
            $out .= '
    </p>
  </form>';
            break;
            
        case "2" : // menu liste dynamique n°1
    		$openimg = 'far fa-plus-square';
    		$closeimg = 'far fa-minus-square';
        case "3" : // menu liste dynamique n°2
          	if ($serviz[59] == "3") {
                $openimg = 'fas fa-chevron-right';
                $closeimg = 'fas fa-chevron-up';
          	}
            $l = 0;
			$isNew = false;
          	for ($i = 0; $i < count($txtbi); $i++) {
				ReadDoc($txtbi[$i][2]);
				$img = getNewUpdateDoc($creadate, $moddate, $serviz[138]);
				if ($img != '') $isNew = true;
           		if ($rubr <> $txtbi[$i][1]) {
           			if (!empty($rubr)) {
                        $out .= '
  </ul>';
                    }
             		$rubr   = $txtbi[$i][1];
             		$rubric = '
    <a href="'.CHEMIN.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[1].'-3-cat-'.$txtbi[$i][1].$z2 
      : $site['BLS'].'.php?lng='.$lng.'&amp;sel=cat&amp;cat='.$txtbi[$i][1].$z2).'">'.$txtbi[$i][1].'
    </a>';
                    $l++;
                    $out .= '
      <p id="titreRubr'.$typeRubrique.$l.'" class="rubr c-pointer" 
        onclick="MontreCacheItems(\'imgOpen'.$typeRubrique.$l.'\',\'imgClose'.$typeRubrique.$l.'\',\'itemsRubr'.$typeRubrique.$l.'\',\'itemsRubrSelect'.$nbox.'\');">
        <i id="imgOpen'.$typeRubrique.$l.'" class="'.$openimg.'" title="'.$web[429].'" style="display: none;"></i>
        <i id="imgClose'.$typeRubrique.$l.'" class="'.$closeimg.'" title="'.$web[57].'"></i>&nbsp;'.@$item['txt'].' '.$rubr.'
      </p>';
    				if ($curr_rubr == $txtbi[$i][1]) {
         			    $out .= '
  <ul id="itemsRubrSelect'.$nbox.'" class="item"> ';
    				}
                    else {
                        $out .= '
  <ul id="itemsRubr'.$typeRubrique.$l.'" class="item">';
    				}
                }
                if ($curr_bi == $txtbi[$i][3]) {
                    $out .= '
    <li class="curr_item">'.$curr_marq.' <a href="'.$url.$txtbi[$i][3].$z2.'">'.$img.$txtbi[$i][2].'</a></li>';
                }
                else {
                    $out .= '
    <li class="item">'.$marqueur.' <a href="'.$url.$txtbi[$i][3].$z2.'">'.$img.$txtbi[$i][2].'</a></li>';
                }
            }
            if (!empty($rubr)) {
                $out .= '
  </ul>';
            }
            if ($userprefs[1] == '' || !$isNew) $out .= '
<script>
var nbRubr = '.($l+1).';
var typeRubr = "'.$typeRubrique.'";
for(var i = 0; i < nbRubr; i++) {
 if((document.getElementById && document.getElementById(\'itemsRubr\'+ typeRubr + i) != null) || (document.all && document.all[\'itemsRubr\'+ typeRubr + i] != undefined ) || (document.layers && document.layers[\'itemsRubr\'+ typeRubr + i] != undefined) ) {
  cache(\'itemsRubr\'+ typeRubr + i);
  montre(\'imgOpen\'+ typeRubr + i,\'inline\');
  cache(\'imgClose\'+ typeRubr + i);
 }
}
</script>';
            break;
        }
        $out  .= '<div class="dispqcBlogCat">'.displayQuickConfig(NULL, false, 'blog', '', '', 39).'</div>';
        $titre = DisplayDownArrow($dynabox[10], 'CATBG'.$nbox.$pos.$tconfig).$web[400];
        return boxthin('BG', $titre, $out, ' CATBG'.$nbox.$pos.$tconfig, $dynabox[10]);
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_blogcom($pos = NULL, $args = NULL) {
    global $lng, $lang, $serviz, $web, $dynabox, $site, $urlrw, $tconfig, $members, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[15])) return FALSE;
    if ($serviz[53] != 'on') return FALSE;
    $dbwr   = array();
    $dbreac = ReadDBFields(DBREBLOG);
    foreach ($dbreac as $reac) {
        $dates  = explode('-', $reac[5]);
        $dbwr[] = array($dates[0], $reac[0]); 
    }
    unset($dbreac);
    @rsort($dbwr);
    if (!empty($dbwr) && $serviz[57] != '' && NULL != $pos) {
        $out = '';
        for ($i = 0; $i < min($serviz[61], count($dbwr)); $i++) {
            ReadDoc($dbwr[$i][1]);
			$img = getNewUpdateDoc($creadate, $moddate, $serviz[138]);
            if (isAccessGranted($fieldmod) && isAuthorizedPublication($creadate)) {
                $reac0 = $fieldc1; //($lng == $lang[0])? $fieldc1 : $fieldc2 ;
                $reac1 = formatDate($creadate);
                $reac2 = $fielda2;
                if (!empty($reac0) && ($status == "a")) {
                    $out .=  '
  <div class="text-left itemBlogBoxW">
    '.$reac1.'
    <br />
    <a href="'.CHEMIN.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[1].'-2-pg-'.$tconfig.'-'.$reac2.$z2 
        : $site['BL'].'.php?lng='.$lng.'&amp;sel=pg&amp;tconfig='.$tconfig.'&amp;pg='.$reac2.$z2).'" title="'.$web[297].'">
      '.$img.CutLongWord(strip_tags($reac0), 80).' ...
    </a>
  </div>';
                }
            }
        }
        $titre = DisplayDownArrow($dynabox[12], 'COMBG'.$nbox.$pos.$tconfig).$web[401];
        return boxthin('BG', $titre, $out, ' COMBG'.$nbox.$pos.$tconfig, $dynabox[12]);
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_bloglast($pos = NULL, $args = NULL) {
    global $lng, $lang, $serviz, $web, $dynabox, $site, $urlrw, $tconfig, $members, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[15])) return FALSE;
    if ($serviz[53] != 'on') return FALSE;
    $dbw0 = ReadDBFields(DBBLOG);
    $dbw1 = array();
    $j    = ($lng == $lang[0])? 0 : 1 ;
    foreach ($dbw0 as $db) {
        if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
			  ReadDoc($db[4]);
			if ($fileid != "") 
			{
				$dates  = explode('-', $db[5]);
				$dbw1[] = array($dates[0], $db[4], trim($db[0+$j])); 
			}
        }
    }
    @rsort($dbw1);
    if (!empty($dbw1) && NULL != $pos) {
        unset($dbw0);
        $out = '';
        for ($i = 0; $i < min($serviz[61], count($dbw1)); $i++) {
            $out .=  ' 
  <div class="text-left itemBlogBoxW">';
            if ($dbw1[$i][2] != "") {
                ReadDoc($dbw1[$i][1]);
				$img   = getNewUpdateDoc($creadate, $moddate, $serviz[138]);
				$sujet = ($lng == $lang[0])? $fieldb1 : $fieldb2 ;
				$sujet = $img.CutLongWord(strip_tags($sujet), 60).' ...';
				$out .=  '
				'.formatDate($creadate).'
				<br />
				<a href="'.CHEMIN.($site['URLR'] == 'on' 
					? $lng.'-'.$urlrw[1].'-2-pg-'.$tconfig.'-'.$fileid.$z2 
					: $site['BL'].'.php?lng='.$lng.'&amp;sel=pg&amp;tconfig='.$tconfig.'&amp;pg='.$fileid.$z2).'" title="'.$web[297].'">
				  '.$sujet.'
				</a>';
			}
            $out .=  '
  </div>';
        }
        $titre = DisplayDownArrow($dynabox[11], 'LSTBG'.$nbox.$pos.$tconfig).$web[382];
        return boxthin('BG', $titre, $out, ' LSTBG'.$nbox.$pos.$tconfig, $dynabox[11]);
    } else {
        unset($dbw0);
        return FALSE;
    }
}

################################################################################

function fbox_blogcal($pos = NULL, $args = NULL) {
    global $lng, $lang, $nom, $drtuser, $page, $serviz, $userprefs, $web, $dynabox, $site, $urlrw, 
        $tconfig, $charset, $members;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[15])) return FALSE;
    if ($serviz[53] == 'on') {
		$hcal = '190';
        $out = '
<script>
function getElement(aID) {
    return (document.getElementById) ? document.getElementById(aID) : document.all[aID];
}
function getIFrameDocument(aID){ 
    var rv = null; 
    var frame=getElement(aID);
    if (frame.contentDocument)
      rv = frame.contentDocument;
    else // bad Internet Explorer  ;)
      rv = document.frames[aID].document;
    return rv;
  }
    
function adjustMyFrameHeight'.$nbox.$pos.$tconfig.'() {
	var frame = getElement("bcalbox'.$nbox.$pos.$tconfig.'");
	var frameDoc = getIFrameDocument("bcalbox'.$nbox.$pos.$tconfig.'");
	frame.height = frameDoc.body.offsetHeight + 2;
}
</script>
<noscript>';
		$hcal = '340';
		$out .= '
</noscript>
<div class="cal text-center m-auto bg-inherit">
  <iframe 
    class="cal" 
    id="bcalbox'.$nbox.$pos.$tconfig.'" 
    src="'.CHEMIN.'inc/'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[1].'-500-'.$pos.'-'.$tconfig.'-'.$nbox 
      : 'blogcal.php?lng='.$lng.'&amp;pos='.$pos.'&amp;tconfig='.$tconfig.'&amp;nbox='.$nbox).'" 
    height="'.$hcal.'">
  </iframe>
</div>
';
        $titre  = DisplayDownArrow($dynabox[13], 'CALBG'.$nbox.$pos.$tconfig).$web[395];
        $out   .= displayQuickConfig($pos, false, 'agenda', '', '', 37);
        return '
<div class="'.$pos.$tconfig.'BG'.$nbox.'">'.boxthin($pos, $titre, $out, ' CALBG'.$nbox.$pos.$tconfig, $dynabox[13]).'</div>';
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_blogarch($pos = NULL, $args = NULL) {
    global $lng, $lang, $web, $site, $urlrw, $tconfig, $dynabox, $serviz, $members, $z2;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[15])) return FALSE;
    if ($serviz[53] != 'on') return FALSE;
	$archdate = ReadCounter(DBBLOGARCHDATE);
	if ($archdate > 0) {
        $sname = substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '/') + 1, -4);
        $mode  = 1 == preg_match('!blogsarch|blogarch!', $sname) ? 'actif' : '';
		if ($mode == '') {
			$out = '
<div class="text-center">
  '.$web[586].' '.FormatDate($archdate).'<br />'.$web[585].'<br />
  <a href="'.($site['URLR'] =='on' ? $lng.'-'.$urlrw[1].'-7'.$z2 : 'blogsarch.php?lng='.$lng.$z2).'"><b>'.$web[584].'</b></a>
</div>';
		} else {
			$out = '
<div class="text-center">
  '.$web[589].' '.FormatDate($archdate).'<br />'.$web[588].'<br />
  <a href="'.CHEMIN.($site['URLR'] =='on' ? $lng.'-'.$urlrw[1].$z2 : $site['BLS'].'.php?lng='.$lng.$z2).'"><b>'.$web[587].'</b></a>
</div>';
		}
        $titre = DisplayDownArrow($dynabox[18], 'ARCBG'.$nbox.$pos.$tconfig).$web[584];
        return boxthin($pos, $titre, $out, ' ARCBG'.$nbox.$pos.$tconfig, $dynabox[18]);
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_blogrss($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $serviz, $userprefs, $web, $dynabox, $site, $urlrw, $page, $tconfig, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
    $dbbss = ReadDBFields(DBBSS);
    sort($dbbss);
    if (!empty($dbbss) && $serviz[27] == 'on' && NULL != $pos) {
        $i   = $lng == $lang[0] ? 0 : 1;
        $out = '';
        for ($j = 0; $j < count($dbbss); $j++) {
            Readdoc($dbbss[$j][4]);
            $tconf = empty($fieldweb) ? 0 : ($fieldweb == 'ALL' ? $tconfig : $fieldweb);
            $out  .= '
  <div class="item itemRssBlog text-left">
    <a href="'.CHEMIN.($site['URLR'] =='on' 
      ? $lng.'-'.$urlrw[19].'-3-'.$dbbss[$j][4].'-'.$tconf.$z2 
      : 'blogrss.php?lng='.$lng.'&amp;id='.$dbbss[$j][4].'&amp;tconfig='.$tconf.$z2).'">'.$dbbss[$j][$i].'
    </a>
  </div>';
        }
        $titre = DisplayDownArrow($dynabox[14], 'RSSBG'.$nbox.$pos.$tconfig).$web[402];
        $out  .= '<div class="rssBlog">'.displayQuickConfig(NULL, false, 'bss', '', '', 41).'</div>';
        return boxthin($pos, $titre , $out, ' RSSBG'.$nbox.$pos.$tconfig, $dynabox[14]);
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_blog($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $page, $site, $serviz, $userprefs, $web, $tconfig, $z2, 
        $id, $prt, $headinc, $pg, $topmess, $widepage, $urlrw, $members;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    if (!isAccessGranted($members[15])) return FALSE;
    if ($serviz[53] != 'on') return FALSE;    
    $pg          = !empty($pg) ? $pg : '0';
    $out         = '';
    $max_height  = isset($site[33]) && $site[33] > 0 && empty($prt) ? $site[33] : 0;
    $max_height2 = isset($site[36]) && $site[36] > 0 && empty($prt) ? $site[36] : 0;
    $xdbw        = array();
    $dbwork = ReadDBFields(DBBLOG);
    foreach ($dbwork as $db) {
        if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) 
            $xdbw[] = array(TYP_BLOG, $db[5], $db[4], 'a');
    }
    unset($dbwork);
    if (!empty($xdbw)) {
        @rsort($xdbw);
        $minblog = intval($site[31]);
        $maxblog = Min(intval($site[31]), count($xdbw));
        $topmess = $maxblog == 1 ? $web[389] : sprintf($web[3], $maxblog);
        $id      = 1;
		$out    .= '
  <div class="text-center headCenterBlog">';
		if ($serviz[54] == 'on' && empty($prt)) {
			$rssblogurl = $site[3].sprintf(RSSBLOG, $lng);
			$out .= '
    <style>
      .headCenterBlog .overpop { padding-top: 20px; }
      .overpop a i { margin-top: -20px; }
    </style>
    <script>
      $(document).ready(function(){
        $(\'.rssBlog\').popover({
          title:"RSS",
          content:"'.$web[398].' : <br /><b> '.$rssblogurl.'</b>",
          trigger:"hover",
          placement:"auto",
          offset:"0 10 10 10",
          html:true
        });
      });
    </script>
    <div class="overpop pt-0 pl-2">
        <a href="'.CHEMIN.'newsrss.php?lng='.$lng.'&url=blog&tconfig='.$tconfig.$z2.'" class="rssBlog float-left">
          <i class="fas fa-rss"></i>
        </a>
    </div>';                            
        }
		$out .= '
    <div class="divnewline"></div>
  </div>';
        $nbrnvisi = count($xdbw) > $site[31] ? $site[31] : count($xdbw);
        for ($i = $minblog*($id-1); $i < $maxblog; $i++) {
            ReadDoc($xdbw[$i][2]);
            $txt0 = $fileid;
            $img  = getNewUpdateDoc($creadate, $moddate, $serviz[138]);
            if ($lng == $lang[0]) {
                $txt1 = $fieldb1;
                $txt2 = $fieldc1;
            }
            else {
                $txt1 = $fieldb2;
                $txt2 = $fieldc2;
            }
            if (!empty($txt2)) {
                if (!empty($fieldd2)) {
                    $txt1 = '<img src="'.CHEMIN.'img/'.$fieldd2.'" class="'.($serviz[153] == 'on' ? 'float-left' : 'float-right').'" alt="'.$fieldd2.'"/>'.$txt1;
                }
                $out .= '
	    <div class="bord">
		  <div class="quest '.($serviz[153] != 'on' ? 'text-left' : 'text-right').'">
		    <a href="'.$site[3].($site['URLR'] == 'on' 
                ? $lng.'-'.$urlrw[1].'-4-'.$fileid.$z2 
                : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2).'" title="'.$web[511].'">
              '.$img.'<b>'.$txt1.'</b>
            </a> &nbsp;';
                if ($serviz[114] != 'on') {
                    if ($fieldd1 == 'on' && !empty($email) && !empty($author)) {
                        $out .= '- &nbsp;'.$web[6].displayWriteEmail('blog'.$i, $author, $email);
                    }
                    elseif (!empty($author)) {
                        $out .= '- &nbsp;'.$web[6].'
            <b>'.$author.'</b>';
                    }
                }
                $out .= '
		  </div>';
                $txt3 = '';
                if (!empty($txt2)) {
                    $txt3 .= '
<style>
.text2Blog {
  max-height: '.($max_height > 0 ? $max_height.'px;' : 'auto;').'
  overflow: '.($max_height > 0 ? 'hidden;' : 'visible;').'
  padding: 4px;
  background: transparent;
}
</style>
		  <div id="blog3'.$i.'" class="w-100 rep blog3Blog">
            <div class="rep text2Blog">
              '.$txt2.'
            </div><div class="clearfix"></div>';
                    if ($max_height > 0) $txt3 .= '
            <p class="text-right c-pointer pr-5"> 
		      <a href="javascript:ActiveMenu(\'blog3\',\'blog2\',0,'.$nbrnvisi.','.$i.')" class="box" title="'.$web[296].'">
                '.$web[296].' <i class="far fa-plus-square"></i>
		      </a>
            </p>';
                    $txt3 .= '
		  </div>';
                    if ($max_height > 0) $txt3 .= '
	      <div id="blog2'.$i.'" class="w-100 rep blog2Blog" style="display:none;">'.$txt2.'
		    <p class="text-right c-pointer pr-5">
              <a href="#billet'.$pos.$i.'" title="'.$web[57].'" onclick="cache(\'blog2'.$i.'\');montre(\'blog3'.$i.'\')">
	            '.$web[57].' <i class="far fa-minus-square"></i>
              </a>
	        </p>
		  </div><div class="clearfix"></div>';
                }
                $out .= $txt3;
                if ($prt == 0 && $serviz[104] == 'on') {
                    include CONFIGREP.'sncode.inc';
                    if (!empty($coders))
                        $out .= '
		  <div class="text-left codersBlog">'.$coders.'</div>';
                }
                $out .= '
		  <div class="text-right align-middle footerItemBlog">
		    <form name="formblog'.$i.'" 
                action="'.CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[1].'-4-'.$fileid.$z2 
                  : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2).'" 
                method="post">
              <b>'.$web[394].'</b>'.FormatDate($creadate).'&nbsp;';
                if ($serviz[57] != "") {
                    $dbcom = ReadDBFields(DBREBLOG);
                    $nbcom = 0;
                    for ($k = 0; $k < count($dbcom); $k++) {
                        if ($dbcom[$k][1] == $txt0) {
                            ReadDoc($dbcom[$k][0]);
                            if ($status == 'a') {
                                $nbcom++;
                            }
                        }
                    }
                    $fileid = $txt0;
                    if ($nbcom == 0) {
                        $nbcom = $web[430].' '.$web[379];
                    } elseif ($nbcom == 1) {
                        $nbcom = $nbcom.' '.$web[379];
                    } else {
                        $nbcom = $nbcom.' '.$web[379].'s';
                    }
                    if ($serviz[57] != '2')
                        $out .= '
			  <a href="'.CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[1].'-4-'.$fileid.$z2 
                  : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2).'" title="'.$nbcom.' - '.$web[297].' '.$web[385].'">
                <span class="commentBlog"> - '.$nbcom.' -  </span>
			    <i class="far fa-comment align-middle commentBlogW" title="'.$nbcom.' - '.$web[297].' '.$web[385].'"></i>
			  </a> &nbsp;';
                }
                $out .= '
			  <input type="hidden" name="cat" value="'.$cat.'"/>
			  <input type="hidden" name="sel" value="'.$sel.'"/>';
                $rank     = ReadDBFields(ADMINS);
                $modadmin = '';
                for ($y = 0; $y < count($rank); $y++) {
                    if ($rank[$y][0] == $userprefs[1] && $rank[$y][2] == 'on') {
                        $modadmin = 'yes';
                        break;
                    }
                }
                if (($author == $userprefs[1] || $modadmin == 'yes' || $serviz[31] == $userprefs[1] || $serviz[176] == $userprefs[1]) && $site[30] != '2') {
                    $urlb = $site['URLR'] == 'on' 
                      ? $lng.'-'.$urlrw[14].'-11-'.TYP_BLOG.'-maj-'.$fileid.$z2 
                      : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_BLOG.'&amp;mod=maj&amp;pg='.$fileid.$z2;
                    $out .= '
              &nbsp;| <a href="'.$urlb.'" title="'.$web[369].'"><i class="far fa-edit"></i></a>&nbsp;';
                }
                if (empty($serviz[76]) && empty($prt)) {
                    $out .= '| 
			  <a href="'.CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[1].'-41-'.$fileid.'--1' 
                  : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;prt=-1').'" target="_blank">
			    <i class="far fa-eye align-middle" title="'.$web[264].'"></i>
			  </a>&nbsp;
			  <a href="'.CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[1].'-41-'.$fileid.'-1' 
                  : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;prt=1').'" target="_blank">
		        <i class="fas fa-print align-middle" title="'.$web[22].'"></i>
			  </a>&nbsp;';
                }
                if (empty($prt)) $out .= '
              <a href="#top" title="'.$web[136].'">| <i class="fas fa-arrow-up align-middle"></i></a>';
                $out .= '
		    </form>
          </div>
		</div>';
                if (empty($prt)) $out .= '
        <div class="qcItemBlog">
          '.displayQuickConfig($pos, $xdbw[$i][2], 'blog&amp;form=2&amp;id='.$xdbw[$i][2], 'blog&amp;act=i&amp;id='.$xdbw[$i][2], 'blog&amp;del='.$xdbw[$i][2], 39).'
        </div>';
            }
        }
        if ($page[9] != '') {
            $topmess = '<i class="fas fa-blog float-right pr-2"></i>'.$topmess;
        }
        return boxwide('BG'.$pos, $topmess, $out, ' BG'.$pos.$tconfig);
    }
    else {
        return false;
    }
}
?>
func_boxes.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/func_boxes.php'
View Content
<?php
/*******************************************************************************
 *   Functions for boxes
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.19 (August 26, 2024) : Box search after a config search
 ******************************************************************************/
 
if (stristr($_SERVER['SCRIPT_NAME'], 'func_boxes.php')) {
    header('location:../index.php');
    die();
}

################################################################################

function fbox_ariane($pos = NULL, $args = NULL) {
    global $lng, $lang, $nom, $page, $site, $web, $urlrw, $endurl, $npage, $pgtype, $topmess, $tconfig, $z2;
	$root   = $site[3].($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
    $stroot = strip_tags(getLabel($nom[($lng == $lang[0] ? 0 : 10)]));
	$sep    = '&raquo;';
    switch ($pgtype) {
    case 5 :
        $ariane = '<span class="arianeOff">'.$npage[5].'</span>';
        break;
    case 18 : // plugins
        if (isset($topmess) && !empty($topmess)) {
            $plugin_name = strip_tags($topmess);
        } else {
			$tmp = explode('/', $endurl);
			foreach ($tmp as $key=>$val) {
				if ($val == 'plugins') break;
			}
			$plugin_dirname = 'plugins/'.$tmp[$key + 1];
			$plugin_file    = CHEMIN.$plugin_dirname.'/plugin.inc';
            $plugin_name    = '';
            if (is_file($plugin_file)) {
                $plugin_bar_name = '';
                include $plugin_file;
                if (!empty($plugin_bar_name)) {
                    $plugin_name = $plugin_bar_name;
                }
            }
            if (empty($plugin_name)) {
                $plugin_name = '';
                if (is_file(CHEMIN.'admin/'.$plugin_dirname.'/plugin.inc')) {
                    $plugin_admin_name = '';
                    include_once CHEMIN.'admin/'.$plugin_dirname.'/plugin.inc';
                    if (!empty($plugin_admin_name)) {
                        $plugin_name = $plugin_admin_name;
                    }
                }
            }
            if (empty($plugin_name)) {
                $plugin_name = $web[465];
            }
        }
        $ariane = '<span class="arianeOn"><a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a></span> '.$sep.' <span class="arianeOff">'.$plugin_name.'</span>';
        break;
    case 13 : // blog
        $topmess2 = explode(' - ', empty($topmess) ? $npage[$pgtype] : strip_tags($topmess));
        $last     = ' '.$sep.' <span class="arianeOff">'.array_pop($topmess2).'</span>';
        $middle   = (0 == count($topmess2)) ? '' : ' '.$sep.' <span class="arianeOn">
          <a href="'.$site[3].($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[1].$z2 : $site['BLS'].'.php?lng='.$lng.$z2).'" title="'.$topmess2[0].'">'.$topmess2[0].'</a></span>';
        $ariane   = '<span class="arianeOn"><a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a></span>'.$middle.$last;
        break;
    case 0 :
    case 3 : // forum
        $topmess2 = explode(' - ', empty($topmess) ? $npage[$pgtype] : strip_tags($topmess, '<a>'));
        $last     = ' '.$sep.' <span class="arianeOff">'.array_pop($topmess2).'</span>';
        $middle   = '';
        foreach ($topmess2 as $item) {
            $middle .= ' '.$sep.' <span class="arianeOn">'.$item.'</span>';
        }
        $ariane = '<span class="arianeOn"><a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a></span>'.$middle.$last;
        break;
    case FALSE :
        $ariane = '<span class="arianeOn">
          <a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a>
          </span> '.$sep.' <span class="arianeOff">'.(empty($topmess) ? '???' : strip_tags($topmess, '<a>')).'</span>';
        break;
    default :
        $topmess2 = explode(' - ', empty($topmess) ? $npage[$pgtype] : strip_tags($topmess, '<a>'));
        $last = ' '.$sep.' <span class="arianeOff">'.array_pop($topmess2).'</span>';
        $middle = '';
        foreach ($topmess2 as $item) {
            $middle .= ' '.$sep.' <span class="arianeOn">'.$item.'</span>';
        }
        $ariane = '<span class="arianeOn"><a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a></span>'.$middle.$last;
        break;
    }
	$out = '
<div class="ariane'.(in_array($pos, array(BOX_TOP, BOX_BOTTOM)) ? ' ARN'.$pos.$tconfig : '').' text-left p-2 m-0">'
	.@$web[637].$ariane.'
</div>';
	if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
		return $out;
	} else {
		if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
			return '
<div class="'.$pos.$tconfig.'ARN">'.boxthin($pos, '', $out, ' ARN'.$pos.$tconfig).'
</div>';
		} else {
			return boxwide($pos, '', $out, ' ARN'.$pos.$tconfig, 'nav');
		}
	}
}

################################################################################

function fbox_print($pos = NULL, $args = NULL) {
    global $serviz, $web, $endurl, $pgtype, $site, $lng, $prt, $urlrw, $page, $tconfig;
	$url1 = str_replace('&', '&amp;', $endurl).'&amp;prt=-2';
	$url2 = str_replace('&', '&amp;', $endurl).'&amp;prt=2';
	$url3 = str_replace('&', '&amp;', $endurl).'&amp;prt=-3';
	$url4 = str_replace('&', '&amp;', $endurl).'&amp;prt=3';
	if ($site['URLR'] == 'on' && strpos($endurl, '/admin/') === false) {
		$infos = explode('/', $_SERVER['SCRIPT_NAME']);
		$qstrs = explode('&', $_SERVER['QUERY_STRING']);
		$fname = explode('.', $infos[count($infos) - 1]);
		$urls  = array(
			'index'=>$urlrw[0].'-1', $site['BLS']=>$urlrw[1].'-1', 'blogs'=>$urlrw[1].'-1' ,'selpg'=>$urlrw[1].'-21', $site['BL'].'pg'=>$urlrw[1].'-41', 'blogsarch'=>$urlrw[1].'-71', $site['BL'].'selpg'=>$urlrw[1].'-21', 
		    'blogsarchselpgcatdatejdateid'=>$urlrw[1].'-72', 'blogarchpg'=>$urlrw[1].'-43', $site['BL'].'pgreact'=>$urlrw[1].'-470', 'blogarchpgreact'=>$urlrw[1].'-480', 
		    'contact'=>$urlrw[2].'-1', 'connect'=>$urlrw[3].'-2', 'connectconnectuuser'=>$urlrw[3].'-31', 'compte'=>$urlrw[3].'-141', 'lostpass'=>$urlrw[3].'-160', 
			'faq'=>$urlrw[4].'-1', 'faqtconfig'=>$urlrw[4].'-11','faqpg'=>$urlrw[4].'-4', 'faqid'=>$urlrw[4].'-5', 'faqdirfaqtconfig'=>$urlrw[4].'-10',$site['FRT']=>$urlrw[5].'-1', $site['FR'].'cat'=>$urlrw[5].'-3', 
			$site['TH'].'pgcat'=>$urlrw[5].'-40', $site['TH'].'pgcatid'=>$urlrw[5].'-50', 'threadarchpgcat'=>$urlrw[5].'-420', 'threadarchpgcatid'=>$urlrw[5].'-520', 
			'fortopicarch'=>'frm-9',
			'links'=>$urlrw[6].'-2', 'linkspg'=>$urlrw[6].'-3', $site['GB']=>$urlrw[7].'-1', $site['GB'].'id'=>$urlrw[7].'-20', $site['GB'].'pg'=>$urlrw[7].'-30', 
			$site['NE']=>$urlrw[8].'-1', $site['NE'].'pgid'=>$urlrw[8].'-31', $site['NE'].'pg'=>$urlrw[8].'-20', 'newsarch'=>$urlrw[8].'-261', 'newsarchpg'=>$urlrw[8].'-263', 
			'newsarchpgid'=>$urlrw[8].'-41', 'photorama'=>$urlrw[9].'-1', 'photorama2pgtconfig'=>$urlrw[9].'-20', 'photoramapg'=>$urlrw[9].'-40', 'photoramatconfig'=>$urlrw[9].'-41',  
			'download'=>$urlrw[11].'-1', 'downloaddirdnl'=>$urlrw[11].'-9','downloadpg'=>$urlrw[11].'-5', 'downloadid'=>$urlrw[11].'-70', 'search'=>$urlrw[12].'-1', 
			'tinymsg'=>$urlrw[13].'-1', 'tinymsgaction'=>$urlrw[13].'-31', 'tinymsgactionid'=>$urlrw[13].'-51', 'tinymsgactionidtofrom'=>$urlrw[13].'-41', 
			'tinymsgactiontofrom'=>$urlrw[13].'-21', $site['PG'].'typ'=>$urlrw[14].'-0', $site['PG'].'typmodnumpg'=>$urlrw[14].'-10', $site['PG'].'typnumpg'=>$urlrw[14].'-20', 
			$site['PG'].'typcat'=>$urlrw[14].'-30', $site['PG'].'typpg'=>$urlrw[14].'-40', $site['USR']=>$urlrw[15].'-0', $site['USR'].'uuser'=>$urlrw[15].'-50', 
			$site['USR'].'modifuuser'=>$urlrw[15].'-60', 'agendamoisanagv'=>$urlrw[17].'-211', 'agendamoisanagvid'=>$urlrw[17].'-231', 
			'agendaidpgpgagv'=>$urlrw[17].'-221', $site['NL']=>$urlrw[18].'-0', 'rss'=>$urlrw[19].'-1', 'articlespg'=>$urlrw[20].'-1001', 'articlespg'=>$urlrw[20].'-102', 
			'articlespgtconfig'=>$urlrw[20].'-102', 'articlespgreact'=>$urlrw[20].'-1010', 'articlespg'=>$urlrw[20].'-1020', 
			'articlespgmnuid'=>$urlrw[20].'-1030', 'articlespgtconfig'=>$urlrw[20].'-1020', 'articlespgmnuidtconfig'=>$urlrw[20].'-1030'
			);
		$vars = '';
		$vals = '-';
/*
		echo 'query string: '.$_SERVER['QUERY_STRING'].'<br />';
    	echo 'SCRIPT_NAME: '.$_SERVER['SCRIPT_NAME'].'<br />';
		echo 'Infos count : '.count($infos).'<br />';
		echo 'Infos 0: '.$infos[0].'<br />';
		echo 'Infos 1: '.$infos[1].'<br />';
		echo 'Infos 2: '.$infos[2].'<br />';
*/		
/*
		foreach($_SERVER as $key => $value)
			echo '$_SERVER['.$key.']='.$value .'<br />';
*/
		$info[1] = trim($info[1]);
$mystring = 'abc';
$findme   = 'a';
$pos = strpos($_SERVER['SCRIPT_NAME'], 'plugins');
        if ($pos === false)
		{
//		    echo 'Apres if Infos 1: '.$infos[1].'<br />';			
			foreach($qstrs as $key=>$val) {
//					echo 'Avant et dans qstrs key: '.$key.'<br />';
//					echo 'Avant et dans qstrs val: '.$val.'<br />';
					
				if ($key != 'lng') {
					$param = explode('=', $val);
					if ($param[0] != 'lng' )
					{	
						if ($fname[0] != 'fortopic' && $fname[0] != 'blog'  && $fname[0] != 'blogs' && $fname[0] != 'news' && $fname[0] != 'agenda' 
							&& $fname[0] != 'contact' && $fname[0] != 'compte' && $fname[0] != 'tinymsg' && $fname[0] != 'download'
							&& $fname[0] != 'links' && $fname[0] != 'guestbk' && $fname[0] != 'photorama')
						{
							if ($param[0] == 'tconfig' && $param[1] >= 0)
							{
	//							echo 'Dans Foreach qstrs param0: '.$param[0].'<br />';	
	//							echo 'Dans Foreach qstrs param1: '.$param[1].'<br />';				
								$vars .= $param[0];
								$vals .= $param[1].'-';
	//							echo 'Dans Foreach qstrs vars: '.$vars.'<br />';	
	//							echo 'Dans Foreach qstrs vals: '.$vals.'<br />';
							}
						}
						if ($param[0] != 'tconfig')
						{
	//						echo 'Dans Foreach qstrs param0: '.$param[0].'<br />';	
	//						echo 'Dans Foreach qstrs param1: '.$param[1].'<br />';				
							$vars .= $param[0];
							$vals .= $param[1].'-';
	//						echo 'Dans Foreach qstrs vars: '.$vars.'<br />';	
	//						echo 'Dans Foreach qstrs vals: '.$vals.'<br />';
						}
					}
				}
			}
			$urlr = '';
/*			
			echo 'fname[0]: '.$fname[0].'<br />';
			echo 'vars: '.$vars.'<br />';	
			echo 'vals: '.$vals.'<br />';	
*/
			foreach($urls as $key=>$url) {
/*
					echo 'AVnt foreach Urls => key: '.$key.'<br />';
					echo 'AVnt foreach Urls =>  vars: '.$vars.'<br />';
					echo 'AVnt foreach Urls =>  fname[0].vars: '.$fname[0].$vars.'<br />';
					echo 'AVnt foreach Urls =>  fname[0]: '.$fname[0].'<br />';
*/					
					if ($fname[0].$vars == $key)
					{		
//							echo 'Dans fname.var if key: '.$key.'<br />';
//							echo 'Dans fname.var if vars: '.$vars.'<br />';	
							$urlr = $url;
//							echo 'Dans fname.var url: '.$url.'<br />';
//							echo 'Dans fname.var urlr: '.$urlr.'<br />';
							break;
					}
					elseif($fname[0] == $key) 
					{
//						echo 'Dans fname = key : '.$key.'<br />';
						$urlr = $url;
//						echo 'Dans fnamE url: '.$url.'<br />';
//						echo 'Dans fname urlr: '.$urlr.'<br />';					
					}
				}
			if ($fname[0] == 'allarticles')
			{
				$url1 = $site[3].$urlr.$lng.'-'.'allart-2'.$vals.'-2';
				$url2 = $site[3].$urlr.$lng.'-'.'allart-2'.$vals.'2';
				$url3 = $site[3].$urlr.$lng.'-'.'allart-2'.$vals.'-3';
				$url4 = $site[3].$urlr.$lng.'-'.'allart-2'.$vals.'3';
			}
			elseif ($fname[0] == 'annoncesplus')
			{
				$url1 = $site[3].$urlr.$lng.'-'.'ap-8'.$vals.'-2';
				$url2 = $site[3].$urlr.$lng.'-'.'ap-8'.$vals.'2';
				$url3 = $site[3].$urlr.$lng.'-'.'ap-8'.$vals.'-3';
				$url4 = $site[3].$urlr.$lng.'-'.'ap-8'.$vals.'3';
			}
			else
			{
				$url1 = $lng.'-'.$urlr.$vals.'-2';
				$url2 = $lng.'-'.$urlr.$vals.'2';
				$url3 = $lng.'-'.$urlr.$vals.'-3';
				$url4 = $lng.'-'.$urlr.$vals.'3';
			}	
		}
		else
			{
				$url1 = $site[3].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'].'&prt=-2';
				$url2 = $site[3].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'].'&prt=2';

			}				
/*
		echo 'url1: '.$url1.'<br />';	
		echo 'url2: '.$url2.'<br />';		
		echo 'url3: '.$url3.'<br />';	
		echo 'url4: '.$url4.'<br />';	
*/
	}
    if ($pgtype != 11) {
        $out = '
<div class="boxprint'.(in_array($pos, array(BOX_TOP, BOX_BOTTOM)) ? ' PRT'.$pos.$tconfig : '').' mx-3 p-2">
  <span class="boxprint1 float-right">
    <a href="'.$url1.'" target="_blank"><i class="fas fa-eye mx-2" title="'.$web[264].'"></i></a>&nbsp;
    <a href="'.$url2.'" target="_blank"><i class="fas fa-print" title="'.$web[22].'"></i></a>&nbsp;
  </span>
  <span class="boxprint2 float-right">'.$web[470].'</span>
  ';
        $out .= '
</div>';
		if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
			return $out;
		} else {
			if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
				return '
<div class="'.$pos.$tconfig.'PRT">
  '.boxthin($pos, '', $out, ' PRT'.$pos.$tconfig).'
</div>';
			} else {
				return boxwide($pos, '', $out, ' PRT'.$pos.$tconfig);
			}
		}
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_logo($pos = NULL, $args = NULL) {
    global $lang, $lng, $page, $site, $skn_logo, $urlrw, $tconfig, $meskin;
    $img  = explode('|', $page[4]);
    $urli = substr($img[0], 0, 1) == 'I' ? CHEMIN.'img/' : $meskin.'img/';
    $logo = $skn_logo != '' && empty($page[4]) ? $skn_logo : $urli.$img[1];
    if ($logo != $urli) {
		$url = ($site['URLR'] == 'on')? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng;
        return '
  <div class="logo m-0 p-0'.(in_array($pos, array(BOX_TOP, BOX_BOTTOM)) ? ' LO'.$pos.$tconfig : '').'">
    <a href="'.$site[3].$url.'" title="'.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'">
      <img src="'.$logo.'" alt="'.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'" />
    </a>
  </div>
';
    } else {
        return FALSE;
    }
}

################################################################################
 
function getMenuFlags($pos = NULL) {
    global $lng, $lang, $page, $site, $endurl, $urlrw, $web, $z2, $flag1, $flag2;
	$flags = '';
    if ($lang[1] != '') { // boxlang
		if ($site['URLR'] == 'on') {
			$len     = strlen(parse_url($site[3], PHP_URL_PATH));
            $flagurl = substr($endurl, $len);
            $pds     = (strstr($flagurl, '/')) ? strripos( $flagurl, '/') : 0;
            if ($pds > 1) {
				$len           = strlen(substr($flagurl, $pds + 1));
                $chemin_plugin = substr($flagurl, 0, $pds + 1);
                $flagurl       = substr($flagurl, $pds + 1);
			} else $chemin_plugin = '';
			$flagurl0 = $site[3].$chemin_plugin.$lang[$lng == $lang[0] ? 1 : 0].'-'.substr($flagurl, 3);
			$flagurl1 = $site[3].($lng == $lang[0] ? $lang[1] : $lang[0]).'-'.$urlrw[0];
            $flagurl = strlen($flagurl) > 3 ? $flagurl0 : $flagurl1;
		} else {
			$slng = strpos($endurl, '?lng=') > 0 || strpos($endurl, '&lng=') > 0 ? '' : 'lng='.$lng;
			if ($slng != '') $endurl .= (strpos($endurl, '?') > 0) ? '&'.$slng : '?'.$slng;
			$flagurl = str_replace('&', '&amp;', $endurl);
			if ($lng == $lang[0]) $flagurl = str_replace('lng='.$lang[0], 'lng='.$lang[1], $flagurl); 
			if ($lng == $lang[1]) $flagurl = str_replace('lng='.$lang[1], 'lng='.$lang[0], $flagurl); 
		}
		$flags = '
      <script>
        $(document).ready(function(){
          $(\'.menuiconflag\').popover({
            title:"'.$web[87].'",
            content:"'.($lng == $lang[0] ? $web[555].': <b>'.$lang[1].'</b>' : $web[556].': <b>'.$lang[0].'</b>').'",
            trigger:"hover",
            placement:"auto",
            html:true
          });
        });
      </script>
      <a href="'.$flagurl.(strpos($flagurl, 'index.php') > 0 || strpos($flagurl, $urlrw[0]) > 0 ? '' : $z2).'" class="menuiconflag" title="'.$web[87].'">
        <i class="flg-'.($lng == $lang[0] ? $lang[1] : $lang[0]).'"></i>
      </a>';
        if ($pos == BOX_LEFT || $pos == BOX_RIGHT && $pos != NULL) {
            // Drapeau menu boite latérale
			$flags = '
      <script>
        $(document).ready(function(){
          $(\'.menuiconflag\').popover({
            title:"'.$web[87].'",
            content:"'.($lng == $lang[0] ? $web[555].': <b>'.$lang[1].'</b>' : $web[556].': <b>'.$lang[0].'</b>').'",
            trigger:"hover",
            placement:"auto",
            html:true
          });
        });
      </script>
      <span class="menuIcons_flag">
        <a href="'.$flagurl.(strpos($flagurl, 'index.php') > 0 || strpos($flagurl, $urlrw[0]) > 0 ? '' 
            : $z2).'" class="menuiconflag float-left" title="'.$web[87].'">
          <i class="flg-'.($lng == $lang[0] ? $lang[1] : $lang[0]).'"></i>
        </a>
      </span>';
        }
    } // boxlang
    return $flags;
}
 
################################################################################

function getOptionsMenuIcons() {
    global $lng, $lang, $serviz, $web, $site, $menuico, $nom, $page, $tconfig, $urlrw, $userprefs, $z2,
		   $fielda1, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    $tconfig = empty($tconfig) ? '0' : $tconfig;
    $menu    = array();
    $i       = ($lng == $lang[0])? 0 : 10;
    $j       = ($lng == $lang[0])? 0 : 1;
    // Admin
    if (isAdmin($userprefs[1])) {
    	$menu[strip_tags($web[144]).'_admin'] = array(
    		'id'      => 'admin',
            'z2'      => false,
    		'name'    => strip_tags($web[144]),
    		'title'   => $web[144],
            'pagedisp' => $tconfig,
            'granted' => true,
    		'icon'    => '<i class="fas fa-user-cog"></i>',
    		'url'     => ($site['URLR'] == 'on')? 'admin/'.$lng.'-'.$urlrw[0].'-19' : 'admin/admin.php?lng='.$lng,
			'base'    => 'admin.php',
			'target'  => '_self'
    	);
    }
    //Home
    if ($serviz[1] == 0 && $menuico[0] == 'on') {
        $menu[getLabel($nom[$i+0]).'_home'] = array(
            'id'       => 'home',
            'z2'       => false,
            'name'     => strip_tags(getLabel($nom[$i+0])),
            'title'    => getLabel($nom[$i+0], 1),
            'icon'     => '<i class="fas fa-home"></i>',
            'pageexec' => 0,
            'pagedisp' => $tconfig,
            'granted'  => true,
            'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[0] : 'index.php',
			'base'     => 'index.php',
			'target'   => '_self'
        );
    }
    //Blog
    if ($serviz[53] == 'on' && $menuico[2] == 'on') {
        $menutconf = $menuico[13] == 'ALL' ? $tconfig : $menuico[13];
    	$menu[getLabel($nom[$j+42]).'_blog'] = array(
    		'id'       => 'blog',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$j+42])),
            'title'    => getLabel($nom[$j+42], 1),
    		'icon'     => '<i class="fas fa-blog"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[23] == 'ALL' ? $tconfig : $menuico[23],
            'granted'  => empty($menuico[33]) ? true : isAccessGranted($menuico[33]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[1].'-'.$menutconf : $site['BLS'].'.php',
    		'alturls'  => array($site['BL'].'.php', 'blogsarch.php', 'blogarch.php'),
			'base'     => $site['BLS'].'.php',
			'target'   => '_self'
    	);
    }
    //Contact
    if ($serviz[21] == 'on' && $serviz[99] == 'on' && $menuico[10] == 'on') {
        $menutconf = $menuico[21] == 'ALL' ? $tconfig : $menuico[21];
    	$menu[getLabel($nom[$j+46]).'_contact'] = array(
    		'id'       => 'contact',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$j+46])),
            'title'    => getLabel($nom[$j+46], 1),
    		'icon'     => '<i class="fas fa-envelope-open-text"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[31] == 'ALL' ? $tconfig : $menuico[31],
            'granted'  => true,
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[2].'-'.$menutconf : $site['CT'].'.php',
			'base'     => $site['CT'].'.php',
			'target'   => '_self'
    	);
    }
    //Connexion
    if ($menuico[11] == 'on') {
		$jj              = $userprefs[1] == '' ? $j+14 : $j+28;
        $menutconf       = $serviz[172] == 'ALL' ? $tconfig : $serviz[172];
		$connectName     = $userprefs[1] == '' ? 'connect.php' : 'connect.php?lng='.$lng.'&amp;connect=no';
		$connectNameURLR = $userprefs[1] == '' ? $urlrw[3].'-0' : $urlrw[3].'-1-no';
    	$menu[getLabel($nom[$jj]).'_connect'] = array(
    		'id'       => 'connect',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$jj])),
            'title'    => getLabel($nom[$jj], 1),
    		'icon'     => '<i class="'.($userprefs[1] == '' ? 'fas fa-sign-in-alt' : 'fas fa-sign-out-alt').'"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $serviz[173] == 'ALL' ? $tconfig : $serviz[173],
            'granted'  => true,
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$connectNameURLR.'-'.$menutconf : $connectName,
			'base'     => 'connect.php',
			'target'   => '_self'
    	);
    }
    //FAQ
    if ($serviz[14] == 'on' && $menuico[6] == 'on') {
        $menutconf = $menuico[17] == 'ALL' ? $tconfig : $menuico[17];
    	$menu[getLabel($nom[$j+24]).'_faq'] = array(
    		'id'       => 'faq',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$j+24])),
            'title'    => getLabel($nom[$j+24], 1),
    		'icon'     => '<i class="far fa-question-circle"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[27] == 'ALL' ? $tconfig : $menuico[27],
            'granted'  => empty($menuico[37]) ? true : isAccessGranted($menuico[37]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[4].'-9-'.$menutconf : 'faq.php',
			'base'     => 'faq.php',
			'target'   => '_self'
    	);
    }
    //Forum
	$dbcat = array();
	if ($serviz[13] == 'on')
          $dbcat = ReadDBFields(DBFORUMCAT);
    $okfr  = false;
    if (!empty($dbcat)) 
	{
		foreach ($dbcat as $cat) 
		{
			if (!isset($cat[5])) $cat[5] = '';
			if ($cat[5] == 'on') 
			{ 
				$okfr = true; break;
			}
		}
	}
    if ($serviz[13] == 'on' && $okfr && $menuico[8] == 'on') {
        $menutconf = $menuico[19] == 'ALL' ? $tconfig : $menuico[19];
    	$forumName = $site['FRT'];
    	$forumNameURLR = $urlrw[5].'-'.$menutconf;
    	$menu[getLabel($nom[$j+22]).'_forum'] = array(
    		'id'       => 'forum',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$j+22])),
            'title'    => getLabel($nom[$j+22], 1),
    		'icon'     => '<i class="fab fa-forumbee"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[29] == 'ALL' ? $tconfig : $menuico[29],
            'granted'  => empty($menuico[39]) ? true : isAccessGranted($menuico[39]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$forumNameURLR : $forumName.'.php',
    		'alturls'  => array($site['TH'].'.php', 'forumarch.php', 'fortopicarch.php', 'treadarch.php'),
			'base'     => $forumName.'.php',
			'target'   => '_self'
    	);
    }
    //Link
    if ($serviz[11] == 'on' && $menuico[5] == 'on') {
        $menutconf = $menuico[16] == 'ALL' ? $tconfig : $menuico[16];
    	$menu[getLabel($nom[$i+3]).'_links'] = array(
    		'id'       => 'links',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+3])),
            'title'    => getLabel($nom[$i+3], 1),
    		'icon'     => '<i class="fas fa-external-link-alt"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[26] == 'ALL' ? $tconfig : $menuico[26],
            'granted'  => empty($menuico[36]) ? true : isAccessGranted($menuico[36]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[6].'-'.$menutconf : 'links.php',
			'base'     => 'links.php',
			'target'   => '_self'
    	);
    }
    //Guestbook
    if ($serviz[12] == 'on' && $menuico[7] == 'on') {
        $menutconf = $menuico[18] == 'ALL' ? $tconfig : $menuico[18];
    	$menu[getLabel($nom[$i+9]).'_guestbk'] = array(
    		'id'       => 'guestbook',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+9])),
            'title'    => getLabel($nom[$i+9], 1),
    		'icon'     => '<i class="fas fa-book"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[28] == 'ALL' ? $tconfig : $menuico[28],
            'granted'  => empty($menuico[38]) ? true : isAccessGranted($menuico[38]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[7].'-'.$menutconf : $site['GB'].'.php',
			'base'     => $site['GB'].'.php',
			'target'   => '_self'
    	);
    }
    //News
    if ($serviz[8] == 'on' && $menuico[1] == 'on') {
        $menutconf = $menuico[12] == 'ALL' ? $tconfig : $menuico[12];
    	$menu[getLabel($nom[$i+7]).'_news'] = array(
    		'id'       => 'news',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+7])),
            'title'    => getLabel($nom[$i+7], 1),
    		'icon'     => '<i class="far fa-newspaper"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[22] == 'ALL' ? $tconfig : $menuico[22],
            'granted'  => empty($menuico[32]) ? true : isAccessGranted($menuico[32]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[8].'-5-'.$menutconf : $site['NE'].'.php',
    		'alturls'  => array('newsarch.php'),
			'base'     => $site['NE'].'.php',
			'target'   => '_self'
    	);
    }
    //Photorama
    if ($serviz[9] == 'on' && $menuico[3] == 'on') {
    	$menutconf = $menuico[14] == 'ALL' ? $tconfig : $menuico[14];
        $photoName = 'photorama'; 
    	$menu[getLabel($nom[$i+2]).'_photo'] = array(
    		'id'       => 'photo',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+2])),
            'title'    => getLabel($nom[$i+2], 1),
    		'icon'     => '<i class="far fa-images"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[24] == 'ALL' ? $tconfig : $menuico[24],
            'granted'  => empty($menuico[34]) ? true : isAccessGranted($menuico[34]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[9].'-'.$menutconf : 'photorama.php',
    		'alturls'  => array('photorama2.php'),
			'base'     => 'photorama.php',
			'target'   => '_self'
    	);
    }
    //Download
    if ($serviz[10] == 'on' && $menuico[4] == 'on') {
    	$menutconf = $menuico[15] == 'ALL' ? $tconfig : $menuico[15];
    	$menu[getLabel($nom[$i+1]).'_download'] = array(
    		'id'       => 'download',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+1])),
            'title'    => getLabel($nom[$i+1], 1),
    		'icon'     => '<i class="fas fa-download"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[25] == 'ALL' ? $tconfig : $menuico[25],
            'granted'  => empty($menuico[35]) ? true : isAccessGranted($menuico[35]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[11].'-'.$menutconf : $site['DN'].'.php',
			'base'     => $site['DN'].'.php',
			'target'   => '_self'
    	);
    }
    //Plugins
    if (is_file(CHEMIN."inc/hplugins.inc")) {
    	include CHEMIN."inc/hplugins.inc";
    }
    //Icônes supplémentaires
    $dbicons = SelectDBFieldsByType(ReadDBFields(DOCID), TYP_MENUICO);
    foreach ($dbicons as $item) {
        if ($item[2] == 'a') {
            ReadDoc($item[1]);
			if ($fieldmail == $tconfig || $fieldmail == 'ALL') {
				$urls = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
				if (preg_match('!https?://|ftps?://|www.!', $urls[0]))
					$url = $urls[0];
				else {
					$slng = (strpos($urls[0], '?lng=') > 0 || strpos($urls[0], '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
					if ($slng != '') $urls[0] .= (strpos($urls[0], '?') > 0) ? '&'.$slng : '?'.$slng;
					$urls[0] = strpos($urls[0], 'tconfig') > 0 ? $urls[0] : $urls[0].'&tconfig='.($fieldweb == 'ALL' ? $tconfig : $fieldweb);
					if ($site['URLR'] == 'on' && empty($urls[1]) && strpos($urls[0], 'articles.php') !== false) {
						$pg      = substr($urls[0], strpos($urls[0], 'pg=') + 3);
						$pg      = strpos($pg, '&') > 0 ? substr($pg, 0, strpos($pg, '&')) : $pg;
						$urls[1] = $lng.'-'.$urlrw[20].($fieldweb == 'ALL' ? '-100-'.$pg : '-102-'.$pg.'-'.$fieldweb);
					}
					$url = (count($urls) == 1 || $site['URLR'] != 'on' ? $urls[0] : $urls[1]);
				}
				$icon_name = $lang[0] == $lng ? getLabel($fieldb1) : getLabel($fieldb2);
				$basename  = $site['URLR'] == 'on' ? basename($_SERVER['SCRIPT_NAME']) : parse_url($url, PHP_URL_PATH);
				$menu[$icon_name.'menuicon_'.$fielda1] = array(
					'id'       => strip_tags($fielda1),
                    'z2'       => preg_match('!https?://|ftps?://|www.!', $url) ? '' : $z2,
					'name'     => $lang[0] == $lng ? strip_tags(getLabel($fieldb1)) : strip_tags(getLabel($fieldb2)),
					'title'    => $icon_name,
					'icon'     => ($fieldc2 != '' && is_file(CHEMIN.'img/'.$fieldc2) 
                                     ? '<img src="'.CHEMIN.'img/'.$fieldc2.'" alt="" class="mt-n1" style="width:2rem;" />' 
                                     : '<i class="fas fa-external-link-alt"></i>'),
                    'pageexec' => $fieldweb == 'ALL' ? $tconfig : $fieldweb,
                    'pagedisp' => $fieldmail == 'ALL' ? $tconfig : $fieldmail,
                    'granted'  => empty($fieldmod) ? true : isAccessGranted($fieldmod),
					'url'      => $url,
					'base'     => basename(parse_url($url, PHP_URL_PATH)).'?'.parse_url($url, PHP_URL_QUERY),
					'target'   => $fieldc1,
					'docid'    => $item[1]
				);
				unset($urls);
			}
        }
    }
    ksort($menu);
    return $menu;
}

################################################################################
    
function fbox_menu($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $page, $site, $serviz, $userprefs, $web, $menuico, 
	    $urlrw, $tconfig, $flag1, $flag2, $dynabox, $endurl, $charset, $z2;
    static $nbox;
    $nbox++;
	$title_menu = getLabel($nom[$lng == $lang[0] ? 44 : 45]);
	$title_menu = mb_substr(trim($title_menu), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[0], 'MI'.$nbox.$pos.$tconfig).$title_menu;
	$tconfig    = empty($tconfig) ? '0' : $tconfig;
	$flags      = getMenuFlags($pos); // boxlang
    if ($lang[1] != '' && ($pos == BOX_LEFT || $pos == BOX_RIGHT)) 
        $title_menu = $flags.'<div'.(empty($lang[1]) ? '' : ' class="titleboxmenu"').'>'.$title_menu.'</div>';
    $base_current = basename(substr($_SERVER["SCRIPT_NAME"], strlen(parse_url($site[3], PHP_URL_PATH))));
	$full_current = $base_current.'?'.$_SERVER["QUERY_STRING"];
    unset($dbw);
    $menu = getOptionsMenuIcons();
    $out = '';
    $currentMenuClass = '';
    if ($pos != BOX_LEFT && $pos != BOX_RIGHT) { // Menu horizontal
    	// Sections du menu
    	$found_current = false;
    	foreach ($menu as $section) {
			if ($section['granted'] === false) continue;
            if ($currentMenuClass != '') {
                $found_current = true;
                $currentMenuClass = '';
            }
            if (!$found_current) {
        		if (!isset($section['alturls'])) {
					if (isset($section['docid']))
						$currentMenuClass = ($full_current == $section['base']) ? ' active' : '';
					else
						$currentMenuClass = ($base_current == $section['base']) ? ' active' : '';
        		} else {
        		    $currentMenuClass = ($base_current == $section['base']) ? ' active' : '';
                    foreach($section['alturls'] as $url) {
                        if ($base_current == $url) {
                            $currentMenuClass = ' active';
                            break;
                        }
                    }
        		}
    		}
    		if (($page[9] != '' || $section['name'] != '') && $section['pagedisp'] == $tconfig) {
				if (strpos($section['url'], $site[3]) !== false) {
					$url  = CHEMIN.substr($section['url'], strlen($site[3]));
					$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
					if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
				} elseif (preg_match('!https?://|ftps?://|www.!', $section['url'])) {
					$url = $section['url'];
				} else {
					$url  = CHEMIN.$section['url'];
					$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
					if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
				}
				if ($section['target'] == '_POPUP')
					$target = '	onclick="window.open(this.href, \'popup'.(isset($section['docid']) ? $section['docid'] : '0').'\', 
						\'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
				else
					$target = strtolower($section['target']) == '_self' ? '' : ' target="'.strtolower($section['target']).'"';
				$contents = '
			<a href="'.$url.($section['z2'] ? $z2 : '').'" title="'.strip_tags($section['title']).'"'.$target.'>';
    			if ($section['name'] != '') {
    				$contents .= '
			  <span class="name_'.$section['id'].$currentMenuClass.'">'.($page[9] != '' ? $section['icon'].'&nbsp;' : '').$section['name'].'</span>';
    			}
    			$contents .= '
			</a>';

    			$out .= '
          <li id="menu_'.$section['id'].'" class="nav-item'.$currentMenuClass.'">
		    '.$contents.'
		  </li>';
    		}
    	}
      return '
<nav class="menuIcons navbar navbar-expand-md navbar-light '.$pos.$tconfig.'MI">
  '.$flags.(empty($flags) ? '<span class="mi-title ml-2">&nbsp;</span>' : '').'
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarMI" aria-controls="navbarMI" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarMI">
    <ul class="container-fluid navbar-nav mr-auto">
      '.$out.'
    </ul>
  </div>
</nav>
';
    } else { // Menu boite latérale
    	$out .= '
      <ul class="boxmenu">
    	';
    	// Sections du menu
    	$found_current = false;
    	$currentMenuClass = '';
    	foreach ($menu as $section) {
			if ($section['granted'] === false) continue;
            if ($currentMenuClass != '') {
                $found_current = true;
                $currentMenuClass = '';
            }
            if (!$found_current) {
        		if (!isset($section['alturls'])) {
					if (isset($section['docid']))
						$currentMenuClass = ($full_current == $section['url']) ? ' curr_item' : '';
					else
						$currentMenuClass = ($base_current == $section['base']) ? ' curr_item' : '';
        		} else {
        		    $currentMenuClass = ($base_current == $section['base'])? ' curr_item' : '';
                    foreach($section['alturls'] as $url) {
                        if ($base_current == $url) {
                            $currentMenuClass = ' curr_item';
                            break;
                        }
                    }
        		}
    		}
    		if ($page[9] != '' || $section['name'] != '') {
				if (strpos($section['url'], $site[3]) !== false) {
					$url  = CHEMIN.substr($section['url'], strlen($site[3]));
					$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
					if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
				} elseif (preg_match('!https?://|ftps?://|www.!', $section['url'])) {
					$url = $section['url'];
				} else {
					$url  = CHEMIN.$section['url'];
					$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
					if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
				}
				if (strtoupper($section['target']) == '_POPUP')
					$target = '	onclick="window.open(this.href, \'popup'.(isset($section['docid']) ? $section['docid'] : '0').'\', 
						\'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
				else
					$target = strtolower($section['target']) == '_self' ? '' : ' target="'.strtolower($section['target']).'"';
				$contents = '<a href="'.$url.(isset($section['z2']) && $section['z2'] ? $z2 : '').'" title="'.strip_tags($section['title']).'"'.$target.'>';
    			if($page[9] != '') {
    				$contents .= $section['icon'].'&nbsp;';
    			}
    			if ($section['name'] != '') {
    				$contents .= '<span class="name_'.$section['id'].$currentMenuClass.'">'.$section['name'].'</span>';
    			}
    			$contents .= '</a>';

    			$out .= '
          <li class="menu_'.$section['id'].$currentMenuClass.'">'.$contents.'</li>';
    		}
    	}
    	$out .= '
      </ul>';
        $out .= displayQuickConfig($pos, false, '', '', '', 29);
        return '
<div class="'.$pos.$tconfig.'MI">
  '.boxthin($pos, $title_menu, $out, ' MI'.$nbox.$pos.$tconfig, $dynabox[0], 'nav').'
</div>';
    }
}

################################################################################

function fbox_sidemenu($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $page, $site, $serviz, $userprefs, $web, $menuico, 
	    $urlrw, $tconfig, $flag1, $flag2, $dynabox, $endurl, $charset, $z2;
    static $nbox;
    $nbox++;
	$tconfig    = empty($tconfig) ? '0' : $tconfig;
	$title_menu = getLabel($nom[$lng == $lang[0] ? 44 : 45]);
	$flags      = getMenuFlags(); // boxlang
    $menu       = getOptionsMenuIcons();
    $out        = '
<script>
function openNav() {
  document.getElementById("GY_sidenav").style.width = "300px";
  document.getElementById("overlay").style.display = "block";
}
function openConnect() {
  document.getElementById("GY_connect").style.width = "400px";
  document.getElementById("overlay").style.display = "block";
}
function closeNav() {
  document.getElementById("GY_sidenav").style.width = "0";
  document.getElementById("overlay").style.display = "none";
}
function closeConnect() {
  document.getElementById("GY_connect").style.width = "0";
  document.getElementById("overlay").style.display = "none";
}
function gotop() { window.location="#top"; }
function goz2() { window.location="#z2"; }
</script>
';
   	$out2 = '
    <div class="smopt">
      <ul class="boxmenu">';
    // Sections du menu
    $nameConnect = $nameAdmin = '';
    foreach ($menu as $section) {
        if ($section['granted'] === false) continue;
        if ($section['id'] == 'connect') $nameConnect = trim($section['name']);
        $pos         = strpos($nameConnect, '-->');
        $nameConnect = ($pos > 0 ? substr($nameConnect, $pos + 3) : $nameConnect);
        if ($section['id'] == 'admin') $nameAdmin = trim($section['name']);
        if (($page[9] != '' || $section['name'] != '') && $section['id'] != 'connect' && $section['id'] != 'admin') {
            if (strpos($section['url'], $site[3]) !== false) {
                $url  = CHEMIN.substr($section['url'], strlen($site[3]));
                $slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
                if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
            } elseif (preg_match('!https?://|ftps?://|www.!', $section['url'])) {
                $url = $section['url'];
            } else {
                $url  = CHEMIN.$section['url'];
                $slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
                if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
            }
            if (strtoupper($section['target']) == '_POPUP')
                $target = '	onclick="window.open(this.href, \'popup'.(isset($section['docid']) ? $section['docid'] : '0').'\', 
                    \'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
            else
                $target = strtolower($section['target']) == '_self' ? '' : ' target="'.strtolower($section['target']).'"';
            $contents = '<a href="'.$url.(isset($section['z2']) && $section['z2'] ? $z2 : '').'" title="'.strip_tags($section['title']).'"'.$target.'>';
            if ($section['name'] != '') {
                $contents .= '<div class="d-inline-block name_'.$section['id'].'">'.($page[9] != '' ? $section['icon'].'&nbsp;' : '').$section['name'].'</div>';
            }
            $contents .= '</a>';
            $out2     .= '
      <li>'.$contents.'</li>';
        }
    }
    $sym = ($nameConnect == $nom[14] || $nameConnect == $nom[15] || empty($userprefs[1]) 
      ? '<i class="fas fa-user" title="'.strip_tags($nom[$lng == $lang[0] ? 14 : 15]).'"></i>' 
      : '<i class="fas fa-user-slash" title="'.strip_tags($nom[$lng == $lang[0] ? 28 : 29]).'"></i>');
    $out2 .= '
      </ul>
    </div>';
    $out3 = '
    <div class="smlogo text-center ml-1 mr-4 mb-2 py-2 font-weight-bold">
      '.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'
    </div>';
    $out .= '
<div id="overlay" onclick="closeNav();closeConnect();"></div>
<div class="sidemenu">
  <div class="sideicon rounded px-3 pb-2" onclick="openNav(); '.($z2 != '' ? 'goz2();' : 'gotop();').'" title="'.$title_menu.'">
    <i class="fas fa-bars align-middle"></i>
  </div>
  '.(isAdmin($userprefs[1]) ? '
  <div class="admicon sidetexte">
    <a href="'.CHEMIN.($site['URLR'] == 'on' ? 'admin/'.$lng.'-'.$urlrw[0].'-19' : 'admin/admin.php?lng='.$lng).'" title="'.$nameAdmin.'">
      <i class="fas fa-user-cog"></i>
    </a>
  </div>' : '').'
  <div class="sidetexte" onclick="openConnect();'.($z2 != '' ? 'goz2();' : 'gotop();').'">'.$sym.'</div>
  <div class="sideflag">'.$flags.'</div>
</div>
<div class="sidenav" id="GY_sidenav">
  '.$out3.'<div><a class="closebtn" href="javascript:void(0)" onclick="closeNav();"><i class="fas fa-chevron-right"></i></a></div>'.$out2.'
</div>
<div class="sideconnect" id="GY_connect">
  <a class="closebtn" href="javascript:void(0)" onclick="closeConnect();"><i class="fas fa-chevron-right"></i></a>
  <div class="tblbox">'.fbox_user().'</div>
</div>';
    $out .= displayQuickConfig($pos, false, '', '', '', 29);
    return boxthin($pos, '', $out, ' SMI SMI'.$nbox.$pos.$tconfig, 'off', 'nav');
}

################################################################################

function fbox_cita($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $serviz, $userprefs, $web, $page, $tconfig;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
	$bc  = $args[0];
	$out = '';
    $dbw = SelectDBFields(TYP_THINK, 'a', '');
    if (count($dbw) > 0) {
		if ($serviz[108] == '') {
			srand(MakeSeed());
			$i = rand(0, count($dbw)-1);
			ReadDoc($dbw[$i][1]);
			if (isAuthorizedPublication($creadate)) {
				if ($lng == $lang[0]) {
					$txt1 = PathToImage($fieldc1);
					$txt2 = $fieldb1;
				} else {
					$txt1 = PathToImage($fieldc2);
					$txt2 = $fieldb2;
				}
				$txt1 = str_ireplace('<p>', ' ', $txt1);
				$txt1 = str_ireplace('</p>', ' ', $txt1);
				$out  = '
<div class="quote QOT'.$pos.$tconfig.'">
  <span class="labelcita">'.$web[5].'&nbsp;&nbsp;</span><span class="cita">'.$txt1.'&nbsp;&nbsp;</span><span class="author">'.$txt2.'</span>
</div>';
			}
		} else {
			$citatime = $serviz[109] * 1000;
			$out = '
<style>
  #lgcita'.$bc.' { position: relative; }
  #lgcita'.$bc.' div { display: none; position: absolute; }
  #lgcita'.$bc.' #citafirst'.$bc.' { position: relative; display: block; }
</style>
<div class="quote">
  <div id="lgcita'.$bc.'">';
			$n = min((int)$bc, count($dbw)) - 1;
			for ($i = 0; $i < count($dbw); $i++) {
				ReadDoc($dbw[$i][1]);
				if (!isAuthorizedPublication($creadate)) continue;
				if ($lng == $lang[0]) {
					$txt1 = PathToImage($fieldc1);
					$txt2 = $fieldb1;
				} else {
					$txt1 = PathToImage($fieldc2);
					$txt2 = $fieldb2;
				}
				$txt1 = str_ireplace('<p>', ' ', $txt1);
				$txt1 = str_ireplace('</p>', ' ', $txt1);
				$out .= '
    <div'.($i == $n ? ' id="citafirst'.$bc.'" ' : '').'>
      <span class="labelcita">'.$web[5].'&nbsp;&nbsp;</span><span class="cita">'.$txt1.'&nbsp;&nbsp;</span><span class="author">'.$txt2.'</span>
    </div>';
			}
			$out .= '
  </div>
  <script>
    function nextcita'.$bc.'(speed) {
      $("#citafirst'.$bc.'").hide();
      if ($("#citafirst'.$bc.'").next().fadeOut(speed).length)
        $("#citafirst'.$bc.'").next().fadeIn(speed,function(){
          $("#citafirst'.$bc.'").removeAttr("id").next().attr("id","citafirst'.$bc.'");
        });
      else
        $("#lgcita'.$bc.' div:first").fadeIn(speed,function(){
		  $("#citafirst'.$bc.'").removeAttr("id");
          $("#lgcita'.$bc.' div:first").attr("id","citafirst'.$bc.'");
		});
    }
    setInterval("nextcita'.$bc.'(0)",'.$citatime.');
  </script>
</div>';
		}
        $out .= displayQuickConfig($pos, false, 'think', '', '', 28);
		return $out;
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_count($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $page, $site, $serviz, $userprefs, $web, $tabcounter, 
           $dynabox, $tconfig, $charset;
    static $nbox;
    $nbox++;
    $i = $lng == $lang[0] ? 0 : 10;
    $out1 = $out2 = '
<p class="box text-left">&nbsp;';
    $out1 .= $tabcounter[0].'&nbsp;';
    $out2 .= $tabcounter[1].'&nbsp;';
    $out1 .= $tabcounter[0] == 1 ? $web[15] : $web[16];
    $out1 .= '
</p>';
    $out2 .= $tabcounter[1] == 1 ? $web[17] : $web[18];
    $out2 .= '
</p>';
    $out = $out1.$out2;
    $out .= displayQuickConfig($pos, false, 'counter', '', '', 31);
	$titre = getLabel($nom[$lng == $lang[0] ? 8 : 18]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[2], 'CNT'.$nbox.$pos.$tconfig).$titre;
    return '
<div class="'.$pos.$tconfig.'CNT">
  '.boxthin($pos, $titre, $out, ' CNT'.$nbox.$pos.$tconfig, $dynabox[2]).'
</div>';
}

################################################################################

function fbox_ban($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $serviz, $userprefs, $web, $page, $tconfig;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox;
    $nbox++;
    $bc = $nbox;
    $dbw = SelectDBFields(TYP_BANNER, 'a', '');
    if (count($dbw) > 0) {
		if ($serviz[25] == '') {
			$out = '
<div class="banner">';
			srand(MakeSeed());
			$i = rand(0,count($dbw)-1);
			ReadDoc($dbw[$i][1]);
			if (isAuthorizedPublication($creadate)) {
				if ($lng == $lang[0]) {
					$img = $fielda1;
					$url = $fieldb1;
					$alt = empty($fieldd1) ? $url : $fieldd1;
				} else {
					$img = empty($fielda2) ? $fielda1 : $fielda2;
					$url = empty($fieldb2) ? $fieldb1 : $fieldb2;
					$alt = empty($fieldd2) ? $url : $fieldd2;
				}
				$img = CHEMIN.'img/'.$img;
				$extn = substr($img,-3);

				if (isImage($extn)) {
					if (!empty($url)) {
						$out .= '
  <a href="'.$url.'" target="_blank" title="'.$alt.'">';
					}
					$out .= '
    <img src="'.$img.'" alt="'.$alt.'" title="'.$alt.'" />';
					if (!empty($url)) {
						$out .= '
  </a>';
					}
				}
			}
		} else {
			$bantime = $serviz[26] * 1000;
			$out = '
<style>
  #ban'.$bc.' { position: relative; }
  #ban'.$bc.' a { display: none; position: absolute; }
  #ban'.$bc.' #banfirst'.$bc.' { position: relative; display: block; }
</style>
<div class="banner BAN'.$pos.$tconfig.'">
  <div id="ban'.$bc.'">';
			$n = min($bc, count($dbw)) - 1;
			for ($i = 0; $i < count($dbw); $i++) {
				ReadDoc($dbw[$i][1]);
				if (!isAuthorizedPublication($creadate)) continue;
				if ($lng == $lang[0]) {
					$img = $fielda1;
					$url = $fieldb1;
					$alt = empty($fieldd1) ? $url : $fieldd1;
				} else {
					$img = empty($fielda2) ? $fielda1 : $fielda2;
					$url = empty($fieldb2) ? $fieldb1 : $fieldb2;
					$alt = empty($fieldd2) ? $url : $fieldd2;
				}
				$img = CHEMIN.'img/'.$img;
				$extn = substr($img,-3);

				if (isImage($extn)) {
					if (!empty($url)) {
						$out .= '
    <a '.($i == $n ? 'id="banfirst'.$bc.'" ' : '').'href="'.$url.'" target="_blank" title="'.$alt.'">';
					}
					$out .= '
	  <img src="'.$img.'" alt="'.$alt.'" title="'.$alt.'" />';
					if (!empty($url)) {
						$out .= '
	</a>';
					}
				}
			}
			$out .= '
  </div>
  <script>
    function nextban'.$bc.'(speed) {
      if ($("#banfirst'.$bc.'").fadeOut(speed).next().length)
        $("#banfirst'.$bc.'").next().fadeIn(speed,function(){
          $("#banfirst'.$bc.'").removeAttr("id").next().attr("id","banfirst'.$bc.'");
        });
      else
        $("#ban'.$bc.' a:first").fadeIn(speed,function(){
		  $("#banfirst'.$bc.'").removeAttr("id");
          $("#ban'.$bc.' a:first").attr("id","banfirst'.$bc.'");
		});
    }
    setInterval("nextban'.$bc.'(0)",'.$bantime.');
  </script>';
		}
        $out .= displayQuickConfig($pos, false, 'banner', '', '', 27);
        return $out.'
</div>';
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_search($pos = NULL, $args = NULL) {
    global $lng, $lang, $members, $nom, $page, $site, $serviz, $userprefs, $drtuser, $web, 
           $dynabox, $urlrw, $tconfig, $charset, $z2;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[23])) return FALSE;
    if ($serviz[24] != 'on') return FALSE;
    include CONFIGREP.'searchconfig.inc';
    $tconf = ($confpage == 'ALL' ? $tconfig : $confpage);
    if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
        $out = '
<div class="thinboxsearch TS'.$pos.$tconfig.'">
  <form class="text-center" name="thinsearch'.$nbox.'" 
      action="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[12].'-'.$tconf.$z2 : 'search.php?lng='.$lng.'&amp;tconfig='.$tconf.$z2).'" 
      method="post">
    <input type="hidden" name="searchin" value="" />
    <div class="input-group mb-3 w-85 m-auto">
      <input name="search" class="texte form-control" type="text" placeholder="'.$web[58].'" value="" />
      <div class="input-group-append c-pointer" onclick="javascript:document.thinsearch'.$nbox.'.submit();">
        <span class="input-group-text">
          <i class="fas fa-search" title="'.getLabel($nom[$lng == $lang[0] ? 20 : 21]).'"></i>
        </span>
      </div>
    </div>';
        if ($lang[1] != '') {
            $out .= '
    <div class="thinboxsearchW">
      <select name="searchlng" class="form-control form-control-lg w-75 m-auto">
        <option value="">['.$lang[0].'] '.$web[177].' ['.$lang[1].']</option>
        <option value="'.$lang[0].'"'.Selected($lng == $lang[0]).'>['.$lang[0].'] '.$web[178].'</option>
        <option value="'.$lang[1].'"'.Selected($lng == $lang[1]).'>['.$lang[1].'] '.$web[178].'</option>
      </select>
	</div>';
        } else {
            $out .= '
    <input type="hidden" name="searchlng" value="'.$lang[0].'" />';
        }
        $out .= '
  </form>
</div>';
		$out .= displayQuickConfig($pos, false, '', '', '', 49);
		$titre = getLabel($nom[$lng == $lang[0] ? 20 : 21]);
		$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[3], 'TS'.$nbox.$pos.$tconfig).$titre;
        return '
<div class="'.$pos.$tconfig.'TS">'.boxthin($pos, $titre, $out, ' TS'.$nbox.$pos.$tconfig, $dynabox[3]).'
</div>';
    } else {
       $out = '
<div class="wideboxsearch WS'.$pos.$tconfig.'">
  <form name="widesearch'.$nbox.'" 
      action="'.CHEMIN.($site['URLR'] == 'on' ? 
        $lng.'-'.$urlrw[12].'-2-'.$lng.'-'.$tconf.$z2 : 
        'search.php?lng='.$lng.'&amp;searchlng='.$lng.'&amp;tconfig='.$tconf.$z2).'" 
      method="post">
    <input type="hidden" name="searchin" value="" />
    <div class="input-group w-85 mx-auto mb-2">
      <input name="search" class="texte form-control" type="text" placeholder="'.$web[58].'" value="" />
      <div class="input-group-append c-pointer" onclick="javascript:document.widesearch'.$nbox.'.submit();">
        <span class="input-group-text">
          <i class="fas fa-search" title="'.getLabel($nom[$lng == $lang[0] ? 20 : 21]).'"></i>
        </span>
      </div>
    </div>
  </form>
</div>';
		$out .= displayQuickConfig($pos, false, '', '', '', 49);
		if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
			return $out;
		} else {
			return boxwide($pos, '', $out, ' WS'.$pos.$tconfig);
		}
    }
}

################################################################################

function fbox_search2($pos = NULL, $args = NULL) {
    global $lng, $lang, $members, $nom, $page, $site, $serviz, $userprefs, $drtuser, $web, $urlrw, $tconfig, $z2;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[23])) return FALSE;
    if ($serviz[24] != 'on') return FALSE;
    include CONFIGREP.'searchconfig.inc';
    $tconf = $confpage == 'ALL' ? $tconfig : $confpage;
    $okfr  = false;
	$dbcat = array();
 	if (!isset($rech_forum)) $rech_faq = 'rech_forum';
	if ($serviz[13] == 'on' && $rech_forum != '')
	{
		$dbcat = ReadDBFields(DBFORUMCAT);
	}
    if (!empty($dbcat)) 
	{
		foreach ($dbcat as $cat) 
		{
			if (!isset($cat[5])) $cat[5] = '';
			if ($cat[5] == 'on') 
			{ 
				$okfr = true; break;
			}
		}
	}
    $i = $lng == $lang[0] ? 0 : 1;
    $j = 10 * $i;
    $options = '';
	if (!isset($rech_article)) $rech_article = TYP_ART;
	if ($rech_article != '')
	{
		$options .= SearchOption(true,                isAccessGranted($members[1]),  TYP_ART,     $web[169]);
		$options .= SearchOption($serviz[29] == 'on', isAccessGranted($members[1]) && isAccessGranted($members[11]), TYP_REACT,   $web[187]);
	}
	if (!isset($rech_download)) $rech_download = TYP_DNLOAD;
	if ($rech_download != '')
		$options .= SearchOption($serviz[10] == 'on', isAccessGranted($members[7]),  TYP_DNLOAD,  getLabel($nom[1+$j]));
	if (!isset($rech_faq)) $rech_faq = TYP_FAQ;
	if ($rech_faq != '') 
		$options .= SearchOption($serviz[14] == 'on', isAccessGranted($members[4]),  TYP_FAQ,     getLabel($nom[24+$i]));
 	if (!isset($rech_forum)) $rech_forum = TYP_FORUM;
	if ($rech_forum != '') 
		$options .= SearchOption($serviz[13] == 'on' && $okfr, isAccessGranted($members[5]), TYP_FORUM, getLabel($nom[22+$i]));
 	if (!isset($rech_livreor)) $rech_livreor = TYP_GUESTBK;
	if ($rech_livreor != '') 
		$options .= SearchOption($serviz[12] == 'on', isAccessGranted($members[12]), TYP_GUESTBK, getLabel($nom[9+$j]));
 	if (!isset($rech_liens)) $rech_liens = TYP_LINKS;
	if ($rech_liens != '') 
		$options .= SearchOption($serviz[11] == 'on', isAccessGranted($members[3]),  TYP_LINKS,   getLabel($nom[3+$j]));
  	if (!isset($rech_news)) $rech_news = TYP_NEWS;
	if ($rech_news != '') 
		$options .= SearchOption($serviz[8]  == 'on', isAccessGranted($members[13]), TYP_NEWS,    getLabel($nom[7+$j]));
   	if (!isset($rech_blog)) $rech_blog = TYP_BLOG;
	if ($rech_blog != '') 
		$options .= SearchOption($serviz[53] == 'on', isAccessGranted($members[15]), TYP_BLOG,    getLabel($nom[42+$i]));
   	if (!isset($rech_photo)) $rech_photo = TYP_PHOTO;
	if ($rech_photo != '') 
		$options .= SearchOption($serviz[9]  == 'on', isAccessGranted($members[2]),  TYP_PHOTO,   getLabel($nom[2+$j]));
   	if (!isset($rech_agenda)) $rech_agenda = TYP_AGENDA;
	if ($rech_agenda != '') 
		$options .= SearchOption($serviz[47] == 'on', isAccessGranted($members[14]), TYP_AGENDA,  $web[488]);
    if (!isset($rech_archive)) $rech_archive = TYP_ARCH;
	if ($rech_archive != '')
		$options .= SearchOption(true,                true                         , TYP_ARCH,    $web[399]);

    $out = '
<form name="widesearch2'.$nbox.'" 
    action="'.CHEMIN.($site['URLR'] == 'on' ? 
      $lng.'-'.$urlrw[12].'-2-'.$lng.'-'.$tconf.$z2 : 
      'search.php?lng='.$lng.'&amp;searchlng='.$lng.'&amp;tconfig='.$tconf.$z2).'" 
    method="post">
  <div id="search2'.$nbox.'" class="'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) ? 'thinboxsearch1 TS1' : 'wideboxsearch1 WS1').$pos.$tconfig.'">
    <input type="hidden" name="searchin" value="" />
    <div class="input-group mb-3 w-85 m-auto">
      <input name="search" class="texte form-control" type="text" size="18" placeholder="'.$web[58].'" value="" />
      <div class="input-group-append c-pointer" onclick="javascript:document.widesearch2'.$nbox.'.submit();">
        <span class="input-group-text">
          <i class="fas fa-search" title="'.getLabel($nom[$lng == $lang[0] ? 20 : 21]).'"></i>
        </span>
      </div>
    </div>
    <div id="adv1'.$nbox.'" class="adv1web">
      <a href="javascript:cache(\'adv1'.$nbox.'\'); montre(\'adv2'.$nbox.'\'); montre(\'search1'.$nbox.'\');">'.$web[590].'</a>
    </div>
    <div id="adv2'.$nbox.'" class="adv2'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) ? '' : ' adv2W').'">&nbsp;</div>
    <div id="search1'.$nbox.'" class="'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) 
      ? 'w-100 mt-4 thinboxsearch2'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) 
        ? '' 
        : ' thinboxsearch2W') 
      : 'pt-2 wideboxsearch2'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) 
        ? '' 
        : ' wideboxsearch2W')).'">
      <div class="'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) ? 'mt-n4 thinboxsearch3W' : 'wideboxsearch3W').' pt-1">
	    <select name="searchin" class="form-control-lg w-60 m-auto">';
		if ($rech_article == TYP_ART && $rech_download == TYP_DNLOAD && $rech_faq == TYP_FAQ && $rech_forum == TYP_FORUM 
			&& $rech_livreor == TYP_GUESTBK && $rech_liens == TYP_LINKS && $rech_news == TYP_NEWS && $rech_blog == TYP_BLOG 
			&& $rech_photo == TYP_PHOTO && $rech_agenda == TYP_AGENDA && $rech_archive == TYP_ARCH)
				$out .= ' <option value="" selected="selected">'.$web[168].'</option>';
		$out .= $options.'
				</select>
			</div>';
    if ($lang[1] != '') {
        $out .= '
      <div class="searchlngW">
        <select name="searchlng" class="form-control-lg w-70 m-auto">
          <option value="">['.$lang[0].'] '.$web[177].' ['.$lang[1].']</option>
          <option value="'.$lang[0].'"'.Selected($lng == $lang[0]).'>['.$lang[0].'] '.$web[178].'</option>
          <option value="'.$lang[1].'"'.Selected($lng == $lang[1]).'>['.$lang[1].'] '.$web[178].'</option>
        </select>
	  </div>';
    } else {
        $out .= '
      <input type="hidden" name="searchlng" value="'.$lang[0].'" />';
    }
    $out.= '
      <i class="fas fa-chevron-up searchclose" title="'.$web[57].'" 
        onclick="cache(\'adv2'.$nbox.'\'); cache(\'search1'.$nbox.'\'); montre(\'adv1'.$nbox.'\');">
      </i>
    </div>
  </div>
</form>
';
	$out .= displayQuickConfig($pos, false, '', '', '', 49);
	if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
		return $out;
	} else {
		if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
			return '
<div class="'.$pos.$tconfig.'SCH">'.boxthin($pos, '', $out, ' SCH'.$pos.$tconfig).'</div>';
		} else {
			return boxwide($pos, '', $out, ' SCH'.$pos.$tconfig);
		}
	}
}

################################################################################

function fbox_empty($pos = NULL, $args = NULL) {
    static $nbox = 0;
    $nbox++;
    $sidebox = in_array($pos, array(BOX_LEFT, BOX_RIGHT, BOX_TOP, BOX_BOTTOM));
	$class   = 'FB'.$nbox.$pos;
	$out = '';
    $content = '
<style>
  .'.$class.' {
    background-color: transparent;
    border: 0;
    box-shadow: none;
    height: 0;
    margin: 0;
    padding: 0;
  } 
</style>
<div class="d-none">&nbsp;</div>';
	if ($sidebox) {
		$out .= boxthin($pos, '', $content, ' '.$class, 'off');
	} else {
		$out .= boxwide($pos, '', $content, ' '.$class);
	}
    return $out;
}

################################################################################

function fbox_freebox($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $serviz, $site, $userprefs, $web, $page, $tconfig, $charset;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
    $sidebox = in_array($pos, array(BOX_LEFT, BOX_RIGHT, BOX_TOP, BOX_BOTTOM));
    $id = $args[0];
    ReadDoc($id);
    if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) return FALSE;
    if ($type != TYP_FREEBOX) return FALSE;
    if ($status != 'a') return FALSE;
    $fieldweb   = intval($fieldweb);
    $max_height = $fieldweb;
	$dynbox     = explode('|', $fielda2);
	$class      = ' FB'.$nbox.$pos.$fileid;
    if ($lng == $lang[0]) {
        $titre   = $fieldb1;
        $contenu = PathToImage($fieldc1);
    }
    else {
        $titre = $fieldb2;
        $contenu = PathToImage($fieldc2);
    }
	if ($pos == BOX_EDITO && mb_substr(trim($titre), 0, 2, $charset) == '§§') 
		$titre = sprintf(empty($userprefs[1]) ? $web[1] : $web[167], stripslashes($site[($lang[0] == $lng ? 0 : 11)]), $userprefs[1]);
    $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : ($pos == BOX_EDITO ? '' : DisplayDownArrow($dynbox[0], trim($class))).$titre;
    $out = '
<div class="'.$pos.$tconfig.'fb'.$id.'">';
    $content = '';
    if (!empty($contenu)) {
        $content .= '
<style>
.freebox'.$id.' {
  max-height: '.($max_height > 0 ? $max_height.'px;' : 'none;').'
  overflow: '.($max_height > 0 ? 'hidden;' : 'visible;').'
  background: transparent;
}
</style>';
        $content .= '
  <div id="box'.$id.'30" class="w-100 box freebox'.$id.'">'.$contenu.'</div>
  <div class="clearfix"></div>';
        if ($max_height > 0) $content .= '
    <p id="box'.$id.'10" class="float-right c-pointer pr-5">
      <a href="javascript:cache(\'box'.$id.'30\');montre(\'box'.$id.'20\');cache(\'box'.$id.'10\');" title="'.$web[296].'">
        '.$web[296].' <i class="far fa-plus-square"></i>
      </a>
    </p>';
        if ($max_height > 0) {
            $content .= '
  <div id="box'.$id.'20" class="w-100 box" style="display: none;">'.$contenu.'
    <p class="float-right c-pointer pr-5">
      <a href="#freebox'.$pos.$id.'" title="'.$web[57].'" onclick="cache(\'box'.$id.'20\');montre(\'box'.$id.'30\');montre(\'box'.$id.'10\');">
	    '.$web[57].' <i class="far fa-minus-square"></i>
      </a>
    </p>
  </div><div class="clearfix"></div>';
        }
    }
  $content .= displayQuickConfig($pos, $id, 'freebox&amp;form=2&amp;tri=ch&amp;id='.$id, '', '', 26);
	if ($sidebox) {
		$out .= boxthin($pos, $titre, $content, $class, $dynbox[0]);
	} else {
		$out .= boxwide($pos, $titre, $content, $class);
	}
	$out .= '
</div>';
    return $out;
}

################################################################################

function fbox_user($pos = NULL, $args = NULL) {
    global $lng, $lang, $members, $nom, $userprefs, $web, $endurl, $serviz, $cryptinstall, 
	       $dynabox, $site, $urlrw, $page, $tconfig, $charset, $tabcounter, $drtuser, $z2, $presform;
    static $nbox = 0;
    $nbox++;
    $out = '
    <div class="box text-right m-auto">';

    if (!empty($userprefs[1])) {
        $out .='
	  <form name="useraccount'.$nbox.'" action="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[3].'-14-'.$tconfig.$z2 : 'compte.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" method="post">
	    <div class="text-center userButtonW cmptButton">'.SubmitButton($web[212]).'</div>
	  </form>';
        if ($serviz[18] != 'on') $out .= '
	  <form name="usermsg'.$nbox.'" action="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[13].'-3-3-'.$tconfig.$z2 : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;tconfig='.$tconfig.$z2).'" method="post">
	    <div class="text-center userButtonW msgButton">'.SubmitButton($web[318]).'</div>
	  </form>';
        $out .= '
	  <form name="useroff'.$nbox.'" action="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[3].'-1-off-'.$tconfig.$z2 : 'connect.php?lng='.$lng.'&amp;connect=off&amp;tconfig='.$tconfig.$z2).'" method="post">
	    <div class="text-center userButtonW cntButton">'.SubmitButton($web[372]).'</div>
	  </form>';
    }
    else {
        if ($members[19] != '0' && $members[19] != '3') {
            $out .='
	  <form 
          name="usermemb'.$nbox.'" 
          action="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[3].'-3-on-new-'.$tconfig.$z2 
            : 'connect.php?lng='.$lng.'&amp;connect=on&amp;uuser=new&amp;tconfig='.$tconfig.$z2).'" 
          method="post">
	    <div class="text-center userButtonW">'.SubmitButton($web[160]).'</div>
	  </form>
	  <hr />';
        }
        $out.= '
<style>
.lblusr i { font-size: 1.7rem; width: 1.85rem; }
.lblusr input, .passwd input { border-radius: '.$presform[9].'; }
.passwd input.texte {
  height: 3.3rem;
  border: thin solid #ced4da;
}
.passwd button i {
  width: 1.85rem;
  height: 2.36rem;
  font-size: 1.6rem;
  padding-top: 4px;
}
.passwd .btn-outline-secondary, #uid-eye .input-group-text {
  background-color: #e9ecef;
  border-color: #ced4da;
  border-radius: '.$presform[9].';
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
</style>
	  <div class="text-center m-auto">
        <b>'.$web[373].' :</b>
        <form 
            name="userin'.$nbox.'" 
            action="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[3].'-0-'.$tconfig.$z2 
              : 'connect.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" 
            method="post">
          <input type="hidden" name="connect" value="on"/>
          <input type="hidden" name="uuser" value="old"/>
          <div class="text-center w-100 m-auto" style="max-width: 300px;">
            <div class="lblusr input-group mb-3">
              <div class="input-group-prepend">
                <span class="input-group-text"><i class="far fa-user"></i></span>
              </div>
              <input class="form-control" type="text" name="pseudo" placeholder="'.$web[49].'" value=""/>
            </div>
            <div class="passwd input-group mb-3">
              <input 
                data-toggle="password"
                id="uuid'.$pos.$tconfig.'" 
                class="texte userIdentW form-control" 
                type="password" 
                name="uid" 
                placeholder="'.$web[300].'" 
                value=""
                data-message="" 
              />
            </div>
            ';
        $out .= '      
              '.SubmitButton($web[52]).'
          </div>
        </form>
	  </div>
	  <div class="text-center userLostW">
	    <a class="userLostA" href="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[3].'-16-'.$tconfig.$z2 
          : 'lostpass.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'">'.$web[592].'</a>
	  </div><br />';
    }
    $out .= '
    </div>';

    $nbrmsg = array();
    if (FileDBExist(MSGREP.$userprefs[1].DBEXT)) {
        $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
        if ($dbmsg[0][0] == $userprefs[7]) {
            for ($i = 2; $i < count($dbmsg); $i++) {
                if (isset($dbmsg[$i][3]) && $dbmsg[$i][3] == 'new') {
                    $nbrmsg[] = $dbmsg[$i][3];
                }
            }
        }
    }
    if (count($nbrmsg) != 0) {
        $act  = ($serviz[18] == 'on' ? '0' : '3');
        $out .= '
	<div class="userWave text-center">
      <a class="box" href="'.CHEMIN.($site['URLR'] == 'on'
        ? $lng.'-'.$urlrw[13].'-3-'.$act.'-'.$tconfig.$z2 
        : 'tinymsg.php?lng='.$lng.'&amp;action='.$act.'&amp;tconfig='.$tconfig.$z2).'">
        <i class="far fa-envelope blink display-4 text-success" title="'.$web[319].'"></i>
      </a>';
        if (FALSE === stristr($endurl, 'tinymsg.php')) {
            $out .= '
      <object type="audio/wave" data="'.CHEMIN.'inc/mail/mail.wav">
        <param name="src" value="'.CHEMIN.'inc/mail/mail.wav" />
        <param name="autoplay" value="true" />
        <param name="autoStart" value="1">
        <param name="controller" value="false">
        <param name="filename" value="'.CHEMIN.'inc/mail/mail.wav" />
        <param name="showcontrols" value="false" />
      </object>';
        }
        $out .= '
    </div>';
    }
    if ($serviz[158].$serviz[159] != 'onon') $out .= '
    <hr />';
    $file_users  = opendir(MSGREP);
    $nbr_membres = 0;
    while ($nomfichier = readdir($file_users)) {
        if ('.dtb' == $nomfichier) {
            @unlink(MSGREP.$nomfichier);
            continue;
        }
        if( substr($nomfichier,-3) == "dtb" ) {
            $nbr_membres++;
        }
    }
    closedir($file_users);
    if ($nbr_membres > 1) {
        $text_nbr_membres = $web[321];
    }
    else {
        $text_nbr_membres = $web[322];
    }
	if ($serviz[149] == 'on') {
		$out1 = $tabcounter[0].'&nbsp;';
		$out2 = $tabcounter[1].'&nbsp;';
		$out .= '
    <div class="userCount text-left">&nbsp;
	  '.$out1.($tabcounter[0] == 1 ? $web[15] : $web[16]).'<br />&nbsp;
      '.$out2.($tabcounter[1] == 1 ? $web[17] : $web[18]).'<br /><br />
	</div>';
	}
    $regusers    = ReadDBFields(DBIPSTATS);
    $usersonline = array();
	$myIP        = '';
    foreach ($regusers as $reg) {
        if (!empty($reg[2])) {
			if ($userprefs[1] == $reg[2]) $myIP = $reg[0];
            $usersonline[] = array($reg[2], $reg[0]);
        }
    }
    @usort($usersonline,'AsciiCompare');
	$uniqueusers   = array();
//	$uniqueusers[] = $usersonline[0];
	for ($i = 0; $i < count($usersonline); $i++) {
			$uniqueusers[] = $usersonline[$i];
	}

    if ($serviz[158] != 'on') {
        $accessok = isAccessGranted($serviz[179], $userprefs[1]);
        $out .= '
    <div class="userList box text-left">&nbsp;';
        if ($accessok && $userprefs[1] != '' && $userprefs[20] != 'on' && $userprefs[5] == 'on' && $serviz[86] == 'on') $out .= '
	  <a href="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[15].'-9-'.$tconfig.$z2 
          : 'memberlist.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" title="'.$web[664].'"><strong>';
        $out .= '<i class="fas fa-users"></i>&nbsp;'.$nbr_membres." ".$text_nbr_membres;
        if ($accessok && $userprefs[1] != '' && $userprefs[20] != 'on' && $serviz[86] == 'on') $out .= '</strong>
      </a>';
        $out .= '
	</div>';
    }
    $visits  = ReadDBFields(USERREP.'visitsofday.dtb');
    $today   = date('Ymd');
    $visits1 = array();
    foreach ($visits as $visit) if ($visit[1] == $today) $visits1[] = $visit;
    $found = false;
    foreach ($uniqueusers as $unuser) {
        foreach ($visits1 as $visit) if ($visit[0] == $unuser[0]) $found = true;
        if (!$found && !empty($unuser[0])) $visits1[] = array($unuser[0], $today);
        $found = false;
    }
    WriteDBFields(USERREP.'visitsofday.dtb', $visits1);
	$visits    = array();
	$nomvisits    = array();
	if ($userprefs[1] != '' && $userprefs[20] != 'on' && $serviz[111] == 'on') {
		$visitsday = SelectDBFieldsByField(ReadDBFields(USERREP.'visitsofday.dtb'), 1, $today);
		foreach ($visitsday as $visit) {
            if (is_file(MSGREP.$visit[0].'.dtb')) {
                $dbmsg = ReadDBFields(MSGREP.$visit[0].DBEXT);
              if (isset($dbmsg[1][6]))
				{
					if ($dbmsg[1][6] == 'on')
					{					
						$visits[] = $visit;
						$nomvisits[] = $visit[0];
					}
				}
                unset($dbmsg);
            }
		}
		$nomvisits = array_unique($nomvisits);
		$out .= '
	<div class="userVisits box text-left">&nbsp;';
		$nbvisits = count($nomvisits);
		if ($nbvisits > 0) $out .= '
	  <a class="c-pointer" title="'.$web[677].'" onmouseup="montre(\'visits'.$nbox.'\');">';
		$out .= '<i class="fas fa-user-check"></i>&nbsp;'.$web[677].$nbvisits;
		if ($nbvisits > 0) $out .= '
	  </a>';
		$out .= '
	</div>
<style>
.visits {
    margin-top: -'.min(200, ($nbvisits*18)).'px;
}
</style>
	<div id="visits'.$nbox.'" class="visits">
	  <div class="visits2">';
		foreach ($nomvisits as $nomvisit) {
			$db = ReadDBFields(MSGREP.$nomvisit.'.dtb');
            if (!empty($db) && $db[1][6] == 'on') {
                $out .= '<div class="connectedofday">';
                if ($page[23] != 'none') {
                    if (!empty($db[1][16]) || $db[1][9] != 'ava-00') {
                        if ($db[1][9] == 'ava-00' && !empty($db[1][16])) $out .= '
            <img src="'.$db[1][16].'" class="ava-img my-1" alt="" />';
                        else $out .= '
            <i class="'.$db[1][9].' ava-img my-1"></i>';
                    }
                    elseif ($db[1][9] == 'ava-00') {
                        $out .= '
            <i class="ava-00 ava-img my-1"></i>';
                    }
                }
                $out .= $nomvisit.'
                </div>';
            }
		}
		$out .= '
	  </div>
	  <div class="visitsClose float-right c-pointer" onmouseup="cache(\'visits'.$nbox.'\')">&#xe808;</div>
	  <div class="clearfix"></div>
	</div>';
	}
    if ($serviz[159] != 'on') {
        $out .= '
    <div class="box text-left connectedList"><b>'.$web[175].'</b></div>';
        if (empty($usersonline)) {
            $out .= '
    <div class="box text-center">'.$web[176].'</div>';
        }
        else {
            $out .= '
    <div class="box text-left connectedList">';
            for ($i = 0; $i < count($uniqueusers); $i++) {
				if (isset($uniqueusers[$i][1]) && $uniqueusers[$i][1] != '')
				{
					if (substr($serviz[85], -1) != '/') $serviz[85] = $serviz[85].'/';
					if (!isset($drtuser[42])) $drtuser[42] = '';
					$whois = (($serviz[31] == $userprefs[1] || $serviz[176] == $userprefs[1] || $drtuser[42] == 'admin') && $serviz[84] == 'on' 
					  ? ' (<a href="'.$serviz[85].$uniqueusers[$i][1].'" title="'.$uniqueusers[$i][1].'" target="_blank">'.substr($uniqueusers[$i][1], 0, 8).'...</a>)' : '');
					$db = ReadDBFields(MSGREP.$uniqueusers[$i][0].'.dtb');
					if ($db[1][6] == 'on') {
						if (!empty($db[1][16]) || $db[1][9] != 'ava-00') {
							if ($db[1][9] == 'ava-00' && !empty($db[1][16])) 
								$avatar = '<img class="img-ava mr-2" src="'.$db[1][16].'" alt="" />';
							else 
								$avatar = '<i class="'.$db[1][9].' ava-img mr-2"></i>';
						}
						elseif ($db[1][9] == 'ava-00') {
							$avatar = '<i class="ava-00 ava-img mr-2"></i>';
						}
						$avatar = $page[23] == 'none' ? ' ' : $avatar;
						if ($userprefs[1] != '' && $userprefs[1] != $uniqueusers[$i][0] && $db[1][24] == 'on') {
							$from = $userprefs[1];
							$out .= '
		  <div class="connectedUserW">
			<i class="fas fa-caret-right connectedImg" title="'.$web[321].'"></i>'.$avatar;
							if ($serviz[18] != 'on') $out .= '
			<a href="'.CHEMIN.($site['URLR'] == 'on' 
				? $lng.'-'.$urlrw[13].'-2-1-'.$uniqueusers[$i][0].'-'.$from.'-'.$tconfig.$z2 
				: 'tinymsg.php?lng='.$lng.'&amp;action=1&amp;to='.$uniqueusers[$i][0].'&amp;from='.$from.'&amp;tconfig='.$tconfig.$z2).'" 
				  title="'.$web[214]." ".$uniqueusers[$i][0].'">
			  <i class="far fa-envelope" title="'.$web[214]." ".$uniqueusers[$i][0].'"></i>
			</a>';
							$out .= '&nbsp;&nbsp;'.$uniqueusers[$i][0].$whois.'
		  </div>';
						}
						else {
							$out .= '
		  <div class="connectedUserW">
			<i class="fas fa-caret-right connectedImg" title="'.$web[321].'"></i>'.$avatar.$uniqueusers[$i][0].'
		  </div>';
						}
					}
				}
            }
            if ($userprefs[1] != '' && $serviz[84] == 'on') {
                $smyIP = substr($myIP, 0, 15).(mb_strlen($myIP) > 15 ? ' ...' : '');
                $out .= '
	  <div class="text-center userprefIP">IP: <a href="'.$serviz[85].$myIP.'" title="'.$myIP.'" target="_blank">'.$smyIP.'</a></div>';
            }
            $out .= '
    </div>';
        }
    }
    if (is_null($pos)) return $out;
	$out .= displayQuickConfig($pos);
	$titre = getLabel($nom[$lng == $lang[0] ? 34 : 35]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[5], 'USR'.$nbox.$pos.$tconfig).$titre;
    return '
<div class="'.$pos.$tconfig.'USR">'.boxthin($pos, $titre, $out, ' USR'.$nbox.$pos.$tconfig, $dynabox[5]).'
</div>';
}

################################################################################

function fbox_webm($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $serviz, $user, $userprefs, $web, $page, $site, $dynabox, $urlrw, 
           $tconfig, $charset, $meskin, $z2;
    static $nbox = 0;
    $nbox++;
    if (isset($user[1])) $em = BreakEMail($user[1]);
    $out = '
<div class="box webm">
  <div class="webmtblW">
    <div class="table-responsive-md">
    <table class="table-responsive-md table-borderless">';
    if ($serviz[21] == 'on') {
		$out .= '
      <tr class="webmlh">';
        if ($serviz[99] == 'on') {
            $out .= '
        <td class="p-3 text-center">
          <i class="fas fa-user-edit" title="'.$web[173].' '.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'"></i>
        </td>
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[2].'-'.$tconfig.$z2 : $site['CT'].'.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" title="'.$web[464].'">&nbsp;'.$web[464].'</a>
        </td>';
        } else {
            $out .= '
        <td class="p-3 text-center">
          <i class="fas fa-user-edit" title="'.$web[173].' '.$user[0].'"></i>
        </td>';
            if ($user[3] == 'on') {
                $out .= '
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[14].'-'.TYP_MAIL.$z2 
              : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_MAIL.$z2).'" title="'.$web[173].' '.$user[0].'">
            &nbsp;'.$web[11].'
          </a>
        </td>';
            } else {
				$org  = 'webm';
                $out .= '
        <td class="p-3 text-left">
          <a data-target="#contactmodal" data-toggle="modal" class="box" style="cursor: pointer;" title="'.$web[173].' '.$user[0].'">&nbsp;'.$web[11].'</a>
        </td>
        <style> .modal-header { padding: 15px; } </style>
        <div class="modal fade" id="contactmodal" role="dialog">
          <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
            <div class="modal-content">
              <div class="modal-header">
                <h2>'.$web[173].' '.$user[0].'</h2>
                <button class="close" data-dismiss="modal" type="button"><i class="fas fa-times"></i></button>
              </div>
              <div class="modal-body">
                <p class="text-center popupMail">'.$web[644].'</p>
                <p class="text-center popupMail">
                  <a href="javascript:showEmails'.$org.'(\''.$em[0].'\',\''.$em[1].'\',\''.$em[2].'\');" 
                      title="'.addslashes($user[0]).'" class="text-center popupMail">
                    '.addslashes($user[0]).'
                  </a>
                </p>
                <p class="text-center popupMail"><b><span id="lblemail'.$org.'">(--------------)</span></b></p>
              </div>
            </div>
          </div>
        </div>
        <script>
          function showEmails'.$org.'(em1, em2, em3) {
            var emailFinal = "<a href=\'mailto:" + em1 + "@" + em2 + "." + em3 + "\'>" + em1 + "@" + em2 + "." + em3 + "</a>";
            document.getElementById("lblemail'.$org.'").innerHTML = emailFinal;
          }
        </script>';
            }
        }
		$out .= '
	  </tr>';
    }
    if ($serviz[62] == 'on') {
        $out .= '
      <tr class="webmlh">
        <td class="p-3 text-center">
          <i class="far fa-grin-hearts" title="'.$web[124].'"></i>
        </td>
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[14].'-'.TYP_RECO.$z2 
              : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_RECO.$z2).'" title="'.$web[124].'">
            &nbsp;'.$web[120].'
          </a>
        </td>
	  </tr>';
    }
    if (is_dir(CHEMIN.'mobile')) {
        $out .= '
      <tr class="webmlh">
        <td class="p-3 text-center">
          <i class="fas fa-mobile-alt" title="'.$web[295].'"></i>
        </td>
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.'mobile/?lng='.$lng.'"" target="_blank">&nbsp;'.$web[295].'</a>
        </td>
	  </tr>';
    }
    if (!empty($serviz[177])) {
        $out .= '
      <tr class="webmlh">
        <td class="p-3 text-center">
          <i class="fas fa-file-contract" title="'.$web[301].'"></i>
        </td>
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[20].'-102-'.$serviz[177].'-'.$serviz[178] 
              : 'articles.php?lng='.$lng.'&pg='.$serviz[177].'&tconfig='.$serviz[178]).$z2.'" title="'.$web[301].'">
            &nbsp;'.$web[301].'
          </a>
        </td>
      </tr>';
    }
    $out .= '
    </table>
    </div>
  </div>
</div>';
    $out .= displayQuickConfig($pos);
	$titre = getLabel($nom[$lng == $lang[0] ? 40 : 41]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[8], 'WEB'.$nbox.$pos.$tconfig).$titre;
    return '
<div class="'.$pos.$tconfig.'WEB">'.boxthin($pos, $titre, $out, ' WEB'.$nbox.$pos.$tconfig, $dynabox[8]).'</div>';
}

################################################################################

function fbox_cal($pos = NULL, $args = NULL) {
    global $lng, $lang, $nom, $drtuser, $page, $serviz, $userprefs, $web, $dynabox, $site, $urlrw, 
        $tconfig, $charset, $members;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[14])) return FALSE;
    if ($serviz[47] == 'on') {
		$titre = getLabel($nom[$lng == $lang[0] ? 32 : 33]);
		$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[4], 'CAL'.$nbox.$pos.$tconfig).$titre;
        $out = '
<script>
function getElement(aID) {
    return (document.getElementById) ? document.getElementById(aID) : document.all[aID];
}
function getIFrameDocument(aID){ 
    var rv = null; 
    var frame=getElement(aID);
    if (frame.contentDocument)
      rv = frame.contentDocument;
    else
      rv = document.frames[aID].document;
    return rv;
  }
    
function adjustMyFrameHeight'.$nbox.$pos.$tconfig.'() {
	var frame = getElement("calbox'.$nbox.$pos.$tconfig.'");
	var frameDoc = getIFrameDocument("calbox'.$nbox.$pos.$tconfig.'");
	frame.height = frameDoc.body.offsetHeight + 2;
}
</script>
<noscript>';
		$hcal = '340';
		$out .= '
</noscript>
<div class="text-center bg-inherit">
  <iframe 
    class="cal" 
    id="calbox'.$nbox.$pos.$tconfig.'" 
    src="'.CHEMIN.'inc/'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[17].'-'.$pos.'-'.$tconfig.'-'.$nbox 
      : 'calendar.php?lng='.$lng.'&amp;pos='.$pos.'&amp;tconfig='.$tconfig.'&amp;nbox='.$nbox).'" 
    height="'.$hcal.'">
  </iframe>
</div>
';
        $out   .= displayQuickConfig($pos, false, 'agenda', '', '', 37);
        return '
<div class="'.$pos.$tconfig.'CAL'.$nbox.'">'.boxthin($pos, $titre, $out, ' CAL'.$nbox.$pos.$tconfig, $dynabox[4]).'</div>';
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_newslet($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $members, $nom, $serviz, $userprefs, $web, $page, $cryptinstall, $dynabox, $site, $urlrw,
           $tconfig, $charset, $z2, $rgpd;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[18], $userprefs[1])) {
        return FALSE;
    } else {
		$titre = getLabel($nom[$lng == $lang[0] ? 38 : 39]);
		$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[6], 'NWL'.$nbox.$pos.$tconfig).$titre;
		// suppression des inscriptions en attente hors délai
		$tmp = ReadDBFields(NEWSLET_WAIT);
		for ($i = 0; $i < count($tmp); $i++) {
			if ((date('Ymd') - $serviz[110]) > substr($tmp[$i][3], 0, 8)) {
				unset($tmp[$i]);
			}
		}
		WriteDBFields(NEWSLET_WAIT, $tmp);
        $nabon = CountDBFields(NEWSLET_LIST);
        $mot   = $nabon < 2 ? $web[257] : $web[258];
        $txt1  = !empty($userprefs[1]) ? $userprefs[1] : $web[259];
        $txt2  = !empty($userprefs[2]) ? $userprefs[2] : $web[260];
        $txt3  = ($nabon == 0) ? $mot.'<br />'.$web[176] : $nabon.' '.$mot;
        $txt3 = $serviz[63] == 'on' ? '' : '
<div class="nwl_nabon text-center">'.$txt3.'</div>';
        if (empty($userprefs[1])) { // non membre
            $out = '
<form 
  class="nwlSubscribe" 
  name="subscribe'.$nbox.'" 
  action="'.CHEMIN.($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[18].$z2 
    : $site['NL'].'.php?lng='.$lng.$z2).'" 
  method="post">
  <input type="hidden" name="nlsecure" value="on" />
  <div class="box">
    <div class="text-center">'.$web[247].'<span class="d-none"><input type="text" name="code_pseudo" value="" /></span></div>
    <div class="input-group mb-3 w-100 mx-auto" style="max-width: 300px;">
      <div class="input-group-prepend">
        <span class="input-group-text"><i class="far fa-user"></i></span>
      </div>
      <input class="texte form-control" type="text" name="nlpseudo" value="'.$txt1.'" onfocus="this.value=\'\'" />
    </div>
    <div class="input-group mb-3 w-100 mx-auto" style="max-width: 300px;">
      <div class="input-group-prepend">
        <span class="input-group-text"><i class="fas fa-at"></i></i></span>
      </div>
      <input class="texte form-control" type="text" name="nlmail" value="'.$txt2.'" onfocus="this.value=\'\'" />
    </div>
    <div class="nwlActionW">
      <label for="action1">'.$web[237].'</label> <input type="radio" id="action1" name="action" value="sub" checked="checked" />
    </div>
    <div class="nwlActionW">
      <label for="action2">'.$web[236].'</label> <input type="radio" id="action2" name="action" value="unsub" />
    </div>';
            if (!empty($serviz[177]) && !OK_RGPD_date($userprefs[1])) $out .= '
    <br/>
    <fieldset class="w-100 mx-auto text-left" style="max-width: 300px;">
      <p>'.$web[693].'</p>
      <div><label for="rgpd">'.$web[415].':&nbsp;&nbsp;&nbsp;</label><input type="checkbox" id="rgpd" name="rgpd"'.Checked($rgpd).' /></div>
    </fieldset>';
            if ($serviz[100] != '0' && $serviz[93] == 'on' && ($userprefs[1] == '' || $serviz[98] == '')) {
				$lbl = $serviz[100] == '3' ? $web[642] : '';
                $out .= '
	<div class="text-center boxCryptW">
      '.dsp_crypt(0, 1, 3, 1, $lbl, $serviz[115] == 'on' ? $web[643] : '').'
	  <div class="text-center m-auto">
	    '.($serviz[100] == '3' ? '' : $web[530]).'<input class="texte inputcrypt m-auto form-control" type="text" name="crypt" />
	  </div>
	</div>';
            }
            $out .= '
    <div class="text-center">'.SubmitButton($web[52]).'</div>'.$txt3.'
  </div>
</form>';
        } else {
            $abon = CheckDB2Fields(NEWSLET_LIST, $userprefs[1], 0, $userprefs[2], 1);
            if ($abon) { // abonné
                $out = '
<form 
  class="nwlUnsubscribe" 
  name="unsubscribe'.$nbox.'" 
  action="'.CHEMIN.($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[18].$z2 
    : $site['NL'].'.php?lng='.$lng.$z2).'" 
  method="post">
  <input type="hidden" name="nlsecure" value="on" />
  <input type="hidden" name="action" value="unsub" />
  <input type="hidden" name="nlpseudo" value="'.$userprefs[1].'" />
  <input type="hidden" name="nlmail" value="'.$userprefs[2].'" />
  <div class="box">
    <div class="text-center">'.$web[500].'<span class="d-none"><input type="text" name="code_pseudo" value="" /></span></div>';
                if ($serviz[100] != '0' && $serviz[93] == 'on' && $serviz[98] == '') {
					$lbl = $serviz[100] == '3' ? $web[642] : '';
                    $out .= '
	<div class="text-center boxCryptW">
	  '.dsp_crypt(0, 1, 3, 1, $lbl, $serviz[115] == 'on' ? $web[643] : '').'
	  <div class="text-center m-auto">
	    '.($serviz[100] == '3' ? '' : $web[530]).'<input class="texte inputcrypt m-auto form-control" type="text" name="crypt" />
	  </div>
	</div>';
                }
                $out .= '
    <div class="text-center">'.SubmitButton($web[236]).'</div>'.$txt3.'
  </div>
</form>';
            } else {
                $tmp = CheckDB2Fields(NEWSLET_WAIT, $userprefs[1], 0, $userprefs[2], 1);
                if ($tmp) { // abonnement en attente de confirmation
                    $out = '
<div class="text-center">'.$web[501].'</div>'.$txt3;
                } else { // non abonné à la newsletter
                    $out = '
<form class="nwlSubscribe" name="subscribe'.$nbox.'" 
    action="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[18] : $site['NL'].'.php?lng='.$lng).$z2.'" method="post">
  <input type="hidden" name="nlsecure" value="on" />
  <input type="hidden" name="action" value="sub" />
  <div class="box">
    <div class="text-center">'.$web[247].'<span class="d-none"><input type="text" name="code_pseudo" value="" /></div>
    <div class="input-group mb-3 w-100 mx-auto" style="max-width: 300px;">
      <div class="input-group-prepend">
        <span class="input-group-text"><i class="far fa-user"></i></span>
      </div>
      <input class="texte nwlIdentW form-control" type="text" name="nlpseudo" value="'.$txt1.'" onfocus="this.value=\'\'" />
    </div>
    <div class="input-group mb-3 w-100 mx-auto" style="max-width: 300px;">
      <div class="input-group-prepend">
        <span class="input-group-text"><i class="fas fa-at"></i></i></span>
      </div>
      <input class="texte nwlIdentW form-control" type="text" name="nlmail" value="'.$txt2.'" onfocus="this.value=\'\'" />
    </div>';
                if (!empty($serviz[177]) && !OK_RGPD_date($userprefs[1])) $out .= '
    <br/>
    <fieldset class="w-100 mx-auto text-left" style="max-width: 300px;">
      <p>'.$web[693].'</p>
      <div><label for="rgpd">'.$web[415].':&nbsp;&nbsp;&nbsp;</label><input type="checkbox" id="rgpd" name="rgpd"'.Checked($rgpd).' /></div>
    </fieldset>';
                    if ($serviz[100] != '0' && $serviz[93] == 'on' && $serviz[98] == '') {
						$lbl = $serviz[100] == '3' ? $web[642] : '';
                        $out .= '
	<div class="text-center boxCryptW">
	  '.dsp_crypt(0, 1, 3, 1, $lbl, $serviz[115] == 'on' ? $web[643] : '').'
	  <div class="text-center m-auto">
	    '.($serviz[100] == '3' ? '' : $web[530]).'<input class="texte inputcrypt m-auto form-control" type="text" name="crypt" />
	  </div>
	</div>';
                    }
                    $out .= '
    <div class="text-center">'.SubmitButton($web[237]).'</div>'.$txt3.'
  </div>
</form>';
                }
            }
        }
        $out   .= displayQuickConfig($pos, false, '', '', '', 33);
        return '
<div class="'.$pos.$tconfig.'NWL">'.boxthin($pos, $titre, $out, ' NWL'.$nbox.$pos.$tconfig, $dynabox[6]).'</div>';
    }
}

################################################################################

function fbox_rss($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $serviz, $userprefs, $web, $page, $dynabox, $site, 
         $urlrw, $tconfig, $charset, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
    $dbrss = ReadDBFields(DBRSS);
    sort($dbrss);
    $out = '';
    $i = $lng == $lang[0] ? 0 : 1;
	$titre = getLabel($nom[36 + $i]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[7], 'RSS'.$nbox.$pos.$tconfig).$titre;
    for ($j = 0; $j < count($dbrss); $j++) {
        Readdoc($dbrss[$j][4]);
        $tconf = empty($fieldweb) ? 0 : ($fieldweb == 'ALL' ? $tconfig : $fieldweb);
        $out .= '
<div class="text-center itemRssBoxW">
  <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[19].'-2-'.$dbrss[$j][4].'-'.$tconf.$z2 
      : 'newsrss.php?lng='.$lng.'&amp;id='.$dbrss[$j][4].'&amp;tconfig='.$tconf.$z2).'">
    '.$dbrss[$j][$i].'
  </a>
</div>';
    }
    $out   .= displayQuickConfig($pos, false, 'rss', '', '', 34);
    return '
<div class="'.$pos.$tconfig.'RSS">'.boxthin($pos, $titre, $out, ' RSS'.$nbox.$pos.$tconfig, $dynabox[7]).'</div>';
}

################################################################################

function fbox_socnet($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $serviz, $userprefs, $web, $page, $nom, $site, $urlrw, $tconfig, $charset, 
		$status, $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $dynabox, $z2;
    static $nbox = 0;
    $nbox++;
    $dbnet = ReadDBFields(DBSOCNET);
    $nbnet = count($dbnet);
    for ($j = 0; $j < $nbnet; $j++) {
        $dbnet[$j][0] = $dbnet[$j][2];
        if (substr($dbnet[$j][0], 0, 4) == '<!--') 
            $dbnet[$j][0] = str_replace('<!--', '', $dbnet[$j][0]);
        else
            $dbnet[$j][0] = $nbnet;
    }
	@sort($dbnet);
    $out = '
<div class="text-left iconSocnetW">';
    for ($j = 0; $j < count($dbnet); $j++) {
		ReadDoc($dbnet[$j][4]);
        if ($fieldc2 != '') $soc = SelectDBFieldsByField(ReadDBFields(CONFIGREP.'socnet.dtb'), 0, $fieldc2);
		if ($status == 'a' && trim($fieldd1) != '') {
            $cr = ($fielda1 == 'on' ? $soc[0][1] : '#000000');
            $bg = ($fielda1 == 'on' ? $soc[0][2] : '#E9ECEF');
            $rd = ($fielda2 == 'on' ? 'circle' : '6px');
            $sz = $fieldb2;
            $fielda2 = $fieldb2 = '';
            $out .= '
  <style> .soc a:hover { color: '.$cr.'; background-color: '.$bg.'; } </style>
';
            if ($fieldc2 == 'rss' && ($serviz[16] == 'on' || $serviz[54] == 'on' || $serviz[60] == 'on' || $serviz[103] == 'on')) $out .= '
  <div class="soc d-inline-block" data-size="'.$sz.'" data-iconcolor="'.$cr.'" data-buttoncolor="'.$bg.'" data-spacing="10px" data-radius="'.$rd.'">
    <a class="soc-rss" href="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[19].$z2 : 'rss.php?lng='.$lng.$z2).'" title="'.$web[617].'" target="'.$fieldc1.'"></a>
  </div>';
            elseif ($fieldd2 != '' && strpos($fieldd2, '.') > 0) 
			{
				$out .= '
  <div class="d-inline-block align-top">
    <a href="'.$fieldd1.'" title="'.(strip_tags($fieldb1)).'" target="'.$fieldc1.'">
      <img src="'.CHEMIN.'img/'.$fieldd2.'" alt="'.(strip_tags($fieldb1)).'" style="width:'.$sz.';" />
    </a>
  </div>';
			}
            else 
			{
				$out .= '
  <div class="soc d-inline-block" data-size="'.$sz.'" data-iconcolor="'.$cr.'" data-buttoncolor="'.$bg.'" data-spacing="10px" data-radius="'.$rd.'">
    <a href="'.$fieldd1.'" class="soc-'.$fieldc2.'" title="'.(strip_tags($fieldb1)).'" target="'.$fieldc1.'"></a>
  </div>';
			}
		}
    }
    $out .= '
</div>    
<div class="clearfix"></div>';
    $out  .= displayQuickConfig($pos, false, 'socnet', '', '', 50);
	$titre = getLabel($nom[$lng == $lang[0] ? 48 : 49]);
	if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
		return '<div class="boxnet NET'.$pos.$tconfig.'">'.$out.'</div>';
	} else {
		if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
            $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[9], 'NET'.$nbox.$pos.$tconfig).$titre;
			return '
<div class="'.$pos.$tconfig.'NET">'.boxthin($pos, $titre, $out, ' NET'.$nbox.$pos.$tconfig, $dynabox[9]).'</div>';
		} else {
            $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : $titre;
			return boxwide($pos, $titre, $out, ' NET'.$pos.$tconfig);
		}
	}
}

################################################################################

function fbox_lastdoc($pos = NULL, $args = NULL) {
    global $lng, $lang, $nom, $page, $serviz, $site, $userprefs, $web, $urlrw, $tconfig, 
	       $charset, $drtuser, $dynabox, $members, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    if (!isAccessGranted($members[22])) return FALSE;
	if ($serviz[116] != 'on') return false;
	if ($serviz[117].$serviz[118] == '') return false;
    static $nbox = 0;
    $nbox++;
    $out   = '';
    $ndays = 0;
    if ($serviz[118] == 'on') $ndays = !empty($serviz[119]) && is_numeric($serviz[119]) ? $serviz[119] : '15';
	if ($serviz[118] == 'on' && $ndays > 0) $dat = date('YmdHi', strtotime($ndays.' days ago'));
    if ($serviz[117] == 'on') {
        if ($userprefs[1] != '') $dat = !empty($userprefs[14]) ? $userprefs[14] : date('YmdHi');
        else $dat = date('YmdHi');
    }
	$db    = $dba = $dbb = array();
	$docid = SelectDBFieldsByStatus(ReadDBFields(DOCID), 'a');
	$dbdat = ReadDBFields(DOCDATES);
	foreach ($dbdat as $item) if ($item[2] >= $dat) $db[] = array($item[2], $item[0]);
	rsort($db);
	$dbag = $dbag2 = $dbar = $dbra = $dbom = $dbbl = $dbrb = $dbdn = $dbfa = $dbfr = $dbli = $dbgb = $dbne = $dbph = array();
	foreach ($db as $item) {
		$typ    = SelectDBFieldsByField($docid, 1, $item[1]);
		$idat   = $serviz[169] == 'on' ? '' : substr(FormatDate($item[0]), 0, 10).' :';
		$typdoc = empty($typ[0][0]) ? '' : $typ[0][0];
		switch ($typdoc) {
		case 'ag' : // agenda
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[14]) ? true : false;
			if ($serviz[121] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
                $valid_date = (int)substr($fielda1, 0, 8) >= (int)date('Ymd');
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a' && $valid_date) {
					$url0 = 'agenda.php?lng='.$lng.'&amp;idpg='.$fileid.'-'.'&amp;pg='.$item[0].'&amp;agv=1&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[17].'-22-'.$fileid.'--'.$fileid.'-1-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.FormatDate(substr($fielda1, 0, 8)).' - '.CutLongWord(strip_tags($lng == $lang[0] ? $fieldc1 : $fieldc2), 36).'...</a>';
					$dbag[]  = array($nom[$lng == $lang[0] ? 32 : 33], $link);
                    $dbag2[] = $fielda1;
				}
			}
			break;
		case 'ar' : // articles
   		case 'ra' : // réactions articles
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[1]) ? true : false;
            $id = false;
            if ($typdoc == 'ra' && $serviz[29] != '2' && $serviz[166] == 'on' && !$zmbr) {
                $dbw = SelectDBFieldsByField(ReadDBFields(DBREACT), 0, $item[1]);
                $id  = $dbw[0][1];
            }
            if ($typdoc == 'ar' && $serviz[122] == 'on' && !$zmbr) {
                $id = $item[1];
            }
            if ($id) {
                ReadDoc($id);
                $afm   = explode('|', $fieldmail);
                $tconf = $typdoc == 'ar' ? ($afm[0] == 'ALL' ? $tconfig : $afm[0]) : $fieldmail;
                $tconf = empty($tconf) ? $tconfig : $tconf;
                if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
                    $fa1  = $fielda1;
                    $fa2  = $fielda2;
                    $fb1  = $fieldb1;
                    $fb2  = $fieldb2;
                    $dbwo = ReadDBFields(DBOPTMENU);
                    $url0 = 'articles.php?lng='.$lng.'&pg='.$id.'&tconfig='.$tconf.$z2;
                    $url1 = $lng.'-'.$urlrw[20].'-102-'.$id.'-'.$tconf.$z2;
                    foreach ($dbwo as $item1) {
                        ReadDoc($item1[4]);
                        if (!isAuthorizedPublication($creadate) || !isAccessGranted($fieldmod) || $status != 'a') continue;
                        $urls = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
                        $pg   = substr($urls[0], strpos($urls[0], 'pg=') + 3);
                        $pos1 = strpos($pg, '&');
                        $pg   = $pos1 === false ? $pg : substr($pg, 0, $pos1);
                        if ($pg == $id) {
                            $fa1  = $fielda1;
                            $fa2  = $fielda2;
                            $fb1  = $fieldb1;
                            $fb2  = $fieldb2;
                            $tcnf = empty($fieldmail) ? $tconf : $fieldmail;
                            $url0 = 'articles.php?lng='.$lng.'&pg='.$pg.'&mnuid='.$item1[5].'&tconfig='.$tcnf.$z2;
                            $url1 = $lng.'-'.$urlrw[20].'-103-'.$pg.'-'.$item1[5].'-'.$tcnf.$z2;
                            break;
                        }
                    }
                    $link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fa1 : $fa2).' - '.strip_tags($lng == $lang[0] ? $fb1 : $fb2).'</a>';
                    if ($typdoc == 'ar') {
                        $dbar[] = array($web[169], $link); 
                        $dba[]  = $id;
                    }
                    if ($typdoc == 'ra') {
                        $dbra[] = array($web[187], $link); 
                        $dba[]  = $id;
                    }
                }
            }
            break;
		case 'om' : // options de menu indépendantes des services
			if ($serviz[154] == 'on') {
				ReadDoc($item[1]);
                $targets = array('agenda', 'articles', 'blog', 'download', 'faq', 'links', 'guestbk', 'thread', 'news', 'photorama2');
                $isValid = true;
                foreach($targets as $target) if (strpos($fieldd1, $target.'.php') === true) $isValid = false;
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a' && $isValid) {
                    $fa1  = $fielda1;
                    $fa2  = $fielda2;
                    $fb1  = $fieldb1;
                    $fb2  = $fieldb2;
                    $urls = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
                    if (empty($urls[1])) $urls[1] = $urls[0];
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $urls[1].$z2 : $urls[0].$z2).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fa1 : $fa2).' - '.strip_tags($lng == $lang[0] ? $fb1 : $fb2).'</a>';
					$dbom[] = array($web[448], $link);
				}
			}
			break;
		case 'bl' : // blog et commentaires
		case 'rb' : 
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[15]) ? true : false;
            $id = false;
            if ($typdoc == 'rb' && $serviz[57] != '2' && $serviz[167] == 'on' && !$zmbr) {
                $dbw = SelectDBFieldsByField(ReadDBFields(DBREBLOG), 0, $item[1]);
                $id  = $dbw[0][1];
            }
            if ($typdoc == 'bl' && $serviz[123] == 'on' && !$zmbr) {
                $id = $item[1];
            }
            if ($id) {
                ReadDoc($id);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
                    $url0 = $site['BL'].'.php?lng='.$lng.'&amp;sel=pg&amp;tconfig='.$tconfig.'&amp;pg='.$fileid.$z2;
                    $url1 = $lng.'-'.$urlrw[1].'-2-pg-'.$tconfig.'-'.$fileid.$z2;
                    $link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
                    if ($typdoc == 'bl') {
                        $dbbl[] = array($nom[$lng == $lang[0] ? 42 : 43], $link); 
                        $dbb[]  = $id;
                    }
                    if ($typdoc == 'rb') {
                        $dbrb[] = array($web[407].' '.mb_strtolower($nom[$lng == $lang[0] ? 42 : 43]), $link);
                        $dbb[]  = $id;
                    }
				}
			}
			break;
		case 'dn' : // téléchargements
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[7]) ? true : false;
			if ($serviz[124] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
					$url0 = $site['DN'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[11].'-4-'.$fileid.'-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
					$dbdn[] = array($nom[$lng == $lang[0] ? 1 : 11], $link);
				}
			}
			break;
		case 'fa' : // faq
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[4]) ? true : false;
			if ($serviz[125] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
					$url0 = 'faq.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[4].'-6-'.$fileid.'-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
					$dbfa[] = array($nom[$lng == $lang[0] ? 24 : 25], $link);
				}
			}
			break;
		case 'fr' : // forum
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[5]) ? true : false;
			if ($serviz[126] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
                if (isForumAccessGranted($fieldb2)) {
                    $dbw  = SelectDBFieldsByField(ReadDBFields(DBFORUM), 1, $fielda1);
                    $fid  = @$dbw[0][2];
                    $urw0 = empty($fieldb2) ? '-41-'.$fid : '-4-'.$fid.'-'.getForumcatId($fieldb2);
                    $urw1 = empty($fieldb2) ? '-411-'.$fid : '-5-'.$fid.'-'.getForumcatId($fieldb2);
                    $url0 = $site['TH'].'.php?lng='.$lng.'&amp;pg='.$fid.'&amp;cat='.getForumcatId($fieldb2).($fielda2 == '0' ? '' : '&amp;id=1#R'.$fielda2);
                    $url1 = $lng.'-'.$urlrw[5].($fielda2 == '0' ? $urw0.$z2 : $urw1.'-1#R'.$fielda2);
                    $lbl0 = ($fielda2 == '0' ? 'S' : 'R').$fielda1;
                    $lbl1 = $fielda2 == '0' ? $fieldb1 : CutLongWord(strip_tags($fieldc1), 36).'...';
                    $link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.$lbl0.' - '.strip_tags($lbl1).'</a>';
                    $dbfr[] = array($nom[$lng == $lang[0] ? 22 : 23], $link);
                }
			}
			break;
		case 'li' : // liens
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[3]) ? true : false;
			if ($serviz[127] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
					$url0 = 'links.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[6].'-5-'.$fileid.'-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
					$dbli[] = array($nom[$lng == $lang[0] ? 3 : 13], $link);
				}
			}
			break;
		case 'gb' : // livre d'or
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[12]) ? true : false;
			if ($serviz[128] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				$url0 = $site['GB'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
				$url1 = $lng.'-'.$urlrw[7].'-4-'.$fileid.'-'.$tconfig.$z2;
				$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.$author.' - '.CutLongWord(strip_tags($fieldc1), 36).'...</a>';
				$dbgb[] = array($nom[$lng == $lang[0] ? 9 : 19], $link);
			}
			break;
		case 'ne' : // nouvelles
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[13]) ? true : false;
			if ($serviz[129] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod)) {
					$url0 = $site['NE'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[8].'-22-'.$fileid.'-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
					$dbne[] = array($nom[$lng == $lang[0] ? 7 : 17], $link);
				}
			}
			break;
		case 'ph' : // photos
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[2]) ? true : false;
			if ($serviz[130] == 'on' && $zmbr === false) {
                ReadDoc($item[1]);
                if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
                    $url0 = 'photorama2.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
                    $url1 = $lng.'-'.$urlrw[9].'-2-'.$fileid.'-'.$tconfig.$z2;
                    $link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
                    $dbph[] = array($nom[$lng == $lang[0] ? 2 : 12], $link);
                }
			}
			break;
		}
	}
	unset($db);
    if (!empty($dbag)) $cr = array_multisort($dbag2, SORT_ASC, $dbag);
	$dbw = array($dbag, $dbar, $dbra, $dbom, $dbbl, $dbrb, $dbdn, $dbfa, $dbfr, $dbli, $dbgb, $dbne, $dbph);
	foreach ($dbw as $db) {
		if (!empty($db)) {
			$out .= '
	<fieldset><legend>'.$db[0][0].'</legend>';
			foreach ($db as $item) {
				$out .= '
	  <div'.($pos == 'NWL' ? ' class="py-1"' : '').'>'.$item[1].'</div>';
			}
			$out .= '
	</fieldset>';
		}
	}
	unset($dbag, $dbar, $dbra, $dbom, $dbbl, $dbrb, $dbdn, $dbfa, $dbfr, $dbli, $dbgb, $dbne, $dbphn, $dbw);
	if ($out != '') {
		$sidebox    = $pos == BOX_LEFT || $pos == BOX_RIGHT;
		$titre      = getLabel($nom[$lng == $lang[0] ? 54 : 55]);
		$lenout     = mb_strlen($out, $charset);
		$max_height = $pos == 'NWL' ? 0 : $serviz[120];
		$txt        = '
	'.($pos == 'NWL' ? '' : '<a id="hautlastdoc'.$nbox.'"></a>').'
	<div class="text-center">
      '.($serviz[118] == 'on'  ? sprintf($web[645], $ndays) : sprintf($web[683], FormatDate(substr($userprefs[14], 0, 8)))).'
    </div>';
		if ($lenout > 0) {
			$txt .= '
<style>
.outLastdoc {
  max-height: '.($max_height > 0 ? $max_height.'px;' : 'none;').'
  overflow: '.($max_height > 0 ? 'hidden;' : 'visible;').'
}
</style>';
            if ($pos != 'NWL') $txt .= '
    <div id="minlastdoc'.$nbox.'" style="display: block;" class="lastdoc">';
            $txt .= '
      <div class="outLastdoc">
        '.$out.'
      </div>';
            if ($max_height > 0) $txt .= '
      <div class="text-right plusLastdocW">
        <a href="#lastdoc'.$nbox.'" title="'.$web[296].'" onclick="cache(\'minlastdoc'.$nbox.'\'); montre(\'maxlastdoc'.$nbox.'\');">
          '.$web[296].' <i class="far fa-plus-square"></i>
        </a>
      </div>';
            if ($pos != 'NWL') $txt .= '
    </div>';
            if ($max_height > 0) $txt .= '
    <div id="maxlastdoc'.$nbox.'" style="display: none;" class="lastdoc2">'.$out.'
      <div class="text-right plusLastdocW">
        <a href="#lastdoc'.$nbox.'" title="'.$web[57].'" onclick="cache(\'maxlastdoc'.$nbox.'\'); montre(\'minlastdoc'.$nbox.'\');">
	      '.$web[57].' <i class="far fa-minus-square"></i>
        </a>
      </div>
    </div>';
        }
        if ($pos == 'NWL') return $txt;
        $txt .= displayQuickConfig($pos);
		if ($sidebox  || $pos == BOX_BOTTOM) {
            $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[15], 'NOV'.$nbox.$pos.$tconfig).$titre;
			return '
<div class="'.$pos.$tconfig.'NOV">'.boxthin($pos, $titre, $txt, ' NOV'.$nbox.$pos.$tconfig, $dynabox[15]).'</div>';
		} else {
            $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : $titre;
			return boxwide($pos, $titre, $txt, ' NOV'.$nbox.$pos.$tconfig);
        }
	} else
		return false;
}

################################################################################

function fbox_menubox($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $site, $serviz, $userprefs, $web, $texte, $page, $urlrw, $tconfig, $charset,
        $type, $fileid, $status, $creadate, $moddate, $author, $email,$fielda1, $fielda2, $z2, 
		$fieldb1, $fieldb2, $fieldc1, $fieldc2,$fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
	$tconfig = empty($tconfig) ? 0 : $tconfig;
    $sidebox = in_array($pos, array(BOX_LEFT, BOX_RIGHT, BOX_TOP, BOX_BOTTOM));
	$ilng    = $lng == $lang[0] ? 0 : 1 ;
    $menu    = $args[0];
    ReadDoc($menu);
    if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) return FALSE;
    if ($type != TYP_MENUBOX) return FALSE;
    if ($status != 'a') return FALSE;
    $type_menu = $fieldweb;
    $posimg    = $fieldd1;
	$class     = ' MNU'.$nbox.$pos.$fileid;
	$dynbox    = explode('|', $fielda2);
    $titre     = $lng == $lang[0] ? $fieldb1 : $fieldb2;
    $contenu   = PathToImage($lng == $lang[0] ? $fieldc1 : $fieldc2);
    $len       = strlen(parse_url($site[3], PHP_URL_PATH));
    $url_self  = $site['URLR'] == 'on' ? substr($_SERVER['REQUEST_URI'], $len): substr($_SERVER['PHP_SELF'], $len).($_SERVER['QUERY_STRING'] == '' ? '' : '?'.$_SERVER['QUERY_STRING']);
	$url_self .= $site['URLR'] == 'on' ? '': (strpos($url_self, 'tconfig') > 0 ? '' : '&amp;tconfig='.$tconfig);
    $dbw       = SelectDbFieldsByField(ReadDBFields(DBOPTMENU), 5, $menu);
    /**
     * $optmenu : tableau des options de menu
     *
     * $optmenu[*][0] = catégorie
     * $optmenu[*][1] = titre de l'option
     * $optmenu[*][2] = ID de l'option de menu
     * $optmenu[*][3] = URL de l'option de menu
     * $optmenu[*][4] = target du lien
     * $optmenu[*][5] = ID de la boîte menu
     * $optmenu[*][6] = indique si c'est la page courante (true/false]
	 * $optmenu[*][7] = indique si nouveauté
	 * $optmenu[*][8] = image new ou maj
     **/
    $optmenu  = array();
    $curr_cat = '';
    foreach ($dbw as $item) {
        if (!isAccessGranted($item[6])) continue;
        ReadDoc($item[4]);
		if (!isAuthorizedPublication($creadate)) continue;
        if ((mb_substr(trim($item[2]), 0, 1, $charset) == '§' && $ilng == 0) || (mb_substr(trim($item[3]), 0, 1, $charset) == '§' && $ilng == 1)) continue;
		$fieldmail = empty($fieldmail) || $fieldmail == 'ALL' ? $tconfig : $fieldmail;
        if ($status != 'a') continue;
        if ($lng == $lang[1] && empty($fieldb2)) continue;
		$img   = '';
		$urls  = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
        $ancre = '';
        $posa  = strpos($urls[0], '#');
        if ($posa !== false) $ancre = substr($urls[0], $posa);
		$pg   = '';
		if (preg_match('!https?://|ftps?://|www.!', $urls[0]))
			$url = $urls[0];
		else {
            $is_art   = strpos($urls[0], 'articles.php') !== false;
            $is_photo = strpos($urls[0], 'photorama2.php') !== false;
			if ($is_art || $is_photo) {
				$pg   = substr($urls[0], strpos($urls[0], 'pg=') + 3);
				$pos1 = strpos($pg, '&');
				$pg   = $pos1 === false ? $pg : substr($pg, 0, $pos1);
                if ($is_art) {
                    $urls[0] = 'articles.php?lng='.$lng.'&pg='.$pg.'&mnuid='.$item[5].'&tconfig='.$fieldmail.$ancre;
                    $urls[1] = $lng.'-'.$urlrw[20].'-103-'.$pg.'-'.$item[5].'-'.$fieldmail;
                }
                if ($is_photo) {
                    $urls[0] = 'photorama2.php?lng='.$lng.'&pg='.$pg.'&mnuid='.$item[5].'&tconfig='.$fieldmail;
                    $urls[1] = $lng.'-'.$urlrw[9].'-30-'.$pg.'-'.$item[5].'-'.$fieldmail;
                }
			}
			$url = empty($urls[1]) ? $urls[0] : ($site['URLR'] != 'on' ? $urls[0] : $urls[1]);
			if (strpos($url, $site[3]) !== false) {
				$url  = CHEMIN.substr($url, strlen($site[3]));
				$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
				if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
			} else {
				$url  = CHEMIN.$url;
				$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
				if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
			}
		}
		if ($fieldc1 == '_POPUP')
			$target = '	onclick="window.open(this.href, \'popup'.$item[4].'\', '
				.'\'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
		else
			$target = ' target="'.strtolower($fieldc1).'"';
		$target  = strtolower($fieldc1) == '_self' ? '' : $target;
        $is_curr = basename($url_self) == basename($url);
		$isNew   = $img != '';
        if ($is_curr) {
            $curr_cat  = trim($item[0 + $ilng]);
			$dynbox[0] = $dynbox[0] != 'off' ? 'open' : $dynbox[0];
        }
		if (!empty($pg)) {
			ReadDoc($pg);
            if (($lng == $lang[0] && empty($fieldb1)) || ($lng == $lang[1] && empty($fieldb2))) continue;
            $accept = $type == TYP_ART ? ($serviz[154] == 'on' ? $serviz[136] : 'off') : ($type == TYP_PHOTO ? $serviz[142] : 'off');
			$imgpg  = getNewUpdateDoc($creadate, $moddate, $accept);
			$isNew  = $isNew || ($imgpg != '');
			$img    = $imgpg != '' ?  $imgpg : $img;
		} else {
			$imgpg = getNewUpdateDoc($creadate, $moddate, $serviz[154]);
			$isNew = $isNew || ($imgpg != '');
			$img   = $imgpg != '' ?  $imgpg : $img;
        }
        if ($isNew) {
            $dynbox[0] = 'open';
        }
		$optmenu[] = array(trim($item[0 + $ilng]), trim($item[2 + $ilng]), $item[4], $url, $target, $item[5], $is_curr, $isNew, $img);
    }
    unset($dbw);
    sort($optmenu);

    $curcats = array();
    /**
     * $liste = liste des catégories et items dans l'ordre d'affichage
     *
     * $liste[*]['opt'] = item du tableau $optmenu d'où provient l'élément
     * $liste[*]['cat'] = est-ce une catégorie (true/false)
     * $liste[*]['txt'] = texte de l'élément, cad soit la [sous-]catégorie, soit le titre du lien
     * $liste[*]['niv'] = niveau d'indentation (0=racine)
     * $liste[*]['vis'] = est-ce un élément visible (true/false)
     * $liste[*]['new'] = est-ce un élément nouveau ou modifié
	 *
     **/
    $liste = array();
    foreach ($optmenu as $item) {
        if (empty($item[0])) {
            $i = 0;
        } else {
            $cats = explode('|', $item[0]);
            $xcat = '';
            for ($i = 0; $i < count($cats); $i++) {
                $xcat .= (empty($xcat) ? '' : '|').$cats[$i];
                // @ pour supprimer les NOTICE dûes à l'initialisation aléatoire des tableaux
                if (@$curcats[$i] != @$cats[$i]) {
                    $liste[] = array(
                        'cat' => TRUE, 'txt' => trim($cats[$i]), 'niv' => $i+1,
                        'vis' => (0 === strpos($curr_cat, $xcat)), 'opt' => $item, 'new' => $item[7]);
                    $curcats[$i] = $cats[$i];
                    array_splice($curcats, $i+1);
                }
            }
        }
        $liste[] = array('cat' => FALSE, 'txt' => ($posimg == 'L' ? $item[8].$item[1] : $item[1].'&nbsp;'.$item[8]), 'niv' => $i+1, 'vis' => $item[6], 'opt' => $item, 'new' => $item[7]);
    }
    unset($cats, $curcats);
    $content = '';
    if (!empty($optmenu)) {
        $out = '
<div class="'.$pos.$tconfig.'mb'.$menu.'">';
        $content = empty($contenu) ? '' : '
 <div class="box">
'.$contenu.'
 </div>';
        $typeRubrique = 'mnu'.$nbox;
      	$marqueur = $texte[3].' ';
      	$curr_marq = '<i class="fas fa-caret-right puce"></i>&nbsp;';
      	$rubr = '---';
      	switch ($type_menu) {
        /**********************************************************************/
  		case "0" : // liste de menu
            $niveau = 0;
            $content .= '
 <div class="mbtype0">
  <ul class="item">';
            foreach ($liste as $item) {
                $opt = $item['opt'];
                $opt[3] = 1 != preg_match('/(ftp|http|https)$/i', $opt[3]) ? $opt[3].$z2 : $opt[3];
                while ($niveau > $item['niv']) {
                    $niveau--;
                    $padding = str_pad('', 3*$niveau);
                    $content .=  '
'.$padding.'  </ul>
'.$padding.' </div>
'.$padding.'</li>';
                }
                $niveau = $item['niv'];
                $padding = str_pad('', 3*$niveau);
                if ($item['cat']) {
                    $content .=  '
'.$padding.'<li>
'.$padding.' <div>
'.$padding.'  <p class="rubr font-weight-bold categ niv'.$item['niv'].'">'.$item['txt'].'</p>
'.$padding.'  <ul class="item">';
                }
                else {
                    $content .= '
'.$padding.'<li class="link '.($opt[6] ? 'curr_item' : 'item').' niv'.$item['niv'].'">'.($opt[6] ? $curr_marq : $marqueur).'<a href="'.htmlentities($opt[3]).'" title="'.strip_tags($opt[1]).'"'.$opt[4].'>'.$item['txt'].'</a>';
        			$content .= displayQuickConfig(NULL, $opt[2], 'optmenu&amp;menubox='.$opt[5].'&amp;form=2&amp;tri=-id&amp;id='.$opt[2], '', '', 17);
                    $content .= '
'.$padding.'</li>';
                }
            }
            while ($niveau > 1) {
                $niveau--;
                $padding = str_pad('', 3*$niveau);
                $content .= '
'.$padding.'  </ul>
'.$padding.' </div>
'.$padding.'</li>';
            }
            $content .= '
  </ul>
 </div>';
    	break;
        /**********************************************************************/
    	case "1" : // menu dynamique
            $niveau = 0;
            $content .= '
 <div class="mbtype1">
  <form name="'.$typeRubrique.'" method="post">
   <p class="ta-center">';
            foreach ($liste as $item) {
                $opt = $item['opt'];
                $opt[3] = 1 != preg_match('/(ftp|http|https)$/i', $opt[3]) ? $opt[3].$z2 : $opt[3];
                if ($item['cat'] && 1 == $item['niv']) {
                    if (0 != $niveau) {
            $content .= '
    </select>';
                    }
                    $content .= '
    <select class="form-control" size="1" onchange="if (\'\' != this.value) { document.'.$typeRubrique.'.action=this.value; document.'.$typeRubrique.'.submit(); }">';
                }
                $selected = $opt[6] ? ' selected="selected"' : '';
                $padding = '';
                for ($i = 1; $i < $item['niv']; $i++) $padding .= '&nbsp; ';
                if ($item['cat']) {
                    $content .= '
     <option class="categ niv'.$item['niv'].'" value=""'.$selected.'>'.$padding.strip_tags($item['txt']).'</option>';
                } else {
                    if (0 == $niveau) {
                    $content .= '
    <select size="1" onchange="if (\'\' != this.value) { document.'.$typeRubrique.'.action=this.value; document.'.$typeRubrique.'.submit(); }" title="">';
                    }
            		$content .= '
     <option class="link niv'.$item['niv'].($opt[6] ? ' current' : '').'" value="'.$opt[3].'"'.$selected.'>'.$padding.$marqueur.strip_tags($item['txt']).'</option>';
                }
                $niveau = $item['niv'];
            }
            $content .= '
    </select>
   </p>
  </form>
 </div>';
            break;
        /**********************************************************************/
    	case "2" : // menu liste dynamique n°1
    		$openimg = 'far fa-plus-square';
    		$closeimg = 'far fa-minus-square';
        /**********************************************************************/
    	case "3" : // menu liste dynamique n°2
    		if ($type_menu == "3") {
                $openimg = 'fas fa-chevron-right';
                $closeimg = 'fas fa-chevron-up';
    		}

            $niveau = 0;
			$cpt    = 0;
			$nliste = $liste;
            $nums   = array_pad(array(), 12, 1);
            $bids   = array();
            $cache  = '';
			$padding = '';
            $content .= '
 <div class="mbtype'.$type_menu.'">
  <ul class="item">';
            foreach ($liste as $item) {
                $opt = $item['opt'];
                $opt[3] = 1 != preg_match('/(ftp|http|https)$/i', $opt[3]) ? $opt[3].$z2 : $opt[3];
                while ($niveau > $item['niv']) {
                    $niveau--;
                    $padding = str_pad('', 3*$niveau);
                    $content .=  '
'.$padding.'  </ul>
'.$padding.' </div>
'.$padding.'</li>';
                }
                $niveau = $item['niv'];
                $padding = str_pad('', 3*$niveau);
                if ($item['cat']) {
					$n = $cpt + 1;
					$isNew = false;
					while ($n < count($nliste) && $nliste[$n]['niv'] > $niveau) {
						if ($nliste[$n]['new']) {
							$isNew = true;
							break;
						}
						$n++;
					} 
                    $baseid = $pos.'mb'.$opt[5].'_'.$item['niv'].'_'.$nums[$item['niv']]++;
                    if (!$item['vis'] && !$isNew) {
                        $cache .= '
  $(\'#'.$baseid.'\').toggle(); $(\'#'.$baseid.'p\').toggle(); $(\'#'.$baseid.'m\').toggle();';
                    }
                    $content .=  '
'.$padding.'<li>
'.$padding.' <div>
'.$padding.'  <p class="rubr font-weight-bold categ niv'.$item['niv'].'" data-rubrid="'.$baseid.'">'
    .'<i id="'.$baseid.'p" class="'.$openimg.'" title="'.$web[429].'" style="display: none;"></i>'
    .'<i id="'.$baseid.'m" class="'.$closeimg.'" title="'.$web[57].'"></i>&nbsp;'.$item['txt'].'</p>
'.$padding.'  <ul id="'.$baseid.'" class="item">';
                }
                else {
                    $content .= '
'.$padding.'<li class="link '.($opt[6] ? 
    'curr_item' : 'item').' niv'.$item['niv'].'">'.($opt[6] ? $curr_marq 
    : $marqueur).'<a href="'.htmlentities($opt[3]).'" title="'.strip_tags($opt[1]).'"'.$opt[4].'>'.$item['txt'].'</a>';
        			$content .= displayQuickConfig(NULL, $opt[2], 'optmenu&amp;menubox='.$opt[5].'&amp;form=2&amp;tri=-id&amp;id='.$opt[2], '', '', 17);
                    $content .= '
'.$padding.'</li>';
                }
				$cpt++;
            }
            while ($niveau > 1) {
                $niveau--;
                $padding = str_pad('', 3*$niveau);
                $content .= '
'.$padding.'  </ul>
'.$padding.' </div>
'.$padding.'</li>';
            }
            $content .= '
  </ul>
 </div>';
            if ($cache != '') {
                $content .= BeginJavascript().$cache.EndJavascript();
            }
            break;
        /**********************************************************************/
    	case "4" : // menu dynamique compact
            $content .= '
 <div class="mbtype4">
  <form name="'.$typeRubrique.'" method="post">
   <p class="ta-center">
    <select size="1" onchange="if (\'\' != this.value) { document.'.$typeRubrique.'.action=this.value; document.'.$typeRubrique.'.submit(); }" title="">';
            foreach ($liste as $item) {
                $opt = $item['opt'];
                $selected = $opt[6] ? ' selected="selected"' : '';
                $padding = '';
                for ($i = 1; $i < $item['niv']; $i++) $padding .= '&nbsp; ';
                if ($item['cat']) {
            		$content .= '
     <option class="categ niv'.$item['niv'].'" value=""'.$selected.'>'.$padding.strip_tags($item['txt']).'</option>';
                } else {
            		$content .= '
     <option class="link niv'.$item['niv'].($opt[6] ? ' current' : '').'" value="'.$opt[3].'"'.$selected.'>'.$padding.$marqueur.strip_tags($item['txt']).'</option>';
                }
            }
            $content .= '
    </select>
   </p>
  </form>
 </div>';
            break;
        }
        $content .= displayQuickConfig($pos, $menu, 'menu&amp;form=2&amp;tri=ch&amp;id='.$menu, '', '', 17);
        $titre    = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : $titre;
        if ($sidebox) {
            $titre = DisplayDownArrow($dynbox[0], trim($class)).$titre;
            $out  .= boxthin($pos, $titre, $content, $class, $dynbox[0], 'nav');
        } else {
            $out .= boxwide($pos, $titre, $content, $class, 'nav');
        }
        $out .= '
</div>';
        return $out;
    } else {
        return false;
    }
}

################################################################################

function fbox_ddmenubox($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $site, $serviz, $userprefs, $web, $urlrw, $tconfig, $charset, $meskin, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
    $sidebox = $pos == BOX_LEFT || $pos == BOX_RIGHT;
	$ilng    = $lng == $lang[0] ? 0 : 1 ;
    $menu    = $args[0];
    ReadDoc($menu);
    if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) return FALSE;
    if ($type != TYP_DDMENUBOX) return FALSE;
    if ($status != 'a') return FALSE;
    $len       = strlen(parse_url($site[3], PHP_URL_PATH));
    $url_self  = $site['URLR'] == 'on' ? substr($_SERVER['REQUEST_URI'], $len) : (substr($_SERVER['PHP_SELF'], $len).($_SERVER['QUERY_STRING'] == '' ? '' : '?'.$_SERVER['QUERY_STRING']));
	$url_self .= $site['URLR'] == 'on' ? '' : (strpos($url_self, 'tconfig') > 0 ? '' : '&amp;tconfig='.$tconfig);
    $type_menu = $fielda2;
	$class     = $type_menu.$fileid;
    $titre     = ($lng == $lang[0] ? $fieldb1 : $fieldb2);
	$titre     = (mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : '<span class="pr-3">'.$titre.'</span>');
    $dynabox   = $fieldc1;
    $dbw       = SelectDbFieldsByField(ReadDBFields(DBOPTDDMENU), 5, $menu);
	$optmenu   = array();
    $is_curr   = false;
    sort($dbw);
    $num = 0;
    foreach ($dbw as $item) {
        if (!isAccessGranted($item[6])) continue;
        ReadDoc($item[4]);
		if (!isAuthorizedPublication($creadate)) continue;
        if ($status != 'a') continue;
		if ($type_menu == 'DDL') {
			$panel     = PathToImage($ilng == 0 ? $fieldc1 : $fieldc2);
			$optmenu[] = array(trim($item[2 + $ilng]), $panel);
		} else {
			$urls     = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
            $is_art   = strpos($urls[0], 'articles.php') !== false;
            $is_photo = strpos($urls[0], 'photorama2.php') !== false;
			$icon     = $fieldc2;
			$url      = '';
			$target   = '';
			if (trim($urls[0]) != '?') {
                $flda1   = $fielda1;
                $fldc1   = $fieldc1;
                $fldmail = $fieldmail;
				if (preg_match('!https?://|ftps?://|www.!', $urls[0]))
					$url = $urls[0];
				else {
					$urls[0] = strpos($urls[0], 'tconfig') > 0 ? $urls[0] : ($urls[0].'&tconfig='.(empty($fldmail) ? $tconfig : $fldmail));
					if ($is_art || $is_photo) {
                        $pg   = substr($urls[0], strpos($urls[0], 'pg=') + 3);
                        $pos1 = strpos($pg, '&');
                        $pg   = $pos1 === false ? $pg : substr($pg, 0, $pos1);
                        ReadDoc($pg);
                        if (!isAccessGranted($fieldmod)) continue;
					}
					if (!empty($urls[1]) && $fieldmail > 0 && ($is_art || $is_photo)) {
                        if ($is_art) $urls[1] = $lng.'-'.$urlrw[20].'-102-'.$pg.'-'.$fldmail;
                        if ($is_photo) $urls[1] = $lng.'-'.$urlrw[9].'-2-'.$pg.'-'.$fldmail;
					}
					$url = empty($urls[1]) ? $urls[0] : ($site['URLR'] != 'on' ? $urls[0] : $urls[1]);
                    $is_curr = $url_self == $url ? true : false;
					if (strpos($url, $site[3]) !== false) {
						$url  = CHEMIN.substr($url, strlen($site[3]));
						$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&amp;lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
						if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&amp;'.$slng : '?'.$slng;
					} elseif ($url != '#') {
						$url  = CHEMIN.$url;
						$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
						if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
					}
                    $url = 1 != preg_match('/(ftp|http|https)$/i', $url) ? $url.(strstr($url, 'index.php') ? '' : $z2) : $url;
				}
				if (strtoupper($fldc1) == '_POPUP')
					$target = '	onclick="window.open(this.href, \'popup'.$item[4].'\', 
						\'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
				else
					$target = ' target="'.strtolower($fldc1).'"';
				$target = strtolower($fldc1) == '_self' ? '': $target;
			}
			$optmenu[] = @array($item[0], trim($item[2 + $ilng]), str_replace('&', '&amp;', $url), $target, $icon, $flda1, $is_curr);
            if ($is_curr) {
                $pos = strrpos($item[0], '-');
                $pos = $pos !== false ? $pos : 10;
                $niv = substr($item[0], 0, $pos);
                for ($j = $num; $j > -1; $j--) {
                    if ($niv == $optmenu[$j][0] && 1 !== preg_match('!https?://|ftps?://|www.!', $optmenu[$j][2])) {
                        $pos            = strrpos($niv, '-');
                        $pos            = $pos !== false ? $pos : 10;
                        $niv            = substr($niv, 0, $pos);
                        $optmenu[$j][6] = $j > ($type_menu == 'DDH' ? 0 : -1) ? true : false;
                        $is_curr        = false;
                        if ($pos == 1) break;
                    }
                }
            }
		}
        $num++;
    }
    unset($dbw);
    if (!empty($optmenu)) {
		sort($optmenu);
		$out = '';		
		$content = '';			  
		if ($type_menu == 'DDL') {
			$out = '';
            $content = '
<nav class="navbar ddl '.$class.' navbar-expand-md">
  <a class="navbar-brand" href="'.$url_self.'">'.$titre.'</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSC-'.$class.'" aria-controls="navbarSC-'.$class.'" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarSC-'.$class.'">
    <ul class="navbar-nav m-0">';
			$n = 0;
			foreach ($optmenu as $opt) {
				$content .= '      
      <li class="nav-item dropdown w-100 T'.$n.'">
        <a class="nav-link dropdown-toggle T'.$n.'" href="#" id="navbarDDL" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          '.$opt[0].'  
        </a>
        <div class="dropdown-menu '.$class.' w-100" aria-labelledby="navbarDDL">
          <div class="container-fluid ml-0 pl-0">
            <div class="row w-100">
              <div class="col-md-12 m-0 ml-4 p-0 pl-4">
                '.$opt[1].'
              </div>
            </div>
          </div>
        </div>
      </li>';
				$n++;
			}
			$content .= '
    </ul>
  </div>
</nav>
';
            $class = ' ddl '.$class;
            $out .= boxwide($pos, '', $content, ' '.$class, 'div');
			$out .= displayQuickConfig($pos, false, '', '', '', 17);
			return $out;
		} 
        else {
			$content = '';	 
			switch ($type_menu) {
			case 'DDH' :
                $content = '
<nav class="navbar ddh '.$class.' navbar-expand-md navbar-light" id="navbar'.$class.'">
  <a class="navbar-brand" href="'.$url_self.'">'.$titre.'</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSC-'.$class.'" aria-controls="navbarSC-'.$class.'" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarSC-'.$class.'">
    <ul class="navbar-nav mr-auto">
                ';
                $scl = 'ddh';
				break;
			case 'DDV' :
				$content = '
<nav class="navbar ddv '.$class.'">
  <ul class="navbar-nav mr-auto">
';
                $scl = 'ddv';
				break;
			}
            $cnt = count($optmenu);
            $i   = 0;
            while ($i < $cnt) {
                $img = empty($optmenu[$i][4]) ? '' : '<img src="'.CHEMIN.'img/'.$optmenu[$i][4].'" class="ddmImg" />';
                $cur = explode('-', $optmenu[$i][0]);
                $c   = count($cur);
                $p   = $s = $c;
                if ($i > 0) {
                    $pred = explode('-', $optmenu[$i - 1][0]);
                    $p    = count($pred);
                }
                if ($i + 1 < $cnt) {
                    $succ = explode('-', $optmenu[$i + 1][0]);
                    $s    = count($succ);
                }
                if ($c == 1 && $s == 1) { 
                    $content .= '
      <li class="nav-item '.$class.' btn-'.$scl.' mt-4 L'.$optmenu[$i][0].'">
        <a class="nav-link" href="'.$optmenu[$i][2].'">'.$img.$optmenu[$i][1].'</a>
      </li>';
                }
                elseif ($c == 1 && $s > $c) { $content .= '
      <li class="nav-item dropdown '.$class.' btn-'.$scl.' L'.$optmenu[$i][0].'">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown'.$optmenu[$i][0].'" role="button" data-toggle="dropdown"
            aria-haspopup="true" aria-expanded="false">
            '.$img.$optmenu[$i][1].'
        </a>
        <ul class="dropdown-menu" aria-labelledby="navbarDropdown'.$optmenu[$i][0].'">';
                }
                elseif ($c == $s) { $content .= '
          <li class="dropdown-item '.$class.($optmenu[$i][6] ? ' dd_current' : '').' L'.$optmenu[$i][0].'">
            <a href="'.$optmenu[$i][2].'"'.$optmenu[$i][3].'>'.$img.$optmenu[$i][1].'</a>
          </li>';
                }
                elseif ($s > $c) { $content .= '
          <li class="nav-item dropdown L'.$optmenu[$i][0].'">
            <a class="dropdown-item dropdown-toggle" href="#" id="navbarDropdown'.$optmenu[$i][0].'" role="button" data-toggle="dropdown"
                aria-haspopup="true" aria-expanded="false">
                '.$img.$optmenu[$i][1].'
            </a>
            <ul class="'.$scl.' dropdown-menu" aria-labelledby="navbarDropdown'.$optmenu[$i][0].'">';
                }
                elseif ($s < $c) { 
                    $content .= '
            <li class="dropdown-item '.$class.($optmenu[$i][6] ? ' dd_current' : '').' L'.$optmenu[$i][0].'">
              <a href="'.$optmenu[$i][2].'"'.$optmenu[$i][3].'>'.$img.$optmenu[$i][1].'</a>
            </li>
          </ul>
        </li>';
                    for ($k = 1; $k < $c - $s; $k++)
                        $content .= '
      </ul>
    </li>';
                }
                $i++;
            }
			switch ($type_menu) {
            case 'DDH' :
                $content .= '
      </ul>
    </li>
  </div>
</nav>';
                $class .= ' ddh';
                $title  = '';
                break;
            case 'DDV' :
                $content .= '
    </ul>
</nav>';
                $class .= ' ddv';
                $title  = $titre;
                break;
            }
            $content .= '
<script>
  $(function () {
    $("#navbar'.$class.'").bootnavbar();
  })
</script>';
			if ($sidebox) {
                $title = DisplayDownArrow($dynabox, trim($class)).$title;
				$out   = boxthin($pos, $title, $content, ' '.$class, $dynabox, 'div');
			} else {
				$out = boxwide($pos, $title, $content, ' '.$class, 'div');
			}
			$out .= displayQuickConfig($pos, false, '', '', '', 17);
			return $out;
		}
    } else {
        return false;
    }
}

################################################################################

function fbox_contact($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $urlrw, $site, $serviz, $userprefs, $web, $dynabox, 
           $tconfig, $charset, $menuico, $members, $z2;
    static $nbox = 0;
    $nbox++;
    if ($serviz[99] == '') return false;
    if (!isAccessGranted($members[20])) return FALSE;
    $tconf = $menuico[21] == 'ALL' ? $tconfig : $menuico[21];
	$out = '
<div class="box text-left">';
	$ctfiles = ReadDBFields(CONFIGREP.'ctconfigs.dtb');
	foreach($ctfiles as $ct) {
		if ($ct[2] == 'a') $out .= '
  <div class="itemContactW">
    <a href="'.CHEMIN.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[2].'-2-'.$ct[1].'-'.$tconf.$z2 
        : $site['CT'].'.php?lng='.$lng.'&amp;ctconfig='.$ct[1].'&amp;tconfig='.$tconf.$z2).'" title="'.$ct[$lng == $lang[0] ? 3 : 4].'">
	  <i class="far fa-envelope imgContact"></i>'.($ct[$lng == $lang[0] ? 3 : 4]).'
	</a>
  </div>';
	}
    $out .= '
</div>';
    $out .= displayQuickConfig($pos, false, 'contact', '', '', 13);
	$titre = getLabel($nom[$lng == $lang[0] ? 56 : 57]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[16], 'CT'.$nbox.$pos.$tconf).$titre;
    return '
<div class="'.$pos.$tconfig.'CT">'.boxthin($pos, $titre, $out, ' CT'.$nbox.$pos.$tconfig, $dynabox[16]).'
</div>';
}

################################################################################

function fbox_photobox($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $urlrw, $site, $serviz, $userprefs, $web, 
           $dynabox, $charset, $z2, $titre, $members, $menuico;
	if (!in_array($pos, array(BOX_EDITO, BOX_LEFT, BOX_RIGHT, BOX_ABOVE, BOX_UNDER, BOX_TOP, BOX_BOTTOM))) return false;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[2])) return FALSE;
    if (!isAccessGranted($menuico[34])) return false;
	$phs = ReadDBFields(DBPHOTO);
	$dps = array();
	$n   = 0;
	foreach ($phs as $ph) {
        if (isAccessGranted($ph[6]) && is_file(CHEMIN.'photo/gal_'.$ph[4].'/params_'.$ph[4].INCEXT)) {
            include CHEMIN.'photo/gal_'.$ph[4].'/params_'.$ph[4].INCEXT;
            if ($param9 == 'on' && empty($param10)) $dps[] = array($ph[4], $n);
            $param9 = '';
        }
        $n++;
	}
    $tconf = $menuico[14] == 'ALL' ? ($serviz[157] != 0 ? $serviz[157] : import('tconfig', '', true, 0)) : $menuico[14];
	if (empty($dps)) return false;
	$nb   = rand(0, count($dps) - 1);
	$dir  = 'gal_'.$dps[$nb][0];
	$gals = ReadDBFields(CHEMIN.'photo/'.$dir.'/'.$dir.DBEXT);
    $imgs = array();
	foreach ($gals as $img) if ($img[1] == 'a') $imgs[] = $img;
	if (empty($imgs)) return false;
	if (!isset($serviz[182])) $serviz[182] = 0;
	if ($serviz[182] == 0) sort($imgs);
	if ($serviz[182] == 1)
		array_multisort(array_column($imgs, 0), SORT_ASC, array_column($imgs, 4), SORT_DESC, $imgs);
	if ($serviz[182] == 2)
		array_multisort(array_column($imgs, 4), SORT_DESC, array_column($imgs, 0), SORT_ASC, $imgs);
    $nbimg = count($imgs);
	$title = $phs[$dps[$nb][1]][$lng == $lang[0] ? 2 : 3];
	$comment = $img[$lng == $lang[0] ? 5 : 6];
	$tpos  = mb_strpos($title, '-->');
	$title = $tpos === false ? $title : mb_substr($title, $tpos + 3);
    $class = $nbox.$pos.$tconf;
	$out = '
<div class="text-center m-auto">
  <div class="phtitlebox">
    <a href="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[9].'-2-'.$phs[$dps[$nb][1]][4].'-'.$tconf.$z2 : 'photorama2.php?lng='.$lng.'&amp;pg='.$phs[$dps[$nb][1]][4].'&amp;tconfig='.$tconf.$z2).'" title="'.$title.'">'.$title.'</a>
  </div>';
    $ugw  = in_array($pos, array(BOX_LEFT, BOX_RIGHT)) ? 540 : (in_array($pos, array(BOX_ABOVE, BOX_UNDER, BOX_EDITO)) ? 800 : 600);
    $ugh  = intval($ugw * 0.75);
    $long = floor($ugw / 17);
    $nblg = intval(floor($nbimg / ($long > 0 ? $long : 1))) + ($long * 17 > $ugw ? 1 : 0);
	switch ($serviz[83]) {
	case '0' :
        $out .= '
  <script src="'.CHEMIN.'inc/unitegallery/themes/tilesgrid/ug-theme-tilesgrid.js"></script>
  <script>
    jQuery(document).ready(function(){
	  jQuery("#'.$class.$dir.'").unitegallery({
		gallery_theme: "tilesgrid",
        grid_num_rows: 1,
        theme_navigation_type: "arrows",
        theme_arrows_margin_top: 8,
        tile_border_width: 3,
        tile_border_radius: 8,
        tile_enable_shadow: false,
        lightbox_type: "compact",
        lightbox_arrows_position: "inside",
      });
    });
  </script>';
		break;
	case '1' :
        $out .= '
  <script src="'.CHEMIN.'inc/unitegallery/themes/carousel/ug-theme-carousel.js"></script>
  <script>
    jQuery(document).ready(function(){
	  jQuery("#'.$class.$dir.'").unitegallery({
		gallery_theme: "carousel",
        theme_navigation_margin: 0,
        tile_border_width: 3,
        tile_width: '.$ugw.',
        tile_height: '.$ugh.',
        tile_border_radius: 0,
        tile_enable_shadow: false,
        lightbox_type: "compact",
        lightbox_arrows_position: "inside",
      });
    });
  </script>';
		break;
	case '2' :
        $out .= '
  <script src="'.CHEMIN.'inc/unitegallery/themes/slider/ug-theme-slider.js"></script>
  <script>
    jQuery(document).ready(function(){
	  jQuery("#'.$pos.$nbox.$dir.'").unitegallery({
		gallery_theme: "slider",
        gallery_width: '.$ugw.',
        gallery_height: '.($ugh + 32 + ($nblg * 15)).',
        slider_transition: "fade",
        slider_transition_speed: 1500,
        slider_enable_zoom_panel: false,
        slider_enable_arrows: false,
        slider_enable_progress_indicator: false,
        slider_item_padding_bottom: '.(32 + ($nblg * 15)).',
      });
    });
  </script>';
		break;
	}
	$out .= '
  <div id="'.$class.$dir.'" style="display:none;margin:auto;">';
	foreach ($imgs as $img) {
		$out .= '
    <img alt="" src="'.CHEMIN.'photo/'.$dir.'/'.$img[2].'" style="display:none;" />';
	}
	$out .= '
  </div>
</div>';
    $out .= displayQuickConfig($pos, false, '', '', '', 18);
	$title = getLabel($nom[$lng == $lang[0] ? 30 : 31]);
	$title = mb_substr(trim($title), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[17], 'photobox SWPH'.$class).$title;
	return '
<div class="'.$class.'SWPH">
  '.boxthin($pos, $title, $out, ' photobox SWPH'.$class, $dynabox[17]).'
</div>';
}

################################################################################

function isAdmin($pseudo) {
    global $serviz;
    if (empty($pseudo) && trim($serviz[31]) == '' && trim($serviz[176]) == '' && is_file(CHEMIN.'install/install.php')) return TRUE;
    if ($pseudo == $serviz[31] || $pseudo == $serviz[176]) return TRUE;
    if ($serviz[42] == 'on') {
		static $admins = null;
		if (!isset($admins)) {
			$admins = ReadDbFields(ADMINS);
		}
		foreach ($admins as $admin) {
			if ((!empty($pseudo) && !empty($admin[0])) && ($pseudo == $admin[0])) return TRUE;
		}
	}
    return FALSE;
}
?>
func_boxes.php.bak
wget 'https://sme10.lists2.roe3.org/guppy/inc/func_boxes.php.bak'
View Content
<?php
/*******************************************************************************
 *   Functions for boxes
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.14 (July 18, 2023) : correction $dbcat, correction visitor member
 ******************************************************************************/
 
if (stristr($_SERVER['SCRIPT_NAME'], 'func_boxes.php')) {
    header('location:../index.php');
    die();
}

################################################################################

function fbox_ariane($pos = NULL, $args = NULL) {
    global $lng, $lang, $nom, $page, $site, $web, $urlrw, $endurl, $npage, $pgtype, $topmess, $tconfig, $z2;
	$root   = $site[3].($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
    $stroot = strip_tags(getLabel($nom[($lng == $lang[0] ? 0 : 10)]));
	$sep    = '&raquo;';
    switch ($pgtype) {
    case 5 :
        $ariane = '<span class="arianeOff">'.$npage[5].'</span>';
        break;
    case 18 : // plugins
        if (isset($topmess) && !empty($topmess)) {
            $plugin_name = strip_tags($topmess);
        } else {
			$tmp = explode('/', $endurl);
			foreach ($tmp as $key=>$val) {
				if ($val == 'plugins') break;
			}
			$plugin_dirname = 'plugins/'.$tmp[$key + 1];
			$plugin_file    = CHEMIN.$plugin_dirname.'/plugin.inc';
            $plugin_name    = '';
            if (is_file($plugin_file)) {
                $plugin_bar_name = '';
                include $plugin_file;
                if (!empty($plugin_bar_name)) {
                    $plugin_name = $plugin_bar_name;
                }
            }
            if (empty($plugin_name)) {
                $plugin_name = '';
                if (is_file(CHEMIN.'admin/'.$plugin_dirname.'/plugin.inc')) {
                    $plugin_admin_name = '';
                    include_once CHEMIN.'admin/'.$plugin_dirname.'/plugin.inc';
                    if (!empty($plugin_admin_name)) {
                        $plugin_name = $plugin_admin_name;
                    }
                }
            }
            if (empty($plugin_name)) {
                $plugin_name = $web[465];
            }
        }
        $ariane = '<span class="arianeOn"><a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a></span> '.$sep.' <span class="arianeOff">'.$plugin_name.'</span>';
        break;
    case 13 : // blog
        $topmess2 = explode(' - ', empty($topmess) ? $npage[$pgtype] : strip_tags($topmess));
        $last     = ' '.$sep.' <span class="arianeOff">'.array_pop($topmess2).'</span>';
        $middle   = (0 == count($topmess2)) ? '' : ' '.$sep.' <span class="arianeOn">
          <a href="'.$site[3].($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[1].$z2 : $site['BLS'].'.php?lng='.$lng.$z2).'" title="'.$topmess2[0].'">'.$topmess2[0].'</a></span>';
        $ariane   = '<span class="arianeOn"><a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a></span>'.$middle.$last;
        break;
    case 0 :
    case 3 : // forum
        $topmess2 = explode(' - ', empty($topmess) ? $npage[$pgtype] : strip_tags($topmess, '<a>'));
        $last     = ' '.$sep.' <span class="arianeOff">'.array_pop($topmess2).'</span>';
        $middle   = '';
        foreach ($topmess2 as $item) {
            $middle .= ' '.$sep.' <span class="arianeOn">'.$item.'</span>';
        }
        $ariane = '<span class="arianeOn"><a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a></span>'.$middle.$last;
        break;
    case FALSE :
        $ariane = '<span class="arianeOn">
          <a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a>
          </span> '.$sep.' <span class="arianeOff">'.(empty($topmess) ? '???' : strip_tags($topmess, '<a>')).'</span>';
        break;
    default :
        $topmess2 = explode(' - ', empty($topmess) ? $npage[$pgtype] : strip_tags($topmess, '<a>'));
        $last = ' '.$sep.' <span class="arianeOff">'.array_pop($topmess2).'</span>';
        $middle = '';
        foreach ($topmess2 as $item) {
            $middle .= ' '.$sep.' <span class="arianeOn">'.$item.'</span>';
        }
        $ariane = '<span class="arianeOn"><a href="'.$root.'" title="'.$stroot.'"> '.$stroot.' </a></span>'.$middle.$last;
        break;
    }
	$out = '
<div class="ariane'.(in_array($pos, array(BOX_TOP, BOX_BOTTOM)) ? ' ARN'.$pos.$tconfig : '').' text-left p-2 m-0">'
	.@$web[637].$ariane.'
</div>';
	if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
		return $out;
	} else {
		if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
			return '
<div class="'.$pos.$tconfig.'ARN">'.boxthin($pos, '', $out, ' ARN'.$pos.$tconfig).'
</div>';
		} else {
			return boxwide($pos, '', $out, ' ARN'.$pos.$tconfig, 'nav');
		}
	}
}

################################################################################

function fbox_print($pos = NULL, $args = NULL) {
    global $serviz, $web, $endurl, $pgtype, $site, $lng, $prt, $urlrw, $page, $tconfig;
	$url1 = str_replace('&', '&amp;', $endurl).'&amp;prt=-2';
	$url2 = str_replace('&', '&amp;', $endurl).'&amp;prt=2';
	$url3 = str_replace('&', '&amp;', $endurl).'&amp;prt=-3';
	$url4 = str_replace('&', '&amp;', $endurl).'&amp;prt=3';
	if ($site['URLR'] == 'on' && strpos($endurl, '/admin/') === false) {
		$infos = explode('/', $_SERVER['SCRIPT_NAME']);
		$qstrs = explode('&', $_SERVER['QUERY_STRING']);
		$fname = explode('.', $infos[count($infos) - 1]);
		$urls  = array(
			'index'=>$urlrw[0].'-1', $site['BLS']=>$urlrw[1].'-1', 'blogs'=>$urlrw[1].'-1' ,'selpg'=>$urlrw[1].'-21', $site['BL'].'pg'=>$urlrw[1].'-41', 'blogsarch'=>$urlrw[1].'-71', $site['BL'].'selpg'=>$urlrw[1].'-21', 
		    'blogsarchselpgcatdatejdateid'=>$urlrw[1].'-72', 'blogarchpg'=>$urlrw[1].'-43', $site['BL'].'pgreact'=>$urlrw[1].'-470', 'blogarchpgreact'=>$urlrw[1].'-480', 
		    'contact'=>$urlrw[2].'-1', 'connect'=>$urlrw[3].'-2', 'connectconnectuuser'=>$urlrw[3].'-31', 'compte'=>$urlrw[3].'-141', 'lostpass'=>$urlrw[3].'-160', 
			'faq'=>$urlrw[4].'-1', 'faqtconfig'=>$urlrw[4].'-11','faqpg'=>$urlrw[4].'-4', 'faqid'=>$urlrw[4].'-5', 'faqdirfaqtconfig'=>$urlrw[4].'-10',$site['FRT']=>$urlrw[5].'-1', $site['FR'].'cat'=>$urlrw[5].'-3', 
			$site['TH'].'pgcat'=>$urlrw[5].'-40', $site['TH'].'pgcatid'=>$urlrw[5].'-50', 'threadarchpgcat'=>$urlrw[5].'-420', 'threadarchpgcatid'=>$urlrw[5].'-520', 
			'fortopicarch'=>'frm-9',
			'links'=>$urlrw[6].'-2', 'linkspg'=>$urlrw[6].'-3', $site['GB']=>$urlrw[7].'-1', $site['GB'].'id'=>$urlrw[7].'-20', $site['GB'].'pg'=>$urlrw[7].'-30', 
			$site['NE']=>$urlrw[8].'-1', $site['NE'].'pgid'=>$urlrw[8].'-31', $site['NE'].'pg'=>$urlrw[8].'-20', 'newsarch'=>$urlrw[8].'-261', 'newsarchpg'=>$urlrw[8].'-263', 
			'newsarchpgid'=>$urlrw[8].'-41', 'photorama'=>$urlrw[9].'-1', 'photorama2pgtconfig'=>$urlrw[9].'-20', 'photoramapg'=>$urlrw[9].'-40', 'photoramatconfig'=>$urlrw[9].'-41',  
			'download'=>$urlrw[11].'-1', 'downloaddirdnl'=>$urlrw[11].'-9','downloadpg'=>$urlrw[11].'-5', 'downloadid'=>$urlrw[11].'-70', 'search'=>$urlrw[12].'-1', 
			'tinymsg'=>$urlrw[13].'-1', 'tinymsgaction'=>$urlrw[13].'-31', 'tinymsgactionid'=>$urlrw[13].'-51', 'tinymsgactionidtofrom'=>$urlrw[13].'-41', 
			'tinymsgactiontofrom'=>$urlrw[13].'-21', $site['PG'].'typ'=>$urlrw[14].'-0', $site['PG'].'typmodnumpg'=>$urlrw[14].'-10', $site['PG'].'typnumpg'=>$urlrw[14].'-20', 
			$site['PG'].'typcat'=>$urlrw[14].'-30', $site['PG'].'typpg'=>$urlrw[14].'-40', $site['USR']=>$urlrw[15].'-0', $site['USR'].'uuser'=>$urlrw[15].'-50', 
			$site['USR'].'modifuuser'=>$urlrw[15].'-60', 'agendamoisanagv'=>$urlrw[17].'-211', 'agendamoisanagvid'=>$urlrw[17].'-231', 
			'agendaidpgpgagv'=>$urlrw[17].'-221', $site['NL']=>$urlrw[18].'-0', 'rss'=>$urlrw[19].'-1', 'articlespg'=>$urlrw[20].'-1001', 'articlespg'=>$urlrw[20].'-102', 
			'articlespgtconfig'=>$urlrw[20].'-102', 'articlespgreact'=>$urlrw[20].'-1010', 'articlespg'=>$urlrw[20].'-1020', 
			'articlespgmnuid'=>$urlrw[20].'-1030', 'articlespgtconfig'=>$urlrw[20].'-1020', 'articlespgmnuidtconfig'=>$urlrw[20].'-1030'
			);
		$vars = '';
		$vals = '-';
/*
		echo 'query string: '.$_SERVER['QUERY_STRING'].'<br />';
    	echo 'SCRIPT_NAME: '.$_SERVER['SCRIPT_NAME'].'<br />';
		echo 'Infos count : '.count($infos).'<br />';
		echo 'Infos 0: '.$infos[0].'<br />';
		echo 'Infos 1: '.$infos[1].'<br />';
		echo 'Infos 2: '.$infos[2].'<br />';
*/		
/*
		foreach($_SERVER as $key => $value)
			echo '$_SERVER['.$key.']='.$value .'<br />';
*/
		$info[1] = trim($info[1]);
$mystring = 'abc';
$findme   = 'a';
$pos = strpos($_SERVER['SCRIPT_NAME'], 'plugins');
        if ($pos === false)
		{
//		    echo 'Apres if Infos 1: '.$infos[1].'<br />';			
			foreach($qstrs as $key=>$val) {
//					echo 'Avant et dans qstrs key: '.$key.'<br />';
//					echo 'Avant et dans qstrs val: '.$val.'<br />';
					
				if ($key != 'lng') {
					$param = explode('=', $val);
					if ($param[0] != 'lng' )
					{	
						if ($fname[0] != 'fortopic' && $fname[0] != 'blog'  && $fname[0] != 'blogs' && $fname[0] != 'news' && $fname[0] != 'agenda' 
							&& $fname[0] != 'contact' && $fname[0] != 'compte' && $fname[0] != 'tinymsg' && $fname[0] != 'download'
							&& $fname[0] != 'links' && $fname[0] != 'guestbk' && $fname[0] != 'photorama')
						{
							if ($param[0] == 'tconfig' && $param[1] >= 0)
							{
	//							echo 'Dans Foreach qstrs param0: '.$param[0].'<br />';	
	//							echo 'Dans Foreach qstrs param1: '.$param[1].'<br />';				
								$vars .= $param[0];
								$vals .= $param[1].'-';
	//							echo 'Dans Foreach qstrs vars: '.$vars.'<br />';	
	//							echo 'Dans Foreach qstrs vals: '.$vals.'<br />';
							}
						}
						if ($param[0] != 'tconfig')
						{
	//						echo 'Dans Foreach qstrs param0: '.$param[0].'<br />';	
	//						echo 'Dans Foreach qstrs param1: '.$param[1].'<br />';				
							$vars .= $param[0];
							$vals .= $param[1].'-';
	//						echo 'Dans Foreach qstrs vars: '.$vars.'<br />';	
	//						echo 'Dans Foreach qstrs vals: '.$vals.'<br />';
						}
					}
				}
			}
			$urlr = '';
/*			
			echo 'fname[0]: '.$fname[0].'<br />';
			echo 'vars: '.$vars.'<br />';	
			echo 'vals: '.$vals.'<br />';	
*/
			foreach($urls as $key=>$url) {
/*
					echo 'AVnt foreach Urls => key: '.$key.'<br />';
					echo 'AVnt foreach Urls =>  vars: '.$vars.'<br />';
					echo 'AVnt foreach Urls =>  fname[0].vars: '.$fname[0].$vars.'<br />';
					echo 'AVnt foreach Urls =>  fname[0]: '.$fname[0].'<br />';
*/					
					if ($fname[0].$vars == $key)
					{		
//							echo 'Dans fname.var if key: '.$key.'<br />';
//							echo 'Dans fname.var if vars: '.$vars.'<br />';	
							$urlr = $url;
//							echo 'Dans fname.var url: '.$url.'<br />';
//							echo 'Dans fname.var urlr: '.$urlr.'<br />';
							break;
					}
					elseif($fname[0] == $key) 
					{
//						echo 'Dans fname = key : '.$key.'<br />';
						$urlr = $url;
//						echo 'Dans fnamE url: '.$url.'<br />';
//						echo 'Dans fname urlr: '.$urlr.'<br />';					
					}
				}
			if ($fname[0] == 'allarticles')
			{
				$url1 = $site[3].$urlr.$lng.'-'.'allart-2'.$vals.'-2';
				$url2 = $site[3].$urlr.$lng.'-'.'allart-2'.$vals.'2';
				$url3 = $site[3].$urlr.$lng.'-'.'allart-2'.$vals.'-3';
				$url4 = $site[3].$urlr.$lng.'-'.'allart-2'.$vals.'3';
			}
			elseif ($fname[0] == 'annoncesplus')
			{
				$url1 = $site[3].$urlr.$lng.'-'.'ap-8'.$vals.'-2';
				$url2 = $site[3].$urlr.$lng.'-'.'ap-8'.$vals.'2';
				$url3 = $site[3].$urlr.$lng.'-'.'ap-8'.$vals.'-3';
				$url4 = $site[3].$urlr.$lng.'-'.'ap-8'.$vals.'3';
			}
			else
			{
				$url1 = $lng.'-'.$urlr.$vals.'-2';
				$url2 = $lng.'-'.$urlr.$vals.'2';
				$url3 = $lng.'-'.$urlr.$vals.'-3';
				$url4 = $lng.'-'.$urlr.$vals.'3';
			}	
		}
		else
			{
				$url1 = $site[3].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'].'&prt=-2';
				$url2 = $site[3].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'].'&prt=2';

			}				
/*
		echo 'url1: '.$url1.'<br />';	
		echo 'url2: '.$url2.'<br />';		
		echo 'url3: '.$url3.'<br />';	
		echo 'url4: '.$url4.'<br />';	
*/
	}
    if ($pgtype != 11) {
        $out = '
<div class="boxprint'.(in_array($pos, array(BOX_TOP, BOX_BOTTOM)) ? ' PRT'.$pos.$tconfig : '').' mx-3 p-2">
  <span class="boxprint1 float-right">
    <a href="'.$url1.'" target="_blank"><i class="fas fa-eye mx-2" title="'.$web[264].'"></i></a>&nbsp;
    <a href="'.$url2.'" target="_blank"><i class="fas fa-print" title="'.$web[22].'"></i></a>&nbsp;
  </span>
  <span class="boxprint2 float-right">'.$web[470].'</span>
  ';
        $out .= '
</div>';
		if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
			return $out;
		} else {
			if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
				return '
<div class="'.$pos.$tconfig.'PRT">
  '.boxthin($pos, '', $out, ' PRT'.$pos.$tconfig).'
</div>';
			} else {
				return boxwide($pos, '', $out, ' PRT'.$pos.$tconfig);
			}
		}
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_logo($pos = NULL, $args = NULL) {
    global $lang, $lng, $page, $site, $skn_logo, $urlrw, $tconfig, $meskin;
    $img  = explode('|', $page[4]);
    $urli = substr($img[0], 0, 1) == 'I' ? CHEMIN.'img/' : $meskin.'img/';
    $logo = $skn_logo != '' && empty($page[4]) ? $skn_logo : $urli.$img[1];
    if ($logo != $urli) {
		$url = ($site['URLR'] == 'on')? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng;
        return '
  <div class="logo m-0 p-0'.(in_array($pos, array(BOX_TOP, BOX_BOTTOM)) ? ' LO'.$pos.$tconfig : '').'">
    <a href="'.$site[3].$url.'" title="'.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'">
      <img src="'.$logo.'" alt="'.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'" />
    </a>
  </div>
';
    } else {
        return FALSE;
    }
}

################################################################################
 
function getMenuFlags($pos = NULL) {
    global $lng, $lang, $page, $site, $endurl, $urlrw, $web, $z2, $flag1, $flag2;
	$flags = '';
    if ($lang[1] != '') { // boxlang
		if ($site['URLR'] == 'on') {
			$len     = strlen(parse_url($site[3], PHP_URL_PATH));
            $flagurl = substr($endurl, $len);
            $pds     = (strstr($flagurl, '/')) ? strripos( $flagurl, '/') : 0;
            if ($pds > 1) {
				$len           = strlen(substr($flagurl, $pds + 1));
                $chemin_plugin = substr($flagurl, 0, $pds + 1);
                $flagurl       = substr($flagurl, $pds + 1);
			} else $chemin_plugin = '';
			$flagurl0 = $site[3].$chemin_plugin.$lang[$lng == $lang[0] ? 1 : 0].'-'.substr($flagurl, 3);
			$flagurl1 = $site[3].($lng == $lang[0] ? $lang[1] : $lang[0]).'-'.$urlrw[0];
            $flagurl = strlen($flagurl) > 3 ? $flagurl0 : $flagurl1;
		} else {
			$slng = strpos($endurl, '?lng=') > 0 || strpos($endurl, '&lng=') > 0 ? '' : 'lng='.$lng;
			if ($slng != '') $endurl .= (strpos($endurl, '?') > 0) ? '&'.$slng : '?'.$slng;
			$flagurl = str_replace('&', '&amp;', $endurl);
			if ($lng == $lang[0]) $flagurl = str_replace('lng='.$lang[0], 'lng='.$lang[1], $flagurl); 
			if ($lng == $lang[1]) $flagurl = str_replace('lng='.$lang[1], 'lng='.$lang[0], $flagurl); 
		}
		$flags = '
      <script>
        $(document).ready(function(){
          $(\'.menuiconflag\').popover({
            title:"'.$web[87].'",
            content:"'.($lng == $lang[0] ? $web[555].': <b>'.$lang[1].'</b>' : $web[556].': <b>'.$lang[0].'</b>').'",
            trigger:"hover",
            placement:"auto",
            html:true
          });
        });
      </script>
      <a href="'.$flagurl.(strpos($flagurl, 'index.php') > 0 || strpos($flagurl, $urlrw[0]) > 0 ? '' : $z2).'" class="menuiconflag" title="'.$web[87].'">
        <i class="flg-'.($lng == $lang[0] ? $lang[1] : $lang[0]).'"></i>
      </a>';
        if ($pos == BOX_LEFT || $pos == BOX_RIGHT && $pos != NULL) {
            // Drapeau menu boite latérale
			$flags = '
      <script>
        $(document).ready(function(){
          $(\'.menuiconflag\').popover({
            title:"'.$web[87].'",
            content:"'.($lng == $lang[0] ? $web[555].': <b>'.$lang[1].'</b>' : $web[556].': <b>'.$lang[0].'</b>').'",
            trigger:"hover",
            placement:"auto",
            html:true
          });
        });
      </script>
      <span class="menuIcons_flag">
        <a href="'.$flagurl.(strpos($flagurl, 'index.php') > 0 || strpos($flagurl, $urlrw[0]) > 0 ? '' 
            : $z2).'" class="menuiconflag float-left" title="'.$web[87].'">
          <i class="flg-'.($lng == $lang[0] ? $lang[1] : $lang[0]).'"></i>
        </a>
      </span>';
        }
    } // boxlang
    return $flags;
}
 
################################################################################

function getOptionsMenuIcons() {
    global $lng, $lang, $serviz, $web, $site, $menuico, $nom, $page, $tconfig, $urlrw, $userprefs, $z2,
		   $fielda1, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    $tconfig = empty($tconfig) ? '0' : $tconfig;
    $menu    = array();
    $i       = ($lng == $lang[0])? 0 : 10;
    $j       = ($lng == $lang[0])? 0 : 1;
    // Admin
    if (isAdmin($userprefs[1])) {
    	$menu[strip_tags($web[144]).'_admin'] = array(
    		'id'      => 'admin',
            'z2'      => false,
    		'name'    => strip_tags($web[144]),
    		'title'   => $web[144],
            'pagedisp' => $tconfig,
            'granted' => true,
    		'icon'    => '<i class="fas fa-user-cog"></i>',
    		'url'     => ($site['URLR'] == 'on')? 'admin/'.$lng.'-'.$urlrw[0].'-19' : 'admin/admin.php?lng='.$lng,
			'base'    => 'admin.php',
			'target'  => '_self'
    	);
    }
    //Home
    if ($serviz[1] == 0 && $menuico[0] == 'on') {
        $menu[getLabel($nom[$i+0]).'_home'] = array(
            'id'       => 'home',
            'z2'       => false,
            'name'     => strip_tags(getLabel($nom[$i+0])),
            'title'    => getLabel($nom[$i+0], 1),
            'icon'     => '<i class="fas fa-home"></i>',
            'pageexec' => 0,
            'pagedisp' => $tconfig,
            'granted'  => true,
            'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[0] : 'index.php',
			'base'     => 'index.php',
			'target'   => '_self'
        );
    }
    //Blog
    if ($serviz[53] == 'on' && $menuico[2] == 'on') {
        $menutconf = $menuico[13] == 'ALL' ? $tconfig : $menuico[13];
    	$menu[getLabel($nom[$j+42]).'_blog'] = array(
    		'id'       => 'blog',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$j+42])),
            'title'    => getLabel($nom[$j+42], 1),
    		'icon'     => '<i class="fas fa-blog"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[23] == 'ALL' ? $tconfig : $menuico[23],
            'granted'  => empty($menuico[33]) ? true : isAccessGranted($menuico[33]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[1].'-'.$menutconf : $site['BLS'].'.php',
    		'alturls'  => array($site['BL'].'.php', 'blogsarch.php', 'blogarch.php'),
			'base'     => $site['BLS'].'.php',
			'target'   => '_self'
    	);
    }
    //Contact
    if ($serviz[21] == 'on' && $serviz[99] == 'on' && $menuico[10] == 'on') {
        $menutconf = $menuico[21] == 'ALL' ? $tconfig : $menuico[21];
    	$menu[getLabel($nom[$j+46]).'_contact'] = array(
    		'id'       => 'contact',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$j+46])),
            'title'    => getLabel($nom[$j+46], 1),
    		'icon'     => '<i class="fas fa-envelope-open-text"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[31] == 'ALL' ? $tconfig : $menuico[31],
            'granted'  => true,
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[2].'-'.$menutconf : $site['CT'].'.php',
			'base'     => $site['CT'].'.php',
			'target'   => '_self'
    	);
    }
    //Connexion
    if ($menuico[11] == 'on') {
		$jj              = $userprefs[1] == '' ? $j+14 : $j+28;
        $menutconf       = $serviz[172] == 'ALL' ? $tconfig : $serviz[172];
		$connectName     = $userprefs[1] == '' ? 'connect.php' : 'connect.php?lng='.$lng.'&amp;connect=no';
		$connectNameURLR = $userprefs[1] == '' ? $urlrw[3].'-0' : $urlrw[3].'-1-no';
    	$menu[getLabel($nom[$jj]).'_connect'] = array(
    		'id'       => 'connect',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$jj])),
            'title'    => getLabel($nom[$jj], 1),
    		'icon'     => '<i class="'.($userprefs[1] == '' ? 'fas fa-sign-in-alt' : 'fas fa-sign-out-alt').'"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $serviz[173] == 'ALL' ? $tconfig : $serviz[173],
            'granted'  => true,
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$connectNameURLR.'-'.$menutconf : $connectName,
			'base'     => 'connect.php',
			'target'   => '_self'
    	);
    }
    //FAQ
    if ($serviz[14] == 'on' && $menuico[6] == 'on') {
        $menutconf = $menuico[17] == 'ALL' ? $tconfig : $menuico[17];
    	$menu[getLabel($nom[$j+24]).'_faq'] = array(
    		'id'       => 'faq',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$j+24])),
            'title'    => getLabel($nom[$j+24], 1),
    		'icon'     => '<i class="far fa-question-circle"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[27] == 'ALL' ? $tconfig : $menuico[27],
            'granted'  => empty($menuico[37]) ? true : isAccessGranted($menuico[37]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[4].'-9-'.$menutconf : 'faq.php',
			'base'     => 'faq.php',
			'target'   => '_self'
    	);
    }
    //Forum
	$dbcat = array();
	if ($serviz[13] == 'on')
          $dbcat = ReadDBFields(DBFORUMCAT);
    $okfr  = false;
    if (!empty($dbcat)) 
	{
		foreach ($dbcat as $cat) 
		{
			if (!isset($cat[5])) $cat[5] = '';
			if ($cat[5] == 'on') 
			{ 
				$okfr = true; break;
			}
		}
	}
    if ($serviz[13] == 'on' && $okfr && $menuico[8] == 'on') {
        $menutconf = $menuico[19] == 'ALL' ? $tconfig : $menuico[19];
    	$forumName = $site['FRT'];
    	$forumNameURLR = $urlrw[5].'-'.$menutconf;
    	$menu[getLabel($nom[$j+22]).'_forum'] = array(
    		'id'       => 'forum',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$j+22])),
            'title'    => getLabel($nom[$j+22], 1),
    		'icon'     => '<i class="fab fa-forumbee"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[29] == 'ALL' ? $tconfig : $menuico[29],
            'granted'  => empty($menuico[39]) ? true : isAccessGranted($menuico[39]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$forumNameURLR : $forumName.'.php',
    		'alturls'  => array($site['TH'].'.php', 'forumarch.php', 'fortopicarch.php', 'treadarch.php'),
			'base'     => $forumName.'.php',
			'target'   => '_self'
    	);
    }
    //Link
    if ($serviz[11] == 'on' && $menuico[5] == 'on') {
        $menutconf = $menuico[16] == 'ALL' ? $tconfig : $menuico[16];
    	$menu[getLabel($nom[$i+3]).'_links'] = array(
    		'id'       => 'links',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+3])),
            'title'    => getLabel($nom[$i+3], 1),
    		'icon'     => '<i class="fas fa-external-link-alt"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[26] == 'ALL' ? $tconfig : $menuico[26],
            'granted'  => empty($menuico[36]) ? true : isAccessGranted($menuico[36]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[6].'-'.$menutconf : 'links.php',
			'base'     => 'links.php',
			'target'   => '_self'
    	);
    }
    //Guestbook
    if ($serviz[12] == 'on' && $menuico[7] == 'on') {
        $menutconf = $menuico[18] == 'ALL' ? $tconfig : $menuico[18];
    	$menu[getLabel($nom[$i+9]).'_guestbk'] = array(
    		'id'       => 'guestbook',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+9])),
            'title'    => getLabel($nom[$i+9], 1),
    		'icon'     => '<i class="fas fa-book"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[28] == 'ALL' ? $tconfig : $menuico[28],
            'granted'  => empty($menuico[38]) ? true : isAccessGranted($menuico[38]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[7].'-'.$menutconf : $site['GB'].'.php',
			'base'     => $site['GB'].'.php',
			'target'   => '_self'
    	);
    }
    //News
    if ($serviz[8] == 'on' && $menuico[1] == 'on') {
        $menutconf = $menuico[12] == 'ALL' ? $tconfig : $menuico[12];
    	$menu[getLabel($nom[$i+7]).'_news'] = array(
    		'id'       => 'news',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+7])),
            'title'    => getLabel($nom[$i+7], 1),
    		'icon'     => '<i class="far fa-newspaper"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[22] == 'ALL' ? $tconfig : $menuico[22],
            'granted'  => empty($menuico[32]) ? true : isAccessGranted($menuico[32]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[8].'-5-'.$menutconf : $site['NE'].'.php',
    		'alturls'  => array('newsarch.php'),
			'base'     => $site['NE'].'.php',
			'target'   => '_self'
    	);
    }
    //Photorama
    if ($serviz[9] == 'on' && $menuico[3] == 'on') {
    	$menutconf = $menuico[14] == 'ALL' ? $tconfig : $menuico[14];
        $photoName = 'photorama'; 
    	$menu[getLabel($nom[$i+2]).'_photo'] = array(
    		'id'       => 'photo',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+2])),
            'title'    => getLabel($nom[$i+2], 1),
    		'icon'     => '<i class="far fa-images"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[24] == 'ALL' ? $tconfig : $menuico[24],
            'granted'  => empty($menuico[34]) ? true : isAccessGranted($menuico[34]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[9].'-'.$menutconf : 'photorama.php',
    		'alturls'  => array('photorama2.php'),
			'base'     => 'photorama.php',
			'target'   => '_self'
    	);
    }
    //Download
    if ($serviz[10] == 'on' && $menuico[4] == 'on') {
    	$menutconf = $menuico[15] == 'ALL' ? $tconfig : $menuico[15];
    	$menu[getLabel($nom[$i+1]).'_download'] = array(
    		'id'       => 'download',
            'z2'       => $z2,
            'name'     => strip_tags(getLabel($nom[$i+1])),
            'title'    => getLabel($nom[$i+1], 1),
    		'icon'     => '<i class="fas fa-download"></i>',
            'pageexec' => $menutconf,
            'pagedisp' => $menuico[25] == 'ALL' ? $tconfig : $menuico[25],
            'granted'  => empty($menuico[35]) ? true : isAccessGranted($menuico[35]),
    		'url'      => ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[11].'-'.$menutconf : $site['DN'].'.php',
			'base'     => $site['DN'].'.php',
			'target'   => '_self'
    	);
    }
    //Plugins
    if (is_file(CHEMIN."inc/hplugins.inc")) {
    	include CHEMIN."inc/hplugins.inc";
    }
    //Icônes supplémentaires
    $dbicons = SelectDBFieldsByType(ReadDBFields(DOCID), TYP_MENUICO);
    foreach ($dbicons as $item) {
        if ($item[2] == 'a') {
            ReadDoc($item[1]);
			if ($fieldmail == $tconfig || $fieldmail == 'ALL') {
				$urls = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
				if (preg_match('!https?://|ftps?://|www.!', $urls[0]))
					$url = $urls[0];
				else {
					$slng = (strpos($urls[0], '?lng=') > 0 || strpos($urls[0], '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
					if ($slng != '') $urls[0] .= (strpos($urls[0], '?') > 0) ? '&'.$slng : '?'.$slng;
					$urls[0] = strpos($urls[0], 'tconfig') > 0 ? $urls[0] : $urls[0].'&tconfig='.($fieldweb == 'ALL' ? $tconfig : $fieldweb);
					if ($site['URLR'] == 'on' && empty($urls[1]) && strpos($urls[0], 'articles.php') !== false) {
						$pg      = substr($urls[0], strpos($urls[0], 'pg=') + 3);
						$pg      = strpos($pg, '&') > 0 ? substr($pg, 0, strpos($pg, '&')) : $pg;
						$urls[1] = $lng.'-'.$urlrw[20].($fieldweb == 'ALL' ? '-100-'.$pg : '-102-'.$pg.'-'.$fieldweb);
					}
					$url = (count($urls) == 1 || $site['URLR'] != 'on' ? $urls[0] : $urls[1]);
				}
				$icon_name = $lang[0] == $lng ? getLabel($fieldb1) : getLabel($fieldb2);
				$basename  = $site['URLR'] == 'on' ? basename($_SERVER['SCRIPT_NAME']) : parse_url($url, PHP_URL_PATH);
				$menu[$icon_name.'menuicon_'.$fielda1] = array(
					'id'       => strip_tags($fielda1),
                    'z2'       => preg_match('!https?://|ftps?://|www.!', $url) ? '' : $z2,
					'name'     => $lang[0] == $lng ? strip_tags(getLabel($fieldb1)) : strip_tags(getLabel($fieldb2)),
					'title'    => $icon_name,
					'icon'     => ($fieldc2 != '' && is_file(CHEMIN.'img/'.$fieldc2) 
                                     ? '<img src="'.CHEMIN.'img/'.$fieldc2.'" alt="" class="mt-n1" style="width:2rem;" />' 
                                     : '<i class="fas fa-external-link-alt"></i>'),
                    'pageexec' => $fieldweb == 'ALL' ? $tconfig : $fieldweb,
                    'pagedisp' => $fieldmail == 'ALL' ? $tconfig : $fieldmail,
                    'granted'  => empty($fieldmod) ? true : isAccessGranted($fieldmod),
					'url'      => $url,
					'base'     => basename(parse_url($url, PHP_URL_PATH)).'?'.parse_url($url, PHP_URL_QUERY),
					'target'   => $fieldc1,
					'docid'    => $item[1]
				);
				unset($urls);
			}
        }
    }
    ksort($menu);
    return $menu;
}

################################################################################
    
function fbox_menu($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $page, $site, $serviz, $userprefs, $web, $menuico, 
	    $urlrw, $tconfig, $flag1, $flag2, $dynabox, $endurl, $charset, $z2;
    static $nbox;
    $nbox++;
	$title_menu = getLabel($nom[$lng == $lang[0] ? 44 : 45]);
	$title_menu = mb_substr(trim($title_menu), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[0], 'MI'.$nbox.$pos.$tconfig).$title_menu;
	$tconfig    = empty($tconfig) ? '0' : $tconfig;
	$flags      = getMenuFlags($pos); // boxlang
    if ($lang[1] != '' && ($pos == BOX_LEFT || $pos == BOX_RIGHT)) 
        $title_menu = $flags.'<div'.(empty($lang[1]) ? '' : ' class="titleboxmenu"').'>'.$title_menu.'</div>';
    $base_current = basename(substr($_SERVER["SCRIPT_NAME"], strlen(parse_url($site[3], PHP_URL_PATH))));
	$full_current = $base_current.'?'.$_SERVER["QUERY_STRING"];
    unset($dbw);
    $menu = getOptionsMenuIcons();
    $out = '';
    $currentMenuClass = '';
    if ($pos != BOX_LEFT && $pos != BOX_RIGHT) { // Menu horizontal
    	// Sections du menu
    	$found_current = false;
    	foreach ($menu as $section) {
			if ($section['granted'] === false) continue;
            if ($currentMenuClass != '') {
                $found_current = true;
                $currentMenuClass = '';
            }
            if (!$found_current) {
        		if (!isset($section['alturls'])) {
					if (isset($section['docid']))
						$currentMenuClass = ($full_current == $section['base']) ? ' active' : '';
					else
						$currentMenuClass = ($base_current == $section['base']) ? ' active' : '';
        		} else {
        		    $currentMenuClass = ($base_current == $section['base']) ? ' active' : '';
                    foreach($section['alturls'] as $url) {
                        if ($base_current == $url) {
                            $currentMenuClass = ' active';
                            break;
                        }
                    }
        		}
    		}
    		if (($page[9] != '' || $section['name'] != '') && $section['pagedisp'] == $tconfig) {
				if (strpos($section['url'], $site[3]) !== false) {
					$url  = CHEMIN.substr($section['url'], strlen($site[3]));
					$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
					if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
				} elseif (preg_match('!https?://|ftps?://|www.!', $section['url'])) {
					$url = $section['url'];
				} else {
					$url  = CHEMIN.$section['url'];
					$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
					if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
				}
				if ($section['target'] == '_POPUP')
					$target = '	onclick="window.open(this.href, \'popup'.(isset($section['docid']) ? $section['docid'] : '0').'\', 
						\'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
				else
					$target = strtolower($section['target']) == '_self' ? '' : ' target="'.strtolower($section['target']).'"';
				$contents = '
			<a href="'.$url.($section['z2'] ? $z2 : '').'" title="'.strip_tags($section['title']).'"'.$target.'>';
    			if ($section['name'] != '') {
    				$contents .= '
			  <span class="name_'.$section['id'].$currentMenuClass.'">'.($page[9] != '' ? $section['icon'].'&nbsp;' : '').$section['name'].'</span>';
    			}
    			$contents .= '
			</a>';

    			$out .= '
          <li id="menu_'.$section['id'].'" class="nav-item'.$currentMenuClass.'">
		    '.$contents.'
		  </li>';
    		}
    	}
      return '
<nav class="menuIcons navbar navbar-expand-md navbar-light '.$pos.$tconfig.'MI">
  '.$flags.(empty($flags) ? '<span class="mi-title ml-2">&nbsp;</span>' : '').'
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarMI" aria-controls="navbarMI" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarMI">
    <ul class="container-fluid navbar-nav mr-auto">
      '.$out.'
    </ul>
  </div>
</nav>
';
    } else { // Menu boite latérale
    	$out .= '
      <ul class="boxmenu">
    	';
    	// Sections du menu
    	$found_current = false;
    	$currentMenuClass = '';
    	foreach ($menu as $section) {
			if ($section['granted'] === false) continue;
            if ($currentMenuClass != '') {
                $found_current = true;
                $currentMenuClass = '';
            }
            if (!$found_current) {
        		if (!isset($section['alturls'])) {
					if (isset($section['docid']))
						$currentMenuClass = ($full_current == $section['url']) ? ' curr_item' : '';
					else
						$currentMenuClass = ($base_current == $section['base']) ? ' curr_item' : '';
        		} else {
        		    $currentMenuClass = ($base_current == $section['base'])? ' curr_item' : '';
                    foreach($section['alturls'] as $url) {
                        if ($base_current == $url) {
                            $currentMenuClass = ' curr_item';
                            break;
                        }
                    }
        		}
    		}
    		if ($page[9] != '' || $section['name'] != '') {
				if (strpos($section['url'], $site[3]) !== false) {
					$url  = CHEMIN.substr($section['url'], strlen($site[3]));
					$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
					if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
				} elseif (preg_match('!https?://|ftps?://|www.!', $section['url'])) {
					$url = $section['url'];
				} else {
					$url  = CHEMIN.$section['url'];
					$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
					if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
				}
				if (strtoupper($section['target']) == '_POPUP')
					$target = '	onclick="window.open(this.href, \'popup'.(isset($section['docid']) ? $section['docid'] : '0').'\', 
						\'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
				else
					$target = strtolower($section['target']) == '_self' ? '' : ' target="'.strtolower($section['target']).'"';
				$contents = '<a href="'.$url.(isset($section['z2']) && $section['z2'] ? $z2 : '').'" title="'.strip_tags($section['title']).'"'.$target.'>';
    			if($page[9] != '') {
    				$contents .= $section['icon'].'&nbsp;';
    			}
    			if ($section['name'] != '') {
    				$contents .= '<span class="name_'.$section['id'].$currentMenuClass.'">'.$section['name'].'</span>';
    			}
    			$contents .= '</a>';

    			$out .= '
          <li class="menu_'.$section['id'].$currentMenuClass.'">'.$contents.'</li>';
    		}
    	}
    	$out .= '
      </ul>';
        $out .= displayQuickConfig($pos, false, '', '', '', 29);
        return '
<div class="'.$pos.$tconfig.'MI">
  '.boxthin($pos, $title_menu, $out, ' MI'.$nbox.$pos.$tconfig, $dynabox[0], 'nav').'
</div>';
    }
}

################################################################################

function fbox_sidemenu($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $page, $site, $serviz, $userprefs, $web, $menuico, 
	    $urlrw, $tconfig, $flag1, $flag2, $dynabox, $endurl, $charset, $z2;
    static $nbox;
    $nbox++;
	$tconfig    = empty($tconfig) ? '0' : $tconfig;
	$title_menu = getLabel($nom[$lng == $lang[0] ? 44 : 45]);
	$flags      = getMenuFlags(); // boxlang
    $menu       = getOptionsMenuIcons();
    $out        = '
<script>
function openNav() {
  document.getElementById("GY_sidenav").style.width = "300px";
  document.getElementById("overlay").style.display = "block";
}
function openConnect() {
  document.getElementById("GY_connect").style.width = "400px";
  document.getElementById("overlay").style.display = "block";
}
function closeNav() {
  document.getElementById("GY_sidenav").style.width = "0";
  document.getElementById("overlay").style.display = "none";
}
function closeConnect() {
  document.getElementById("GY_connect").style.width = "0";
  document.getElementById("overlay").style.display = "none";
}
function gotop() { window.location="#top"; }
function goz2() { window.location="#z2"; }
</script>
';
   	$out2 = '
    <div class="smopt">
      <ul class="boxmenu">';
    // Sections du menu
    $nameConnect = $nameAdmin = '';
    foreach ($menu as $section) {
        if ($section['granted'] === false) continue;
        if ($section['id'] == 'connect') $nameConnect = trim($section['name']);
        $pos         = strpos($nameConnect, '-->');
        $nameConnect = ($pos > 0 ? substr($nameConnect, $pos + 3) : $nameConnect);
        if ($section['id'] == 'admin') $nameAdmin = trim($section['name']);
        if (($page[9] != '' || $section['name'] != '') && $section['id'] != 'connect' && $section['id'] != 'admin') {
            if (strpos($section['url'], $site[3]) !== false) {
                $url  = CHEMIN.substr($section['url'], strlen($site[3]));
                $slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
                if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
            } elseif (preg_match('!https?://|ftps?://|www.!', $section['url'])) {
                $url = $section['url'];
            } else {
                $url  = CHEMIN.$section['url'];
                $slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng.'&amp;tconfig='.$section['pageexec'];
                if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
            }
            if (strtoupper($section['target']) == '_POPUP')
                $target = '	onclick="window.open(this.href, \'popup'.(isset($section['docid']) ? $section['docid'] : '0').'\', 
                    \'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
            else
                $target = strtolower($section['target']) == '_self' ? '' : ' target="'.strtolower($section['target']).'"';
            $contents = '<a href="'.$url.(isset($section['z2']) && $section['z2'] ? $z2 : '').'" title="'.strip_tags($section['title']).'"'.$target.'>';
            if ($section['name'] != '') {
                $contents .= '<div class="d-inline-block name_'.$section['id'].'">'.($page[9] != '' ? $section['icon'].'&nbsp;' : '').$section['name'].'</div>';
            }
            $contents .= '</a>';
            $out2     .= '
      <li>'.$contents.'</li>';
        }
    }
    $sym = ($nameConnect == $nom[14] || $nameConnect == $nom[15] || empty($userprefs[1]) 
      ? '<i class="fas fa-user" title="'.strip_tags($nom[$lng == $lang[0] ? 14 : 15]).'"></i>' 
      : '<i class="fas fa-user-slash" title="'.strip_tags($nom[$lng == $lang[0] ? 28 : 29]).'"></i>');
    $out2 .= '
      </ul>
    </div>';
    $out3 = '
    <div class="smlogo text-center ml-1 mr-4 mb-2 py-2 font-weight-bold">
      '.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'
    </div>';
    $out .= '
<div id="overlay" onclick="closeNav();closeConnect();"></div>
<div class="sidemenu">
  <div class="sideicon rounded px-3 pb-2" onclick="openNav(); '.($z2 != '' ? 'goz2();' : 'gotop();').'" title="'.$title_menu.'">
    <i class="fas fa-bars align-middle"></i>
  </div>
  '.(isAdmin($userprefs[1]) ? '
  <div class="admicon sidetexte">
    <a href="'.CHEMIN.($site['URLR'] == 'on' ? 'admin/'.$lng.'-'.$urlrw[0].'-19' : 'admin/admin.php?lng='.$lng).'" title="'.$nameAdmin.'">
      <i class="fas fa-user-cog"></i>
    </a>
  </div>' : '').'
  <div class="sidetexte" onclick="openConnect();'.($z2 != '' ? 'goz2();' : 'gotop();').'">'.$sym.'</div>
  <div class="sideflag">'.$flags.'</div>
</div>
<div class="sidenav" id="GY_sidenav">
  '.$out3.'<div><a class="closebtn" href="javascript:void(0)" onclick="closeNav();"><i class="fas fa-chevron-right"></i></a></div>'.$out2.'
</div>
<div class="sideconnect" id="GY_connect">
  <a class="closebtn" href="javascript:void(0)" onclick="closeConnect();"><i class="fas fa-chevron-right"></i></a>
  <div class="tblbox">'.fbox_user().'</div>
</div>';
    $out .= displayQuickConfig($pos, false, '', '', '', 29);
    return boxthin($pos, '', $out, ' SMI SMI'.$nbox.$pos.$tconfig, 'off', 'nav');
}

################################################################################

function fbox_cita($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $serviz, $userprefs, $web, $page, $tconfig;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
	$bc  = $args[0];
	$out = '';
    $dbw = SelectDBFields(TYP_THINK, 'a', '');
    if (count($dbw) > 0) {
		if ($serviz[108] == '') {
			srand(MakeSeed());
			$i = rand(0, count($dbw)-1);
			ReadDoc($dbw[$i][1]);
			if (isAuthorizedPublication($creadate)) {
				if ($lng == $lang[0]) {
					$txt1 = PathToImage($fieldc1);
					$txt2 = $fieldb1;
				} else {
					$txt1 = PathToImage($fieldc2);
					$txt2 = $fieldb2;
				}
				$txt1 = str_ireplace('<p>', ' ', $txt1);
				$txt1 = str_ireplace('</p>', ' ', $txt1);
				$out  = '
<div class="quote QOT'.$pos.$tconfig.'">
  <span class="labelcita">'.$web[5].'&nbsp;&nbsp;</span><span class="cita">'.$txt1.'&nbsp;&nbsp;</span><span class="author">'.$txt2.'</span>
</div>';
			}
		} else {
			$citatime = $serviz[109] * 1000;
			$out = '
<style>
  #lgcita'.$bc.' { position: relative; }
  #lgcita'.$bc.' div { display: none; position: absolute; }
  #lgcita'.$bc.' #citafirst'.$bc.' { position: relative; display: block; }
</style>
<div class="quote">
  <div id="lgcita'.$bc.'">';
			$n = min((int)$bc, count($dbw)) - 1;
			for ($i = 0; $i < count($dbw); $i++) {
				ReadDoc($dbw[$i][1]);
				if (!isAuthorizedPublication($creadate)) continue;
				if ($lng == $lang[0]) {
					$txt1 = PathToImage($fieldc1);
					$txt2 = $fieldb1;
				} else {
					$txt1 = PathToImage($fieldc2);
					$txt2 = $fieldb2;
				}
				$txt1 = str_ireplace('<p>', ' ', $txt1);
				$txt1 = str_ireplace('</p>', ' ', $txt1);
				$out .= '
    <div'.($i == $n ? ' id="citafirst'.$bc.'" ' : '').'>
      <span class="labelcita">'.$web[5].'&nbsp;&nbsp;</span><span class="cita">'.$txt1.'&nbsp;&nbsp;</span><span class="author">'.$txt2.'</span>
    </div>';
			}
			$out .= '
  </div>
  <script>
    function nextcita'.$bc.'(speed) {
      $("#citafirst'.$bc.'").hide();
      if ($("#citafirst'.$bc.'").next().fadeOut(speed).length)
        $("#citafirst'.$bc.'").next().fadeIn(speed,function(){
          $("#citafirst'.$bc.'").removeAttr("id").next().attr("id","citafirst'.$bc.'");
        });
      else
        $("#lgcita'.$bc.' div:first").fadeIn(speed,function(){
		  $("#citafirst'.$bc.'").removeAttr("id");
          $("#lgcita'.$bc.' div:first").attr("id","citafirst'.$bc.'");
		});
    }
    setInterval("nextcita'.$bc.'(0)",'.$citatime.');
  </script>
</div>';
		}
        $out .= displayQuickConfig($pos, false, 'think', '', '', 28);
		return $out;
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_count($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $page, $site, $serviz, $userprefs, $web, $tabcounter, 
           $dynabox, $tconfig, $charset;
    static $nbox;
    $nbox++;
    $i = $lng == $lang[0] ? 0 : 10;
    $out1 = $out2 = '
<p class="box text-left">&nbsp;';
    $out1 .= $tabcounter[0].'&nbsp;';
    $out2 .= $tabcounter[1].'&nbsp;';
    $out1 .= $tabcounter[0] == 1 ? $web[15] : $web[16];
    $out1 .= '
</p>';
    $out2 .= $tabcounter[1] == 1 ? $web[17] : $web[18];
    $out2 .= '
</p>';
    $out = $out1.$out2;
    $out .= displayQuickConfig($pos, false, 'counter', '', '', 31);
	$titre = getLabel($nom[$lng == $lang[0] ? 8 : 18]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[2], 'CNT'.$nbox.$pos.$tconfig).$titre;
    return '
<div class="'.$pos.$tconfig.'CNT">
  '.boxthin($pos, $titre, $out, ' CNT'.$nbox.$pos.$tconfig, $dynabox[2]).'
</div>';
}

################################################################################

function fbox_ban($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $serviz, $userprefs, $web, $page, $tconfig;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox;
    $nbox++;
    $bc = $nbox;
    $dbw = SelectDBFields(TYP_BANNER, 'a', '');
    if (count($dbw) > 0) {
		if ($serviz[25] == '') {
			$out = '
<div class="banner">';
			srand(MakeSeed());
			$i = rand(0,count($dbw)-1);
			ReadDoc($dbw[$i][1]);
			if (isAuthorizedPublication($creadate)) {
				if ($lng == $lang[0]) {
					$img = $fielda1;
					$url = $fieldb1;
					$alt = empty($fieldd1) ? $url : $fieldd1;
				} else {
					$img = empty($fielda2) ? $fielda1 : $fielda2;
					$url = empty($fieldb2) ? $fieldb1 : $fieldb2;
					$alt = empty($fieldd2) ? $url : $fieldd2;
				}
				$img = CHEMIN.'img/'.$img;
				$extn = substr($img,-3);

				if (isImage($extn)) {
					if (!empty($url)) {
						$out .= '
  <a href="'.$url.'" target="_blank" title="'.$alt.'">';
					}
					$out .= '
    <img src="'.$img.'" alt="'.$alt.'" title="'.$alt.'" />';
					if (!empty($url)) {
						$out .= '
  </a>';
					}
				}
			}
		} else {
			$bantime = $serviz[26] * 1000;
			$out = '
<style>
  #ban'.$bc.' { position: relative; }
  #ban'.$bc.' a { display: none; position: absolute; }
  #ban'.$bc.' #banfirst'.$bc.' { position: relative; display: block; }
</style>
<div class="banner BAN'.$pos.$tconfig.'">
  <div id="ban'.$bc.'">';
			$n = min($bc, count($dbw)) - 1;
			for ($i = 0; $i < count($dbw); $i++) {
				ReadDoc($dbw[$i][1]);
				if (!isAuthorizedPublication($creadate)) continue;
				if ($lng == $lang[0]) {
					$img = $fielda1;
					$url = $fieldb1;
					$alt = empty($fieldd1) ? $url : $fieldd1;
				} else {
					$img = empty($fielda2) ? $fielda1 : $fielda2;
					$url = empty($fieldb2) ? $fieldb1 : $fieldb2;
					$alt = empty($fieldd2) ? $url : $fieldd2;
				}
				$img = CHEMIN.'img/'.$img;
				$extn = substr($img,-3);

				if (isImage($extn)) {
					if (!empty($url)) {
						$out .= '
    <a '.($i == $n ? 'id="banfirst'.$bc.'" ' : '').'href="'.$url.'" target="_blank" title="'.$alt.'">';
					}
					$out .= '
	  <img src="'.$img.'" alt="'.$alt.'" title="'.$alt.'" />';
					if (!empty($url)) {
						$out .= '
	</a>';
					}
				}
			}
			$out .= '
  </div>
  <script>
    function nextban'.$bc.'(speed) {
      if ($("#banfirst'.$bc.'").fadeOut(speed).next().length)
        $("#banfirst'.$bc.'").next().fadeIn(speed,function(){
          $("#banfirst'.$bc.'").removeAttr("id").next().attr("id","banfirst'.$bc.'");
        });
      else
        $("#ban'.$bc.' a:first").fadeIn(speed,function(){
		  $("#banfirst'.$bc.'").removeAttr("id");
          $("#ban'.$bc.' a:first").attr("id","banfirst'.$bc.'");
		});
    }
    setInterval("nextban'.$bc.'(0)",'.$bantime.');
  </script>';
		}
        $out .= displayQuickConfig($pos, false, 'banner', '', '', 27);
        return $out.'
</div>';
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_search($pos = NULL, $args = NULL) {
    global $lng, $lang, $members, $nom, $page, $site, $serviz, $userprefs, $drtuser, $web, 
           $dynabox, $urlrw, $tconfig, $charset, $z2;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[23])) return FALSE;
    if ($serviz[24] != 'on') return FALSE;
    include CONFIGREP.'searchconfig.inc';
    $tconf = ($confpage == 'ALL' ? $tconfig : $confpage);
    if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
        $out = '
<div class="thinboxsearch TS'.$pos.$tconfig.'">
  <form class="text-center" name="thinsearch'.$nbox.'" 
      action="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[12].'-'.$tconf.$z2 : 'search.php?lng='.$lng.'&amp;tconfig='.$tconf.$z2).'" 
      method="post">
    <input type="hidden" name="searchin" value="" />
    <div class="input-group mb-3 w-85 m-auto">
      <input name="search" class="texte form-control" type="text" placeholder="'.$web[58].'" value="" />
      <div class="input-group-append c-pointer" onclick="javascript:document.thinsearch'.$nbox.'.submit();">
        <span class="input-group-text">
          <i class="fas fa-search" title="'.getLabel($nom[$lng == $lang[0] ? 20 : 21]).'"></i>
        </span>
      </div>
    </div>';
        if ($lang[1] != '') {
            $out .= '
    <div class="thinboxsearchW">
      <select name="searchlng" class="form-control form-control-lg w-75 m-auto">
        <option value="">['.$lang[0].'] '.$web[177].' ['.$lang[1].']</option>
        <option value="'.$lang[0].'"'.Selected($lng == $lang[0]).'>['.$lang[0].'] '.$web[178].'</option>
        <option value="'.$lang[1].'"'.Selected($lng == $lang[1]).'>['.$lang[1].'] '.$web[178].'</option>
      </select>
	</div>';
        } else {
            $out .= '
    <input type="hidden" name="searchlng" value="'.$lang[0].'" />';
        }
        $out .= '
  </form>
</div>';
		$out .= displayQuickConfig($pos, false, '', '', '', 49);
		$titre = getLabel($nom[$lng == $lang[0] ? 20 : 21]);
		$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[3], 'TS'.$nbox.$pos.$tconfig).$titre;
        return '
<div class="'.$pos.$tconfig.'TS">'.boxthin($pos, $titre, $out, ' TS'.$nbox.$pos.$tconfig, $dynabox[3]).'
</div>';
    } else {
       $out = '
<div class="wideboxsearch WS'.$pos.$tconfig.'">
  <form name="widesearch'.$nbox.'" 
      action="'.CHEMIN.($site['URLR'] == 'on' ? 
        $lng.'-'.$urlrw[12].'-2-'.$lng.'-'.$tconf.$z2 : 
        'search.php?lng='.$lng.'&amp;searchlng='.$lng.'&amp;tconfig='.$tconf.$z2).'" 
      method="post">
    <input type="hidden" name="searchin" value="" />
    <div class="input-group w-85 mx-auto mb-2">
      <input name="search" class="texte form-control" type="text" placeholder="'.$web[58].'" value="" />
      <div class="input-group-append c-pointer" onclick="javascript:document.widesearch'.$nbox.'.submit();">
        <span class="input-group-text">
          <i class="fas fa-search" title="'.getLabel($nom[$lng == $lang[0] ? 20 : 21]).'"></i>
        </span>
      </div>
    </div>
  </form>
</div>';
		$out .= displayQuickConfig($pos, false, '', '', '', 49);
		if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
			return $out;
		} else {
			return boxwide($pos, '', $out, ' WS'.$pos.$tconfig);
		}
    }
}

################################################################################

function fbox_search2($pos = NULL, $args = NULL) {
    global $lng, $lang, $members, $nom, $page, $site, $serviz, $userprefs, $drtuser, $web, $urlrw, $tconfig, $z2;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[23])) return FALSE;
    if ($serviz[24] != 'on') return FALSE;
    include CONFIGREP.'searchconfig.inc';
    $tconf = $confpage == 'ALL' ? $tconfig : $confpage;
    $okfr  = false;
	$dbcat = array();
	if ($serviz[13] == 'on')
	{
		$dbcat = ReadDBFields(DBFORUMCAT);
	}
    if (!empty($dbcat)) 
	{
		foreach ($dbcat as $cat) 
		{
			if (!isset($cat[5])) $cat[5] = '';
			if ($cat[5] == 'on') 
			{ 
				$okfr = true; break;
			}
		}
	}
    $i = $lng == $lang[0] ? 0 : 1;
    $j = 10 * $i;
    $options = '';
    $options .= SearchOption(true,                isAccessGranted($members[1]),  TYP_ART,     $web[169]);
    $options .= SearchOption($serviz[29] == 'on', isAccessGranted($members[1]) && isAccessGranted($members[11]), TYP_REACT,   $web[187]);
    $options .= SearchOption($serviz[10] == 'on', isAccessGranted($members[7]),  TYP_DNLOAD,  getLabel($nom[1+$j]));
    $options .= SearchOption($serviz[14] == 'on', isAccessGranted($members[4]),  TYP_FAQ,     getLabel($nom[24+$i]));
    $options .= SearchOption($serviz[13] == 'on' && $okfr, isAccessGranted($members[5]), TYP_FORUM, getLabel($nom[22+$i]));
    $options .= SearchOption($serviz[12] == 'on', isAccessGranted($members[12]), TYP_GUESTBK, getLabel($nom[9+$j]));
    $options .= SearchOption($serviz[11] == 'on', isAccessGranted($members[3]),  TYP_LINKS,   getLabel($nom[3+$j]));
    $options .= SearchOption($serviz[8]  == 'on', isAccessGranted($members[13]), TYP_NEWS,    getLabel($nom[7+$j]));
    $options .= SearchOption($serviz[53] == 'on', isAccessGranted($members[15]), TYP_BLOG,    getLabel($nom[42+$i]));
    $options .= SearchOption($serviz[9]  == 'on', isAccessGranted($members[2]),  TYP_PHOTO,   getLabel($nom[2+$j]));
    $options .= SearchOption($serviz[47] == 'on', isAccessGranted($members[14]), TYP_AGENDA,  $web[488]);
    $options .= SearchOption(true,                true                         , TYP_ARCH,    $web[399]);

    $out = '
<form name="widesearch2'.$nbox.'" 
    action="'.CHEMIN.($site['URLR'] == 'on' ? 
      $lng.'-'.$urlrw[12].'-2-'.$lng.'-'.$tconf.$z2 : 
      'search.php?lng='.$lng.'&amp;searchlng='.$lng.'&amp;tconfig='.$tconf.$z2).'" 
    method="post">
  <div id="search2'.$nbox.'" class="'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) ? 'thinboxsearch1 TS1' : 'wideboxsearch1 WS1').$pos.$tconfig.'">
    <input type="hidden" name="searchin" value="" />
    <div class="input-group mb-3 w-85 m-auto">
      <input name="search" class="texte form-control" type="text" size="18" placeholder="'.$web[58].'" value="" />
      <div class="input-group-append c-pointer" onclick="javascript:document.widesearch2'.$nbox.'.submit();">
        <span class="input-group-text">
          <i class="fas fa-search" title="'.getLabel($nom[$lng == $lang[0] ? 20 : 21]).'"></i>
        </span>
      </div>
    </div>
    <div id="adv1'.$nbox.'" class="adv1web">
      <a href="javascript:cache(\'adv1'.$nbox.'\'); montre(\'adv2'.$nbox.'\'); montre(\'search1'.$nbox.'\');">'.$web[590].'</a>
    </div>
    <div id="adv2'.$nbox.'" class="adv2'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) ? '' : ' adv2W').'">&nbsp;</div>
    <div id="search1'.$nbox.'" class="'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) 
      ? 'w-100 mt-4 thinboxsearch2'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) 
        ? '' 
        : ' thinboxsearch2W') 
      : 'pt-2 wideboxsearch2'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) 
        ? '' 
        : ' wideboxsearch2W')).'">
      <div class="'.(in_array($pos, array(BOX_LEFT, BOX_RIGHT)) ? 'mt-n4 thinboxsearch3W' : 'wideboxsearch3W').' pt-1">
	    <select name="searchin" class="form-control-lg w-60 m-auto">
          <option value="" selected="selected">'.$web[168].'</option>
          '.$options.'
        </select>
	  </div>';
    if ($lang[1] != '') {
        $out .= '
      <div class="searchlngW">
        <select name="searchlng" class="form-control-lg w-70 m-auto">
          <option value="">['.$lang[0].'] '.$web[177].' ['.$lang[1].']</option>
          <option value="'.$lang[0].'"'.Selected($lng == $lang[0]).'>['.$lang[0].'] '.$web[178].'</option>
          <option value="'.$lang[1].'"'.Selected($lng == $lang[1]).'>['.$lang[1].'] '.$web[178].'</option>
        </select>
	  </div>';
    } else {
        $out .= '
      <input type="hidden" name="searchlng" value="'.$lang[0].'" />';
    }
    $out.= '
      <i class="fas fa-chevron-up searchclose" title="'.$web[57].'" 
        onclick="cache(\'adv2'.$nbox.'\'); cache(\'search1'.$nbox.'\'); montre(\'adv1'.$nbox.'\');">
      </i>
    </div>
  </div>
</form>
';
	$out .= displayQuickConfig($pos, false, '', '', '', 49);
	if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
		return $out;
	} else {
		if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
			return '
<div class="'.$pos.$tconfig.'SCH">'.boxthin($pos, '', $out, ' SCH'.$pos.$tconfig).'</div>';
		} else {
			return boxwide($pos, '', $out, ' SCH'.$pos.$tconfig);
		}
	}
}

################################################################################

function fbox_empty($pos = NULL, $args = NULL) {
    static $nbox = 0;
    $nbox++;
    $sidebox = in_array($pos, array(BOX_LEFT, BOX_RIGHT, BOX_TOP, BOX_BOTTOM));
	$class   = 'FB'.$nbox.$pos;
	$out = '';
    $content = '
<style>
  .'.$class.' {
    background-color: transparent;
    border: 0;
    box-shadow: none;
    height: 0;
    margin: 0;
    padding: 0;
  } 
</style>
<div class="d-none">&nbsp;</div>';
	if ($sidebox) {
		$out .= boxthin($pos, '', $content, ' '.$class, 'off');
	} else {
		$out .= boxwide($pos, '', $content, ' '.$class);
	}
    return $out;
}

################################################################################

function fbox_freebox($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $serviz, $site, $userprefs, $web, $page, $tconfig, $charset;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
    $sidebox = in_array($pos, array(BOX_LEFT, BOX_RIGHT, BOX_TOP, BOX_BOTTOM));
    $id = $args[0];
    ReadDoc($id);
    if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) return FALSE;
    if ($type != TYP_FREEBOX) return FALSE;
    if ($status != 'a') return FALSE;
    $fieldweb   = intval($fieldweb);
    $max_height = $fieldweb;
	$dynbox     = explode('|', $fielda2);
	$class      = ' FB'.$nbox.$pos.$fileid;
    if ($lng == $lang[0]) {
        $titre   = $fieldb1;
        $contenu = PathToImage($fieldc1);
    }
    else {
        $titre = $fieldb2;
        $contenu = PathToImage($fieldc2);
    }
	if ($pos == BOX_EDITO && mb_substr(trim($titre), 0, 2, $charset) == '§§') 
		$titre = sprintf(empty($userprefs[1]) ? $web[1] : $web[167], stripslashes($site[($lang[0] == $lng ? 0 : 11)]), $userprefs[1]);
    $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : ($pos == BOX_EDITO ? '' : DisplayDownArrow($dynbox[0], trim($class))).$titre;
    $out = '
<div class="'.$pos.$tconfig.'fb'.$id.'">';
    $content = '';
    if (!empty($contenu)) {
        $content .= '
<style>
.freebox'.$id.' {
  max-height: '.($max_height > 0 ? $max_height.'px;' : 'none;').'
  overflow: '.($max_height > 0 ? 'hidden;' : 'visible;').'
  background: transparent;
}
</style>';
        $content .= '
  <div id="box'.$id.'30" class="w-100 box freebox'.$id.'">'.$contenu.'</div>
  <div class="clearfix"></div>';
        if ($max_height > 0) $content .= '
    <p id="box'.$id.'10" class="float-right c-pointer pr-5">
      <a href="javascript:cache(\'box'.$id.'30\');montre(\'box'.$id.'20\');cache(\'box'.$id.'10\');" title="'.$web[296].'">
        '.$web[296].' <i class="far fa-plus-square"></i>
      </a>
    </p>';
        if ($max_height > 0) {
            $content .= '
  <div id="box'.$id.'20" class="w-100 box" style="display: none;">'.$contenu.'
    <p class="float-right c-pointer pr-5">
      <a href="#freebox'.$pos.$id.'" title="'.$web[57].'" onclick="cache(\'box'.$id.'20\');montre(\'box'.$id.'30\');montre(\'box'.$id.'10\');">
	    '.$web[57].' <i class="far fa-minus-square"></i>
      </a>
    </p>
  </div><div class="clearfix"></div>';
        }
    }
  $content .= displayQuickConfig($pos, $id, 'freebox&amp;form=2&amp;tri=ch&amp;id='.$id, '', '', 26);
	if ($sidebox) {
		$out .= boxthin($pos, $titre, $content, $class, $dynbox[0]);
	} else {
		$out .= boxwide($pos, $titre, $content, $class);
	}
	$out .= '
</div>';
    return $out;
}

################################################################################

function fbox_user($pos = NULL, $args = NULL) {
    global $lng, $lang, $members, $nom, $userprefs, $web, $endurl, $serviz, $cryptinstall, 
	       $dynabox, $site, $urlrw, $page, $tconfig, $charset, $tabcounter, $drtuser, $z2, $presform;
    static $nbox = 0;
    $nbox++;
    $out = '
    <div class="box text-right m-auto">';

    if (!empty($userprefs[1])) {
        $out .='
	  <form name="useraccount'.$nbox.'" action="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[3].'-14-'.$tconfig.$z2 : 'compte.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" method="post">
	    <div class="text-center userButtonW cmptButton">'.SubmitButton($web[212]).'</div>
	  </form>';
        if ($serviz[18] != 'on') $out .= '
	  <form name="usermsg'.$nbox.'" action="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[13].'-3-3-'.$tconfig.$z2 : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;tconfig='.$tconfig.$z2).'" method="post">
	    <div class="text-center userButtonW msgButton">'.SubmitButton($web[318]).'</div>
	  </form>';
        $out .= '
	  <form name="useroff'.$nbox.'" action="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[3].'-1-off-'.$tconfig.$z2 : 'connect.php?lng='.$lng.'&amp;connect=off&amp;tconfig='.$tconfig.$z2).'" method="post">
	    <div class="text-center userButtonW cntButton">'.SubmitButton($web[372]).'</div>
	  </form>';
    }
    else {
        if ($members[19] != '0' && $members[19] != '3') {
            $out .='
	  <form 
          name="usermemb'.$nbox.'" 
          action="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[3].'-3-on-new-'.$tconfig.$z2 
            : 'connect.php?lng='.$lng.'&amp;connect=on&amp;uuser=new&amp;tconfig='.$tconfig.$z2).'" 
          method="post">
	    <div class="text-center userButtonW">'.SubmitButton($web[160]).'</div>
	  </form>
	  <hr />';
        }
        $out.= '
<style>
.lblusr i { font-size: 1.7rem; width: 1.85rem; }
.lblusr input, .passwd input { border-radius: '.$presform[9].'; }
.passwd input.texte {
  height: 3.3rem;
  border: thin solid #ced4da;
}
.passwd button i {
  width: 1.85rem;
  height: 2.36rem;
  font-size: 1.6rem;
  padding-top: 4px;
}
.passwd .btn-outline-secondary, #uid-eye .input-group-text {
  background-color: #e9ecef;
  border-color: #ced4da;
  border-radius: '.$presform[9].';
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
</style>
	  <div class="text-center m-auto">
        <b>'.$web[373].' :</b>
        <form 
            name="userin'.$nbox.'" 
            action="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[3].'-0-'.$tconfig.$z2 
              : 'connect.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" 
            method="post">
          <input type="hidden" name="connect" value="on"/>
          <input type="hidden" name="uuser" value="old"/>
          <div class="text-center w-100 m-auto" style="max-width: 300px;">
            <div class="lblusr input-group mb-3">
              <div class="input-group-prepend">
                <span class="input-group-text"><i class="far fa-user"></i></span>
              </div>
              <input class="form-control" type="text" name="pseudo" placeholder="'.$web[49].'" value=""/>
            </div>
            <div class="passwd input-group mb-3">
              <input 
                data-toggle="password"
                id="uuid'.$pos.$tconfig.'" 
                class="texte userIdentW form-control" 
                type="password" 
                name="uid" 
                placeholder="'.$web[300].'" 
                value=""
                data-message="" 
              />
            </div>
            ';
        $out .= '      
              '.SubmitButton($web[52]).'
          </div>
        </form>
	  </div>
	  <div class="text-center userLostW">
	    <a class="userLostA" href="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[3].'-16-'.$tconfig.$z2 
          : 'lostpass.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'">'.$web[592].'</a>
	  </div><br />';
    }
    $out .= '
    </div>';

    $nbrmsg = array();
    if (FileDBExist(MSGREP.$userprefs[1].DBEXT)) {
        $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
        if ($dbmsg[0][0] == $userprefs[7]) {
            for ($i = 2; $i < count($dbmsg); $i++) {
                if (isset($dbmsg[$i][3]) && $dbmsg[$i][3] == 'new') {
                    $nbrmsg[] = $dbmsg[$i][3];
                }
            }
        }
    }
    if (count($nbrmsg) != 0) {
        $act  = ($serviz[18] == 'on' ? '0' : '3');
        $out .= '
	<div class="userWave text-center">
      <a class="box" href="'.CHEMIN.($site['URLR'] == 'on'
        ? $lng.'-'.$urlrw[13].'-3-'.$act.'-'.$tconfig.$z2 
        : 'tinymsg.php?lng='.$lng.'&amp;action='.$act.'&amp;tconfig='.$tconfig.$z2).'">
        <i class="far fa-envelope blink display-4 text-success" title="'.$web[319].'"></i>
      </a>';
        if (FALSE === stristr($endurl, 'tinymsg.php')) {
            $out .= '
      <object type="audio/wave" data="'.CHEMIN.'inc/mail/mail.wav">
        <param name="src" value="'.CHEMIN.'inc/mail/mail.wav" />
        <param name="autoplay" value="true" />
        <param name="autoStart" value="1">
        <param name="controller" value="false">
        <param name="filename" value="'.CHEMIN.'inc/mail/mail.wav" />
        <param name="showcontrols" value="false" />
      </object>';
        }
        $out .= '
    </div>';
    }
    if ($serviz[158].$serviz[159] != 'onon') $out .= '
    <hr />';
    $file_users  = opendir(MSGREP);
    $nbr_membres = 0;
    while ($nomfichier = readdir($file_users)) {
        if ('.dtb' == $nomfichier) {
            @unlink(MSGREP.$nomfichier);
            continue;
        }
        if( substr($nomfichier,-3) == "dtb" ) {
            $nbr_membres++;
        }
    }
    closedir($file_users);
    if ($nbr_membres > 1) {
        $text_nbr_membres = $web[321];
    }
    else {
        $text_nbr_membres = $web[322];
    }
	if ($serviz[149] == 'on') {
		$out1 = $tabcounter[0].'&nbsp;';
		$out2 = $tabcounter[1].'&nbsp;';
		$out .= '
    <div class="userCount text-left">&nbsp;
	  '.$out1.($tabcounter[0] == 1 ? $web[15] : $web[16]).'<br />&nbsp;
      '.$out2.($tabcounter[1] == 1 ? $web[17] : $web[18]).'<br /><br />
	</div>';
	}
    $regusers    = ReadDBFields(DBIPSTATS);
    $usersonline = array();
	$myIP        = '';
    foreach ($regusers as $reg) {
        if (!empty($reg[2])) {
			if ($userprefs[1] == $reg[2]) $myIP = $reg[0];
            $usersonline[] = array($reg[2], $reg[0]);
        }
    }
    @usort($usersonline,'AsciiCompare');
	$uniqueusers   = array();
//	$uniqueusers[] = $usersonline[0];
	for ($i = 0; $i < count($usersonline); $i++) {
			$uniqueusers[] = $usersonline[$i];
	}

    if ($serviz[158] != 'on') {
        $accessok = isAccessGranted($serviz[179], $userprefs[1]);
        $out .= '
    <div class="userList box text-left">&nbsp;';
        if ($accessok && $userprefs[1] != '' && $userprefs[20] != 'on' && $userprefs[5] == 'on' && $serviz[86] == 'on') $out .= '
	  <a href="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[15].'-9-'.$tconfig.$z2 
          : 'memberlist.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" title="'.$web[664].'"><strong>';
        $out .= '<i class="fas fa-users"></i>&nbsp;'.$nbr_membres." ".$text_nbr_membres;
        if ($accessok && $userprefs[1] != '' && $userprefs[20] != 'on' && $serviz[86] == 'on') $out .= '</strong>
      </a>';
        $out .= '
	</div>';
    }
    $visits  = ReadDBFields(USERREP.'visitsofday.dtb');
    $today   = date('Ymd');
    $visits1 = array();
    foreach ($visits as $visit) if ($visit[1] == $today) $visits1[] = $visit;
    $found = false;
    foreach ($uniqueusers as $unuser) {
        foreach ($visits1 as $visit) if ($visit[0] == $unuser[0]) $found = true;
        if (!$found && !empty($unuser[0])) $visits1[] = array($unuser[0], $today);
        $found = false;
    }
    WriteDBFields(USERREP.'visitsofday.dtb', $visits1);
	$visits    = array();
	$nomvisits    = array();
	if ($userprefs[1] != '' && $userprefs[20] != 'on' && $serviz[111] == 'on') {
		$visitsday = SelectDBFieldsByField(ReadDBFields(USERREP.'visitsofday.dtb'), 1, $today);
		foreach ($visitsday as $visit) {
            if (is_file(MSGREP.$visit[0].'.dtb')) {
                $dbmsg = ReadDBFields(MSGREP.$visit[0].DBEXT);
              if (isset($dbmsg[1][6]))
				{
					if ($dbmsg[1][6] == 'on')
					{					
						$nomvisits[] = $visit[0];
					}
				}
                unset($dbmsg);
            }
		}
		$nomvisits = array_unique($nomvisits);
		$out .= '
	<div class="userVisits box text-left">&nbsp;';
		$nbvisits = count($nomvisits);
		if ($nbvisits > 0) $out .= '
	  <a class="c-pointer" title="'.$web[677].'" onmouseup="montre(\'visits'.$nbox.'\');">';
		$out .= '<i class="fas fa-user-check"></i>&nbsp;'.$web[677].$nbvisits;
		if ($nbvisits > 0) $out .= '
	  </a>';
		$out .= '
	</div>
<style>
.visits {
    margin-top: -'.min(200, ($nbvisits*18)).'px;
}
</style>
	<div id="visits'.$nbox.'" class="visits">
	  <div class="visits2">';
		foreach ($nomvisits as $nomvisit) {
			$db = ReadDBFields(MSGREP.$nomvisit.'.dtb');
            if (!empty($db) && $db[1][6] == 'on') {
                $out .= '<div class="connectedofday">';
                if ($page[23] != 'none') {
                    if (!empty($db[1][16]) || $db[1][9] != 'ava-00') {
                        if ($db[1][9] == 'ava-00' && !empty($db[1][16])) $out .= '
            <img src="'.$db[1][16].'" class="ava-img my-1" alt="" />';
                        else $out .= '
            <i class="'.$db[1][9].' ava-img my-1"></i>';
                    }
                    elseif ($db[1][9] == 'ava-00') {
                        $out .= '
            <i class="ava-00 ava-img my-1"></i>';
                    }
                }
                $out .= $nomvisit.'
                </div>';
            }
		}
		$out .= '
	  </div>
	  <div class="visitsClose float-right c-pointer" onmouseup="cache(\'visits'.$nbox.'\')">&#xe808;</div>
	  <div class="clearfix"></div>
	</div>';
	}
    if ($serviz[159] != 'on') {
        $out .= '
    <div class="box text-left connectedList"><b>'.$web[175].'</b></div>';
        if (empty($usersonline)) {
            $out .= '
    <div class="box text-center">'.$web[176].'</div>';
        }
        else {
            $out .= '
    <div class="box text-left connectedList">';
            for ($i = 0; $i < count($uniqueusers); $i++) {
                if (substr($serviz[85], -1) != '/') $serviz[85] = $serviz[85].'/';
                $whois = (($serviz[31] == $userprefs[1] || $serviz[176] == $userprefs[1] || $drtuser[42] == 'admin') && $serviz[84] == 'on' 
                  ? ' (<a href="'.$serviz[85].$uniqueusers[$i][1].'" title="'.$uniqueusers[$i][1].'" target="_blank">'.substr($uniqueusers[$i][1], 0, 8).'...</a>)' : '');
                $db = ReadDBFields(MSGREP.$uniqueusers[$i][0].'.dtb');
                if ($db[1][6] == 'on') {
                    if (!empty($db[1][16]) || $db[1][9] != 'ava-00') {
                        if ($db[1][9] == 'ava-00' && !empty($db[1][16])) 
                            $avatar = '<img class="img-ava mr-2" src="'.$db[1][16].'" alt="" />';
                        else 
                            $avatar = '<i class="'.$db[1][9].' ava-img mr-2"></i>';
                    }
                    elseif ($db[1][9] == 'ava-00') {
                        $avatar = '<i class="ava-00 ava-img mr-2"></i>';
                    }
                    $avatar = $page[23] == 'none' ? ' ' : $avatar;
                    if ($userprefs[1] != '' && $userprefs[1] != $uniqueusers[$i][0] && $db[1][24] == 'on') {
                        $from = $userprefs[1];
                        $out .= '
      <div class="connectedUserW">
        <i class="fas fa-caret-right connectedImg" title="'.$web[321].'"></i>'.$avatar;
                        if ($serviz[18] != 'on') $out .= '
        <a href="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[13].'-2-1-'.$uniqueusers[$i][0].'-'.$from.'-'.$tconfig.$z2 
            : 'tinymsg.php?lng='.$lng.'&amp;action=1&amp;to='.$uniqueusers[$i][0].'&amp;from='.$from.'&amp;tconfig='.$tconfig.$z2).'" 
              title="'.$web[214]." ".$uniqueusers[$i][0].'">
          <i class="far fa-envelope" title="'.$web[214]." ".$uniqueusers[$i][0].'"></i>
        </a>';
                        $out .= '&nbsp;&nbsp;'.$uniqueusers[$i][0].$whois.'
      </div>';
                    }
                    else {
                        $out .= '
      <div class="connectedUserW">
        <i class="fas fa-caret-right connectedImg" title="'.$web[321].'"></i>'.$avatar.$uniqueusers[$i][0].'
      </div>';
                    }
                }
            }
            if ($userprefs[1] != '' && $serviz[84] == 'on') {
                $smyIP = substr($myIP, 0, 15).(mb_strlen($myIP) > 15 ? ' ...' : '');
                $out .= '
	  <div class="text-center userprefIP">IP: <a href="'.$serviz[85].$myIP.'" title="'.$myIP.'" target="_blank">'.$smyIP.'</a></div>';
            }
            $out .= '
    </div>';
        }
    }
    if (is_null($pos)) return $out;
	$out .= displayQuickConfig($pos);
	$titre = getLabel($nom[$lng == $lang[0] ? 34 : 35]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[5], 'USR'.$nbox.$pos.$tconfig).$titre;
    return '
<div class="'.$pos.$tconfig.'USR">'.boxthin($pos, $titre, $out, ' USR'.$nbox.$pos.$tconfig, $dynabox[5]).'
</div>';
}

################################################################################

function fbox_webm($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $serviz, $user, $userprefs, $web, $page, $site, $dynabox, $urlrw, 
           $tconfig, $charset, $meskin, $z2;
    static $nbox = 0;
    $nbox++;
    if (isset($user[1])) $em = BreakEMail($user[1]);
    $out = '
<div class="box webm">
  <div class="webmtblW">
    <div class="table-responsive-md">
    <table class="table-responsive-md table-borderless">';
    if ($serviz[21] == 'on') {
		$out .= '
      <tr class="webmlh">';
        if ($serviz[99] == 'on') {
            $out .= '
        <td class="p-3 text-center">
          <i class="fas fa-user-edit" title="'.$web[173].' '.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'"></i>
        </td>
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[2].'-'.$tconfig.$z2 : $site['CT'].'.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2).'" title="'.$web[464].'">&nbsp;'.$web[464].'</a>
        </td>';
        } else {
            $out .= '
        <td class="p-3 text-center">
          <i class="fas fa-user-edit" title="'.$web[173].' '.$user[0].'"></i>
        </td>';
            if ($user[3] == 'on') {
                $out .= '
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[14].'-'.TYP_MAIL.$z2 
              : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_MAIL.$z2).'" title="'.$web[173].' '.$user[0].'">
            &nbsp;'.$web[11].'
          </a>
        </td>';
            } else {
				$org  = 'webm';
                $out .= '
        <td class="p-3 text-left">
          <a data-target="#contactmodal" data-toggle="modal" class="box" style="cursor: pointer;" title="'.$web[173].' '.$user[0].'">&nbsp;'.$web[11].'</a>
        </td>
        <style> .modal-header { padding: 15px; } </style>
        <div class="modal fade" id="contactmodal" role="dialog">
          <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
            <div class="modal-content">
              <div class="modal-header">
                <h2>'.$web[173].' '.$user[0].'</h2>
                <button class="close" data-dismiss="modal" type="button"><i class="fas fa-times"></i></button>
              </div>
              <div class="modal-body">
                <p class="text-center popupMail">'.$web[644].'</p>
                <p class="text-center popupMail">
                  <a href="javascript:showEmails'.$org.'(\''.$em[0].'\',\''.$em[1].'\',\''.$em[2].'\');" 
                      title="'.addslashes($user[0]).'" class="text-center popupMail">
                    '.addslashes($user[0]).'
                  </a>
                </p>
                <p class="text-center popupMail"><b><span id="lblemail'.$org.'">(--------------)</span></b></p>
              </div>
            </div>
          </div>
        </div>
        <script>
          function showEmails'.$org.'(em1, em2, em3) {
            var emailFinal = "<a href=\'mailto:" + em1 + "@" + em2 + "." + em3 + "\'>" + em1 + "@" + em2 + "." + em3 + "</a>";
            document.getElementById("lblemail'.$org.'").innerHTML = emailFinal;
          }
        </script>';
            }
        }
		$out .= '
	  </tr>';
    }
    if ($serviz[62] == 'on') {
        $out .= '
      <tr class="webmlh">
        <td class="p-3 text-center">
          <i class="far fa-grin-hearts" title="'.$web[124].'"></i>
        </td>
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[14].'-'.TYP_RECO.$z2 
              : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_RECO.$z2).'" title="'.$web[124].'">
            &nbsp;'.$web[120].'
          </a>
        </td>
	  </tr>';
    }
    if (is_dir(CHEMIN.'mobile')) {
        $out .= '
      <tr class="webmlh">
        <td class="p-3 text-center">
          <i class="fas fa-mobile-alt" title="'.$web[295].'"></i>
        </td>
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.'mobile/?lng='.$lng.'"" target="_blank">&nbsp;'.$web[295].'</a>
        </td>
	  </tr>';
    }
    if (!empty($serviz[177])) {
        $out .= '
      <tr class="webmlh">
        <td class="p-3 text-center">
          <i class="fas fa-file-contract" title="'.$web[301].'"></i>
        </td>
        <td class="p-3 text-left">
          <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[20].'-102-'.$serviz[177].'-'.$serviz[178] 
              : 'articles.php?lng='.$lng.'&pg='.$serviz[177].'&tconfig='.$serviz[178]).$z2.'" title="'.$web[301].'">
            &nbsp;'.$web[301].'
          </a>
        </td>
      </tr>';
    }
    $out .= '
    </table>
    </div>
  </div>
</div>';
    $out .= displayQuickConfig($pos);
	$titre = getLabel($nom[$lng == $lang[0] ? 40 : 41]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[8], 'WEB'.$nbox.$pos.$tconfig).$titre;
    return '
<div class="'.$pos.$tconfig.'WEB">'.boxthin($pos, $titre, $out, ' WEB'.$nbox.$pos.$tconfig, $dynabox[8]).'</div>';
}

################################################################################

function fbox_cal($pos = NULL, $args = NULL) {
    global $lng, $lang, $nom, $drtuser, $page, $serviz, $userprefs, $web, $dynabox, $site, $urlrw, 
        $tconfig, $charset, $members;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[14])) return FALSE;
    if ($serviz[47] == 'on') {
		$titre = getLabel($nom[$lng == $lang[0] ? 32 : 33]);
		$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[4], 'CAL'.$nbox.$pos.$tconfig).$titre;
        $out = '
<script>
function getElement(aID) {
    return (document.getElementById) ? document.getElementById(aID) : document.all[aID];
}
function getIFrameDocument(aID){ 
    var rv = null; 
    var frame=getElement(aID);
    if (frame.contentDocument)
      rv = frame.contentDocument;
    else
      rv = document.frames[aID].document;
    return rv;
  }
    
function adjustMyFrameHeight'.$nbox.$pos.$tconfig.'() {
	var frame = getElement("calbox'.$nbox.$pos.$tconfig.'");
	var frameDoc = getIFrameDocument("calbox'.$nbox.$pos.$tconfig.'");
	frame.height = frameDoc.body.offsetHeight + 2;
}
</script>
<noscript>';
		$hcal = '340';
		$out .= '
</noscript>
<div class="text-center bg-inherit">
  <iframe 
    class="cal" 
    id="calbox'.$nbox.$pos.$tconfig.'" 
    src="'.CHEMIN.'inc/'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[17].'-'.$pos.'-'.$tconfig.'-'.$nbox 
      : 'calendar.php?lng='.$lng.'&amp;pos='.$pos.'&amp;tconfig='.$tconfig.'&amp;nbox='.$nbox).'" 
    height="'.$hcal.'">
  </iframe>
</div>
';
        $out   .= displayQuickConfig($pos, false, 'agenda', '', '', 37);
        return '
<div class="'.$pos.$tconfig.'CAL'.$nbox.'">'.boxthin($pos, $titre, $out, ' CAL'.$nbox.$pos.$tconfig, $dynabox[4]).'</div>';
    } else {
        return FALSE;
    }
}

################################################################################

function fbox_newslet($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $members, $nom, $serviz, $userprefs, $web, $page, $cryptinstall, $dynabox, $site, $urlrw,
           $tconfig, $charset, $z2, $rgpd;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[18], $userprefs[1])) {
        return FALSE;
    } else {
		$titre = getLabel($nom[$lng == $lang[0] ? 38 : 39]);
		$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[6], 'NWL'.$nbox.$pos.$tconfig).$titre;
		// suppression des inscriptions en attente hors délai
		$tmp = ReadDBFields(NEWSLET_WAIT);
		for ($i = 0; $i < count($tmp); $i++) {
			if ((date('Ymd') - $serviz[110]) > substr($tmp[$i][3], 0, 8)) {
				unset($tmp[$i]);
			}
		}
		WriteDBFields(NEWSLET_WAIT, $tmp);
        $nabon = CountDBFields(NEWSLET_LIST);
        $mot   = $nabon < 2 ? $web[257] : $web[258];
        $txt1  = !empty($userprefs[1]) ? $userprefs[1] : $web[259];
        $txt2  = !empty($userprefs[2]) ? $userprefs[2] : $web[260];
        $txt3  = ($nabon == 0) ? $mot.'<br />'.$web[176] : $nabon.' '.$mot;
        $txt3 = $serviz[63] == 'on' ? '' : '
<div class="nwl_nabon text-center">'.$txt3.'</div>';
        if (empty($userprefs[1])) { // non membre
            $out = '
<form 
  class="nwlSubscribe" 
  name="subscribe'.$nbox.'" 
  action="'.CHEMIN.($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[18].$z2 
    : $site['NL'].'.php?lng='.$lng.$z2).'" 
  method="post">
  <input type="hidden" name="nlsecure" value="on" />
  <div class="box">
    <div class="text-center">'.$web[247].'<span class="d-none"><input type="text" name="code_pseudo" value="" /></span></div>
    <div class="input-group mb-3 w-100 mx-auto" style="max-width: 300px;">
      <div class="input-group-prepend">
        <span class="input-group-text"><i class="far fa-user"></i></span>
      </div>
      <input class="texte form-control" type="text" name="nlpseudo" value="'.$txt1.'" onfocus="this.value=\'\'" />
    </div>
    <div class="input-group mb-3 w-100 mx-auto" style="max-width: 300px;">
      <div class="input-group-prepend">
        <span class="input-group-text"><i class="fas fa-at"></i></i></span>
      </div>
      <input class="texte form-control" type="text" name="nlmail" value="'.$txt2.'" onfocus="this.value=\'\'" />
    </div>
    <div class="nwlActionW">
      <label for="action1">'.$web[237].'</label> <input type="radio" id="action1" name="action" value="sub" checked="checked" />
    </div>
    <div class="nwlActionW">
      <label for="action2">'.$web[236].'</label> <input type="radio" id="action2" name="action" value="unsub" />
    </div>';
            if (!empty($serviz[177]) && !OK_RGPD_date($userprefs[1])) $out .= '
    <br/>
    <fieldset class="w-100 mx-auto text-left" style="max-width: 300px;">
      <p>'.$web[693].'</p>
      <div><label for="rgpd">'.$web[415].':&nbsp;&nbsp;&nbsp;</label><input type="checkbox" id="rgpd" name="rgpd"'.Checked($rgpd).' /></div>
    </fieldset>';
            if ($serviz[100] != '0' && $serviz[93] == 'on' && ($userprefs[1] == '' || $serviz[98] == '')) {
				$lbl = $serviz[100] == '3' ? $web[642] : '';
                $out .= '
	<div class="text-center boxCryptW">
      '.dsp_crypt(0, 1, 3, 1, $lbl, $serviz[115] == 'on' ? $web[643] : '').'
	  <div class="text-center m-auto">
	    '.($serviz[100] == '3' ? '' : $web[530]).'<input class="texte inputcrypt m-auto form-control" type="text" name="crypt" />
	  </div>
	</div>';
            }
            $out .= '
    <div class="text-center">'.SubmitButton($web[52]).'</div>'.$txt3.'
  </div>
</form>';
        } else {
            $abon = CheckDB2Fields(NEWSLET_LIST, $userprefs[1], 0, $userprefs[2], 1);
            if ($abon) { // abonné
                $out = '
<form 
  class="nwlUnsubscribe" 
  name="unsubscribe'.$nbox.'" 
  action="'.CHEMIN.($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[18].$z2 
    : $site['NL'].'.php?lng='.$lng.$z2).'" 
  method="post">
  <input type="hidden" name="nlsecure" value="on" />
  <input type="hidden" name="action" value="unsub" />
  <input type="hidden" name="nlpseudo" value="'.$userprefs[1].'" />
  <input type="hidden" name="nlmail" value="'.$userprefs[2].'" />
  <div class="box">
    <div class="text-center">'.$web[500].'<span class="d-none"><input type="text" name="code_pseudo" value="" /></span></div>';
                if ($serviz[100] != '0' && $serviz[93] == 'on' && $serviz[98] == '') {
					$lbl = $serviz[100] == '3' ? $web[642] : '';
                    $out .= '
	<div class="text-center boxCryptW">
	  '.dsp_crypt(0, 1, 3, 1, $lbl, $serviz[115] == 'on' ? $web[643] : '').'
	  <div class="text-center m-auto">
	    '.($serviz[100] == '3' ? '' : $web[530]).'<input class="texte inputcrypt m-auto form-control" type="text" name="crypt" />
	  </div>
	</div>';
                }
                $out .= '
    <div class="text-center">'.SubmitButton($web[236]).'</div>'.$txt3.'
  </div>
</form>';
            } else {
                $tmp = CheckDB2Fields(NEWSLET_WAIT, $userprefs[1], 0, $userprefs[2], 1);
                if ($tmp) { // abonnement en attente de confirmation
                    $out = '
<div class="text-center">'.$web[501].'</div>'.$txt3;
                } else { // non abonné à la newsletter
                    $out = '
<form class="nwlSubscribe" name="subscribe'.$nbox.'" 
    action="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[18] : $site['NL'].'.php?lng='.$lng).$z2.'" method="post">
  <input type="hidden" name="nlsecure" value="on" />
  <input type="hidden" name="action" value="sub" />
  <div class="box">
    <div class="text-center">'.$web[247].'<span class="d-none"><input type="text" name="code_pseudo" value="" /></div>
    <div class="input-group mb-3 w-100 mx-auto" style="max-width: 300px;">
      <div class="input-group-prepend">
        <span class="input-group-text"><i class="far fa-user"></i></span>
      </div>
      <input class="texte nwlIdentW form-control" type="text" name="nlpseudo" value="'.$txt1.'" onfocus="this.value=\'\'" />
    </div>
    <div class="input-group mb-3 w-100 mx-auto" style="max-width: 300px;">
      <div class="input-group-prepend">
        <span class="input-group-text"><i class="fas fa-at"></i></i></span>
      </div>
      <input class="texte nwlIdentW form-control" type="text" name="nlmail" value="'.$txt2.'" onfocus="this.value=\'\'" />
    </div>';
                if (!empty($serviz[177]) && !OK_RGPD_date($userprefs[1])) $out .= '
    <br/>
    <fieldset class="w-100 mx-auto text-left" style="max-width: 300px;">
      <p>'.$web[693].'</p>
      <div><label for="rgpd">'.$web[415].':&nbsp;&nbsp;&nbsp;</label><input type="checkbox" id="rgpd" name="rgpd"'.Checked($rgpd).' /></div>
    </fieldset>';
                    if ($serviz[100] != '0' && $serviz[93] == 'on' && $serviz[98] == '') {
						$lbl = $serviz[100] == '3' ? $web[642] : '';
                        $out .= '
	<div class="text-center boxCryptW">
	  '.dsp_crypt(0, 1, 3, 1, $lbl, $serviz[115] == 'on' ? $web[643] : '').'
	  <div class="text-center m-auto">
	    '.($serviz[100] == '3' ? '' : $web[530]).'<input class="texte inputcrypt m-auto form-control" type="text" name="crypt" />
	  </div>
	</div>';
                    }
                    $out .= '
    <div class="text-center">'.SubmitButton($web[237]).'</div>'.$txt3.'
  </div>
</form>';
                }
            }
        }
        $out   .= displayQuickConfig($pos, false, '', '', '', 33);
        return '
<div class="'.$pos.$tconfig.'NWL">'.boxthin($pos, $titre, $out, ' NWL'.$nbox.$pos.$tconfig, $dynabox[6]).'</div>';
    }
}

################################################################################

function fbox_rss($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $serviz, $userprefs, $web, $page, $dynabox, $site, 
         $urlrw, $tconfig, $charset, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
    $dbrss = ReadDBFields(DBRSS);
    sort($dbrss);
    $out = '';
    $i = $lng == $lang[0] ? 0 : 1;
	$titre = getLabel($nom[36 + $i]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[7], 'RSS'.$nbox.$pos.$tconfig).$titre;
    for ($j = 0; $j < count($dbrss); $j++) {
        Readdoc($dbrss[$j][4]);
        $tconf = empty($fieldweb) ? 0 : ($fieldweb == 'ALL' ? $tconfig : $fieldweb);
        $out .= '
<div class="text-center itemRssBoxW">
  <a class="box" href="'.CHEMIN.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[19].'-2-'.$dbrss[$j][4].'-'.$tconf.$z2 
      : 'newsrss.php?lng='.$lng.'&amp;id='.$dbrss[$j][4].'&amp;tconfig='.$tconf.$z2).'">
    '.$dbrss[$j][$i].'
  </a>
</div>';
    }
    $out   .= displayQuickConfig($pos, false, 'rss', '', '', 34);
    return '
<div class="'.$pos.$tconfig.'RSS">'.boxthin($pos, $titre, $out, ' RSS'.$nbox.$pos.$tconfig, $dynabox[7]).'</div>';
}

################################################################################

function fbox_socnet($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $serviz, $userprefs, $web, $page, $nom, $site, $urlrw, $tconfig, $charset, 
		$status, $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $dynabox, $z2;
    static $nbox = 0;
    $nbox++;
    $dbnet = ReadDBFields(DBSOCNET);
    $nbnet = count($dbnet);
    for ($j = 0; $j < $nbnet; $j++) {
        $dbnet[$j][0] = $dbnet[$j][2];
        if (substr($dbnet[$j][0], 0, 4) == '<!--') 
            $dbnet[$j][0] = str_replace('<!--', '', $dbnet[$j][0]);
        else
            $dbnet[$j][0] = $nbnet;
    }
	@sort($dbnet);
    $out = '
<div class="text-left iconSocnetW">';
    for ($j = 0; $j < count($dbnet); $j++) {
		ReadDoc($dbnet[$j][4]);
        if ($fieldc2 != '') $soc = SelectDBFieldsByField(ReadDBFields(CONFIGREP.'socnet.dtb'), 0, $fieldc2);
		if ($status == 'a' && trim($fieldd1) != '') {
            $cr = ($fielda1 == 'on' ? $soc[0][1] : '#000000');
            $bg = ($fielda1 == 'on' ? $soc[0][2] : '#E9ECEF');
            $rd = ($fielda2 == 'on' ? 'circle' : '6px');
            $sz = $fieldb2;
            $fielda2 = $fieldb2 = '';
            $out .= '
  <style> .soc a:hover { color: '.$cr.'; background-color: '.$bg.'; } </style>
';
            if ($fieldc2 == 'rss' && ($serviz[16] == 'on' || $serviz[54] == 'on' || $serviz[60] == 'on' || $serviz[103] == 'on')) $out .= '
  <div class="soc d-inline-block" data-size="'.$sz.'" data-iconcolor="'.$cr.'" data-buttoncolor="'.$bg.'" data-spacing="10px" data-radius="'.$rd.'">
    <a class="soc-rss" href="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[19].$z2 : 'rss.php?lng='.$lng.$z2).'" title="'.$web[617].'" target="'.$fieldc1.'"></a>
  </div>';
            elseif ($fieldd2 != '' && strpos($fieldd2, '.') > 0) $out .= '
  <div class="d-inline-block align-top">
    <a href="'.$fieldd1.'" title="'.$fieldb1.'" target="'.$fieldc1.'">
      <img src="'.CHEMIN.'img/'.$fieldd2.'" alt="'.(strip_tags($fieldb1)).'" style="width:'.$sz.';" />
    </a>
  </div>';
            else $out .= '
  <div class="soc d-inline-block" data-size="'.$sz.'" data-iconcolor="'.$cr.'" data-buttoncolor="'.$bg.'" data-spacing="10px" data-radius="'.$rd.'">
    <a href="'.$fieldd1.'" class="soc-'.$fieldc2.'" title="'.$fieldb1.'" target="'.$fieldc1.'"></a>
  </div>';
		}
    }
    $out .= '
</div>    
<div class="clearfix"></div>';
    $out  .= displayQuickConfig($pos, false, 'socnet', '', '', 50);
	$titre = getLabel($nom[$lng == $lang[0] ? 48 : 49]);
	if (in_array($pos, array(BOX_TOP, BOX_BOTTOM))) {
		return '<div class="boxnet NET'.$pos.$tconfig.'">'.$out.'</div>';
	} else {
		if (in_array($pos, array(BOX_LEFT, BOX_RIGHT))) {
            $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[9], 'NET'.$nbox.$pos.$tconfig).$titre;
			return '
<div class="'.$pos.$tconfig.'NET">'.boxthin($pos, $titre, $out, ' NET'.$nbox.$pos.$tconfig, $dynabox[9]).'</div>';
		} else {
            $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : $titre;
			return boxwide($pos, $titre, $out, ' NET'.$pos.$tconfig);
		}
	}
}

################################################################################

function fbox_lastdoc($pos = NULL, $args = NULL) {
    global $lng, $lang, $nom, $page, $serviz, $site, $userprefs, $web, $urlrw, $tconfig, 
	       $charset, $drtuser, $dynabox, $members, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    if (!isAccessGranted($members[22])) return FALSE;
	if ($serviz[116] != 'on') return false;
	if ($serviz[117].$serviz[118] == '') return false;
    static $nbox = 0;
    $nbox++;
    $out   = '';
    $ndays = 0;
    if ($serviz[118] == 'on') $ndays = !empty($serviz[119]) && is_numeric($serviz[119]) ? $serviz[119] : '15';
	if ($serviz[118] == 'on' && $ndays > 0) $dat = date('YmdHi', strtotime($ndays.' days'));
    if ($serviz[117] == 'on') {
        if ($userprefs[1] != '') $dat = !empty($userprefs[14]) ? $userprefs[14] : date('YmdHi');
        else $dat = date('YmdHi');
    }
	$db    = $dba = $dbb = array();
	$docid = SelectDBFieldsByStatus(ReadDBFields(DOCID), 'a');
	$dbdat = ReadDBFields(DOCDATES);
	foreach ($dbdat as $item) if ($item[2] >= $dat) $db[] = array($item[2], $item[0]);
	rsort($db);
	$dbag = $dbag2 = $dbar = $dbra = $dbom = $dbbl = $dbrb = $dbdn = $dbfa = $dbfr = $dbli = $dbgb = $dbne = $dbph = array();
	foreach ($db as $item) {
		$typ    = SelectDBFieldsByField($docid, 1, $item[1]);
		$idat   = $serviz[169] == 'on' ? '' : substr(FormatDate($item[0]), 0, 10).' :';
		$typdoc = empty($typ[0][0]) ? '' : $typ[0][0];
		switch ($typdoc) {
		case 'ag' : // agenda
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[14]) ? true : false;
			if ($serviz[121] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
                $valid_date = (int)substr($fielda1, 0, 8) >= (int)date('Ymd');
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a' && $valid_date) {
					$url0 = 'agenda.php?lng='.$lng.'&amp;idpg='.$fileid.'-'.'&amp;pg='.$item[0].'&amp;agv=1&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[17].'-22-'.$fileid.'--'.$fileid.'-1-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.FormatDate(substr($fielda1, 0, 8)).' - '.CutLongWord(strip_tags($lng == $lang[0] ? $fieldc1 : $fieldc2), 36).'...</a>';
					$dbag[]  = array($nom[$lng == $lang[0] ? 32 : 33], $link);
                    $dbag2[] = $fielda1;
				}
			}
			break;
		case 'ar' : // articles
   		case 'ra' : // réactions articles
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[1]) ? true : false;
            $id = false;
            if ($typdoc == 'ra' && $serviz[29] != '2' && $serviz[166] == 'on' && !$zmbr) {
                $dbw = SelectDBFieldsByField(ReadDBFields(DBREACT), 0, $item[1]);
                $id  = $dbw[0][1];
            }
            if ($typdoc == 'ar' && $serviz[122] == 'on' && !$zmbr) {
                $id = $item[1];
            }
            if ($id) {
                ReadDoc($id);
                $afm   = explode('|', $fieldmail);
                $tconf = $typdoc == 'ar' ? ($afm[0] == 'ALL' ? $tconfig : $afm[0]) : $fieldmail;
                $tconf = empty($tconf) ? $tconfig : $tconf;
                if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
                    $fa1  = $fielda1;
                    $fa2  = $fielda2;
                    $fb1  = $fieldb1;
                    $fb2  = $fieldb2;
                    $dbwo = ReadDBFields(DBOPTMENU);
                    $url0 = 'articles.php?lng='.$lng.'&pg='.$id.'&tconfig='.$tconf.$z2;
                    $url1 = $lng.'-'.$urlrw[20].'-102-'.$id.'-'.$tconf.$z2;
                    foreach ($dbwo as $item1) {
                        ReadDoc($item1[4]);
                        if (!isAuthorizedPublication($creadate) || !isAccessGranted($fieldmod) || $status != 'a') continue;
                        $urls = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
                        $pg   = substr($urls[0], strpos($urls[0], 'pg=') + 3);
                        $pos1 = strpos($pg, '&');
                        $pg   = $pos1 === false ? $pg : substr($pg, 0, $pos1);
                        if ($pg == $id) {
                            $fa1  = $fielda1;
                            $fa2  = $fielda2;
                            $fb1  = $fieldb1;
                            $fb2  = $fieldb2;
                            $tcnf = empty($fieldmail) ? $tconf : $fieldmail;
                            $url0 = 'articles.php?lng='.$lng.'&pg='.$pg.'&mnuid='.$item1[5].'&tconfig='.$tcnf.$z2;
                            $url1 = $lng.'-'.$urlrw[20].'-103-'.$pg.'-'.$item1[5].'-'.$tcnf.$z2;
                            break;
                        }
                    }
                    $link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fa1 : $fa2).' - '.strip_tags($lng == $lang[0] ? $fb1 : $fb2).'</a>';
                    if ($typdoc == 'ar') {
                        $dbar[] = array($web[169], $link); 
                        $dba[]  = $id;
                    }
                    if ($typdoc == 'ra') {
                        $dbra[] = array($web[187], $link); 
                        $dba[]  = $id;
                    }
                }
            }
            break;
		case 'om' : // options de menu indépendantes des services
			if ($serviz[154] == 'on') {
				ReadDoc($item[1]);
                $targets = array('agenda', 'articles', 'blog', 'download', 'faq', 'links', 'guestbk', 'thread', 'news', 'photorama2');
                $isValid = true;
                foreach($targets as $target) if (strpos($fieldd1, $target.'.php') === true) $isValid = false;
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a' && $isValid) {
                    $fa1  = $fielda1;
                    $fa2  = $fielda2;
                    $fb1  = $fieldb1;
                    $fb2  = $fieldb2;
                    $urls = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
                    if (empty($urls[1])) $urls[1] = $urls[0];
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $urls[1].$z2 : $urls[0].$z2).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fa1 : $fa2).' - '.strip_tags($lng == $lang[0] ? $fb1 : $fb2).'</a>';
					$dbom[] = array($web[448], $link);
				}
			}
			break;
		case 'bl' : // blog et commentaires
		case 'rb' : 
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[15]) ? true : false;
            $id = false;
            if ($typdoc == 'rb' && $serviz[57] != '2' && $serviz[167] == 'on' && !$zmbr) {
                $dbw = SelectDBFieldsByField(ReadDBFields(DBREBLOG), 0, $item[1]);
                $id  = $dbw[0][1];
            }
            if ($typdoc == 'bl' && $serviz[123] == 'on' && !$zmbr) {
                $id = $item[1];
            }
            if ($id) {
                ReadDoc($id);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
                    $url0 = $site['BL'].'.php?lng='.$lng.'&amp;sel=pg&amp;tconfig='.$tconfig.'&amp;pg='.$fileid.$z2;
                    $url1 = $lng.'-'.$urlrw[1].'-2-pg-'.$tconfig.'-'.$fileid.$z2;
                    $link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
                    if ($typdoc == 'bl') {
                        $dbbl[] = array($nom[$lng == $lang[0] ? 42 : 43], $link); 
                        $dbb[]  = $id;
                    }
                    if ($typdoc == 'rb') {
                        $dbrb[] = array($web[407].' '.mb_strtolower($nom[$lng == $lang[0] ? 42 : 43]), $link);
                        $dbb[]  = $id;
                    }
				}
			}
			break;
		case 'dn' : // téléchargements
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[7]) ? true : false;
			if ($serviz[124] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
					$url0 = $site['DN'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[11].'-4-'.$fileid.'-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
					$dbdn[] = array($nom[$lng == $lang[0] ? 1 : 11], $link);
				}
			}
			break;
		case 'fa' : // faq
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[4]) ? true : false;
			if ($serviz[125] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
					$url0 = 'faq.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[4].'-6-'.$fileid.'-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
					$dbfa[] = array($nom[$lng == $lang[0] ? 24 : 25], $link);
				}
			}
			break;
		case 'fr' : // forum
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[5]) ? true : false;
			if ($serviz[126] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
                if (isForumAccessGranted($fieldb2)) {
                    $dbw  = SelectDBFieldsByField(ReadDBFields(DBFORUM), 1, $fielda1);
                    $fid  = @$dbw[0][2];
                    $urw0 = empty($fieldb2) ? '-41-'.$fid : '-4-'.$fid.'-'.getForumcatId($fieldb2);
                    $urw1 = empty($fieldb2) ? '-411-'.$fid : '-5-'.$fid.'-'.getForumcatId($fieldb2);
                    $url0 = $site['TH'].'.php?lng='.$lng.'&amp;pg='.$fid.'&amp;cat='.getForumcatId($fieldb2).($fielda2 == '0' ? '' : '&amp;id=1#R'.$fielda2);
                    $url1 = $lng.'-'.$urlrw[5].($fielda2 == '0' ? $urw0.$z2 : $urw1.'-1#R'.$fielda2);
                    $lbl0 = ($fielda2 == '0' ? 'S' : 'R').$fielda1;
                    $lbl1 = $fielda2 == '0' ? $fieldb1 : CutLongWord(strip_tags($fieldc1), 36).'...';
                    $link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.$lbl0.' - '.strip_tags($lbl1).'</a>';
                    $dbfr[] = array($nom[$lng == $lang[0] ? 22 : 23], $link);
                }
			}
			break;
		case 'li' : // liens
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[3]) ? true : false;
			if ($serviz[127] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
					$url0 = 'links.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[6].'-5-'.$fileid.'-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
					$dbli[] = array($nom[$lng == $lang[0] ? 3 : 13], $link);
				}
			}
			break;
		case 'gb' : // livre d'or
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[12]) ? true : false;
			if ($serviz[128] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				$url0 = $site['GB'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
				$url1 = $lng.'-'.$urlrw[7].'-4-'.$fileid.'-'.$tconfig.$z2;
				$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.$author.' - '.CutLongWord(strip_tags($fieldc1), 36).'...</a>';
				$dbgb[] = array($nom[$lng == $lang[0] ? 9 : 19], $link);
			}
			break;
		case 'ne' : // nouvelles
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[13]) ? true : false;
			if ($serviz[129] == 'on' && !$zmbr) {
				ReadDoc($item[1]);
				if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod)) {
					$url0 = $site['NE'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
					$url1 = $lng.'-'.$urlrw[8].'-22-'.$fileid.'-'.$tconfig.$z2;
					$link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
					$dbne[] = array($nom[$lng == $lang[0] ? 7 : 17], $link);
				}
			}
			break;
		case 'ph' : // photos
            $zmbr = $userprefs[1] == '' && !isAccessGranted($members[2]) ? true : false;
			if ($serviz[130] == 'on' && $zmbr === false) {
                ReadDoc($item[1]);
                if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
                    $url0 = 'photorama2.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2;
                    $url1 = $lng.'-'.$urlrw[9].'-2-'.$fileid.'-'.$tconfig.$z2;
                    $link = $idat.' <a href="'.CHEMIN.($site['URLR'] == 'on' ? $url1 : $url0).'" target="_self" title="">'.strip_tags($lng == $lang[0] ? $fielda1 : $fielda2).' - '.strip_tags($lng == $lang[0] ? $fieldb1 : $fieldb2).'</a>';
                    $dbph[] = array($nom[$lng == $lang[0] ? 2 : 12], $link);
                }
			}
			break;
		}
	}
	unset($db);
    if (!empty($dbag)) $cr = array_multisort($dbag2, SORT_ASC, $dbag);
	$dbw = array($dbag, $dbar, $dbra, $dbom, $dbbl, $dbrb, $dbdn, $dbfa, $dbfr, $dbli, $dbgb, $dbne, $dbph);
	foreach ($dbw as $db) {
		if (!empty($db)) {
			$out .= '
	<fieldset><legend>'.$db[0][0].'</legend>';
			foreach ($db as $item) {
				$out .= '
	  <div'.($pos == 'NWL' ? ' class="py-1"' : '').'>'.$item[1].'</div>';
			}
			$out .= '
	</fieldset>';
		}
	}
	unset($dbag, $dbar, $dbra, $dbom, $dbbl, $dbrb, $dbdn, $dbfa, $dbfr, $dbli, $dbgb, $dbne, $dbphn, $dbw);
	if ($out != '') {
		$sidebox    = $pos == BOX_LEFT || $pos == BOX_RIGHT;
		$titre      = getLabel($nom[$lng == $lang[0] ? 54 : 55]);
		$lenout     = mb_strlen($out, $charset);
		$max_height = $pos == 'NWL' ? 0 : $serviz[120];
		$txt        = '
	'.($pos == 'NWL' ? '' : '<a id="hautlastdoc'.$nbox.'"></a>').'
	<div class="text-center">
      '.($serviz[118] == 'on' ? sprintf($web[645], $ndays) : sprintf($web[683], FormatDate(substr($userprefs[14], 0, 8)))).'
    </div>';
		if ($lenout > 0) {
			$txt .= '
<style>
.outLastdoc {
  max-height: '.($max_height > 0 ? $max_height.'px;' : 'none;').'
  overflow: '.($max_height > 0 ? 'hidden;' : 'visible;').'
}
</style>';
            if ($pos != 'NWL') $txt .= '
    <div id="minlastdoc'.$nbox.'" style="display: block;" class="lastdoc">';
            $txt .= '
      <div class="outLastdoc">
        '.$out.'
      </div>';
            if ($max_height > 0) $txt .= '
      <div class="text-right plusLastdocW">
        <a href="#lastdoc'.$nbox.'" title="'.$web[296].'" onclick="cache(\'minlastdoc'.$nbox.'\'); montre(\'maxlastdoc'.$nbox.'\');">
          '.$web[296].' <i class="far fa-plus-square"></i>
        </a>
      </div>';
            if ($pos != 'NWL') $txt .= '
    </div>';
            if ($max_height > 0) $txt .= '
    <div id="maxlastdoc'.$nbox.'" style="display: none;" class="lastdoc2">'.$out.'
      <div class="text-right plusLastdocW">
        <a href="#lastdoc'.$nbox.'" title="'.$web[57].'" onclick="cache(\'maxlastdoc'.$nbox.'\'); montre(\'minlastdoc'.$nbox.'\');">
	      '.$web[57].' <i class="far fa-minus-square"></i>
        </a>
      </div>
    </div>';
        }
        if ($pos == 'NWL') return $txt;
        $txt .= displayQuickConfig($pos);
		if ($sidebox  || $pos == BOX_BOTTOM) {
            $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[15], 'NOV'.$nbox.$pos.$tconfig).$titre;
			return '
<div class="'.$pos.$tconfig.'NOV">'.boxthin($pos, $titre, $txt, ' NOV'.$nbox.$pos.$tconfig, $dynabox[15]).'</div>';
		} else {
            $titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : $titre;
			return boxwide($pos, $titre, $txt, ' NOV'.$nbox.$pos.$tconfig);
        }
	} else
		return false;
}

################################################################################

function fbox_menubox($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $site, $serviz, $userprefs, $web, $texte, $page, $urlrw, $tconfig, $charset,
        $type, $fileid, $status, $creadate, $moddate, $author, $email,$fielda1, $fielda2, $z2, 
		$fieldb1, $fieldb2, $fieldc1, $fieldc2,$fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
	$tconfig = empty($tconfig) ? 0 : $tconfig;
    $sidebox = in_array($pos, array(BOX_LEFT, BOX_RIGHT, BOX_TOP, BOX_BOTTOM));
	$ilng    = $lng == $lang[0] ? 0 : 1 ;
    $menu    = $args[0];
    ReadDoc($menu);
    if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) return FALSE;
    if ($type != TYP_MENUBOX) return FALSE;
    if ($status != 'a') return FALSE;
    $type_menu = $fieldweb;
    $posimg    = $fieldd1;
	$class     = ' MNU'.$nbox.$pos.$fileid;
	$dynbox    = explode('|', $fielda2);
    $titre     = $lng == $lang[0] ? $fieldb1 : $fieldb2;
    $contenu   = PathToImage($lng == $lang[0] ? $fieldc1 : $fieldc2);
    $len       = strlen(parse_url($site[3], PHP_URL_PATH));
    $url_self  = $site['URLR'] == 'on' ? substr($_SERVER['REQUEST_URI'], $len): substr($_SERVER['PHP_SELF'], $len).($_SERVER['QUERY_STRING'] == '' ? '' : '?'.$_SERVER['QUERY_STRING']);
	$url_self .= $site['URLR'] == 'on' ? '': (strpos($url_self, 'tconfig') > 0 ? '' : '&amp;tconfig='.$tconfig);
    $dbw       = SelectDbFieldsByField(ReadDBFields(DBOPTMENU), 5, $menu);
    /**
     * $optmenu : tableau des options de menu
     *
     * $optmenu[*][0] = catégorie
     * $optmenu[*][1] = titre de l'option
     * $optmenu[*][2] = ID de l'option de menu
     * $optmenu[*][3] = URL de l'option de menu
     * $optmenu[*][4] = target du lien
     * $optmenu[*][5] = ID de la boîte menu
     * $optmenu[*][6] = indique si c'est la page courante (true/false]
	 * $optmenu[*][7] = indique si nouveauté
	 * $optmenu[*][8] = image new ou maj
     **/
    $optmenu  = array();
    $curr_cat = '';
    foreach ($dbw as $item) {
        if (!isAccessGranted($item[6])) continue;
        ReadDoc($item[4]);
		if (!isAuthorizedPublication($creadate)) continue;
        if ((mb_substr(trim($item[2]), 0, 1, $charset) == '§' && $ilng == 0) || (mb_substr(trim($item[3]), 0, 1, $charset) == '§' && $ilng == 1)) continue;
		$fieldmail = empty($fieldmail) || $fieldmail == 'ALL' ? $tconfig : $fieldmail;
        if ($status != 'a') continue;
        if ($lng == $lang[1] && empty($fieldb2)) continue;
		$img   = '';
		$urls  = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
        $ancre = '';
        $posa  = strpos($urls[0], '#');
        if ($posa !== false) $ancre = substr($urls[0], $posa);
		$pg   = '';
		if (preg_match('!https?://|ftps?://|www.!', $urls[0]))
			$url = $urls[0];
		else {
            $is_art   = strpos($urls[0], 'articles.php') !== false;
            $is_photo = strpos($urls[0], 'photorama2.php') !== false;
			if ($is_art || $is_photo) {
				$pg   = substr($urls[0], strpos($urls[0], 'pg=') + 3);
				$pos1 = strpos($pg, '&');
				$pg   = $pos1 === false ? $pg : substr($pg, 0, $pos1);
                if ($is_art) {
                    $urls[0] = 'articles.php?lng='.$lng.'&pg='.$pg.'&mnuid='.$item[5].'&tconfig='.$fieldmail.$ancre;
                    $urls[1] = $lng.'-'.$urlrw[20].'-103-'.$pg.'-'.$item[5].'-'.$fieldmail;
                }
                if ($is_photo) {
                    $urls[0] = 'photorama2.php?lng='.$lng.'&pg='.$pg.'&mnuid='.$item[5].'&tconfig='.$fieldmail;
                    $urls[1] = $lng.'-'.$urlrw[9].'-30-'.$pg.'-'.$item[5].'-'.$fieldmail;
                }
			}
			$url = empty($urls[1]) ? $urls[0] : ($site['URLR'] != 'on' ? $urls[0] : $urls[1]);
			if (strpos($url, $site[3]) !== false) {
				$url  = CHEMIN.substr($url, strlen($site[3]));
				$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
				if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
			} else {
				$url  = CHEMIN.$url;
				$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
				if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
			}
		}
		if ($fieldc1 == '_POPUP')
			$target = '	onclick="window.open(this.href, \'popup'.$item[4].'\', '
				.'\'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
		else
			$target = ' target="'.strtolower($fieldc1).'"';
		$target  = strtolower($fieldc1) == '_self' ? '' : $target;
        $is_curr = basename($url_self) == basename($url);
		$isNew   = $img != '';
        if ($is_curr) {
            $curr_cat  = trim($item[0 + $ilng]);
			$dynbox[0] = $dynbox[0] != 'off' ? 'open' : $dynbox[0];
        }
		if (!empty($pg)) {
			ReadDoc($pg);
            if (($lng == $lang[0] && empty($fieldb1)) || ($lng == $lang[1] && empty($fieldb2))) continue;
            $accept = $type == TYP_ART ? ($serviz[154] == 'on' ? $serviz[136] : 'off') : ($type == TYP_PHOTO ? $serviz[142] : 'off');
			$imgpg  = getNewUpdateDoc($creadate, $moddate, $accept);
			$isNew  = $isNew || ($imgpg != '');
			$img    = $imgpg != '' ?  $imgpg : $img;
		} else {
			$imgpg = getNewUpdateDoc($creadate, $moddate, $serviz[154]);
			$isNew = $isNew || ($imgpg != '');
			$img   = $imgpg != '' ?  $imgpg : $img;
        }
        if ($isNew) {
            $dynbox[0] = 'open';
        }
		$optmenu[] = array(trim($item[0 + $ilng]), trim($item[2 + $ilng]), $item[4], $url, $target, $item[5], $is_curr, $isNew, $img);
    }
    unset($dbw);
    sort($optmenu);

    $curcats = array();
    /**
     * $liste = liste des catégories et items dans l'ordre d'affichage
     *
     * $liste[*]['opt'] = item du tableau $optmenu d'où provient l'élément
     * $liste[*]['cat'] = est-ce une catégorie (true/false)
     * $liste[*]['txt'] = texte de l'élément, cad soit la [sous-]catégorie, soit le titre du lien
     * $liste[*]['niv'] = niveau d'indentation (0=racine)
     * $liste[*]['vis'] = est-ce un élément visible (true/false)
     * $liste[*]['new'] = est-ce un élément nouveau ou modifié
	 *
     **/
    $liste = array();
    foreach ($optmenu as $item) {
        if (empty($item[0])) {
            $i = 0;
        } else {
            $cats = explode('|', $item[0]);
            $xcat = '';
            for ($i = 0; $i < count($cats); $i++) {
                $xcat .= (empty($xcat) ? '' : '|').$cats[$i];
                // @ pour supprimer les NOTICE dûes à l'initialisation aléatoire des tableaux
                if (@$curcats[$i] != @$cats[$i]) {
                    $liste[] = array(
                        'cat' => TRUE, 'txt' => trim($cats[$i]), 'niv' => $i+1,
                        'vis' => (0 === strpos($curr_cat, $xcat)), 'opt' => $item, 'new' => $item[7]);
                    $curcats[$i] = $cats[$i];
                    array_splice($curcats, $i+1);
                }
            }
        }
        $liste[] = array('cat' => FALSE, 'txt' => ($posimg == 'L' ? $item[8].$item[1] : $item[1].'&nbsp;'.$item[8]), 'niv' => $i+1, 'vis' => $item[6], 'opt' => $item, 'new' => $item[7]);
    }
    unset($cats, $curcats);
    $content = '';
    if (!empty($optmenu)) {
        $out = '
<div class="'.$pos.$tconfig.'mb'.$menu.'">';
        $content = empty($contenu) ? '' : '
 <div class="box">
'.$contenu.'
 </div>';
        $typeRubrique = 'mnu'.$nbox;
      	$marqueur = $texte[3].' ';
      	$curr_marq = '<i class="fas fa-caret-right puce"></i>&nbsp;';
      	$rubr = '---';
      	switch ($type_menu) {
        /**********************************************************************/
  		case "0" : // liste de menu
            $niveau = 0;
            $content .= '
 <div class="mbtype0">
  <ul class="item">';
            foreach ($liste as $item) {
                $opt = $item['opt'];
                $opt[3] = 1 != preg_match('/(ftp|http|https)$/i', $opt[3]) ? $opt[3].$z2 : $opt[3];
                while ($niveau > $item['niv']) {
                    $niveau--;
                    $padding = str_pad('', 3*$niveau);
                    $content .=  '
'.$padding.'  </ul>
'.$padding.' </div>
'.$padding.'</li>';
                }
                $niveau = $item['niv'];
                $padding = str_pad('', 3*$niveau);
                if ($item['cat']) {
                    $content .=  '
'.$padding.'<li>
'.$padding.' <div>
'.$padding.'  <p class="rubr font-weight-bold categ niv'.$item['niv'].'">'.$item['txt'].'</p>
'.$padding.'  <ul class="item">';
                }
                else {
                    $content .= '
'.$padding.'<li class="link '.($opt[6] ? 'curr_item' : 'item').' niv'.$item['niv'].'">'.($opt[6] ? $curr_marq : $marqueur).'<a href="'.htmlentities($opt[3]).'" title="'.strip_tags($opt[1]).'"'.$opt[4].'>'.$item['txt'].'</a>';
        			$content .= displayQuickConfig(NULL, $opt[2], 'optmenu&amp;menubox='.$opt[5].'&amp;form=2&amp;tri=-id&amp;id='.$opt[2], '', '', 17);
                    $content .= '
'.$padding.'</li>';
                }
            }
            while ($niveau > 1) {
                $niveau--;
                $padding = str_pad('', 3*$niveau);
                $content .= '
'.$padding.'  </ul>
'.$padding.' </div>
'.$padding.'</li>';
            }
            $content .= '
  </ul>
 </div>';
    	break;
        /**********************************************************************/
    	case "1" : // menu dynamique
            $niveau = 0;
            $content .= '
 <div class="mbtype1">
  <form name="'.$typeRubrique.'" method="post">
   <p class="ta-center">';
            foreach ($liste as $item) {
                $opt = $item['opt'];
                $opt[3] = 1 != preg_match('/(ftp|http|https)$/i', $opt[3]) ? $opt[3].$z2 : $opt[3];
                if ($item['cat'] && 1 == $item['niv']) {
                    if (0 != $niveau) {
            $content .= '
    </select>';
                    }
                    $content .= '
    <select class="form-control" size="1" onchange="if (\'\' != this.value) { document.'.$typeRubrique.'.action=this.value; document.'.$typeRubrique.'.submit(); }">';
                }
                $selected = $opt[6] ? ' selected="selected"' : '';
                $padding = '';
                for ($i = 1; $i < $item['niv']; $i++) $padding .= '&nbsp; ';
                if ($item['cat']) {
                    $content .= '
     <option class="categ niv'.$item['niv'].'" value=""'.$selected.'>'.$padding.strip_tags($item['txt']).'</option>';
                } else {
                    if (0 == $niveau) {
                    $content .= '
    <select size="1" onchange="if (\'\' != this.value) { document.'.$typeRubrique.'.action=this.value; document.'.$typeRubrique.'.submit(); }" title="">';
                    }
            		$content .= '
     <option class="link niv'.$item['niv'].($opt[6] ? ' current' : '').'" value="'.$opt[3].'"'.$selected.'>'.$padding.$marqueur.strip_tags($item['txt']).'</option>';
                }
                $niveau = $item['niv'];
            }
            $content .= '
    </select>
   </p>
  </form>
 </div>';
            break;
        /**********************************************************************/
    	case "2" : // menu liste dynamique n°1
    		$openimg = 'far fa-plus-square';
    		$closeimg = 'far fa-minus-square';
        /**********************************************************************/
    	case "3" : // menu liste dynamique n°2
    		if ($type_menu == "3") {
                $openimg = 'fas fa-chevron-right';
                $closeimg = 'fas fa-chevron-up';
    		}

            $niveau = 0;
			$cpt    = 0;
			$nliste = $liste;
            $nums   = array_pad(array(), 12, 1);
            $bids   = array();
            $cache  = '';
			$padding = '';
            $content .= '
 <div class="mbtype'.$type_menu.'">
  <ul class="item">';
            foreach ($liste as $item) {
                $opt = $item['opt'];
                $opt[3] = 1 != preg_match('/(ftp|http|https)$/i', $opt[3]) ? $opt[3].$z2 : $opt[3];
                while ($niveau > $item['niv']) {
                    $niveau--;
                    $padding = str_pad('', 3*$niveau);
                    $content .=  '
'.$padding.'  </ul>
'.$padding.' </div>
'.$padding.'</li>';
                }
                $niveau = $item['niv'];
                $padding = str_pad('', 3*$niveau);
                if ($item['cat']) {
					$n = $cpt + 1;
					$isNew = false;
					while ($n < count($nliste) && $nliste[$n]['niv'] > $niveau) {
						if ($nliste[$n]['new']) {
							$isNew = true;
							break;
						}
						$n++;
					} 
                    $baseid = $pos.'mb'.$opt[5].'_'.$item['niv'].'_'.$nums[$item['niv']]++;
                    if (!$item['vis'] && !$isNew) {
                        $cache .= '
  $(\'#'.$baseid.'\').toggle(); $(\'#'.$baseid.'p\').toggle(); $(\'#'.$baseid.'m\').toggle();';
                    }
                    $content .=  '
'.$padding.'<li>
'.$padding.' <div>
'.$padding.'  <p class="rubr font-weight-bold categ niv'.$item['niv'].'" data-rubrid="'.$baseid.'">'
    .'<i id="'.$baseid.'p" class="'.$openimg.'" title="'.$web[429].'" style="display: none;"></i>'
    .'<i id="'.$baseid.'m" class="'.$closeimg.'" title="'.$web[57].'"></i>&nbsp;'.$item['txt'].'</p>
'.$padding.'  <ul id="'.$baseid.'" class="item">';
                }
                else {
                    $content .= '
'.$padding.'<li class="link '.($opt[6] ? 
    'curr_item' : 'item').' niv'.$item['niv'].'">'.($opt[6] ? $curr_marq 
    : $marqueur).'<a href="'.htmlentities($opt[3]).'" title="'.strip_tags($opt[1]).'"'.$opt[4].'>'.$item['txt'].'</a>';
        			$content .= displayQuickConfig(NULL, $opt[2], 'optmenu&amp;menubox='.$opt[5].'&amp;form=2&amp;tri=-id&amp;id='.$opt[2], '', '', 17);
                    $content .= '
'.$padding.'</li>';
                }
				$cpt++;
            }
            while ($niveau > 1) {
                $niveau--;
                $padding = str_pad('', 3*$niveau);
                $content .= '
'.$padding.'  </ul>
'.$padding.' </div>
'.$padding.'</li>';
            }
            $content .= '
  </ul>
 </div>';
            if ($cache != '') {
                $content .= BeginJavascript().$cache.EndJavascript();
            }
            break;
        /**********************************************************************/
    	case "4" : // menu dynamique compact
            $content .= '
 <div class="mbtype4">
  <form name="'.$typeRubrique.'" method="post">
   <p class="ta-center">
    <select size="1" onchange="if (\'\' != this.value) { document.'.$typeRubrique.'.action=this.value; document.'.$typeRubrique.'.submit(); }" title="">';
            foreach ($liste as $item) {
                $opt = $item['opt'];
                $selected = $opt[6] ? ' selected="selected"' : '';
                $padding = '';
                for ($i = 1; $i < $item['niv']; $i++) $padding .= '&nbsp; ';
                if ($item['cat']) {
            		$content .= '
     <option class="categ niv'.$item['niv'].'" value=""'.$selected.'>'.$padding.strip_tags($item['txt']).'</option>';
                } else {
            		$content .= '
     <option class="link niv'.$item['niv'].($opt[6] ? ' current' : '').'" value="'.$opt[3].'"'.$selected.'>'.$padding.$marqueur.strip_tags($item['txt']).'</option>';
                }
            }
            $content .= '
    </select>
   </p>
  </form>
 </div>';
            break;
        }
        $content .= displayQuickConfig($pos, $menu, 'menu&amp;form=2&amp;tri=ch&amp;id='.$menu, '', '', 17);
        $titre    = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : $titre;
        if ($sidebox) {
            $titre = DisplayDownArrow($dynbox[0], trim($class)).$titre;
            $out  .= boxthin($pos, $titre, $content, $class, $dynbox[0], 'nav');
        } else {
            $out .= boxwide($pos, $titre, $content, $class, 'nav');
        }
        $out .= '
</div>';
        return $out;
    } else {
        return false;
    }
}

################################################################################

function fbox_ddmenubox($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $site, $serviz, $userprefs, $web, $urlrw, $tconfig, $charset, $meskin, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    static $nbox = 0;
    $nbox++;
    $sidebox = $pos == BOX_LEFT || $pos == BOX_RIGHT;
	$ilng    = $lng == $lang[0] ? 0 : 1 ;
    $menu    = $args[0];
    ReadDoc($menu);
    if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) return FALSE;
    if ($type != TYP_DDMENUBOX) return FALSE;
    if ($status != 'a') return FALSE;
    $len       = strlen(parse_url($site[3], PHP_URL_PATH));
    $url_self  = $site['URLR'] == 'on' ? substr($_SERVER['REQUEST_URI'], $len) : (substr($_SERVER['PHP_SELF'], $len).($_SERVER['QUERY_STRING'] == '' ? '' : '?'.$_SERVER['QUERY_STRING']));
	$url_self .= $site['URLR'] == 'on' ? '' : (strpos($url_self, 'tconfig') > 0 ? '' : '&amp;tconfig='.$tconfig);
    $type_menu = $fielda2;
	$class     = $type_menu.$fileid;
    $titre     = ($lng == $lang[0] ? $fieldb1 : $fieldb2);
	$titre     = (mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : '<span class="pr-3">'.$titre.'</span>');
    $dynabox   = $fieldc1;
    $dbw       = SelectDbFieldsByField(ReadDBFields(DBOPTDDMENU), 5, $menu);
	$optmenu   = array();
    $is_curr   = false;
    sort($dbw);
    $num = 0;
    foreach ($dbw as $item) {
        if (!isAccessGranted($item[6])) continue;
        ReadDoc($item[4]);
		if (!isAuthorizedPublication($creadate)) continue;
        if ($status != 'a') continue;
		if ($type_menu == 'DDL') {
			$panel     = PathToImage($ilng == 0 ? $fieldc1 : $fieldc2);
			$optmenu[] = array(trim($item[2 + $ilng]), $panel);
		} else {
			$urls     = explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2);
            $is_art   = strpos($urls[0], 'articles.php') !== false;
            $is_photo = strpos($urls[0], 'photorama2.php') !== false;
			$icon     = $fieldc2;
			$url      = '';
			$target   = '';
			if (trim($urls[0]) != '?') {
                $flda1   = $fielda1;
                $fldc1   = $fieldc1;
                $fldmail = $fieldmail;
				if (preg_match('!https?://|ftps?://|www.!', $urls[0]))
					$url = $urls[0];
				else {
					$urls[0] = strpos($urls[0], 'tconfig') > 0 ? $urls[0] : ($urls[0].'&tconfig='.(empty($fldmail) ? $tconfig : $fldmail));
					if ($is_art || $is_photo) {
                        $pg   = substr($urls[0], strpos($urls[0], 'pg=') + 3);
                        $pos1 = strpos($pg, '&');
                        $pg   = $pos1 === false ? $pg : substr($pg, 0, $pos1);
                        ReadDoc($pg);
                        if (!isAccessGranted($fieldmod)) continue;
					}
					if (!empty($urls[1]) && $fieldmail > 0 && ($is_art || $is_photo)) {
                        if ($is_art) $urls[1] = $lng.'-'.$urlrw[20].'-102-'.$pg.'-'.$fldmail;
                        if ($is_photo) $urls[1] = $lng.'-'.$urlrw[9].'-2-'.$pg.'-'.$fldmail;
					}
					$url = empty($urls[1]) ? $urls[0] : ($site['URLR'] != 'on' ? $urls[0] : $urls[1]);
                    $is_curr = $url_self == $url ? true : false;
					if (strpos($url, $site[3]) !== false) {
						$url  = CHEMIN.substr($url, strlen($site[3]));
						$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&amp;lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
						if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&amp;'.$slng : '?'.$slng;
					} elseif ($url != '#') {
						$url  = CHEMIN.$url;
						$slng = (strpos($url, '?lng=') > 0 || strpos($url, '&lng=') > 0 || $site['URLR'] == 'on') ? '' : 'lng='.$lng;
						if ($slng != '') $url .= (strpos($url, '?') > 0) ? '&'.$slng : '?'.$slng;
					}
                    $url = 1 != preg_match('/(ftp|http|https)$/i', $url) ? $url.(strstr($url, 'index.php') ? '' : $z2) : $url;
				}
				if (strtoupper($fldc1) == '_POPUP')
					$target = '	onclick="window.open(this.href, \'popup'.$item[4].'\', 
						\'resizable=yes,status=yes,location=no,toolbar=yes,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=1024,left=0,height=768,top=0\'); return false;"';
				else
					$target = ' target="'.strtolower($fldc1).'"';
				$target = strtolower($fldc1) == '_self' ? '': $target;
			}
			$optmenu[] = @array($item[0], trim($item[2 + $ilng]), str_replace('&', '&amp;', $url), $target, $icon, $flda1, $is_curr);
            if ($is_curr) {
                $pos = strrpos($item[0], '-');
                $pos = $pos !== false ? $pos : 10;
                $niv = substr($item[0], 0, $pos);
                for ($j = $num; $j > -1; $j--) {
                    if ($niv == $optmenu[$j][0] && 1 !== preg_match('!https?://|ftps?://|www.!', $optmenu[$j][2])) {
                        $pos            = strrpos($niv, '-');
                        $pos            = $pos !== false ? $pos : 10;
                        $niv            = substr($niv, 0, $pos);
                        $optmenu[$j][6] = $j > ($type_menu == 'DDH' ? 0 : -1) ? true : false;
                        $is_curr        = false;
                        if ($pos == 1) break;
                    }
                }
            }
		}
        $num++;
    }
    unset($dbw);
    if (!empty($optmenu)) {
		sort($optmenu);
		if ($type_menu == 'DDL') {
			$out = '';
            $content = '
<nav class="navbar ddl '.$class.' navbar-expand-md">
  <a class="navbar-brand" href="'.$url_self.'">'.$titre.'</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSC-'.$class.'" aria-controls="navbarSC-'.$class.'" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarSC-'.$class.'">
    <ul class="navbar-nav m-0">';
			$n = 0;
			foreach ($optmenu as $opt) {
				$content .= '      
      <li class="nav-item dropdown w-100 T'.$n.'">
        <a class="nav-link dropdown-toggle T'.$n.'" href="#" id="navbarDDL" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          '.$opt[0].'  
        </a>
        <div class="dropdown-menu '.$class.' w-100" aria-labelledby="navbarDDL">
          <div class="container-fluid ml-0 pl-0">
            <div class="row w-100">
              <div class="col-md-12 m-0 ml-4 p-0 pl-4">
                '.$opt[1].'
              </div>
            </div>
          </div>
        </div>
      </li>';
				$n++;
			}
			$content .= '
    </ul>
  </div>
</nav>
';
            $class = ' ddl '.$class;
            $out .= boxwide($pos, '', $content, ' '.$class, 'div');
			$out .= displayQuickConfig($pos, false, '', '', '', 17);
			return $out;
		} 
        else {
			switch ($type_menu) {
			case 'DDH' :
                $content = '
<nav class="navbar ddh '.$class.' navbar-expand-md navbar-light" id="navbar'.$class.'">
  <a class="navbar-brand" href="'.$url_self.'">'.$titre.'</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSC-'.$class.'" aria-controls="navbarSC-'.$class.'" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarSC-'.$class.'">
    <ul class="navbar-nav mr-auto">
                ';
                $scl = 'ddh';
				break;
			case 'DDV' :
				$content = '
<nav class="navbar ddv '.$class.'">
  <ul class="navbar-nav mr-auto">
';
                $scl = 'ddv';
				break;
			}
            $cnt = count($optmenu);
            $i   = 0;
            while ($i < $cnt) {
                $img = empty($optmenu[$i][4]) ? '' : '<img src="'.CHEMIN.'img/'.$optmenu[$i][4].'" class="ddmImg" />';
                $cur = explode('-', $optmenu[$i][0]);
                $c   = count($cur);
                $p   = $s = $c;
                if ($i > 0) {
                    $pred = explode('-', $optmenu[$i - 1][0]);
                    $p    = count($pred);
                }
                if ($i + 1 < $cnt) {
                    $succ = explode('-', $optmenu[$i + 1][0]);
                    $s    = count($succ);
                }
                if ($c == 1 && $s == 1) { 
                    $content .= '
      <li class="nav-item '.$class.' btn-'.$scl.' mt-4 L'.$optmenu[$i][0].'">
        <a class="nav-link" href="'.$optmenu[$i][2].'">'.$img.$optmenu[$i][1].'</a>
      </li>';
                }
                elseif ($c == 1 && $s > $c) { $content .= '
      <li class="nav-item dropdown '.$class.' btn-'.$scl.' L'.$optmenu[$i][0].'">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown'.$optmenu[$i][0].'" role="button" data-toggle="dropdown"
            aria-haspopup="true" aria-expanded="false">
            '.$img.$optmenu[$i][1].'
        </a>
        <ul class="dropdown-menu" aria-labelledby="navbarDropdown'.$optmenu[$i][0].'">';
                }
                elseif ($c == $s) { $content .= '
          <li class="dropdown-item '.$class.($optmenu[$i][6] ? ' dd_current' : '').' L'.$optmenu[$i][0].'">
            <a href="'.$optmenu[$i][2].'"'.$optmenu[$i][3].'>'.$img.$optmenu[$i][1].'</a>
          </li>';
                }
                elseif ($s > $c) { $content .= '
          <li class="nav-item dropdown L'.$optmenu[$i][0].'">
            <a class="dropdown-item dropdown-toggle" href="#" id="navbarDropdown'.$optmenu[$i][0].'" role="button" data-toggle="dropdown"
                aria-haspopup="true" aria-expanded="false">
                '.$img.$optmenu[$i][1].'
            </a>
            <ul class="'.$scl.' dropdown-menu" aria-labelledby="navbarDropdown'.$optmenu[$i][0].'">';
                }
                elseif ($s < $c) { 
                    $content .= '
            <li class="dropdown-item '.$class.($optmenu[$i][6] ? ' dd_current' : '').' L'.$optmenu[$i][0].'">
              <a href="'.$optmenu[$i][2].'"'.$optmenu[$i][3].'>'.$img.$optmenu[$i][1].'</a>
            </li>
          </ul>
        </li>';
                    for ($k = 1; $k < $c - $s; $k++)
                        $content .= '
      </ul>
    </li>';
                }
                $i++;
            }
			switch ($type_menu) {
            case 'DDH' :
                $content .= '
      </ul>
    </li>
  </div>
</nav>';
                $class .= ' ddh';
                $title  = '';
                break;
            case 'DDV' :
                $content .= '
    </ul>
</nav>';
                $class .= ' ddv';
                $title  = $titre;
                break;
            }
            $content .= '
<script>
  $(function () {
    $("#navbar'.$class.'").bootnavbar();
  })
</script>';
			if ($sidebox) {
                $title = DisplayDownArrow($dynabox, trim($class)).$title;
				$out   = boxthin($pos, $title, $content, ' '.$class, $dynabox, 'div');
			} else {
				$out = boxwide($pos, $title, $content, ' '.$class, 'div');
			}
			$out .= displayQuickConfig($pos, false, '', '', '', 17);
			return $out;
		}
    } else {
        return false;
    }
}

################################################################################

function fbox_contact($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $urlrw, $site, $serviz, $userprefs, $web, $dynabox, 
           $tconfig, $charset, $menuico, $members, $z2;
    static $nbox = 0;
    $nbox++;
    if ($serviz[99] == '') return false;
    if (!isAccessGranted($members[20])) return FALSE;
    $tconf = $menuico[21] == 'ALL' ? $tconfig : $menuico[21];
	$out = '
<div class="box text-left">';
	$ctfiles = ReadDBFields(CONFIGREP.'ctconfigs.dtb');
	foreach($ctfiles as $ct) {
		if ($ct[2] == 'a') $out .= '
  <div class="itemContactW">
    <a href="'.CHEMIN.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[2].'-2-'.$ct[1].'-'.$tconf.$z2 
        : $site['CT'].'.php?lng='.$lng.'&amp;ctconfig='.$ct[1].'&amp;tconfig='.$tconf.$z2).'" title="'.$ct[$lng == $lang[0] ? 3 : 4].'">
	  <i class="far fa-envelope imgContact"></i>'.($ct[$lng == $lang[0] ? 3 : 4]).'
	</a>
  </div>';
	}
    $out .= '
</div>';
    $out .= displayQuickConfig($pos, false, 'contact', '', '', 13);
	$titre = getLabel($nom[$lng == $lang[0] ? 56 : 57]);
	$titre = mb_substr(trim($titre), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[16], 'CT'.$nbox.$pos.$tconf).$titre;
    return '
<div class="'.$pos.$tconfig.'CT">'.boxthin($pos, $titre, $out, ' CT'.$nbox.$pos.$tconfig, $dynabox[16]).'
</div>';
}

################################################################################

function fbox_photobox($pos = NULL, $args = NULL) {
    global $lng, $lang, $drtuser, $nom, $urlrw, $site, $serviz, $userprefs, $web, 
           $dynabox, $charset, $z2, $titre, $members, $menuico;
	if (!in_array($pos, array(BOX_EDITO, BOX_LEFT, BOX_RIGHT, BOX_ABOVE, BOX_UNDER, BOX_TOP, BOX_BOTTOM))) return false;
    static $nbox = 0;
    $nbox++;
    if (!isAccessGranted($members[2])) return FALSE;
    if (!isAccessGranted($menuico[34])) return false;
	$phs = ReadDBFields(DBPHOTO);
	$dps = array();
	$n   = 0;
	foreach ($phs as $ph) {
        if (isAccessGranted($ph[6]) && is_file(CHEMIN.'photo/gal_'.$ph[4].'/params_'.$ph[4].INCEXT)) {
            include CHEMIN.'photo/gal_'.$ph[4].'/params_'.$ph[4].INCEXT;
            if ($param9 == 'on' && empty($param10)) $dps[] = array($ph[4], $n);
            $param9 = '';
        }
        $n++;
	}
    $tconf = $menuico[14] == 'ALL' ? ($serviz[157] != 0 ? $serviz[157] : import('tconfig', '', true, 0)) : $menuico[14];
	if (empty($dps)) return false;
	$nb   = rand(0, count($dps) - 1);
	$dir  = 'gal_'.$dps[$nb][0];
	$gals = ReadDBFields(CHEMIN.'photo/'.$dir.'/'.$dir.DBEXT);
    $imgs = array();
	foreach ($gals as $img) if ($img[1] == 'a') $imgs[] = $img;
	if (empty($imgs)) return false;
    $nbimg = count($imgs);
	$title = $phs[$dps[$nb][1]][$lng == $lang[0] ? 2 : 3];
	$comment = $img[$lng == $lang[0] ? 5 : 6];
	$tpos  = mb_strpos($title, '-->');
	$title = $tpos === false ? $title : mb_substr($title, $tpos + 3);
    $class = $nbox.$pos.$tconf;
	$out = '
<div class="text-center m-auto">
  <div class="phtitlebox">
    <a href="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[9].'-2-'.$phs[$dps[$nb][1]][4].'-'.$tconf.$z2 : 'photorama2.php?lng='.$lng.'&amp;pg='.$phs[$dps[$nb][1]][4].'&amp;tconfig='.$tconf.$z2).'" title="'.$title.'">'.$title.'</a>
  </div>';
    $ugw  = in_array($pos, array(BOX_LEFT, BOX_RIGHT)) ? 540 : (in_array($pos, array(BOX_ABOVE, BOX_UNDER, BOX_EDITO)) ? 800 : 600);
    $ugh  = intval($ugw * 0.75);
    $long = floor($ugw / 17);
    $nblg = intval(floor($nbimg / ($long > 0 ? $long : 1))) + ($long * 17 > $ugw ? 1 : 0);
	switch ($serviz[83]) {
	case '0' :
        $out .= '
  <script src="'.CHEMIN.'inc/unitegallery/themes/tilesgrid/ug-theme-tilesgrid.js"></script>
  <script>
    jQuery(document).ready(function(){
	  jQuery("#'.$class.$dir.'").unitegallery({
		gallery_theme: "tilesgrid",
        grid_num_rows: 1,
        theme_navigation_type: "arrows",
        theme_arrows_margin_top: 8,
        tile_border_width: 3,
        tile_border_radius: 8,
        tile_enable_shadow: false,
        lightbox_type: "compact",
        lightbox_arrows_position: "inside",
      });
    });
  </script>';
		break;
	case '1' :
        $out .= '
  <script src="'.CHEMIN.'inc/unitegallery/themes/carousel/ug-theme-carousel.js"></script>
  <script>
    jQuery(document).ready(function(){
	  jQuery("#'.$class.$dir.'").unitegallery({
		gallery_theme: "carousel",
        theme_navigation_margin: 0,
        tile_border_width: 3,
        tile_width: '.$ugw.',
        tile_height: '.$ugh.',
        tile_border_radius: 0,
        tile_enable_shadow: false,
        lightbox_type: "compact",
        lightbox_arrows_position: "inside",
      });
    });
  </script>';
		break;
	case '2' :
        $out .= '
  <script src="'.CHEMIN.'inc/unitegallery/themes/slider/ug-theme-slider.js"></script>
  <script>
    jQuery(document).ready(function(){
	  jQuery("#'.$pos.$nbox.$dir.'").unitegallery({
		gallery_theme: "slider",
        gallery_width: '.$ugw.',
        gallery_height: '.($ugh + 32 + ($nblg * 15)).',
        slider_transition: "fade",
        slider_transition_speed: 1500,
        slider_enable_zoom_panel: false,
        slider_enable_arrows: false,
        slider_enable_progress_indicator: false,
        slider_item_padding_bottom: '.(32 + ($nblg * 15)).',
      });
    });
  </script>';
		break;
	}
	$out .= '
  <div id="'.$class.$dir.'" style="display:none;margin:auto;">';
	foreach ($imgs as $img) {
		$out .= '
    <img alt="" src="'.CHEMIN.'photo/'.$dir.'/'.$img[2].'" style="display:none;" />';
	}
	$out .= '
  </div>
</div>';
    $out .= displayQuickConfig($pos, false, '', '', '', 18);
	$title = getLabel($nom[$lng == $lang[0] ? 30 : 31]);
	$title = mb_substr(trim($title), 0, 1, $charset) == '§' ? '' : DisplayDownArrow($dynabox[17], 'photobox SWPH'.$class).$title;
	return '
<div class="'.$class.'SWPH">
  '.boxthin($pos, $title, $out, ' photobox SWPH'.$class, $dynabox[17]).'
</div>';
}

################################################################################

function isAdmin($pseudo) {
    global $serviz;
    if (empty($pseudo) && trim($serviz[31]) == '' && trim($serviz[176]) == '' && is_file(CHEMIN.'install/install.php')) return TRUE;
    if ($pseudo == $serviz[31] || $pseudo == $serviz[176]) return TRUE;
    if ($serviz[42] == 'on') {
		static $admins = null;
		if (!isset($admins)) {
			$admins = ReadDbFields(ADMINS);
		}
		foreach ($admins as $admin) {
			if ((!empty($pseudo) && !empty($admin[0])) && ($pseudo == $admin[0])) return TRUE;
		}
	}
    return FALSE;
}
?>
func_contact.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/func_contact.php'
View Content
<?php
/*******************************************************************************
 *   Functions Advanced contact
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

if (stristr($_SERVER["SCRIPT_NAME"], "func_contact.php")) {
  header("location:../index.php");
  die();
}

function ItemName($description, $name0, $value0, $name1, $value1) {
    global $flag1, $flag2, $lang, $charset;
	echo '
<div style="text-align:center;width:520px;padding-bottom:8px;">
  <div style="width:140px;float:left;position:relative;top:12px;padding-left:12px;text-align:left;">&bull; '.$description.'</div>
  <div style="width:240px;float:left;position:relative;top:7px;left:260px;text-align:right;">
	<div>';
    if (!empty($lang[1])) {
		echo '
    <div class="d-inline-block"><i class="flg-'.$lang[0].' align-middle" title="'.$lang[0].'"></i></div>';
	}
    echo '
    <div class="d-inline-block">
      <input class="form-control texte" name="'.$name0.'" type="text" size="24" value="'.htmlentities($value0, ENT_QUOTES, $charset).'" />
    </div>
    </div>';
	if (!empty($lang[1])) {
		echo '
    <div>
	  <div class="d-inline-block"><i class="flg-'.$lang[1].' align-middle" title="'.$lang[1].'"></i></div>
      <div class="d-inline-block">
        <input class="form-control texte" name="'.$name1.'" type="text" size="24" value="'.htmlentities($value1, ENT_QUOTES, $charset).'" />
      </div>
    </div>';
	}
    echo '
  </div>';
	echo '
  <div class="clearfix"></div>';
	echo '
</div>';
}

function ItemCheck($area, $chk0) {
    global $admin;
	echo '
<div class="form-check" style="z-index:100;float:right;position:relative;top:14px;right:320px;width:216px;text-align:left;">';
    if ($area == 'chmail1' || $area == 'chmail2' || $area == 'chmes1') {
		echo '
  <input class="form-check-input" type="radio" name="'.$area.'" value="fix" checked="checked" />&nbsp;<span class="pl-3">'.$admin[1188].' (*)</span>';
    } else {
        echo '
  <input class="form-check-input" type="radio" name="'.$area.'" value=""'; 
        if ($chk0 == '') {
            echo ' checked="checked"';
        } 
        echo ' /><span class="px-3"> '.$admin[1604].'</span>';
        echo '
  <input class="form-check-input" type="radio" name="'.$area.'" value="on"'; 
        if ($chk0 == 'on') {
            echo ' checked="checked"';
        } 
        echo ' /><span class="px-3"> '.$admin[1605].'</span>';
        if ($area != 'chfic0'){
            echo '
  <input class="form-check-input" type="radio" name="'.$area.'" value="fix"'; 
            if ($chk0 == 'fix') {
                echo ' checked="checked"';
            } 
            echo ' />&nbsp;<span class="pl-3">'.$admin[1188].'</span>';
        }
    }
    echo '
</div>';
}
?>
func_forum.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/func_forum.php'
View Content
<?php
/*******************************************************************************
 *   Forum functions
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.11 (March 09, 2023) : correction $dbcat, addittion test
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'func_forum.php')) {
  header('location:../index.php');
  die();
}

function isForumPage() {
    global $site;
    $sname = substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '/') + 1, -4);
    return 1 == preg_match('!'.$site['FR'].'|'.$site['FRT'].'|'.$site['TH'].'|forum|forumarch|thread|treadarch|fortopic|fortopicarch|formyposts!', $sname);
}

################################################################################

function fbox_forum($pos = NULL, $args = NULL) {
    global $lng, $lang, $forum, $members, $nom, $page, $site, $serviz, $userprefs, $web, $urlrw, $tconfig, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    $dbcat = array();
	if ($serviz[13] == 'on')
	   $dbcat = ReadDBFields(DBFORUMCAT);
    $okfr  = false;
    if (!empty($dbcat)) 
	{
		foreach ($dbcat as $cat) 
		{
			if (!isset($cat[5])) $cat[5] = '';
			if ($cat[5] == 'on') 
			{ 
				$okfr = true; break;
			}
		}
	}
    if (!isAccessGranted($members[5])) return FALSE;
    if ($serviz[13] == 'on' && $okfr && $site[20] > 0) {
		$dbworkcat = array();
        $l      = $lng == $lang[0] ? 0 : 1;
        $dbwork = ReadDBFields(DBFORUMCAT);
        foreach ($dbcat as $dbc)
            if ($dbc[5] != '') $dbworkcat[] = $dbc;
        $dbwork  = array();
        $dbwork1 = ReadDBFields(DBTHREAD);
        foreach ($dbwork1 as $db) {
            if ($db[8] != '') $dbcat = SelectDBFieldsByField($dbworkcat, 0, $db[8]);
            if (isForumAccessGranted($db[8]) && !empty($dbcat)) $dbwork[] = $db;
        }
        unset($dbwork1);
        @sort($dbwork);
        $dbfor  = ReadDBFields(DBFORUM);
        $dbmess = array();
        $j = 0;
        if (!empty($dbwork)) {
            $newdate = date('YmdHi',time()-(86400*$forum[8]));
            $messtop = '<i class="frm-msg_t" title="'.$web[370].'"></i>';
            $messnew = '<i class="frm-msg_n" title="'.$web[371].'"></i>';
            for ($i = count($dbwork)-1; $i >= max(0,count($dbwork)-$site[20]); $i--) {
                ReadDoc($dbwork[$i][3]);
                $img = getNewUpdateDoc($creadate, $moddate, $serviz[139]);
                $dbmess[$j] = array_pad(array(), 10, '');
                if ($fielda2 == '0') {
                    $dbmess[$j][0] = $fileid;
                    $sujet = strip_tags($fieldb1);
                } else {
                    for ($k = 0; $k < count($dbfor); $k++) {
                        if ($fielda1 == $dbfor[$k][1]) {
                            $fieldb2       = $dbfor[$k][12];
                            $dbmess[$j][0] = $dbfor[$k][2];
                            $sujet         = strip_tags($dbfor[$k][5]);
                            $nbrep         = $dbfor[$k][7];
                            $dbmess[$j][7] = $dbwork[$i][2];
                            $dbmess[$j][8] = $dbfor[$k][3];
                        }
                    }
                }
                $dbmess[$j][1] = $fieldb2;
                for ($k = 0; $k < count($dbworkcat); $k++) {
                    if ($dbworkcat[$k][0] == $fieldb2) {
                        $dbmess[$j][2] = $dbworkcat[$k][$l+1];
                    }
                }
                $dbmess[$j][3] = strip_tags(str_replace('<br />', ' &#172; ',$fieldc1));
                $dbmess[$j][4] = FormatDate($creadate).'<br />';
                if ($newdate < $creadate || $newdate < $moddate) {
                    $dbmess[$j][4] = FormatDate($creadate).'<br />'.$messnew.' ';
                }
                if ($moddate != $creadate) {
                    if ($moddate > date('YmdHi')) {
                        $dbmess[$j][4] = FormatDate(date('YmdHi')).'<br />'.$messtop.' ';
                    } elseif ($fieldmod != '') {
                        $datemod       = explode('#',$fieldmod);
                        $dbmess[$j][4] = FormatDate($datemod[2]).'<br />';
                    } else {
                        $dbmess[$j][4] = FormatDate($moddate).'<br />';
                    }
                }
                $dbmess[$j][5] = $img.$sujet;
                $dbmess[$j][6] = (ceil((int)$dbmess[$j][7] / $serviz[20]));
                $dbmess[$j][9] = $author;
                $j++;
            }
        }
        $topmess = getLabel($nom[$l+22]).' '.$web[179];
        if ($page[9] != '') {
            $topmess = '<i class="fab fa-forumbee float-right"></i>'.$topmess;
        }
        if (!isAccessGranted($members[5])) {
            $out = '
<div class="text-center web342">'.$web[342];
            if ($members[19] != '0' && $members[19] != '3') {
                $href1 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[3].'-0-'.$tconfig.$z2 
                  : 'connect.php?lng='.$lng.'&tconfig='.$tconfig.$z2);
                $href2 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[15].'-5-new-'.$tconfig.$z2 
                  : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$tconfig.$z2);
                echo '
  <p class="text-center">
    '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
      (empty($userprefs[1]) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
  </p>';
    }
			$out .= '
</div>';
        } else {
            $out = '';
            if (!empty($dbmess)) {
                $out .= '
<style>
.frcellheight {
  height: '.(empty($site[34]) ? 'auto' : $site[34].'px').';
  min-height: 40px;
  overflow: hidden;
}
</style>
<div class="text-center m-auto">
  <div class="table-responsive-md">
  <table class="table table-borderless text-center">';
                for ($i = 0; $i < count($dbmess); $i++) {
					$dbmess[$i][7] = empty($dbmess[$i][7]) ? 0 : $dbmess[$i][7];
                    $bgcol = $i %2 == 0 ? 'rep' : 'quest';
                    $tmpmess = '
    <tr class="'.$bgcol.' align-top text-left p-0">';
                    $urw = empty($dbmess[$i][1]) ? '-31' : '-2-'.getForumcatId($dbmess[$i][1]);
                    $tmpmess .= '
      <td class="w-22 px-0 py-2">
        <div class="px-1">
        <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[5].$urw.$z2 
            : $site['FR'].'.php?lng='.$lng.'&amp;cat='.getForumcatId($dbmess[$i][1]).$z2).'" title ="'.$web[297].'">
          <b>'.$dbmess[$i][2].'</b>
        </a>
        </div>
      </td>';
					$urw0 = empty($dbmess[$i][1]) ? '-41-'.$dbmess[$i][0] : '-4-'.$dbmess[$i][0].'-'.getForumcatId($dbmess[$i][1]);
					$urw1 = empty($dbmess[$i][1]) ? '-411-'.$dbmess[$i][0] : '-5-'.$dbmess[$i][0].'-'.getForumcatId($dbmess[$i][1]);
                    $tmpmess .= '
      <td class="w-55 px-0 py-2">
        <div class="text-left px-1">
          <b>'.$web[384].' 
          <a href="'.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[5].$urw0.$z2 
              : $site['TH'].'.php?lng='.$lng.'&amp;pg='.$dbmess[$i][0].'&amp;cat='.getForumcatId($dbmess[$i][1]).$z2).'" 
                title ="'.$web[6].' '.$dbmess[$i][8].' ... '.$web[297].' ">
            '.$dbmess[$i][5].'
          </a></b>
        </div>
        <div class="text-left">
          <div class="frcellheight px-1">
            <a href="'.($site['URLR'] == 'on' 
                ? $lng.'-'.$urlrw[5].$urw1.'-'.$dbmess[$i][6].'#R'.$dbmess[$i][7] 
                : $site['TH'].'.php?lng='.$lng.'&amp;pg='.$dbmess[$i][0].'&amp;cat='.getForumcatId($dbmess[$i][1]).
                  '&amp;id='.$dbmess[$i][6].'#R'.$dbmess[$i][7]).'" title ="'.$web[6].' '.$dbmess[$i][9].' ... '.$web[297].' ">
              &nbsp;'.$dbmess[$i][3].' ...
            </a>
          </div>
        </div>  
      </td>
      <td class="w-23 text-center px-0 py-2"> '.$dbmess[$i][4].' ('.$web[6].' '.$dbmess[$i][9].')</td>
    </tr>';
                    $out .= $tmpmess;
                }
                $out .= '
  </table>
  </div>
</div>';
            }
        }
        return boxwide($pos, $topmess, $out, ' FRA'.$pos.$tconfig);
    } else {
        return FALSE;
    }
}

?>
func_groups.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/func_groups.php'
View Content
<?php
/*******************************************************************************
 *   Functions for groups
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'func_groups.php')) {
    header('location:../index.php');
    die();
}

/*******************************************************************************
 * Lecture du fichier GROUPS pour fournir un tableau associatif
 * dont l'index est le nom d'un groupe et
 * dont le contenu est la liste des membres de ce groupe
 *
 * @return array
 ******************************************************************************/
function ReadGroups() {
    if (!File_Exists(GROUPS)) return array();
    $dbf = ReadDbFields(GROUPS);
    $grps = array();
    foreach($dbf as $f) {
        $grp = $f[0];
        unset($f[0]);
        $grps[$grp] = array_values($f);
    }
    return $grps;
}

/*******************************************************************************
 * Ecriture du fichier GROUPS
 * A partir du tableau associatif fourni par ReadGroups()
 *
 * @param array $grps (une liste de groupes)
 * @return void
 ******************************************************************************/
function WriteGroups($grps) {
    ksort($grps);
    $dbf = array();
    foreach ($grps as $grp=>$mbrs) {
        sort($mbrs);
        $dbf[] = array_merge(array($grp), $mbrs);
    }
    WriteDbFields(GROUPS, $dbf);
}

/*******************************************************************************
 * Lecture du fichier MEMBERS
 * pour fournir un tableau associatif
 * dont l'index est le nom d'un membre et
 * dont le contenu est la liste des groupes contenant ce membre
 *
 * @return array
 ******************************************************************************/
function ReadMembers() {
    if (!File_Exists(MEMBERS)) return array();
    $dbf = ReadDbFields(MEMBERS);
    $mbrs = array();
    foreach($dbf as $f) {
        $mbr = $f[0];
        unset($f[0]);
        $mbrs[$mbr] = array_values($f);
    }
    return $mbrs;
}

/*******************************************************************************
 * Ecriture du fichier MEMBERS
 * A partir d'un tableau associatif fourni par ReadMembers()
 *
 * @param array $mbrs (une liste de membres)
 * @return void
 ******************************************************************************/
function WriteMembers($mbrs) {
    ksort($mbrs);
    $dbf = array();
    foreach ($mbrs as $mbr=>$grps) {
        sort($grps);
        $dbf[] = array_merge(array($mbr), $grps);
    }
    WriteDbFields(MEMBERS, $dbf);
}

/*******************************************************************************
 * Ajout d'un groupe dans le fichier GROUPS
 *
 * @param string $grp (un nom de groupe)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function AddGroup($grp) {
    if ('all_members' == $grp) return FALSE;
	$grps = ReadGroups();
    if (array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe existe déjà  !
    } else {
        $grps[$grp] = array();
        WriteGroups($grps);
        return TRUE;
    }
}

/*******************************************************************************
 * Suppression d'un groupe de membres dans le fichier GROUPS
 * avec mise à jour du fichier MEMBERS
 *
 * @param string $grp (un nom de groupe)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function DelGroup($grp) {
    $grps = ReadGroups();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        unset($grps[$grp]);
        WriteGroups($grps);
        $mbrs1 = ReadMembers();
        $mbrs2 = array();
        foreach ($mbrs1 as $mbr=>$grps) {
            $find = array_search($grp, $grps);
            if (FALSE !== $find) {
                unset($grps[$find]);
                $grps = array_values($grps);
            }
            $mbrs2[$mbr] = $grps;
        }
        WriteMembers($mbrs2);
        return TRUE;
    }
}

/*******************************************************************************
 * Recheche d'un membre d'un groupe
 *
 * @param string $grp (un nom de groupe)
 * @param string $mbr (un nom de membre)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function CheckGroup($grp, $mbr) {
	global $userprefs;
	if ($grp == 'all_members' && !empty($userprefs[1])) return TRUE;
    $grps = ReadGroups();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        $find = array_search($mbr, $grps[$grp]);
        return FALSE !== $find;
    }
}

/*******************************************************************************
 * Ajout d'un membre dans un groupe
 * avec mise à jour des fichiers MEMBERS et GROUPS
 *
 * @param string $grp (un nom de groupe)
 * @param string $mbr (un nom de membre)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function AddMember($grp, $mbr) {
    $grps = ReadGroups();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        $mbrs = $grps[$grp];
        if (in_array($mbr, $mbrs)) {
            return FALSE; // Le membre existe déjà  !
        } else {
            $grps[$grp][] = $mbr;
            WriteGroups($grps);
            $mbrs = ReadMembers();
            $change = FALSE;
            if (!array_key_exists($mbr, $mbrs)) {
                // Le membre n'existe pas encore
                $mbrs[$mbr] = array($grp);
                $change = TRUE;
            } else {
                if (!in_array($grp, $mbrs[$mbr])) {
                    // Le groupe n'est pas encore dans la liste
                    $mbrs[$mbr][] = $grp;
                    $change = TRUE;
                }
            }
            if ($change) WriteMembers($mbrs);
            return TRUE;
        }
    }
}

/*******************************************************************************
 * Retrait d'un membre d'un groupe
 * avec mise à jour des fichiers MEMBERS et GROUPS
 *
 * @param string $grp (un nom de groupe)
 * @param string $mbr (un nom de membre)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function DelMember($grp, $mbr) {
    $grps = ReadGroups();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        if (!in_array($mbr, $grps[$grp])) {
            return FALSE; // Le membre n'existe pas !
        } else {
            $find = array_search($mbr, $grps[$grp]);
            if (FALSE !== $find) {
                unset($grps[$grp][$find]);
                $grps[$grp] = array_values($grps[$grp]);
                WriteGroups($grps);
            }
            $mbrs = ReadMembers();
            $find = array_search($grp, $mbrs[$mbr]);
            if (FALSE !== $find) {
                unset($mbrs[$mbr][$find]);
                $mbrs[$mbr] = array_values($mbrs[$mbr]);
                WriteMembers($mbrs);
            }
            return TRUE;
        }
    }
}

/*******************************************************************************
 * Suppression d'un membre 
 * avec mise à jour des fichiers MEMBERS et GROUPS
 *
 * @param string $mbr (un nom de membre)
 * @return void
 ******************************************************************************/
function DestroyMember($mbr) {
    $mbrs = ReadMembers();
    unset($mbrs[$mbr]);
    WriteMembers($mbrs);
    unset($mbrs);
    
    $grps1 = ReadGroups();
    $grps2 = array();
    foreach ($grps1 as $grp=>$mbrs) {
        $find = array_search($mbr, $mbrs);
        if (FALSE !== $find) {
            unset($mbrs[$find]);
            $mbrs = array_values($mbrs);
        }
        $grps2[$grp] = $mbrs;
    }
    WriteGroups($grps2);
}

/*******************************************************************************
 * Contrôle l'existance des membres présents dans les fichiers GROUPS et MEMBERS
 *
 * @return void
 ******************************************************************************/
function CheckMembers() {
    $mbrs = ReadMembers();
    foreach ($mbrs as $mbr=>$grps) {
        if (!file_exists(USEREP.$mbr.DBEXT)) {
            DestroyMember($mbr);
        }
    }
}

/*******************************************************************************
 * Contrôle du droit d'accès à un document
 *
 * @param string $group (un nom de groupe)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function isAccessGranted($group, $user='') {
    global $userprefs, $serviz;
    if (empty($user)) $user = $userprefs[1];
    if ($user == $serviz[31] || $user == $serviz[176]) return TRUE;
	if ($group == 'all_members' && !empty($user)) return TRUE;
    if (empty($group)) return TRUE;
    if (empty($user)) return FALSE;
    return CheckGroup($group, $user);
}

/*******************************************************************************
 * Contrôle du droit d'accès à un document du forum
 *
 * @param string $catforum (une catégorie de forum "id,groupe")
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function isForumAccessGranted($catforum) {
    global $userprefs, $serviz;
    if ($userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176]) return TRUE;
    $catforum = getForumCatFull($catforum);
    if (FALSE !== strpos($catforum, ',')) {
        $temp  = explode(',', $catforum);
        $group = empty($temp[1]) ? '' : trim($temp[1]);
    } else {
        return TRUE;
    }
	if ($group == 'all_members' && !empty($userprefs[1])) return TRUE;
    if (empty($group)) return TRUE;
    if (empty($userprefs[1])) return FALSE;
    return CheckGroup($group, $userprefs[1]);
}

/*******************************************************************************
 * Contrôle si une catégorie de discussion du forum existe bien
 *
 * param string $cat (identifiant de la catégorie)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function IsValidForumCat($cat) {	
	$cats = ReadForumCats();
	if (!empty($cat) && in_array($cat, $cats)) {
			return TRUE;
	}
	return FALSE;
}


/*******************************************************************************
 * Vérifie si une catégorie de discussion du forum est privée ou non
 *
 * param string $cat (identifiant de la catégorie)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function IsPrivateForumCat($cat) {
	$cats = ReadForumCats();
    if (!empty($cat)) {
        foreach ($cats as $categ) {
            $categs = explode(',', $categ);
            if ($cat == $categs[0] && isset($categs[1])) {
                return TRUE;
            }
        }
    }
	return FALSE;
}

/*******************************************************************************
 * Lecture du fichier FORUM_CATS
 * pour fournir un tableau associatif
 * dont l'index est le nom d'un membre et
 * dont le contenu est la liste des groupes contenant ce membre
 *
 * return array
 ******************************************************************************/ 
function ReadForumCats() {
    if (!File_Exists(DBFORUMCAT)) return array();
	
    $dbwork = ReadDbFields(DBFORUMCAT);
	
	$cats = array();
	for ($i = 0; $i < count($dbwork); $i++) {
		$cats[] = $dbwork[$i][0]; //id de la catégorie
	}

    return $cats;
}
?>
func_groupscol.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/func_groupscol.php'
View Content
<?php
/*******************************************************************************
 *   Functions for collaborators GROUPSCOL
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'func_groupscol.php')) {
    header('location:../index.php');
    die();
}

/*******************************************************************************
 * Lecture du fichier GROUPSCOL pour fournir un tableau associatif
 * dont l'index est le nom d'un groupe et
 * dont le contenu est la liste des membres de ce groupe
 *
 * @return array
 ******************************************************************************/
function ReadGroupsCol() {
    if (!File_Exists(GROUPSCOL)) return array();
    $dbf = ReadDbFields(GROUPSCOL);
    $grps = array();
    foreach($dbf as $f) {
        $grp = $f[0];
        unset($f[0]);
        $grps[$grp] = array_values($f);
    }
    return $grps;
}

/*******************************************************************************
 * Ecriture du fichier GROUPSCOL
 * A partir du tableau associatif fourni par ReadGroupsCol()
 *
 * @param array $grps (une liste de groupes)
 * @return void
 ******************************************************************************/
function WriteGroupsCol($grps) {
    ksort($grps);
    $dbf = array();
    foreach ($grps as $grp=>$mbrs) {
        sort($mbrs);
        $dbf[] = array_merge(array($grp), $mbrs);
    }
    WriteDbFields(GROUPSCOL, $dbf);
}

/*******************************************************************************
 * Lecture du fichier MEMBERSCOL
 * pour fournir un tableau associatif
 * dont l'index est le nom d'un membre et
 * dont le contenu est la liste des groupes contenant ce membre
 *
 * @return array
 ******************************************************************************/
function ReadMembersCol() {
    if (!File_Exists(MEMBERSCOL)) return array();
    $dbf  = ReadDbFields(MEMBERSCOL);
    $mbrs = array();
    foreach($dbf as $f) {
        $mbr = $f[0];
        unset($f[0]);
        $mbrs[$mbr] = array_values($f);
    }
    return $mbrs;
}

/*******************************************************************************
 * Ecriture du fichier MEMBERSCOL
 * A partir d'un tableau associatif fourni par ReadMembersCol()
 *
 * @param array $mbrs (une liste de membres)
 * @return void
 ******************************************************************************/
function WriteMembersCol($mbrs) {
    ksort($mbrs);
    $dbf = array();
    foreach ($mbrs as $mbr=>$grps) {
        sort($grps);
        $dbf[] = array_merge(array($mbr), $grps);
    }
    WriteDbFields(MEMBERSCOL, $dbf);
}

/*******************************************************************************
 * Ajout d'un groupe dans le fichier GROUPSCOL
 *
 * @param string $grp (un nom de groupe)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function AddGroupCol($grp) {
    if ('ALL' == $grp) return FALSE;
	$grps = ReadGroupsCol();
    if (array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe existe déjà  !
    } else {
        $grps[$grp] = array();
        WriteGroupsCol($grps);
        return TRUE;
    }
}

/*******************************************************************************
 * Suppression d'un groupe de membres dans le fichier GROUPSCOL
 * avec mise à jour du fichier MEMBERSCOL
 *
 * @param string $grp (un nom de groupe)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function DelGroupCol($grp) {
    $grps = ReadGroupsCol();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        unset($grps[$grp]);
        WriteGroupsCol($grps);
        $mbrs1 = ReadMembersCol();
        $mbrs2 = array();
        foreach ($mbrs1 as $mbr=>$grps) {
            $find = array_search($grp, $grps);
            if (FALSE !== $find) {
                unset($grps[$find]);
                $grps = array_values($grps);
            }
            $mbrs2[$mbr] = $grps;
        }
        WriteMembersCol($mbrs2);
        return TRUE;
    }
}

/*******************************************************************************
 * Recheche d'un membre d'un groupe
 *
 * @param string $grp (un nom de groupe)
 * @param string $mbr (un nom de membre)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function CheckGroupCol($grp, $mbr) {
	global $userprefs;
	if ($grp == 'ALL' && !empty($userprefs[1])) return TRUE;
    $grps = ReadGroupsCol();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        $find = array_search($mbr, $grps[$grp]);
        return FALSE !== $find;
    }
}

/*******************************************************************************
 * Ajout d'un membre dans un groupe
 * avec mise à jour des fichiers MEMBERSCOL et GROUPSCOL
 *
 * @param string $grp (un nom de groupe)
 * @param string $mbr (un nom de membre)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function AddMemberCol($grp, $mbr) {
    $grps = ReadGroupsCol();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        $mbrs = $grps[$grp];
        if (in_array($mbr, $mbrs)) {
            return FALSE; // Le membre existe déjà  !
        } else {
            $grps[$grp][] = $mbr;
            WriteGroupsCol($grps);
            $mbrs = ReadMembersCol();
            $change = FALSE;
            if (!array_key_exists($mbr, $mbrs)) {
                // Le membre n'existe pas encore
                $mbrs[$mbr] = array($grp);
                $change = TRUE;
            } else {
                if (!in_array($grp, $mbrs[$mbr])) {
                    // Le groupe n'est pas encore dans la liste
                    $mbrs[$mbr][] = $grp;
                    $change = TRUE;
                }
            }
            if ($change) WriteMembersCol($mbrs);
            return TRUE;
        }
    }
}

/*******************************************************************************
 * Retrait d'un membre d'un groupe
 * avec mise à jour des fichiers MEMBERSCOL et GROUPSCOL
 *
 * @param string $grp (un nom de groupe)
 * @param string $mbr (un nom de membre)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function DelMemberCol($grp, $mbr) {
    $grps = ReadGroupsCol();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        if (!in_array($mbr, $grps[$grp])) {
            return FALSE; // Le membre n'existe pas !
        } else {
            $find = array_search($mbr, $grps[$grp]);
            if (FALSE !== $find) {
                unset($grps[$grp][$find]);
                $grps[$grp] = array_values($grps[$grp]);
                WriteGroupsCol($grps);
            }
            $mbrs = ReadMembersCol();
            $find = array_search($grp, $mbrs[$mbr]);
            if (FALSE !== $find) {
                unset($mbrs[$mbr][$find]);
                $mbrs[$mbr] = array_values($mbrs[$mbr]);
                WriteMembersCol($mbrs);
            }
            return TRUE;
        }
    }
}

/*******************************************************************************
 * Suppression d'un membre 
 * avec mise à jour des fichiers MEMBERSCOL et GROUPSCOL
 *
 * @param string $mbr (un nom de membre)
 * @return void
 ******************************************************************************/
function DestroyMemberCol($mbr) {
    $mbrs = ReadMembersCol();
    unset($mbrs[$mbr]);
    WriteMembersCol($mbrs);
    unset($mbrs);
    
    $grps1 = ReadGroupsCol();
    $grps2 = array();
    foreach ($grps1 as $grp=>$mbrs) {
        $find = array_search($mbr, $mbrs);
        if (FALSE !== $find) {
            unset($mbrs[$find]);
            $mbrs = array_values($mbrs);
        }
        $grps2[$grp] = $mbrs;
    }
    WriteGroupsCol($grps2);
}

/*******************************************************************************
 * Contrôle l'existance des membres présents dans les fichiers GROUPSCOL et MEMBERSCOL
 *
 * @return void
 ******************************************************************************/
function CheckMembersCol() {
    $mbrs = ReadMembersCol();
    foreach ($mbrs as $mbr=>$grps) {
        if (!file_exists(REDACREP.$mbr.INCEXT)) {
            DestroyMemberCol($mbr);
        }
    }
}

/*******************************************************************************
 * Contrôle du droit d'accès à un document
 *
 * @param string $group (un nom de groupe)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function isAccessGrantedCol($group) {
    global $userprefs;
	if ($group == 'ALL' && !empty($userprefs[1])) return TRUE;
    if (empty($userprefs[1])) return FALSE;
    return CheckGroupCol($group, $userprefs[1]);
}
?>
func_groupsnwl.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/func_groupsnwl.php'
View Content
<?php
/*******************************************************************************
 *   Functions for groups newsletters
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'func_groupsnwl.php')) {
  header('location:../index.php');
  die();
}

/*******************************************************************************
 * Lecture du fichier GROUPSNWL pour fournir un tableau associatif
 * dont l'index est le nom d'un groupe et
 * dont le contenu est la liste des abonnés de ce groupe
 *
 * @return array
 ******************************************************************************/
function ReadGroupsNewsletter() {
    if (!File_Exists(GROUPSNWL)) return array();
    $dbf  = ReadDbFields(GROUPSNWL);
    $grps = array();
    foreach($dbf as $f) {
        $grp = $f[0];
        unset($f[0]);
        $grps[$grp] = array_values($f);
    }
    return $grps;
}
/*******************************************************************************
 * Lecture du fichier GROUPSNWL pour fournir un tableau associatif
 * dont la liste des groupe 
 * dont la liste des membres 
 *
 * @return array
 ******************************************************************************/
function ReadAbonnesGroupsNewsletter() {
    if (!File_Exists(GROUPSNWL)) return array();
    $dbf  = ReadDbFields(GROUPSNWL);
    $grps = array();
	$k    = 0;
    foreach($dbf as $f) {
        $grp = $f[0];
        unset($f[0]);
		$grps["group"][$k]  = $grp;
        $grps["abonne"][$k] = array_values($f);
		$k++;
    }
    return $grps;
}

/*******************************************************************************
 * Ecriture du fichier GROUPSNWL
 * A partir du tableau associatif fourni par ReadGroupsNewsletter()
 *
 * @param array $grps (une liste de groupes)
 * @return void
 ******************************************************************************/
function WriteGroupsNewsletter($grps) {
    ksort($grps);
    $dbf = array();
    foreach ($grps as $grp=>$abonnes) {
        sort($abonnes);
        $dbf[] = array_merge(array($grp), $abonnes);
    }
    WriteDbFields(GROUPSNWL, $dbf);
}

/*******************************************************************************
 * Lecture du fichier MEMBERSNWL
 * pour fournir un tableau associatif
 * dont l'index est le nom d'un abonne et
 * dont le contenu est la liste des groupes contenant cet abonné
 *
 * @return array
 ******************************************************************************/
function ReadAbonnes() {
    if (!File_Exists(MEMBERSNWL)) return array();
    $dbf = ReadDbFields(MEMBERSNWL);
    $abonnes = array();
    foreach($dbf as $f) {
        $abonne = $f[0];
        unset($f[0]);
        $abonnes[$abonne] = array_values($f);
    }
    return $abonnes;
}

/*******************************************************************************
 * Ecriture du fichier MEMBERSNWL
 * A partir d'un tableau associatif fourni par ReadAbonnes()
 *
 * @param array $abonnes (une liste d'abonnés)
 * @return void
 ******************************************************************************/
function WriteAbonnes($abonnes) {
    ksort($abonnes);
    $dbf = array();
    foreach ($abonnes as $abonne=>$grps) {
        sort($grps);
        $dbf[] = array_merge(array($abonne), $grps);
    }
	$mrnombreabonnes = count($dbf);
	$dbfabonnes = array();
	for ($ij = 0; $ij < count($dbf); $ij++) { 
		if (isset($dbf[$ij][1]) && $dbf[$ij][1] == '')
            unset ($dbf[$ij]);
		else
            $dbfabonnes[] = $dbf[$ij];
	}
    WriteDbFields(MEMBERSNWL, $dbfabonnes);
}

/*******************************************************************************
 * Ajout d'un groupe dans le fichier GROUPSNWL
 *
 * @param string $grp (un nom de groupe)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function AddGroupNewsletter($grp) {
	if ('all_subscribers' == $grp) return FALSE;
    $grps = ReadGroupsNewsletter();
    if (array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe existe déjà  !
    } else {
        $grps[$grp] = array();
        WriteGroupsNewsletter($grps);
        return TRUE;
    }
}

/*******************************************************************************
 * Suppression d'un groupe d'abonnes dans le fichier GROUPSNWL
 * avec mise à jour du fichier MEMBERSNWL
 *
 * @param string $grp (un nom de groupe)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function DelGroupNewsletter($grp) {
    $grps = ReadGroupsNewsletter();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        unset($grps[$grp]);
        WriteGroupsNewsletter($grps);
        $abonnes1 = ReadAbonnes();
        $abonnes2 = array();
        foreach ($abonnes1 as $abonne=>$grps) {
            $find = array_search($grp, $grps);
            if (FALSE !== $find) {
                unset($grps[$find]);
                $grps = array_values($grps);
            }
            $abonnes2[$abonne] = $grps;
        }
        WriteAbonnes($abonnes2);
        return TRUE;
    }
}

/*******************************************************************************
 * Recherche d'un abonné d'un groupe
 *
 * @param string $grp (un nom de groupe)
 * @param string $abonne (un nom d'abonné)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function CheckGroupNewsletter($grp, $abonne) {
    $grps = ReadGroupsNewsletter();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        $find = array_search($abonne, $grps[$grp]);
        return FALSE !== $find;
    }
}

/*******************************************************************************
 * Ajout d'un abonné dans un groupe
 * avec mise à jour des fichiers MEMBERSNWL et GROUPSNWL
 *
 * @param string $grp (un nom de groupe)
 * @param string $abonne (un nom d'abonné)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function AddAbonne($grp, $abonne) {
    $grps = ReadGroupsNewsletter();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        $abonnes = $grps[$grp];
        if (in_array($abonne, $abonnes)) {
            return FALSE; // L'abonné existe déjà !
        } else {
            $grps[$grp][] = $abonne;
            WriteGroupsNewsletter($grps);
            $abonnes = ReadAbonnes();
            $change  = FALSE;
            if (!array_key_exists($abonne, $abonnes)) {
                // L' abonné n'existe pas encore
                $abonnes[$abonne] = array($grp);
                $change = TRUE;
            } else {
                if (!in_array($grp, $abonnes[$abonne])) {
                    // Le groupe n'est pas encore dans la liste
                    $abonnes[$abonne][] = $grp;
                    $change = TRUE;
                }
            }
            if ($change) WriteAbonnes($abonnes);
            return TRUE;
        }
    }
}

/*******************************************************************************
 * Retrait d'un abonné d'un groupe
 * avec mise à jour des fichiers MEMBERSNWL et GROUPSNWL
 *
 * @param string $grp (un nom de groupe)
 * @param string $abonne (un nom d'abonné)
 * @return boolean (TRUE = réussite, FALSE = échec)
 ******************************************************************************/
function DelAbonne($grp, $abonne) {
    $grps = ReadGroupsNewsletter();
    if (!array_key_exists($grp, $grps)) {
        return FALSE; // Le groupe n'existe pas !
    } else {
        if (!in_array($abonne, $grps[$grp])) {
            return FALSE; // L' abonne n'existe pas !
        } else {
            $find = array_search($abonne, $grps[$grp]);
            if (FALSE !== $find) {
                unset($grps[$grp][$find]);
                $grps[$grp] = array_values($grps[$grp]);
                WriteGroupsNewsletter($grps);
            }
            $abonnes = ReadAbonnes();
            $find = array_search($grp, $abonnes[$abonne]);
            if (FALSE !== $find) {
                unset($abonnes[$abonne][$find]);
                $abonnes[$abonne] = array_values($abonnes[$abonne]);
                WriteAbonnes($abonnes);
            }
            return TRUE;
        }
    }
}

/*******************************************************************************
 * Suppression d'un abonne 
 * avec mise à jour des fichiers MEMBERSNWL et GROUPSNWL
 *
 * @param string $abonne (un nom d'abonné)
 * @return void
 ******************************************************************************/
function DestroyAbonne($abonne) {
    $abonnes = ReadAbonnes();
    unset($abonnes[$abonne]);
    WriteAbonnes($abonnes);
    unset($abonnes);
    
    $grps1 = ReadGroupsNewsletter();
    $grps2 = array();
    foreach ($grps1 as $grp=>$abonnes) {
        $find = array_search($abonne, $abonnes);
        if (FALSE !== $find) {
            unset($abonnes[$find]);
            $abonnes = array_values($abonnes);
        }
        $grps2[$grp] = $abonnes;
    }
    WriteGroupsNewsletter($grps2);
}
?>
func_news.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/func_news.php'
View Content
<?php
/*******************************************************************************
 *   Load Includes
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'func_news.php')) {
  header('location:../index.php');
  die();
}

################################################################################

function fbox_news($pos = NULL, $args = NULL) {
    global $id, $pg, $lng, $lang, $drtuser, $members, $nom, $page, $site, $serviz, $user, $userprefs, $web, 
	     $topmess, $prt, $urlrw, $tconfig, $charset, $z2;
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    if (!isAccessGranted($members[13]) || $serviz[8] != 'on') return FALSE;
    static $nbox = 0;
    $nbox++;
    $out = '';
    $id  = strip_tags($id);
    $max_height  = isset($site[29]) && $site[29] > 0 && empty($prt) ? $site[29] : 0;
    $max_height2 = isset($site[13]) && $site[13] > 0 && empty($prt) ? $site[13] : 0;
    $outrs = '';
    if ($prt == 0 && $serviz[106] == 'on') {
        include CONFIGREP.'sncode.inc';
        if (!empty($coders))
            $outrs .= '
<div class="codersNews">'.$coders.'</div>';
    }
    $out .= '
<div class="headNews text-center">';
    if ($serviz[16] == 'on' && empty($prt)) {
        $rssnewsurl = $site[3].sprintf(RSSNEWS, $lng);
        $out .= '
  <style>
    .headNews .overpop { padding-top: 20px; }
    .overpop a i { margin-top: -20px; }
  </style>
  <script>
    $(document).ready(function(){
      $(\'.rssNews\').popover({
        title:"RSS",
        content:"'.$web[221].' : <br /><b> '.$rssnewsurl.'</b>",
        trigger:"hover",
        placement:"auto",
        offset:"0 10 10 10",
        html:true
      });
    });
  </script>
  <div class="overpop pt-0 pl-2">
    <a href="'.CHEMIN.'newsrss.php?lng='.$lng.'&url=news&tconfig='.$tconfig.$z2.'" class="rssNews float-left">
      <i class="fas fa-rss"></i>
    </a>
  </div>';                            
    }
    $out .= '
  <div class="divnewline"></div>
</div>';
    if (!empty($pg)) {
        $db1 = SelectDbFieldsByField(ReadDbFields(DBNEWS), 4, $pg);
        $db2 = array_filter($db1, 'IsNotEmptyTitle');
        if (empty($db2) || 1 != count($db2)) {
            if ($site[10] != '')
                header('location:'.$site[3].'error.php?lng='.$lng.'&err=404');
            else
                header('HTTP/1.0 404 Not Found');
            exit;
        } else {
            if (isAccessGranted($db2[0][6]) && isAuthorizedPublication($db2[0][5]))
                $dbwnews = array(array(TYP_NEWS, $db2[0][5], $pg, 'a'));
            else
                $dbwnews = array();
        }
    } else {
        $db1 = ReadDbFields(DBNEWS);
        $db2 = array_filter($db1, 'IsNotEmptyTitle');
        $dbwnews = array();
        foreach ($db2 as $db) {
            if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                $dbwnews[] = array(TYP_NEWS, $db[5], $db[4], 'a');
            }
        }
        @rsort($dbwnews);
    }
    unset($db1, $db2);
    if ($pos == BOX_EDITO) { // edito
        $minnews = 0;
        $maxnews = Min($site[4], count($dbwnews));
        $id = 1;
    }
    if (!empty($dbwnews)) {
        for ($i = $minnews; $i < $maxnews; $i++) {
            ReadDoc($dbwnews[$i][2]);
            $img = getNewUpdateDoc($creadate, $moddate, $serviz[137]);
            if ($lng == $lang[0]) {
                $txt1 = $fieldb1;
                $txt2 = $fieldc1;
            }
            else {
                $txt1 = $fieldb2;
                $txt2 = $fieldc2;
            }
            $txt2 .= $outrs;
            // date création
            $txt72 = $serviz[72] == '' ? ' - '.$web[7].' <b>'.FormatDate($creadate).'</b> ' : '';
            // auteur
            $txt73 = $serviz[73] == '' 
              ? (empty($txt72) ? ' - ' : ' ').$web[6].' '.($fieldd1 == 'on' ? displayWriteEmail('boxnews'.$i, $author, $email) : '<b>'.$author.'</b>')
              : '';
            // icone
            if (!empty($fieldd2)) {
                $txt1 = '<img src="'.CHEMIN.'img/'.$fieldd2.'" class="'.($serviz[152] == 'on' ? 'float-left' : 'float-right').'" alt="'.$fieldd2.'" />'.$txt1;
            }
            $out .= '
  <div class="bord">
    <div class="quest '.($serviz[152] != 'on' ? 'text-left' : 'text-right').'">
	  <a href="'.$site[3].($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[8].'-22-'.$fileid.'-'.$tconfig.$z2 
          : $site['NE'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$tconfig.$z2).'" title="'.$web[511].'">
        '.$img.'<b>'.$txt1.'</b>
      </a>
      '.$txt72.$txt73.'
    </div>';
            if ($pos == BOX_EDITO) { // edito : nouvelle réduite
                $txt3 = '
<style>
.repNews {
  max-height: '.($max_height > 0 ? $max_height.'px;' : 'none;').'
  overflow: '.($max_height > 0 ? 'hidden;' : 'visible;').'
  background: transparent;
}
</style>';
                if (!empty($txt2)) {
                    $txt3 .= '
    <div id="texte3'.$i.'" class="w-100 rep editoNews">
      <div class="rep repNews">
        '.$txt2.'
      </div><div class="clearfix"></div>';
                        if ($max_height > 0) $txt3 .= '
      <p class="text-right c-pointer pr-5">
        <a href="javascript:ActiveMenu(\'texte3\',\'texte2\',0,'.$maxnews.','.$i.')" class="box" title="'.$web[296].'">
          '.$web[296].' <i class="far fa-plus-square"></i>
        </a>
      </p>';
                        $txt3 .= '
    </div>' ;
                        if ($max_height > 0) $txt3 .= '
    <div id="texte2'.$i.'" class="w-100 rep txt2News" style="display:none;">'.$txt2.'
      <p class="text-right c-pointer pr-5">
        <a href="#news'.$pos.$i.'" title="'.$web[57].'" onclick="cache(\'texte2'.$i.'\');montre(\'texte3'.$i.'\')">
          '.$web[57].' <i class="far fa-minus-square"></i>
        </a>
      </p>
    </div><div class="clearfix"></div>';
                }
                $out .= $txt3;
            } 
            $out .= displayQuickConfig($pos, $dbwnews[$i][2], 'news&amp;form=2&amp;id='.$dbwnews[$i][2], 'news&amp;act=i&amp;id='.$dbwnews[$i][2], 'news&amp;del='.$dbwnews[$i][2], 14);
            $out .= '
  </div>
  <br />';
        }
    } elseif (!empty($pg)) {
        $out .= '
  <p>'.$web[36].'</p>';
    }
    $pg = empty($pg) ? '0' : $pg;
    if (count($dbwnews) > 1 && $site[4] > 1) {
        $topmess = sprintf($web[2], min($site[4], count($dbwnews)));
    } else {
        $topmess = $web[145];
    }
    $class = ' NEW'.$pos.$tconfig;
    if ($page[9] != '') {
        $topmess = '<i class="far fa-newspaper float-right pr-2"></i>'.$topmess;
    }
    return $maxnews == 0 ? false : boxwide($pos, $topmess, $out, $class);
}

?>
funcarch.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/funcarch.php'
View Content
<?php
/*******************************************************************************
 *   Archives Specific Functions
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2022 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.15 (November 29, 2023) : correction archive forum
 ******************************************************************************/

if (stristr($_SERVER["SCRIPT_NAME"], "funcarch.php")) {
    header("location:../index.php");
    die();
}

function UpdateDocCounterArch($id) {
    $DataDB = ReadDocCounter($id, ARCHDBCOUNT);
    $vote = DejaVote(ARCHDBIPBASE.$id.DBEXT, 300);
    if ($vote[0] == false) {
        $DataDB++;
        WriteDocCounter($id, $DataDB, ARCHDBCOUNT);
    }
    return $DataDB;
}

function UpdateDBdtbArch($dtb, $idxarch) {
    global $type,$fileid,$status,$creadate,$moddate,$author,$email,
        $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldd1,$fieldd2,$fieldc1,$fieldc2,$fieldweb,$fieldmail,$fieldmod;
    @set_time_limit(0);
    $db  = SelectDBFields($dtb, 'a', '', DOCIDARCH);
    $dba = array();
    $j = 0;
    foreach($db as $dbs) {
        ReadDoc($dbs[1], ARCHDBBASE);
        $dba[$j]= array(
            RemoveConnector($fielda1),
            RemoveConnector($fielda2),
            RemoveConnector($fieldb1),
            RemoveConnector($fieldb2),
            $fileid,
            $creadate,
            $fieldmod,
			$type
            );
        $j++;
    }
    WriteDBFields($idxarch, $dba);
}
function UpdateDBreblogArch() {
    global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
        $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldd1,$fieldd2,$fieldc1,$fieldc2,$fieldweb,$fieldmail,$fieldmod;
    @set_time_limit(0);
    $dbs = SelectDBFields(TYP_REBLOG, 'a', '', DOCIDARCH);
    $dbr = array();
    $j = 0;
    foreach($dbs as $db) {
		ReadDoc($db[1], ARCHDBBASE);
//		$dbr = array_pad(array(), 7, '');
		$dbr[$j][0] = $fileid;
		$dbr[$j][1] = $fielda2;
		$dbr[$j][5] = $creadate;
		ReadDoc($fielda2, ARCHDBBASE);
		$dbr[$j][2] = $fieldb1;
		$dbr[$j][3] = $fieldb2;
		$dbr[$j][6] = $fieldmod;
        $j++;
    }
	WriteDBFields(DBREBLOGARCH, $dbr);
}

function UpdateDBforumArch() {
    global $site,$type,$fileid,$status,$creadate,$moddate,$author,$email,
        $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldc1,$fieldc2,$fieldd1,$fieldd2,$fieldweb,$fieldmail,$fieldmod;
    @set_time_limit(0);
    $db = ReadDBFields(DOCIDARCH);
    @sort($db);
    $dbf = array();
    $j   = 0;
    foreach ($db as $dbw) {
        if ($dbw[2] == "a") {
            ReadDoc($dbw[1], ARCHDBBASE);
            $dbf[$j][0] = $creadate;
            $dbf[$j][1] = $fielda1;
            $dbf[$j][2] = $fielda2;
            $dbf[$j][3] = $fileid;
            $dbf[$j][4] = RemoveConnector($author);
            $dbf[$j][5] = RemoveConnector($email);
            $dbf[$j][6] = RemoveConnector($fieldb1);
            $dbf[$j][7] = $fieldd1;
            $dbf[$j][8] = $fieldb2;
            $j++;
        }
    }
    @sort($dbf, SORT_REGULAR);
    WriteDBFields(DBTHREADARCH, $dbf);
    $db  = ReadDBFields(DBTHREADARCH);
    $dbf = array();
    $j = 0;
    for ($i = 0; $i < count($db); $i++) {
        if ($db[$i][2] == "0") {
            $dbf[$j][0] = $db[$i][0];
            $dbf[$j][1] = $db[$i][1];
            $dbf[$j][2] = $db[$i][3];
            $dbf[$j][3] = $db[$i][4];
            $dbf[$j][4] = $db[$i][5];
            $dbf[$j][5] = $db[$i][6];
            $dbf[$j][6] = $db[$i][0];
            $dbf[$j][7] = 0;
            $dbf[$j][8] = "";
            $dbf[$j][9] = "";
            $dbf[$j][10] = $db[$i][7];
            $dbf[$j][11] = "";
            $dbf[$j][12] = $db[$i][8];
            for ($k = $i + 1; $k < count($db); $k++) {
                if ($db[$k][1] == $dbf[$j][1]) {
                    $dbf[$j][0] = $db[$k][0];
                    $dbf[$j][7] = $dbf[$j][7]+1;
                    $dbf[$j][8] = $db[$k][4];
                    $dbf[$j][9] = $db[$k][5];
                    $dbf[$j][11] = $db[$k][7];
                }
            }
            $j++;
        }
    }
    @rsort($dbf, SORT_REGULAR);
    WriteDBFields(DBFORUMARCH, $dbf);
}

?>
funcrss.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/funcrss.php'
View Content
<?php
/*******************************************************************************
 *   RSS News Publication Functions
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'funcrss.inc')) {
    header('location:../index.php');
    die();
}

function PubDate($creadate) {
    return date('r',
        mktime(
            intval(substr($creadate, 8, 2)),
            intval(substr($creadate, 10, 2)),
            0,
            intval(substr($creadate, 4, 2)),
            intval(substr($creadate, 6, 2)),
            intval(substr($creadate, 0, 4))
        ));
}

function UpdateRSSall() {
    global $site, $lang, $lng, $serviz,
        $type, $fileid, $status, $creadate, $moddate, $author, $email,
        $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldmod;
	list($rsshead1, $rsshead2, $rssfoot) = MakeRSSheadfoot();
    if ($serviz[103] == 'on' && ($serviz[16] == 'on' || $serviz[54] == 'on' || $serviz[60] == 'on')) {
		$rssall1 = $rssall2 = '';
		
		if ($serviz[16] == 'on') {
			$db1 = ReadDBFields(DBNEWS);
			$db2 = array();
            foreach ($db1 as $db) {
                if (empty($db[6])) {
                    ReadDoc($db[4]);
                    if (TYP_NEWS != $type) continue;
                    $db2[] = array(substr($moddate, 0, 12), $fileid);
                }
            }

			list($rsstxtl1, $rsstxtl2) = MakeRSSitems($db2, $site['NE'].'.php?lng=%s&amp;pg=%s', $serviz[37]);
			$rssall1 .= $rsstxtl1;
			$rssall2 .= $rsstxtl2;
			unset($db1, $db2);
		}
		
		if ($serviz[54] == 'on') {
			$db1 = ReadDBFields(DBBLOG);
			$db2 = array();
			foreach ($db1 as $db) {
				if (empty($db[6])) {
                    ReadDoc($db[4]);
                    if (TYP_BLOG != $type) continue;
                    $db2[] = array(substr($moddate, 0, 12), $fileid);
				}
			}

			list($rsstxtl1, $rsstxtl2) = MakeRSSitems($db2, $site['BL'].'.php?lng=%s&amp;sel=pg&amp;pg=%s', $serviz[56]);
			$rssall1 .= $rsstxtl1;
			$rssall2 .= $rsstxtl2;
			unset($db1, $db2);
		}
		
		if ($serviz[60] == 'on') {
			$db1 = ReadDBFields(DBART);
			$db2 = array();
			foreach ($db1 as $db) {
				if (empty($db[6])) {
                    ReadDoc($db[4]);
                    if (TYP_ART != $type) continue;
                    $db2[] = array(substr($moddate, 0, 12), $fileid);
				}
			}

			list($rsstxtl1, $rsstxtl2) = MakeRSSitems($db2, 'articles.php?lng=%s&amp;pg=%s', $serviz[82]);
			$rssall1 .= $rsstxtl1;
			$rssall2 .= $rsstxtl2;
			unset($db1, $db2);
		}

		WriteFullDB(CHEMIN.sprintf(RSSALL, $lang[0]), $rsshead1.$rssall1.$rssfoot);
		if ($lang[1] != '') {
			WriteFullDB(CHEMIN.sprintf(RSSALL, $lang[1]), $rsshead2.$rssall2.$rssfoot);
		}
    }
    else {
        WriteFullDB(CHEMIN.sprintf(RSSALL, $lang[0]), $rsshead1.$rssfoot);
        if ($lang[1] != '') {
            WriteFullDB(CHEMIN.sprintf(RSSALL, $lang[1]), $rsshead2.$rssfoot);
        }
    }
}

function UpdateRSSnews() {
    global $site, $lang, $lng, $serviz,
        $type, $fileid, $status, $creadate, $moddate, $author, $email,
        $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldmod;
	list($rsshead1, $rsshead2, $rssfoot) = MakeRSSheadfoot();
    if ($serviz[16] == 'on') {
        $db1 = ReadDBFields(DBNEWS);
        $db2 = array();
        foreach ($db1 as $db) {
            if (empty($db[6])) {
                ReadDoc($db[4]);
                if (TYP_NEWS != $type) continue;
                $db2[] = array(substr($moddate, 0, 12), $fileid);
            }
        }

        list($rsstxtl1, $rsstxtl2) = MakeRSSitems($db2, $site['NE'].'.php?lng=%s&amp;pg=%s', $serviz[37]);
        unset($db1, $db2);

        WriteFullDB(CHEMIN.sprintf(RSSNEWS, $lang[0]), $rsshead1.$rsstxtl1.$rssfoot);
        if ($lang[1] != '') {
            WriteFullDB(CHEMIN.sprintf(RSSNEWS, $lang[1]), $rsshead2.$rsstxtl2.$rssfoot);
        }
    }
    else {
        WriteFullDB(CHEMIN.sprintf(RSSNEWS, $lang[0]), $rsshead1.$rssfoot);
        if ($lang[1] != '') {
            WriteFullDB(CHEMIN.sprintf(RSSNEWS, $lang[1]), $rsshead2.$rssfoot);
        }
    }
}

function UpdateRSSblog() {
    global $site, $lang, $lng, $serviz,
        $type, $fileid, $status, $creadate, $moddate, $author, $email,
        $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldmod;
    list($rsshead1, $rsshead2, $rssfoot) = MakeRSSheadfoot();
    if ($serviz[54] == 'on') {
        $db1 = ReadDBFields(DBBLOG);
        $db2 = array();
        foreach ($db1 as $db) {
            if (empty($db[6])) {
                ReadDoc($db[4]);
                if (TYP_BLOG != $type) continue;
                $db2[] = array(substr($moddate, 0, 12), $fileid);
            }
        }

        list($rsstxtl1, $rsstxtl2) = MakeRSSitems($db2, $site['BL'].'.php?lng=%s&amp;sel=pg&amp;pg=%s', $serviz[56]);
        unset($db1, $db2);

        WriteFullDB(CHEMIN.sprintf(RSSBLOG, $lang[0]), $rsshead1.$rsstxtl1.$rssfoot);
        if ($lang[1] != '') {
            WriteFullDB(CHEMIN.sprintf(RSSBLOG, $lang[1]), $rsshead2.$rsstxtl2.$rssfoot);
        }
    }
    else {
        WriteFullDB(CHEMIN.sprintf(RSSBLOG, $lang[0]), $rsshead1.$rssfoot);
        if ($lang[1] != '') {
            WriteFullDB(CHEMIN.sprintf(RSSBLOG, $lang[1]), $rsshead2.$rssfoot);
        }
    }
}

function UpdateRSSart() {
    global $lang, $lng, $serviz,
        $type, $fileid, $status, $creadate, $moddate, $author, $email,
        $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldmod;
	list($rsshead1, $rsshead2, $rssfoot) = MakeRSSheadfoot();
    if ($serviz[60] == 'on') {
        $db1 = ReadDBFields(DBART);
        $db2 = array();
        foreach ($db1 as $db) {
            if (empty($db[6])) {
                ReadDoc($db[4]);
                if (TYP_ART != $type) continue;
                $db2[] = array(substr($moddate, 0, 12), $fileid);
            }
        }

        list($rsstxtl1, $rsstxtl2) = MakeRSSitems($db2, 'articles.php?lng=%s&amp;pg=%s', $serviz[82]);
        unset($db1, $db2);

        WriteFullDB(CHEMIN.sprintf(RSSART, $lang[0]), $rsshead1.$rsstxtl1.$rssfoot);
        if ($lang[1] != '') {
            WriteFullDB(CHEMIN.sprintf(RSSART, $lang[1]), $rsshead2.$rsstxtl2.$rssfoot);
        }
    }
    else {
        WriteFullDB(CHEMIN.sprintf(RSSART, $lang[0]), $rsshead1.$rssfoot);
        if ($lang[1] != '') {
            WriteFullDB(CHEMIN.sprintf(RSSART, $lang[1]), $rsshead2.$rssfoot);
        }
    }
}

function MakeRSSheadfoot() {
	global $site, $user, $lang, $lng, $charset, $skn_logo;
	
    $rsstxt1 = '<?xml version="1.0" encoding="'.$charset.'"?'.'>
<?xml-stylesheet type="text/css" media="screen" href="'.$site[3].'data/stylexml.css"?>
<!-- RSS generated by GuppY v'.MP_VERSION.' on '.FormatDate(GetCurrentDateTime()).' -->
<rss version="2.0">
  <channel>
    <title>'.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'</title>
    <link>'.$site[3].'</link>
    <description>'.$site[1].'</description>
    <lastBuild>'.date(DATE_RSS).'</lastBuild>';

    $rsstxt2 = '
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>GuppY v'.MP_VERSION.'</generator>
    <managingEditor>no-response@no-spam.spam ('.$user[0].')</managingEditor>
    <webMaster>no-response@no-spam.spam ('.$user[0].')</webMaster>';
	
	if ($skn_logo != '' && is_file($skn_logo)) {
		list($width, $height, $type, $attr) = getimagesize($skn_logo);
		$rsstxt2 .= '
    <image>
      <title>'.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'</title>
      <url>'.$site[3].substr($skn_logo, 3).'</url>
      <link>'.$site[3].'</link>
      <width>'.$width.'</width>
      <height>'.$height.'</height>
    </image>';
	}

    $rsshead1 = $rsstxt1.'
    <language>'.$lang[0].'</language>'.$rsstxt2;
    if ($lang[1] != '') {
        $rsshead2 = $rsstxt1.'
    <language>'.$lang[1].'</language>'.$rsstxt2;
    } else {
        $rsshead2 = '';
    }
	$rssfoot = '
  </channel>
</rss>';
    return array($rsshead1, $rsshead2, $rssfoot);
}

function MakeRSSitems($db, $rssurl, $nbitem) {
    global $site, $lang, $lng, $serviz, $meskin, $urlrw, $z2,
        $type, $fileid, $status, $creadate, $moddate, $author, $email,
        $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldmod;
    @rsort($db);
    $lng  = empty($lng) ? $lang[0] : (!in_array($lng, $lang) ? $lang[0] : $lng);
    $aml  = '';
    $wbm  = '';
    if ($lang[1] != '') {
        include CHEMIN.'inc/lang/'.$lang[1].'-web'.INCEXT;
        $par2 = $web[6];
        $le2 = $web[7];
    }
    include CHEMIN.'inc/lang/'.$lang[0].'-web'.INCEXT;
    $par1 = $web[6];
    $le1 = $web[7];
    include CHEMIN.'inc/lang/'.$lng.'-web'.INCEXT;
    $sito = $site[3];
	
	$rsstxt1 = $rsstxt2 = '';
    for ($i = 0; $i < Min(count($db),$nbitem); $i++) {
        ReadDoc($db[$i][1]);
        if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) continue;
        $fieldc1 = ForceToAbsolute($fieldc1);
        $fieldc2 = ForceToAbsolute($fieldc2);
        if (($type == TYP_BLOG && $serviz[114] == 'on') || ($type == TYP_NEWS && $serviz[73] == 'on')) $author = $web[11];
        $rsstxt1 .= '
    <item>
      <title>'.strip_tags($fieldb1).' - '.$par1.' '.$author.' '.$le1.' '.FormatDate($moddate).'</title>
      <link>'.$sito.sprintf($rssurl, $lang[0], $fileid).'</link>
      <guid>'.$sito.sprintf($rssurl, $lang[0], $fileid).'</guid>
      <description><![CDATA['.stripslashes($fieldc1).']]></description>
      <pubDate>'.PubDate($moddate).'</pubDate>
    </item>';
        if ($lang[1] != '') {
            $rsstxt2 .= '
    <item>
      <title>'.strip_tags($fieldb2).' - '.$par2.' '.$author.' '.$le2.' '.FormatDate($moddate).'</title>
      <link>'.$sito.sprintf($rssurl, $lang[1], $fileid).'</link>
      <guid>'.$sito.sprintf($rssurl, $lang[1], $fileid).'</guid>
      <description>'.stripslashes($fieldc2).']]></description>
      <pubDate><![CDATA['.PubDate($moddate).'</pubDate>
    </item>';
        }
    }
    return array($rsstxt1, $rsstxt2);
}
?>
funcskin.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/funcskin.inc'
View Content
<?php
/*******************************************************************************
 *   Skin functions
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

function htable($tblti, $largeur) {
    echo '
<!-- Begin of Main Article -->
<article>
<h1 class="titre">'.$tblti.'</h1>
<div class="tbl" onmouseover="this.className = \'tbl tblover\'" onmouseout="this.className = \'tbl\'">';
}

function htable1($tblti, $class, $largeur) {
    $tclass = empty($class) ? '' : ' Tr'.trim($class);
    echo '
<!-- Begin of Main Article -->
<article>
<h1 class="titre'.$tclass.'">'.$tblti.'</h1>
<div class="tbl" onmouseout="this.className = \'tbl\'" onmouseover="this.className = \'tbl tblover\'">';
}

function btable() {
    echo '
</div>
</article> <!-- End of Main Article -->';
}

function boxwide($pos, $title, $content, $class='', $tag='div') {
    global $boxid, $tconfig;
	$boxid++;
    if (empty($title)) {
        return '
<'.$tag.' class="w-100 px-2 tbl'.$class.'" id="'.$pos.$tconfig.'tbl'.$boxid.'" 
  onmouseover="this.className = \'w-100 px-2 tbl'.$class.' tblover\'" onmouseout="this.className = \'w-100 px-2 tbl'.$class.'\'">
  '.$content.'
</'.$tag.'>
';
    } else {
		$tclass = empty($class) ? '' : ' Tr'.trim($class);
        return '
<'.$tag.'>
  <h1 class="w-100 px-2 titre'.$tclass.'" id="'.$pos.$tconfig.'titre'.$boxid.'">'.$title.'</h1>
  <div class="w-100 px-2 tbl'.$class.'" id="'.$pos.$tconfig.'tbl'.$boxid.'" 
    onmouseover="this.className = \'w-100 px-2 tbl'.$class.' tblover\'" onmouseout="this.className = \'w-100 px-2 tbl'.$class.'\'">
    '.$content.'
  </div>
</'.$tag.'>
';
    }
}

function boxthin($pos, $title, $content, $class='', $dynbox='off', $tag='div') {
    global $boxid, $page, $tconfig;
	$boxid++;
    if (empty($title)) {
        return '
<'.$tag.' class="w-100 px-2 tblbox'.$class.'" id="'.$pos.$tconfig.'tbl'.$boxid.'" 
  onmouseover="this.className=\'w-100 px-2 tblbox'.$class.' tblboxover\'" onmouseout="this.className=\'w-100 px-2 tblbox'.$class.'\'">
  '.$content.'
</'.$tag.'>
';
    } else {
		$tclass = empty($class) ? '' : ' Tr'.trim($class);
		if ($dynbox == 'off' || $dynbox == '')
			$out = '
<style>
  .curtitre { cursor: inherit; }
</style>
<h1 class="w-100 px-2 titrebox'.$tclass.' curtitre" id="'.$pos.$tconfig.'titrebox'.$boxid.'">'.$title.'</h1>';
		else
			$out = '
<h1 class="titrebox'.$tclass.'" id="'.$pos.$tconfig.'titrebox'.$boxid.'" 
  onclick="var div=getElementById(\''.$pos.$tconfig.'tblbox'.$boxid.'\'); 
  if (div.style.display == \'none\') { montre(\''.$pos.$tconfig.'tblbox'.$boxid.'\'); getElementById(\'Ar'.trim($class).'\').innerHTML = \'&#xe808;\'; } 
  else { cache(\''.$pos.$tconfig.'tblbox'.$boxid.'\'); getElementById(\'Ar'.trim($class).'\').innerHTML = \'&#xe807;\'; }">'.$title.'
</h1>';
        $out .= '
<div class="w-100 px-2 tblbox'.$class.'" id="'.$pos.$tconfig.'tblbox'.$boxid.'" 
  onmouseover="this.className=\'w-100 px-2 tblbox'.$class.' tblboxover\'" onmouseout="this.className=\'w-100 px-2 tblbox'.$class.'\'">
  '.$content;
		$out .= '
</div>';
		if (!empty($title) && ($dynbox == 'open' || $dynbox == 'close')) {
			if ($dynbox == 'open')
				$out .= '<script>montre(\''.$pos.$tconfig.'tblbox'.$boxid.'\');</script>';
			else
				$out .= '<script>cache(\''.$pos.$tconfig.'tblbox'.$boxid.'\');</script>';
		}
		return '
    <'.$tag.'>
      '.$out.'
    </'.$tag.'>
        ';
    }
}
?>
functions.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/functions.php'
View Content
<?php
/*******************************************************************************
 *   Functions
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.19 (August 20, 2024) : Integration security in import
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'functions.php')) {
  header('location:../index.php');
  die();
}

include_once CHEMIN.'inc/constantes.php';
global $phpmailer;

// (Re)create it, if it's gone missing.
  // lance les classes de PHPMailer
	use PHPMailer\PHPMailer\PHPMailer;
	// use PHPMailer\PHPMailer\Exception;
	// path du dossier PHPMailer % fichier d'envoi du mail
	require_once 'PHPMailer/src/PHPMailer.php';
	require_once 'PHPMailer/src/SMTP.php';
	require_once 'PHPMailer/src/Exception.php';

/*

md5crypt.php5
--------------

Written by

   - Dennis Riehle <selfhtml@riehle-web.com>

Based on

   - perl's Crypt::PasswdMD5 by Luis Munoz (lem@cantv.net)
   - phyton's md5crypt.py by Michal Wallace http://www.sabren.com/
   - /usr/src/libcrypt/crypt.c from FreeBSD 2.2.5-RELEASE

Many thanks to

   - Fabian Steiner <info@fabis-site.net>
   - J�rg Reinholz <http://www.fastix.de/>

USAGE

  $cryptedpassword = Md5Crypt::unix   ($password [, $salt [, $magicstring ]);
  $apachepassword  = Md5Crypt::apache ($password [, $salt]);

DESCRIPTION

  unix_md5_crypt() provides a crypt()-compatible interface to the
  rather new MD5-based crypt() function found in modern operating systems.
  It's based on the implementation found on FreeBSD 2.2.[56]-RELEASE and
  contains the following license in it:

   "THE BEER-WARE LICENSE" (Revision 42):
   <phk@login.dknet.dk> wrote this file.  As long as you retain this notice you
   can do whatever you want with this stuff. If we meet some day, and you think
   this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp

  apache_md5_crypt() provides a function compatible with Apache's
  .htpasswd files. This was contributed by Bryan Hart <bryan@eai.com>.

*/
class Md5Crypt
{
    public static $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
    // [a-zA-Z0-9./]

    protected static function to64($v, $n)
    {
        $itoa64 = self::$itoa64;
        $ret = '';

        while (--$n >= 0) {
            $ret .= $itoa64[$v & 0x3f];
            $v = $v >> 6;
        }

        return $ret;
    }

    public static function apache($pw, $salt = null)
    {
        $Magic = '$apr1$';

        return self::unix($pw, $salt, $Magic);
    }

    public static function unix($pw, $salt = null, $Magic = '$1$')
    {
        $itoa64 = self::$itoa64;

        if (null !== $salt) {
            // Take care of the magic string if present
            if (substr($salt, 0, strlen($Magic)) == $Magic) {
                $salt = substr($salt, strlen($Magic), strlen($salt));
            }
            // Salt can have up to 8 characters
            $parts = explode('$', $salt, 1);
            $salt = substr($parts[0], 0, 8);
        } else {
            $salt = '';
            mt_srand((float) (microtime() * 10000000));

            while (strlen($salt) < 8) {
                $salt .= $itoa64[mt_rand(0, strlen($itoa64) - 1)];
            }
        }

        $ctx = $pw . $Magic . $salt;

        $final = pack('H*', md5($pw . $salt . $pw));

        for ($pl = strlen($pw); $pl > 0; $pl -= 16) {
            $ctx .= substr($final, 0, ($pl > 16) ? 16 : $pl);
        }

        // Now the 'weird' xform
        for ($i = strlen($pw); $i; $i >>= 1) {
            if ($i & 1) {				// This comes from the original version,
                $ctx .= pack('C', 0);   // where a memset() is done to $final
            } else {					// before this loop
                $ctx .= $pw[0];
            }
        }

        $final = pack('H*', md5($ctx)); // The following is supposed to make
        // things run slower

        for ($i = 0; $i < 1000; ++$i) {
            $ctx1 = '';
            if ($i & 1) {
                $ctx1 .= $pw;
            } else {
                $ctx1 .= substr($final, 0, 16);
            }
            if ($i % 3) {
                $ctx1 .= $salt;
            }
            if ($i % 7) {
                $ctx1 .= $pw;
            }
            if ($i & 1) {
                $ctx1 .= substr($final, 0, 16);
            } else {
                $ctx1 .= $pw;
            }
            $final = pack('H*', md5($ctx1));
        }

        // Final xform
        $passwd = '';
        $passwd .= self::to64((intval(ord($final[0])) << 16)
                        | (intval(ord($final[6])) << 8)
                        | (intval(ord($final[12]))), 4);
        $passwd .= self::to64((intval(ord($final[1])) << 16)
                        | (intval(ord($final[7])) << 8)
                        | (intval(ord($final[13]))), 4);
        $passwd .= self::to64((intval(ord($final[2])) << 16)
                        | (intval(ord($final[8])) << 8)
                        | (intval(ord($final[14]))), 4);
        $passwd .= self::to64((intval(ord($final[3])) << 16)
                        | (intval(ord($final[9])) << 8)
                        | (intval(ord($final[15]))), 4);
        $passwd .= self::to64((intval(ord($final[4]) << 16)
                        | (intval(ord($final[10])) << 8)
                        | (intval(ord($final[5])))), 4);
        $passwd .= self::to64((intval(ord($final[11]))), 2);

        // Return the final string
        return $Magic . $salt . '$' . $passwd;
    }
}


function is_ssl() {
    if (isset($_SERVER['HTTPS'])) {
        if ('on' == strtolower($_SERVER['HTTPS'])) return true;
        if ('1' == $_SERVER['HTTPS']) return true;
    } elseif (isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] )) {
        return true;
    } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && ('https' == strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']))) {
        return true;
    } elseif (isset($_SERVER['X_FORWARDED_PROTO']) && ('https' == strtolower($_SERVER['X_FORWARDED_PROTO']))) {
        return true;
    } elseif (isset($_SERVER['HTTP_X_FORWARDED_SSL']) && 'on' == strtolower($_SERVER['HTTP_X_FORWARDED_SSL'])) {
        return true;
    } elseif (isset($_SERVER['X_FORWARDED_SSL']) && 'on' == strtolower($_SERVER['X_FORWARDED_SSL'])) {
        return true;
    } elseif (isset($_SERVER['HTTP_X_FORWARDED_HTTPS']) && 'on' == strtolower($_SERVER['HTTP_X_FORWARDED_HTTPS'])) {
        return true;
    } elseif (isset($_SERVER['X_FORWARDED_HTTPS']) && 'on' == strtolower($_SERVER['X_FORWARDED_HTTPS'])) {
        return true;
    }
    return false;
}
if (!isset($_SERVER['HTTP_HOST'])) $_SERVER['HTTP_HOST'] = 'localhost';
if (!isset($_SERVER['HTTPS'])) $_SERVER['HTTPS'] = '';
$_DOMAIN   = (strtolower($_SERVER['HTTP_HOST']) != 'localhost' ? $_SERVER['HTTP_HOST'] : false);
$_SECURE   = (is_ssl() ? true : false);
$_HTTPONLY = (!empty($_SERVER['HTTPS']) ? true : false);

function ClearCookies() {
    global $_DOMAIN, $_SECURE, $_HTTPONLY;
    if (isset($_COOKIE[USER_COOKIE])) @setcookie(USER_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
    if (isset($_COOKIE[PREF_COOKIE])) @setcookie(PREF_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
    if (isset($_COOKIE[ADMP_COOKIE])) @setcookie(ADMP_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
    if (isset($_COOKIE[CTCT_COOKIE])) @setcookie(CTCT_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
    if (isset($_COOKIE[CNCT_COOKIE])) @setcookie(CNCT_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
    if (isset($_COOKIE[POST_COOKIE])) @setcookie(POST_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
    if (isset($_COOKIE['GuppYCrypt'])) @setcookie('GuppYCrypt', '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
    if (isset($_COOKIE[COOKIE_COOKIE])) @setcookie(COOKIE_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
    return true;
}

$show_progbar  = FALSE;
$widepage      = '';
$headinc       = '';
$meskin        = '';
$skinCopyright = '';

$souriez = array(
    array('|:-)', '&#x1F60E;',     'cool'),
    array(';-)',  '&#x1F609;',     'wink'),
    array(':-))', '&#x1F601;',  'biggrin'),
    array(':-)',  '&#x1F60A;',    'smile'),
    array(':-o',  '&#x1F62B;',    'frown'),
    array(':o)',  '&#x1F60F;',      'eek'),
    array(':-((', '&#x1F608;',      'mad'),
    array(':-(',  '&#x1F621;', 'confused'),
    array('8-)',  '&#x1F628;', 'rolleyes'),
    array(':-p',  '&#x1F61C;',   'tongue'),
    array(';-(',  '&#x1F62D;',      'cry')
	);


function souriez($chaine) {
    global $souriez;
    foreach($souriez as $item) {
        $chaine = str_replace($item[0], '<span title="'.$item[2].'">'.$item[1].'</span>', $chaine);
    }
    return $chaine;
}

function replaceimg($chaine) {
    global $souriez, $site;
    foreach($souriez as $item) {
        $chaine = str_replace($item[0], '<span title="'.$item[2].'">'.$item[1].'</span>', $chaine);
    }
    return $chaine;
}

function DrawSmileys($num) {
    global $souriez;
    for ($i = 0; $i < count($souriez); $i++) {
        echo '<a href="JavaScript:AddSmiley'.$num.'(\''.$souriez[$i][0].'\')" class="clsCursor" title="'.$souriez[$i][0].'">'.$souriez[$i][1].'</a>&nbsp;';
    }
}

function DejaVote($file_ip, $d_time = 0) {
    global $userprefs, $site;
    $remoteadr   = getIPadress($site[6] == 'on' ? (isset($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']): $_SERVER['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();
    foreach($subdata as $sub) {
        list($jour, $mois, $annee) = explode('/', substr($sub[1], 0, 10));
        list($heure, $minute, $seconde) = explode(':', substr($sub[1], 10, 18));
        if ($now_time < mktime((int)$heure, (int)$minute, (int)$seconde, (int)$mois, (int)$jour, (int)$annee) + $d_time) {
            $nbr_connect++;
            $var_ip[$k][0] = $sub[0];
            if ($remoteadr == $sub[0]) {
                $var_bool = TRUE;
            }
            $var_ip[$k][1] = $sub[1];
            if ($userprefs[5] != '') {
                $uprefname = $userprefs[1];
            }
            else {
                $uprefname = '';
            }
            if ($remoteadr == $sub[0] && $uprefname != $sub[2]) {
                $user_bool = TRUE;
                $var_ip[$k][2] = $uprefname;
            }
            else {
                $var_ip[$k][2] = @$sub[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);
    }
    return array($var_bool, $nbr_connect);
}

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);
    }
    return array($nbr_visit, $subdata[1]);
}

function IsImage($extn) {
    $extn = strtolower($extn);
	if (version_compare(PHP_VERSION, '8.1.0') >= 0 && version_compare(PHP_VERSION, '8.2.0') < 0) {
			if ($extn == 'gif' || $extn == 'jpg' || $extn == 'jpeg' || $extn == 'png' || $extn == 'bmp' || $extn == 'webp' || $extn == 'avif') {
				return TRUE;
			} else {
				return FALSE;
			}
	}
	else
	{
		if ($extn == 'gif' || $extn == 'jpg' || $extn == 'jpeg' || $extn == 'png' || $extn == 'bmp' || $extn == 'webp') {
			return TRUE;
		} else {
			return FALSE;
		}
	}
}

function ExtImage($extn){
    switch(strtolower($extn)) {
    case 'bat'  : return 'bat';
    case 'bmp'  : return 'bmp';
    case 'com'  : return 'com';
    case 'css'  : return 'css';
    case 'doc'  : return 'doc';
    case 'exe'  : return 'exe';
    case 'gif'  : return 'gif';
    case 'js'   : return 'js';
    case 'mid'  : return 'mid';
    case 'mp3'  : return 'mp3';
	case 'mp4'  : return 'mp4';
    case 'pdf'  : return 'pdf';
    case 'ppt'  : return 'ppt';
    case 'png'  : return 'png';
    case 'swf'  : return 'swf';
    case 'xls'  : return 'xls';

    case 'com'  :
    case 'pif'  : return 'com';

    case 'htm'  :
    case 'html' : return 'html';
    case 'jpeg' :
    case 'jpg' : return 'jpg';
	case 'webp' : return 'webp';
	case 'avif' : return 'avif';
    
    case 'odf'  : // OpenOffice
    case 'odg'  :
    case 'odm'  :
    case 'odp'  :
    case 'ods'  :
    case 'odt'  : return 'ooo';

    case 'inc'  :
    case 'php'  :
    case 'php3' :
    case 'php4' :
    case 'php5' :
    case 'phtml' : return 'php';

    case 'dtb'  :
    case 'ini'  :
    case 'nfo'  :
    case 'txt'  : return 'txt';

    case 'avi'  :
    case 'mpeg' :
    case 'mpg'  :
    case 'mov'  :
    case 'wav'  : return 'wav';

    case 'ace'  :
    case 'cab'  :
    case 'gz'   :
    case 'rar'  :
    case 'tar'  :
    case 'tgz'  :
    case 'zip'  : return 'zip';
    
    default     : 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=| action=)(\"|')?([^ >]+)`i", 'PathAbs', $text);
}

function CutLongWord($textin, $textlen = 50) {
	return (mb_strlen($textin) > $textlen ? mb_substr(mb_substr($textin, 0, $textlen), 0, strrpos(mb_substr($textin, 0, $textlen), ' ')) : $textin);
}

function WrapLongWords($textin, $textlen = 50, $textrep = ' ') {
    return wordwrap($textin, $textlen, $textrep, 1);
}

function FormatDateStamp($datein) {
    global $site, $lng, $lang;
    $l       = ($lng == $lang[0] ? 0 : 1);
    $asite19 = explode('|', $site[19]);
    if ($asite19[$l] == 'E1') {
        $formatout = 'd/m/Y';
    }
    elseif ($asite19[$l] == 'E2') {
        $formatout = 'd.m.Y';
    }
    elseif ($asite19[$l] == 'U1') {
        $formatout = 'm/d/Y';
    }
    elseif ($asite19[$l] == 'U2') {
        $formatout = 'm.d.Y';
    }
    elseif ($asite19[$l] == '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, $lng, $lang;
    $l       = ($lng == $lang[0] ? 0 : 1);
    $asite19 = explode('|', $site[19]);
	if ($datein != '')
	{
		$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 ($asite19[$l] == 'E1') {
			$dateout = $jour.'/'.$mois.'/'.$annee;
		}
		elseif ($asite19[$l] == 'E2') {
			$dateout = $jour.'.'.$mois.'.'.$annee;
		}
		elseif ($asite19[$l] == 'U1') {
			$dateout = $mois.'/'.$jour.'/'.$annee;
		}
		elseif ($asite19[$l] == 'U2') {
			$dateout = $mois.'.'.$jour.'.'.$annee;
		}
		elseif ($asite19[$l] == 'C1') {
			$dateout = $annee.'/'.$mois.'/'.$jour;
		}
		else {
			$dateout = $annee.'.'.$mois.'.'.$jour;
		}
		if ($heure.$minute != '') {
			$dateout .= ' '.$site[23].' ';
			$suffixe  = '';
			if ($site[22] == "H1") {
				$separe   = ':';
			}
			elseif ($site[22] == "H2") {
				$separe = 'h';
			}
			else {
				$separe = ':';
				if ($heure < 12) {
					$suffixe = ' AM';
				}
				else {
					$suffixe = ' PM';
					$heure = $heure - 12;
				}
			}
			$dateout .= $heure.$separe.$minute.$suffixe;
		}
	}
	else $dateout = '';
    return $dateout;
}
function FormatDateSec($datein) {
    global $site, $lng, $lang;
    $l       = ($lng == $lang[0] ? 0 : 1);
    $asite19 = explode('|', $site[19]);
	if ($datein != '')
	{
		$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);
		$seconde = substr($datein,12,2);
		if ($seconde == '' ) $seconde = '00';
			
		if ($asite19[$l] == 'E1') {
			$dateout = $jour.'/'.$mois.'/'.$annee;
		}
		elseif ($asite19[$l] == 'E2') {
			$dateout = $jour.'.'.$mois.'.'.$annee;
		}
		elseif ($asite19[$l] == 'U1') {
			$dateout = $mois.'/'.$jour.'/'.$annee;
		}
		elseif ($asite19[$l] == 'U2') {
			$dateout = $mois.'.'.$jour.'.'.$annee;
		}
		elseif ($asite19[$l] == 'C1') {
			$dateout = $annee.'/'.$mois.'/'.$jour;
		}
		else {
			$dateout = $annee.'.'.$mois.'.'.$jour;
		}
		if ($heure.$minute.$seconde != '') {
			$dateout .= ' '.$site[23].' ';
			$suffixe  = '';
			if ($site[22] == "H1") {
				$separe   = ':';
			}
			elseif ($site[22] == "H2") {
				$separe = 'h';
			}
			else {
				$separe = ':';
				if ($heure < 12) {
					$suffixe = ' AM';
				}
				else {
					$suffixe = ' PM';
					$heure = $heure - 12;
				}
			}
			$dateout .= $heure.$separe.$minute.$separe.$seconde.$suffixe;
		}
	}
	else $dateout = '';
    return $dateout;
}
function GetCurrentDateTime() {
    return date('YmdHi');
}
function GetCurrentDateTimeSec() {
    return date('YmdHis');
}
function FileSizeInKb($fic) {
    $taille = @filesize($fic);
    if ($taille !== false) {
        $taille = round($taille/1024);
    }
    return $taille;
}

function FileDBExist($fic) {
	if ($fic != '')
		return is_file($fic);
	else
		return false;
}

function DestroyDBFile($fic) {
    if (FileDBExist($fic)) {
        SetChmod($fic);
        SetChmod($fic);
        @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 (!empty($fic))
	{
		if (FileDBExist($fic)) {
			$DataDB = file($fic);
			$i = 0;
			foreach($DataDB as $Data) {
				$Fields[$i] = explode(CONNECTOR, trim($Data));
				$i++;
			}
		}
	}
    return $Fields;
}

function WriteDBFields($fic, $Fields) {
    $fhandle = fopen($fic, 'w');
    $out = '';
    foreach($Fields as $row) {
        $out .= @implode(CONNECTOR, (array)$row)."\n";
    }
    fputs($fhandle, $out);
    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');
    foreach($newarray as $new){
        fwrite($fhandle, $new."\n");
    }
    fclose($fhandle);
}

function CheckDB1Field($fic, $submit, $FieldNB) {
    if (FileDBExist($fic)) {
        $DataDB = ReadDBFields($fic);
        foreach($DataDB as $Data) {
            if (@stristr($Data[$FieldNB], $submit)) {
                return TRUE;
            }
        }
    }
    return FALSE;
}

function CheckDB2Fields($fic,$submit1,$FieldNB1,$submit2,$FieldNB2) {
    if (FileDBExist($fic)) {
        $DataDB = ReadDBFields($fic);
        foreach($DataDB as $Data) {
            if (@stristr($Data[$FieldNB1],$submit1) && @stristr($Data[$FieldNB2],$submit2)) {
                return TRUE;
            }
        }
    }
    return FALSE;
}

function SelectDBFieldsByID($Fields,$id) {
    $DataDB = array();
    foreach ($Fields as $row) {
        if ($row[1] == $id) {
            $DataDB[] = $row;
        }
    }
    return $DataDB;
}

function SelectDBFieldsByField($Fields, $index, $value) {
    $DataDB = array();
    foreach ($Fields as $row) {
        if ($row[$index] == $value) {
            $DataDB[] = $row;
        }
    }
    return $DataDB;
}

function IndexDBFieldsByField($Fields, $index) {
    $DataDB = array();
    foreach ($Fields as $row) {
        $DataDB[$row[$index]] = $row;
    }
    return $DataDB;
}

function SelectDBFieldsByType($Fields, $type) {
    $DataDB = array();
    foreach ($Fields as $row) {
        if ($row[0] == $type) {
            $DataDB[] = $row;
        }
    }
    return $DataDB;
}

function SelectDBFieldsByNotStatus($Fields, $status) {
    $DataDB = array();
    foreach ($Fields as $row) {
        if ($row[2] != $status) {
            $DataDB[] = $row;
        }
    }
    return $DataDB;
}

function SelectDBFieldsByStatus($Fields, $status) {
    $DataDB = array();
    foreach ($Fields as $row) {
        if ($row[2] == $status) {
            $DataDB[] = $row;
        }
    }
    return $DataDB;
}

function SelectDBFields($type,$status,$id,$docid=DOCID) {
    if (!empty($status) && !empty($id)) {
        return SelectDBFieldsByID(SelectDBFieldsByStatus(SelectDBFieldsByType(ReadDBFields($docid), $type), $status), $id);
    }
    elseif (!empty($status)) {
        return SelectDBFieldsByStatus(SelectDBFieldsByType(ReadDBFields($docid), $type), $status);
    }
    elseif (!empty($id)) {
        return SelectDBFieldsByID(SelectDBFieldsByType(ReadDBFields($docid), $type), $id);
    }
    else {
        return SelectDBFieldsByType(ReadDBFields($docid), $type);
    }
}

function RemoveQuote($chaine) {
    return str_replace(array('"', "'"), '', $chaine);
}

function RemoveConnector($chaine) {
    return str_replace(CONNECTOR, '', $chaine);
}

function RemoveBR($chaine) {
    return preg_replace('!<br />!i', "\n", $chaine);
}

function PutBR($chaine) {
    return str_replace(array(chr(10), chr(13)), array("\n", "\r"), $chaine);
}

function ReplaceDolar($chaine) {
    return str_replace('$','&#36;',$chaine);
}

function TestFileId($id, $format='%08d') {
	if ($id =='') return FALSE;
		if (1 == preg_match('|^[0-9]+$|', $id)) {
			return sprintf($format, $id);
		} else {
			return FALSE;
		}
}

function ReadDocCounter($id, $dir = DBCOUNT) {
    $id = TestFileID($id);
    if ($id === FALSE) {
        return FALSE;
    } else {
        return ReadCounter($dir.$id.DBEXT);
    }
}

function WriteDocCounter($id, $DataDB, $dir = DBCOUNT) {
    WriteCounter($dir.$id.DBEXT, $DataDB);
}

function UpdateDocCounter($id) {
    $id = TestFileID($id);
    if ($id === FALSE) return FALSE;
    $DataDB = ReadDocCounter($id);
    $vote = DejaVote(DBIPBASE.$id.DBEXT,300);
    if ($vote[0] == FALSE) {
        $DataDB++;
        WriteDocCounter($id, $DataDB);
    }
    return $DataDB;
}

function ReadDoc($id, $dir = DBBASE) {
    global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    $type       = '';
    $fileid     = '';
    $status     = '';
    $creadate   = '';
    $moddate    = '';
    $author     = '';
    $email      = '';
    $fielda1    = '';
    $fielda2    = '';
    $fieldb1    = '';
    $fieldb2    = '';
    $fieldc1    = '';
    $fieldc2    = '';
    $fieldd1    = '';
    $fieldd2    = '';
    $fieldweb   = '';
    $fieldmail  = '';
    $fieldmod   = '';
    $id = TestFileID($id);
    if ($id === FALSE) return FALSE;
    if (FileDBExist($dir.$id.INCEXT)) {
        include($dir.$id.INCEXT);
    }
    return TRUE;
}

function WriteDoc($action = '', $dir = DBBASE) {
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
         $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
         $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
    $id = TestFileID($fileid);
    if ($id === FALSE) return FALSE;
	if ($action != 'migr' && in_array($type, array(TYP_ART, TYP_BLOG, TYP_FAQ, TYP_FREEBOX, TYP_MENUBOX, TYP_OPTDDMENU))) {
		$fieldc1 = str_replace('&#36;', '$', $fieldc1);
		$fieldc2 = str_replace('&#36;', '$', $fieldc2);
	}
	$rec = "<?php
\$type = '".$type."';
\$fileid = '".$fileid."';
\$status = '".$status."';
\$creadate = '".$creadate."';
\$moddate = '".$moddate."';
\$author = stripslashes('".$author."');
\$email = stripslashes('".$email."');
\$fielda1 = stripslashes('".$fielda1."');
\$fielda2 = stripslashes('".$fielda2."');
\$fieldb1 = stripslashes('".$fieldb1."');
\$fieldb2 = stripslashes('".$fieldb2."');
\$fieldc1 = stripslashes('".$fieldc1."');
\$fieldc2 = stripslashes('".$fieldc2."');
\$fieldd1 = stripslashes('".$fieldd1."');
\$fieldd2 = stripslashes('".$fieldd2."');
\$fieldweb = stripslashes('".$fieldweb."');
\$fieldmail = stripslashes('".$fieldmail."');
\$fieldmod = stripslashes('".$fieldmod."');
?>
";
    WriteFullDB($dir.$id.INCEXT, $rec);
    return TRUE;
}

function UpdateDBdtb($dtb) {
    global $type,$fileid,$status,$creadate,$moddate,$author,$email,
        $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldd1,$fieldd2,$fieldweb,$fieldmail,$fieldmod;
    $db  = SelectDBFields($dtb, 'a', '');
    $dba = array();
    $j   = 0;
    foreach($db as $dbs) {
        ReadDoc($dbs[1]);
		if ($fielda1 != '' || $fielda2 != '' || $fieldb1 != '' || $fieldb2 != '')
		{	
			$dba[$j]= array(
				RemoveConnector($fielda1),
				RemoveConnector($fielda2),
				RemoveConnector($fieldb1),
				RemoveConnector($fieldb2),
				$fileid,
				$creadate,
				$fieldmod,
				$type
				);
			if ($dtb == TYP_SOCNET) {
				$dba[$j][2] = $fieldb1;
			}
			if ($dtb == TYP_ART) {
				$dba[$j][5] = RemoveConnector($fieldd1);
			} elseif ($dtb == TYP_OPTMENU || $dtb == TYP_OPTDDMENU) {
				$dba[$j][5] = $fieldweb;
			}
			$j++;
		}
    }
    WriteDBFields(DBINDEX.$dtb.DBEXT, $dba);
}

function UpdateDBreact($action, $id) {
    global $type, $fileid, $status, $creadate, $moddate, $author, $email,
        $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2,
        $fieldweb, $fieldmail, $fieldmod;
    $db = array();
    if ($action == 'add' || $action == 'migr') {
        ReadDoc($id);
		if ($status == 'a') {
			$db = array_pad(array(), 7, '');
			$db[0] = $fileid;
			$db[1] = $fielda2;
			ReadDoc($fielda2);
			$db[2] = $fieldb1;
			$db[3] = $fieldb2;
			$db[5] = $creadate;
			$db[6] = $fieldmod;
			$db[7] = TYP_REACT;
			AppendDBFields(DBREACT, $db);
		}
    }
    else {
        $db = SelectDBFields(TYP_REACT,'a','');
        sort($db);
        $dbart = ReadDBFields(DBART);
        $dbf = array();
		$i   = 0;
        foreach($db as $dbs) {
            $dbf[$i] = array_pad(array(), 7, '');
            ReadDoc($dbs[1]);
            $dbf[$i][0] = $fileid;
            $dbf[$i][1] = $fielda2;
            $art = SelectDBFieldsByField($dbart, 4, $fielda2);
			if (!empty($art)) {
				$dbf[$i][2] = $art[0][2];
				$dbf[$i][3] = $art[0][3];
				$dbf[$i][5] = $art[0][5];
				$dbf[$i][6] = $art[0][6];
				$dbf[$i][7] = TYP_REACT;
			}
			$i++;
        }
        WriteDBFields(DBREACT, $dbf);
    }
}

function UpdateDBreblog($action, $id) {
    global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
        $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2,
        $fieldweb, $fieldmail, $fieldmod;
    $db = array();
    if ($action == 'add' || $action == 'migr') {
        ReadDoc($id);
		if ($status == 'a') {
			$db = array_pad(array(), 7, '');
			$db[0] = $fileid;
			$db[1] = $fielda2;
			ReadDoc($fielda2);
			$db[2] = $fieldb1;
			$db[3] = $fieldb2;
			$db[5] = $creadate;
			$db[6] = $fieldmod;
			$db[7] = TYP_REBLOG;
			AppendDBFields(DBREBLOG, $db);
		}
    }
    else {
        $db = SelectDBFields(TYP_REBLOG,'a','');
        sort($db);
        $dbblog = ReadDBFields(DBBLOG);
        $dbf = array();
		$i   = 0;
        foreach($db as $dbs) {
            $dbf[$i] = array_pad(array(), 7, '');
            ReadDoc($dbs[1]);
            $dbf[$i][0] = $fileid;
            $dbf[$i][1] = $fielda2;
            $blog = SelectDBFieldsByField($dbblog, 4, $fielda2);
			if (!empty($blog)) {
				$dbf[$i][2] = $blog[0][2];
				$dbf[$i][3] = $blog[0][3];
				$dbf[$i][5] = $blog[0][5];
				$dbf[$i][6] = $blog[0][6];
				$dbf[$i][7] = TYP_REBLOG;
			}
			$i++;
        }
        WriteDBFields(DBREBLOG, $dbf);
    }
}

function UpdateDBforum($action, $id) {
    global $type,$fileid,$status,$creadate,$moddate,$author,$email,
    $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldc1,$fieldc2,$fieldd1,$fieldd2,$fieldweb,$fieldmail;$fieldmod;
    $db = array();
    if ($action == 'add' || $action == 'migr') {
        ReadDoc($id);
		if ($status == 'a') {
			$db[0]  = $creadate;
			$db[1]  = $fielda1;
			$db[2]  = $fielda2;
			$db[3]  = $fileid;
			$db[4]  = RemoveConnector($author);
			$db[5]  = RemoveConnector($email);
			$db[6]  = RemoveConnector($fieldb1);
			$db[7]  = $fieldd1;
			$db[8]  = getForumCatFull($fieldb2);
			$db[9]  = $fieldmail;
			$db[10] = TYP_FORUM;
			AppendDBFields(DBTHREAD, $db);
		}
    } else {
        $db = SelectDBFields(TYP_FORUM, 'a', '');
        sort($db);
        $dbf    = array();
        $ns2cat = array();
		$i      = 0;
        foreach($db as $dbs) {
            ReadDoc($dbs[1]);
            $dbf[$i][0]  = $creadate;
            $dbf[$i][1]  = $fielda1;
            $dbf[$i][2]  = $fielda2;
            $dbf[$i][3]  = $fileid;
            $dbf[$i][4]  = RemoveConnector($author);
            $dbf[$i][5]  = RemoveConnector($email);
            $dbf[$i][6]  = RemoveConnector($fieldb1);
            $dbf[$i][7]  = $fieldd1;
            $dbf[$i][8]  = getForumCatFull($fieldb2);
            $dbf[$i][9]  = $fieldmail;
			$dbf[$i][10] = TYP_FORUM;
            if (0 == $fielda2) {
                $ns2cat[$fielda1] = $fieldb2;
            } elseif (isset($ns2cat[$fielda1])) {
                $dbf[$i][8] = $ns2cat[$fielda1];
            }
			$i++;
        }
        @sort($dbf, SORT_REGULAR);
        WriteDBFields(DBTHREAD, $dbf);
    }
    $db  = array();
    $db  = ReadDBFields(DBTHREAD);
    $dbf = array();
    $i   = 0;
    $j   = 0;
    foreach ($db as $dbs) {
        if ($db[$i][2] == '0') {
            $dbf[$j][0]  = $dbs[0];
            $dbf[$j][1]  = $dbs[1];
            $dbf[$j][2]  = $dbs[3];
            $dbf[$j][3]  = $dbs[4];
            $dbf[$j][4]  = $dbs[5];
            $dbf[$j][5]  = $dbs[6];
            $dbf[$j][6]  = $dbs[3] == ($fileid ? $creadate : $dbs[0]);
            $dbf[$j][7]  = GetLastChildNumber(TYP_FORUM, $dbs[1]);
            $dbf[$j][8]  = '';
            $dbf[$j][9]  = '';
            $dbf[$j][10] = $dbs[7];
            $dbf[$j][11] = '';
            $dbf[$j][12] = $dbs[8];
			$dbf[$j][13] = $dbs[10];
			$k           = 0;
            foreach ($db as $dbk) {
                if ($dbk[1] == $dbf[$j][1]) {
                    $dbf[$j][0]  = ($dbk[0] > $dbf[$j][0] ? $dbk[0] : $dbf[$j][0]);
                    $dbf[$j][8]  = $dbk[4];
                    $dbf[$j][9]  = $dbk[5];
                    $dbf[$j][11] = $dbk[7];
                }
				$k++;
            }
            $j++;
        }
		$i++;
    }
    @rsort($dbf, SORT_REGULAR);
    WriteDBFields(DBFORUM, $dbf);
}

function UpdateDocid($id, $status) {
    $db = ReadDBFields(DOCID);
    for ($i = 0; $i < count($db); $i++) {
        if ($db[$i][1] == $id) {
            $db[$i][2] = $status;
            break;
        }
    }
    WriteDBFields(DOCID,$db);
    unset($db);
}

function UpdateDocdates($action, $id, $mdate='', $cdate='') {
    $db = ReadDBFields(DOCDATES);
    switch ($action) {
    case 'add'  :
    case 'migr' :
		$datespub    = explode('-', $cdate);
		$datespub[0] = (empty($datespub[0]) ? GetCurrentDateTime() : $datespub[0]);
		$datespub[1] = (empty($datespub[1]) ? '' : $datespub[1]);
		$cdate       = $datespub[0].'-'.$datespub[1];
		$mdate       = ($action == 'add' ? $datespub[0] : $mdate);
        $db[]        = array($id, $cdate, $mdate);
        break;
    case 'mod' :
		$trouveid = 0;				
        for ($i = 0; $i < count($db); $i++) {
            if ($db[$i][0] == $id) {
				if ($cdate != '' && $db[$i][1] != $cdate) {
					$datespub    = explode('-', $cdate);
					$datespub[0] = (empty($datespub[0]) ? GetCurrentDateTime() : $datespub[0]);
					$datespub[1] = (empty($datespub[1]) ? '' : $datespub[1]);
					$db[$i][1]   = $datespub[0].'-'.$datespub[1];
				}
                $db[$i][2] = ($mdate == '' ? GetCurrentDateTime() : $mdate);
				$trouveid = 1;				  
                break;
            }
        }
		if ($trouveid != 1)
		{
			$datespub    = explode('-', $cdate);
			$datespub[0] = (empty($datespub[0]) ? GetCurrentDateTime() : $datespub[0]);
			$datespub[1] = (empty($datespub[1]) ? '' : $datespub[1]);
			$db[]        = array($id, $cdate, $mdate);
		}
        break;
    case 'del' :
        for ($i = 0; $i < count($db); $i++) {
            if ($db[$i][0] == $id) {
                unset($db[$i]);
                break;
            }
        }
        break;
    }
    sort($db);
    WriteDBFields(DOCDATES, $db);
    unset($db);
}

function GetLastChildNumber($type, $parentId = NULL) {
    $db = SelectDBFieldsByField(ReadDBFields(CHILDREN), 1, $type);
    if (isset($parentId)) {
        $db = SelectDBFieldsByField($db, 3, $parentId);
    }
    if (count($db) > 0) {
        rsort($db);
        return $db[0][2];
    } else {
        return 0;
    }
    unset($db);
}

function GetNextChildNumber($type, $parentId = NULL) {
    return 1 + GetLastChildNumber($type, $parentId);
}

function UpdateChildren($action, $data) {
    $db = IndexDbFieldsByField(ReadDBFields(CHILDREN), 0);
    switch ($data[0]) {
    case TYP_GUESTBK :
    case TYP_REACT :
    case TYP_REBLOG :
        switch ($action) {
        case 'add' :
            $db[$data[1]] = array($data[1], $data[0], $data[7], $data[8]);
            WriteDbFields(CHILDREN, $db);
            break;
        case 'del' :
            unset($db[$data[1]]);
            WriteDbFields(CHILDREN, $db);
            break;
        }
        break;
    case TYP_FORUM :
        if (0 == $data[8]) break;
        switch ($action) {
        case 'add' :
            $db[$data[1]] = array($data[1], $data[0], $data[8], $data[7]);
            WriteDbFields(CHILDREN, $db);
            break;
        case 'del' :
            if (isset($db[$data[1]])) unset($db[$data[1]]);
            WriteDbFields(CHILDREN, $db);
            break;
        }
        break;
    }
    unset($db);
}

function UpdateDocFromDoc($action, $id, $newStatus) {
    global $type,$fileid,$status,$creadate,$moddate,$author,$email,
    $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldc1,$fieldc2,$fieldd1,$fieldd2,
    $fieldweb,$fieldmail,$fieldmod, $lang, $urlrw;
    ReadDoc($id);
    $status    = $newStatus;
    $author    = addslashes($author);
    $email     = addslashes($email);
    $fielda1   = addslashes($fielda1);
    $fielda2   = addslashes($fielda2);
    $fieldb1   = addslashes($fieldb1);
    $fieldb2   = addslashes($fieldb2);
    $fieldc1   = addslashes($fieldc1);
    $fieldc2   = addslashes($fieldc2);
    $fieldd1   = addslashes($fieldd1);
    $fieldd2   = addslashes($fieldd2);
    $fieldweb  = addslashes($fieldweb);
    $fieldmail = addslashes($fieldmail);
    $fieldmod  = addslashes($fieldmod);
    WriteDoc($action);
    if ($type == TYP_ART) {
        $mnu_id = substr($fieldd1, 4);
        $dbw    = SelectDBFieldsByField(ReadDBFields(DBOPTMENU), 5, $mnu_id);
        foreach ($dbw as $item) {
            ReadDoc($item[4]);
			$urls = explode('||', $fieldd1);
			if (!empty($urls[0]) && strpos($urls[0], 'articles.php') !== false) {
				$pg  = substr($urls[0], strpos($urls[0], 'pg=') + 3);
				$pos = strpos($pg, '&');
				$pg  = ($pos === false ? $pg : substr($pg, 0, $pos));
			}
            if ($pg == $id && $fieldweb == $mnu_id) {
                $opt_id = $item[4];
                UpdateDocid($opt_id, $newStatus);
                UpdateDocFromDoc($action, $opt_id, $newStatus);
                UpdateDBdtb(TYP_OPTMENU);
                break;
            }                
        }
        unset($dbw);
    }
}

function UpdateDocFromInput($action, $id, $data) {
    global $site,$type,$fileid,$status,$creadate,$moddate,$author,$email,
    $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldc1,$fieldc2,$fieldd1,$fieldd2,
    $fieldweb,$fieldmail,$fieldmod;
    ReadDoc($id);
    if (in_array($action, array('add', 'migr'))) {
        $type   = $data[0];
        $fileid = $id;
        $status = $data[2];
		
		$datespub    = explode('-', $data[3]);
		$datespub[0] = (empty($datespub[0]) ? GetCurrentDateTime() : $datespub[0]);
		$datespub[1] = (empty($datespub[1]) ? '' : $datespub[1]);
		$creadate    = $datespub[0].'-'.$datespub[1];
		$moddate     = ($action == 'add' ? $datespub[0] : $data[4]);
    } else {
        /// $action == 'mod'
		if ($creadate != $data[3] && $data[0] != TYP_FORUM) {
			$datespub    = explode('-', $data[3]);
			$datespub[0] = (empty($datespub[0]) ? GetCurrentDateTime() : $datespub[0]);
			$datespub[1] = (empty($datespub[1]) ? '' : $datespub[1]);
			$creadate    = $datespub[0].'-'.$datespub[1];
		}
        $moddate = $data[4];
    }
    $author  = addslashes(stripslashes($data[5]));
    $email   = addslashes(stripslashes($data[6]));
    $fielda1 = addslashes(stripslashes($data[7]));
    $fielda2 = addslashes(stripslashes($data[8]));
    $fieldb1 = addslashes(stripslashes($data[9]));
    $fieldb2 = addslashes(stripslashes($data[10]));
    if ($data[0] == TYP_NWL) {
        $fieldc1 = addslashes(stripslashes(replaceimg(ReplaceDolar(PutBR($data[11])))));
        $fieldc2 = addslashes(stripslashes(replaceimg(ReplaceDolar(PutBR($data[12])))));
    }
    else {
        $fieldc1 = addslashes(stripslashes(souriez(ReplaceDolar(PutBR($data[11])))));
        $fieldc2 = addslashes(stripslashes(souriez(ReplaceDolar(PutBR($data[12])))));
    }
   if (isset($data[13])) $fieldd1   = addslashes(stripslashes($data[13]));
	else
		$fieldd1   = '';
    if (isset($data[14])) $fieldd2   = addslashes(stripslashes($data[14]));
		else
		$fieldd2   = '';
    if (isset($data[15]))$fieldweb  = addslashes(stripslashes($data[15]));
		else
		$fieldweb   = '';
    if (isset($data[16]))$fieldmail = addslashes(stripslashes($data[16]));
		else
		$fieldmail   = '';
    if (isset($data[17])) $fieldmod  = addslashes(stripslashes(@$data[17]));
		else
		$fieldmod   = '';				   
    WriteDoc($action);
}

function DeactivateInCascade($type, $parentId) {
    // Désactivation en cascade des réactions, réponses et commentaires actifs
    switch ($type) {
    case TYP_ART :
        $db1 = SelectDBFieldsByField(ReadDBFields(DBREACT), 1, $parentId);
        foreach ($db1 as $db) {
            ActionOnFields('act', array(TYP_REACT, $db[0], 'i'), FALSE);
        }
        if (count($db1) > 0) {
            ActionOnFields('reindex', array(TYP_REACT, 0));
        }
        unset($db1, $db);
        break;
    case TYP_BLOG :
        $db1 = SelectDBFieldsByField(ReadDBFields(DBREBLOG), 1, $parentId);
        foreach ($db1 as $db) {
            ActionOnFields('act', array(TYP_REBLOG, $db[0], 'i'), FALSE);
        }
        if (count($db1) > 0) {
            ActionOnFields('reindex', array(TYP_REBLOG, 0));
        }
        unset($db1, $db);
        break;
    case TYP_FORUM :
        global $fielda1, $fielda2;
        if (0 == $fielda2) {
            $db1 = SelectDBFieldsByField(ReadDBFields(DBTHREAD), 1, $fielda1);
            foreach ($db1 as $db) {
                if ($db[2] > 0) {
                    ActionOnFields('act', array(TYP_FORUM, $db[3], 'i'), FALSE);
                }
            }
            if (count($db1) > 1) {
                ActionOnFields('reindex', array(TYP_FORUM, 0));
            }
            unset($db1, $db);
        }
        break;
    }
}

function DeleteInCascade($type, $parentId) {
    // Suppression en cascade des réactions, réponses et commentaires actifs
    $db1 = array();
    $typechildren = array(TYP_ART=>TYP_REACT, TYP_BLOG=>TYP_REBLOG);
    switch ($type) {
    case TYP_ART :
    case TYP_BLOG :
        $db1 = SelectDBFieldsByField(SelectDBFieldsByField(ReadDBFields(CHILDREN),1, $typechildren[$type]), 3, $parentId);
        foreach ($db1 as $db) {
            ActionOnFields('del', array($typechildren[$type], $db[0]), FALSE);
        }
        break;
    case TYP_FORUM :
        global $fielda1, $fielda2;
        if (0 == $fielda2) {
            $db1 = SelectDBFieldsByField(SelectDBFieldsByField(ReadDBFields(CHILDREN),1, $type), 3, $fielda1);
            foreach ($db1 as $db) {
                ActionOnFields('del', array($type, $db[0]), FALSE);
            }
        }
        break;
    }
    if (count($db1) > 0) {
        ActionOnFields('reindex', array($type, 0));
    }
    unset($db1);
}

function DestroyInCascade($type, $parentId) {
    // Destruction définitive en cascade des réactions, réponses et commentaires actifs
    $db1 = array();
    $typechildren = array(TYP_ART=>TYP_REACT, TYP_BLOG=>TYP_REBLOG);
    switch ($type) {
    case TYP_ART :
    case TYP_BLOG :
        $db1 = SelectDBFieldsByField(SelectDBFieldsByField(ReadDBFields(CHILDREN),1, $typechildren[$type]), 3, $parentId);
        foreach ($db1 as $db) {
            ActionOnFields('sup', array($typechildren[$type], $db[0]), FALSE);
        }
        break;
    case TYP_FORUM :
        global $fielda1, $fielda2;
        if (0 == $fielda2) {
            $db1 = SelectDBFieldsByField(SelectDBFieldsByField(ReadDBFields(CHILDREN),1, $type), 3, $fielda1);
            foreach ($db1 as $db) {
                ActionOnFields('sup', array($type, $db[0]), FALSE);
            }
        }
        break;
    }
    if (count($db1) > 0) {
        ActionOnFields('reindex', array($type, 0));
    }
}
	
function CreateSitemapFile($file, $db) {
	global $charset;
	$smtxt = '<?xml version="1.0" encoding="'.$charset.'"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
	foreach($db as $url) {
		$smtxt .= '
  <url>
    <loc>'.$url['LOC'].'</loc>
    <lastmod>'.$url['LM'].'</lastmod>
    <changefreq>'.$url['CF'].'</changefreq>
    <priority>'.$url['PR'].'</priority>
  </url>';
	}
	$smtxt .= '
</urlset>';
	WriteFullDB($file, $smtxt);
}

function UpdateSitemaps($typ) {
	global $lang, $site, $urlrw, $sitemap, $charset, $z2, 
	$type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1,
	$fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
	
	$smtyps  = array(TYP_BLOG, TYP_ART, TYP_NEWS, TYP_PHOTO, TYP_DNLOAD, TYP_FAQ, TYP_LINKS, TYP_GUESTBK, TYP_FORUM, TYP_AGENDA);
    $smfiles = array(TYP_BLOG=>SM_BLOG, TYP_ART=>SM_ART, TYP_NEWS=>SM_NEWS, TYP_PHOTO=>SM_PHOTO, TYP_DNLOAD=>SM_DNLOAD, 
                     TYP_FAQ=>SM_FAQ, TYP_LINKS=>SM_LINKS, TYP_GUESTBK=>SM_GUESTBK, TYP_FORUM=>SM_FORUM, TYP_AGENDA=>SM_AGENDA);
	
    if (!in_array($typ, array_merge($smtyps, array('URLS', 'NONE')))) return;
	
	if ($typ == 'NONE') {
        @unlink(SITEMAPS);
        foreach($smtyps as $smtyp) @unlink($smfiles[$smtyp]);
        @unlink(SM_URLS);
    }
    
	$dbws = array();
	if ($sitemap['SM'] == 'on') {
		$home = array('index.php?lng='.$lang[0], ($lang[1] != '' ? 'index.php?lng='.$lang[1] : NULL));
		$urls = file_exists(MAPSURLS) ? array_merge(file(MAPSURLS), $home) : $home;
		
		$smslcts = array(TYP_BLOG=>$sitemap['BL'], TYP_ART=>$sitemap['AR'], TYP_NEWS=>$sitemap['NE'], TYP_PHOTO=>$sitemap['PH'], TYP_DNLOAD=>$sitemap['DN'], 
		                 TYP_FAQ=>$sitemap['FA'], TYP_LINKS=>$sitemap['LI'], TYP_GUESTBK=>$sitemap['GB'], TYP_FORUM=>$sitemap['FR'], TYP_AGENDA=>$sitemap['AG']);
		$smfreqs = array(TYP_BLOG=>'weekly', TYP_ART=>'monthly', TYP_NEWS=>'weekly', TYP_PHOTO=>'monthly', TYP_DNLOAD=>'monthly', 
		                 TYP_FAQ=>'yearly', TYP_LINKS=>'monthly', TYP_GUESTBK=>'monthly', TYP_FORUM=>'daily', TYP_AGENDA=>'monthly');
		
		foreach($smtyps as $smtyp) if ($smslcts[$smtyp] != 'on') @unlink($smfiles[$smtyp]);

		$dbw = array();
		foreach($urls as $url) {
		if ($url != '')
			{
				$url = str_replace('&amp;', '&', $url);
				$url = str_replace('&', '&amp;', $url);
				$dbw[] = array('LOC'=>$site[3].$url, 'LM'=>date('Y-m-d'), 'CF'=>'yearly', 'PR'=>'0.5');
			}
		}
		CreateSitemapFile(SM_URLS, $dbw);
		
		foreach($smtyps as $smtyp) {
			if ($typ != $smtyp || $smslcts[$smtyp] != 'on') continue;
			$dbw  = array();
			$docs = SelectDBFields($smtyp, 'a', '');
			foreach ($docs as $doc) {
				ReadDoc($doc[1]);
				if ($typ == TYP_FORUM && $fielda2 != '0') continue;
				$fieldmail = (empty($fieldmail) ? 0 : $fieldmail);
				if (isAuthorizedPublication($creadate) && $fieldmod == '') {
					foreach($lang as $lng) {
						if ($lang[1] == $lng && ($fieldc2 == '' || in_array(array(TYP_GUESTBK, TYP_FORUM), $smtyps))) continue;
						switch ($smtyp) {
						case TYP_BLOG    : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[1].'-4-'.$fileid.$z2 
                          : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2);
                          break;
						case TYP_ART     : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[20].'-102-'.$fileid.'-'.$fieldmail.$z2 
                          : 'articles.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$fieldmail.$z2);
                          break;
						case TYP_NEWS    : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[8].'-2-'.$fileid.$z2 
                          : $site['NE'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2);
                          break;
						case TYP_PHOTO   : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[9].'-2-'.$fileid.'-'.$fieldmail.$z2 
                          : 'photorama2.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$fieldmail.$z2);
                          break;
						case TYP_DNLOAD  : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[11].'-4-'.$fileid.'-'.$fieldmail.$z2 
                          : $site['DN'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$fieldmail.$z2);
                          break;
						case TYP_FAQ     : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[4].'-3-'.$fileid.$z2 
                          : 'faq.php?lng='.$lng.'&amp;pg='.$fileid.$z2);
                          break;
						case TYP_LINKS   : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[6].'-1-'.$fileid.$z2 
                          : 'links.php?lng='.$lng.'&amp;pg='.$fileid.$z2);
                          break;
						case TYP_GUESTBK : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[7].'-3-'.$fileid.$z2 
                          : $site['GB'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2);
                          break;
						case TYP_FORUM   : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[5].'-500-'.$fileid.'-'.$fielda1.'-1'.$z2 
                          : $site['TH'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;cat='.$fielda1.'&amp;fid=1'.$z2);
                          break;
						case TYP_AGENDA  : $smloc = ($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[17].'-22-'.$fileid.'-'.$fileid.'-1-'.$fieldmail.$z2 
                          : 'agenda.php?lng='.$lng.'&amp;idpg='.$fileid.'-'.'&amp;pg='.$fileid.'&amp;agv=1&amp;tconfig='.$fieldmail.$z2);
                          break;
						}
						$dbw[] = array(
							'LOC'=>$site[3].$smloc, 
							'LM'=>substr($moddate, 0, 4).'-'.substr($moddate, 4, 2).'-'.substr($moddate, 6, 2), 
							'CF'=>$smfreqs[$smtyp], 'PR'=>'0.5');
					}
				}
			}
			if (!empty($dbw)) CreateSitemapFile($smfiles[$smtyp], $dbw); else @unlink($smfiles[$smtyp]);
		}
        $len = strlen(CHEMIN);
		if (file_exists(SM_URLS))    $dbws[] = array('LOC'=>substr(SM_URLS, $len), 'LM'=>date('Y-m-d', filemtime(SM_URLS)));
		if (file_exists(SM_BLOG))    $dbws[] = array('LOC'=>substr(SM_BLOG, $len), 'LM'=>date('Y-m-d', filemtime(SM_BLOG)));
		if (file_exists(SM_ART))     $dbws[] = array('LOC'=>substr(SM_ART, $len), 'LM'=>date('Y-m-d', filemtime(SM_ART)));
		if (file_exists(SM_NEWS))    $dbws[] = array('LOC'=>substr(SM_NEWS, $len), 'LM'=>date('Y-m-d', filemtime(SM_NEWS)));
		if (file_exists(SM_PHOTO))   $dbws[] = array('LOC'=>substr(SM_PHOTO, $len), 'LM'=>date('Y-m-d', filemtime(SM_PHOTO)));
		if (file_exists(SM_DNLOAD))  $dbws[] = array('LOC'=>substr(SM_DNLOAD, $len), 'LM'=>date('Y-m-d', filemtime(SM_DNLOAD)));
		if (file_exists(SM_FAQ))     $dbws[] = array('LOC'=>substr(SM_FAQ, $len), 'LM'=>date('Y-m-d', filemtime(SM_FAQ)));
		if (file_exists(SM_LINKS))   $dbws[] = array('LOC'=>substr(SM_LINKS, $len), 'LM'=>date('Y-m-d', filemtime(SM_LINKS)));
		if (file_exists(SM_GUESTBK)) $dbws[] = array('LOC'=>substr(SM_GUESTBK, $len), 'LM'=>date('Y-m-d', filemtime(SM_GUESTBK)));
		if (file_exists(SM_FORUM))   $dbws[] = array('LOC'=>substr(SM_FORUM, $len), 'LM'=>date('Y-m-d', filemtime(SM_FORUM)));
		if (file_exists(SM_AGENDA))  $dbws[] = array('LOC'=>substr(SM_AGENDA, $len), 'LM'=>date('Y-m-d', filemtime(SM_AGENDA)));
		if (!empty($dbws)) {
			$smtxt = '<?xml version="1.0" encoding="'.$charset.'"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
			foreach($dbws as $sm) {
				$smtxt .= '
  <sitemap>
    <loc>'.$site[3].$sm['LOC'].'</loc>
    <lastmod>'.$sm['LM'].'</lastmod>
  </sitemap>';
			}
			$smtxt .= '
</sitemapindex>';
			WriteFullDB(SITEMAPS, $smtxt);
		}
 	}
	if (file_exists(CHEMIN.'robots.txt')) {
		$robots = file(CHEMIN.'robots.txt');
		$dbr    = array();
		foreach($robots as $line)
			if (substr($line, 0, 8) != 'Sitemap:') $dbr[] = $line;
		if (!empty($dbws)) $dbr[] = 'Sitemap: '.$site[3].substr(SITEMAPS, 3);
		$rh = fopen(CHEMIN.'robots.txt', 'w');
		foreach($dbr as $line) fwrite($rh, $line);
		fclose($rh);
	}
}

function ActionOnFields($action, $data, $reindex = TRUE) {
    global $site,$type,$fileid,$status,$creadate,$moddate,$author,$email,
    $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldc1,$fieldc2,$fieldd1,$fieldd2,
    $fieldweb,$fieldmail,$fieldmod;
	$id = ($action == 'reindex' ? false : $data[AOF_ID]);
    switch ($action) {
    case 'add'  :
    case 'migr' :
        $id = $data[AOF_ID] = IncrNextID();
        AppendDBFields(DOCID, array($data[AOF_TYPE], $id, $data[AOF_STATUS]));
        UpdateDocFromInput($action, $id, $data);
        UpdateDocdates($action, $id, $data[4], $data[3]);
        UpdateChildren($action, $data);
        break;
    case 'mod' :
        UpdateDocFromInput($action, $id, $data);
        UpdateDocdates($action, $id, $data[4], $data[3]);
        break;
    case 'act' :
        UpdateDocid($data[AOF_ID], $data[AOF_STATUS]);
        UpdateDocFromDoc($action, $id, $data[AOF_STATUS]);
        if ('i' == $data[AOF_STATUS]) {
            DeactivateInCascade($data[AOF_TYPE], $id);
        }
        break;
    case 'del' :
        UpdateDocid($id, 'd');
        UpdateDocFromDoc($action, $id, 'd');
        UpdateDocdates($action, $id);
        DeleteInCascade($data[AOF_TYPE], $id);
        break;
    case 'sup' :
        ReadDoc($id);
        DestroyDBFile(DBBASE.TestFileId($id).INCEXT);
        DestroyDBFile(DBBASE.TestFileId($id).DBEXT);
        DestroyDBFile(DBIPBASE.TestFileId($id).DBEXT);
        $dbdocid = IndexDbFieldsByField(ReadDBFields(DOCID), 1);
        unset($dbdocid[$id]);
        WriteDBFields(DOCID, $dbdocid);
        $dbdates = IndexDbFieldsByField(ReadDBFields(DOCDATES), 0);
        unset($dbdates[$id]);
        WriteDBFields(DOCDATES, $dbdates);
        $dbchild = IndexDbFieldsByField(ReadDBFields(CHILDREN), 0);
        unset($dbchild[$id]);
        WriteDBFields(CHILDREN, $dbchild);
        DestroyInCascade($data[AOF_TYPE], $id);
		if ($data[AOF_TYPE] == TYP_ART) DestroyKeywords($id);
        break;
    }
    if ($reindex) {
        switch ($data[0]) {
        case TYP_LINKS     :
        case TYP_PHOTO     :
        case TYP_FAQ       :
        case TYP_DNLOAD    :
        case TYP_RSS       :
        case TYP_BSS       :
        case TYP_AGENDA    :
        case TYP_FREEBOX   :
        case TYP_MENUBOX   :
        case TYP_OPTMENU   :
        case TYP_DDMENUBOX :
        case TYP_OPTDDMENU :
        case TYP_MENUICO   :
		case TYP_SOCNET    :
        case TYP_BRUB      :
            UpdateDBdtb($data[0]);
            break;
        case TYP_ART :
            UpdateDBdtb($data[0]);
            include_once CHEMIN.INCREP."funcrss.php";
            UpdateRSSart();
			UpdateRSSall();
            break;
        case TYP_BLOG :
            UpdateDBdtb($data[0]);
            include_once CHEMIN.INCREP."funcrss.php";
            UpdateRSSblog();
			UpdateRSSall();
            break;
        case TYP_NEWS :
            UpdateDBdtb($data[0]);
            include_once CHEMIN.INCREP."funcrss.php";
            UpdateRSSnews();
			UpdateRSSall();
            break;
        case TYP_REACT :
            UpdateDBreact($action, $id);
            break;
        case TYP_REBLOG :
            UpdateDBreblog($action, $id);
            break;
        case TYP_FORUM :
        case TYP_THREAD :
            UpdateDBforum($action, $id);
            break;
        }
		UpdateSitemaps($data[0]);
    }
    return $id;
}

function InitDBlog($typ) {
    global $site;
    $db = array();
    date_default_timezone_set('UTC');
    switch ($typ) {
    case 1  : $db[0] = array(date('H'), 'H', date('Y-m-d-H '));  break;
    case 12 : $db[0] = array(date('Y'), 'Y', date('Y'));         break;
    case 24 : $db[0] = array(date('D'), 'D', date('Y-m-d'));     break;
    case 31 : $db[0] = array(date('M'), 'M', date('Y-m'));       break;
    default : $db[0] = array(0,         '?', date('Y-m-d-H-i')); break;
    }
    date_default_timezone_set($site['TZ']);
    $db[1] = array_pad(array(), STATS_NBPAGE, 0);
    $db[2] = array_pad(array(), STATS_NBLANGUE, 0);
    $db[3] = array_pad(array(), STATS_NBBROWSER, 0);
    $db[4] = array_pad(array(), STATS_NBOS, 0);
    $db[5] = array_pad(array(), $typ, 0);
    $db[6] = array_pad(array(), $typ, 0);
    $db[7] = array(1);
    return $db;
}

function SaveOldDbLog($db) {
    global $statscfg;
	if (!empty($db[0][1])) {
		switch ($db[0][1]) {
		case 'D' :
		case 'M' :
			if ($statscfg[$db[0][1]] == 'on') {
				WriteDbFields(OLDSSTATSREP.$db[0][2].DBEXT, $db);
			}
			break;
		case 'Y' :
			if ($statscfg[$db[0][1]] == 'on') {
				WriteDbFields(OLDSSTATSREP.$db[0][2].DBEXT, $db);
				$last = substr($db[0][2], 0, 4) - $statscfg['NBY'];
				$files = ExploreFile(OLDSSTATSREP);
				foreach ($files as $file) {
					if (substr($file, 0, 4) <= $last) {
						DestroyDbFile(OLDSSTATSREP.$file);
					}
				}
			}
			break;
		}
	}
}

function sendmail($eTo, $eFrom ,$objet, $contenu, $piece_jointe, $actioncomplete, $destcopy, $eAR = '', $eReply = '', $form1 = '') {  

	global $lang, $lng, $smtp, $user, $charset, $phpmailer, $fdest, $fname, $f2name, $supervision;
	// on crée une nouvelle instance de la classe
	$phpmailer = new PHPMailer(true);
	// puis on l’exécute avec un 'try/catch' qui teste les erreurs d'envoi
  try {
	/* DONNEES SERVEUR */
	#####################

	$phpmailer->setLanguage($lng, 'PHPMailer/language/');   // pour avoir les messages d'erreur en FR
	$phpmailer->SMTPDebug = 0;            // en production (sinon "2")
	if ($smtp[6] == 'on') 
		$phpmailer->SMTPDebug = 2;
	$phpmailer->Debugoutput = function($str, $level) {
	$datjourl = new DateTime('now');
	$dateheureminiutesecl = $datjourl->format('Y_m_d_H');
	$nomficlog = CHEMIN.'data/log/smtp'.'_'.$dateheureminiutesecl.'.log';
	file_put_contents($nomficlog, date('Y-m-d H:i:s'). "\t$level\t$str\n", FILE_APPEND | LOCK_EX);
	};																				   

	$phpmailer->isSMTP();                                                            // envoi avec le SMTP du serveur
	$phpmailer->CharSet    = $charset;
	$phpmailer->Host       = $smtp[0];                          // Serveur Smtp  / sets SMTP server
	$phpmailer->SMTPSecure = $smtp[2];                          // sets the prefix to the server ('', ssl, tls)
	$phpmailer->SMTPAuth   = $smtp[1] == 'on' ? true : false;   // enable SMTP authentication
	$phpmailer->Port       = $smtp[3];                          // N° de port 25 par défaut / set the SMTP port
	$phpmailer->Username   = $smtp[4]; 
	$phpmailer->Password   = gy_decrypt(CRYPT_KEY, $smtp[5]);	// Votre adresse mail / MAIL adress 
	$phpmailer->setFrom($eFrom);  
    if ($eAR != '')
	{
			if ($actioncomplete == 'C')
				$phpmailer->addCustomHeader("Disposition-Notification-To: $eReply");	
			else
				$phpmailer->addCustomHeader("Disposition-Notification-To: $eFrom");	
	}
 	if (!empty($eReply))
	{
		$verifpos = strrpos($eReply, "<");
		$pseudo = '';
		if (strlen($verifpos) !=0)
		{
			$adressemailetpseudo2 = substr($eReply, strripos($eReply, "<") + 1);
			$adressemail = substr($adressemailetpseudo2, 0, strrpos($adressemailetpseudo2, ">"));
			$pseudo = substr($eReply, 0, strrpos($eReply, "<"));
			$phpmailer->AddReplyTo($adressemail,$pseudo);
		}	
		else
			if ($form1 != '')	
				$phpmailer->AddReplyTo($eReply, $form1);
			else
				$phpmailer->AddReplyTo($eReply);
	}
	/* DONNEES DESTINATAIRES */
	##########################

	$fnom = '';
	$fmail0 = '';
	if ($actioncomplete == 'M' || $actioncomplete == 'C' || $actioncomplete == 'E')  // M Pour les plugins ou  E pour emailhtmlto function avec destinataire en autres demandes
	{
		if ($destcopy != '')
		{
			$allCC    = explode(' ', trim($destcopy));
			$nbrencopy = count($allCC);
			for ($i = 0; $i < $nbrencopy; $i++)
			{
				$phpmailer->addCC($allCC[$i]); 
			}
		}
	}
	$allCC    = explode(' ', trim($eTo));
	$nbrencopy = count($allCC);
	if (count($allCC) > 1)
	{
		for ($i = 0; $i < $nbrencopy; $i++)
		{
			$phpmailer->addAddress($allCC[$i]); 
		}
			

	}
	else
	{
		$phpmailer->AddAddress(trim($eTo));
	}
	/* PIECES JOINTES */
	##########################
	if ($piece_jointe != '')
	{
		$nomfichier = explode(' ',$piece_jointe);
		for ($i=0; $i < count($nomfichier)-1; $i++)
		{
			$phpmailer->addAttachment('fic/'.$nomfichier[$i]);         // Pièces jointes en gardant le nom du serveur
		}
	}

	/* CONTENU DE L'EMAIL*/
	##########################
	$phpmailer->isHTML(true);                                      // email au format HTML
	$phpmailer->Subject = utf8_decode($objet);      // Objet du message (éviter les accents là, sauf si utf8_encode)
	$phpmailer->Body    = $contenu;          // corps du message en HTML - Mettre des slashes si apostrophes
	// $phpmailer->AltBody = 'Contenu au format texte pour les clients e-mails qiui ne le supportent pas'; // ajout facultatif de texte sans balises HTML (format texte)
    $phpmailer->send();
 
  }
  // si le try ne marche pas > exception ici
  catch (Exception $e) {
    return false;
  }  
} // fin de la fonction sendmail   

function eMailTo($eSubject, $eMessage, $eTo)  {
	global $lng, $lang, $supervision, $user, $charset, $smtp, $actioncomplete;
    eMailHtmlTo($eSubject, "", $eTo, "", $eMessage);
}

function eMailHtmlTo($eSubject, $eMsgHtml, $eTo = '', $eFrom = '', $eMsgTxt = '', $eReply = '')  {
    global $lng, $lang, $supervision, $user, $charset, $smtp, $actioncomplete;
    if (empty($eFrom)) $eFrom = trim($user[1]);
    $eFromF = $eFrom;
    $FromTo = $user[0];
    if ($eMsgTxt == '') {
        $eMsgText = strip_tags(preg_replace("!<br />|<br />|</p>!i", "\n", preg_replace("!<hr>|<hr />!i", "\n \n", $eMsgHtml)));
    }
    if ($eMsgHtml == '') {
        $eMsgHtml = str_replace("\n", "<br />", str_replace("\n \n", "<hr />", $eMsgTxt));
    }

    $eSubject      = strtr($eSubject, array('à'=>'a', 'é'=>'e', 'è'=>'e', 'ê'=>'e', 'ë'=>'e', 'î'=>'i', 'ï'=>'i', 'ô'=>'o', 'û'=>'u', 'û'=>'u'));
    $eSubject      = preg_replace('![^-a-zA-Z0-9_ ]!i', '.', $eSubject);

	$allTo = ($eTo == '' ? explode(' ', $user[1].' '.trim($supervision[10])) : explode(' ', $eTo));
	$allTo = array_unique($allTo);
    $eTo   = (count($allTo) > 0 ? $allTo[0] : $user[1]);
    $cque  = '';
    foreach ($allTo as $adr) if ($adr != $eTo) $cque .= $adr.' ';
    $eAR = '';
	if (!isset($actioncomplete)) $actioncomplete = 'L';
	$efilesattaches = '';
	$destinataireencopy = $cque;
	if ($destinataireencopy != '') $actioncomplete = 'E';
    sendmail($eTo, $eFrom,$eSubject, $eMsgHtml, $efilesattaches, $actioncomplete, $destinataireencopy, $eAR, $eReply);
}

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;
    $starttime = microtime(TRUE);
}

function StopTimer() {
    global $starttime;
    return round ((microtime(TRUE) - $starttime), 2);
}

function MakeSeed() {
    return microtime(TRUE);
}

function GenerateUID() {
	$lolo = array(1=>'abcdefghijklmnopqrstuvwxyz',2=>'ABCDEFGHIJKLMNOPQRSTUVWXYZ',3=>'0123456789',4=>'-*€£§@{}[](),.;!:_°µ|éèçàù');
    $sequ = array(1, 2, 4, 3, 3, 4, 1, 1, 2, 3);
    $len  = array(1=>26, 2=>26, 3=>10, 4=>26);
	$newUID = '';
//    srand((int)microtime()*1000000);
	srand((double)microtime(true)*1000000);
    foreach ($sequ as $seq) {
        $rand = rand(0, $len[$seq] - 1);
        $newUID .= ($seq == 4 && ord($lolo[$seq][$rand]) > 127 ? ':' : $lolo[$seq][$rand]);
    }
    return $newUID;
}

function KeepGoodChars($textin) {
    $textin  = strtr($textin, array(' '=>'_', 'à'=>'a', 'é'=>'e', 'è'=>'e', 'ê'=>'e', 'ë'=>'e', 'î'=>'i', 'ï'=>'i', 'ô'=>'o', 'û'=>'u', 'û'=>'u'));
    $textout = preg_replace("![^-a-zA-Z0-9_]!i","",$textin);
    return $textout;
}

function ValUnique($tableau) {
    if (empty($tableau)) return array();
    for ($i = 0, $n = count($tableau); $i < $n; $i++) {
        $NewTableau[$tableau[$i]] = 1;
    }
    @reset($NewTableau);
	$KeyUnique = array();
    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,
    $ancre = '',
    $imgBegin = '',
    $imgPrev = '',
    $imgNext = '',
    $imgEnd = '',
    $imgBeginN = '',
    $imgPrevN = '',
    $imgNextN = '',
    $imgEndN = '',
    $imgMinus = '',
    $imgPlus = '',
    $decade = 10,
	$tri = ''
    )
{
    global  $page, $site, $lng, $web, $serviz, $aml, $wbm;
	if (!is_numeric($currentPage))    $currentPage = 1;
	if (!is_numeric($decade))    $decade = 10;
    if (empty($web)) include_once CHEMIN.INCREP.'lang/'.$lng.'-web'.INCEXT;
    $out = $txtPrevPage = $txtSuivPage = '';
    if ($maxItem > $nbItemPage) {
        $imgBegin  = (empty($imgBegin)  ? '<i class="fas fa-angle-double-left cur" title="'.$web[339].'"></i>' 
                                        : '<img src="'.$imgBegin.'" alt="'.$web[339].'" title="'.$web[339].'" />');
        $imgPrev   = (empty($imgPrev)   ? '<i class="fas fa-angle-left cur" title="'.$web[32].'"></i>' 
                                        : '<img src="'.$imgPrev.'" alt="'.$web[32].'" title="'.$web[32].'" />');
        $imgNext   = (empty($imgNext)   ? '<i class="fas fa-angle-right cur" title="'.$web[34].'"></i>' 
                                        : '<img src="'.$imgNext.'" alt="'.$web[34].'" title="'.$web[34].'" />');
        $imgEnd    = (empty($imgEnd)    ? '<i class="fas fa-angle-double-right cur" title="'.$web[338].'"></i>' 
                                        : '<img src="'.$imgEnd.'" alt="'.$web[338].'" title="'.$web[338].'" />');
        $imgBeginN = (empty($imgBeginN) ? '<i class="fas fa-angle-double-left curN"></i>' 
                                        : '<img src="'.$imgBeginN.'" alt="'.$web[339].'" />');
        $imgPrevN  = (empty($imgPrevN)  ? '<i class="fas fa-angle-left curN"></i>' 
                                        : '<img src="'.$imgPrevN.'" alt="'.$web[32].'" />');
        $imgNextN  = (empty($imgNextN)  ? '<i class="fas fa-angle-right curN"></i>' 
                                        : '<img src="'.$imgNextN.'" alt="'.$web[34].'" />');
        $imgEndN   = (empty($imgEndN)   ? '<i class="fas fa-angle-double-right curN"></i>' 
                                        : '<img src="'.$imgEndN.'" alt="'.$web[338].'" />');
        $imgMinus  = (empty($imgMinus)  ? '<i class="far fa-minus-square imgMinusW" title="'.$txtPrevPage.'"></i>' 
                                        : '<img src="'.$imgMinus.'" alt="'.$txtPrevPage.'" title="'.$txtPrevPage.'" class="imgMinusW" />');
        $imgPlus   = (empty($imgPlus)   ? '<i class="far fa-plus-square imgPlusW" title="'.$txtSuivPage.'"></i>' 
                                    : '<img src="'.$imgPlus.'" alt="'.$txtSuivPage.'" title="'.$txtSuivPage.'" class="imgPlusW" />');
        $nbPage = ($nbItemPage > 0 ? (ceil($maxItem/$nbItemPage)) : 1);
        $out .= '<div class="text-center">';
        $out .= '<div class="table-responsive-md"><table class="text-center m-auto"><tr>';
        if ($currentPage > 1) {
            $out .= '<td class="px-2 navbarLeftW"><a href="'.$url.'1'.$ancre.'">'.$imgBegin.'</a></td>';
            $out .= '<td class="px-2 navbarLeftW"><a href="'.$url.($currentPage-1).$ancre.'">'.$imgPrev.'</a></td>';
        }
        else {
            $out .= '<td class="px-2 navbarLeftW">'.$imgBeginN.'</td>';
            $out .= '<td class="px-2 navbarLeftW">'.$imgPrevN.'</td>';
        }
        $out .= '<td class="px-3 navbarLeftW">';
        $nbpg = 1;
        $pgDebut = (int)floor((float)($currentPage / $decade)) * $decade;
        $pgFin = (int)ceil((float)($currentPage / $decade)) * $decade;
        if ($pgDebut == $pgFin) {
            $pgDebut = $pgFin - $decade;
        }
        if ($currentPage > $pgDebut && $currentPage <= $pgFin) {
            $decadeDebut = $pgDebut;
            $decadeFin   = $pgFin;
            $paq = ($nbPage >= $decadeFin ? $decade : $nbPage - $decadeDebut);
        }
        if ($currentPage > $decade && $decadeDebut < $nbPage) {
            if ($nbPage - $decade + $decadeFin > $decade) {
                $nbPrevPage = $decade;
            }
            else {
                $nbPrevPage = $nbPage - $decade + $decadeFin;
            }
            if ($nbPrevPage > 1) {
                $txtPrevPage = $nbPrevPage." ".$web[340];
            }
            else {
                $txtPrevPage = $nbPrevPage." ".$web[341];
            }
            $out .= '<a href="'.$url.($currentPage + $decadeDebut - $decadeFin).$ancre.'">'.$imgMinus.'</a>';
        }
        $out .= ' [ ';
        for($i = 1; $i <= $paq; $i++) {
            if ($i + $decadeDebut <> $currentPage) {
                $out .= '<a href="'.$url.($i + $decadeDebut).$ancre.'">'.($nbpg + $decadeDebut).'</a> ';
            } else {
                $out .= '
<style>
  .currNum {
      text-decoration: underline;
      font: bold '.$page[2].' '.$page[1].';
  }
</style>
                <span class="currNum">'.($nbpg + $decadeDebut).'</span> ';
            }
            $nbpg++;
        }
        $out .= '] ';
        if($currentPage <= $decadeFin && $decadeFin < $nbPage) {
            if($nbPage - $decade - $decadeDebut > $decade) {
                $nbSuivPage = $decade;
            }
            else {
                $nbSuivPage = $nbPage - $decade - $decadeDebut;
            }
            if ($nbSuivPage > 1) {
                $txtSuivPage = $nbSuivPage." ".$web[337];
            }
            else {
                $txtSuivPage = $nbSuivPage." ".$web[336];
            }
            $out .= '<a href="'.$url.$tri.($i + $decadeDebut).$ancre.'">'.$imgPlus.'</a>';
        }
        $out .='</td>';
        if ($currentPage < $nbPage) {
            $out .= '<td class="px-2 navbarRightW"><a href="'.$url.($currentPage + 1).$ancre.'">'.$imgNext.'</a></td>';
            $out .= '<td class="px-2 navbarRightW"><a href="'.$url.$nbPage.$ancre.'">'.$imgEnd.'</a></td>';
        }
        else {
            $out .= '<td class="px-2 navbarRightW">'.$imgNextN.'</td>';
            $out .= '<td class="px-2 navbarRightW">'.$imgEndN.'</td>';
        }
        $out .= '</tr></table></div></div>';
    }
    return $out;    
}

function Formatage($format, $in) {
    $out = '';
    if (!empty($in) && !empty($format)) {
        $out = str_replace(' ', ' ', sprintf($format, $in));
    }
    return $out;
}
function Controlimport($varacontroler)
{
	global $charset, $admin;
	$varacontrole = '';	
	$handle = fopen(MOTSINTERDITS, "r");
	$size = filesize(MOTSINTERDITS);
//	$motdeniedlect  = fread($handle, filesize(MOTSINTERDITS));
	$motdenied = array();
	if ($size != false)    
	{
		$motdeniedlect  = fread($handle, filesize(MOTSINTERDITS));
		$motdenied = explode("\n", $motdeniedlect);
	}
//	$motdenied = array('alert','write','hacker.com','javascript','location','document', 'wp-', 'wp-login.php', 'php-cgi', 'allow_url', 'XSS');
//	$varacontrolerspecial = htmlspecialchars($varacontroler, ENT_QUOTES, $charset);

	$datjourl = new DateTime('now');
	$dateheureminiutesecl = $datjourl->format('Y_m_d');
	$nomficlog = CHEMIN.'data/log/controlimport'.'_'.$dateheureminiutesecl.'.log';
			
	if (is_array($varacontroler))
	{
		foreach ($varacontroler as $varacontrole2) {
			if (is_array($varacontrole2)) 
			{
				foreach ($varacontrole2 as $varacontrole3) {
					$v3 = htmlspecialchars($varacontrole3, ENT_QUOTES, $charset);
					$v3 = strip_tags($v3);
					for ($ij=0; $ij < count($motdenied); $ij++)
					{					
						$pos = strpos($v3, trim($motdenied[$ij]));
						if ($v3 == '' && $pos != false)
						{
							$v3 = $admin[20]. ' '.$motdenied[$ij];
						}
						
					}
				}
			}
			else
			{
				$varacontrole2 = htmlspecialchars($varacontrole2, ENT_QUOTES, $charset);
				$varacontrole2 = strip_tags($varacontrole2);
				for ($ij=0; $ij < count($motdenied); $ij++)
				{
					if (!empty($motdenied[$ij]))
					{
						$pos = strpos($varacontrole2, trim($motdenied[$ij]));
						if ($varacontrole2 == '' && $pos != false)
						{
							$varacontrole2 = $admin[20]. ' '.$motdenied[$ij];
						}
					}

				}
				
			}
		}
		$varacontrolerspecial = $varacontroler;
	}
	else
	{
		$varacontrolerspecial = htmlspecialchars($varacontroler, ENT_QUOTES, $charset);
		$varacontrolerspecial = strip_tags($varacontrolerspecial);
		if ($varacontrolerspecial != '' && $varacontrolerspecial != null )
		{
			for ($ij=0; $ij < count($motdenied); $ij++)
			{
				$pos = substr_count(mb_strtolower($varacontrolerspecial, $charset), mb_strtolower(trim($motdenied[$ij]), $charset));
				if ($varacontrolerspecial != '' && $pos != 0)
				{
					$varacontroler = $admin[20]. ' '.$motdenied[$ij];;
				}
				
			}
		}
	}
	return $varacontroler;
}
function import($name, $origine = '', $striptags = TRUE, $value='') {
    switch ($origine) {
    case 'POST' :
        $var = (isset($_POST[$name]) ? (empty($_POST[$name]) && $value != '' ? $value : $_POST[$name]) : $value);
        break;
    case 'GET':
        $var = (isset($_GET[$name]) ? (empty($_GET[$name]) && $value != '' ? $value : $_GET[$name]) : $value);
        break;
    default :
        $var = (isset($_POST[$name]) 
          ? (empty($_POST[$name]) && $value != '' ? $value : $_POST[$name]) 
          : (isset($_GET[$name]) ? (empty($_GET[$name]) && $value != '' ? $value : $_GET[$name]) : $value));
    }
	if (is_array($var)) $striptags = TRUE;

    if (is_array($var) && $striptags) {
        foreach ($var as &$v1) {
            if (is_array($v1)) {
                foreach ($v1 as $v2) {
                    if (is_array($v2)) {
                        foreach ($v2 as $v3) {
							$v3 = Controlimport($v3);
                        }
                    } else {
						$v2 = Controlimport($v2);                        
                    }
                }
            } else {
					$v1 = Controlimport($v1);                
            }
        }
        return $var;
   } else {
			if ($var != '')
			{
				$var = Controlimport($var);
				return ($striptags ? strip_tags($var) : $var);
			}
			else
				return ($var = Controlimport($var));
    }
}

function IncrNextID() {
    $nextidbk = ReadCounter(NEXTIDBK);
    $nextid   = ReadCounter(NEXTID) + 1;
    if ($nextid < $nextidbk) {
        $nextid = $nextidbk + 10;
    }
    while (file_exists(DBBASE.TestFileId($nextid).INCEXT)) {
        $nextid++;
    }
    WriteCounter(NEXTID, $nextid);
    if ($nextid > $nextidbk) {
        WriteCounter(NEXTIDBK, $nextid);
    }
    return $nextid;
}

function AsciiCompare($left, $right) {
    return @strcasecmp((string)$left, (string)$right);
}

function SearchOption($serviz_actif, $members_inactif, $typ_code, $typ_nom) {
    global $userprefs, $members;
    if (!$serviz_actif) return;
    if ($userprefs[1] != '' || $members_inactif) {
        return '
        <option value="'.$typ_code.'">'.$typ_nom.'</option>';
    }
}

function AddCHEMIN($dir) {
    if (empty(CHEMIN)) return $dir;
    $pos = strpos($dir, CHEMIN);
    if (0 === $pos) {
        return $dir;
    } else {
        return CHEMIN.$dir;
    }
}

function ExploreDir($dir) {
    $dir = AddCHEMIN($dir);
    $array = array();
    if (is_dir($dir)) {
        $dossier = opendir($dir);
        while ($fichier = readdir($dossier)) {
            if ($fichier != "." && $fichier != ".." && is_dir($dir.$fichier) ) {
                $array[] = $fichier;
            }
        }
        closedir($dossier);
    }
    sort($array);
    return $array;
}

function ExploreFile($dir) {
    $dir = AddCHEMIN($dir);
    $array = array();
    $dossier = opendir($dir);
    while ($fichier = readdir($dossier)) {
        if (is_file($dir.$fichier) && $fichier != 'index.php') {
            $array[] = $fichier;
        }
    }
    closedir($dossier);
    sort($array);
    return $array;
}

function ExploreImg($dir) {
    $dir = AddCHEMIN($dir);
    $array = array();
    $dossier = opendir($dir);
    while ($fichier = readdir($dossier)) {
        if (is_file($dir.$fichier) && $fichier != 'index.php') {
            $path_parts = basename($fichier);
            $path_parts = substr($path_parts,strrpos($path_parts,".")+1);
            if (IsImage($path_parts)) {
                $array[] = $fichier;
            }
        }
    }
    closedir($dossier);
    sort($array);
    return $array;
}

function ForceToAbsolute_callback($m) {
    global $site;
    if (preg_match('!^(http|https|ftp|mailto)s?:!', $m[2])) {
        return $m[0];
    } else {
        if (strpos('#', $m[2]) === 0 ) {
            return $m[0];
        } else {
            return $m[1].$site[3].$m[2];
        }
    }
}

function ForceToAbsolute($s) {
    $s = preg_replace_callback('!( src=")([^"]*")!', 'ForceToAbsolute_callback', $s);
    $s = preg_replace_callback('!( href=")([^"]*")!', 'ForceToAbsolute_callback', $s);
    return $s;
}

function ReadFrSigns() {
    $tmp = parse_ini_file(FRSIGNS_INI, TRUE);
    ksort($tmp);
    return $tmp;
}

function ReplaceFrSigns($sign) {
	$sign    = str_replace(array(chr(10), chr(13)), '<br />', $sign);
	$sign = str_replace('<br />', ' sautligne ', $sign);
	$listesign = explode(' ',$sign);;
    $frsigns = ReadFrSigns();
	$countsign = count($listesign);
	$codesignimage = array();
	foreach ($frsigns as $code => $frsign) 
	{
		if ('a' == $frsign['status']) 
		{
			if ('i' == $frsign['origine']) 
			{

				$codesignimage[$code] = $frsign['image'];

			}
		}
	}
	$signcomplet = '';
	for ($i=0 ; $i < $countsign; $i++)
	{
		if ($listesign[$i] != '')
		{	
			
			if (array_key_exists($listesign[$i], $codesignimage))
			{
				$codecomplet = $codesignimage[$listesign[$i]];

				$signcomplet .= '<img src="'.FRSIGNS_IMG.$codecomplet.'" alt="" title="" /> ';
			}
				else $signcomplet .= $listesign[$i].' ';
		}
	}
    $signcomplet = str_replace(' sautligne ','<br />', $signcomplet);
    return $signcomplet;
}

function SelectDBThreadByThread($Fields, $id) {
    $DataDB = array();
    foreach ($Fields as $Field) {
        if ($Field[1] == $id && $Field[2] != '0') {
            $DataDB[] = $Field;
        }
    }
    return $DataDB;
}

function SelectDBForumByID($Fields, $id) {
    $DataDB = array();
    foreach ($Fields as $Field) {
        if ($Field[2] == $id) {
            $DataDB[] = $Field;
        }
    }
    return $DataDB;
}

function SelectDBForumByCat($Fields, $cat) {
    $DataDB = array();
    foreach ($Fields as $Field) {
		$temp = explode(',', $Field[12]);
        if ($cat == $temp[0]) {
            $DataDB[] = $Field;
        }
    }
    return $DataDB;
}

function SubmitButton($title, $onclick = '', $left = '', $right = '', $typ = 'submit') {
    global $boutonleft, $boutonright;
    $onclick = (empty($onclick) ? ''           : ' onclick="'.$onclick.'"');
    $left    = (empty($left)    ? $boutonleft  : $left);
    $right   = (empty($right)   ? $boutonright : $right);
    return $left.'<button type="'.$typ.'" class="btn btn-info btn-lg submitButton" title="'.$title.'"'.$onclick.'>'.$title.'</button>'.$right;
}

function ImgSubmitButton($title, $left = '', $right = '', $background = '') {
    return $left.'" style="vertical-align:top;" alt="" />'.
'<button type="submit" style="background:transparent url('.$background.
') repeat-x;  height:22px; margin:0; padding:0; border-radius:0; cursor:pointer;" title="'.$title.'">
'.$title.'</button><img src="'.$right.'" style="vertical-align:top;" alt="" />';
}

function JavascriptFile($file) {
    return '
<script src="'.$file.'"></script>';
}

function BeginJavascript() {
    return '
<script>
';
}

function EndJavascript() {
    return '
</script>
';
}

function ExecFunctionBox($pos, $box) {
    global $lng, $lang, $members, $nom, $page, $site, $serviz, $userprefs,
        $endurl, $npage, $pgtype, $topmess, $skn_logo, $flag1, $flag2,
        $tabcounter, $plugin_admin_name, $plugin_bar_name;
    $out = FALSE;
    if (!empty($box)) {
        $temp = explode(CONNECTOR, $box);
        $incl = (isset($temp[0]) ? $temp[0] : '');
        $fnct = (isset($temp[1]) ? $temp[1] : '');
        $args = (isset($temp[2]) ? $temp[2] : '');
        if (!empty($incl) && is_file(CHEMIN.$incl.INCEXT)) {
            include_once CHEMIN.$incl.INCEXT;
        }
        if (!empty($fnct)) {
            if (empty($args)) {
                $args = array_pad(array(), 5, '');
            } else {
                $args = (FALSE === strpos($args, ',') ? array($args) : explode(',', $args));
                $args = array_pad($args, 5, '');
            }
            $out = $fnct($pos, $args);
        }
    }
    return $out;
}

function Checked($bool) {
    return ($bool ? ' checked="checked"' : '');
}

function Selected($bool) {
    return ($bool ? ' selected="selected"' : '');
}

function IsNotEmptyTitle($var) {
    global $lng, $lang;
    return ($lng == $lang[0] ? !empty($var[2]) : !empty($var[3]));
}

function BreakIRC($ircinput) {
    $ircinput = trim($ircinput);
    $idirc = explode('@', $ircinput, 2);
    $ircoutput[0] = $idirc[0];
    $idtemp = explode('.', $idirc[1], 9);
    $ircoutput[1] = $idtemp[0];
    $ircoutput[2] = $idtemp[1];
    return $ircoutput;
}
    
// Utilisé pour trouver l'ID à partir du numéro de sujet (évite les &thrd=123 remplacé par pg=234)
function GetThreadId($thrd, $file = DBTHREAD) {
    $db = ReadDBFields($file);
    foreach ($db as $dbs) {
        if ($dbs[1] == $thrd && 0 == $dbs[2]) {
            return $dbs[3];
        }
    }
    return FALSE;
}

function getThreadName($thrd) {
	$db = ReadDBFields(DBFORUM);
    foreach ($db as $dbs) {
        if ($dbs[1] == $thrd) {
            return $dbs[5];
        }
    }
    return FALSE;
}

// Utilisé pour éviter des urls contenant &cat=&id=
function GetOptionnalArg($name, $value = '') {
    if (empty($value)) return '';
    return '&amp;'.$name.'='.$value;
}

// Utilisé avec array_reduce($array , 'EstNonVide') pour savoir si le tableau est vide
function EstNonVide ($r, $i) {
    return $r && empty($i);
}

function legend($legend) {
	return '<legend class="legend">'.$legend.'</legend>';
}

function getForumCat() {
    static $db_frcat = NULL;
    if (!isset($db_frcat)) {
        $frcat = ReadDBFields(DBFORUMCAT);
        $db_frcat = array();
        foreach ($frcat as $frc) {
            if (FALSE !== strpos($frc[0], ',')) {
                $temp = explode(',', $frc[0]);
                $db_frcat[$temp[0]] = $frc;
            } else {
                $db_frcat[$frc[0]] = $frc;
            }
        }
    }
    return $db_frcat;
}

function getForumCatName($cat) {
    global $lng, $lang;
    $cat = getForumCatId($cat);
    $db_frcat = getForumCat();
    if (isset($db_frcat[$cat])) {
        return ($db_frcat[$cat][$lng == $lang[0] ? 1 : 2]);
    } else {
        return '--unknown--';
    }
}

function getForumCatFull($cat) {
    $cat = getForumCatId($cat);
    $db_frcat = getForumCat();
    if (isset($db_frcat[$cat])) {
        return $db_frcat[$cat][0];
    } else {
        return $cat;
    }
}

function getForumCatId($cat) {
    if (FALSE !== strpos((string)$cat, ',')) {
        $temp = explode(',', (string)$cat);
        $cat = $temp[0];
    }
    return $cat;
}

function AddPluginBox($label= '', $include = NULL, $function = '', $accept = 'LR', $args = '') {
    global $boxes;
    if ('' == $label || '' == $function) return FALSE;
    $boxes[] = array(
        'label' => $label,
        'include' => $include,
        'accept' => $accept,
        'function' => $function,
        'args' => $args
        );
    return TRUE;
}

function checkUserWebsiteUrl($url) {
	$url = trim($url);
	if (preg_match('/(ftp|http|https):\/\/[a-z0-9à-ö-]+(.[a-z0-9à-ö-]+)*(:[0-9]+)?(\/.*)?$/i', $url)) {
		return $url;
	}
    return 'https://';    
}

function checkEmail($email) {
    $email = trim($email);
    return (filter_var($email, FILTER_VALIDATE_EMAIL) ? $email : '');
}

function displayWriteEmail($org, $author, $email, $img='', $class='') {
	global $web, $meskin, $user;
    $lbl   = ($img == '' ? ' <b>'.addslashes($author).'</b>' : $img);
    $class = (empty($class) ? $org : $class);
    $em    = BreakEMail($email);
    $out   = '
        <a data-target="#'.$class.'" data-toggle="modal" class="'.$class.' c-pointer" title="'.$web[173].' '.$user[0].'"> '.$lbl.'</a>
      <style>
      .modal-header { padding: 15px; }
      </style>
      <div class="modal fade" id="'.$class.'" role="dialog">
        <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
          <div class="modal-content">
            <div class="modal-header">
              <h2>'.$web[173].' '.$author.'</h2>
              <button class="close" data-dismiss="modal" type="button"><i class="fas fa-times"></i></button>
            </div>
            <div class="modal-body">
              <p class="text-center popupMail">'.$web[644].'</p>
              <p class="text-center popupMail">
                <a href="javascript:showEmails'.$org.'(\''.$em[0].'\',\''.$em[1].'\',\''.$em[2].'\');" 
                   title="'.$author.'" class="text-center popupMail">'.$author.'</a>
              </p>
              <p class="text-center popupMail"><b><span id="lblemail'.$org.'">(--------------)</span></b></p>
            </div>
          </div>
        </div>
      </div>
      <script>
      function showEmails'.$org.'(em1, em2, em3) {
        var emailFinal = "<a href=\'mailto:" + em1 + "@" + em2 + "." + em3 + "\'>" + em1 + "@" + em2 + "." + em3 + "</a>";
        document.getElementById("lblemail'.$org.'").innerHTML = emailFinal;
      }
      </script>';
	return $out;
}

function getLabel($lbl, $idx=0) {
	if ($lbl == '' || $idx > 1) return '';
	$db = explode(CONNECTOR, $lbl);
	if (empty($db[$idx])) $db[$idx] = $db[0];
	return trim($db[$idx]);
}

function displayErrorMsg($label, $msg) {
	$sto = str_replace('<li>', '- ', str_replace('</li>', '\n', $msg));
	$out = '
<noscript>
  <fieldset class="bord dispError">
    <div dispError2>'.$label.'</div>
    <ul class="text-left">'.$msg.'</ul>
  </fieldset>
</noscript>'.
BeginJavascript().'
sto = "'.$label.'\n\n" + "'.$sto.'";
alert(sto);
'.EndJavascript();
	return $out;
}

function DestroyKeywords($id) {
	$db = ReadDBFields(DBKEYWORDS);
	if (!empty($db)) {
		sort($db);
		$n = count($db);
		$j = 0;
		while ($db[$j][0] != $id && $j < $n - 1) $j++;
		for ($i = $j; $i < $n; $i++) {
			if ($db[$i][0] == $id) unset($db[$i]); else break;
		}
		WriteDBFields(DBKEYWORDS, $db);
	}
}

function UpdateKeywords($pg, $t1, $t2='', $k1='', $k2='', $tc=0) {
	$t1   = strip_tags($t1);
	$t2   = strip_tags($t2);
	$k1   = (strtolower(substr($k1, -1) == ';' ? substr($k1, 0, -1) : $k1));
	$k2   = (strtolower(substr($k2, -1) == ';' ? substr($k2, 0, -1) : $k2));
    $atc  = explode('|', $tc);
	$db   = ReadDBFields(DBKEYWORDS);
	$i    = 0;
	$find = false;
	foreach ($db as $dbs) {
		if ($pg == $dbs[0]) {
			$db[$i][1] = $t1;
			$db[$i][2] = $t2;
			$db[$i][3] = $k1;
			$db[$i][4] = $k2;
			$db[$i][5] = $atc[0];
			$find      = true;
			if (trim($k1.$k2) == '') unset($db[$i]);
			break;
		}
		$i++;
	}
	if (!$find) {
		$i         = count($db);
		$db[$i][0] = $pg;
		$db[$i][1] = $t1;
		$db[$i][2] = $t2;
		$db[$i][3] = $k1;
		$db[$i][4] = $k2;
		$db[$i][5] = $atc[0];
	}
	WriteDBFields(DBKEYWORDS, $db);
}

function GetKeywords($pg) {
	global $lang, $lng, $site, $urlrw, $z2, 
	$fileid,$status,$creadate,$moddate,$author,$email,
    $fielda1,$fielda2,$fieldb1,$fieldb2,$fieldc1,$fieldc2,$fieldd1,$fieldd2,
    $fieldweb,$fieldmail,$fieldmod;
	$keywords = '';
	$dbks     = ReadDBFields(DBKEYWORDS);
	$dbw      = array();
	foreach ($dbks as $dbk) {
		if ($pg == $dbk[0]) {
			$dbw = (explode(';', ($lng == $lang[0] ? $dbk[3] : $dbk[4])));
			break;
		}
	}
	if (!empty($dbw)) {
		$dbwords = array();
		$i       = 0;
		$j       = -1;
		foreach ($dbks as $dbk) {
			if ($pg == $dbk[0]) continue;
			$kws = (explode(';', ($lng == $lang[0] ? $dbk[3] : $dbk[4])));
			foreach ($kws as $kw) {
				$dbwords[$i][0] = $kw;
				$dbwords[$i][1] = $dbk[0];
				$dbwords[$i][2] = ($lng == $lang[0] ? $dbk[1] : $dbk[2]);
				$dbwords[$i][3] = (empty($dbk[5]) ? 0 : $dbk[5]);
				$i++;
			}
		}
		sort($dbwords);
		$wexist = false;
		$words  = '';
		$i      = count($dbwords);
		foreach ($dbw as $word) {
			$kw = ' ';
			$nk = 0;
			if (!empty($dbwords)) {
				$j = 0;
				while ($dbwords[$j][0] != $word && $j < $i - 1) $j++;
				for ($k = $j; $k < $i; $k++) {
					if ($dbwords[$k][0] != $word) break;
					ReadDoc($dbwords[$k][1]);
					if (isAuthorizedPublication($creadate) && isAccessGranted($fieldmod) && $status == 'a') {
						$dbwo = ReadDBFields(DBOPTMENU);
						foreach ($dbwo as $item) {
							ReadDoc($item[4]);
							if (!isAuthorizedPublication($creadate) || !isAccessGranted($fieldmod)) continue;
							$urls = (explode('||', $lng == $lang[0] ? $fieldd1 : $fieldd2));
							$pg   = substr($urls[0], strpos($urls[0], 'pg=') + 3);
							$pos  = strpos($pg, '&');
							$pg   = ($pos === false ? $pg : substr($pg, 0, $pos));
							if ($pg == $dbwords[$k][1]) {
								$url0 = 'articles.php?lng='.$lng.'&pg='.$pg.'&mnuid='.$item[5].'&tconfig='.$fieldmail.$z2;
								$url1 = $lng.'-'.$urlrw[20].'-103-'.$pg.'-'.$item[5].'-'.$fieldmail.$z2;
								$url = ($site['URLR'] == 'on' ? $url1 : $url0);
								$kw .= '<a href="'.$url.'">'.$dbwords[$k][2].'</a><br />';
								$nk++;
								$wexist = true;
								break;
							}
						}
					}
				}
			}
			$kw = (trim($kw) != '' ? '<div>'.$kw.'</div>' : '');
			if ($nk > 5) $class = 'keyword3';
			elseif ($nk > 3) $class = 'keyword2';
			elseif ($nk > 1) $class = 'keyword1';
			else $class = 'keyword0';
			if (trim($word) != '' && $nk > 0) {
				if ($kw != '') 
					$word = '
	  <li class="dir"><span class="'.$class.'">'.$word.'</span><ul><li>'.$kw.'</li></ul></li>';
				else
					$word = '
	  <li><span class="'.$class.'">'.$word.'</span></li>';
				$words .= $word;
			}
		}
		if ($words != '')
			$keywords = '
	<ul class="keyword keyword-horizontal">
	  '.$words.'
	</ul>';
	}
	return $keywords;
}

function displayQuickConfig($pos, $id = false, $edit = '', $desact = '', $del = '', $drt = false) {
	global $lng, $page, $web, $userprefs, $serviz, $drtuser;
    $drtuser[42] = ($serviz[31] == $userprefs[1] || $serviz[176] == $userprefs[1] ? 'admin' : '');
    if (is_file(CHEMIN.'admin/'.REDACREP.$userprefs[1].INCEXT)) include CHEMIN.'admin/'.REDACREP.$userprefs[1].INCEXT;
    $isdrt  = ($drt ? (@$drtuser[$drt] == 'on') : false);
    $id     = TestFileID($id);
    if ($drtuser[42] != 'admin' && $id !== FALSE && FileDBExist(DBBASE.$id.INCEXT)) {
        include(DBBASE.$id.INCEXT);
        $temp   = explode('|', $author);
        $author = $temp[0];
        $grpc   = (isset($temp[1]) ? $temp[1] : '');
        $access = ($grpc == '' ? ($author == $userprefs[1]) : isAccessGrantedCol($grpc));
    }
    $access = true;
    if ($serviz[32] == "on" && ($drtuser[42] == 'admin' || $isdrt)) {
        $config = ($pos == BOX_EDITO ? 'config3' : 'config6');
        $img    = ($pos == BOX_EDITO ? 'cfgaccueil' : 'cfgboites');
        $txt    = ($pos == BOX_EDITO ? $web[686] : $web[689]);
        $ret = '
    <div class="float-right mr-2">';
        $ret .= (!$access || in_array($drtuser[42], array('redac1', 'redac2')) || is_null($pos) ? '' : '
      <a href="'.CHEMIN.'admin/admin.php?lng='.$lng.'&amp;pg='.$config.'&amp;selskin='.$page[14].'">
        <i class="gen-'.$img.' align-middle mr-2" title="'.$txt.'"></i>
      </a>');
        $ret .= (!$access || $edit == '' ? '' : '
      <a href="'.CHEMIN.'admin/admin.php?lng='.$lng.'&amp;pg='.$edit.'">
        <i class="far fa-edit align-middle mr-2" style="font-size: 1.4rem;" title="'.$web[308].'"></i>
      </a>');
        $ret .= (!$access || $desact == '' ? '' : '
      <a href="'.CHEMIN.'admin/admin.php?lng='.$lng.'&amp;pg='.$desact.'">
        <i class="fas fa-power-off text-danger align-middle mr-2" style="font-size: 1.4rem;" title="'.$web[333].'"></i>
      </a>');
        $ret .= (!$access || $del == '' ? '' : '
      <a href="'.CHEMIN.'admin/admin.php?lng='.$lng.'&amp;pg='.$del.'">
        <i class="fas fa-times text-danger align-middle mr-2" title="'.$web[324].'"></i>
      </a>');
        $ret .= '
    </div>';
    } else
        $ret = '';
    return $ret;
}

function getNewUpdateDoc($crea, $mod, $accept='off') {
	global $userprefs, $web, $serviz;
	if ($accept == 'off' || ($accept == 'mbr' && $userprefs[1] == '') || $serviz[135] <= 0) return '';
	$img     = '';
	$ctrlday = date('Ymdhi', strtotime('-'.$serviz[135].' day'));
	if ($mod > $crea && $mod > $ctrlday) {
        $img = 'majdoc';
        $cls = 'text-primary';
    }
	if ((intval($mod) - intval($crea)) == 0 && $crea > $ctrlday) {
        $img = 'newdoc';
        $cls = 'text-danger';
    }
	$title = ($img == 'majdoc' ? $web[196] : $web[371]);
	return (empty($img) ? '' : '<i class="fas fa-eye '.$cls.' blink align-middle" title="'.$title.'"></i>&nbsp;');
}

function setURLrewriting($mode) {
	global $urlrw, $site;
	if (!is_file(CHEMIN.'.htaccess')) return;
	$stop     = '# URL rewriting'.chr(13).chr(10);
	$htaccess = file(CHEMIN.'.htaccess');
	switch ($mode) {
	case 'on' :
		if (in_array($stop, $htaccess)) break;
		$uheader = file(CONFIGREP.'uheader.dtb');
		$urules  = file(CONFIGREP.'urules.dtb');		
		for ($i = 0; $i < count($urules); $i++) {
			$pos = strpos($urules[$i], '##');
			$st = ($pos === false ? '' : substr($urules[$i], $pos + 2));
			$st = ($st == '' ? '' : substr($st, 0, strpos($st, '##')));
			if ($st != '') $urules[$i] = str_replace('##'.$st.'##', $site[$st], $urules[$i]);
			$pos = strpos($urules[$i], '#');
			$st = ($pos === false ? '' : substr($urules[$i], $pos + 1));
			$st = ($st == '' ? '' : substr($st, 0, strpos($st, '#')));
			if ($st != '') $urules[$i] = str_replace('#'.$st.'#', $urlrw[$st], $urules[$i]);
		}
        if ($htaccess[count($htaccess) - 1] == chr(13).chr(10)) unset($htaccess[count($htaccess) - 1]);
		$htaccess = array_merge($htaccess, $uheader, $urules);
		$dir      = CONFIGREP.'rules/';
		if (is_dir($dir)) {
			$files = scandir($dir);
			if ($files !== false) {
				foreach ($files as $file) {
					$info = pathinfo($file);
					if (isset($info['extension']) && $info['extension'] == 'dtb') {
						$rules    = file($dir.$file);
						$htaccess = array_merge($htaccess, $rules);
						unset($rules);
					}
				}
				unset($allrules);
			}
		}		
		$st = '';
		foreach ($htaccess as $hta) $st .= $hta;
		$perms = substr(sprintf('%o', fileperms(CHEMIN.'.htaccess')), -4);
		SetChmod(CHEMIN.'.htaccess');
		$handle = fopen(CHEMIN.'.htaccess', 'w');
		fwrite($handle, $st);
		fclose($handle);
		SetChmod(CHEMIN.'.htaccess', $perms);
		break;
	case '' :
	case 'off' :
		if (!in_array($stop, $htaccess)) break;
		$st = '';
		foreach ($htaccess as $hta)
			if ($hta != $stop) $st .= $hta; else break;
		$perms = substr(sprintf('%o', fileperms(CHEMIN.'.htaccess')), -4);
		SetChmod(CHEMIN.'.htaccess');
		$handle = fopen(CHEMIN.'.htaccess', 'w');
		fwrite($handle, $st);
		fclose($handle);
		SetChmod(CHEMIN.'.htaccess', $perms);
		break;
	}
}

function isAuthorizedPublication($pdate) {
	if ($pdate != '')
	{
		$datespub = explode('-', $pdate);
		$datenow  = GetCurrentDateTime();
		return ($datespub[0] <= $datenow) && (empty($datespub[1]) ? true : $datespub[1] > $datenow);
	}
	else
		return true;			  
}

function GetListCollaboratorEmail($typ) {
	global $drtuser;
	$drt    = array(TYP_NEWS => 14, TYP_BLOG => 39, TYP_REBLOG => 40, TYP_GUESTBK => 22, TYP_FORUM => 23, TYP_REACT => 16);
	$drtsv  = array(TYP_NEWS => 2,  TYP_BLOG => 3,  TYP_REBLOG => 4,  TYP_GUESTBK => 5,  TYP_FORUM => 6,  TYP_REACT => 1);
    $dbcoll = array();
	$dbwork = @scandir(CHEMIN.'admin/'.REDACREP);
    foreach($dbwork as $file) {
		$info = pathinfo($file);
		if (isset($info['extension']) && $info['extension'] == 'inc') {
			$coll = $info['filename'];
            if (is_file(CHEMIN.'admin/'.REDACREP.$coll.INCEXT)) {
                include CHEMIN.'admin/'.REDACREP.$coll.INCEXT;
                if ($drtuser[$drt[$typ]] == 'on' && $drtusersv[$drtsv[$typ]] == 'on' && file_exists(MSGREP.$coll.DBEXT)) {
                    $userdb = ReadDBFields(MSGREP.$coll.DBEXT);
                    $dbcoll[] = $userdb[1][3];
                }
            }
        }
    }
	return $dbcoll;
}

function RecursiveRemoteDir($dir) {
	if (is_dir($dir)) {
		$files = scandir($dir);
		foreach ($files as $file) {
			if ($file != '.' && $file != '..') {
				if (filetype($dir.'/'.$file) == 'dir') 
					RecursiveRemoteDir($dir.'/'.$file); 
				else
					DestroyDBFile($dir.'/'.$file);
			}
		}
		reset($files);
		SetChmod($dir);
		@rmdir($dir);
	}
}

function RecursiveDeleteDir($dir, $bad = array('index.php', '.htaccess')) {
	if (is_dir($dir)) {
		$files = scandir($dir);
		foreach ($files as $file) {
			if ($file != '.' && $file != '..') {
				if (filetype($dir.'/'.$file) == 'dir') 
					RecursiveDeleteDir($dir.'/'.$file); 
				elseif (!in_array($file, $bad))
					DestroyDBFile($dir.'/'.$file);
			}
		}
		reset($files);
	}
}
function RecursiveDeleteDirComplet($dir) {
	if (is_dir($dir)) {
		$files = scandir($dir);
		foreach ($files as $file) {
			if ($file != '.' && $file != '..') {
				$path =$dir.'/'.$file; // construction du chemin du fichier
				if (is_dir($dir.'/'.$file)) 
					RecursiveDeleteDirComplet($dir.'/'.$file); 
				elseif (is_file($dir.'/'.$file))
					DestroyDBFile($dir.'/'.$file);
				@rmdir($path);
			}
		}
		reset($files);
		@rmdir($dir);
	}
}

function DeleteDir($dir, $bad = array('index.php', '.htaccess')) {
	if (is_dir($dir)) {
		$files = scandir($dir);
		foreach ($files as $file) {
			if ($file != '.' && $file != '..') {
				if (!in_array($file, $bad))
					DestroyDBFile($dir.'/'.$file);
			}
		}
		reset($files);
		
	}
}

function recursiveCopy($src, $dest) {
    $dir = @opendir($src);
    if (!is_dir($dest)) MakeDir($dest);
    while (false !== ($file = @readdir($dir))) {
        if (($file != '.') && ($file != '..') && ($file != '')) {
            if (is_dir($src.'/'.$file))
                recursiveCopy($src.'/'.$file, $dest.'/'.$file);
            else
                @copy($src.'/'.$file, $dest.'/'.$file);
        }
    }
    closedir($dir);
}

function ReplaceSpecialChars($text) {
	$chars_in  = array('$', '%', '.', '/', ':', '<', '=', '>', '?', '[', ']', '^', '{', '}');
	$chars_out = array('&#036;', '&#037;', '&#046;', '&#047;', '&#058;', '&#060;', '&#061;', '&#062;', '&#063;', '&#091;', '&#093;', '&#094;', '&#123;', '&#125;');
	return str_replace($chars_in, $chars_out, $text);
}

function SetChmod($file, $mode='') {
	global $site;
	$site['MF'] = (empty($site['MF']) ? '0644' : $site['MF']);
	$site['MD'] = (empty($site['MD']) ? '0755' : $site['MD']);
	$typ        = (is_dir($file) ? 'dir' : 'file');
	$value      = (empty($typ) || $typ == 'file' ? $site['MF'] : $site['MD']);
	$value      = (empty($mode) ? $value : $mode);
	return @chmod($file, intval($value, 8));
}

function MakeDir($dir, $mode='') {
	global $site;
	$value = (empty($site['MD']) ? '0755' : $site['MD']);
	$value = (empty($mode) ? $value : $mode);
	return @mkdir($dir, intval($value, 8));
}

function DisplayDownArrow($dynbox, $id='') {
    $rarrow = '<span class="dispArrow"'.($id == '' ? '' : ' id="Ar'.$id.'"').' title="">&#xe807;</span>';
    $uarrow = '<span class="dispArrow"'.($id == '' ? '' : ' id="Ar'.$id.'"').' title="">&#xe808;</span>';
    return ($dynbox == 'off' ? '' : ($dynbox == 'open' ? $uarrow : $rarrow));
}

function getIPadress($adress) {
    if (strstr($adress, ', ')) {
        $ips = explode(', ', $adress);
        $adress = $ips[0];
    }
    return $adress;
}

function UpdateCollaboratorPass($redac, $pass) {
	$filedroits = CHEMIN.'admin/'.REDACREP.$redac.INCEXT;
	if (!is_file($filedroits)) return false;
	@include $filedroits;
	$drtuser[38] = $pass;
    $rightsname  = $redac;
    @include CHEMIN.'admin/inc/rightsupdt'.INCEXT;
	return true;
}

function UpdateProtectMember($memb, $pass) {
    if (!is_file(CHEMIN.'data/config/.htpasswd')) return false;
    $htpasswd = @file(CHEMIN.'data/config/.htpasswd');
    $countht  = count($htpasswd);
    if ($countht >= 2) {
        $htpass = '';
        for ($i = 0; $i <= $countht; $i++) {

					$verifpos1 = strrpos($htpasswd[$i], ":");
					if (!is_numeric($verifpos1)) $verifpos1 = 0;			
					if ($verifpos1 != '0' )
					{
						$aht = explode(':', $htpasswd[$i]);
						if ($aht[0] == $memb) $htpasswd[$i] = $aht[0].':'.$pass.chr(10);
						$htpass .= $htpasswd[$i];
					}

        }
        WriteFullDB(CHEMIN.'data/config/.htpasswd', $htpass);
    }
	return true;
}
    
function DeleteMemberProtect($membprot) {
    if (!is_file(CHEMIN.'data/config/.htpasswd') || !is_file(CHEMIN.'admin/'.REDACREP.$membprot.INCEXT)) return false;
    $htpasswd = @file(CHEMIN.'data/config/.htpasswd');
    $countht  = count($htpasswd);
    $htpass   = $htpasswd[0].$htpasswd[1];
    for ($i = 2; $i < $countht; $i++) {
        $aht = explode(':', $htpasswd[$i]);
        if ($membprot != $aht[0] && !empty($htpasswd[$i])) $htpass .= $htpasswd[$i];
    }
    if (mb_substr($htpass, -1) == chr(13)) $htpass = mb_substr($htpass, 0, -1);
    if (mb_substr($htpass, -1) == chr(10)) $htpass = mb_substr($htpass, 0, -1);
    WriteFullDB(CHEMIN.'data/config/.htpasswd', $htpass);
	return true;
}

function DeleteAdmin($memb) {
    $admins  = ReadDBFields(ADMINS);
    $dbadmin = array();
    foreach ($admins as $adm) {
        if ($adm[0] != $memb) $dbadmin[] = $adm;
    }
    WriteDBFields(ADMINS, $dbadmin);
}

function ctrlPasswordOK($pwd) {
	$pwd = strip_tags($pwd);
	if (strlen($pwd) < 8) return false;
    return (1 == preg_match('/^\S{8,40}$/', $pwd) ? true : false);
}

function getPGTXT($stxt='') {
    $txt = '';
    while(!empty($stxt)) {
        $pos0 = mb_strpos($stxt, '<pre class=');
        $pos1 = mb_strlen($stxt);
        $txt0 = htmlspecialchars_decode(mb_substr($stxt, 0, ($pos0 !== false ? $pos0 : $pos1)));
        if (!empty($txt0)) {
            $simg = $txt0;
            $txt1 = '';
            while(!empty($simg)) {
                $sp0 = mb_strpos($simg, '<img');
                $sp1 = mb_strlen($simg);
                if ($sp0 !== false) {
                    $sp1  = mb_strpos(mb_substr($simg, $sp0), '>');
                    $img  = mb_substr($simg, $sp0, $sp1 + 1);
                    $txt0 = (preg_match('!https?://|ftps?://|www.!', $img) ? str_replace($img, '', $txt0) : $txt0);
                }
                $simg = trim(mb_substr($simg, $sp1 + 1));
            }
        }
        $txt .= $txt0;
        if ($pos0 !== false) {
            $pos1 = mb_strpos($stxt, '</pre>') + 6;
            $txt .= mb_substr($stxt, $pos0, $pos1 - $pos0);
        }
        $stxt = trim(mb_substr($stxt, $pos1));
    }
    return $txt;
}

function isAuthorImg($pseudo) {
    global $serviz;
    switch ($serviz[175]) {
    case 0 : return false; break;
    case 1 : return true; break;
    case 2 : return !empty($pseudo); break;
    case 3 : 
        if ($pseudo == $serviz[31] || $pseudo == $serviz[176]) return TRUE;
        if ($serviz[42] == 'on') {
            static $admins = null;
            if (!isset($admins)) $admins = ReadDBFields(ADMINS);
            foreach ($admins as $admin) if (($pseudo != '' && $admin[0] != '') && $pseudo == $admin[0]) return TRUE;
        }
        break;
    }    
    return FALSE;
}

function gy_crypt($key, $str) {
	$key    = md5($key);
	$letter = -1;
	$new    = '';
	$strlen = strlen($str);
	for ($i = 0; $i < $strlen; $i++) {
		$letter++;
		if ($letter > 31) $letter = 0;
		$neword = ord($str[$i]) + ord($key[$letter]);
		if ($neword > 255) $neword -= 256;
		$new .= chr($neword);
	}
	return base64_encode($new);
}

function gy_decrypt($key, $str) {
	$key    = md5($key);
	$letter = -1;
	$new    = '';
	if ($str != '')
	{
		$str    = base64_decode($str);
		$strlen = strlen($str);
		for ($i = 0; $i < $strlen; $i++) {
			$letter++;
			if ($letter > 31) $letter = 0;
			$neword = ord($str[$i]) - ord($key[$letter]);
			if ($neword < 1) $neword += 256;
			$new .= chr($neword);
		}
	}
	return $new;
}

function setRGPDdate() {
    global $userprefs, $members, $serviz, $_DOMAIN, $_SECURE;
    $userdb = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
    $userdb[1][28] = date('Ymd');
    WriteDBFields(MSGREP.$userprefs[1].DBEXT, $userdb);
    $userprefs[27] = $userdb[1][28];
    $userdata = '';
    for ($i = 0; $i < count($userprefs); $i++) {
        $stri      = sprintf("%02d", $i);
        $strlen    = (empty($userprefs[$i]) ? '03' : sprintf("%02d", strlen($userprefs[$i])));
        $userdata .= ($stri.$strlen.(empty($userprefs[$i]) ? 'off' : $userprefs[$i]));
    }
//    $usertime = (!empty($members[21]) ? intval($members[21]) : 157680000);
//   $expires  = ((is_file(CHEMIN.'admin/'.REDACREP.$userprefs[1].INCEXT) || $userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176]) 
//      ? 157680000 : $usertime);
 //avant   @setcookie(USER_COOKIE, gy_crypt(CRYPT_KEY, $userdata), time() + $expires, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
	@setcookie(USER_COOKIE, gy_crypt(CRYPT_KEY, $userdata), strtotime( '+365 days' ), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);	
}

function OK_RGPD_date($user='') {
    if (empty($user)) return false;
    if (!is_file(MSGREP.$user.DBEXT)) return false;
	$userdb = ReadDBFields(MSGREP.$user.DBEXT);
    if (empty($userdb[1][28])) return false;
//    $diff = (int)date('Ymd') - (int)substr($userdb[1][28], 0, 8);
	$origin = date_create((int)substr($userdb[1][28], 0, 8));
	$target = date_create((int)date('Ymd'));
	$diff = date_diff($origin, $target);
	$diff = $diff->format("%a");
	if ($diff <= 365) 
	{
		return true;
	
	}
	else
	{
		return false;
		
	}

}

function CreateDir($dir) {
    if (is_dir($dir)) return true;
    @mkdir($dir);
    @SetChmod($dir);
    if (!is_dir($dir)) return false;
}

?>
guestbk.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/guestbk.inc'
View Content
<?php
/*******************************************************************************
 *   Guestbook
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'guestbk.inc')) {
    header('location:../index.php');
    die();
}

class GY_guestbk {
    public $tconfig;
    public $topmess;
    protected $pg;
    protected $id;

    public function __construct() {
        global $menuico, $nom, $lang, $lng, $page, $pg, $id;
        $topmess       = getLabel($nom[$lng == $lang[0] ? 9 : 19]);
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fas fa-book-reader float-right align-middle"></i>'.$topmess;
        $this->tconfig = $menuico[18] == 'ALL' ? import('tconfig', '', true, 0) : $menuico[18];
        $this->pg      = $pg;
        $this->id      = $id;
    }
    
    public function GBK_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $out = '';
        if ($serviz[12] != 'on') {
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
<div class="text-center web342">'.$web[143].'
  <p class="text-center">
    '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
  </p>
</div>';
            return array('GBK', $out);
        }
        elseif (!isAccessGranted($members[4])) {
            $out .= '
<div class="text-center web342">'.$web[342];
            $href1 = CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[3].'-0-'.$tconfig.$z2 
              : 'connect.php?lng='.$lng.'&tconfig='.$tconfig.$z2);
            $href2 = CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[15].'-5-new-'.$tconfig.$z2 
              : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$tconfig.$z2);
            if ($members[19] != '0' && $members[19] != '3') $out .= '
  <p class="text-center">
    '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
      (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
  </p>';
            $out .= '
</div>';
            return array('GBK', $out);
        }
        elseif (!empty($this->pg)) {
            $dbwork = SelectDBFields(TYP_GUESTBK, 'a', $this->pg);
            $isdoc  = (count($dbwork) > 0);
            if (!$isdoc) {
                if ($site[10] != '') return array('h1', '');
                else return array('h2', '');
            }
        }
        return array('');
    }
    
    public function GBK_content() {
        global $lng, $site, $serviz, $web, $prt, $urlrw, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        if (!empty($this->pg)) {
            if (count(SelectDBFields(TYP_GUESTBK, 'a', $this->pg)) != 0) {
                $dbwork = SelectDBFields(TYP_GUESTBK, 'a', $this->pg);
            } else {
                $dbwork = array();
            }
        } else {
            $dbwork = SelectDBFields(TYP_GUESTBK, 'a', '');
        }
        @rsort($dbwork);
        $out = '';
        if (empty($prt)) $out .= '
<form 
    action="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[14].'-'.TYP_GUESTBK.$z2 
      : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_GUESTBK.$z2).'" 
    method="post">
  <p class="text-center">'.SubmitButton($web[41]).'</p>
</form>
<hr />';
        if (empty($this->id)) $this->id = 1;
        if (!empty($dbwork)) {
            if (3 == abs($prt)) {
                $this->id  = 1;
                $serviz[7] = 99999;
            }
            for ($i = $serviz[7]*($this->id-1); $i < Min($serviz[7]*$this->id, count($dbwork)); $i++) {
                ReadDoc($dbwork[$i][1]);
                $img = getNewUpdateDoc($creadate, $moddate, $serviz[141]);
                $out .= '
<div class="bord text-center w-98">
  <div class="table-responsive-md">
  <div class="d-table text-center w-100">
    <div class="d-table-row">
      <div class="forum d-table-cell w-18">'.$web[39].$fielda1.'</div>
      <div class="quest d-table-cell">'.$web[6].' ';
                if ($fieldd1 == 'on') $out .= displayWriteEmail('guest'.$i, $author, $email);
                else $out .= '
        <b>'.$author.'</b>';
                $out .= '
        '.$web[7].' '.FormatDate($creadate).'
        <div class="gbkb1W">';
                if ($fieldb1 != '' && $fieldb1 != 'http://' && $fieldb1 != 'https://') $out .= '
          <a href="'.$fieldb1.'" target="_blank">
            <i class="fas fa-globe"></i>&nbsp;&nbsp;'.$fieldb1.'
          </a>&nbsp;';
                $out .= $img.'
        </div>
      </div>
    </div>
  </div>
  </div>
  <div class="rep w-98 m-auto gbkc1">'.$fieldc1;
            if (empty($prt)) $out .= 
  displayQuickConfig(NULL, $dbwork[$i][1], 'guestbk&amp;form=2&amp;id='.$dbwork[$i][1], 
    'guestbk&amp;act=i&amp;id='.$dbwork[$i][1], 'guestbk&amp;del='.$dbwork[$i][1], 22);
            $out .= '
  </div>
</div>';
                if ($i < min($serviz[7]*$this->id, count($dbwork))-1) $out .= '
<hr />';
            }
        } else if (!empty($this->pg)) {
            $out .= '
<p>'.$web[36].'</p>';
        }
        $out .= GetNavBar(($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[7].'-2'.'-' 
          : $site['GB'].'.php?lng='.$lng.'&amp;id='), 
          count($dbwork), $this->id, $serviz[7], $z2);
        return array('GBK', $out);
   }
}
?>
guestbk.php
wget 'https://sme10.lists2.roe3.org/guppy/inc/guestbk.php'
View Content
<?php
/*******************************************************************************
 *   Guestbook
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

header('Pragma: no-cache');
define('CHEMIN', '');
include CHEMIN.'inc/includes.inc';
include CHEMIN.'inc/guestbk.inc';
$gygbk   = new GY_guestbk();
$result  = $gygbk->GBK_ok($userprefs[1], $lng);
$tconfig = $gygbk->tconfig;
$topmess = $gygbk->topmess;
switch ($result[0]) {
case 'h1' : header('location:'.$site[3].'error.php?lng='.$lng.'&err=404');
case 'h2' : header('HTTP/1.0 404 Not Found');
case 'GBK' :
    include CHEMIN.'inc/hpage.inc';
    if (function_exists('htable1'))
        htable1($topmess, $result[0].$tconfig, '100%');
    else
        htable($topmess, '100%');
    echo $result[1];
    btable();
    include 'inc/bpage.inc';
    exit();
}
$result  = $gygbk->GBK_content();
include CHEMIN.'inc/hpage.inc';
if (function_exists('htable1'))
    htable1($topmess, $result[0].$tconfig, '100%');
else
    htable($topmess, '100%');
echo $result[1];
btable();
include 'inc/bpage.inc';
?>
hpage.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/hpage.inc'
View Content
<?php
/*******************************************************************************
 *   Site Index Top of Page
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.19 (August 20, 2024): Integration a firewall protect system
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'hpage.inc')) {
    header('location:../index.php');
    die();
}
if (function_exists('opcache_get_configuration'))
{
	// Si opcache est active mettre en disable
	if ($site[7] == 'on')
	{
		if (OPCACHEDISABLE == 1)
		{
			if (OPCACHEINISET == 1) // Gestion des options caches enable/disable
			{	
				{	
					if (ini_get('opcache') == 1) 
					{
						ini_set('opcache.enable', '0');
//						echo ' OPcache désactivé fait<br />';
					}
				}
			}
		}
	}
} // fin de existance opcache_get_configuration()
$obgo = FALSE;
if (($site[26] == 'on')) {
    if (!strstr($endurl, 'admin/') && !strstr($endurl, $site['PG'].'.php')) {
        if (extension_loaded('zlib') > 0) {
            if (strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
                $obgo = ob_start();
            }
        }
    }
}

$toppage = stripslashes($site[($lang[0] == $lng ? 0 : 11)]);
if (($page[22]) && (!empty($topmess))) {
    $toppage .= ' - '.strip_tags($topmess);
}
if ($serviz[32] == 'on' && $serviz[42] == 'on' && $userprefs[1] != '' && FileDBExist(CHEMIN.'admin/redac/'.$userprefs[1].INCEXT)) {
    include CHEMIN.'admin/redac/'.$userprefs[1].INCEXT;
}
/*
if (!empty($userprefs[1]) && @substr($_COOKIE[COOKIE_COOKIE], 0, 1) == '1' && !OK_RGPD_date($userprefs[1])) {
    $userdb  = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
    $acdtreg = mktime(0,0,0,(int)substr($userdb[1][28], 4, 2),(int)substr($userdb[1][28], -2),(int)substr($userdb[1][28], 0, 4));
    $acdtout = time() - $acdtreg > 31536000 ? true : false;
    if ($acdtout) {
        $userdb[1][28] = date('Ymd');
        WriteDBFields(MSGREP.$userprefs[1].DBEXT, $userdb);
        $userprefs[27] = date('Ymd');
        $userdata = '';
        for ($i = 0; $i < count($userprefs); $i++) {
            $stri      = sprintf("%02d", $i);
            $strlen    = empty($userprefs[$i]) ? '03' : sprintf("%02d", strlen($userprefs[$i]));
            $userdata .= $stri.$strlen.(empty($userprefs[$i]) ? 'off' : $userprefs[$i]);
        }
        $usertime = !empty($members[21]) ? intval($members[21]) : 157680000;
        $expires  = (is_file(CHEMIN.'admin/'.REDACREP.$userprefs[1].INCEXT) || $userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176]) ? 157680000 : $usertime;
// avant       setcookie(USER_COOKIE, gy_crypt(CRYPT_KEY, $userdata), time() + $expires, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
		setcookie(USER_COOKIE, gy_crypt(CRYPT_KEY, $userdata), strtotime( '+365 days' ), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
		
    }
}
      Modif Rgpd  apres
*/
	if (!empty($userprefs[1]) && @substr($_COOKIE[COOKIE_COOKIE], 0, 1) == '1' && !OK_RGPD_date($userprefs[1])) {
    	if (!OK_RGPD_date($userprefs[1])) 
		{
			setRGPDdate();
		}
	}

echo '<!DOCTYPE html>
<html lang="'.$lng.'">';

	///////////////////////////////////////////////////////////////////////////////////
	//                                                                               //
	//                GuppY is protected by the CeCILL FREE LICENSE.                 //
	//  REMOVING OR MODIFYING THE FOLLOWING COPYRIGHT NOTICE IS STRICTLY FORBIDDEN.  //
	//                                                                               //
	///////////////////////////////////////////////////////////////////////////////////

echo '

  <!--[  GuppY v'.MP_VERSION.' CeCILL Copyright (C) '.MP_COPYRIGHT.' by Laurent Duveau - https://www.freeguppy.org/  ]-->
  
<head>
<meta http-equiv="content-type" content="text/html; charset='.$charset.'" />
<meta name="application-name" content="'.$toppage.'" />

<title>'.$toppage.'</title>

<meta name="description" content="'.$site[1].'" />
<meta name="generator" content="GuppY CMS" />
<meta name="author" content="'.$site[9].'" />
<meta name="keywords" content="'.$site[2].'" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">';

echo '
<script>
  var charset = "'.$charset.'";
  var site0 = "'.htmlspecialchars($site[($lang[0] == $lng ? 0 : 11)]).'";
  var site3 = "'.SITE3.'";
</script>';

include CONFIGREP.'lancrgpd.inc'; // RGPD (ne pas supprimer)

/*
 Fin de rgpd.js
 */
 if (is_dir(CHEMIN.'inc/incpage')) {
    $hd = opendir(CHEMIN.'inc/incpage');
    while ($file = readdir($hd)) {
        if (1 == preg_match('!^[^_].*(\.inc|\.inc\.php)$!', $file)) {
			include CHEMIN.'inc/incpage/'.$file;
        }
    }
	closedir($hd);
}

if (!defined('NO_CRYPT') && $serviz[100] > 0 && empty($_COOKIE['GuppYCrypt'])) echo '
<script> window.location.reload(); </script>';

echo '
<link rel="shortcut icon" href="'.$site[3].'favicon.ico">';

echo '
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/css/bootstrap.min.css" 
  integrity="sha512-rt/SrQ4UNIaGfDyEXZtNcyWvQeOq0QLygHluFQcSjaGB04IxWhal71tKuzP6K8eYXYB6vJV4pHkXcmFGGQ1/0w==" crossorigin="anonymous" />
<link rel="stylesheet" href="'.CHEMIN.'inc/lang/flags.css" />
<link rel="stylesheet" href="'.CHEMIN.'inc/img/avatars/'.$page[23].'.css" />
<link rel="stylesheet" href="'.CHEMIN.'inc/img/general/forum.css" />
<link rel="stylesheet" href="'.CHEMIN.'inc/img/general/general.css" />
';
if (is_file ($meskin.'confskin.inc')) {
    include $meskin.'confskin.inc';
} else {
    include CHEMIN.'skins/no_skin/confskin.inc';
}
if (file_exists($meskin."style.css")) echo '
<link rel="stylesheet" href="'.$meskin.'style.css" />';
else echo '
<link rel="stylesheet" href="no_skin/style.css" />';
if (file_exists($meskin."bs4style.css")) echo '
<link rel="stylesheet" href="'.$meskin.'bs4style.css" />';
if (file_exists($meskin."styleplus.css")) echo '
<link rel="stylesheet" href="'.$meskin.'styleplus.css" />';
if ($tconfig > 0 && file_exists($meskin.'stylepage'.$tconfig.'.css')) echo '
<link rel="stylesheet" href="'.$meskin.'stylepage'.$tconfig.'.css" />';
if (file_exists($meskin."mobstyle.css")) echo '
<link rel="stylesheet" href="'.$meskin.'mobstyle.css" />';

echo '
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css" 
  integrity="sha512-3xLMEigMNYLDJLAgaGlDSxpGykyb+nQnJBzbkQy2a0gyVKL2ZpNOPIj1rD8IPFaJbwAgId/atho1+LBpWu5DhA==" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" 
  integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/SocialIcons/1.0.1/soc.min.css" 
  integrity="sha512-PTz/4lAo890ortUEd041dNdebPVxpjxZiTTgW8DXUTIiPZQGXFua9U7izCygP7NqHUDmaDF4F1CswmblvYq4Vw==" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" 
  integrity="sha512-c42qTSw/wPZ3/5LBzD+Bw5f7bSF2oxou6wEb+I/lqeaKV5FDIfMvvRp772y4jcJLKuGUOpbJMdg/BTl50fJYAw==" crossorigin="anonymous" />
<link rel="stylesheet" href="'.CHEMIN.'inc/unitegallery/css/unite-gallery.css" />
';

echo '
<style media="print"> @import url('.CHEMIN.'inc/print.css); </style>';

$dir = CHEMIN.'inc/csshead';
if (is_dir($dir)) {
    $allcss = scandir($dir);
    if (FALSE !== $allcss) {
        sort($allcss);
        foreach ($allcss as $onecss) {
            $info = pathinfo($onecss);
            if (isset($info['extension']) && $info['extension'] == 'css') echo '
<link rel="stylesheet" href="'.$dir.'/'.$onecss.'" />';
        }
        unset($allcss, $onecss);
    }
}

// ordre de chargement : jquery, popper, bootstrap (ou jquery, bundle)
echo 
  JavascriptFile(CHEMIN.'inc/hpage.js').'
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" 
  integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/js/bootstrap.bundle.min.js" 
	integrity="sha512-igl8WEUuas9k5dtnhKqyyld6TzzRjvMqLC79jkgT3z02FvJyHAuUtyemm/P/jYSne1xwFI06ezQxEwweaiV7VA==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.5.2/jquery-migrate.min.js" 
  integrity="sha512-BzvgYEoHXuphX+g7B/laemJGYFdrq4fTKEo+B3PurSxstMZtwu28FHkPKXu6dSBCzbUWqz/rMv755nUwhjQypw==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js" 
  integrity="sha512-0QbL0ph8Tc8g5bLhfVzSqxe9GERORsKhIn1IrpxDAgUsbBGz/V7iSav2zzW325XGd1OMLdL4UiqRJj702IeqnQ==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js" 
  integrity="sha512-Pbb8o120v5/hN/a6LjF4N4Lxou+xYZ0QcVF8J6TWhBbHmctQWd8O6xTDmHpE/91OjPzCk4JRoiJsexHYg4SotQ==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/SocialIcons/1.0.1/soc.min.js" 
  integrity="sha512-eUJ3eP9+avp5kHKhfx5gB0vzLEgMkZiOmZcpVqJmlg9hMMse2SChMOTSDWl6oYGfmYW2N7oO/W6CqpgYBneqKw==" crossorigin="anonymous">
</script>
<script src="https://unpkg.com/bootstrap-show-password@1.2.1/dist/bootstrap-show-password.min.js"></script>
'.JavascriptFile(CHEMIN.'inc/unitegallery/js/unitegallery.min.js');

$dir = CHEMIN.'inc/jshead';
if (is_dir($dir)) {
    $alljs = scandir($dir);
    if (FALSE !== $alljs) { 
        sort($alljs);
        foreach ($alljs as $onejs) {
            $info = pathinfo($onejs);
            if (isset($info['extension']) && $info['extension'] == 'js')
				echo '
<script src="'.$dir.'/'.$onejs.'"></script>
';
        }
        unset($alljs, $onejs);
    }
}

if (is_dir(CHEMIN.'inc/jqhead')) {
    $hd = opendir(CHEMIN.'inc/jqhead');
    while ($file = readdir($hd)) {
        if (1 == preg_match('!^[^_].*(\.js|\.js\.php)$!', $file)) {
			include CHEMIN.'inc/jqhead/'.$file;
        }
    }
	closedir($hd);
}

echo '
<script>
  $(document).ready(function() {
    $("pre").each(function(i, block) {
      hljs.highlightBlock(block);
    });
    $("pre code").each(function(i, block) {
      hljs.highlightBlock(block);
    });
  });
</script>';

$tconfig = isset($tconfig) ? $tconfig : import('tconfig', '', true, 0);
$tconfig = !isset($templates[$tconfig]) ? 0 : $tconfig;

if (empty($prt)) echo '
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-parallax/1.1.3/jquery-parallax-min.js" 
  integrity="sha512-ES/eSqVi/9sgeZfvunOto+gwgFGrD/hzi5UOJFDR1Me8acKSBJIb2Gk0IyKje2ZaX+OovAG2/bRzj/uBcNeesg==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.3/jquery.scrollTo.min.js" 
  integrity="sha512-PsJ1f4lw0Jrga4wbDOvdWs9DFl88C1vlcH2VQYqgljHBmzmqtGivUkzRHWx2ZxFlnysKUcROqLeuOpYh9q4YNg==" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-localScroll/2.0.0/jquery.localScroll.min.js" 
  integrity="sha512-x/Viuh5YndnrDISWqrZ6rerGnHccdLv/TW2B+xEGqubrLGCT6LdBGhnQxXo1Q4sXFgO12YeRWDYJkIV41OtOTA==" crossorigin="anonymous">
</script>
';

if (empty($prt)) echo '
<script>
  $(document).ready(function(){		
    $("#paranav").localScroll(800);
    $("#slide1").parallax("50%", 0.2, true);
    $("#slide2").parallax("50%", 0.2, true);
    $("#slide3").parallax("50%", 0.2, true);
  })
</script>
';
if (!isset($page[54])) $page[54] = '0,0,0,0,0,0';
$numlines = explode(',', $page[54]);
if ($numlines[$tconfig] != '') {
    echo '
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.sticky/1.0.4/jquery.sticky.min.js" 
  integrity="sha512-QABeEm/oYtKZVyaO8mQQjePTPplrV8qoT7PrwHDJCBLqZl5UmuPi3APEcWwtTNOiH24psax69XPQtEo5dAkGcA==" crossorigin="anonymous">
</script>
';
    echo "
<script>
  $(document).ready(function() {
    $('#T".$tconfig."entrow".$numlines[$tconfig]."').sticky({topSpacing:0,zIndex:1040});
  })
  $(window).scroll(function() {
    if ($('#T".$tconfig."entrow".$numlines[$tconfig]."').css('position') == 'fixed') {
      $('#T".$tconfig."entrow".$numlines[$tconfig]."').addClass('fixed-top-line');
    }
    else {
      $('#T".$tconfig."entrow".$numlines[$tconfig]."').removeClass('fixed-top-line');
    }
  });
</script>
";
}

echo $headinc;

if (isset($prt)) {
    switch ($prt) {
    case -1 :
    case -2 :
    case -3 :
		echo '
<style media="screen">
  @import url('.CHEMIN.'inc/preview.css);
</style>';
        break;
    case 1 :
    case 2 :
    case 3 :
		echo '
<style media="screen">
  @import url('.CHEMIN.'inc/preview.css);
</style>';
        echo '
<script>
  window.print();
</script>
';
        break;
    }
}

if ($body[7] == 'on' && empty($prt))
    echo '
<style>
#returnOnTop {
  bottom: '.$body[5].';
  opacity: '.$opacity[20].';
}
</style>
';
    echo "
<script>
  $(document).ready( function () {
    $('body').append('<div id=\"returnOnTop\" title=\"".$web[136]."\">&nbsp;</div>');
    $('#returnOnTop').click( function() {
    $('html,body').animate({scrollTop: 0}, 'slow');
    });
  });
  $(window).scroll(function() {
    if ($(window).scrollTop() < ".$body[6].")
      $('#returnOnTop').fadeOut();
    else
      $('#returnOnTop').fadeIn();
  });
</script>
";

echo '
<!--[if lte IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js" 
  integrity="sha256-3Jy/GbSLrg0o9y5Z5n1uw0qxZECH7C6OQpVBgNFYa0g=" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js" 
  integrity="sha256-g6iAfvZp+nDQ2TdTR/VVKJf3bGro4ub5fvWSWVRi2NE=" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/selectivizr/1.0.2/selectivizr-min.js" 
  integrity="sha256-8fF/6nzuSprnSYGykwsQo6r9cT9FZAgN7yTl+4NCozg=" crossorigin="anonymous">
</script>
<![endif]-->

</head>

<body class="m-0 text-center'.($prt == 0 ? ' body' : '').'">';

$cookies = intval(@substr($_COOKIE[COOKIE_COOKIE], 1));
if (!empty($cookies) && time() > $cookies) {
    echo '
<script>
var sValue = "";
document.cookie = "'.COOKIE_COOKIE.'" + "=" + encodeURIComponent(sValue) + ";expires=0";
</script>
';
    $cookies = 0;
}
/*
if (empty($cookies) && !OK_RGPD_date($userprefs[1])) {
    echo '
<script>
function setCookiesAccept() {
  var sValue = "'.(empty($userprefs[1]) ? '0'.strval(time() + 259200) : '1'.strval(time() + 31536000)).'";
  var today = new Date(), expires = new Date();
  expires.setTime(today.getTime() + '.(empty($userprefs[1]) ? 259200000 : 31536000000).');
  document.cookie = "'.COOKIE_COOKIE.'" + "=" + encodeURIComponent(sValue) + ";expires=" + expires.toGMTString();
  window.location.reload();
}
</script>
';
}*/
if (@substr($_COOKIE[COOKIE_COOKIE], 0, 1) == '0' && !empty($userprefs[1])) {
    echo '
<script>
  var sValue = "'.('1'.strval(time() + 31536000)).'";
  var today = new Date(), expires = new Date();
  expires.setTime(today.getTime() + 31536000000);
  document.cookie = "'.COOKIE_COOKIE.'" + "=" + encodeURIComponent(sValue) + ";expires=" + expires.toGMTString();
</script>
';
}

// extraction des éléments des boîtes utilisées WEB et MOB
$bccount = 0;
$wposbox = array();
foreach ($templates as $keyconf=>$valueconf) {
	foreach (array(BOX_LSIDE, BOX_LEFT, BOX_CENTER, BOX_RIGHT, BOX_RSIDE) as $key) {
		foreach ($xposbox[$keyconf][BOX_TOP][$key] as $i=>$value) {
			$args  = '';
			if (!empty($value)) {
				$pos   = strrpos($value, 'W');
				$args  = $pos === false ? '' : substr($value, $pos + 1);
				$value = $pos === false ? $value : substr($value, 0, $pos);
				$value = substr($value, -1) == '|' ? substr($value, 0, -2) : $value;			
			}
			$xposbox[$keyconf][BOX_TOP][$key][$i] = $value;
			$wposbox[$keyconf][BOX_TOP][$key][$i] = $args;
		}
		foreach ($xposbox[$keyconf][BOX_BOTTOM][$key] as $i=>$value) {
			$args  = '';
			if (!empty($value)) {
				$pos   = strrpos($value, 'W');
				$args  = $pos === false ? '' : substr($value, $pos + 1);
				$value = $pos === false ? $value : substr($value, 0, $pos);
				$value = substr($value, -1) == '|' ? substr($value, 0, -2) : $value;
			}
			$xposbox[$keyconf][BOX_BOTTOM][$key][$i] = $value;
			$wposbox[$keyconf][BOX_BOTTOM][$key][$i] = $args;
		}
	}
}
foreach (array(BOX_LSIDE, BOX_LEFT, BOX_CENTER, BOX_RIGHT, BOX_RSIDE) as $key) {
	foreach ($xposbox[BOX_EDITO][$key] as $i=>$value) {
		$args  = '';
		if (!empty($value)) {
			$pos   = strrpos($value, 'W');
			$args  = $pos === false ? '' : substr($value, $pos + 1);
			$value = $pos === false ? $value : substr($value, 0, $pos);
			$value = substr($value, -1) == '|' ? substr($value, 0, -2) : $value;
		}
		$xposbox[BOX_EDITO][$key][$i] = $value;
		$wposbox[BOX_EDITO][$key][$i] = $args;
	}
}

if (!isset($userprefs3)) $userprefs3 = $userprefs[3];

echo '
  <a id="z1"></a>
';
if (!isset($page[50])) $page[50] = '';
if (empty($prt) && $page[50] != 'no') {
    echo '
  <script>
    $(document).ready(function(){		
      $("#paranav").localScroll(800);
    })
  </script>
';
    echo '
  <ul id="paranav"> <!-- parallax navigator -->
    <li><a href="#z1" title="'.$web[136].'"></a></li>
    <li><a href="#z2" title="'.$web[695].'"></a></li>
    <li><a href="#z3" title="'.$web[696].'"></a></li>
  </ul>
';
}

// Site en travaux
if (empty($prt) && $serviz[44] == "on") {
    echo '
    <section id="work">
      <div class="row mx-0 px-0">
        <div class="col-md-12 mx-0 px-0 notice text-center font-weight-bold workprogress">
          ATTENTION : site en travaux - CAUTION: work in progress
        </div>
      </div>
    </section>
';
}

/*
// message RGPD
$cookies = (is_file(CHEMIN.'install/install.php') ? 'off' : $cookies);
if (empty($prt) && empty($cookies) && !OK_RGPD_date($userprefs[1])) {
    echo '
  <div id="overlay"></div>
  <script>
    document.getElementById("overlay").style.display = "block";
  </script>
  <section id="rgpd" class="sticky-top m-0 p-0 accookie">
    <div class="row">
      <div class="col-md-3"></div>
      <div class="col-md-6">
        <div class="pt-5 display-3"><i class="fas fa-file-contract"></i></div>
        <div>'.$web[91].'</div>
      </div>
      <div class="col-md-3"></div>
      <div class="col-md-12 pt-3 pb-5 text-center">'.SubmitButton($web[629], 'setCookiesAccept();', '', '', 'button').'</div>
    </div>
  </section>
';
}
*/
if (empty($prt)) echo '
  <header id="slide1"> <!-- Begin of Total HEADER -->
    <div class="slide_inside">
';

// php or html scripts located in directory inc/inchead are automatically include at the top of the page
if (is_dir(CHEMIN.'inc/inchead')) { 
        $hd = opendir(CHEMIN.'inc/inchead');
        while ($file = readdir($hd)) { 
            if (1 == preg_match('!^[^_].*(\.inc|\.inc\.php)$!', $file)) {
                echo '
    <section id="header" class="row mx-0 px-0">
      <div class="col-md-12 mx-0 px-0">';
                include CHEMIN.'inc/inchead/'.$file;
                echo '
      </div>
    </section>
';
            }
        }
}

if (empty($prt)) {
    echo '
      <!-- Begin of TOP BOXES -->
      <a id="top"></a>
      <section id="TopBoxes" class="container-fluid mx-auto px-0">';

    foreach ($xposbox[$tconfig][BOX_TOP][BOX_LEFT] as $i => $aa) {
        $item4 = @ExecFunctionBox(BOX_TOP, $xposbox[$tconfig][BOX_TOP][BOX_LSIDE][$i]);
        $item1 = @ExecFunctionBox(BOX_TOP, $xposbox[$tconfig][BOX_TOP][BOX_LEFT][$i]);
        $item2 = @ExecFunctionBox(BOX_TOP, $xposbox[$tconfig][BOX_TOP][BOX_CENTER][$i]);
        $item3 = @ExecFunctionBox(BOX_TOP, $xposbox[$tconfig][BOX_TOP][BOX_RIGHT][$i]);
        $item5 = @ExecFunctionBox(BOX_TOP, $xposbox[$tconfig][BOX_TOP][BOX_RSIDE][$i]);
        if ($item4 || $item1 || $item2 || $item3 || $item5) {
            $w3    = (int)$wposbox[$tconfig][BOX_TOP][BOX_LSIDE][$i];
            $w0    = (int)$wposbox[$tconfig][BOX_TOP][BOX_LEFT][$i];
            $w1    = (int)$wposbox[$tconfig][BOX_TOP][BOX_CENTER][$i];
            $w2    = (int)$wposbox[$tconfig][BOX_TOP][BOX_RIGHT][$i];
            $w4    = (int)$wposbox[$tconfig][BOX_TOP][BOX_RSIDE][$i];
            $sfix  = BOX_TOP.$tconfig.$i;
            $wcol3 = 'col-md-'.($item4 === false ?  '0' : $w3).' mx-0 px-'.($item4 === false ?  '0' : '2').' wcol3'.$sfix;
            $wcol0 = 'col-md-'.($item1 === false ?  '0' : $w0).' mx-0 px-'.($item1 === false ?  '0' : '2').' wcol0'.$sfix;
            $wcol1 = 'col-md-'.($item2 === false ?  '0' : $w1).' mx-0 px-'.($item2 === false ?  '0' : '2').' wcol1'.$sfix;
            $wcol2 = 'col-md-'.($item3 === false ?  '0' : $w2).' mx-0 px-'.($item3 === false ?  '0' : '2').' wcol2'.$sfix;
            $wcol4 = 'col-md-'.($item5 === false ?  '0' : $w4).' mx-0 px-'.($item5 === false ?  '0' : '2').' wcol4'.$sfix;
			if (!isset($titre[78])) $titre[78] = '';
            echo '
        <style> #T'.$tconfig.'row'.$i.' { max-width: '.$titre[78].'; } </style>
        <div id="T'.$tconfig.'entrow'.$i.'" class="T'.$tconfig.'entrow'.$i.'">
          <div id="T'.$tconfig.'row'.$i.'" class="row mx-auto px-0 T'.$tconfig.'row'.$i.'">
            <div class="'.$wcol3.'">'.(FALSE !== $item4 ? $item4 : '').'</div>
            <div class="'.$wcol0.'">'.(FALSE !== $item1 ? $item1 : '').'</div>
            <div class="'.$wcol1.'">'.(FALSE !== $item2 ? $item2 : '').'</div>
            <div class="'.$wcol2.'">'.(FALSE !== $item3 ? $item3 : '').'</div>
            <div class="'.$wcol4.'">'.(FALSE !== $item5 ? $item5 : '').'</div>
          </div>
        </div>';
        }
    }

    echo '
      </section> <!-- End of TOP BOXES -->
';
    echo '
    </div> <!--.slide_inside-->	 
  </header> <!--#slide1--> <!-- end of Total HEADER -->
';
}
if (!isset($page[62])) $page[62] = '70,70,70,70,70,70';
if ($serviz[74] == '' || strip_tags($_SERVER['SCRIPT_NAME']) != '/index.php') {
    $pages62 = explode(',', $page[62]);
    $pages62[$tconfig] = empty($pages62[$tconfig]) ? 0 : $pages62[$tconfig];
    echo '
<style>.mainoffset'.$tconfig.' { padding-top: '.$pages62[$tconfig].'px !important; } </style>
';
}

if (empty($prt)) echo '
  <!-- Begin of MAIN CONTENT -->
  <a id="z2"></a>
  <main id="slide2" class="mainoffset'.$tconfig.'">
    <div class="slide_inside">
      <div id="MainContent" class="container-fluid mx-auto px-0">
        <div class="row mx-auto px-0">
';
    $colconf = isBlogPage() ? 'B' : $tconfig;
    for ($ii=0; $ii < count($xposbox[$colconf][BOX_LEFT]); $ii++) {
        $box  = $xposbox[$colconf][BOX_LEFT][$ii];
        $temp = explode(CONNECTOR, $box);
        $fnct = isset($temp[1]) ? $temp[1] : '';
        $args = isset($temp[2]) ? $temp[2] : '';
        if (in_array($fnct, array('fbox_freebox', 'fbox_menubox', 'fbox_ddmenubox'))) {
            ReadDoc($args);
            $xposbox[$colconf][BOX_LEFT][$ii] = isAccessGranted($fieldmod) ? $box : '';
        }
    }
    for ($ii=0; $ii < count($xposbox[$colconf][BOX_RIGHT]); $ii++) {
        $box  = $xposbox[$colconf][BOX_RIGHT][$ii];
        $temp = explode(CONNECTOR, $box);
        $fnct = isset($temp[1]) ? $temp[1] : '';
        $args = isset($temp[2]) ? $temp[2] : '';
        if (in_array($fnct, array('fbox_freebox', 'fbox_menubox', 'fbox_ddmenubox'))) {
            ReadDoc($args);
            $xposbox[$colconf][BOX_RIGHT][$ii] = isAccessGranted($fieldmod) ? $box : '';
        }
    }
    
    $left_empty  = array_reduce($xposbox[$colconf][BOX_LEFT], 'EstNonVide', true) || $userprefs3 == BOX_RIGHT;
    $right_empty = array_reduce($xposbox[$colconf][BOX_RIGHT], 'EstNonVide', true) || $userprefs3 == BOX_LEFT;
    $userprefs3  = (isBlogPage() ? BOX_LEFT.BOX_RIGHT : $userprefs3);
    $userprefs3  = (isForumPage() ? ($forum[3] == '' ? $forum[4] : BOX_LEFT.BOX_RIGHT) : $userprefs3);

    if ($serviz[74] == '' || strip_tags($_SERVER['SCRIPT_NAME']) != '/index.php') {
        if (is_file($meskin.'leftside.inc')) {
            include($meskin.'leftside.inc');
        } else {
            if ($widepage == '' && $userprefs3 != BOX_RIGHT && !$left_empty) {
                echo '

        <!-- Begin of LEFT BOXES -->
        <aside id="'.(isBlogPage() ? 'Blog' : '').'LeftBoxes" class="col-md-3 mx-0 pl-0 pr-4 a-col">
          <div id="'.(isBlogPage() ? 'Blog' : '').'BoxesLeft"> <!-- hauteur des boîtes seules -->';

                foreach ($xposbox[$colconf][BOX_LEFT] as $ii => $aa) {
                    if ($userprefs3 != BOX_RIGHT && $xposbox[$colconf][BOX_LEFT][$ii] != '') {
                        $item = ExecFunctionBox(BOX_LEFT, $xposbox[$colconf][BOX_LEFT][$ii]);
                        if (FALSE !== $item) echo $item;
                    }
                    if ($userprefs3 == BOX_LEFT && $xposbox[$colconf][BOX_RIGHT][$ii] != '') {
                        $item = ExecFunctionBox(BOX_LEFT, $xposbox[$colconf][BOX_RIGHT][$ii]);
                        if (FALSE !== $item) echo $item;
                    }
                }

                echo '
          </div>
        </aside>  <!-- End of LEFT_BOXES -->
        ';
            }
        }
    }
    $lcb = 'col-md-'.(($left_empty && $right_empty) || ($serviz[74] == 'on' && strip_tags($_SERVER['SCRIPT_NAME']) == '/index.php') || !empty($widepage) 
      ? '12' : ($left_empty || $right_empty || (isForumPage() && $forum[3] == '') ? '9' : '6'));
    echo '
        <!-- Begin CENTER BOXES -->
        <section id="CenterBoxes" class="'.$lcb.' mx-auto px-1">
          <div id="BoxesCenter" class="row mx-0 px-0"> <!-- hauteur des boîtes seules -->
            <div class="col-12 mx-0 px-0">';
    
    $above_empty = array_reduce($xposbox[$tconfig][BOX_ABOVE], 'EstNonVide', true);
    if (!$above_empty) {
        echo '
            <!-- Begin of ABOVE BOXES -->
            <div id="AboveBoxes" class="row mx-0 px-0 '.BOX_ABOVE.$tconfig.'">
              <div id="BoxesAbove" class="col-12 mx-0 px-0">';
        foreach ($xposbox[$tconfig][BOX_ABOVE] as $item) {
            $bc = '';
            if ($item != '') {
                if (strpos($item, 'fbox_cita') > 0) { 
                    $bccount++; $bc = '||'.$bccount; 
                }
                $item = ExecFunctionBox(BOX_ABOVE, $item.$bc);
                if (FALSE !== $item) echo '
                <div class="row mx-0 px-0 '.BOX_ABOVE.'row'.$tconfig.'">
                  <div class="col-12 mx-0 px-0">
                    '.$item.'
                  </div>
                </div>';
            }
        }
            echo '
              </div>
            </div> <!-- End of ABOVE BOXES -->
      ';
    }
    	if (!OK_RGPD_date($userprefs[1])) 
		{
			setRGPDdate();
		}
?>
hpage.js
wget 'https://sme10.lists2.roe3.org/guppy/inc/hpage.js'
View Content
function msgdefil(){afftexte=texte.substring(postexte,texte.length)+texte.substring(0,postexte),postexte++,postexte==texte.length&&(postexte=0),window.status=afftexte,vitessedefil=setTimeout("msgdefil()",150)}
function WriteMailTo(a,b,c,d){var e=112,f=300,g=(screen.height-e)/2,h=(screen.width-f)/2;""==a&&(a=b+"@"+c+"."+d),fenetremail=window.open("","","top="+g+", left="+h+", width="+f+", height="+e+", directories=no, menubar=no, status=no, resizable=no, location=no"),fenetreNote=fenetremail,null!=fenetreNote&&(docmail=fenetremail.document,textemail='<html><head><title>email</title><meta http-equiv="Content-Type" content="text/html; charset="'+charset+'" ></head><body onblur="javascript:setTimeout(\'window.close();\',5000);" style="margin: 5px; background-color:<?php echo $forum[0]; ?>; color: <?php echo $texte[0] ?>; overflow: hidden;"><div align="center"><br /><?php echo $web173; ?> <b>'+a+'</b> :<br /><br /><a  href="mailto:'+b+"@"+c+"."+d+'">'+b+"@"+c+"."+d+"</a><br /><br /></div></body></html>",docmail.write(textemail),docmail.close())}
function ContactMe(a,b,c,d,e){var f=112,g=360,h=(screen.height-f)/2,i=(screen.width-g)/2;switch(""!=e&&(e="."+e),""!=d&&(d="@"+d),ircident=c+d+e,a){case"ICQ":ircsite="http://www.icq.com/people/webmsg.php?to="+ircident;break;case"MSN":ircsite="msnim:chat?contact="+ircident;break;case"Yahoo":ircsite="ymsgr:sendim?"+ircident;break;case"Gtalk":ircsite="http://mail.google.com/mail/";break;case"Skype":ircsite="skype:"+ircident+"?call";break;case"AIM":ircsite="aim:goim?screenname="+ircident;break;case"Teamspeak":ircsite="teamspeak://"+ircident}fenetremail=window.open("","","top="+h+", left="+i+", width="+g+", height="+f+", directories=no, menubar=no, status=no, resizable=no, location=no"),fenetreNote=fenetremail,null!=fenetreNote&&(docmail=fenetremail.document,textemail='<html><head><title>email</title><meta http-equiv="Content-Type" content="text/html; charset="'+charset+'" ></head><body onblur="javascript:setTimeout(\'window.close();\',5000);" style="margin: 5px; background-color:<?php echo $forum[0]; ?>; color: <?php echo $texte[0] ?>; overflow: hidden;"><div align="center"><br /><?php echo $web173; ?> <b> '+b+" via "+a+"</b> :<br /><br /><br />",textemail+='<a href="'+ircsite+'">'+ircident+"</a>",textemail+="</div></body></html>",docmail.write(textemail),docmail.close())}
function AddFavo(a,b){return void 0==a&&(a=site0),void 0==b&&(b=site3),window.sidebar?(window.sidebar.addPanel(a,b,""),!1):window.external?(window.external.AddFavorite(b,a),!1):!0}
function PopupWindow(a,b,c,d,e,f){var g=(screen.height-d)/2,h=(screen.width-c)/2;window.open(a,b,"top="+g+", left="+h+", width="+c+", height="+d+", directories=no, menubar=no, status=no, resizable="+e+", scrollbars="+f+", location=no")}
function hideLoadingPage(){document.getElementById?document.getElementById("hidepage").style.visibility="hidden":document.layers?document.hidepage.visibility="hidden":document.all.hidepage.style.visibility="hidden"}
function MontreCacheItems(a,b,c,d){
    document.getElementById&&"inline"==document.getElementById(a).style.display||document.all&&"inline"==document.all[a].style.display||document.layers&&"inline"==document.layers[a].display
      ?(cache(a),montre(b,"inline"),document.getElementById&&null!=document.getElementById(c)||document.all&&void 0!=document.all[c]||document.layers&&void 0!=document.layers[c]
        ?montre(c,"block"):montre(d,"block"))
        :(cache(b),montre(a,"inline"),
          cache(document.getElementById&&null!=document.getElementById(c)||document.all&&void 0!=document.all[c]||document.layers&&void 0!=document.layers[c]?c:d)
        )
}
function montre(a,b){
    "block" != b && "inline" != b && (b = "inline-block"),
    document.getElementById
      ?document.getElementById(a).style.display = b
      :document.all
        ?document.all[a].style.display = b
        :document.layers&&(document.layers[a].display = b)
}
function cache(a){
    document.getElementById
      ?document.getElementById(a).style.display="none"
      :document.all
        ?document.all[a].style.display="none"
        :document.layers&&(document.layers[a].display="none")
}
function ToggleValue(a){document.getElementById?document.getElementById(a).value="on"==document.getElementById(a).value?"":"on":document.all?document.all[a].value="on"==document.all[a].value?"":"on":document.layers&&(document.layers[a].value="on"==document.layers[a].value?"":"on")}
function submenu(a){if(document.all)for(i=1;i<=maxsub;i++)menu=document.all["sub"+i],menu.style.display=i!=a?"none":"block";else if(document.getElementById)for(i=1;i<=maxsub;i++)menu=document.getElementById("sub"+i),menu.style.display=i!=a?"none":"block"}
function ActiveMenu(a,b,c,d,e,f){
    DesactiveMenu(a,b,c,d,f),
    ActiveItem(a,b,e,f)
}
function DesactiveMenu(a,b,c,d,e){
    for(i=c;i<c+d;i++)
        document.getElementById(b+i)&&document.getElementById(a+i)&&(cache(b+i),montre(a+i,e))
}
function ActiveItem(a,b,c,d){
    cache(a+c),montre(b+c,d)
}
function DesactiveItem(a,b,c,d){cache(b+c),montre(a+c,d)}window!=top&&(top.location=window.location);var postexte=0;
hplugins.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/hplugins.inc'
View Content
<?php
/*******************************************************************************
 *   Registered Plugins Management
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.03 (August 10, 2021) : adaptation to php 8
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'hplugins.inc')) {
    header('location:../index.php');
    die();
}

$PluginsDB = ReadDBFields(DBPLUGIN);

for ($i = 0; $i < count($PluginsDB); $i++) {
	unset($plugin_bar_name, $plugin_bar_icon, $plugin_bar_url, $plugin_bar_alturls, $plugin_bar_anchor);

	if (is_file(CHEMIN.'plugins/'.$PluginsDB[$i][0].'/plugin.inc')) {
		include CHEMIN.'plugins/'.$PluginsDB[$i][0].'/plugin.inc';
	}
    if (!empty($plugin_bar_icon) && @is_file(CHEMIN.'plugins/'.$PluginsDB[$i][0].'/'.$plugin_bar_icon)) {
        $plugin_bar_icon = '<img class="mx-0 mt-n1" style="width:2rem;" src="'.CHEMIN.'plugins/'.$PluginsDB[$i][0].'/'.$plugin_bar_icon.'" alt="" />';
    }
    else {
        $plugin_bar_icon = '<i class="fas fa-plug"></i>';
    }

	// if (isset($plugin_bar_name) && $plugin_bar_name != '') {
	if (!empty($plugin_bar_name)) {
        $PluginsDB[$i][1] = empty($PluginsDB[$i][1]) ? 'ALL' : $PluginsDB[$i][1];
        $PluginsDB[$i][2] = empty($PluginsDB[$i][2]) ? 'ALL' : $PluginsDB[$i][2];
		$menu[$plugin_bar_name.'_'.$PluginsDB[$i][0]] = array(
			'id'       => $PluginsDB[$i][0],
            'z2'       => isset($plugin_bar_anchor) && $z2 ? $plugin_bar_anchor : $z2,
			'name'     => strip_tags($plugin_bar_name),
			'title'    => $plugin_bar_name,
			'icon'     => $plugin_bar_icon,
            'pageexec' => $PluginsDB[$i][1] == 'ALL' ? $tconfig : $PluginsDB[$i][1],
            'pagedisp' => $PluginsDB[$i][2] == 'ALL' ? $tconfig : $PluginsDB[$i][2],
            'granted'  => true,
			'url'      => ($site['URLR'] == 'on') ? $plugin_bar_url : 'plugins/'.$PluginsDB[$i][0].'/'.$plugin_bar_url,
			'alturls'  => isset($plugin_bar_alturls) && is_array($plugin_bar_alturls) ? $plugin_bar_alturls : array(),
			'base'     => parse_url($plugin_bar_url, PHP_URL_PATH),
			'target'   => '_SELF'
		);
	}
}
?>
includes.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/includes.inc'
View Content
<?php
/*******************************************************************************
 *   Load Includes
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.19 (August 26, 2024) : correction requete not allowed
 ******************************************************************************/

if (version_compare(phpversion(), '5.6.0', '<')) {
    die(sprintf('Insufficient version of PHP (%s) : 5.6.0 or higher necessary', phpversion()));
}

if (@preg_match("!//|/\*|#|:/|\.\./|%2E\./|\.%2E/|%2E%2E/|document.cookie|alert!i", $_SERVER["QUERY_STRING"])) {
    die("Requête non autorisée - Request not allowed");
}
if (@preg_match("!//|/\*|#|:/|\.\./|%2E\./|\.%2E/|%2E%2E/|document.cookie|alert|wp-!i", $_SERVER['PHP_SELF'])) {
    die("Requête non autorisée - Request not allowed");
}
$cherchscript = substr_count($_SERVER['PHP_SELF'],'alert');
$cherchscript1 = substr_count($_SERVER['PHP_SELF'],'target');
$cherchscript2 = substr_count($_SERVER['PHP_SELF'],'title');
$cherchscript = $cherchscript + $cherchscript1 + $cherchscript2;
if ($cherchscript > 0)
 die("Requête non autorisée - Request not allowed");

if (stristr($_SERVER['SCRIPT_NAME'], 'includes.inc')) {
    header('location:index.php');
    die();
}

error_reporting( E_ALL ^ E_NOTICE );

$endurl  = strip_tags($_SERVER['REQUEST_URI']);
$lang    = array('','');
$charset = 'UTF-8';
$tconfig = 0;
$cryptos = array(2=>'cryptotexte', 3=>'cryptoseltexte');

include CHEMIN.'inc/functions.php';
include CONFIG;
define('SITE3', $site[3]);

if (isset($_GET['securekey'])) {
    ClearCookies();
    if (!defined('NO_CRYPT') && $serviz[100] > 0) {
        include CRYPTREP.$cryptos[$serviz[100]].'.php';
        include CRYPTREP.$cryptos[$serviz[100]].'.fct.php';
    }
    $location = CHEMIN.'index.php?lng='.$lng.'&selskin='.$page[14].'&changekey=on';
    echo '
<script>
  window.location="'.$location.'";
</script>';
    header("location:".$location); 
    exit();
}

if (!defined('NO_CRYPT') && $serviz[100] > 0) include CRYPTREP.$cryptos[$serviz[100]].'.fct.php';
if (substr($serviz[101], -2) != 'px') $serviz[101] = '800px';

include CHEMIN.'inc/func_groups.php';
include CHEMIN.'inc/func_groupscol.php';
include CHEMIN.'inc/func_groupsnwl.php';
include CHEMIN.'inc/func_boxes.php';
include CHEMIN.'inc/func_blogboxes.php';
include CHEMIN.'inc/func_forum.php';
include CHEMIN.'inc/func_news.php';

$prt = import('prt');
if (!in_array($prt, array(-3, -2, -1, 0, 1, 2, 3))) $prt = 0;
date_default_timezone_set($site['TZ']);

function TestInteger($name) {
    $GLOBALS[$name] = import($name);
    if (isset($GLOBALS[$name])) {
        $n = preg_match('!^([0-9]+)!', $GLOBALS[$name], $res);
        if ($n == 0 || $res[1] == '')
            $GLOBALS[$name] = NULL;
        else
            $GLOBALS[$name] = $res[1];
    }
}

TestInteger('pg');
TestInteger('id');
TestInteger('num');

$lng        = import('lng');
$userprefs  = array_pad(array(), 31, '');
if (!empty($_COOKIE[USER_COOKIE]) && !isset($_GET['changekey'])) {
    $usercookie = gy_decrypt(CRYPT_KEY, $_COOKIE[USER_COOKIE]);
    $positem    = 0;
    for ($i = 0; $i < 31; $i++) {
        $poslen        = $positem + 2;
        $posdata       = $positem + 4;
        $lendata       = intval(substr($usercookie, $poslen, 2));
        $userprefs[$i] = substr($usercookie, $posdata, $lendata);
        $userprefs[$i] = $userprefs[$i] == 'off' ? '' : $userprefs[$i];
        $positem       = $posdata + $lendata;
    }
    if (($userprefs[0] == $lang[0] || $userprefs[0] == $lang[1]) && empty($lng)) {
        $lng = strip_tags($userprefs[0]);
    }
    $userprefs[0] = strip_tags($userprefs[0]);
    $userprefs[1] = preg_replace('![^-a-zA-Z0-9_]!i', '', substr(strip_tags($userprefs[1]), 0, $serviz[148]));
    $userprefs[2] = strip_tags($userprefs[2]);
    $userprefs[3] = strip_tags($userprefs[3]);
    $userprefs[4] = strip_tags($userprefs[4]);
    $userprefs[5] = strip_tags($userprefs[5]);
    $userprefs[6] = str_replace('\n', '<br />', strip_tags($userprefs[6]));
    $userprefs[7]  = strip_tags($userprefs[7]);
    $userprefs[8]  = strip_tags($userprefs[8]);
    $userprefs[9]  = strip_tags($userprefs[9]);
    $userprefs[10] = strip_tags($userprefs[10]);
    $userprefs[11] = strip_tags($userprefs[11]);
    $userprefs[12] = strip_tags($userprefs[12]);
    $userprefs[13] = strip_tags($userprefs[13]);
    $userprefs[14] = strip_tags($userprefs[14]);
    $userprefs[15] = strip_tags($userprefs[15]);
    $userprefs[16] = strip_tags($userprefs[16]);
    $userprefs[17] = strip_tags($userprefs[17]);
    $userprefs[18] = strip_tags($userprefs[18]);
    $userprefs[19] = strip_tags($userprefs[19]);
    $userprefs[20] = strip_tags($userprefs[20]);
    $userprefs[21] = strip_tags($userprefs[21]);
    $userprefs[22] = strip_tags($userprefs[22]);
    $userprefs[23] = strip_tags($userprefs[23]);
    $userprefs[24] = strip_tags($userprefs[24]);
    $userprefs[25] = strip_tags($userprefs[25]);
    $userprefs[26] = strip_tags($userprefs[26]);
    $userprefs[27] = strip_tags($userprefs[27]);
    $userprefs[28] = strip_tags($userprefs[28]);
    $userprefs[29] = strip_tags($userprefs[29]);
    $userprefs[30] = strip_tags($userprefs[30]);
}

if (!isset($selskin)) $selskin = import('selskin');
$selskin = preg_replace('`[^-a-z0-9_]`i', '', $selskin);
if (is_file(CHEMIN.'data/config/rotaskins.dtb')) {
    $now_time  = date('YmdHi');
    $skn       = $page[14];
    $rotaskins = @file(CHEMIN.'data/config/rotaskins.dtb');
    if (!empty($rotaskins)) {
        for ($i = 0; $i < count($rotaskins); $i++) {
            $rota    = explode(CONNECTOR, $rotaskins[$i]);
            $rota[0] = substr($rota[0], 0, 4) == '----' ? str_replace('----', date('Y'), $rota[0]) : $rota[0];
            $rotaskins[$i] = $rota[0].CONNECTOR.$rota[1];
        }
        rsort($rotaskins);
        foreach ($rotaskins as $rotaskin) {
            $rota     = explode(CONNECTOR, $rotaskin);
            if ($now_time >= $rota[0]) {
                $skn = $rota[1];
                $skn = $skn[strlen($skn)-1] == chr(10) ? substr($skn, 0, -1) : $skn;
                break;
            }
        }
        if (!empty($skn) && $skn != $page[14] && $selskin != $page[14] && $userprefs[10] == '') {
            $selskin  = $skn;
        }
    }
}
if (empty($page[14])) {
    $page[14] = 'no_skin';
}
// ne pas modifier les 2 lignes suivantes / do not modify the 2 following lines
if (!empty($userprefs[10])) { $page[14] = $userprefs[10]; }
/// Debut Fork GHOST
elseif (is_file(CHEMIN.'plugins/ghost/ghost.inc')) {
    include_once CHEMIN.'plugins/ghost/ghost.inc';
    if (!empty($_COOKIE[GHOST_COOKIE])) {
        $tmpprefs   = array_pad(array(), 31, '');
        $usercookie = $_COOKIE[GHOST_COOKIE];
        $positem    = 0;
        for ($i = 0; $i < 31; $i++) {
            $poslen       = $positem + 2;
            $posdata      = $positem + 4;
            $lendata      = intval(substr($usercookie, $poslen, 2));
            $tmpprefs[$i] = substr($usercookie, $posdata, $lendata);
            $tmpprefs[$i] = $tmpprefs[$i] == 'off' ? '' : $tmpprefs[$i];
            $positem      = $posdata + $lendata;
        }
        $page[14] = strip_tags($tmpprefs[10]);
        unset($tmprefs);
    }
}
/// Fin Fork GHOST					
if (!empty($selskin)) { $page[14] = $selskin; }
if (empty($selskin)) { $selskin = $page[14]; }

$pathconf = is_file(CHEMIN.'skins/'.$page[14].'/skin'.INCEXT) ? $page[14] : 'no_skin';
$fileconf = 'confweb';
include CHEMIN.'skins/'.$pathconf.'/skin'.INCEXT;
include CHEMIN.'inc/funcskin'.INCEXT;
include CHEMIN.'skins/'.$pathconf.'/confskin'.INCEXT;
include CHEMIN.'skins/'.$pathconf.'/'.$fileconf.INCEXT;
$z2 = !isset($body[16]) ? '#z2' : ($body[16] == 'on' ? '#z2' : '');

$lng  = empty($lng) ? $lang[0] : (!in_array($lng, $lang) ? $lang[0] : $lng);
$aml0 = 'articles.php?lng='.$lng.'&pg='.$serviz[177].'&tconfig='.$serviz[178];
$aml1 = $lng.'-'.$urlrw[20].'-102-'.$serviz[177].'-'.$serviz[178];
$aml  = '<a href="'.(!empty($serviz[177]) ? CHEMIN.($site['URLR'] == 'on' ? $aml1 : $aml0).$z2 : '#').'" title="">';
$wbm0 = $site['PG'].'.php?lng='.$lng.'&typ='.TYP_MAIL;
$wbm1 = $lng.'-'.$urlrw[14].'-'.TYP_MAIL;
$wbm  = '<a href="'.CHEMIN.($site['URLR'] == 'on' ? $wbm1 : $wbm0).$z2.'" title="">';
include CHEMIN.INCREP.'lang/'.$lng.'-help'.INCEXT;
include(CHEMIN.INCREP."lang/".$lng."-web".INCEXT);

$usertime = !empty($members[21]) ? intval($members[21]) : 157680000;
$expires  = $userprefs[1] == $serviz[31] || is_file(CHEMIN.'admin/'.REDACREP.$userprefs[1].INCEXT) ? 157680000 : $usertime;
$aconnect = isset($_COOKIE[CNCT_COOKIE]) ? explode(CONNECTOR, gy_decrypt(CRYPT_KEY, $_COOKIE[CNCT_COOKIE])) : array(0, '');
$savetime = intval($aconnect[0]);
$ctrltime = time() - $savetime;
$exit     = !empty($members[21]) ? $ctrltime >= $expires : false;
if ($exit && $userprefs[1] != '' && FileDBExist(MSGREP.$userprefs[1].DBEXT)) {
    ClearCookies();
    if (!defined('NO_CRYPT') && $serviz[100] > 0) {
        include CRYPTREP.$cryptos[$serviz[100]].'.php';
        include CRYPTREP.$cryptos[$serviz[100]].'.fct.php';
    }
    $location = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
    echo '
<script>
  window.location="'.$location.'";
</script>';
    header("location:".$location); 
    exit();
}

$userconnect = gy_crypt(CRYPT_KEY, time().CONNECTOR.$userprefs[1].CONNECTOR.date('Ymdhi'));
// avant @setcookie(CNCT_COOKIE, $userconnect, time() + $expires, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
// Modif pour 365 jours
@setcookie(CNCT_COOKIE, $userconnect, strtotime( '+365 days' ), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);

if (!isset($_SERVER['REQUEST_URI'])) {
    $REQUEST_URI = $_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING'];
}
StartTimer();

if (!headers_sent()) header('Content-type: text/html; charset='.$charset);

if ($lng == $lang[0]) {
    $npage = @array($web[169], getLabel($nom[1]), getLabel($nom[24]), getLabel($nom[22]), getLabel($nom[9]), getLabel($nom[0]), getLabel($nom[3]), 
    getLabel($nom[7]), getLabel($nom[2]), '', getLabel($nom[20]), getLabel($nom[26]), $web[144], getLabel($nom[42]), $web[485], 
    $web[486], $web[487], $web[488], $web[489], $web[490]);
} else {
    $npage = array($web[169], getLabel($nom[11]), getLabel($nom[25]), getLabel($nom[23]), getLabel($nom[19]), getLabel($nom[10]), getLabel($nom[13]),
        getLabel($nom[17]), getLabel($nom[12]), '', getLabel($nom[21]), getLabel($nom[27]), $web[144], getLabel($nom[43]),
        $web[485], $web[486], $web[487], $web[488], $web[489], $web[490]);
}

$flag1 = '<i class="flg-'.$lang[0].' align-middle" title="'.$lang[0].'"></i>';
$flag2 = '<i class="flg-'.$lang[1].' align-middle" title="'.$lang[1].'"></i>';

if (stristr($_SERVER['SCRIPT_NAME'], 'calendar.php') === false && stristr($_SERVER['SCRIPT_NAME'], 'blogcal.php') === false && strpos($endurl, '/install/') === false) {
    @include CHEMIN.INCREP.'log.inc' ;
    @include CHEMIN.INCREP.'log_stats.inc' ;
}
include CHEMIN.INCREP.'security.inc';
	$datjourl = new DateTime('now');
	$dateheureminiutesecl = $datjourl->format('Y_m_d');
	$nomficlog = CHEMIN.'data/log/security'.'_'.$dateheureminiutesecl.'.log';
if (!isset($actionwaf)) $actionwaf = '1';
if ($actionwaf == 1) ExecuteBannishment();					 

if (!defined('NO_CRYPT') && $serviz[100] > 0 && empty($_COOKIE['GuppYCrypt'])) include CRYPTREP.$cryptos[$serviz[100]].'.php';
  
if (strpos($endurl, '/install/') === false) {
    if ($serviz[44] == 'on' &&  ($userprefs[1] == '' || (trim($serviz[31]) != $userprefs[1] && trim($serviz[176]) != $userprefs[1]))) {
        header('location: '.CHEMIN.'maintenance.php?lng='.$lng);
    }
}

?>
lastRSS.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/lastRSS.inc'
View Content
<?php
/*
 ======================================================================
 lastRSS 0.9.1
 
 Simple yet powerfull PHP class to parse RSS files.
 
 by Vojtech Semecky, webmaster @ webdot . cz
 
 Latest version, features, manual and examples:
 	http://lastrss.webdot.cz/

 ----------------------------------------------------------------------
 LICENSE

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License (GPL)
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.

 To read the license please visit http://www.gnu.org/copyleft/gpl.html
 ======================================================================
*/
/**
* lastRSS
* Simple yet powerfull PHP class to parse RSS files.
*/

// may 2007 : added cURL if fopen failled (Gusman and Hpsam)

// added access security by JeanMi
if (stristr($_SERVER["SCRIPT_NAME"], "lastRSS.inc")) {
  header("location:../index.php");
  die();
}

class lastRSS {
	// -------------------------------------------------------------------
	// Public properties
	// -------------------------------------------------------------------
    var $default_cp = 'UTF-8';
    var $CDATA = 'content';
    var $cp = '';
    var $items_limit = 0;
    var $stripHTML = False;
    var $date_format = 'YmdHi';

	// -------------------------------------------------------------------
	// Private variables
	// -------------------------------------------------------------------
	var $channeltags = array ('title', 'link', 'description', 'language', 'copyright', 'managingEditor', 'webMaster', 'lastBuildDate', 'rating', 'docs');
	var $itemtags = array('title', 'link', 'description', 'author', 'category', 'comments', 'enclosure', 'guid', 'pubDate', 'source');
	var $imagetags = array('title', 'url', 'link', 'width', 'height');
	var $textinputtags = array('title', 'description', 'name', 'link');

	// -------------------------------------------------------------------
	// Parse RSS file and returns associative array.
	// -------------------------------------------------------------------
	function Get ($rss_url) {
		// If CACHE ENABLED
		if ($this->cache_dir != '') {
			$cache_file = $this->cache_dir . '/rsscache_' . md5($rss_url);
			$timedif = @(time() - filemtime($cache_file));
			if ($timedif < $this->cache_time) {
				// cached file is fresh enough, return cached array
				$result = unserialize(join('', file($cache_file)));
				// set 'cached' to 1 only if cached file is correct
				if ($result) $result['cached'] = 1;
			} else {
				// cached file is too old, create new
				$result = $this->Parse($rss_url);
				if ($result) {
				    $serialized = serialize($result);
    				if ($f = @fopen($cache_file, 'w')) {
    					fwrite ($f, $serialized, strlen($serialized));
    					fclose($f);
    				}
    				$result['cached'] = 0;
				}
			}
		}
		// If CACHE DISABLED >> load and parse the file directly
		else {
			$result = $this->Parse($rss_url);
			if ($result) $result['cached'] = 0;
		}
		// return result
		return $result;
	}
	
	// -------------------------------------------------------------------
	// Modification of preg_match(); return trimed field with index 1
	// from 'classic' preg_match() array output
	// -------------------------------------------------------------------
	function my_preg_match ($pattern, $subject) {
		// start regullar expression
		if(isset($subject)){
			preg_match($pattern, $subject, $out);

			// if there is some result... process it and return it
			if(isset($out[1])) {
				// Process CDATA (if present)
				if ($this->CDATA == 'content') { // Get CDATA content (without CDATA tag)
					$out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));
				} elseif ($this->CDATA == 'strip') { // Strip CDATA
					$out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));
				}

				// If code page is set convert character encoding to required
				if ($this->cp != '')
					$out[1] = iconv($this->rsscp, $this->cp.'//TRANSLIT', $out[1]);
				// Return result
				return trim($out[1]);
			} else {
				// if there is NO result, return empty string
				return '';
			}
		}
	}

	// -------------------------------------------------------------------
	// Replace HTML entities &something; by real characters
	// -------------------------------------------------------------------
	function unhtmlentities ($string) {
		// Get HTML entities table
		$trans_tbl = get_html_translation_table (HTML_ENTITIES, ENT_QUOTES);
		// Flip keys<==>values
		$trans_tbl = array_flip ($trans_tbl);
		// Add support for &apos; entity (missing in HTML_ENTITIES)
		$trans_tbl += array('&apos;' => "'");
		// Replace entities by values
		return strtr ($string, $trans_tbl);
	}

	// -------------------------------------------------------------------
	// Parse() is private method used by Get() to load and parse RSS file.
	// Don't use Parse() in your scripts - use Get($rss_file) instead.
	// -------------------------------------------------------------------
	function Parse ($rss_url) {
		// Open and load RSS file
		
// start modif cURL
        $load_ok = FALSE;
        $rss_content = '';
		$out_channel = array();
		if ($rss_url== '' )   return FALSE;
        if ($f = @fopen($rss_url, 'r')) {
            while (!feof($f)) {
                $rss_content .= fgets($f, 4096);
            }
            fclose($f);
			$load_ok = TRUE;
		} elseif (function_exists('curl_init') && $curl = @curl_init($rss_url)) {
            $timeout = 5; // set to zero for no timeout
            curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
            curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
            $rss_content = curl_exec($curl);
            curl_close($curl);
            if ($rss_content != FALSE) {
            	$load_ok = TRUE;
            }
		}
		if ($load_ok) {
// end modif cURL

			// Parse document encoding
			$result['encoding'] = $this->my_preg_match("'encoding=[\'\"](.*?)[\'\"]'si", $rss_content);
			// if document codepage is specified, use it
			if ($result['encoding'] != '')
				{ $this->rsscp = $result['encoding']; } // This is used in my_preg_match()
			// otherwise use the default codepage
			else
				{ $this->rsscp = $this->default_cp; } // This is used in my_preg_match()

			// Parse CHANNEL info
			preg_match("'<channel.*?>(.*?)</channel>'si", $rss_content, $out_channel);
			foreach($this->channeltags as $channeltag)
			{
				$temp = $this->my_preg_match("'<$channeltag.*?>(.*?)</$channeltag>'si", @$out_channel[1]);
				if ($temp != '') $result[$channeltag] = $temp; // Set only if not empty
			}
			// If date_format is specified and lastBuildDate is valid
			if ($this->date_format != '' && isset($result['lastBuildDate']) && ($timestamp = strtotime($result['lastBuildDate'])) !== -1) {
						// convert lastBuildDate to specified date format
						$result['lastBuildDate'] = date($this->date_format, $timestamp);
			}

			// Parse TEXTINPUT info
			preg_match("'<textinput(|[^>]*[^/])>(.*?)</textinput>'si", $rss_content, $out_textinfo);
				// This a little strange regexp means:
				// Look for tag <textinput> with or without any attributes, but skip truncated version <textinput /> (it's not beggining tag)
			if (isset($out_textinfo[2])) {
				foreach($this->textinputtags as $textinputtag) {
					$temp = $this->my_preg_match("'<$textinputtag.*?>(.*?)</$textinputtag>'si", $out_textinfo[2]);
					if ($temp != '') $result['textinput_'.$textinputtag] = $temp; // Set only if not empty
				}
			}
			// Parse IMAGE info
			preg_match("'<image.*?>(.*?)</image>'si", $rss_content, $out_imageinfo);
			if (isset($out_imageinfo[1])) {
				foreach($this->imagetags as $imagetag) {
					$temp = $this->my_preg_match("'<$imagetag.*?>(.*?)</$imagetag>'si", $out_imageinfo[1]);
					if ($temp != '') $result['image_'.$imagetag] = $temp; // Set only if not empty
				}
			}
			// Parse ITEMS
			preg_match_all("'<item(| .*?)>(.*?)</item>'si", $rss_content, $items);
			$rss_items = $items[2];
			$i = 0;
			$result['items'] = array(); // create array even if there are no items
			foreach($rss_items as $rss_item) {
				// If number of items is lower then limit: Parse one item
				if ($i < $this->items_limit || $this->items_limit == 0) {
					foreach($this->itemtags as $itemtag) {
						$temp = $this->my_preg_match("'<$itemtag.*?>(.*?)</$itemtag>'si", $rss_item);
						if ($temp != '') $result['items'][$i][$itemtag] = $temp; // Set only if not empty
					}
					// Strip HTML tags and other bullshit from DESCRIPTION
					if ($this->stripHTML && $result['items'][$i]['description'])
						$result['items'][$i]['description'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['description'])));
					// Strip HTML tags and other bullshit from TITLE
					if ($this->stripHTML && $result['items'][$i]['title'])
						$result['items'][$i]['title'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['title'])));
					// If date_format is specified and pubDate is valid
					if (isset($result['items'][$i]['pubDate']))
						if ($this->date_format != '' && ($timestamp = strtotime($result['items'][$i]['pubDate'])) !==-1) {
							// convert pubDate to specified date format
							$result['items'][$i]['pubDate'] = date($this->date_format, $timestamp);
						}
					// Item counter
					$i++;
				}
			}

			$result['items_count'] = $i;
			return $result;
		}
		else // Error in opening return FALSE
		{
			return FALSE;
		}
	}
}
?>
links.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/links.inc'
View Content
<?php
/*******************************************************************************
 *   Links
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.03 (August 10, 2021) : adaptation to php 8
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'links.inc')) {
    header('location:../index.php');
    die();
}

class GY_links {
    public $tconfig;
    public $topmess;
    protected $pg;
    protected $id;
    protected $dirlnk;
    
    public function __construct() {
        global $nom, $menuico, $page, $lang, $lng, $charset;
        $topmess = getLabel($nom[$lng == $lang[0] ? 3 : 13]);
        $this->topmess = $page[9] == '' ? $topmess : '<i class="fas fa-external-link-alt float-right align-middle"></i></i>'.$topmess;
        $this->tconfig = $menuico[16] == 'ALL' ? import('tconfig', '', true, 0) : $menuico[16];
        $this->pg      = import('pg');
        $this->id      = import('id');
        $this->dirlnk  = import('dirlnk');
    }
    
    public function LNK_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $out = '';
        if ($serviz[11] != 'on') {
            $out = '
    <div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array('LNK', $out);
        }
        elseif (!isAccessGranted($members[14])) {
            $out = '
	<div class="web342 text-center">'.$web[342];
            if ($members[19] != '0' && $members[19] != '3') {
                $href1 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 
                  : 'connect.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2);
                $href2 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
                  : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$this->tconfig.$z2);
                $out .= '
      <p class="text-center">
        '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
          (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
      </p>';
            }
            $out .= '
	</div>';
            return array('LNK', $out);
        }
        elseif (!empty($this->pg)) {
            $dbwork = SelectDbFieldsByField(ReadDBFields(DBLINKS), 4, $this->pg);
            $isdoc  = (count($dbwork) != 0);
            if ($isdoc) {
                $isdoc = isAuthorizedPublication($dbwork[0][5]);
                if (!isAccessGranted($dbwork[0][6])) return array('h0', '');
            }
            if (!$isdoc) {
                $dbwork = array();
                if ($site[10] != '') return array('h1', '');
                else return array('h2', '');
            }
        }
        return array('');
    }
    
    public function LNK_content() {
        global $lang, $lng, $web, $serviz, $urlrw, $site, $prt, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $k      = ($lng == $lang[0]) ? 0 : 1;
        $categ  = '';
        $dbwork = array();
        if (!empty($this->pg)) {
            $dbwork = SelectDbFieldsByField(ReadDBFields(DBLINKS), 4, $this->pg);
            $dbwan  = array();
        }
        else {
            $dbwan   = array();
            $dbwork2 = ReadDBFields(DBLINKS);
            $dbwork1 = array_filter($dbwork2, 'IsNotEmptyTitle');
            unset($dbwork2);
            if (empty($this->dirlnk) || $this->dirlnk == 'no') {
                foreach ($dbwork1 as $db) {
                    if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                        $cats  = explode('|', $db[0 + $k]);
                        $catan =  count($cats) > 1 ? $cats[0] : $web[649];
                        if (array_search($catan, $dbwan) === false) $dbwan[] = $catan;
                    }
                }
                if (count($dbwan) == 1 && $dbwan[0] == $web[649]) {
                    $this->dirlnk = 'no';
                    foreach ($dbwork1 as $db) 
                        if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) $dbwork[] = $db;
                    $dbwan = array();
                }
                sort($dbwan);
            }
            else {
                $dbwan = array();
                foreach ($dbwork1 as $db) {
                    if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                        $cats  = explode('|', $db[0 + $k]);
                        $cat0  = count($cats) > 1 ? $cats[0] : $web[649];
                        $pos   = mb_strpos($cat0, '-->');
                        $cat0  = $pos !== false ? mb_substr($cat0, $pos + 3) : $cat0;
                        $catan = KeepGoodChars(count($cats) > 1 ? $cat0 : $web[649]);
                        if ($this->dirlnk == $catan) {
                            $dbwork[] = $db;
                            $categ    = $cat0;
                        }
                    }
                }
                $categ = $this->dirlnk == KeepGoodChars($web[649]) ? $web[649] : $categ;
            }
            unset($dbwork1);
        }
        sort($dbwork);
        $out = '
<div><p class="text-center">'.$web[38].'</p></div>';
        if (empty($this->dirlnk) && empty($this->pg) && !empty($dbwan)) {
            foreach ($dbwan as $an) {
                $pos  = mb_strpos($an, '-->');
                $an   = $pos !== false ? mb_substr($an, $pos + 3) : $an;
                $out .= '
<a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[6].'-6-'.KeepGoodChars($an).'-'.$this->tconfig.$z2 : 'links.php?lng='.$lng.'&amp;dirlnk='.KeepGoodChars($an).'&amp;tconfig='.$this->tconfig.$z2).'">
  <div class="licatlink">
    <i class="fas fa-external-link-square-alt" title="'.$an.'"></i>'.$an.'
  </div>
</a>';
            }
        } 
        else {
            if (empty($this->id)) $this->id = 1;
            if (empty($this->pg) && $this->dirlnk != 'no') {
                if (!empty($categ)) $out .= '
<div class="lititlecat">'.$categ.'</div>';
                $out .= '
<div class="text-center">
  <form name="retanlnk" method="post" action="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[6].'-'.$this->tconfig.$z2 
      : 'links.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'">
    '.SubmitButton($web[650]).'
  </form>
</div>';
            }
            if (!empty($dbwork)) {
                $typeRubrique = TYP_LINKS;
                $imgOpen      = "far fa-plus-square";
                $imgClose     = "far fa-minus-square";
                $subImgOpen   = "far fa-caret-square-down align-middle pt-2";
                $subImgClose  = "far fa-caret-square-up align-middle pt-2";
                $nlpg         = (count($dbwork)-($serviz[5]*($this->id-1))>$serviz[5])? $serviz[5] : count($dbwork)-($serviz[5]*($this->id-1)) ;
                $out         .= BeginJavascript().'var maxsub = '.$nlpg.';'.EndJavascript();
                $rubr         = '';
                $l            = 0;
                if (3 == abs($prt)) {
                    $this->id  = 1;
                    $serviz[5] = 99999;
                }
                $isNew = false;
                for ($i = $serviz[5]*($this->id-1); $i < Min($serviz[5]*$this->id, count($dbwork)); $i++) {
                    ReadDoc($dbwork[$i][4]);
                    $img = getNewUpdateDoc($creadate, $moddate, $serviz[144]);
                    if ($img != '') $isNew = true;
                    if ($lng == $lang[0]) {
                        $txt1 = $img.$fieldb1;
                        $txt2 = $fieldc1;
                        $txt3 = $fielda1;
                        $txt4 = $fieldd1;
                    } else {
                        $txt1 = $img.$fieldb2;
                        $txt2 = $fieldc2;
                        $txt3 = $fielda2;
                        $txt4 = $fieldd2;
                    }
                    if ($rubr <> $txt3 || $txt3 == '') {
                        $rubr  = $txt3;
                        $rubrs = explode('|', $rubr);
                        $srubr = count($rubrs) > 1 ? $rubrs[1] : $rubrs[0];
                        if ($l > 0) $out .= '
</div>';
                        if (trim($rubr) != '') {
                            $l++;
                            $out .= '
<div id="titreRubr'.$typeRubrique.$i.'" class="lirubr font-weight-bold" 
    onclick="MontreCacheItems(\'imgOpen'.$typeRubrique.$i.'\',\'imgClose'.$typeRubrique.$i.'\',\'itemsRubr'.$typeRubrique.$i.'\',\'itemsRubrSelect\');">
  <i id="imgOpen'.$typeRubrique.$i.'" class="'.$imgOpen.'" title="'.$web[429].'" style="display: none;"></i>
  <i id="imgClose'.$typeRubrique.$i.'" class="'.$imgClose.'" title="'.$web[57].'" style="display: inline;"></i>
  &nbsp;'.$srubr.'
</div>';
                            if (count($dbwork) == 1) $out .= '
<div id="itemsRubrSelect" style="display: block;">';
                            else $out .= '
<div id="itemsRubr'.$typeRubrique.$i.'" style="display: block;">';
                        }
                    }
                    $n = (count($dbwork) > $serviz[5])? $i-$serviz[5]*$this->id+$serviz[5] : $i;
                    $out .= '
  <div id="titreSubRubr'.$typeRubrique.$i.'" class="lirubr2 font-weight-bold" 
      onclick="MontreCacheItems(\'subImgOpen'.$typeRubrique.$i.'\',\'subImgClose'.$typeRubrique.$i.'\',
        \'itemSubRubr'.$typeRubrique.$i.'\',\'itemSubRubrSelect\');">'."\n".'
	<div class="float-left text-right lirubr3">
      <i id="subImgOpen'.$typeRubrique.$i.'" class="'.$subImgOpen.'" title="'.$web[429].'" style="display: none;"></i>
      <i id="subImgClose'.$typeRubrique.$i.'" class="'.$subImgClose.'" title="'.$web[57].'" style="display: inline;"></i>
    </div>'."\n".'
    <div class="lisubrubr"><a id="subRubr'.$typeRubrique.$i.'">'.$txt1.'</a></div>'."\n".'
  </div>'."\n";
                    if (count($dbwork) == 1) $out .= '
<div class="bord2" id="itemSubRubrSelect" style="display: block;">';
                    else $out .= '
<div class="bord2" id="itemSubRubr'.$typeRubrique.$i.'" style="display: block;">';
                    $printurl = $prt != 0 ? ' <strong> '.$txt4.' </strong>' : '';
                    $out .= '
  <div class="rep licontent">'.$txt2.'<div class="clearfix"></div>
    <p class="text-right c-pointer">';
                    $out .= '
      <a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[6].'-1-'.$dbwork[$i][4].$z2 : 'links.php?lng='.$lng.'&amp;pg='.$dbwork[$i][4].$z2).'">
        <i class="fas fa-link align-middle" title="'.$web[527].'"></i>
      </a>&nbsp;&nbsp;';
                    $out .= '
      <a href="'.$txt4.'" target="_blank">
        <i class="fas fa-globe align-middle" title="'.$web[304].'"></i>'.$printurl.'
      </a>
    </p>
  </div><div class="clearfix"></div>';
                    if (empty($prt)) $out .= 
  displayQuickConfig(NULL, $dbwork[$i][4], 'links&amp;form=2&amp;id='.$dbwork[$i][4], 
    'links&amp;act=i&amp;id='.$dbwork[$i][4], 'links&amp;del='.$dbwork[$i][4], 20);
                    $out .= '
</div>';
                }
                if ($l > 0) $out .= '
</div>';
                if (0 == $prt && 'on' != $serviz[80] && !$isNew) $out .= 
BeginJavascript().'
var nbRubr = '.$i.';
var typeRubr = "'.$typeRubrique.'";
for(i = 0; i < nbRubr; i++) {
	if((document.getElementById && document.getElementById("itemsRubr"+ typeRubr + i) != null) 
      || (document.all && document.all["itemsRubr"+ typeRubr + i] != undefined ) 
      || (document.layers && document.layers["itemsRubr"+ typeRubr + i] != undefined) ) {
		cache("itemsRubr"+ typeRubr + i);
		montre("imgOpen"+ typeRubr + i, "inline");
		cache("imgClose"+ typeRubr + i);
	}
}'.EndJavascript();
                if (0 == $prt && 'on' != $serviz[80]) $out .= 
BeginJavascript().'
var nbRubr = '.$i.';
var typeRubr = "'.$typeRubrique.'";
for(i = 0; i < nbRubr; i++) {
	if((document.getElementById && document.getElementById("itemSubRubr"+ typeRubr + i) != null) 
      || (document.all && document.all["itemSubRubr"+ typeRubr + i] != undefined ) 
      || (document.layers && document.layers["itemSubRubr"+ typeRubr + i] != undefined) ) {
		cache("itemSubRubr"+ typeRubr + i);
		montre("subImgOpen"+ typeRubr + i, "inline");
		cache("subImgClose"+ typeRubr + i);
	}
}'.EndJavascript();
            }
            elseif (!empty($this->pg)) $out .= '
<p>'.$web[36].'</p>';
            $out .= GetNavBar(($site['URLR'] == 'on' ? $lng.'-'.$urlrw[6].'-4-'.$this->dirlnk.'-' 
              : 'links.php?lng='.$lng.'&amp;dirlnk='.$this->dirlnk.'&amp;id='), count($dbwork), $this->id, $serviz[5], $z2);
            if (empty($this->pg) && $this->dirlnk != 'no') $out .= '
<div class="text-center">
  <form 
      name="retanlnk" 
      action="'.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[6].'-'.$this->tconfig.$z2 
        : 'links.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
      method="post">
    '.SubmitButton($web[650]).'
  </form>
</div>';
        }
        return array('LNK', $out);
    }
}
?>
log.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/log.inc'
View Content
<?php
/*******************************************************************************
 *   Activity Log
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 *  v6.00.20 (October 24, 2024) : Modify script
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'log.inc')) {
    header('location:../index.php');
    die();
}

function BotDetected() {
    if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider|qwantify/i', $_SERVER['HTTP_USER_AGENT'])) 
        return TRUE;
    else 
        return FALSE;
}
$isBotDetected = BotDetected();
date_default_timezone_set('UTC'); // Les journaux sont basés sur le temps universel.

if (!isset($_SERVER['REQUEST_URI'])) {
    $REQUEST_URI = $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];
    $log1 = $_SERVER['SCRIPT_NAME'];
} else {
    $log1 = strip_tags($_SERVER['REQUEST_URI']);    
}
$log2  = $_SERVER["HTTP_USER_AGENT"];
$ulog2 = mb_strtoupper($log2, $charset);//strtoupper($log2);//
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $log3 = $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif(isset($_SERVER['HTTP_CLIENT_IP'])) {
    $log3 = $_SERVER['HTTP_CLIENT_IP'];
} else {
    $log3 = $_SERVER['REMOTE_ADDR'];
}
$log3 = getIPadress($log3);
$yr   = (integer) date('Y');
$mh   = (integer) date('m');
$dy   = (integer) date('d');
$hr   = (integer) date('H');

if (
    (strstr($log2, 'Nav')) || (strstr($log2, 'Gold')) || (strstr($log2, 'X11')) ||
    (strstr($log2, 'Netscape')) AND (!strstr($log2, 'MSIE'))
   ) $browser = 0; // Netscape
elseif (strstr($log2,  'Avant Browser')) $browser = 10;
elseif (strstr($log2,  'Crazy Browser')) $browser = 11;
elseif (strstr($ulog2, 'MAXTHON')) $browser = 12;
elseif (strstr($log2,  'MSIE') || (strstr($log2,  'Edg'))) $browser = 1; // MSIE Edge
elseif (strstr($log2,  'Flock')) $browser = 20;
elseif (strstr($log2,  'Iceweasel')) $browser = 21;
elseif (strstr($log2,  'Firefox')) $browser = 19;
elseif (strstr($log2,  'Chrome')) $browser = 22;
elseif (strstr($log2,  'Nintendo wii')) $browser = 18;
elseif (strstr($log2,  'Opera')) $browser = 4;
elseif (strstr($log2,  'Lynx')) $browser = 13;
elseif (strstr($log2,  'Safari')) $browser = 14;
elseif (strstr($log2,  'Camino')) $browser = 23;
elseif (strstr($log2,  'Konqueror')) $browser = 6;
elseif (strstr($log2,  'Dillo')) $browser = 24;
elseif (strstr($log2,  'Element Browser')) $browser = 25;
elseif (strstr($log2,  'Epiphany')) $browser = 26;
elseif (strstr($log2,  'Galeon')) $browser = 28;
elseif (strstr($log2,  'K-Meleon')) $browser = 29;
elseif (strstr($log2,  'Kazehakase')) $browser = 30;
elseif (strstr($log2,  'Minefield')) $browser = 31;
elseif (strstr($ulog2, 'SEAMONKEY')) $browser = 15;
elseif (strstr($log2,  'Playstation portable')) $browser = 16;
elseif (strstr($log2,  'PLAYSTATION 3')) $browser = 17;
elseif (strstr($log2,  'Wget')) $browser = 9;
elseif (strstr($log2,  'DA')) $browser = 3;
elseif (strstr($log2,  'iCab')) $browser = 5;
elseif (
    (strstr($log2, 'bot')) || (strstr($log2, 'Google')) || (strstr($log2, 'Slurp')) ||
    (strstr($log2, 'Seeker')) || (strstr($log2, 'Scooter')) ||
    (strstr($log2, 'Spider')) || (strstr($log2, 'Infoseek'))
       ) $browser = 7;
elseif (strstr($log2,  'Mozilla')) $browser = 2;
else $browser = 8;

if (FileDBExist(DBLOGH)) {
	$dblog = ReadDBFields(DBLOGH);
}
else {
	$dblog = InitDBlog(1);
	$dblog[0][0] = $hr;
}

if ($hr != $dblog[0][0] && !$isBotDetected) {
    $dblog[7][0] = 0;
    WriteDBFields(DBLOGH,$dblog);
    if (FileDBExist(DBLOGD)) {
        $dblod = ReadDBFields(DBLOGD);
    }
    else {
        $dblod = InitDBlog(STATS_NBHEURE);
        $dblod[0][0] = $dy;
    }
	for ($i = 0; $i < STATS_NBPAGE; $i++) {
        $dblod[1][$i] = (isset($dblod[1][$i]) ? (is_numeric($dblod[1][$i]) ? $dblod[1][$i] : 0) : 0) + (isset($dblog[1][$i]) ? (is_numeric($dblog[1][$i]) ? $dblog[1][$i] : 0) : 0);
    }
    for ($i = 0; $i < STATS_NBLANGUE; $i++) {
        $dblod[2][$i] = (isset($dblod[2][$i]) ? (is_numeric($dblod[2][$i]) ? $dblod[2][$i] : 0) : 0) + (isset($dblog[2][$i]) ? (is_numeric($dblog[2][$i]) ? $dblog[2][$i] : 0) : 0);
    }
    for ($i = 0; $i < STATS_NBBROWSER; $i++) {
        $dblod[3][$i] = (isset($dblod[3][$i]) ? (is_numeric($dblod[3][$i]) ? $dblod[3][$i] : 0) : 0) + (isset($dblog[3][$i]) ? (is_numeric($dblog[3][$i]) ? $dblog[3][$i] : 0) : 0);
    }
    for ($i = 0; $i < STATS_NBOS; $i++) {
        $dblod[4][$i] = (isset($dblod[4][$i]) ? (is_numeric($dblod[4][$i]) ? $dblod[4][$i] : 0) : 0) + (isset($dblog[4][$i]) ? (is_numeric($dblog[4][$i]) ? $dblog[4][$i] : 0) : 0);
    }
    $dblod[5][$dblog[0][0]] = $dblod[5][$dblog[0][0]]+$dblog[5][0];
    $dblod[6][$dblog[0][0]] = $dblod[6][$dblog[0][0]]+$dblog[6][0];
    WriteDBFields(DBLOGD,$dblod);
    $dblog = InitDBlog(1);
    $dblog[0][0] = $hr;
    WriteDBFields(DBLOGH,$dblog);
    if ($dy != $dblod[0][0]) {
        SaveOldDbLog($dblod);
        if (FileDBExist(DBLOGM)) {
            $dblom = ReadDBFields(DBLOGM);
        } else {
            $dblom = InitDBlog(STATS_NBJOUR);
            $dblom[0][0] = $mh;
        }
        for ($i = 0; $i < STATS_NBPAGE; $i++) {
			$dblom[1][$i] = empty($dblom[1][$i]) ? 0 : $dblom[1][$i];
			$dblod[1][$i] = empty($dblod[1][$i]) ? 0 : $dblod[1][$i];
            $dblom[1][$i] = $dblom[1][$i] + $dblod[1][$i];
        }
        for ($i = 0; $i < STATS_NBLANGUE; $i++) {
			$dblom[2][$i] = empty($dblom[2][$i]) ? 0 : $dblom[2][$i];
			$dblod[2][$i] = empty($dblod[2][$i]) ? 0 : $dblod[2][$i];
            $dblom[2][$i] = $dblom[2][$i] + $dblod[2][$i];
        }
        for ($i = 0; $i < STATS_NBBROWSER; $i++) {
			$dblom[3][$i] = empty($dblom[3][$i]) ? 0 : $dblom[3][$i];
			$dblod[3][$i] = empty($dblod[3][$i]) ? 0 : $dblod[3][$i];
            $dblom[3][$i] = $dblom[3][$i] + $dblod[3][$i];
        }
        for ($i = 0; $i < STATS_NBOS; $i++) {
			$dblom[4][$i] = empty($dblom[4][$i]) ? 0 : $dblom[4][$i];
			$dblod[4][$i] = empty($dblod[4][$i]) ? 0 : $dblod[4][$i];
            $dblom[4][$i] = $dblom[4][$i] + $dblod[4][$i];
        }
        for ($i = 0; $i < STATS_NBHEURE; $i++) {
            $dblom[5][$dblod[0][0]-1] = (int)$dblom[5][$dblod[0][0]-1] + (int)$dblod[5][$i];
        }
        for ($i = 0; $i < STATS_NBHEURE; $i++) {
            $dblom[6][$dblod[0][0]-1] = (int)$dblom[6][$dblod[0][0]-1] + (int)$dblod[6][$i];
        }
        WriteDBFields(DBLOGM,$dblom);
        $dblod = InitDBlog(STATS_NBHEURE);
        $dblod[0][0] = $dy;
        WriteDBFields(DBLOGD,$dblod);
        if ($mh != $dblom[0][0]) {
            SaveOldDbLog($dblom);
            if (FileDBExist(DBLOGY)) {
                $dbloy = ReadDBFields(DBLOGY);
            } else {
                $dbloy = InitDBlog(STATS_NBMOIS);
                $dbloy[0][0] = $yr;
            }
            for ($i = 0; $i < STATS_NBPAGE; $i++) {
				$dbloy[1][$i] = empty($dbloy[1][$i]) ? 0 : $dbloy[1][$i];
				$dblom[1][$i] = empty($dblom[1][$i]) ? 0 : $dblom[1][$i];
                $dbloy[1][$i] = $dbloy[1][$i] + $dblom[1][$i];
            }
            for ($i = 0; $i < STATS_NBLANGUE; $i++) {
				$dbloy[2][$i] = empty($dbloy[2][$i]) ? 0 : $dbloy[2][$i];
				$dblom[2][$i] = empty($dblom[2][$i]) ? 0 : $dblom[2][$i];
                $dbloy[2][$i] = $dbloy[2][$i] + $dblom[2][$i];
            }
            for ($i = 0; $i < STATS_NBBROWSER; $i++) {
				$dbloy[3][$i] = empty($dbloy[3][$i]) ? 0 : $dbloy[3][$i];
				$dblom[3][$i] = empty($dblom[3][$i]) ? 0 : $dblom[3][$i];
                $dbloy[3][$i] = $dbloy[3][$i] + $dblom[3][$i];
            }
            for ($i = 0; $i < STATS_NBOS; $i++) {
				$dbloy[4][$i] = empty($dbloy[4][$i]) ? 0 : $dbloy[4][$i];
				$dblom[4][$i] = empty($dblom[4][$i]) ? 0 : $dblom[4][$i];
                $dbloy[4][$i] = $dbloy[4][$i] + $dblom[4][$i];
            }
            for ($i = 0; $i < STATS_NBJOUR; $i++) {
                $dbloy[5][$dblom[0][0]-1] = (int)$dbloy[5][$dblom[0][0]-1] + (int)$dblom[5][$i];
            }
            for ($i = 0; $i < STATS_NBJOUR; $i++) {
                $dbloy[6][$dblom[0][0]-1] = (int)$dbloy[6][$dblom[0][0]-1] + (int)$dblom[6][$i];
            }
            WriteDBFields(DBLOGY,$dbloy);
            $dblom = InitDBlog(STATS_NBJOUR);
            $dblom[0][0] = $mh;
            WriteDBFields(DBLOGM,$dblom);
            if ($yr != $dbloy[0][0]) {
                SaveOldDbLog($dbloy);
                $dbloy = InitDBlog(STATS_NBMOIS);
                $dbloy[0][0] = $yr;
                WriteDBFields(DBLOGY,$dbloy);
            }
        }
    }
}

$page2type = array(
    'articles.php'      => 0, $urlrw[20] => 0,
    $site['DN'].'.php'  => 1, $urlrw[11] => 1,
    'faq.php'           => 2, $urlrw[4]  => 2,
    $site['FR'].'.php'  => 3, $site['TH'].'.php' => 3, $site['FRT'].'.php' => 3, $urlrw[5] => 3,
    $site['GB'].'.php'  => 4, $urlrw[7] => 4,
    'index.php'         => 5, $urlrw[0].'1' => 5,
    'links.php'         => 6, $urlrw[6] => 6,
    $site['NE'].'.php'  => 7, $urlrw[8] => 7,
    'photos.php'        => 8,
    'photorama.php'     => 8,
    'photorama2.php'    => 8,
    $urlrw[9]           => 8,
    'search.php'        => 10,
    $urlrw[12]          => 10,
    'admin.php'         => 12, $urlrw[0].'-19'     => 12,
    $site['BL'].'.php'  => 13, $site['BLS'].'.php' => 13, $urlrw[1] => 13,
    $site['NL'].'.php'  => 14, $urlrw[18] => 14,
    'newsrss.php'       => 15,
    'blogrss.php'       => 16,
    'agenda.php'        => 17, $site['CT'].'.php' => 17, $urlrw[17] => 17, $urlrw[2] => 17,
    'plugins/'          => 18,
    'pages/'            => 19
);
$pgtype = FALSE;
foreach($page2type as $key => $val) {
    if (1 == preg_match('!'.$key.'!', $log1)) {
        $pgtype = $val;
        break;
    }
}
unset($page2type);
if (FALSE === $pgtype && $log1[strlen($log1)-1] == "/") $pgtype = 5;

if (FALSE !== $pgtype && !$isBotDetected) {
    if ('on' == $configlog[$pgtype]) {
        $loguser = array();
		$compteur++;
		WriteCounter(DBCOUNTERLOGBK,$compteur);
        if (FileDBExist(DBLOGBOOK)) {
            $loguser[0] = GetCurrentDateTimeSec();
            $loguser[1] = $log3;
            $loguser[2] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
            $loguser[3] = @gethostbyaddr($log3);
            $loguser[4] = $browser;
            $loguser[5] = rawurldecode(htmlspecialchars(substr($log1, 1)));
			$loguser[6] = $log2;
			$loguser[7] = $_SERVER['SCRIPT_NAME'];
			$loguser[8] = $_SERVER['QUERY_STRING'];
            AppendDBFields(DBLOGBOOK, $loguser);
        }
        else {
            $loguser[0][0] = GetCurrentDateTimeSec();
            $loguser[0][1] = $log3;
            $loguser[0][2] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
            $loguser[0][3] = @gethostbyaddr($log3);
            $loguser[0][4] = $browser;
            $loguser[0][5] = rawurldecode(htmlspecialchars(substr($log1, 1)));
			$loguser[0][6] = $log2;
			$loguser[0][7] = $_SERVER['SCRIPT_NAME'];
			$loguser[0][8] = $_SERVER['QUERY_STRING'];
            WriteDBFields(DBLOGBOOK, $loguser);
        }
        $amsglog = CountDBFields(DBLOGBOOK);
        while ($amsglog > $configlogNB) {
            DeleteDBFieldById(DBLOGBOOK);
            $amsglog = CountDBFields(DBLOGBOOK);
        }
    }

    $dblog[1][$pgtype]++;
    $dblog[5][0]++;

    if(empty($lang[1])) {
        $dblog[2][0]++;
    } elseif(strstr($log1, 'lng='.$lang[1])) {
        $dblog[2][1]++;
    } else {
        $dblog[2][0]++;
    }
    
    $var_bool = false;
    $subdata = array();
    $subdata = ReadDBFields(DBIPSTATS);
    for ($i = 0; $i < count($subdata); $i++) {
        if ($log3 == $subdata[$i][0]) {
            $now_time = time();
            list($zjour, $zmois, $zannee) = explode('/', substr($subdata[$i][1], 0, 10));
            list($zheure, $zminute, $zseconde) = explode(':', substr($subdata[$i][1], 10, 18));
            if ($now_time < mktime((int)$zheure, (int)$zminute, (int)$zseconde, (int)$zmois, (int)$zjour, (int)$zannee) + HIT_TIME) {
                $var_bool = true;
            }
        }
    }
    if ($var_bool == false) {
        $dblog[6][0]++;
        $dblog[3][$browser]++;

        if (strstr($log2, 'Win')) $dblog[4][0]++;
        elseif ((strstr($log2, 'Mac')) || (strstr($log2, 'PPC'))) $dblog[4][1]++;
        elseif (strstr($log2, 'Linux')) $dblog[4][2]++;
        elseif (strstr($log2, 'FreeBSD')) $dblog[4][3]++;
        elseif (strstr($log2, 'SunOS')) $dblog[4][4]++;
        elseif (strstr($log2, 'IRIX')) $dblog[4][5]++;
        elseif (strstr($log2, 'BeOS')) $dblog[4][6]++;
        elseif (strstr($log2, 'OS/2')) $dblog[4][7]++;
        elseif (strstr($log2, 'AIX')) $dblog[4][8]++;
        else $dblog[4][9]++;
    }
    WriteDBFields(DBLOGH,$dblog);
}
$tabcounter = CompteVisites(DBIPSTATS, DBSTATS);
if ($tabcounter[0] > 0 && ($tabcounter[0]/10) == intval($tabcounter[0]/10)) {
    WriteCounter(DBSTATSBK, $tabcounter[0]);
}
if ($tabcounter[0] < 10) {
    $oldcount = ReadCounter(DBSTATSBK);
    if ($oldcount > 10) {
        WriteCounter(DBSTATS,$oldcount);
        $tabcounter[0] = $oldcount;
    }
}
if ($supervision[0] == 'on' && $supervision[1] > 0) {
    if (($tabcounter[0]/$supervision[1]) == intval($tabcounter[0]/$supervision[1])) {
        $old_count = ReadCounter(DBCOUNTER);
        if ($tabcounter[0] != $old_count) {
            WriteCounter(DBCOUNTER,$tabcounter[0]);
            $eSub = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).' - '.$web[102];
            $eMsg = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).' - '.$web[103].' '.$web[102].' '.$web[104].' '.date('d/m/Y H:i:s').'.<br />';
            $eMsg .= $web[105].' '.$tabcounter[0].'.';
            eMailHtmlTo($eSub,$eMsg);
        }
    }
}

date_default_timezone_set($site['TZ']);

// lecture dans le dossier data/log et prendre les details des fichiers
$meslogsmtp = CHEMIN."data/log/"; // Dossier contenant les logs SMTP
$file_names = array();
$file_dates = array();
$handler = opendir($meslogsmtp);
$i = 0;
if (!isset($smtp[6]))  $smtp[6] = '';
if ($smtp[6] == 'on') // Activation LOG SMTP 
{	
	if (!isset($smtp[7]))  $smtp[7] = 0;
	if (!is_numeric($smtp[7])) $smtp[7] = 0;
	while ($file = readdir($handler)) {  
		if ($file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess"){
			$i++;
			$currentModified = filectime($meslogsmtp."/".$file);
			$file_names[] = $file;
			$file_dates[] = $currentModified;
		}    
	}
	closedir($handler);
	asort($file_dates); // tri du plus ancien
	//Match file_names array to file_dates array
		$file_names_Array = array_keys($file_dates);
		foreach ($file_names_Array as $idx => $name) $name=$file_names[$name];
		$file_dates = array_merge($file_dates);
		
		$i = 0;

		//Loop through dates array and then echo the list
		foreach ($file_dates as $file_dates){
			$date = $file_dates;
			$j = $file_names_Array[$i];
			$file = $file_names[$j];
			$i++;
			$datefichier = date("Ymd.", $date);	
			$datejour = date("Ymd"); 		
	 //       echo  'File name: '.$file.' - Date Added: '. $datefichier.'<br/>';   
		
	 //       echo 'Date du jour: '.$datejour.'<br/>'; 
			$diffjoursdate = $datejour-$datefichier;
			
	 //      echo 'Diff en nombre de jours: '.$diffjoursdate.'<br/>';  
			if ($diffjoursdate > $smtp[7])
			{
	//			echo 'Suppression : '.$file.'<br />';
				SetChmod($meslogsmtp."/".$file);
				@unlink($meslogsmtp."/".$file);
			}
			
		}
} // PAs Activation de log SMTP
?>
log_stats.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/log_stats.inc'
View Content
<?php
/*******************************************************************************
 *   Counter Log
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.03 (August 10, 2021) : adaptation to php 8
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'log_stats.inc')) {
    header('location:../index.php');
    die();
}

function log_test() {
    if (is_file(DBLOGDATE)) {
        $last = ReadCounter(DBLOGDATE);
        return ($last != date('d/m/y'));
    } else {
        return TRUE;
    }
}

function log_stats() {
    WriteCounter(DBLOGDATE, date('d/m/y'));
    $s = ReadCounter(DBSTATS);
    $fhandle = fopen(DBLOGSTATS, 'a');
    fputs($fhandle, date('d/m/y;').$s."\n");
    fclose($fhandle);
}

if (log_test()) log_stats();
?>
mod_blog.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/mod_blog.inc'
View Content
<?php
/*******************************************************************************
 *   Blog update routine
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'mod_blog.inc')) {
    header('location:../index.php');
    die();
}

if (!empty($pg)) {
    ReadDoc($pg);
    $fileid = $pg;
    if ($mod == 'maj') {
        $note = '<hr /><u>'.$web[417].'</u> '.$web[6].' '.$userprefs[1].' '.$web[7].' '.FormatDate(date('YmdHi'));
        if ($lang[0] == $lng) {
            $fielda1 = addslashes(stripslashes($rub));
            $fieldb1 = addslashes(stripslashes($ptit));
            $fieldc1 = addslashes(stripslashes(replaceimg(ReplaceDolar(PutBR($ptxt))))).$note;
        }
        else {
            $fielda2 = addslashes(stripslashes($rub));
            $fieldb2 = addslashes(stripslashes($ptit));
            $fieldc2 = addslashes(stripslashes(replaceimg(ReplaceDolar(PutBR($ptxt))))).$note;
        }
		$fieldd1 = ($pehide == 'on') ? 'on' : '';
        WriteDoc();

		if ($supervision[8] == "on") {
			$eSub  = stripslashes($site[($lang[0] == $lng ? 0 : 11)])." ".$web[688];
			$eMsg  = stripslashes($site[($lang[0] == $lng ? 0 : 11)])." - ".$web[688].", ".$web[104]." ".$datefrmt.".<br />";
			$eMsg .= $web[107].stripslashes($pseudo)." (".stripslashes($pemail).").<br />";
			$eMsg .= $web[108].stripslashes($ptit)."<br />";
			$eMsg .= '<hr />'.$web[109].'<br />'.ForceToAbsolute(stripslashes($ptxt)).$note;
			$eMsg .= "<hr />".$web[349]." : ".$web[354].$id;
			$eMsg .= "<br />".$web[360].'<a href="'.$site[3].$site['BL'].".php?lng=".$lng."&pg=".$id.'">'.$site[3].$site['BL'].".php?lng=".$lng."&pg=".$id.'</a>';
			$eMsg .= "<br />".$web[350].'<a href="'.$site[3]."admin/admin.php?lng=".$lng."&pg=blog&form=2&id=".$id.'">'.$site[3]."admin/admin.php?lng=".$lng."&pg=blog&form=2&id=".$id.'</a>';
			if ($site[30] == "1") {
				$eMsg .= "<br />".$web[351].'<a href="'.$site[3]."admin/admin.php?lng=".$lng."&pg=blog&act=a&id=".$id.'">'.$site[3]."admin/admin.php?lng=".$lng."&pg=blog&act=a&id=".$id.'</a>';
			} else {
				$eMsg .= "<br />".$web[352].'<a href="'.$site[3]."admin/admin.php?lng=".$lng."&pg=blog&act=i&id=".$id.'">'.$site[3]."admin/admin.php?lng=".$lng."&pg=blog&act=i&id=".$id.'</a>';
			}
			$eMsg .= "<br />".$web[353].'<a href="'.$site[3]."admin/admin.php?lng=".$lng."&pg=blog&del=".$id.'">'.$site[3]."admin/admin.php?lng=".$lng."&pg=blog&del=".$id.'</a>';
			$eMsg .= "<hr />".$infos;
			$maillist = GetListCollaboratorEmail(TYP_BLOG);
			eMailHtmlTo($eSub, $eMsg, trim(implode(' ', $maillist).' '.trim($supervision[10]).' '.$user[1]), $user[1], '', $pemail);
		}
	}
}
?>
mod_thread.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/mod_thread.inc'
View Content
<?php
/*******************************************************************************
 *   Thread update routine
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.11 (March 09, 2023) : correction variable $bodycorps
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'mod_thread.inc')) {
    header('location:../index.php');
    die();
}
if (!empty($pg)) {
    $th_id = '';
    ReadDoc($pg);
    $fileid = $pg;
    if ($mod == 'up' ) {
        $moddate   = date('YmdHi', time() + (3600 * $forum[5]));
        $fieldmod  =  'u#'.$userprefs[1].'#'.date('YmdHi');
        $web[111] .= ' : '.$web[364];
    }
    elseif ($mod == 'top' ) {
        $moddate   = $forum[6] == 0 ? '301201010101' : date('YmdHi', time() + (86400 * $forum[6]));
        $fieldmod  =  't#'.$userprefs[1].'#'.$moddate;
        $web[111] .= '  : '.$web[365];
    }
    elseif ($mod == 'lock' ) {
        $fieldmod =  'c#'.$userprefs[1].'#'.date('YmdHi');
        $web[111] .= ' : '.$web[363];
    }
    elseif ($mod == 'stop' ) {
        $fieldmod =  's#'.$userprefs[1].'#'.date('YmdHi');
        $web[111] .= ' : '.$web[363];
    }
    elseif ($mod == 'raz' ) {
        $fieldmod = '';
        $web[111] .= ' : '.$web[621];
    }
    elseif ($mod == 'maj' ) {
        $fieldmod = '';
        $web[111] .= ' : '.$web[369];
    }
    elseif ($mod == 'move' ) {
        $fieldmod = '';
        $web[111] .= ' : '.$web[632];
    }
    $fieldb1 = addslashes($fieldb1);
    if ($mod == 'maj') {
		include TEMPREP.$filesign;
        $note      = '<hr /><u>'.$web[417].'</u> '.$web[6].' '.$userprefs[1].' '.$web[7].' '.FormatDate(date('YmdHi'));
        $fieldc1   = addslashes(stripslashes(replaceimg(ReplaceDolar(PutBR($ptxt)))).$signforum).$note;
		DestroyDBfile(TEMPREP.$filesign);
		$fieldd1   = ($pehide == 'on') ? 'on' : '';
		$fieldmail = $replymail;
    } elseif ($mod == 'move') {
		include TEMPREP.$filesign;
		$fieldb2   = $tocat;
        $note      = '<hr /><u>'.$web[635].'</u> '.$web[6].' '.$userprefs[1].' '.$web[7].' '.FormatDate(date('YmdHi'));
        $fieldc1   = addslashes(stripslashes(replaceimg(ReplaceDolar(PutBR($ptxt)))).$signforum).$note;
		DestroyDBfile(TEMPREP.$filesign);
		$fieldd1   = ($pehide == 'on') ? 'on' : '';
		$fieldmail = $replymail;
    } elseif ($mod == 'stop') {
		include TEMPREP.$filesign;
        $fieldc1 = addslashes(stripslashes(replaceimg(ReplaceDolar(PutBR($ptxt)))).$signforum);
		DestroyDBfile(TEMPREP.$filesign);
    } else {
        $fieldc1 = addslashes(stripslashes($fieldc1));
    }
    WriteDoc();
    $data[7]  = $fielda1; // n° thread
    $data[8]  = $fielda2; // n° response
    $data[10] = $fieldb2; // n° catégorie
    if ($typ == TYP_FORUM) {
        $catthread = getForumCatFull($fieldb2); // n° id category
    } else {
        $dbf = ReadDBFields(DBFORUM);
        for ($i = 0; $i < count($dbf); $i++) {
            if ($dbf[$i][1] == $num) {
                $catthread = getForumCatFull($dbf[$i][12]); // n° id category
                break;
            }
        }
        unset($dbf);
    }

    if ($mod == 'up' || $mod == 'top') { // maj date de modif forum-thread
        $newdate = $moddate;
        $dbf     = ReadDBFields(DBFORUM);
        for ($i = 0; $i < count($dbf); $i++) {
            if ($dbf[$i][2] == $pg) {
				$dbf[$i][0] = $moddate;
				$n_th       = $dbf[$i][1];
				$n_re       = $dbf[$i][7];
				break;
            }
        }
        @rsort($dbf, SORT_REGULAR);
        WriteDBFields(DBFORUM, $dbf);
        $dbth = ReadDBFields(DBTHREAD);
        for ($i = 0; $i < count($dbth); $i++) {
            if ($dbth[$i][1] == $n_th && $dbth[$i][2] == $n_re) {
                $dbth[$i][0] = $moddate;
                $th_id = $dbth[$i][3];
            }
        }
        WriteDBFields(DBTHREAD, $dbth);
        ReadDoc($th_id);
        $fileid  = $th_id;
        $moddate = $newdate;
        $fieldb1 = addslashes(stripslashes($fieldb1));
        $fieldb2 = addslashes(stripslashes($fieldb2));
        $fieldc1 = addslashes(stripslashes($fieldc1));
        $fieldc2 = addslashes(stripslashes($fieldc2));
        if ($mod == 'up' ) {
            $fieldmod =  'u#'.$userprefs[1].'#'.date('YmdHi');
        } else {
            $fieldmod =  't#'.$userprefs[1].'#'.$newdate;
        }
		if (($forum[6] != 0 && $mod == 'top') || $mod == 'up') WriteDoc();
    }
	if ($mod == 'maj') {
		$dbworkmail = ReadDBFields(DBFORUM);
		for ($i = 0; $i < count($dbworkmail); $i++) {
			if ($num == $dbworkmail[$i][1]){
				$sujetthread = $dbworkmail[$i][5];
				$catthread   = $dbworkmail[$i][12];
				break;
			}
		}
		$dbmailuniq = Array();
		$dbworkuniq = ReadDBFields(DBTHREAD);
		for ($i = 0; $i < count($dbworkuniq); $i++) {
		if ($num == $dbworkuniq[$i][1] && $dbworkuniq[$i][2] == 0) {
			$pgview = $dbworkuniq[$i][3];
		}
		if ($num == $dbworkuniq[$i][1] && $dbworkuniq[$i][9] == 'on') {
			$dbmailuniq[] = $dbworkuniq[$i][5];
		}
		}
		$mailuniq = ValUnique($dbmailuniq);
		for ($i = 0; $i < count($mailuniq); $i++) {
			$to    = $mailuniq[$i];
			$sujet = $web[345].$sujetthread;
			$bodycorps  = $web[346].$sujetthread.'<br /><br />';
			$bodycorps .= $web[109].'<hr />'.ForceToAbsolute(stripslashes($ptxt)).'<hr /><br />';
			$bodycorps .= $web[347].'<br />';
			$bodycorps .= '<a href="'.$site[3].($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[5].'-4-'.$pgview.'-'.getForumCatId($catthread).$z2 
              : $site['TH'].'.php?lng='.$lng.'&pg='.$pgview.'&cat='.getForumCatId($catthread).$z2).'">';
			$bodycorps .= $site[3].($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[5].'-4-'.$pgview.'-'.getForumCatId($catthread).$z2 
              : $site['TH'].'.php?lng='.$lng.'&pg='.$pgview.'&cat='.getForumCatId($catthread).$z2);
			$bodycorps .= '</a><br /><br />';
			$bodycorps .= $web[348].'<br />'.$user[0];
			eMailHtmlTo($sujet, $bodycorps, $to);
		}
	}
	if ($mod == 'move') {
        $dbf = ReadDBFields(DBFORUM);
        for ($i = 0; $i < count($dbf); $i++) {
            if ($dbf[$i][2] == $pg) {
				$dbf[$i][12] = $tocat;
				break;
            }
        }
        @rsort($dbf, SORT_REGULAR);
        WriteDBFields(DBFORUM, $dbf);
        $dbth = ReadDBFields(DBTHREAD);
        for ($i = 0; $i < count($dbth); $i++) {
            if ($dbth[$i][1] == $fielda1) {
                $dbth[$i][8] = $tocat;
            }
        }
        WriteDBFields(DBTHREAD, $dbth);
		$to    = $email;
		$sujet = $web[632].$fieldb1;
		$bodycorps  = sprintf($web[636], $fieldb1).'<br /><br />';
		$bodycorps .= $web[109].'<hr />'.ForceToAbsolute(stripslashes($ptxt)).'<hr /><br />';
		$bodycorps .= $web[347].'<br />';
		$bodycorps .= '<a href="'.$site[3].($site['URLR'] == 'on' ? $lng.'-'.$urlrw[5].'-4-'.$pg.'-'.$tocat.$z2 : $site['TH'].'.php?lng='.$lng.'&pg='.$pg.'&cat='.$tocat.$z2).'">';
		$bodycorps .= $site[3].($site['URLR'] == 'on' ? $lng.'-'.$urlrw[5].'-4-'.$pg.'-'.$tocat.$z2 : $site['TH'].'.php?lng='.$lng.'&pg='.$pg.'&cat='.$tocat.$z2);
		$bodycorps .= '</a><br /><br />';
		$bodycorps .= $web[348].'<br />'.$user[0];
		eMailHtmlTo($sujet, $bodycorps, $to);
	}
    unset($dbf, $dbth);
}
?>
news.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/news.inc'
View Content
<?php
/*******************************************************************************
 *   News
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2022 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.07 (February 24, 2022) : adaptation to php 8.1, correction script
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'news.inc')) {
    header('location:../index.php');
    die();
}

class GY_news {
    public $tconfig;
    public $topmess;
    protected $pg;
    protected $id;
    protected $nbox;
    protected $pos;

    public function __construct() {
        global $menuico, $nom, $lang, $lng, $page, $pg, $id, $pos;
        static $nbox = 0;
        $topmess       = getLabel($nom[$lng == $lang[0] ? 7 : 17]);
        $this->topmess = $page[9] == '' ? $topmess : '<i class="far fa-newspaper float-right align-middle""></i>'.$topmess;
        $this->tconfig = $menuico[12] == 'ALL' ? import('tconfig', '', true, 0) : $menuico[12];
        $this->pg      = $pg;
        $this->id      = $id;
        $this->nbox    = $nbox++;
        $this->pos     = $pos;
    }
    
    public function NEWS_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $out = '';
        if ($serviz[8] != 'on') {
            $out .= '
<div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
  <p class="text-center">
    '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
  </p>';
            $out .= '
</div>';
            return array('NEW', $out);
        }
        elseif (!isAccessGranted($members[13])) {
            $out .= '
<div class="text-center web342">'.$web[342];
            if ($members[19] != '0' && $members[19] != '3') {
                $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-0-'.$tconfig.$z2 : 'connect.php?lng='.$lng.'&tconfig='.$tconfig.$z2);
                $href2 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[15].'-5-new-'.$tconfig.$z2 : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$tconfig.$z2);
                $out .= '
  <p class="text-center">
    '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
      (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
  </p>';
            }
            $out .= '
</div>';
            return array('NEW', $out);
        }
        if (!empty($this->pg)) {
            $db1 = SelectDbFieldsByField(ReadDbFields(DBNEWS), 4, $this->pg);
            $db2 = array_filter($db1, 'IsNotEmptyTitle');
            if (empty($db2) || 1 != count($db2)) {
                if ($site[10] != '') return array('h1', '');
                else return array('h2', '');
            }
        }
        return array('');
    }
    
    public function NEWS_content() {
        global $lng, $lang, $site, $serviz, $web, $prt, $urlrw, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        //$this->id    = strip_tags($this->id);
        $max_height  = isset($site[29]) && $site[29] > 0 && empty($prt) ? $site[29] : 0;
        $max_height2 = isset($site[13]) && $site[13] > 0 && empty($prt) ? $site[13] : 0;
        $out = $outrs = '';
        if ($prt == 0 && $serviz[106] == 'on') {
            include CONFIGREP.'sncode.inc';
            if (!empty($coders))
                $outrs .= '
    <div class="codersNews">'.$coders.'</div>';
        }
        $archdate = ReadCounter(DBNEWSARCHDATE);
        if ($archdate > 0) {
            $out .= '
<div class="text-center archNews">'.$web[580].' '.FormatDate($archdate).'
  <br />'.$web[579].'&nbsp;
  <a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[8].'-26'.$z2 : 'newsarch.php?lng='.$lng.$z2).'" title="'.$web[578].'">'.$web[578].'
    <i class="far fa-file-alt"></i>
  </a>
</div>';
        }
        $out .= '
<div class="headNews text-center">';
        if ($serviz[16] == 'on' && empty($prt)) {
            $rssnewsurl = $site[3].sprintf(RSSNEWS, $lng);
            $out .= '
  <style>
    .headNews .overpop { padding-top: 8px; }
    .overpop a i { margin-top: -20px; }
  </style>
  <script>
    $(document).ready(function(){
      $(\'.rssNews\').popover({
        title:"RSS",
        content:"'.$web[221].' : <br /><b> '.$rssnewsurl.'</b>",
        trigger:"hover",
        placement:"auto",
        offset:"0 10 10 10",
        html:true
      });
    });
  </script>
  <div class="overpop pt-0 pl-2">
    <a href="'.CHEMIN.'newsrss.php?lng='.$lng.'&url=news&tconfig='.$this->tconfig.$z2.'" class="rssNews float-left">
      <i class="fas fa-rss"></i>
    </a>
  </div>';                            
        }
        if ($site[5] != '2' && empty($prt)) {
            $out .= '
  <form 
    name="postnews'.$this->nbox.'" 
    action="'.CHEMIN.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[14].'-'.TYP_NEWS.$z2 
      : $site['PG'].'.php?lng='.$lng.'&amp;typ='.TYP_NEWS.$z2).'" 
    method="post">
    <input type="hidden" name="tconfig" value="'.$this->tconfig.'" />
    <div class="text-center'.($serviz[16] == 'on' ? ' postNews' : '').'">'.SubmitButton($web[4]).'</div>
  </form>';
        } else
            $out .= '<div class="divnewline"></div>';
        $out .= '
</div>';
        if (!empty($this->pg)) {
            $db1 = SelectDbFieldsByField(ReadDbFields(DBNEWS), 4, $this->pg);
            $db2 = array_filter($db1, 'IsNotEmptyTitle');
            if (isAccessGranted($db2[0][6]) && isAuthorizedPublication($db2[0][5]))
                $dbwnews = array(array(TYP_NEWS, $db2[0][5], $this->pg, 'a'));
            else
                $dbwnews = array();
        } else {
            $db1 = ReadDbFields(DBNEWS);
            $db2 = array_filter($db1, 'IsNotEmptyTitle');
            $dbwnews = array();
            foreach ($db2 as $db) {
                if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5])) {
                    $dbwnews[] = array(TYP_NEWS, $db[5], $db[4], 'a');
                }
            }
            @rsort($dbwnews);
        }
        unset($db1, $db2);
        $this->id = empty($this->id) ? 1 : $this->id;
        $minnews = $serviz[2]*($this->id-1);
        $maxnews = Min($serviz[2]*$this->id, count($dbwnews));
        if (!empty($dbwnews)) {
            for ($i = $minnews; $i < $maxnews; $i++) {
                ReadDoc($dbwnews[$i][2]);
                $img = getNewUpdateDoc($creadate, $moddate, $serviz[137]);
                if ($lng == $lang[0]) {
                    $txt1 = $fieldb1;
                    $txt2 = $fieldc1;
                }
                else {
                    $txt1 = $fieldb2;
                    $txt2 = $fieldc2;
                }
                $txt2 .= $outrs;
                // date création
                $txt72 = $serviz[72] == '' ? ' - '.$web[7].' <b>'.FormatDate($creadate).'</b> ' : '';
                // auteur
                $txt73 = $serviz[73] == '' 
                  ? (empty($txt72) ? ' - ' : ' ').$web[6].' '.($fieldd1 == 'on' ? displayWriteEmail('boxnews'.$i, $author, $email) : '<b>'.$author.'</b>')
                  : '';
                // icone
                if (!empty($fieldd2)) {
                    $txt1 = '<img src="'.CHEMIN.'img/'.$fieldd2.'" class="'.($serviz[152] == 'on' 
                      ? 'float-left' : 'float-right').'" alt="'.$fieldd2.'" />'.$txt1;
                }
                $out .= '
  <div class="bord">
    <div class="quest '.($serviz[152] != 'on' ? 'text-left' : 'text-right').'">
	  <a href="'.$site[3].($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[8].'-22-'.$fileid.'-'.$this->tconfig.$z2 
          : $site['NE'].'.php?lng='.$lng.'&amp;pg='.$fileid.'&amp;tconfig='.$this->tconfig.$z2).'" title="'.$web[511].'">
        '.$img.'<b>'.$txt1.'</b>
      </a>'.$txt72.$txt73.'
    </div>';
                $txt3 = '
    <a id="news'.$this->pos.$i.'"></a>
<style>
.repNews2 {
  max-height: '.($max_height2 > 0 ? $max_height2.'px;' : 'none;').'
  overflow: '.($max_height2 > 0 ? 'hidden;' : 'visible;').'
  background: transparent;
}
</style>';
                if (!empty($txt2)) {
                    $txt3 .= '
    <div id="texte3'.$i.'" class="rep fullNews">
      <div class="rep repNews2">
        '.$txt2.'
      </div><div class="clearfix"></div>';
                if ($max_height2 > 0) $txt3 .= '
      <p class="text-right">
        <a href="javascript:ActiveMenu(\'texte3\',\'texte2\',0,'.$maxnews.','.$i.')" class="box" title="'.$web[296].'">
          '.$web[296].' <i class="far fa-plus-square"></i>
        </a>
      </p>';
                $txt3 .= '
    </div>' ;
                if ($max_height2 > 0) $txt3 .= '
    <div id="texte2'.$i.'" class="rep txt2News" style="display:none;">'.$txt2.'
      <p class="text-right c-pointer">
        <a href="#news'.$this->pos.$i.'" title="'.$web[57].'" onclick="cache(\'texte2'.$i.'\');montre(\'texte3'.$i.'\')">
          '.$web[57].' <i class="far fa-minus-square"></i>
        </a>
      </p>
    </div><div class="clearfix"></div>';
                }
                $out .= $txt3.
                    displayQuickConfig($this->pos, $dbwnews[$i][2], 'news&amp;form=2&amp;id='.$dbwnews[$i][2], 
                      'news&amp;act=i&amp;id='.$dbwnews[$i][2], 'news&amp;del='.$dbwnews[$i][2], 14).'
  </div>
  <br />';
            }
        } elseif (!empty($this->pg)) {
            $out .= '
  <p>'.$web[36].'</p>';
        }
        $this->pg = empty($this->pg) ? '0' : $this->pg;
        $out .= GetNavBar(($site['URLR'] == 'on'? 
            $lng.'-'.$urlrw[8].'-3-'.$this->pg.'-': 
            $site['NE'].'.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;id='), count($dbwnews), $this->id, $serviz[2], $z2);
        return array('NEW', $out);
    }
}
?>
newsarch.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/newsarch.inc'
View Content
<?php
/*******************************************************************************
 *   Archived News
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.03 (August 10, 2021) : adaptation to php 8
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'newsarch.inc')) {
    header('location:../index.php');
    die();
}

class GY_newsarch {
    public $tconfig;
    public $topmess;
    protected $pg;
    protected $id;

    public function __construct() {
        global $menuico, $nom, $lang, $lng, $page, $web;
        $topmess       = getLabel($nom[$lng == $lang[0] ? 7 : 17]).' - '.$web[399];
        $this->topmess = $page[9] == '' ? $topmess : '<i class="far fa-newspaper float-right align-middle""></i>'.$topmess;
        $this->tconfig = $menuico[12] == 'ALL' ? import('tconfig', '', true, 0) : $menuico[12];
        $this->pg      = import('pg');
        $this->id      = import('id');
    }
    
    public function NWA_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $out = '';
        if ($serviz[8] != 'on') {
            $out .= '
<div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
  <p class="text-center">
    '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
  </p>';
            $out .= '
</div>';
            return array('NWA', $out);
        }
        elseif (!isAccessGranted($members[13])) {
            $out .= '
<div class="text-center web342">'.$web[342];
            if ($members[19] != '0' && $members[19] != '3') {
                $href1 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 
                  : 'connect.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2);
                $href2 = CHEMIN.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
                  : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$this->tconfig.$z2);
                $out .= '
  <p class="text-center">
    '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
      (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
  </p>';
            }
            $out .= '
</div>';
            return array('NWA', $out);
        }
        if (!empty($this->pg)) {
            $db1 = SelectDbFieldsByField(ReadDbFields(DBNEWSARCH), 4, $this->pg);
            $db2 = array_filter($db1, 'IsNotEmptyTitle');
            if (1 != count($db2) || !isAccessGranted($db2[0][6]) || !isAuthorizedPublication($db2[0][5])) {
                if ($site[10] != '') return array('h1', '');
                else return array('h2', '');
            }
        }
        return array('');
    }
    
    public function NWA_content() {
        global $lng, $lang, $site, $serviz, $web, $urlrw, $z2, $prt, $pos;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $fieldb1, 
               $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $this->id = strip_tags($this->id);
        $out      = '';
        $archdate = ReadCounter(DBNEWSARCHDATE);
        if ($archdate > 0) {
            $out .= '
  <div class="text-center archNews">'.$web[583].' '.FormatDate($archdate).'
    <br />'.$web[582].'&nbsp;
    <a href="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[8].$z2 : $site['NE'].'.php?lng='.$lng.$z2).'" title="'.$web[581].'">'.$web[581].'
      <i class="far fa-file-alt"></i>
    </a>
  </div>';
        }
        if (!empty($this->pg)) {
            $db1 = SelectDbFieldsByField(ReadDbFields(DBNEWSARCH), 4, $this->pg);
            $db2 = array_filter($db1, 'IsNotEmptyTitle');
            if (1 != count($db2) || !isAccessGranted($db2[0][6]) || !isAuthorizedPublication($db2[0][5])) {
                $dbwnews = array();
            } else {
                $dbwnews = array(array(TYP_NEWS, $this->pg, 'a'));
            }
        } else {
            $db1 = ReadDbFields(DBNEWSARCH);
            $db2 = array_filter($db1, 'IsNotEmptyTitle');
            $dbwnews = array();
            foreach ($db2 as $db) {
                if (isAccessGranted($db[6])) {
                    $dbwnews[] = array(TYP_NEWS, $db[4], 'a');
                }
            }
        }
        @rsort($dbwnews);
        unset($db1, $db2);
        $this->id    = empty($this->id) ? 1 : $this->id;
        $minnews     = $serviz[2]*($this->id-1);
        $maxnews     = Min($serviz[2]*$this->id, count($dbwnews));
        $max_height2 = isset($site[13]) && $site[13] > 0 && empty($prt) ? $site[13] : 0;
        if (!empty($dbwnews)) {
            for ($i = $minnews; $i < $maxnews; $i++) {
                ReadDoc($dbwnews[$i][1], ARCHDBBASE);
                if ($lng == $lang[0]) {
                    $txt1 = $fieldb1;
                    $txt2 = $fieldc1;
                }
                else {
                    $txt1 = $fieldb2;
                    $txt2 = $fieldc2;
                }
                // date création
                if ($serviz[72] == '') {
                    $txt72 = ' - '.$web[7].' ';
                    $txt72 .= '
    <b>'.FormatDate($creadate).'</b> ';
                } else {
                    $txt72 = '';
                }
                // auteur
                $txt73 = '';
                if ($serviz[73] == '') {
                    $txt73 = (empty($txt72) ? ' - ' : ' ').$web[6].' <b>'.$author.'</b>';
                }
                // icone
                if (!empty($fieldd2)) {
                    $txt1 = '<img src="'.CHEMIN.'img/'.$fieldd2.'" class="'.($serviz[152] == 'on' 
                      ? 'float-left' : 'float-right').'" alt="'.$fieldd2.'" />'.$txt1;
                }
                $txt3 = '
<div class="forum2"><b>'.$txt1.'</b>'.$txt72.$txt73.'</div>
<style>
.repNews2 {
  max-height: '.($max_height2 > 0 ? $max_height2.'px;' : 'none;').'
  overflow: '.($max_height2 > 0 ? 'hidden;' : 'visible;').'
  background: transparent;
}
</style>';
                if (!empty($txt1)) {
                    $txt3 .= '
<div id="texte3'.$i.'" class="rep fullNews">
  <div class="rep repNews2">
    '.$txt2.'
  </div><div class="clearfix"></div>';
                if ($max_height2 > 0) $txt3 .= '
  <p class="text-right">
    <a href="javascript:ActiveMenu(\'texte3\',\'texte2\',0,'.$maxnews.','.$i.')" class="box" title="'.$web[296].'">
      '.$web[296].' <i class="far fa-plus-square"></i>
    </a>
  </p>';
                $txt3 .= '
</div>' ;
                if ($max_height2 > 0) $txt3 .= '
<div id="texte2'.$i.'" class="rep txt2News" style="display:none;">'.$txt2.'
  <p class="text-right c-pointer">
    <a href="#news'.$pos.$i.'" title="'.$web[57].'" onclick="cache(\'texte2'.$i.'\');montre(\'texte3'.$i.'\')">
      '.$web[57].' <i class="far fa-minus-square"></i>
    </a>
  </p>
</div><div class="clearfix"></div>';
                }
                $out .= $txt3.'
<br />';
            }
        } elseif (!empty($this->pg)) {
            $out .= '
<p>'.$web[36].'</p>';
        }
        $this->pg = empty($this->pg)? '0' : $this->pg;
        $out .= GetNavBar(($site['URLR'] == 'on'? 
            $lng.'-'.$urlrw[8].'-4-'.$this->pg.'-': 
            'newsarch.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;id='), count($dbwnews), $this->id, $serviz[2], $z2);
        return array('NWA', $out);
    }
}
?>
newsletter.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/newsletter.inc'
View Content
<?php
/*******************************************************************************
 *   Newsletter
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.19 (August 26, 2024) : correction script
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'download.inc')) {
    header('location:../index.php');
    die();
}

class GY_newsletter {
    public $tconfig;
    public $topmess;
    protected $pg;
    protected $rgpd;
    protected $nlgrp;
    protected $nlpseudo;
    protected $nlmail;
    protected $action;
    
    public function __construct() {
        global $lng, $web;
        $this->topmess  = $web[222];
        $this->tconfig  = import('tconfig', '', true, 0);
        $this->pg       = import('pg');
        $this->rgpd     = import('rgpd');
        $this->nlgrp    = import('nlgrp', 'GET', true, null);
        $this->nlpseudo = import('nlpseudo', 'GET', true, null);
        $this->action   = import('action');
        $this->nlmail   = import('nlmail');
    }

    public function NWL_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $out = '';
        if ($serviz[36] != 'on') {
            $out = '
    <div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array('DWNL', $out);
        }
        return array('');
    }
    
    private function isValidEmail($email, $verify, $return_errors=true) {
        global $web, $charset;
        $error = '';
		$out = '';
        if (preg_match('/^([a-zA-Z0-9\._\+-]+)\@((\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,7}|[0-9]{1,3})(\]?))$/', $email, $matches)) {
            @$user   = $matches[1];
            $domain = $matches[2];
            if ($verify == "on") {
                $out  .= sprintf($web[502], $domain);
                $amxrr = array();
                $mxrr  = getmxrr($domain, $amxrr);
                if (count($amxrr) <= 0) {
                    $error = $web[503];
                }
            }
        } else {
            $error = $web[504];
        }
        if ($return_errors) {
            if(isset($error)) {
                return htmlentities($error, NULL, $charset);
            } else {
                return TRUE;
            }
        }
    }

    private function CheckEqualityDB1Field($fic, $submit, $FieldNB) {
        if (FileDBExist($fic)) {
            $DataDB = ReadDBFields($fic);
            for ($i = 0; $i < count($DataDB); $i++) {
                if (isset($DataDB[$i][$FieldNB]) && strtolower($DataDB[$i][$FieldNB]) == strtolower($submit)) {
                    return TRUE;
                }
            }
        }
        return FALSE;
    }
    
    public function NWL_content() {
        global $lang, $lng, $web, $nom, $serviz, $urlrw, $site, $userprefs, $prt, $z2, $charset, $supervision;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
		$out = '';
        $crypt     = isset($_POST['crypt']) ? strip_tags($_POST['crypt']) : NULL;
        $cryptok   = (!$crypt) ? false : chk_crypt($crypt);
        $nlsecure  = import('nlsecure');
        $nlconfirm = import('nlconfirm');
        $ctrl_spam = import('code_pseudo', 'POST', true, '');
        if (empty($this->action) && !empty($this->pg) && !is_null($this->nlgrp) && !is_null($this->nlpseudo)) {
            // Affichage d'une lettre d'information
            $abonnes = ReadDBFields(MEMBERSNWL);
            if ($this->nlgrp != 'all_subscribers') {
                $ok = false;
                foreach ($abonnes as $abonne)
                    if ($abonne[0] == $this->nlpseudo) {
                        $ok = $this->nlgrp == $abonne[1];
                        break;
                    }
            } 
            else
                $ok = true;
            if ($ok && (1 == count(SelectDBFields(TYP_NWL, 'a', $this->pg)) || 1 == count(SelectDBFields(TYP_NEWS, 'a', $this->pg)))) {
                ReadDoc($this->pg);
                $this->topmess = $lng == $lang[0] ? getLabel($nom[38]).' - '.$fieldb1 : getLabel($nom[39]).' - '.$fieldb2;
                $txtnwl        = $lng == $lang[0] ? $fieldc1 : $fieldc2;
            } else {
                $this->topmess = getLabel($nom[$lng == $lang[0] ? 38 : 39]);
                if ($site[10] != '') {
                    $txtnwl = BeginJavascript().'window.location="'.$site[3].'error.php?lng='.$lng.'&err=404"'.EndJavascript();
                }
                else 
                    $txtnwl = $web[36];
            }
            $this->topmess = mb_substr($this->topmess, 0, 1, $charset) == '§' 
              ? mb_substr($this->topmess, 1, mb_strlen($this->topmess ,$charset) ,$charset) 
              : $this->topmess;
            $out .= '
        <p>
        '.$txtnwl.'
        </p>';
        }
        elseif (empty($ctrl_spam)) {
			$error = '';
            // Abonnement / confirmation / désabonnement
            $this->nlpseudo = import('nlpseudo');
			if (strlen($this->nlpseudo) == 0)
				$error .= '<p class="text-justify"> - erreur '.$web[252].'</p>';
            $this->nlpseudo = KeepGoodChars(CutLongWord(strip_tags(stripslashes($this->nlpseudo)),20));
            $this->topmess  = $web[222];
            if (!empty($userprefs[1]) && $this->rgpd == 'on') setRGPDdate();
			if (strlen($this->action) == 0) $this->action = "noconfsub"; 
            switch ($this->action) {
			case "noconfsub" :
					 $out .= '<p class="text-justify"><b>'.$web[256].'</b></p><br />';
				break;
            case 'sub' :
                $out .= '<p class="text-left">'.sprintf($web[502], $this->nlmail).'<br /></p>';
                $error = '';
				if (strlen($this->nlpseudo) == 0 ){
                    $error     .= '<p class="text-justify"> - '.$web[252].'</p>';
                    $nlconfirm = 'on';
                }
                if(($this->nlpseudo == "") || ($this->nlpseudo == KeepGoodChars($web[259]))) {
                    $error .= '<p class="text-justify"> - '.$web[252].'</p>';
                }
				if (strlen($this->nlmail == 0)) {
                    $error .= '<p class="text-justify"> - '.$web[251].'</p>';
				}
                if ((!preg_match("!^(.+)@(.+)\\.(.+)$!",$this->nlmail)) || ($this->nlmail == "") || ($this->nlmail == $web[260])) {
                    $error .= '<p class="text-justify"> - '.$web[251].'</p>';
                }
                if (($serviz[100] != '0' && $serviz[93] == 'on' && ($userprefs[1] == '' || $serviz[98] == '')) && !$cryptok) {
                    $error .= '<p class="text-justify"> - '.$web[529].'</p>';
                }
                if ($error == "") {
                    $controle = $this->CheckEqualityDB1Field(NEWSLET_LIST, $this->nlpseudo,0);
                    if ($controle) {
                        $error = $web[392];
                    }
                    else {
                        $controle = $this->CheckEqualityDB1Field(NEWSLET_LIST, $this->nlmail,1);
                        if ($controle) $error = $web[250];
                    }
                    if (FileDBExist(NEWSLET_WAIT)) {
                        $tmplist = ReadDBFields(NEWSLET_WAIT);
                        for ($k = count($tmplist)-1; $k >= 0; $k--) {
                            if ($tmplist[$k][0] !="" && $tmplist[$k][0] != $this->nlpseudo && $tmplist[$k][3] < date("YmdHi")) {
                                DeleteDBFieldById(NEWSLET_WAIT, $id=$k);
                            }
                        }
                        unset($tmplist);
                        $tmplist = ReadDBFields(NEWSLET_WAIT);
                        for ($k = 0; $k < count($tmplist); $k++) {
                            if ($tmplist[$k][0] == $this->nlpseudo) {
                                unset($tmplist);
                                $out = '
<script>
alert("'.addslashes($web[433]).'");
document.location.href="'.($site['URLR'] == 'on'? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng).'";
</script>';
                                return array('NWL', $out);
                            }
                        }
                        unset($tmplist);
                    }
                    if (!$controle) {
                        $valemail = $this->IsValidEmail($this->nlmail, $serviz[36]);
                        if ($valemail) {
                            $controle = false;
                            $error    = $valemail;
                        }
                    }
                    if (!$controle && !$valemail) {
                        $nllist    = array();
                        $nllist[0] = $this->nlpseudo;
                        $nllist[1] = $this->nlmail;
                        $nllist[2] = $lng;
                        $nllist[3] = date("YmdHi",time()+900); //délai 15 mn
                        AppendDBFields(NEWSLET_WAIT, $nllist);
                        $out  .= '<p>'.$web[245].'<b> '.$this->nlpseudo.'</b> '.$web[431].
                          stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'<br />'.$web[433].'</p>';
                        $to    = $this->nlmail;
                        $sujet = stripslashes($site[($lang[0] == $lng ? 0 : 11)])." - ".$web[246];
                        $bodycorps  = $web[245]." ".$this->nlpseudo." ".$web[431].stripslashes($site[($lang[0] == $lng ? 0 : 11)])."<br /><br />";
                        $bodycorps .= $web[432]."<br />";
                        $url   = $site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[18].'-1-confsub-'.$this->nlpseudo.'-'.$this->nlmail 
                          : $site['NL'].'.php?lng='.$lng.'&action=confsub&nlpseudo='.$this->nlpseudo.'&nlmail='.$this->nlmail;
                        $bodycorps .= '<a href="'.$site[3].$url.'">'.$site[3].$url.'</a>';
                        $bodycorps .= "<hr />".$web[235]."<br />".@$user[0]." <br />".$site[3];
                        eMailHtmlTo($sujet, $bodycorps, $to);
                    } 
                    else {
                        $out .= '<br /><p>'.$error.'</p><br />';
                    }
                } 
                else {
                    $out .= '<p class="text-justify"><b>'.$web[256].'</b></p><br />'.$error;
                }
                break;
            case "confsub" :
                $error        = "";
                $this->nlmail = strip_tags(stripslashes($this->nlmail));
                $out         .= '<p class="text-left">'.sprintf($web[502], $this->nlmail).'<br /></p>';
				if (strlen($this->nlpseudo) == 0 ){
                    $error     = '<p class="text-justify"> - '.$web[252].'</p>';
                    $nlconfirm = 'on';
                }
                if (($this->nlpseudo == "") || ($this->nlpseudo == KeepGoodChars($web[259]))) {
                    $error = '<p class="text-justify""> - '.$web[252].'</p>';
                }
				if (strlen($this->nlmail == 0)) {
                    $error .= '<p class="text-justify"> - '.$web[251].'</p>';
				}
                if ((!preg_match("!^(.+)@(.+)\\.(.+)$!", $this->nlmail)) || ($this->nlmail == "") || ($this->nlmail == $web[260])) {
                    $error .= '<p class="text-justify"> - '.$web[251].'</p>';
                }
                if ($error == "") {
                    $controle = $this->CheckEqualityDB1Field(NEWSLET_LIST, $this->nlpseudo,0);
                    if ($controle) {
                        $error = $web[392];
                    } 
                    else{
                        $controle = $this->CheckEqualityDB1Field(NEWSLET_LIST, $this->nlmail,1);
                        if ($controle) {
                            $error = $web[250];
                        }
                    }
                    // update tmp list
                    if (FileDBExist(NEWSLET_WAIT)) {
                        $tmplist = ReadDBFields(NEWSLET_WAIT);
                        for ($k = 0; $k < count($tmplist); $k++) {
                            if ($tmplist[$k][0] == $this->nlpseudo && $tmplist[$k][3] > date("YmdHi")) {
                                unset($tmplist);
                                DeleteDBFieldById(NEWSLET_WAIT, $id=$k);
                                break;
                            }
                        }
                    }
                    if (!$controle) {
                        $valemail = $this->IsValidEmail($this->nlmail, @$user[1], $serviz[36]);
                        if ($valemail) {
                            $controle = false;
                            $error    = $valemail;
                        }
                    }
                    if (!$controle && !$valemail) {
                        $out .= '<p>'.$web[249].'<b> '.$this->nlpseudo.'</b><br /><br />'.$web[50].'<b> '.$this->nlmail.'</b> '.$web[248].'</p><br />';
                        $nllist    = array();
                        $nllist[0] = $this->nlpseudo;
                        $nllist[1] = $this->nlmail;
                        $nllist[2] = $lng;
                        AppendDBFields(NEWSLET_LIST, $nllist);
                        $to    = $this->nlmail;
                        $sujet = stripslashes($site[($lang[0] == $lng ? 0 : 11)])." - ".$web[246];
                        $bodycorps  = $web[245]." ".$this->nlpseudo.$web[244]." ".stripslashes($site[($lang[0] == $lng ? 0 : 11)])."<br /><br />";
                        $bodycorps .= $web[235]."<br />".@$user[0]."<br />".$site[3]."<hr />";
                        $bodycorps .= $web[243]."<br />";
                        $url   = $site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[18].'-1-unsub-'.$this->nlpseudo.'-'.$this->nlmail 
                          : $site['NL'].'.php?lng='.$lng.'&action=unsub&nlpseudo='.$this->nlpseudo.'&nlmail='.$this->nlmail;
                        $bodycorps .= '<a href="'.$site[3].$url.'">'.$site[3].$url.'</a>';
                        eMailHtmlTo($sujet, $bodycorps, $to);
                        if ($supervision[7] == "on") {
                            $bodycorps  = $this->nlpseudo.' ('.$this->nlmail.') '.$web[242].' '.stripslashes($site[($lang[0] == $lng ? 0 : 11)])."<hr />";
                            $bodycorps .= $web[241].":<br />";
                            $bodycorps .= '<a href="'.$site[3].$url.'">'.$site[3].$url.'</a>';
                            eMailHtmlTo($sujet, $bodycorps);
                        }
                    } 
                    else {
                        $out .= '<br /><p>'.$error.'</p><br />';
                    }
                } 
                else {
                    $out .= '<p class="text-justify"><b>'.$web[256].'</b></p><br />'.$error;
                }
                break;
            case "unsub" :
                $error = "";
				if (strlen($this->nlpseudo) == 0 ){
                    $error     = '<p class="text-justify"> - '.$web[252].'</p>';
                    $nlconfirm = 'on';
                }
                if ($nlsecure != 'on' && $nlconfirm != 'on') $nlsecure = 'on';
                if (($this->nlpseudo == '' ||  $this->nlpseudo == KeepGoodChars($web[259])) && $nlsecure != 'on') {
                    $error     = '<p class="text-justify"> - '.$web[252].'</p>';
                    $nlconfirm = 'on';
                }
				if (strlen($this->nlmail == 0)) {
                    $error .= '<p class="text-justify"> - '.$web[251].'</p>';
				}
                if ((!preg_match("!^(.+)@(.+)\\.(.+)$!",$this->nlmail) || $this->nlmail == "" || $this->nlmail == $web[260]) && $nlsecure != 'on') {
                    $error    .= '<p class="text-justify"> - '.$web[251].'</p>';
                    $nlconfirm = 'on';
                }
                if (($serviz[100] != '0' && $serviz[93] == 'on' && ($userprefs[1] == '' || $serviz[98] == '')) && !$cryptok && $nlsecure != 'on') {
                    $error    .= '<p class="text-justify"> - '.$web[529].'</p>';
                    $nlconfirm = 'on';
                } 
                else {
                    if ($nlsecure == 'on' && $nlconfirm != 'on') {
                        $out .= '
<div class="container box">
  <div class="text-center nwlunsub"><b>'.$this->nlpseudo.' => '.$this->nlmail.'</b><br /><br />'.$web[553].'</div>
  <form name="confunsub" action="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[18].$z2 : $site['NL'].'.php?lng='.$lng.$z2).'" method="POST">
    <input type="hidden" name="nlsecure" value="on">
    <input type="hidden" name="nlconfirm" value="on">
    <input type="hidden" name="action" value="unsub">
    <input type="hidden" name="nlpseudo" value="'.$this->nlpseudo.'" />
    <input type="hidden" name="nlmail" value="'.$this->nlmail.'" />
    <div class="text-center">';
                if ($serviz[100] != '0' && $serviz[93] == 'on' && $serviz[98] == '') {
					$lbl  = $serviz[100] == '3' ? $web[642] : '';
                    $out .= '
      <div class="text-center nwlcrypt">
        <div class="text-center">'.dsp_crypt(0, 1, 3, 1, $lbl, $serviz[115] == 'on' ? $web[643] : '');      
                    if ($serviz[100] == '1') $out .= '<br />';
                    $out .= ($serviz[100] == '3' ? '' : $web[530]).'<br />
          <input type="text" class="inputcrypt" name="crypt" onpaste="return false;" />
        </div>
      </div><br />';
                }
                $out .= '
      <span class="nwlyesbtn">
        '.SubmitButton($web[313]).'
      </span>
      <span class="nwlnobtn">
        <button 
          type="button" 
          class="btn btn-info btn-lg" 
          title="'.$web[314].'" 
          onclick="self.location.href=\''.($site['URLR'] == 'on'? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng).'\'">'.$web[314].'
        </button>
      </span>
    </div>
  </form>
</div>';
                    }
                }
                if ($nlconfirm == 'on') {
                    if ($error == '') {
                        $controle = CheckDB2Fields(NEWSLET_LIST, $this->nlpseudo, 0, $this->nlmail,1);
                        if ($controle) {
                            $this->nlpseudo = stripslashes($this->nlpseudo);
                            $newdb          = array();
                            $dbwork         = ReadDBFields(NEWSLET_LIST);
                            for ($i = 0; $i < count($dbwork); $i++) {
                                if (isset($dbwork[$i][1]) && $dbwork[$i][1] == $this->nlmail) {
                                    if ($dbwork[$i][0] != $this->nlpseudo) {
                                        $newdb[] = $dbwork[$i];
                                    }
                                } 
                                else {
                                    $newdb[] = $dbwork[$i];
                                }
                            }
                            WriteDBFields(NEWSLET_LIST,$newdb);
                            $out .= '<p>'.$web[253].'<b> '.$this->nlpseudo.'</b><br /><br />'.$web[255].'<b> '.$this->nlmail.'</b> '.$web[254].'</p><br />';
                            if ($supervision[7] == "on") {
                                $to    = $this->nlmail;
                                $sujet = stripslashes($site[($lang[0] == $lng ? 0 : 11)])." - ".$web[241];
                                $bodycorps  = $web[240]." ".$this->nlpseudo.$web[239]." ".stripslashes($site[($lang[0] == $lng ? 0 : 11)])."<hr />";
                                $bodycorps .= $web[235]."<br />".@$user[0]."<br />".$site[3]."<hr />";
                                $bodycorps .= $web[234]."<br />";
                                $url   = $site['URLR'] == 'on'? $lng.'-'.$urlrw[18].'-1-sub-'.$this->nlpseudo.'-'.$this->nlmail: $site['NL'].'.php?lng='.$lng.'&action=sub&nlpseudo='.$this->nlpseudo.'&nlmail='.$this->nlmail;
                                $bodycorps .= '<a href="'.$site[3].$url.'">'.$site[3].$url.'</a>';
                                eMailHtmlTo($sujet, $bodycorps,$to);
                                $bodycorps = $this->nlpseudo." (".$this->nlmail.") ".$web[238]." ".stripslashes($site[($lang[0] == $lng ? 0 : 11)])."\n";
                                eMailHtmlTo($sujet, $bodycorps, '');
                            }
                        } else {
                            $out .= '<br /><p>'.$web[255].' <b>'.$this->nlmail.'</b> '.$web[233].'</p><br />';
                        }
                    } else {
                        $out .= '<p class="text-justify"><b>'.$web[256].'</b></p><br />'.$error;
                    }
                }
                break;
            }
        }
        return array('NWL', $out);
    }
}
?>
newsrss.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/newsrss.inc'
View Content
<?php
/*******************************************************************************
 *   News RSS
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.11 (March 09, 2023) : correction $text1
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'newsrss.inc')) {
    header('location:../index.php');
    die();
}

class GY_newsrss {
    public $tconfig;
    public $topmess;
    protected $url;
    protected $id;

    public function __construct() {
        $this->tconfig = import('tconfig', '', true, 0);
        $this->id      = import('id');
    }
    
    public function RSS_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web;
        $this->url = import('url', 'GET', true, '');
        $out = '';
        if ($serviz[38] != 'on') {
            $out = '
    <div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array('RSS', $out);
        }
        return array('');
    }

    public function RSS_content() {
        global $nom, $page, $lang, $lng, $charset, $web, $serviz, $site, $page, $prt, $charset, $style;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, $site,
               $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        if (!empty($this->url)) {
            switch ($this->url) {
            case 'news' : $this->url = $site[3].sprintf(RSSNEWS, $lng); break;
            case 'arts' : $this->url = $site[3].sprintf(RSSART, $lng); break;
            case 'blog' : $this->url = $site[3].sprintf(RSSBLOG, $lng); break;
            case 'all'  : $this->url = $site[3].sprintf(RSSALL, $lng); break;
            default: $this->url = '';
            }
        }
        ReadDoc($this->id);
        $this->tconfig = $fieldweb == 'ALL' ? $this->tconfig : $fieldweb;
        $rssurl        = empty($this->url) ? ($lng == $lang[0] ? $fieldb1 : $fieldb2) : $this->url;
        $rsstxt        = getLabel($nom[$lng == $lang[0] ? 36 : 37]).' - '.($lng == $lang[0] ? $fielda1 : $fielda2);
        $rsstxt        = $page[9] == '' ? $rsstxt : '<i class="fas fa-rss float-right align-middle""></i>'.$rsstxt;
        $this->topmess = mb_substr($rsstxt, 0, 1, $charset) == '§' ? mb_substr($rsstxt, 1, mb_strlen($rsstxt ,$charset) ,$charset) : $rsstxt;
        $max_width     = $style != '1024' ? ($style == '800' ? '500px' : 'auto') : '720px';
        $max_height    = isset($serviz[133]) && $serviz[133] > 0 && empty($prt) ? $serviz[133] : 0;
        include 'inc/lastRSS.inc';
        $rss             = new lastRSS;
        $rss->default_cp = strtoupper($charset);
        $rss->cache_dir  = substr(CACHEREP, 0, strlen(CACHEREP)-1);
        $rss->cache_time = $serviz[39];
        $rs              = $rss->Get($rssurl);
        if (FALSE !== $rs) {
            $cpin  = strtoupper($rs['encoding']);
            $cpout = strtoupper($charset);
            if ($cpin == $cpout) {
                function MyIConv($txt) { return $txt; }
            } 
            else {
                function MyIConv($txt) {
                    global $cpin, $cpout;
                    return iconv($cpin, $cpout, $txt);
                }
            }
            $out = '';
            if (@isset($rs['image_url']) && $rs['image_url'] != '') {
                if (@isset($rs['image_width']))
                    $classimg = @$rs['image_width'] > 540 || @$rs['image_width'] == '' ? ' class="imgrss540"' : ' class="imgrss"';
                else
                    $classimg = ' class="imgrss540"';
                $out .= '
<style>
.imgrss540 { width: 540px; }
.imgrss { width: '.@$rs['image_width'].'px; }
</style>
<div class="text-center m-auto"><img src="'.$rs['image_url'].'" alt="" title="'.$rs['image_title'].'"'.$classimg.' /></div>';
            }
            if (isset($rs['link']) && $rs['title'] != '') {
                if (preg_match('!^https?://([-a-z0-9.]+)+(/[-a-z0-9.]*)*(\?[-a-z0-9=&/]+)?$!', $rs['link']))
                    $out .= '
<p class="forum"><b><a href="'.$rs['link'].'" target="_blank">'.MyIConv($rs['title']).'</a></b></p>
<br />';
                else
                    $out .= '
<p class="forum"><b>'.MyIConv($rs['title']).'</b></p>
<p class="text-center m-auto">'.$rs['link'].'</p><br />';
            }
            if (isset($rs['description'])) {
                $out .= '
<p><b>'.html_entity_decode(MyIConv($rs['description']), ENT_QUOTES, $charset).'</b></p>
<hr class="w-60" />';
            }            
            $i = 0;
            foreach($rs['items'] as $item) {
                $i++;
                if ($item['title'] == '' && $item['link'] == '') {
                    $txt = '';
                }
                elseif ($item['title'] == '') {
                    $txt = '<a href="'.$item['link'].'" target="_blank">'.$item['link'].'</a><br /><br />';
                }
                elseif ($item['link'] == '') {
                    $txt = '<u>'.MyIConv($item['title']).'</u><br /><br />';
                }
                else {
                    $txt = '<a href="'.$item['link'].'" target="_blank" title="'.$web[297].'">
                              '.MyIConv($item['title']).'&nbsp; <i class="fas fa-eye" title="'.$web[297].'"></i>
                            </a><br /><br />';
                }
                $txt1 = '';
				if (isset($item['description'])) {
					$desc = html_entity_decode(MyIConv($item['description']), ENT_QUOTES, $charset);			  
					$txt1 = '<b>'.$txt.'</b>'.$desc;
				}
                if (!empty($txt1)) {
                    $out .= '
<style>
.maxwidthitem { max-width: '.$max_width.'; }
.txt1rss {
  height: '.($max_height > 0 ? $max_height.'px;' : 'auto;').'
  overflow: '.($max_height > 0 ? 'hidden;' : 'visible;').'
}
</style>
<div id="texte2'.$i.'" class="rep text2newsrss maxwidthitem">
  <div class="rep text-justify txt1rss">
    '.$txt1.'
  </div>';
                    if ($max_height > 0) $out .= '
  <p class="text-right">
    <a href="javascript:cache(\'texte2'.$i.'\');montre(\'texte1'.$i.'\');" class="box" title="'.$web[296].'">
    '.$web[296].' <i class="far fa-plus-square" title="'.$web[296].'"></i></a>
  </p>
</div>
<div id="texte1'.$i.'" class="bord text-justify text1newsrss maxwidthitem" style="display:none;">
          '.$txt1.'
  <p class="text-right c-pointer">
    <a href="javascript:cache(\'texte1'.$i.'\');montre(\'texte2'.$i.'\');" class="box" title="'.$web[57].'">
      '.$web[57].' <i class="far fa-minus-square" title="'.$web[57].'"></i>
    </a>
  </p>
</div>';
                }
                if (isset($item['pubDate']) && $item['pubDate'] != '') $out .= '
<div class="m-auto datitemrss maxwidthitem">('.FormatDate($item['pubDate']).')</div>';
                else $out .= '
<div class="m-auto datitemrss maxwidthitem">(???)</div>';
                $out .= '
<hr class="maxwidthitem" />';
            }
            $modfl = @filemtime(CACHEREP.'rsscache_'.md5($rssurl));
            $txt   = $modfl == false ? $web[261] : $web[263].' <b>'.FormatDateStamp($modfl).'</b>';
            $out  .= '
<p>'.$txt.'</p>';
        }
        else 
            $out = '
<p>'.$web[262].' '.$rssurl.'</p>';
        return array('RSS', $out);
    }
}    
?>
photorama.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/photorama.inc'
View Content
<?php
/*******************************************************************************
 *   Photos
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2023 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.19 (August 20, 2024) : Adaptation Order Number sort
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'photorama.inc')) {
    header('location:../index.php');
    die();
}

if (is_dir(CHEMIN.'inc/photo/lightbox')) {
    $headinc .= '
<link href="'.CHEMIN.'inc/photo/lightbox/css/lightbox.min.css" rel="stylesheet" />'.
JavascriptFile(CHEMIN.'inc/photo/lightbox/js/lightbox.min.js').
JavascriptFile(CHEMIN.'inc/photo/lightbox/js/modernizr.custom.js');
}
if (is_dir(CHEMIN.'inc/photo/lytebox')) {
    $headinc .= '
<link rel="stylesheet" href="'.CHEMIN.'inc/photo/lytebox/lytebox.css" type="text/css" media="screen" />'.
JavascriptFile(CHEMIN.'inc/photo/lytebox/lytebox.js');
}

class GY_photo {
    public $tconfig;
    public $topmess;
    public $widepage;
    public $userprefs3;
    public $phtyp;
    protected $pg;
    protected $id;
    protected $largpage;
    protected $idpg;
    
    public function __construct() {
        global $nom, $menuico, $page, $lang, $lng, $charset, $serviz;
        $topmess        = getLabel($nom[$lng == $lang[0] ? 2 : 12]);
        $this->topmess  = $page[9] == '' ? $topmess : '<i class="far fa-images float-right"></i>'.$topmess;
        $this->tconfig  = $menuico[14] == 'ALL' ? ($serviz[157] != 0 ? $serviz[157] : import('tconfig', '', true, 0)) : $menuico[14];
        $this->widepage = $serviz[156];
        $this->pg       = import('pg');
        $this->id       = import('id', '', true, 1);
        $this->largpage = import('largpage', '', true, 'N');
        $this->idpg     = import('idpg', '', true, 1);
    }
    
    public function PH_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $href1 = CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 
          : 'connect.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2);
        $href2 = CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
          : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$this->tconfig.$z2);
        $out = '';
        if ($serviz[9] != 'on') {
            $out = '
    <div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array($this->phtyp, $out);
        }
        elseif (!isAccessGranted($members[2])) {
            $out = '
	<div class="web342 text-center">'.$web[342];
            if ($members[19] != '0' && $members[19] != '3') {
                $out .= '
      <p class="text-center">
        '.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
          (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
      </p>';
            }
            $out .= '
	</div>';
            return array($this->phtyp, $out);
        }
        elseif (!empty($this->pg)) {
            $dbwork = SelectDbFieldsByField(ReadDBFields(DBPHOTO), 4, $this->pg);
			if (!empty($dbwork))
			{
				if (!isAccessGranted($dbwork[0][6]) || !isAuthorizedPublication($dbwork[0][5])) {
					$out = '
		<div class="web342 text-center">'.$web[342];
					if ($members[19] != '0' && $members[19] != '3') {
						$out .= '
		  <p class="text-center">
			'.SubmitButton($web[630], 'self.location.href=\''.$href1.'\'').
			  (empty($pseudo) ? '&nbsp;&nbsp;'.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'') : '').'
		  </p>';
					}
					$out .= '
		</div>';
					return array($this->phtyp, $out);
				}
			}
            if (empty($dbwork) || !is_file(PHOTOREP.'gal_'.$this->pg.'/params_'.$this->pg.INCEXT)) {
                unset($dbwork);
                if ($site[10] != '') return array('h1', '');
                else return array('h2', '');
            }
        }
        return array('');
    }
    
    public function PH_content() {
        global $lang, $lng, $web, $serviz, $urlrw, $site, $prt, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $out = '';
// LOg 
$datjourl = new DateTime('now');
$dateheureminiutesecl = $datjourl->format('Y_m_d');
$nomficlog = CHEMIN.'data/log/photorama'.'_'.$dateheureminiutesecl.'.log';
// fin de log
        if (!empty($this->pg)) {
            $dbwork = SelectDbFieldsByField(ReadDBFields(DBPHOTO), 4, $this->pg);
			if (file_exists(PHOTOREP.'gal_'.$this->pg.'/params_'.$this->pg.INCEXT))
            include PHOTOREP.'gal_'.$this->pg.'/params_'.$this->pg.INCEXT;
        } else {
            $dbwork  = array();
            $dbwork2 = ReadDBFields(DBPHOTO);
            $dbwork1 = array_filter($dbwork2, 'IsNotEmptyTitle');
            foreach ($dbwork1 as $db) {
                $param10 = '';
				if (file_exists(PHOTOREP.'gal_'.$db[4].'/params_'.$db[4].INCEXT))
				{
					include PHOTOREP.'gal_'.$db[4].'/params_'.$db[4].INCEXT;
					if (isAccessGranted($db[6]) && isAuthorizedPublication($db[5]) && empty($param10)) {
						if (!isset($db[9])) $db[9] = '0099';
						$dbwork[] = $db;
					}
				}
            }
            unset($dbwork1, $dbwork2);
        }
		if (!isset($serviz[182])) $serviz[182] = 0;
        if ($serviz[182] == 0) sort($dbwork);
		if ($serviz[182] == 1)
			array_multisort(array_column($dbwork, 0), SORT_ASC, array_column($dbwork, 4), SORT_DESC, $dbwork);
		if ($serviz[182] == 2)
			array_multisort(array_column($dbwork, 4), SORT_DESC, array_column($dbwork, 0), SORT_ASC, $dbwork);			
        if (empty($this->id)) $this->id = 1;
        if (!empty($dbwork)) {
            $typeRubrique = TYP_PHOTO;
            $imgOpen      = "far fa-plus-square";
            $imgClose     = "far fa-minus-square";
            $subImgOpen   = "far fa-caret-square-down";
            $subImgClose  = "far fa-caret-square-up";
            $mawmenu      = (count($dbwork)-($serviz[87]*($this->id-1))>$serviz[87]) ? $serviz[87] : count($dbwork)-($serviz[87]*($this->id-1)) ;
            $out .= BeginJavascript().'
var maxsub = '.$mawmenu.';'.EndJavascript();
            $rubr  = '';
            $l     = 0;
            $isNew = false;
            for ($i = $serviz[87]*($this->id-1); $i < Min($serviz[87]*$this->id, count($dbwork)); $i++) {
                ReadDoc($dbwork[$i][4]);

                $dirgal = 'gal_'.$fileid;
                $dirmin = $dirgal.'/vgnt';
                $img = getNewUpdateDoc($creadate, $moddate, $serviz[142]);
                if ($img != '') $isNew = true;
                if ($lng == $lang[0]) {
                    $txt1 = $img.$fieldb1;
                    $txt2 = $fieldc1;
                    $txt3 = $fielda1;
                } else {
                    $txt1 = $img.$fieldb2;
                    $txt2 = $fieldc2;
                    $txt3 = $fielda2;
                }
                if (!is_file(PHOTOREP.$dirgal.'/params_'.substr($dirgal, 4).INCEXT)) {
                    $txt2 = '
  <p class="text-center"><br>'.$web[680].'<br /><br /></p>';
                } else {
                    $tmpi = count(SelectDBFieldsByField(ReadDBFields(PHOTOREP.$dirgal.'/'.$dirgal.DBEXT), 1, 'a'));
					if (file_exists(include PHOTOREP.$dirgal.'/params_'.substr($dirgal, 4).INCEXT))
                    include PHOTOREP.$dirgal.'/params_'.substr($dirgal, 4).INCEXT;
                }
                if ($rubr != $txt3) {
                    $rubr = $txt3;
                    if ($l > 0) $out .= '
</div>';
                    if (trim($rubr) != "") {
                        $l++;
                        $out .= '
<div id="titreRubr'.$typeRubrique.$i.'" class="phrubr font-weight-bold" 
    onclick="MontreCacheItems(\'imgOpen'.$typeRubrique.$i.'\',\'imgClose'.$typeRubrique.$i.'\',
      \'itemsRubr'.$typeRubrique.$i.'\',\'itemsRubrSelect\');">
  <i id="imgOpen'.$typeRubrique.$i.'" class="'.$imgOpen.'" title="'.$web[429].'" style="display: none;"></i>
  <i id="imgClose'.$typeRubrique.$i.'" class="'.$imgClose.'" title="'.$web[57].'" style="display: inline;"></i>
  &nbsp;'.$rubr.'
</div>';
                        if (count($dbwork) == 1) $out .= '
<div id="itemsRubrSelect" style="display: block;">';
                        else $out .= '
<div id="itemsRubr'.$typeRubrique.$i.'" style="display: block;">';
                    }
                }
                $out .= '
  <div id="titreSubRubr'.$typeRubrique.$i.'" class="phrubr2 font-weight-bold" 
      onclick="MontreCacheItems(\'subImgOpen'.$typeRubrique.$i.'\',\'subImgClose'.$typeRubrique.$i.'\',
        \'itemSubRubr'.$typeRubrique.$i.'\',\'itemSubRubrSelect\');">'."\n".'
	<div class="phitem2">
      <i id="subImgOpen'.$typeRubrique.$i.'" class="'.$subImgOpen.'" title="'.$web[429].'" style="display: none;"></i>
      <i id="subImgClose'.$typeRubrique.$i.'" class="'.$subImgClose.'" title="'.$web[57].'" style="display: inline;"></i>
	</div>
	<div class="phsubrubr">
      <a class="pl-3" id="subRubr'.$typeRubrique.$i.'">'.$txt1.'</a>'.(@$param11 != 'on' ? '<span class="phcpt">('.$tmpi.' photos)</span>' : '').'
    </div>
  </div>';
                $out .= '
  <div class="clearfix"></div>';
                if (count($dbwork) == 1) $out .= '
  <div class="bord2" id="itemSubRubrSelect" style="display: block;">';
                else $out .= '
  <div class="bord2" id="itemSubRubr'.$typeRubrique.$i.'" style="display: block;">';
                if (!empty($txt2)) $out .= '
  <div class="phcomment">'.$txt2.'</div>';
                $out .= '
  <div class="phimgs">';
                if (file_exists(PHOTOREP.$dirgal.'/params_'.substr($dirgal, 4).INCEXT)) {
                    if ($tmpi > 0) {
                        $dirgal  = 'gal_'.$fileid;
                        $dirmin  = $dirgal.'/vgnt';
						$dbphoto = ReadDBFields(PHOTOREP.$dirgal.'/'.$dirgal.DBEXT);
                        $tmpi    = 0;
                        $tmp[0]  = array();
                        $tmp[1]  = array();
                        $tmp[2]  = array();
                        $tmp[3]  = array();
                        $tmp[4]  = array();
                        $tmp[5]  = array();
                        $tmp[6]  = array();
						$tmp[9]  = array();
                        for ($ii = 0; $ii < count($dbphoto); $ii++) {
                            if ($dbphoto[$ii][1] == 'a') {
                                $tmp[0][$tmpi] = $dbphoto[$ii][0];
                                $tmp[1][$tmpi] = $dbphoto[$ii][1];
                                $tmp[2][$tmpi] = $dbphoto[$ii][2];
                                $tmp[3][$tmpi] = $dbphoto[$ii][3];
                                $tmp[4][$tmpi] = $dbphoto[$ii][4];
                                $tmp[5][$tmpi] = $dbphoto[$ii][5];
                                $tmp[6][$tmpi] = $dbphoto[$ii][6];
								if (!isset($dbphoto[$ii][9])) 
									$tmp[9][$tmpi] = '';
								else
									$tmp[9][$tmpi] = $dbphoto[$ii][9];
                                $tmpi++;
                            }
                        }
                        unset($dbphoto);
//						file_put_contents($nomficlog, date('Y-m-d H:i:s').'tri 2 174: '.$serviz[174]."\n", FILE_APPEND | LOCK_EX);
						if ($serviz[174] == 0) // nom ascendant
							array_multisort($tmp[2], SORT_ASC, $tmp[0], $tmp[1], $tmp[3], $tmp[4], $tmp[5], $tmp[6]);	
						if ($serviz[174] == 1) //tri no ordre asc et nom ascendant
							array_multisort($tmp[9], SORT_ASC, $tmp[2] , SORT_ASC, $tmp[0], $tmp[1], $tmp[3], $tmp[4], $tmp[5], $tmp[6]);							
                        $countgal = UpdateDocCounter($dbwork[$i][4]);
                        $txtcount = $web[685].'<b>'.$countgal.' '.($countgal < 2 ? $web[188] : $web[189]).'</b>';
                        $out .= '
    <div class="phimgs2 '.($param8 == 'L' ? 'text-left' : ($param8 == 'C' ? 'text-center' : 'text-right')).'">';
                        $nbmin = min($param1, $tmpi);
                        $nbpl  = min($param6, $nbmin);
                        $nb    = 0;
                        for ($ii = 0; $ii < $nbmin; $ii++) {
                            $filemin = PHOTOREP.$dirmin.'/'.$tmp[2][$ii];
                            $fileimg = PHOTOREP.$dirgal.'/'.$tmp[2][$ii];
                            $comment = stripslashes($tmp[$lng == $lang[0] ? 5 : 6][$ii]);
                            switch ($param4) {
                            case 'lightbox' :
                                $out .= '
	  <a href="'.$fileimg.'" class="lightshow" title="'.$comment.'" data-lightbox="'.$fileid.'" rel="lightbox[plants]">';
                                break;
                            case 'lytebox' :
                                $out .= '
	  <a href="'.$fileimg.'" class="lyteshow" data-lyte-options="slide:true group:'.$fileid.' slideInterval:'.((int)$param5*1000).'" 
        data-title="'.$comment.'" rel="lyteshow[diapo'.$fileid.']">';
                                break;
                            }
							if (empty($param7)) $param7 = 1;
                            $out .= '
<style>
.phimg'.$fileid.$ii.' {
    width: '.$tmp[3][$ii].'px;
    height: '.$tmp[4][$ii].'px;
    margin: '.intval($param7/2).'px;
}
</style>
        <img class="phimg phimg'.$fileid.$ii.'" src="'.$filemin.'" alt="" title="" />
	  </a>';
                            $nb++;
                            if ($nb == $nbpl) {
                                $out .= '<br />';
                                $nb = 0;
                            }
                        }
                        if ($nbmin < $tmpi) $out .= '
      <strong>...</strong>';
                        for ($ii = $nbmin; $ii < $tmpi; $ii++) {
                            $filemin = PHOTOREP.$dirmin.'/'.$tmp[2][$ii];
                            $fileimg = PHOTOREP.$dirgal.'/'.$tmp[2][$ii];
                            $comment = stripslashes($tmp[$lng == $lang[0] ? 5 : 6][$ii]);
                            $out .= '
      <span class="d-none">';							
                            switch ($param4) {
                            case 'lightbox' :
                                $out .= '
	    <a href="'.$fileimg.'" title="'.$comment.'" data-lightbox="'.$fileid.'" rel="lightbox[plants]">';
                                break;
                            case 'lytebox' :
                                $out .= '
	    <a href="'.$fileimg.'" class="lyteshow" data-lyte-options="slide:true group:'.$fileid.' slideInterval:'.((int)$param5*1000).'" 
          data-title="'.$comment.'" rel="lyteshow[diapo'.$fileid.']">';
                                break;
                            }
                            $out .= '
<style>
.phimg2'.$fileid.$ii.' {
    width: '.$tmp[3][$ii].'px;
    height: '.$tmp[4][$ii].'px;
}
</style>
          <img src="'.$filemin.'"  class="phimg2'.$fileid.$ii.'" alt="" title="" />
	    </a>
	  </span>';
                        }
                        $out .= '
    </div>';
                        if (@$param12 != 'on') $out .= '
    <div class="galcounter text-right">('.$txtcount.')</div>';
                        $out .= '
    <div class="clearfix"></div>';
                    }
                    $out .= displayQuickConfig(NULL, $dbwork[$i][4], 'photo&amp;form=2&amp;id='.$dbwork[$i][4], 
                      'photo&amp;act=i&amp;id='.$dbwork[$i][4], 'photo&amp;del='.$dbwork[$i][4], 18);
                    $out .= '
  </div>
</div>';
                }

		} // fin for
            if ($l > 0) $out .= '
</div>';
            if ('on' != $serviz[81] && !$isNew && empty($prt)) {
                $out .= BeginJavascript().'
var nbRubr = '.$i.';
var typeRubr = "'.$typeRubrique.'";
for(i = 0; i < nbRubr; i++) {
	if((document.getElementById && document.getElementById("itemsRubr"+ typeRubr + i) != null) 
      || (document.all && document.all["itemsRubr"+ typeRubr + i] != undefined ) 
      || (document.layers && document.layers["itemsRubr"+ typeRubr + i] != undefined) ) {
		cache("itemsRubr"+ typeRubr + i);
		montre("imgOpen"+ typeRubr + i,"inline");
		cache("imgClose"+ typeRubr + i);
	}
}'.EndJavascript();
            }
            if ('on' != $serviz[81] && empty($prt)) {
                $out .= BeginJavascript().'
var nbRubr = '.$i.';
var typeRubr = "'.$typeRubrique.'";
for(i = 0; i < nbRubr; i++) {
	if((document.getElementById && document.getElementById("itemSubRubr"+ typeRubr + i) != null) 
      || (document.all && document.all["itemSubRubr"+ typeRubr + i] != undefined ) 
      || (document.layers && document.layers["itemSubRubr"+ typeRubr + i] != undefined) ) {
		cache("itemSubRubr"+ typeRubr + i);
		montre("subImgOpen"+ typeRubr + i,"inline");
		cache("subImgClose"+ typeRubr + i);
	}
}'.EndJavascript();
            }
        }
        elseif (!empty($this->pg)) $out .= '
<p>'.$web[36].'</p>';
        $out .= '
<div class="phrubr2 font-weight-bold">
  '.GetNavBar(($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[9].'-5-'.$this->tconfig.'-' 
    : 'photorama.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.'&amp;id='), 
    count($dbwork), $this->id, $serviz[87], $z2).'
</div>';
        return array($this->phtyp, $out);
    }
    
    public function PH2_content() {
        global $lang, $lng, $web, $serviz, $urlrw, $site, $prt, $z2, $members, $nom, $page;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, 
               $fielda1, $fielda2, $fieldb1, $fieldb2, $fieldc1, $fieldc2,
               $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $out = '';
// LOg 
$datjourl = new DateTime('now');
$dateheureminiutesecl = $datjourl->format('Y_m_d');
$nomficlog = CHEMIN.'data/log/photorama ph2_content'.'_'.$dateheureminiutesecl.'.log';
// file_put_contents($nomficlog, date('Y-m-d H:i:s').' debut: '."\n", FILE_APPEND | LOCK_EX);
// fin de log

        if (!empty($this->pg)) {
            $dbwork = SelectDbFieldsByField(ReadDBFields(DBPHOTO), 4, $this->pg);
            if (!empty($dbwork)) {
                ReadDoc($dbwork[0][4]);
                $img = getNewUpdateDoc($creadate, $moddate, $serviz[142]);
                if ($lng == $lang[0]) {
                    $txt1 = $img.$fieldb1;
                    $txt2 = $fieldc1;
                    $txt3 = $fielda1;
                } 
                else {
                    $txt1 = $fieldb2;
                    $txt2 = $fieldc2;
                    $txt3 = $fielda2;
                }
                $dirgal  = 'gal_'.$fileid;
                $dirmin  = $dirgal.'/vgnt';
                $dbphoto = ReadDBFields(PHOTOREP.$dirgal.'/'.$dirgal.DBEXT);
                $tmpi    = 0;
                $tmp[0]  = array();
                $tmp[1]  = array();
                $tmp[2]  = array();
                $tmp[3]  = array();
                $tmp[4]  = array();
                $tmp[5]  = array();
				$tmp[9]  = array();
				for ($ii = 0; $ii < count($dbphoto); $ii++) {
					if ($dbphoto[$ii][1] == 'a') {
						$tmp[0][$tmpi] = $dbphoto[$ii][0];
						$tmp[1][$tmpi] = $dbphoto[$ii][1];
						$tmp[2][$tmpi] = $dbphoto[$ii][2];
						$tmp[3][$tmpi] = $dbphoto[$ii][3];
						$tmp[4][$tmpi] = $dbphoto[$ii][4];
						$tmp[5][$tmpi] = $dbphoto[$ii][5];
						$tmp[6][$tmpi] = $dbphoto[$ii][6];
						if (!isset($dbphoto[$ii][9])) 
							$tmp[9][$tmpi] = '';
						else
							$tmp[9][$tmpi] = $dbphoto[$ii][9];
						$tmpi++;
					}
				}
				unset($dbphoto);
//				file_put_contents($nomficlog, date('Y-m-d H:i:s').'tri 1er 174: '.$serviz[174]."\n", FILE_APPEND | LOCK_EX);
				if ($serviz[174] == 0) // nom ascendant
					array_multisort($tmp[2], SORT_ASC, $tmp[0], $tmp[1], $tmp[3], $tmp[4], $tmp[5], $tmp[6]);	
				if ($serviz[174] == 1) //tri no ordre asc et nom ascendant
					array_multisort($tmp[9], SORT_ASC, $tmp[2] , SORT_ASC, $tmp[0], $tmp[1], $tmp[3], $tmp[4], $tmp[5], $tmp[6]);		
                if (file_exists(PHOTOREP.$dirgal.'/params_'.substr($dirgal, 4).INCEXT))
                    include PHOTOREP.$dirgal.'/params_'.substr($dirgal, 4).INCEXT;
            }
            $this->largpage = empty($this->largpage) ? 'N' : $this->largpage;
            switch($this->largpage) {
            case 'W' :
                $this->userprefs3 = '';
                $this->widepage   = 'on';
                break;
            case 'L' :
                $this->userprefs3 = 'L';
                break;
            case 'R' :
                $this->userprefs3 = 'R';
                break;
            default : 
                $this->userprefs3 = '';
                break;
            }
            $topmess       = getLabel($nom[$lng == $lang[0] ? 2 : 12]).(empty($txt3) ? '' : ' - '.$txt3.' : ').$txt1;
            $this->topmess = $page[9] == '' ? $topmess : '<i class="far fa-images float-right"></i>'.$topmess;
            $errpg         = false;
            if (!is_file(PHOTOREP.$dirgal.'/params_'.substr($dirgal, 4).INCEXT)) $txt2 = '
<p class="text-center"><br>'.$web[680].'<br /><br /></p>';
            if ($param4 == 'unitegallery') {
                $ugfile = PHOTOREP.$dirgal.'/'.$lng.'-th'.$param13.'_'.$this->pg.INCEXT;
                if (is_file($ugfile)) {
                    if (!empty($txt2)) $out .= '
<div class="phcomment">'.$txt2.'</div>';
                    $out .= file_get_contents($ugfile);
                    $countgal = UpdateDocCounter($dbwork[0][4]);
                    $txtcount = $web[685].'<b>'.$countgal.' '.($countgal < 2 ? $web[188] : $web[189]).'</b>';
                    if ($param12 != 'on') $out .= '
<div class="galcounter text-right">('.$txtcount.')</div>';
                } 
                else
				{
                    $errpg = true;				
				}
            } 
            else {
                if (!empty($dbwork)) {
					if (!isset($param11)) $param11 = '';
                    $out .= '
<div class="phrubr2 font-weight-bold phsubrubr">'.$txt1.($param11 != 'on' ? '<span class="phcpt">('.$tmpi.' photos)</span>' : '').'</div>';
                    if (!empty($txt2)) $out .= '
<div class="phcomment">'.$txt2.'</div>';
                    $fileid = substr($dirgal, 4);
                    $out .= '
<div class="phimgs">';
                    if ($tmpi > 0 && is_file(PHOTOREP.$dirgal.'/params_'.$fileid.INCEXT)) {
                        $out .= '
  <div class="phimgs2 w-100 m-auto '.($param8 == 'L' ? 'text-left' : ($param8 == 'C' ? 'text-center' : 'text-right')).'">';
                        $nbmin = min($param1, $tmpi);
                        $nbpl  = min($param6, $nbmin);
                        $nb    = 0;
                        if (empty($this->idpg)) $this->idpg = 1;
                        else while ($tmpi <= ($this->idpg - 1)* $nbmin) $this->idpg--;
                        $navbar = GetNavBar(($site['URLR'] == 'on' 
                          ? $lng.'-'.$urlrw[9].'-3-'.$this->pg.'-'.$this->largpage.'-'.$this->tconfig.'-' 
                          : 'photorama2.php?lng='.$lng.'&amp;pg='.$this->pg.'&amp;largpage='.$this->largpage.'&amp;tconfig='.$this->tconfig.'&amp;idpg='), 
                          $tmpi, $this->idpg, $nbmin, $z2);
                        for ($ii = 0; $ii < max($nbmin*($this->idpg-1), 0); $ii++) {
                            $filemin = PHOTOREP.$dirmin.'/'.$tmp[2][$ii];
                            $fileimg = PHOTOREP.$dirgal.'/'.$tmp[2][$ii];
                            $comment = stripslashes($tmp[$lng == $lang[0] ? 5 : 6][$ii]);
                            $out .= '
    <span class="d-none">';							
                            switch ($param4) {
                            case 'lightbox' :
                                $out .= '
      <a href="'.$fileimg.'" class="lightshow" title="'.$comment.'" data-lightbox="'.$dbwork[0][4].'" rel="lightbox[plants]">';
                                break;
                            case 'lytebox' :
                                $out .= '
	  <a href="'.$fileimg.'" class="lyteshow" data-lyte-options="slide:true group:'.$dbwork[0][4].' slideInterval:'.($param5*1000).'" 
        data-title="'.$comment.'" rel="lyteshow[diapo'.$dbwork[0][4].']">';
                                break;
                            }
                            $out .= '
<style>
.phimg2'.$fileid.$ii.' {
    width: '.$tmp[3][$ii].'px;
    height: '.$tmp[4][$ii].'px;
}
</style>
        <img src="'.$filemin.'"  class="phimg2'.$fileid.$ii.'" alt="" title="" />
      </a>
	</span>';
                        }
                        $countgal = UpdateDocCounter($dbwork[0][4]);
                        $txtcount = $web[685].'<b>'.$countgal.' '.($countgal < 2 ? $web[188] : $web[189]).'</b>';;
                        for ($ii = $nbmin*($this->idpg-1); $ii < Min($nbmin*$this->idpg, $tmpi); $ii++) {
                            $filemin = PHOTOREP.$dirmin.'/'.$tmp[2][$ii];
                            $fileimg = PHOTOREP.$dirgal.'/'.$tmp[2][$ii];
                            $comment = stripslashes($tmp[$lng == $lang[0] ? 5 : 6][$ii]);
                            switch ($param4) {
                            case 'lightbox' :
                                $out .= '
	  <a href="'.$fileimg.'" class="lightshow" title="'.$comment.'" data-lightbox="'.$dbwork[0][4].'" rel="lightbox[plants]">';
                                break;
                            case 'lytebox' :
                                $out .= '
	  <a href="'.$fileimg.'" class="lyteshow" data-lyte-options="slide:true group:'.$dbwork[0][4].' slideInterval:'.((int)$param5*1000).'" data-title="'.$comment.'" rel="lyteshow[diapo'.$dbwork[0][4].']">';
                                break;
                            }
                            $out .= '
<style>
.phimg'.$fileid.$ii.' {
    width: '.$tmp[3][$ii].'px;
    height: '.$tmp[4][$ii].'px;
    margin: '.intval($param7/2).'px;
}
</style>
        <img src="'.$filemin.'" class="phimg phimg'.$fileid.$ii.'" alt="" title="" />
	  </a>';
                            $nb++;
                            if ($nb == $nbpl) {
                                $out .= '<br />';
                                $nb = 0;
                            }
                        }
                        for ($ii = Min($nbmin*$this->idpg, $tmpi); $ii < $tmpi; $ii++) {
                            $filemin = PHOTOREP.$dirmin.'/'.$tmp[2][$ii];
                            $fileimg = PHOTOREP.$dirgal.'/'.$tmp[2][$ii];
                            $comment = stripslashes($tmp[$lng == $lang[0] ? 5 : 6][$ii]);
                            $out .= '
    <span class="d-none">';							
                            switch ($param4) {
                            case 'lightbox' :
                                $out .= '
	  <a href="'.$fileimg.'" class="lightshow" title="'.$comment.'" data-lightbox="'.$dbwork[0][4].'" rel="lightbox[plants]">';
                                break;
                            case 'lytebox' :
                                $out .= '
	  <a href="'.$fileimg.'" class="lyteshow" data-lyte-options="slide:true group:'.$dbwork[0][4].' slideInterval:'.((int)$param5*1000).'" 
        data-title="'.$comment.'" rel="lyteshow[diapo'.$dbwork[0][4].']">';
                                break;
                            }
                            $out .= '
<style>
.phimg3'.$fileid.$ii.' {
    width: '.$tmp[3][$ii].'px;
    height: '.$tmp[4][$ii].'px;
}
</style>
          <img src="'.$filemin.'"  class="phimg3'.$fileid.$ii.'" alt="" title="" />
	    </a>
	  </span>';
                        }
                        $out .= $navbar;
                        $out .= '
    </div>';
						if (!isset($param12)) $param12 = 'on';
                        if ($param12 != 'on') $out .= '
    <div class="galcounter text-right">('.$txtcount.')</div>';
                        $out .= '
    <div class="clearfix"></div>';
                        if (empty($prt)) $out .= 
    displayQuickConfig(NULL, false, 'photo&amp;form=2&amp;id='.$dbwork[0][4], 
      'photo&amp;act=i&amp;id='.$dbwork[0][4], 'photo&amp;del='.$dbwork[0][4], 18);
                    }
                    unset($tmp[0],$tmp[1],$tmp[2],$tmp[3],$tmp[4],$tmp[5],$tmp[6]);
                    $out .= '
  </div>';
                }
                else
                    $errpg = true;
            }
            if (!empty($this->pg) && $errpg) $out .= '
<p>'.$web[36].'</p>';
        }
        return array($this->phtyp, $out);
    }
}
?>
preview.css
wget 'https://sme10.lists2.roe3.org/guppy/inc/preview.css'
View Content
/***********************************************
 * Feuille de style dédiée à l'aperçu avant impression
 ***********************************************
 * Elle permet de n'afficher que la partie principale de la page
 ***********************************************/

@media screen {
    body { background: transparent !important; }
    #header,
    #TopBoxes,
    #LeftBoxes,
    #AboveBoxes,
    #UnderBoxes,
    #RightBoxes,
    #BottomBoxes,
    #footer,
    #BlogTopBoxes,
    #BlogLeftBoxes,
    #BlogRightBoxes,
	.titrebox,
	.tblbox,
    #slide1, #slide3, #paranav, #returnOnTop { display : none; }
    #slide2 { background: transparent !important; }
}
print.css
wget 'https://sme10.lists2.roe3.org/guppy/inc/print.css'
View Content
/***********************************************
 * Feuille de style dédiée à l'aperçu avant impression
 ***********************************************
 * Elle permet de n'afficher que la partie principale de la page
 ***********************************************/

@media print {
    body { background: transparent !important; }
    #header,
    #TopBoxes,
    #LeftBoxes,
    #AboveBoxes,
    #UnderBoxes,
    #RightBoxes,
    #BottomBoxes,
    #footer,
    #BlogTopBoxes,
    #BlogLeftBoxes,
    #BlogRightBoxes,
    #slide1, #slide3, #paranav, #returnOnTop { display : none; }    
    #slide2 { background: transparent !important; }
}
search.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/search.inc'
View Content
<?php
/*******************************************************************************
 *   Search
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2022 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.19 (August 26, 2024) : Adaption after choice view
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'search.inc')) {
    header('location:../index.php');
    die();
}

class GY_search {
    public $tconfig;
    public $topmess;
    protected $search;
    protected $searchin;
    protected $searchlng;
    protected $tokens;

    public function __construct() {
        global $web;
        include CONFIGREP.'searchconfig.inc';
        $this->search    = import('search');
        $this->tconfig   = import('tconfig', '', true, 0);
        $this->tconfig   = $confpage == 'ALL' ? $this->tconfig : $confpage;
        $this->topmess   = $web[59].' - '.stripslashes($this->search);
        $this->searchin  = import('searchin');
        $this->searchlng = import('searchlng');
        $this->cat       = import('cat', '', false, 0);
    }
    
    public function SCH_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web;
        $out   = '';
        $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
        if ($serviz[24] != 'on') {
            $out = '
    <div class="text-center web342">'.$web[143];
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array('SCH', $out);
        }
        if (empty(trim($this->search))) {
            $out = '
    <div class="text-center web342">'.$web[505];
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array('SCH', $out);
        }
        return array('');
    }

    protected function Rechercher($expr, $string) {
        $res        = 0;
        $total      = 0;
        $occurrence = array();
        $i          = 0;
        $k          = 0;
        foreach ($expr as $exp) {
            $r = preg_match_all('"'.$exp.'"', $string, $x);
            if (($r !== false) && ($r > 0)) {
                $res += (10 + max(100-20*$i, 1))*(9 + min($r, 5));
            }
            if (in_array($exp, $this->tokens)) {
                $occurrence['mot'][$k] = $exp;
                $occurrence['nb'][$k]  = $r;
                $total += $r;
                $k++;
            }
            $i++;
        }
        if ($total == 0) $res = 0;
        $occurrence['stat'][0] = $res;
        $occurrence['stat'][1] = $total;
        return $occurrence;
    }

    protected function GetTitleMenuBox($id) {
        global $lng, $lang;
        $title = '';
        $id    = TestFileID($id);
        if (FileDBExist(DBBASE.$id.INCEXT)) {
            include DBBASE.$id.INCEXT;
            $title = ($lng == $lang[0]) ? $fieldb1 : $fieldb2;
        }
        return $title;
    }

    public function SCH_content() {
        global $nom, $site, $page, $lang, $lng, $members, $charset, $serviz, $nom, $page, $prt, 
               $userprefs, $web, $charset, $urlrw, $z2;
        global $type, $fileid, $status, $creadate, $moddate, $author, $email, $fielda1, $fielda2, 
               $fieldb1, $fieldb2, $fieldc1, $fieldc2, $fieldd1, $fieldd2, $fieldweb, $fieldmail, $fieldmod;
        $out = '';
        $id  = import('id');
        include CONFIGREP.'searchconfig.inc';
        $this->tconfig     = $confpage == 'ALL' ? $this->tconfig : $confpage;
        $savesearch        = $this->search;
        $restricted        = false;
        $savepertinencemin = $pertinencemin;
		//log 
		$datjourl = new DateTime('now');
		$dateheureminiutesecl = $datjourl->format('Y_m_d');
		$nomficlog = CHEMIN.'data/log/searchinc'.'_'.$dateheureminiutesecl.'.log';
		
//        $pertinencemin  = import('pert');
		if (!empty(import('pert'))) $pertinencemin  = import('pert');
        if ($userprefs[1] == '') {
            if (!empty($this->searchin)) {
                $searchfor = array($this->searchin);
                $illegal   = false;
                switch ($this->searchin) {
                case TYP_ART :
                case TYP_REACT :
				    if (!isset($rech_article)) $rech_article = TYP_ART;
					if ($rech_article != '')
						if (!isAccessGranted($members[1])) $illegal = true;
                    break;
                case TYP_BLOG :
                case TYP_REBLOG :
				    if (!isset($rech_blog)) $rech_blog = TYP_BLOG;
					if ($rech_blog != '')
						if (!isAccessGranted($members[15])) $illegal = true;
                    break;
                case TYP_DNLOAD :
                    if (!isset($rech_download)) $rech_download = TYP_DNLOAD;
					if ($rech_download != '')
						if (!isAccessGranted($members[7])) $illegal = true;
                    break;
                case TYP_FAQ :
                    if (!isset($rech_faq)) $rech_faq = TYP_FAQ;
					if ($rech_faq != '')
						if (!isAccessGranted($members[4])) $illegal = true;
                    break;
                case TYP_FORUM :
                    if (!isset($rech_forum)) $rech_forum = TYP_FORUM;
					if ($rech_forum != '')
						if (!isAccessGranted($members[5])) $illegal = true;
                    break;
                case TYP_GUESTBK :
                    if (!isset($rech_livreor)) $rech_livreor = TYP_GUESTBK;
					if ($rech_livreor != '')
						if (!isAccessGranted($members[12])) $illegal = true;
                    break;
                case TYP_LINKS :
                     if (!isset($rech_liens)) $rech_liens = TYP_LINKS;
					if ($rech_liens != '')
						if (!isAccessGranted($members[3])) $illegal = true;
                    break;
                case TYP_NEWS :
                     if (!isset($rech_news)) $rech_news = TYP_NEWS;
					if ($rech_news != '') 
						if (!isAccessGranted($members[13])) $illegal = true;
                    break;
                case TYP_PHOTO :
                    if (!isset($rech_photo)) $rech_photo = TYP_PHOTO;
					if ($rech_photo != '') 
					    if (!isAccessGranted($members[2])) $illegal = true;
                    break;
                case TYP_AGENDA :
                    if (!isset($rech_rech_agenda)) $rech_rech_agenda = TYP_AGENDA;
					if ($rech_rech_agenda != '')
						if (!isAccessGranted($members[14])) $illegal = true;
                    break;
                }
                if ($illegal) {
                    die('STOP ! Illegal search');
                }
            } 
            else {
                $searchall = array (TYP_ART, TYP_DNLOAD, TYP_FAQ, TYP_FORUM, TYP_FREEBOX, TYP_GUESTBK, TYP_LINKS, 
                                    TYP_NEWS, TYP_PHOTO, TYP_REACT, TYP_AGENDA, TYP_BLOG, TYP_REBLOG, TYP_ARCH);
                $searchfor = array();
                foreach ($searchall as $typ) {
                    switch ($typ) {
                    case TYP_ART :
                    case TYP_REACT :
						if (!isset($rech_article)) $rech_article = TYP_ART;
						if ($rech_article != '') $searchfor[] = $typ; else $restricted = true;
                        if (isAccessGranted($members[1])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_BLOG :
                    case TYP_REBLOG :
						if (!isset($rech_blog)) $rech_blog = TYP_BLOG;
						if ($rech_blog != '') $searchfor[] = $typ; else $restricted = true;
                        if (isAccessGranted($members[15])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_DNLOAD :
						if (!isset($rech_download)) $rech_download = TYP_DNLOAD ;
						if ($rech_download != '') $searchfor[] = $typ; else $restricted = true;
                        if (isAccessGranted($members[7])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_FAQ :
 						if (!isset($rech_faq)) $rech_faq = TYP_FAQ;
						if ($rech_faq != '') $searchfor[] = $typ; else $restricted = true;
						if (isAccessGranted($members[4])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_FORUM :
						if (!isset($rech_forum)) $rech_forum = TYP_FORUM ;
						if ($rech_forum != '') $searchfor[] = $typ; else $restricted = true;
                        if (isAccessGranted($members[5])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_GUESTBK :
						if (!isset($rech_livreor)) $rech_livreor = TYP_GUESTBK;
						if ($rech_livreor != '') $searchfor[] = $typ; else $restricted = true;
                        if (isAccessGranted($members[12])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_LINKS :
						if (!isset($rech_liens)) $rech_liens = TYP_LINKS;
						if ($rech_liens != '') $searchfor[] = $typ; else $restricted = true;
                        if (isAccessGranted($members[3])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_NEWS :
						if (!isset($rech_news)) $rech_news = TYP_NEWS;
						if ($rech_news != '') $searchfor[] = $typ; else $restricted = true;
                        if (isAccessGranted($members[13])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_PHOTO :
						if (!isset($rech_photo)) $rech_photo = TYP_PHOTO;
						if ($rech_photo != '') $searchfor[] = $typ; else $restricted = true;
                        if (isAccessGranted($members[2])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_AGENDA :
						if (!isset($rech_agenda)) $rech_agenda = TYP_AGENDA ;
						if ($rech_agenda != '') $searchfor[] = $typ; else $restricted = true;
                       if (isAccessGranted($members[14])) $searchfor[] = $typ; else $restricted = true;
                        break;
                    case TYP_ARCH :
						if (!isset($rech_archive)) $rech_archive = TYP_ARCH ;
						if ($rech_archive != '') $searchfor[] = $typ; else $restricted = true;
                        break;
                    default :
                        $searchfor[] = $typ;
                    }
                    unset($searchall);
                }
            }
        } else 
            $searchfor = array (TYP_ART, TYP_DNLOAD, TYP_FAQ, TYP_FORUM, TYP_FREEBOX, TYP_GUESTBK, TYP_LINKS, 
                                TYP_NEWS, TYP_PHOTO, TYP_REACT, TYP_AGENDA, TYP_BLOG, TYP_REBLOG, TYP_ARCH);
        if (in_array($this->searchin, array(TYP_FORUM, TYP_ARCH))) {
            $searchfor      = array(TYP_FORUM, TYP_ARCH);
            $this->searchin = '';
        }
        $longword     = 100;
        $longbarre    = 75;
        $nbresult     = $resultbypage;
        $stylespan    = '<span style="';
        $stylespan   .= ($styleocc[0] == '') ? '' : 'color:'.$styleocc[0].'; ';
        $stylespan   .= ($styleocc[1] == '') ? '' : 'font-style:'.$styleocc[1].'; ';
        $stylespan   .= ($styleocc[2] == '') ? '' : 'font-weight:'.$styleocc[2].'; ';
        $stylespan   .= ($styleocc[3] == '') ? '' : 'text-decoration:'.$styleocc[3].'; ';
        $stylespan   .= ($styleocc[4] == '') ? '' : 'background-color:';
        $endstyle     = '</span>';
        $found        = array();
        $this->search = stripslashes(trim($this->search));
        $this->search = str_replace(array('^', '[', ']', '.', '+', '?', '*', '|'), '', $this->search);
        $this->search = str_replace(array('(', ')'), ' ', $this->search);
        $this->tokens = array();
        if (!empty($this->search)) {
            $searchlower = strtolower($this->search);
            $nbres = preg_match_all('/[ \t]*"([^ \t"]+[^"]*[^ \t"]+)"[ \t]*|[ \t]*([^ \t]+)[ \t]*/', $searchlower, $res);
            if (($nbres !== false) && ($nbres > 0)) {
                $this->search = '';
                for ($i=0; $i < count($res[1]); $i++) {
                    if (empty($res[1][$i])) {
                        $this->tokens[] = str_replace(array('/', '"'), array('\/', ''), trim($res[0][$i]));
                        $this->search  .= $this->tokens[$i].' ' ;
                    }
                    else {
                        $this->tokens[] = str_replace('/', '\/', $res[1][$i]);
                        $this->search  .= "'".$this->tokens[$i]."' ";
                    }
                }
                //------ Elargir la recherche sur des expressions similaires à la requête ------//
                $expression = array();
                $k          = 0;
                for ($i = 0; $i < count($this->tokens); $i++) {
                    $expression[$k] = '';
                    for ($j = 0; $j < count($this->tokens) - $i; $j++) {
                        $expression[$k] .= ' '.$this->tokens[$j];
                    }
                    $expression[$k] = trim($expression[$k]);
                    $k++;
                }
                for ($i = 1; $i < count($this->tokens); $i++) {
                    $expression[$k] = $this->tokens[$i];
                    $k++;
                }
                for ($i = count($this->tokens) - 2; $i > 0; $i--) {
                    $expression[$k] = '';
                    for ($j = count($this->tokens) - 1; $j >= $i; $j--) {
                        $expression[$k] = $this->tokens[$j].' '.$expression[$k];
                    }
                    $expression[$k] = trim($expression[$k]);
                    $k++;
                }
                unset($k);
                $this->tokens = array_unique($this->tokens);
                $expression   = array_unique($expression);
                //---------------- Vire tous les termes inutiles (non exhaustif) ---------------//
                $exclus = $lng == $lang[0] ? $exclure0 : $exclure1;
                if (!empty($exclus)) {
                    $exclure = explode(',', $exclus);
                    for ($i = 0; $i < count($exclure); $i++) {
                        $exclure[$i] = trim($exclure[$i]);
                        if ($exclure[$i] == '') {
                            array_splice($exclure, $i);
                            $i--;
                        }
                    }
                    array_unique($exclure);
                }
                $ignore = array();
                $j      = 0;
                for ($i = 0; $i < count($this->tokens); $i++) {
                    if (in_array($this->tokens[$i], $exclure)) {
                        if (!in_array($this->tokens[$i], $ignore)) {
                            $ignore[$j] = $this->tokens[$i];
                            $j++;
                        }
                        array_splice($this->tokens, $i, 1);
                        $i--;
                    }
                    if (strpos($this->tokens[$i], "'") == 1) $this->tokens[$i] = substr(strrchr($this->tokens[$i], "'"), 1);
                }
                unset($j);
                if (!empty($this->tokens)) {
                    for ($i = 0; $i < count($expression); $i++) {
                        if (in_array($expression[$i], $exclure)) {
                            array_splice($expression, $i, 1);
                            $i--;
                        }
                        if (strpos($expression[$i], "'") == 1) $expression[$i] = substr(strrchr($expression[$i], "'"), 1);
                    }
                    if ($this->tokens[0] != $expression[0]) {
                        for ($i=count($this->tokens); $i>0; $i--) {
                            $this->tokens[$i] = $this->tokens[$i-1];
                        }
                        $this->tokens[0] = $expression[0];
                    }
                } 
                else $expression = $this->tokens;
                $this->search = trim($this->search);	
				$dbwork = array();
				$dbw1 = array();								
                if (!empty($this->searchin)) {
					if (isset($rech_archive)) $rech_archive = TYP_ARCH;
                    if ($this->searchin == TYP_ARCH && $rech_archive == TYP_ARCH) {
                        $dbw1 = SelectDBFieldsByStatus(ReadDBFields(DOCIDARCH), 'a');
                        for ($i = 0; $i < count($dbw1); $i++)
						{
							$typnonrech = false;
							if ($rech_article == $dbw1[$i][0]) 	$typnonrech = true;
							if ($rech_download == $dbw1[$i][0])	$typnonrech = true;
							if ($rech_faq == $dbw1[$i][0]) 		$typnonrech = true;
							if ($rech_livreor == $dbww1[$i][0])   $typnonrech = true;
							if ($rech_liens == $dbw1[$i][0])     $typnonrech = true;
							if ($rech_news == $dbw1[$i][0])      $typnonrech = true;
							if ($rech_blog == $dbw1[$i][0])      $typnonrech = true;
							if ($rech_photo == $dbw1[$i][0])     $typnonrech = true;
							if ($rech_agenda == $dbw1[$i][0])    $typnonrech = true;
							if ($rech_forum == $dbw1[$i][0])      $typnonrech = true;
							if ($typnonrech)
							{
								$dbw1[$i][4] = 'i';
								$dbwork[] = $dbw1[$i];
							}
						}

                    } else {
						if (!isset($rech_article)) $rech_article = TYP_ART;
						if (!isset($rech_download)) $rech_download = TYP_DNLOAD;
						if (!isset($rech_faq)) $rech_faq = TYP_FAQ;
						if (!isset($rech_livreor)) $rech_livreor = TYP_GUESTBK;
						if (!isset($rech_liens)) $rech_liens = TYP_LINK;
						if (!isset($rech_news)) $rech_news = TYP_NEWS;
						if (!isset($rech_blog)) $rech_blog = TYP_BLOG;
						if (!isset($rech_photo)) $rech_photo = TYP_PHOTO;
						if (!isset($rech_agenda)) $rech_agenda = TYP_AGENDA;
						if (!isset($rech_forum)) $rech_forum = TYP_FORUM;						
							$dbwork = SelectDBFields($this->searchin, 'a', '');
							for ($i = 0; $i < count($dbwork); $i++)
							{
								$typnonrech = false;
								if (isset($dbwork[$i][0]))
								{
									if ($rech_article == $dbwork[$i][0]) 	$typnonrech = true;
									if ($rech_download == $dbwork[$i][0])	$typnonrech = true;
									if ($rech_faq == $dbwork[$i][0]) 		$typnonrech = true;
									if ($rech_livreor == $dbwork[$i][0])   $typnonrech = true;
									if ($rech_liens == $dbwork[$i][0])     $typnonrech = true;
									if ($rech_news == $dbwork[$i][0])      $typnonrech = true;
									if ($rech_blog == $dbwork[$i][0])      $typnonrech = true;
									if ($rech_photo == $dbwork[$i][0])     $typnonrech = true;
									if ($rech_agenda == $dbwork[$i][0])    $typnonrech = true;
									if ($rech_forum == $dbwork[$i][0])      $typnonrech = true;
									if ($typnonrech)
									{
										$dbwork[$i][4] = 'a';
										$dbw1[] = $dbwork[$i];
									}
								}
						}
                    }
                } 
				else 
				{
						if (!isset($rech_article)) $rech_article = TYP_ART;
						if (!isset($rech_download)) $rech_download = TYP_DNLOAD;
						if (!isset($rech_faq)) $rech_faq = TYP_FAQ;
						if (!isset($rech_livreor)) $rech_livreor = TYP_GUESTBK;
						if (!isset($rech_liens)) $rech_liens = TYP_LINKS;
						if (!isset($rech_news)) $rech_news = TYP_NEWS;
						if (!isset($rech_blog)) $rech_blog = TYP_BLOG;
						if (!isset($rech_photo)) $rech_photo = TYP_PHOTO;
						if (!isset($rech_agenda)) $rech_agenda = TYP_AGENDA;
						if (!isset($rech_forum)) $rech_forum = TYP_FORUM;							
						$dbw = SelectDBFieldsByStatus(ReadDBFields(DOCID), 'a');
						$dbw1 = $dbw2 =array();
						for ($i = 0; $i < count($dbw); $i++) 
						{
							$typnonrech = false;
						if ($rech_article == $dbw[$i][0]) 	$typnonrech = true;
							if ($rech_download == $dbw[$i][0] )	$typnonrech = true;
							if ($rech_faq == $dbw[$i][0]) 		$typnonrech = true;
							if ($rech_livreor == $dbw[$i][0])   $typnonrech = true;
							if ($rech_liens == $dbw[$i][0])     $typnonrech = true;
							if ($rech_news == $dbw[$i][0])      $typnonrech = true;
							if ($rech_blog == $dbw[$i][0])      $typnonrech = true;
							if ($rech_photo == $dbw[$i][0])     $typnonrech = true;
							if ($rech_agenda == $dbw[$i][0])    $typnonrech = true;
							if ($rech_forum == $dbw[$i][0])      $typnonrech = true;
							if ($typnonrech)
							{
								$dbw[$i][4] = 'a';
								$dbw1[] = $dbw[$i];
							}
						}	
						if (isset($rech_archive)) $rech_archive = TYP_ARCH;
						$dbw = array();
						if ($rech_archive != '')
						{
							$dbw = SelectDBFieldsByStatus(ReadDBFields(DOCIDARCH), 'a');
							for ($i = 0; $i < count($dbw); $i++) 
							{
								$typnonrech = false;
								if ($rech_article == $dbw[$i][0]) 	$typnonrech = true;
								if ($rech_download == $dbw[$i][0])	$typnonrech = true;
								if ($rech_faq == $dbw[$i][0]) 		$typnonrech = true;
								if ($rech_livreor == $dbw[$i][0])   $typnonrech = true;
								if ($rech_liens == $dbw[$i][0])     $typnonrech = true;
								if ($rech_news == $dbw[$i][0])      $typnonrech = true;
								if ($rech_blog == $dbw[$i][0])      $typnonrech = true;
								if ($rech_photo == $dbw[$i][0])     $typnonrech = true;
								if ($rech_agenda == $dbw[$i][0])    $typnonrech = true;
								if ($rech_forum == $dbw[$i][0])      $typnonrech = true;
								if ($typnonrech)
								{
									$dbw[$i][4] = 'i';
									$dbw2[] = $dbw[$i];									
								}
							}	
						}
                    $dbwork = array_merge($dbw1, $dbw2);
                }
                @rsort($dbwork);

                $type_unilingue = array(TYP_GUESTBK, TYP_REACT, TYP_REBLOG, TYP_FORUM);
                $searchlng0     = (empty($this->searchlng) || $this->searchlng == $lang[0]);
                $searchlng1     = (empty($this->searchlng) || $this->searchlng == $lang[1]);

                $j = 0;
                foreach ($dbwork as $dbw) {
					if (isset($dbw[4]))
					{
						if ($dbw[4] == 'a')
							ReadDoc($dbw[1]);
						else
							ReadDoc($dbw[1], ARCHDBBASE);	
						if ($type == TYP_FORUM) {
							$frcat = explode(',', $fieldb2);
							if (!empty($frcat[1]) && !isAccessGranted($frcat[1])) {
								continue;
							}
						} else {
							if (!isAccessGranted($fieldmod) || !isAuthorizedPublication($creadate)) {
								continue;
							}
						}
						if ((empty($type)) || (!in_array($type, $searchfor))) continue;
						$unilingue = in_array($type, $type_unilingue);
						if ($searchlng0 || $unilingue) {
							//----- Variable $occurrence qui stocke les résultats attribuée à $found[5] ----//
							$txt        = strip_tags(strtolower($author.' '.$fielda1.' '.$fieldb1.' '.$fieldc1));
							$occurrence = $this->Rechercher($expression, $txt);
							$note       = $occurrence['stat'][0];
							if ($note > 0) {
								$found[0][$j] = $note;
								$found[1][$j] = (empty($moddate) ? $creadate : $moddate);
								$found[2][$j] = ($unilingue ? 0 : 1);
								$found[3][$j] = $type;
								$found[4][$j] = $dbw[1];
								$found[5][$j] = $occurrence;
								$found[6][$j] = $dbw[4];
								$j++;
							}
						}
						if ($searchlng1 && $type != TYP_FORUM) {
							$txt        = strip_tags(strtolower($author.' '.$fielda2.' '.$fieldb2.' '.$fieldc2));
							$occurrence = $this->Rechercher($expression, $txt);
							$note       = $occurrence['stat'][0];
							if ($note > 0) {
								$found[0][$j] = $note;
								$found[1][$j] = (empty($moddate) ? $creadate : $moddate);
								$found[2][$j] = 2;
								$found[3][$j] = $type;
								$found[4][$j] = $dbw[1];
								$found[5][$j] = $occurrence;
								$found[6][$j] = $dbw[4];
								$j++;
							}
						}
					}
					
                }
                unset($dbwork);
                if (count($found) > 0) {
                    array_multisort($found[0], SORT_DESC, SORT_NUMERIC, $found[1], SORT_DESC, $found[2], SORT_ASC, $found[3], $found[4], $found[5], $found[6]);
						if (empty($this->searchin) && $rech_forum != '') {
							$cattitle = array();
							$catwork  = ReadDBFields(DBFORUMCAT);
							for ($i = 0; $i < count($catwork); $i++){
								$cattitle[$catwork[$i][0]][1] = $catwork[$i][1];
								$cattitle[$catwork[$i][0]][2] = $catwork[$i][2];
							}
							unset($catwork);
							$fridthd = array();
							$frtitle = array();
							$fridcat = array();
							$frwork = ReadDBFields(DBFORUM);
							for ($i = 0; $i < count($frwork); $i++) {
								$fridthd[$frwork[$i][1]] = $frwork[$i][2];
								$frtitle[$frwork[$i][1]] = $frwork[$i][5];
								$fridcat[$frwork[$i][1]] = $frwork[$i][12];
							}
							unset($frwork);
						}
                }
            }
        }
        //------------ Caractères à remplacer dans str_word_count ----------------------//
        $accent     = array("à", "â", "é", "è", "ê", "ë", "î", "ï", "ô", "ù");
        $sansaccent = array("a", "a", "e", "e", "e", "e", "i", "i", "o", "u");
        //------------------------------------------------------------------------------//
        if (empty($found)) {
            $out .= '
        <p class="text-center"><strong>'.$web[62].'</strong></p>';
            return array('SCH', $out);
        }
		if (!isset($id)) $id = 1;
		if (!is_numeric($id)) $id = 1;								
        if (empty($id)) $id = 1;
        if (count($found[0]) != 0) {
            if (count($found[0]) == 1) $out .= '
        <p class="text-center"><strong>1</strong> '.$web[60].' <strong>'.stripslashes($this->search).'</strong></p>';
            else $out .= '
        <p class="text-center"><strong>'.count($found[0]).'</strong> '.$web[61].' <strong>'.stripslashes($this->search).'</strong></p><hr /> ';
            //--------------------------- Affiche les mots ignorés -------------------------//
            if (!empty($ignore)) {
                $out .= '<div class="text-center m-auto">( ';
                if (count($ignore) == 1) $out .= ($web[569].'<b>'.$ignore[0].'</b>'.$web[570].$web[573]);
                else {
                    $out .= ($web[571]);
                    for ($i = 0; $i < count($ignore); $i++) {
                        $out .= ('<b>'.$ignore[$i].'</b>, ');
                    }
                    $out .=($web[572].$web[573]);    
                }
                $out .= ')</div>';
            }
            //------------------------------------------------------------------------------//
            if ($pertinencemin > 0) $out .= '<div class="text-center m-auto fontXsmall">'.$web[574].'</div>';
            $out .= '<br /><br />';
            $maxresult   = count($found[0]) - ($nbresult * ($id - 1)) > $nbresult ? $nbresult : count($found[0]) - ($nbresult*($id-1));
            $imgprtsearc = '<i class="fas fa-print c-pointer" title="'.$web[22].'"></i> '.$web[22].' ';
            $imgdnlsearc = '<i class="fas fa-database c-pointer" title="'.$web[362].'"></i> '.$web[362].' ';
            $ilng        = ($lng != $lang[1] ? 0 : 1);
            //---- Modification de l'affichage des barres de résultat qui tient compte: ----//
            //---- de l'absence de résultat sur un terme de la requête ---------------------//
            //---- de la présence de l'expression exacte dans les résultats ----------------//
            $notemax = $found[0][0];
            $first   = $found[5][0];
            for ($i = 1; $i < count($first['mot']); $i++) {
                if ($first['nb'][$i] == 0) 
                    $notemax += $found[0][0] * (count($first['mot']) - $i) / count($first['mot']);
            }
            if ($first['nb'][0] > 0) {
                $coef    = 1 + 2 / 10;
                $notemax = $notemax * $coef;
            }
            //------------------------------------------------------------------------------//
            $stop          = false;
            $nbresultshown = 0;
            $prive         = 0; /// modif accès privé
            for ($i = $nbresult*($id-1); $i < Min($nbresult*$id, count($found[0])); $i++) {
                if (!$stop) {
                    if ($found[6][$i] == 'a') ReadDoc($found[4][$i]);
                    else ReadDoc($found[4][$i], ARCHDBBASE);
                    $acces  = isAccessGranted($fieldmod) && isAuthorizedPublication($creadate);
                    $doctit = '';
                    $doclnk = '';
                    $doctxt = '';
                    $docinv = '';
                    switch ($found[2][$i]) {
                    case 0 :
                        $doclang = 'lang';
                        switch ($found[3][$i]) {
                        case TYP_GUESTBK :
                            $doctit = '<strong>'.getLabel($nom[9 + 10 * $ilng]).' :</strong> '.$web[39].' <strong>
                              '.$fielda1.'</strong> - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($creadate);
                            $doclnk = $site['URLR'] == 'on' ? $lng.'-'.$urlrw[7].'-3-'.$fileid.$z2 : $site['GB'].'.php?lng='.$lng.'&amp;pg='.$fileid.$z2;
                            break;
                        case TYP_REACT :
                            $doctit0 = '<strong>'.$web[187].' :</strong> ';
                            $doctit2 = $web[185].$fielda1.' - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($creadate);
                            $doclnk  = $site['URLR'] == 'on' 
                              ? $lng.'-'.$urlrw[20].'-101-'.$fielda2.'-'.$fileid.$z2 
                              : 'articles.php?lng='.$lng.'&amp;pg='.$fielda2.'&amp;react='.$fileid.$z2;
                            ReadDoc($fielda2);
                            $acces   = isAccessGranted($fieldmod) && isAuthorizedPublication($creadate);
                            $doctit1 = ($lng == $lang[0] ? $fieldb1 : $fieldb2);
                            $doctit  = $doctit0.' <strong>'.$doctit1.' :</strong> '.$doctit2;
                            break;
                        case TYP_REBLOG :
                            $doctit0 = '<strong>'.$web[381].' - '.$web[379].' :</strong> ';
                            $doctit2 = $web[185].$fielda1.' - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($creadate);
                            if ($found[6][$i] == 'a') {
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lng.'-'.$urlrw[1].'-47-'.$fielda2.'-'.$fileid.$z2 
                                  : $site['BL'].'.php?lng='.$lng.'&amp;pg='.$fielda2.'&amp;react='.$fileid.$z2;
                                ReadDoc($fielda2);
                            } 
                            else {
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lng.'-'.$urlrw[1].'-48-'.$fielda2.'-'.$fileid.$z2 
                                  : 'blogarch.php?lng='.$lng.'&amp;pg='.$fielda2.'&amp;react='.$fileid.$z2;
                                ReadDoc($fielda2, ARCHDBBASE);
                            }
                            $acces   = isAccessGranted($fieldmod) && isAuthorizedPublication($creadate);
                            $doctit1 = ($lng == $lang[0] ? $fieldb1 : $fieldb2);
                            $doctit  = $doctit0.' <strong>'.$doctit1.' :</strong> '.$doctit2;
                            break;
                        case TYP_FORUM :
                            $frcat  = explode(',', $fieldb2);
                            $acces  = isForumAccessGranted($frcat[0]);
                            $doctit = '<strong>'.getLabel($nom[22 + $ilng]).'</strong>';
                            if (!empty($fridcat[$fielda1]) && !empty($cattitle[$fridcat[$fielda1]][1 + $ilng])) {
                                $doctit .= ' : <strong>'.$cattitle[$fridcat[$fielda1]][1 + $ilng].'</strong>';
                            }
                            if (!empty($fieldb1)) {
                                $doctit .= ' : '.$web[63].' '.$fielda1.' <strong>'.$fieldb1.'</strong>';
                                if ($found[6][$i] == 'a') {
                                    $thrdid = GetThreadId($fielda1);
                                    $doclnk = $site['URLR'] == 'on' 
                                      ? $lng.'-'.$urlrw[5].'-4-'.$thrdid.'-'.(empty($fridcat[$fielda1]) ? 0 : $fridcat[$fielda1]).$z2 
                                      : $site['TH'].'.php?lng='.$lng.'&amp;pg='.$thrdid.
                                      GetOptionnalArg('cat', (empty($fridcat[$fielda1]) ? 0 : $fridcat[$fielda1])).$z2;
                                } 
                                else {
                                    $thrdid = GetThreadId($fielda1, DBTHREADARCH);
                                    $doclnk = $site['URLR'] == 'on' 
                                      ? $lng.'-'.$urlrw[5].'-42-'.$thrdid.'-'.(empty($fridcat[$fielda1]) ? 0 
                                      : $fridcat[$fielda1]).$z2 : 'threadarch.php?lng='.$lng.'&amp;pg='.$thrdid.
                                      GetOptionnalArg('cat', (empty($fridcat[$fielda1])? 0: $fridcat[$fielda1])).$z2;
                                }
                            } 
                            else {
                                $doctit .= ' : '.$web[63].' '.$fielda1.' <strong>
                                  '.(empty($frtitle[$fielda1]) ? '' : $frtitle[$fielda1]).'</strong> - '.$web[68].$fielda2;
                                if (empty($fridthd[$fielda1]) || empty($fridcat[$fielda1]))
                                    $doclnk = '';
                                else {
                                    if ($found[6][$i] == 'a')
                                        $doclnk = $site['URLR'] == 'on' 
                                          ? $lng.'-'.$urlrw[5].'-5-'.$fridthd[$fielda1].'-'.$fridcat[$fielda1].'-'.ceil($fielda2/$serviz[20]).'#R'.$fielda2 
                                          : $site['TH'].'.php?lng='.$lng.'&amp;pg='.$fridthd[$fielda1].
                                          GetOptionnalArg('cat', $fridcat[$fielda1]).GetOptionnalArg('id', ceil($fielda2/$serviz[20])).'#R'.$fielda2;
                                    else
                                        $doclnk = $site['URLR'] == 'on' 
                                          ? $lng.'-'.$urlrw[5].'-52-'.$fridthd[$fielda1].'-'.$fridcat[$fielda1].'-'.ceil($fielda2/$serviz[20]).'#R'.$fielda2 
                                          : 'threadarch.php?lng='.$lng.'&amp;pg='.$fridthd[$fielda1].
                                          GetOptionnalArg('cat', $fridcat[$fielda1]).GetOptionnalArg('id', ceil($fielda2/$serviz[20])).'#R'.$fielda2;
                                }
                            }
                            $doctit .= ' - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($creadate);
                            break;
                        }
                        $doctxt = WrapLongWords(CutLongWord(strip_tags($fieldc1), $longword));
                        $doctxtlong = $fieldc1;
                        break;
                    case 1 :
                        $doclang = $lang[0];
                        switch ($found[3][$i]) {
                        case TYP_ART :
                            if (substr($fieldd1, 0, 3) == 'MNU') {
                                $mnuid    = intval(substr($fieldd1, 4));
                                $mnutitle = $this->GetTitleMenuBox($mnuid);
                                $doctit   = '<strong>'.$mnutitle.' :</strong> ';
                            } 
                            else $doctit = '<strong>'.$fileid.' :</strong> ';
                            if (!empty($doctit)) {
                                $doctit .= ' <strong>'.$fielda1.'</strong> - ';
                                $doctit .= '<strong>'.$fieldb1.'</strong>';
                                $doclnk  = $site['URLR'] == 'on' 
                                  ? $lang[0].'-'.$urlrw[20].'-100-'.$fileid.$z2 
                                  : 'articles.php?lng='.$lang[0].'&amp;pg='.$fileid.$z2;
                                $docinv  = '<a href="'.($site['URLR'] == 'on' 
                                  ? $lang[0].'-'.$urlrw[20].'-1001-'.$fileid.'-1' 
                                  : 'articles.php?lng='.$lang[0].'&amp;pg='.$fileid.'&amp;prt=1').'" target="_blank">'.$imgprtsearc.'</a>';
                            }
                            break;
                        case TYP_DNLOAD :
                            $doctit = '<strong>'.getLabel($nom[1]).' :</strong> '.$fieldb1;
                            $doctit .= ' - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($moddate);
                            $doclnk = $site['URLR'] == 'on' 
                              ? $lang[0].'-'.$urlrw[11].'-4-'.$fileid.$z2 
                              : $site['DN'].'.php?lng='.$lang[0].'&amp;pg='.$fileid.$z2;
                            $docinv = '<a href="javascript:PopupWindow(\''.($site['URLR'] == 'on' ? 
                              $lang[0].'-'.$urlrw[11].'-6-'.$fileid : 'dwnld.php?lng='.$lang[0].'&amp;pg='.$fileid)
                              .'\',\'dnload\',400,265,\'no\',\'no\')">'.$imgdnlsearc.'</a>';
                            break;
                        case TYP_LINKS :
                            $doctit = '<strong>'.getLabel($nom[3]).' :</strong> '.$fieldb1;
                            $doclnk = $site['URLR'] == 'on' ? $lang[0].'-'.$urlrw[6].'-1-'.$fileid.$z2 : 'links.php?lng='.$lang[0].'&amp;pg='.$fileid.$z2;
                            break;
                        case TYP_NEWS :
                            $doctit  = '<strong>'.getLabel($nom[7]).' :</strong> <strong>'.$fieldb1.'</strong>';
                            $doctit .= ' - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($moddate);
                            if ($found[6][$i] == 'a')
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[0].'-'.$urlrw[8].'-2-'.$fileid.$z2 
                                  : $site['NE'].'.php?lng='.$lang[0].'&amp;pg='.$fileid.$z2;
                            else
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[0].'-'.$urlrw[8].'-262-'.$fileid.$z2 
                                  : 'newsarch.php?lng='.$lang[0].'&amp;pg='.$fileid.$z2;
                            break;
                        case TYP_BLOG :
                            $doctit  = '<strong>'.getLabel($nom[42]).' :</strong> <strong>'.$fieldb1.'</strong>';
                            $doctit .= ' - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($moddate);
                            if ($found[6][$i] == 'a')
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[0].'-'.$urlrw[1].'-4-'.$fileid.$z2 
                                  : $site['BL'].'.php?lng='.$lang[0].'&amp;pg='.$fileid.$z2;
                            else
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[0].'-'.$urlrw[1].'-42-'.$fileid.$z2 
                                  : 'blogarch.php?lng='.$lang[0].'&amp;pg='.$fileid.$z2;
                            break;
                        case TYP_FREEBOX :
                            $doctit = '<strong>'.$fieldb1.'</strong>';
                            $doctit .= ' - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($moddate);
                            $doclnk = $site['URLR'] == 'on' ? $lang[0].'-'.$urlrw[0].$z2 : 'index.php?lng='.$lang[0].$z2;
                            break;
                        case TYP_FAQ :
                            $doctit = '<strong>'.getLabel($nom[24]).' :</strong> '.$fieldb1;
                            $doclnk = $site['URLR'] == 'on' 
                              ? $lang[0].'-'.$urlrw[4].'-3-'.$fileid.$z2 
                              : 'faq.php?lng='.$lang[0].'&amp;pg='.$fileid.$z2;
                            $docinv = '<a href="'.($site['URLR'] == 'on' 
                              ? $lang[0].'-'.$urlrw[4].'-4-'.$fileid.'-1' 
                              : 'faq.php?lng='.$lang[0].'&amp;pg='.$fileid.'&amp;prt=1').'" target="_blank">'.$imgprtsearc.'</a>';
                            break;
                        case TYP_PHOTO :
                            $doctit = '<strong>'.getLabel($nom[2]).' :</strong> '.$fieldb1;
                            $doclnk = $site['URLR'] == 'on' 
                              ? $lang[0].'-'.$urlrw[9].'-4-'.$fileid.$z2 
                              : 'photorama.php?lng='.$lang[0].'&amp;pg='.$fileid.$z2;
                            break;
                        case TYP_AGENDA :
                            $doctit = $web[287].' '.$fieldb1;
                            if ($found[6][$i] == 'a')
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[0].'-'.$urlrw[17].'-2-'.$fileid.'-'.$fileid.'-1'.$z2 
                                  : 'agenda.php?lng='.$lang[0].'&amp;idpg='.$fileid.'-&amp;pg='.$fileid.'&agv=1'.$z2;
                            else
                                $doclnk = "";
                            break;
                        }
                        $doctxt = WrapLongWords(CutLongWord(strip_tags($fieldc1), $longword));
                        $doctxtlong = $fieldc1;
                        break;
                    case 2 :
                        $doclang = $lang[1];
                        switch ($found[3][$i]) {
                        case TYP_ART :
                            if (substr($fieldd1, 0, 3) == 'MNU') {
                                $mnuid    = intval(substr($fieldd1, 4));
                                $mnutitle = $this->GetTitleMenuBox($mnuid);
                                $doctit   = '<strong>'.$mnutitle.' :</strong> ';
                            } 
                            else $doctit = '<strong>'.$fileid.' :</strong> ';

                            if (!empty($doctit)) {
                                $doctit .= ' <strong>'.$fielda2.'</strong> - ';
                                $doctit .= '<strong>'.$fieldb2.'</strong>';
                                $doclnk  =  $site['URLR'] == 'on' 
                                  ? $lang[1].'-'.$urlrw[20].'-100-'.$fileid.$z2 
                                  : 'articles.php?lng='.$lang[1].'&amp;pg='.$fileid.$z2;
                                $docinv  = '<a href="'.($site['URLR'] == 'on' 
                                  ? $lang[1].'-'.$urlrw[20].'-1001-'.$fileid.'-1' 
                                  : 'articles.php?lng='.$lang[1].'&amp;pg='.$fileid.'&amp;prt=1').'" target="_blank">'.$imgprtsearc.'</a>';
                            }
                            break;
                        case TYP_DNLOAD :
                            $doctit = '<strong>'.getLabel($nom[11]).' :</strong> '.$fieldb2;
                            $doctit .= ' - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($moddate);
                            $doclnk = $site['URLR'] == 'on' 
                              ? $lang[1].'-'.$urlrw[11].'-4-'.$fileid.$z2 
                              : $site['DN'].'.php?lng='.$lang[1].'&amp;pg='.$fileid.$z2;
                            $docinv = '<a href="javascript:PopupWindow(\''.($site['URLR'] == 'on' 
                              ? $lang[1].'-'.$urlrw[11].'-6-'.$fileid : 'dwnld.php?lng='.$lang[1].'&amp;pg='.$fileid)
                              .'\', \'dnload\', 400, 265, \'no\', \'no\')">'.$imgdnlsearc.'</a>';
                            break;
                        case TYP_LINKS :
                            $doctit = '<strong>'.getLabel($nom[13]).' :</strong> '.$fieldb2;
                            $doclnk = $site['URLR'] == 'on' 
                              ? $lang[1].'-'.$urlrw[6].'-1-'.$fileid.$z2 
                              : 'links.php?lng='.$lang[1].'&amp;pg='.$fileid.$z2;
                            break;
                        case TYP_BLOG :
                            $doctit = '<strong>'.getLabel($nom[42]).' :</strong> <strong>'.$fieldb2.'</strong>';
                            if ($found[6][$i] == 'a')
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[1].'-'.$urlrw[1].'-4-'.$fileid.$z2 
                                  : $site['BL'].'.php?lng='.$lang[1].'&amp;pg='.$fileid.$z2;
                            else
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[1].'-'.$urlrw[1].'-42-'.$fileid.$z2 
                                  : 'blogarch.php?lng='.$lang[1].'&amp;pg='.$fileid.$z2;
                            break;
                        case TYP_NEWS :
                            $doctit = '<strong>'.getLabel($nom[17]).': </strong> <strong>'.$fieldb2.
                              '</strong> - '.$web[6].' '.$author.' '.$web[7].' '.FormatDate($moddate);
                            if ($found[6][$i] == 'a')
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[1].'-'.$urlrw[8].'-2-'.$fileid.$z2 
                                  : $site['NE'].'.php?lng='.$lang[1].'&amp;pg='.$fileid.$z2;
                            else
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[1].'-'.$urlrw[8].'-262-'.$fileid.$z2 
                                  : 'newsarch.php?lng='.$lang[1].'&amp;pg='.$fileid.$z2;
                            break;
                        case TYP_FREEBOX :
                            $doctit = '<strong>'.$fieldb2.'</strong>';
                            $doclnk = $site['URLR'] == 'on' ? $lang[1].'-'.$urlrw[0].$z2 : 'index.php?lng='.$lang[1].$z2;
                            break;
                        case TYP_FAQ :
                            $doctit = '<strong>'.getLabel($nom[25]).' :</strong> '.$fieldb2;
                            $doclnk = $site['URLR'] == 'on' 
                              ? $lang[1].'-'.$urlrw[4].'-3-'.$fileid.$z2 
                              : 'faq.php?lng='.$lang[1].'&amp;pg='.$fileid.$z2;
                            $docinv = '<a href="'.($site['URLR'] == 'on' 
                              ? $lang[1].'-'.$urlrw[4].'-4-'.$fileid.'-1' 
                              : 'faq.php?lng='.$lang[1].'&amp;pg='.$fileid.'&amp;prt=1').'" target="_blank">'.$imgprtsearc.'</a>';
                            break;
                        case TYP_PHOTO :
                            $doctit = '<strong>'.getLabel($nom[12]).' :</strong> '.$fieldb2;
                            $doclnk = $site['URLR'] == 'on' 
                              ? $lang[1].'-'.$urlrw[9].'-4-'.$fileid.$z2 
                              : 'photorama.php?lng='.$lang[1].'&amp;pg='.$fileid.$z2;
                            break;
                        case TYP_AGENDA :
                            $doctit = $web[287].' '.$fieldb2;
                            if ($found[6][$i] == 'a')
                                $doclnk = $site['URLR'] == 'on' 
                                  ? $lang[1].'-'.$urlrw[17].'-22-'.$fileid.'-'.$fileid.'-1-'.$this->tconfig.$z2 
                                  : 'agenda.php?lng='.$lang[1].'&amp;idpg='.$fileid.'-&amp;pg='.$fileid.'&agv=1&amp;tconfig='.$this->tconfig.$z2;
                            else
                                $doclnk = "";
                            break;
                        }
                        $doctxt     = WrapLongWords(CutLongWord(strip_tags($fieldc2), $longword));
                        $doctxtlong = $fieldc2;
                        break;
                    }
                    for ($j=0; $j<count($this->tokens); $j++) {
                        $doctxt = preg_replace('/('.$this->tokens[$j].')/i', '<strong>\\1</strong>', $doctxt);
                    }
                    //--- Applique le style aux occurrences en excluant celles dans les balises ----//
                    for ($j = count($this->tokens) - 1; $j >= 0; $j--) {
                        if ($styleocc[4] == 'on') $background = $bgcolor[fmod($j, count($bgcolor))].';';
                        $document = '';
                        $text = preg_split('/('.$this->tokens[$j].')/i', $doctxtlong, -1, PREG_SPLIT_OFFSET_CAPTURE);
                        if ($text[0][1] != 0) $document .= substr($doctxtlong, 0, $text[0][1] - 1);
                        for ($k = 0; $k < count($text) - 1; $k++) {
                            if (strrpos($text[$k][0], '<') > strrpos($text[$k][0], '>') || strpos($text[$k+1][0], '>') < strpos($text[$k+1][0], '<')) 
                                $document .= $text[$k][0].substr($doctxtlong, $text[$k+1][1]-strlen($this->tokens[$j]), strlen($this->tokens[$j]));
                            else 
                                $document .= $text[$k][0].$stylespan.$background.'">'.substr($doctxtlong, 
                                  $text[$k+1][1]-strlen($this->tokens[$j]), strlen($this->tokens[$j])).$endstyle;
                        }
                        $document  .= $text[count($text) - 1][0];
                        $doctxtlong = $document;
                    }
                    //------------------------------------------------------------------------------//
                    $doctit = strip_tags($doctit, '<strong>');
                    //-------- Récupération des occurrences pour chaque résultat et pondération ----//
                    //-------- Calcul de la pertinence du résultat et modification de l'affichage --//
                    $occurrence = $found[5][$i];
                    if ($occurrence['nb'][0] > 0) $found[0][$i] = $found[0][$i]*$coef;
                    if ($found[0][$i] > $notemax) $found[0][$i] = $notemax;
                    $pourcent   = ceil($found[0][$i] / $notemax * $longbarre);
                    $pertinence = ceil($pourcent / $longbarre * 100);
                    $stop       = ($pertinence < $pertinencemin) ? true : false;
                    if ($stop) break;
                    $width = $longbarre + 36;
                    if ($acces) {
                        $out .= '
<style>
.divbars { width: '.$width.'px; }
.imggreen { width: '.$pourcent.'px !important; height: 8px !important; }
.imgyellow { width: '.($longbarre - $pourcent).'px !important; height: 8px !important; margin-left: -3px; }
.imglang { padding: 2px 0 0 4px; width: 18px !important; height: 12px !important; }
</style>
  <div class="bord">
	<div class="table-responsive-md">
    <div class="d-table w-100">
	  <div class="d-table-row trheadsearch">
		<div class="d-table-cell">
		  <div class="divbars">
		    <img src="'.CHEMIN.'inc/img/bars/vert.gif" alt="" class="align-middle imggreen" />';
                        if ($pourcent < $longbarre) $out .= '
			<img src="'.CHEMIN.'inc/img/bars/jaune.gif" alt="" class="align-middle imgyellow" />';
                        $out .= '
			<i class="flg-'.$doclang.' align-middle imglang" title="'.$doclang.'"></i>
		  </div>
		</div>
		<div class="d-table-cell w-100 text-left">
          &nbsp;'.($doclnk == '' ? $doctit : '<a href="'.$doclnk.'" title="'.$web[326].'">'.$doctit.'</a>').'
        </div>
	  </div>
    </div>
    </div>
    <div class="table-responsive-md">
	<div class="d-table w-100">
	  <div class="d-table-row fontXsmall trheadsearch">
		<div class="d-table-cell w-100 text-center">&nbsp;'.$web[566].$pertinence.'% - ';
                        if (str_word_count(str_replace($accent, $sansaccent, $occurrence['mot'][0])) > 1 && $occurrence['nb'][0] > 0) {
                            $out .= $web[567].'<u><b>'.$occurrence['mot'][0].':</b></u> '.$occurrence['nb'][0].' - ';
                            $firstocc = 1;
                        } 
                        else $firstocc = 0;
                        $out  .= $web[568].' : ';
                        $tiret = false;
                        for ($j = $firstocc; $j < count($occurrence['mot']); $j++) {
                            if ($styleocc[4] == 'on') $background = $bgcolor[fmod($j, count($bgcolor))].';';
                            if ($occurrence['nb'][$j] > 0) {
                                if ($tiret) $out .= ' - ';
                                $out .= $stylespan.$background.'">'.$occurrence['mot'][$j].$endstyle.' : '.$occurrence['nb'][$j];
                                $tiret = true;
                            }
                        }
                        $out .= '
		</div>
	  </div>
    </div>
    </div>
    <div class="table-responsive-md">
    <div class="d-table w-100">
	  <div class="d-table-row text-left">
		<div class="d-table-cell tr2headsearch">
		  <div id="court'.$i.'">
			<i class="far fa-plus-square c-pointer" title="'.$web[429].'" 
              onclick="ActiveMenu(\'court\',\'long\','.$nbresult*($id-1).','.$maxresult.','.$i.')">
            </i>
			&nbsp; '.$doctxt.' ...
		  </div>
		  <div id="long'.$i.'" style="display:none;">
			<div>
			  <i class="far fa-minus-square c-pointer" title="'.$web[57].'" 
                onclick="DesactiveItem(\'court\',\'long\','.$i.')">
              </i>
			  &nbsp; '.($hideprint == 'on' ? '' : $docinv).'
			</div>';
						if (strlen($doctxtlong) > 750) $out .= '
			<div class="txthiddensearch">'.$doctxtlong.'</div>
		  </div>';
						else $out .= '
			<div>'.$doctxtlong.'</div>
		  </div>';
						$out .= '
	    </div>
      </div>
      </div>
	</div>
  </div>
	<br />';
                    } 
                    else $prive++;
                } //------------------------- fin d'affichage pour $pertinence > $pertinence min
                $nbresultshown++;
            }
        } 
        else {
            $out .= '<div class="text-center m-auto">'.$web[62].'</div><br />';
            if (!empty($this->search) && count($this->tokens) == 0) {
                $words = explode(' ', $this->search);
                if (count($words) == 1) $out .= 
                    '<div class="text-center m-auto">'.$web[569].'<b>'.$words[0].'</b>'.$web[575].'</div><br />';
                elseif (count($words) > 1) {
                    $out .= '<div class="text-center m-auto">'.$web[571];
                    for ($j = 0; $j < count($words); $j++) 
                        $out .= '<b>'.$words[$j].'</b>'.(($j == count($words) - 2) ? ' & ' : ', ');
                    $out .= $web[576].'</div><br />';
                }
            }
        }
        //------------ On récupère la requête initiale pour la page suivante... --------//
        $this->search = stripslashes($savesearch);
        //------------------------------------------------------------------------------//
        $max = 1;
        if ($pertinencemin > 0) {
            $nbresulttotshown = $nbresult * ($id - 1) + $nbresultshown;
            $nextpage         = ($nbresultshown == $nbresult && $pertinence > $pertinencemin) ? 1 : 0;
            $max              = max($max, $nbresulttotshown + $nextpage);
        }
        if ($pertinencemin > 0 && $max < count($found[0])) {
            if ($nbresulttotshown == 1) $out .= '
<div class="text-center m-auto">'.$web[559].'<div><br />';
            elseif ($nbresulttotshown > 1) $out .= '
<div class="text-center m-auto">'.$web[560].'<b>'.$nbresulttotshown.'</b>'.$web[561].'<div><br />';
            $out .= '
<div class="text-center m-auto">
  <a href="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[12].'-3-'.$this->cat.'-'.$this->search.'-'.$this->searchin.'-'.$this->searchlng.'-0-'.$max.'-'.$id.$z2 
      : 'search.php?lng='.$lng.GetOptionnalArg('cat', $this->cat).'&amp;search='.$this->search.
      '&amp;searchin='.$this->searchin.'&amp;searchlng='.$this->searchlng.'&amp;pert=0&amp;max='.$max.'&amp;id='.$id.$z2).'">
    '.(($id > 1) ? $web[563] : $web[562]).'
  </a>
</div>
<br /><br />';
        }
        if ($pertinencemin == 0) {
            $out .= 
        GetNavBar((false 
          ? $lng.'-'.$urlrw[12].'-3-'.(empty($this->cat) ? '0' : $this->cat).'-'.$this->search.'-'.(empty($this->searchin) ? '0' : $this->searchin).'-'.$this->searchlng.'-0-'.$max.'-'
          : 'search.php?lng='.$lng.GetOptionnalArg('cat', $this->cat).'&amp;search='.$this->search.
            '&amp;searchin='.$this->searchin.'&amp;searchlng='.$this->searchlng.'&amp;pert='.$pertinencemin.'&amp;max='.$max.'&amp;id='), 
          count($found[0]), $id, $nbresult, $z2).'
<br />
<div class="text-center m-auto">'.$web[564].'<br />
  <a href="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[12].'-3-'.$this->cat.'-'.$this->search.'-'.$this->searchin.'-'.$this->searchlng.'-'.$savepertinencemin.'-'.$max.'-1'.$z2 
      : 'search.php?lng='.$lng.GetOptionnalArg('cat', $this->cat).'&amp;search='.$this->search.
      '&amp;searchin='.$this->searchin.'&amp;searchlng='.$this->searchlng.'&amp;pert='.$savepertinencemin.'&amp;max='.$max.'&amp;id=1'.$z2).'">
    '.$web[565].'
  </a>
</div>
<br /><br />';          
        } 
        if ($prive > 0) $out .= '<hr />
<p class="text-center"><strong>... '.$web[446].'</strong></p>';
        if ($restricted) {
            $out .= '
<hr />
<p class="text-center">'.$web[441].'</p>';
            if ($members[19] != '0' && $members[19] != '3') $out .= '
<p class="text-center">
  <a href="'.CHEMIN.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
      : $site['USR'].'.php?lng='.$lng.'&amp;uuser=new&amp;tconfig='.$this->tconfig.$z2).'" title="'.$web[160].'">
    ['.$web[160].']
  </a>
</p>';
        }
        return array('SCH', $out);
    }
}
?>
security.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/security.inc'
View Content
<?php
/*******************************************************************************
 *   Security
 *******************************************************************************
 *   GuppY PHP Script - version 5.0
 *   CeCILL Copyright (C) 2004-2013 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V5 developed by Lud Bienaimé
 *      with the participation of Jean-Michel Misrachi and the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.20 (October 24, 2024) : Integration news functions for counter IP
 * 
 ******************************************************************************/

define('SECURITY_REP',  CHEMIN.DATAREP.'security/');
define('BAN_REP',       SECURITY_REP.'bannis/');
define('BLA_REP',       SECURITY_REP.'blacklist/');
define('BAN_CFG',       SECURITY_REP.'ban_cfg.ini');
define('BLA_CFG',       SECURITY_REP.'bla_cfg.ini');
define('BAN_DEF',       SECURITY_REP.'ban_def.ini');
define('BLA_DEF',       SECURITY_REP.'bla_def.ini');
define('BAN_REPCOUNTERS', SECURITY_REP.'counters/');

$sec_retention = array(
    0  => (isset($web) ? $web[506] : $admin[1739]),
	1  => '1'.(isset($web) ? $web[699] : $admin[1342]),
	2  => '2'.(isset($web) ? $web[507] : $admin[1157]),
	3  => '3'.(isset($web) ? $web[507] : $admin[1157]),
    4  => '4'.(isset($web) ? $web[507] : $admin[1157]),
    8  => '8'.(isset($web) ? $web[507] : $admin[1157]),
    12 => '12'.(isset($web) ? $web[507] : $admin[1157]),
    24 => '24'.(isset($web) ? $web[507] : $admin[1157]),
    52 => '52'.(isset($web) ? $web[507] : $admin[1157]),
);
$sec_active = array(
    ''   => isset($web) ? $web[508] : $admin[1737],
    'on' => isset($web) ? $web[509] : $admin[1738],
);
$sec_pathlgmessage = array(
	100 => '100'.(isset($web) ? $web[697] : $admin[1050]),
	150 => '150'.(isset($web) ? $web[697] : $admin[1050]),
	200 => '200'.(isset($web) ? $web[697] : $admin[1050]),
	350 => '350'.(isset($web) ? $web[697] : $admin[1050]),
);
$sec_querylgmessage = array(
	100 => '100'.(isset($web) ? $web[697] : $admin[1050]),
	150 => '150'.(isset($web) ? $web[697] : $admin[1050]),
	200 => '200'.(isset($web) ? $web[697] : $admin[1050]),
	350 => '350'.(isset($web) ? $web[697] : $admin[1050]),
	400 => '400'.(isset($web) ? $web[697] : $admin[1050]),
	500 => '500'.(isset($web) ? $web[697] : $admin[1050]),
	600 => '600'.(isset($web) ? $web[697] : $admin[1050]),
	700 => '700'.(isset($web) ? $web[697] : $admin[1050]),
);
$sec_seuilmaxip = array(
    100 => '100',
    150 => '150',
    200 => '200',
    250 => '250',
	300 => '300',
);

function ReadSecurityConfig($file) {
    if (is_file($file)) {
        return parse_ini_file($file);
    } else {
        $cfg = array(
            'nextid' => 1,
			'inforparmail' => '',
            'status' => '',
            'record' => '',
            'retention' => '0',
			'seuilmaxip' => '100'
            );
        WriteSecurityConfig($file, $cfg);
        return $cfg;
    }
}

function WriteSecurityConfig($file, $datas) {
    $out = '';
    foreach ($datas as $key => $value) {
        $out .= $key.'="'.addslashes(trim($value))."\"\n";
    }
    file_put_contents($file, $out);
}

function ReadSecurityDatas($file) {
    if (is_file($file)) {
$datjourl = new DateTime('now');
$dateheureminiutesecl = $datjourl->format('Y_m_d');
$nomficlog = CHEMIN.'data/log/ReadSecurityDatas'.'_'.$dateheureminiutesecl.'.log';
 //   file_put_contents($nomficlog, date('Y-m-d H:i:s').'file: '.$file."\n", FILE_APPEND | LOCK_EX);
        return parse_ini_file($file, TRUE);
    } else {
        return array();
    }
}

function WriteSecurityDatas($file, $sections) {
    $out = '';
    foreach ($sections as $section => $datas) {
        $out .= '['.$section.']'."\n";
        foreach ($datas as $key => $value) {
            $out .= $key.'="'.trim($value)."\"\n";
        }
        $out .= "\n";
    }
   file_put_contents($file, $out);
}
function SelectBANReadSecurityDatas($ip, $nomhost) {
	$datjourl = new DateTime('now');
$dateheureminiutesecl = $datjourl->format('Y_m_d');
$nomficlog = CHEMIN.'data/log/SelectBANReadSecurityDatas'.'_'.$dateheureminiutesecl.'.log';
//   file_put_contents($nomficlog, date('Y-m-d H:i:s').'recherpath: '.$path."\n", FILE_APPEND | LOCK_EX);
	$defs = ReadSecurityDatas(BAN_DEF);
	$rechdeftrouve = '';
	foreach ($defs as $id => $def) {
		if (empty($def['status'])) continue;

		if ($def['ip'] != '' && $def['ip'] == $ip)
			$rechdeftrouve = $def['ip'];
		else
		{
			if ($def['host'] != '' && $def['host'] == $nomhost)
			$rechdeftrouve = $def['host'];
		}
		
	}
	return $rechdeftrouve;
}
function Select5BANReadSecurityDatas($nomhost) { // rech Host
// file_put_contents($nomficlog, date('Y-m-d H:i:s').'nomhost: '.$path."\n", FILE_APPEND | LOCK_EX);
	$defs = ReadSecurityDatas(BAN_DEF);
	$rechdeftrouve = '';
	$rejet1 = '';
	
/*	if (!filter_var($nomhost, FILTER_VALIDATE_IP)) // IP????
		$nomhostlimit   = substr($nomhost, 0, 9);
*/
	foreach ($defs as $id => $def) {
		if (empty($def['status'])) continue;
		if (!$rechdeftrouve)
		{				
			if ($def['host'] != '')
			{
				$nomhosts = explode(',', $def['host']);
				$nbrehosts = count($nomhosts);		
				for ($ijnbrehost = 0; $ijnbrehost < $nbrehosts; $ijnbrehost++)
				{
					if ($rechdeftrouve == '')
					{
						$rejet1 = substr_count($nomhost, $nomhosts[$ijnbrehost]);
						if ($rejet1 != 0) 
							{
								$rechdeftrouve = $nomhosts[$ijnbrehost];
							}
					}		
				}
			}
		}
		
	}
	return $rechdeftrouve;
}
function Select6BANReadSecurityDatas($path) {  //rech path
$datjourl = new DateTime('now');
$dateheureminiutesecl = $datjourl->format('Y_m_d');
$nomficlog = CHEMIN.'data/log/Select6BANReadSecurityDatas'.'_'.$dateheureminiutesecl.'.log';
// file_put_contents($nomficlog, date('Y-m-d H:i:s').'recherpath: '.$path."\n", FILE_APPEND | LOCK_EX);
	$defs = ReadSecurityDatas(BAN_DEF);
	$rechdeftrouve = '';
	$rejet = false;

	foreach ($defs as $id => $def) {
		if (empty($def['status'])) continue;
		if ($rechdeftrouve == '')
		{				
			if ($def['path'] != '')
			{
				$paths = explode(',', $def['path']);
				
				$nbrepaths = count($paths);		
				for ($ijnbrepath = 0; $ijnbrepath < $nbrepaths; $ijnbrepath++)
				{
					if ($rechdeftrouve == '')
					{	
						$rejet1 = substr_count($path, $paths[$ijnbrepath]);
//						file_put_contents($nomficlog, date('Y-m-d H:i:s').'rech path rejet1: '.$rejet1. "\n", FILE_APPEND | LOCK_EX);
						if ($rejet1 != 0) 
							{
								$rechdeftrouve = $paths[$ijnbrepath];
//								file_put_contents($nomficlog, date('Y-m-d H:i:s').'path rechdeftrouve: '.$rechdeftrouve. "\n", FILE_APPEND | LOCK_EX);
							}
					}		
				}
			}
		}
		
	}
	return $rechdeftrouve;
}
function Select7BANReadSecurityDatas($mot) {    // rech Mots
$datjourl = new DateTime('now');
$dateheureminiutesecl = $datjourl->format('Y_m_d');
$nomficlog = CHEMIN.'data/log/Select7BANReadSecurityDatas'.'_'.$dateheureminiutesecl.'.log';
//	file_put_contents($nomficlog, date('Y-m-d H:i:s').'rechermot: '.$mots."\n", FILE_APPEND | LOCK_EX);
	$defs = ReadSecurityDatas(BAN_DEF);
	$rechdeftrouve = '';

	foreach ($defs as $id => $def) {
		if (empty($def['status'])) continue;
		if ($rechdeftrouve == '')
		{				
			if ($def['mots'] != '')
			{
				$defmots = $def['mots'];			
				$mots = explode(',', $def['mots']);
				$nbremots = count($mots);		
				for ($ijnbremots = 0; $ijnbremots < $nbremots; $ijnbremots++)
				{
					if ($rechdeftrouve == '')
					{
						$rejet1 = substr_count($mot, $mots[$ijnbremots]);
//						file_put_contents($nomficlog, date('Y-m-d H:i:s').'rech mot rejet1: '.$rejet1. "\n", FILE_APPEND | LOCK_EX);
						if ($rejet1 != 0) 
							{
								$rechdeftrouve = $mots[$ijnbremots];
//								file_put_contents($nomficlog, date('Y-m-d H:i:s').'mot rechdeftrouve: '.$rechdeftrouve. "\n", FILE_APPEND | LOCK_EX);								
							}
					}		
				}
			}
		}
		
	}
	return $rechdeftrouve;
}
function Select8BANReadSecurityDatas($rechagent) {   // rech Agent
	$defs = ReadSecurityDatas(BAN_DEF);
	$rechdeftrouve = '';

	foreach ($defs as $id => $def) {
		if (empty($def['status'])) continue;
		if (!$rechdeftrouve)
		{				
			if ($def['agent'] != '')
			{
				$defagent = $def['agent'];				
				$agent = explode(',', $def['agent']);
				$nbreagent = count($agent);		
				for ($ijnbreagent = 0; $ijnbreagent < $nbreagent; $ijnbreagent++)
				{
					if ($rechdeftrouve == '')
					{	
						$rejet1 = substr_count($rechagent, $agent[$ijnbreagent]);	
						if ($rejet1 != 0) 
							{
								$rechdeftrouve = $agent[$ijnbreagent];
							}
					}		
				}
			}
		}
		
	}
	return $rechdeftrouve;
}

function CutField($field, $max = 15, $more = '...') {
	global $charset;
    $len = strlen($field);
    if ($len > $max) {
        return '<acronym title="'.htmlentities($field, ENT_COMPAT, $charset).'" class="cursorHelp">'.substr($field, 0, $max).$more.'</acronym>';
    } else {
        return $field;
    }
}

function SelectSecurity($name, $value, $options) {
    $out = "\n".'<select name="'.$name.'">'."\n";
    foreach ($options as $key=>$option) {
        $out .= '<option value="'.$key.'"'.Selected($key == $value).'>'.$option.'</option>'."\n";
    }
    $out .= '</select>'."\n";
    return $out;
}
// Journal Bannissement 
function SelectBANReadJournalBannis($file, $ip) { 
$datjourl = new DateTime('now');
$dateheureminiutesecl = $datjourl->format('Y_m_d');
$nomficlog = CHEMIN.'data/log/SelectBANReadJournalBannis'.'_'.$dateheureminiutesecl.'.log';
// file_put_contents($nomficlog, date('Y-m-d H:i:s').'file: '.$file.' Ip: '.$ip."\n", FILE_APPEND | LOCK_EX);
	$journalbannis = ReadDBFields($file);
	$rechiptrouve = '';
	if (is_array($journalbannis))
	{
		foreach ($journalbannis as $journalban) {
			if ($journalban[2] == $ip)
				$rechiptrouve = $journalban[2];		
		}
//		 file_put_contents($nomficlog, date('Y-m-d H:i:s').'rechiptrouve: '.$rechiptrouve.' Ip: '.$ip."\n", FILE_APPEND | LOCK_EX);
	}
		return $rechiptrouve;  
}
function ExecuteBannishment() {
    global $userprefs, $pseudo, $pemail, $purl, $log1, $site, $charset, $lang, $web, $lng, $actionwaf;
	$datjourl = new DateTime('now');
	$dateheureminiutesecl = $datjourl->format('Y_m_d');
	$nomficlog = CHEMIN.'data/log/security'.'_'.$dateheureminiutesecl.'.log';

	if (!isset($actionwaf)) $actionwaf = '1';
	$this_url = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'?'.$_SERVER["QUERY_STRING"].';';
	$ptit = $_SERVER["QUERY_STRING"];
	$cfg = ReadSecurityConfig(BAN_CFG);
	date_default_timezone_set('UTC');
	$typ = isset($_REQUEST['typ']) ? $_REQUEST['typ'] : '';
	$add = isset($_REQUEST['add']) ? $_REQUEST['add'] : '';
	if (empty($log1) || $log1 == null) $log1 = '';
	$datas = array(
		date('Ymd His'),
		'-',
		getIPadress($_SERVER[$site[6] == 'on' ? 'HTTP_X_FORWARDED_FOR' : 'REMOTE_ADDR']),
		sprintf('typ=%s add=%s', $typ, $add),
		$pseudo,
		$pemail,
		$purl,
		@gethostbyaddr(getIPadress($_SERVER[$site[6] == 'on' ? 'HTTP_X_FORWARDED_FOR' : 'REMOTE_ADDR'])),
		$_SERVER['HTTP_USER_AGENT'],
		isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
		rawurldecode(htmlspecialchars($log1))
	);
	// Vérification pour atteinte du seuil toléré en cas de Spam, Vérifier le compteur de l'adresse IP , et bannissement dur
	if (!isset($cfg['seuilmaxip'])) $cfg['seuilmaxip'] = 100;
	$ipvisiteur = getIPadress($_SERVER[$site[6] == 'on' ? 'HTTP_X_FORWARDED_FOR' : 'REMOTE_ADDR']);
	$filecompteursip = BAN_REPCOUNTERS.$ipvisiteur.'_'.date('Y-W').DBEXT;
	$ipcompteur = ReadCounter($filecompteursip);
	if (file_exists($filecompteursip))
	{
		if (trim($ipcompteur+1) >= trim($cfg['seuilmaxip']))
		{
			header('location:'.'https://www.interpol.int/');
			exit();
		}
	}
	date_default_timezone_set($site['TZ']);
	$rejet = FALSE;
	if ('on' == $cfg['status']) {
		$defs = ReadSecurityDatas(BAN_DEF);
		foreach ($defs as $id => $def) {
			if (empty($def['status'])) continue;
			$url = $def['url'];
			$msg = $def['msg'];
			$motif = 'BAN('.$id;
			if (!empty($def['ip'])) {
				$rejet = $rejet || (getIPadress($_SERVER[$site[6] == 'on' ? 'HTTP_X_FORWARDED_FOR' : 'REMOTE_ADDR']) == $def['ip']);
				if ($rejet) {
					$motif .= ',ip)';
						break;
				}
			}
			if (!$rejet && !empty($def['pseudo'])) {
				if (!isset($pseudo)) $pseudo = '';
				$rejet = substr_count(mb_strtolower($userprefs[1], $charset), mb_strtolower($def['pseudo'], $charset));

				if ($rejet!= 0) {
					$motif .= ',pseudo)';
					$rejet = true;
					break;
				}
			}
			if (!$rejet && !empty($def['email'])) {
				if (!isset($email)) $email = '';
				$rejet = substr_count(mb_strtolower($userprefs[2], $charset), mb_strtolower($def['email'], $charset));
				 if ($rejet!= 0) {
					$motif .= ',email)';
					$rejet = true;
						break;
				}
			}
			if (!$rejet && !empty($def['agent'])) {
				$rejet = $rejet || (mb_substr_count(mb_strtolower($_SERVER['HTTP_USER_AGENT'], $charset), mb_strtolower($def['agent'], $charset), $charset) != 0);
				if ($rejet) {
					$motif .= ',agent)';
						break;
				}
			}
			if (!$rejet && !empty($def['host'])) {
				$host = mb_strtolower(@gethostbyaddr(getIPadress($_SERVER[$site[6] == 'on' ? 'HTTP_X_FORWARDED_FOR' : 'REMOTE_ADDR'])), $charset);
				$values = explode(",", $def['host']);
				$rejet = false;
			
				for ($ij = 0; $ij < count($values); $ij++)
				{
					if (!$rejet)
					{
						$rejet1 = substr_count($host, $values[$ij]);	
						if ($rejet1 != 0) 
						{
							$rejet = true;
						}
					}
					
				}
				if ($rejet) {
					$motif .= ',host)';
						break;
				}
			}
			if (!isset($def['path'])) $def['path'] = '';
			if (!$rejet && !empty($def['path'])) {
				$partieurl = $_SERVER['PHP_SELF'];
				$partieurl = rawurldecode($partieurl);
				$values = explode(",", $def['path']);
				$rejet = false;			
				for ($ij = 0; $ij < count($values); $ij++)
				{
					if (!$rejet)
					{	
						$rejet1 = substr_count($partieurl, $values[$ij]);	
						if ($rejet1 != 0) 
						{
							$rejet = true;
						}
					}
				}
				if ($rejet) {
					$motif .= ',path)';
					break;
				}
// test longueur de SCRIPT Name				}
				if (!$rejet && strlen($_SERVER['SCRIPT_NAME']) > $cfg['pathlgmessage'])
				{
						$rejet = true;
						$motif .=',Path lg= '.strlen($_SERVER['SCRIPT_NAME']).' : '.$web[698].')';
						break;
				}
// fin ajout
			}
// ajout Linuxmr
			if (!$rejet && !empty($def['mots'])) {
				$ptext = $ptit;
				$values = explode(",", $def['mots']);
				$rejet = false;
				$mottrouve = '';
				$ptext = rawurldecode($ptext);
				for ($ij = 0; $ij < count($values); $ij++)
				{
					if (!$rejet)
					{
						$rejet1 = substr_count($ptext, $values[$ij]);	
						if ($rejet1 != 0) 
						{
							$rejet = true;
							$mottrouve =  $values[$ij];
							break;
						}
					}
					
				}
				if ($rejet) {
					$motif .= ',mot='.$mottrouve.')';
					break;
				}	
			}
// test longueur de SCRIPT
			if (!$rejet && strlen($_SERVER["QUERY_STRING"]) > $cfg['querylgmessage'])
			{
					$rejet = true;
					$motif .= ',Query_string lg= '.strlen($_SERVER["QUERY_STRING"]).' : '.$web[698].')';
					break;
			}
// fin ajout
		}
	}
	
	$nomficlog = CHEMIN.'data/log/security'.'_'.$dateheureminiutesecl.'.log';
	$datas[1] = $rejet ? $motif : '';
	$ipvisiteur = getIPadress($_SERVER[$site[6] == 'on' ? 'HTTP_X_FORWARDED_FOR' : 'REMOTE_ADDR']);
	if ('on' == $cfg['record'] && $datas[1] != '' && $rejet) 
	{
//		file_put_contents($nomficlog, date('Y-m-d H:i:s').'Bannissement ipvisiteur: '.$ipvisiteur."\n", FILE_APPEND | LOCK_EX);
		$rechecheip = '';
		$ipcompteur=1;
		$filecompteursip = BAN_REPCOUNTERS.$ipvisiteur.'_'.date('Y-W').DBEXT;
		$file = BAN_REP.date('Y-W').DBEXT;
//		 file_put_contents($nomficlog, date('Y-m-d H:i:s').'Test file: '.$file.' ipvisiteur: '.$ipvisiteur."\n", FILE_APPEND | LOCK_EX);
		if (FileDBExist($file)) 
		{ // test ficihier bannis exist
//			file_put_contents($nomficlog, date('Y-m-d H:i:s').'File exists: '.$file.' ipvisiteur: '.$ipvisiteur."\n", FILE_APPEND | LOCK_EX);
			$rechecheip = SelectBANReadJournalBannis($file, $ipvisiteur);
			if (file_exists($filecompteursip)) //si fichier Compteur par IP exists
			{
//				file_put_contents($nomficlog, date('Y-m-d H:i:s').'Exists Increment readcounter filecompteursip: '.$filecompteursip.' ipvisiteur: '.$ipvisiteur."\n", FILE_APPEND | LOCK_EX);
				$ipcompteur = ReadCounter($filecompteursip);
				$ipcompteur++;
			}
			if ($rechecheip != '' && trim($ipcompteur) >= trim($cfg['seuilmaxip']))
			{
//				file_put_contents($nomficlog, date('Y-m-d H:i:s').'Test pour ipvisiteur: '.$ipvisiteur.' ipcompteur: '.$ipcompteur.' cfg seuilmaxip'.$cfg['seuilmaxip']."\n", FILE_APPEND | LOCK_EX);
//				file_put_contents($nomficlog, date('Y-m-d H:i:s').'Renvoi vers https://www.interpol.int/ pour ipvisiteur: '.$ipvisiteur.' ipcompteur: '.$ipcompteur.' cfg seuilmaxip'.$cfg['seuilmaxip']."\n", FILE_APPEND | LOCK_EX);
				header('location:'.'https://www.interpol.int/');
				exit();
			}
			else
			{
//				file_put_contents($nomficlog, date('Y-m-d H:i:s').' readcounter filecompteursip: '.$filecompteursip.' ipvisiteur: '.$ipvisiteur.' ipcompteur: '.$ipcompteur."\n", FILE_APPEND | LOCK_EX);
				WriteCounter($filecompteursip,$ipcompteur);	
//				file_put_contents($nomficlog, date('Y-m-d H:i:s').'Ecr  Compteuripvisiteur: '.$ipvisiteur.' rechecheip: '.$rechecheip.' ipcompteur: '.$ipcompteur."\n", FILE_APPEND | LOCK_EX);
				AppendDbFields($file, $datas);
//				file_put_contents($nomficlog, date('Y-m-d H:i:s').'Bannis ajout Apres ecr ipvisiteur: '.$ipvisiteur.' rechecheip: '.$rechecheip.' ipcompteur: '.$ipcompteur."\n", FILE_APPEND | LOCK_EX);
			}
		}
		else
		{
//			file_put_contents($nomficlog, date('Y-m-d H:i:s').'File absent: '.$file.' ipvisiteur: '.$ipvisiteur."\n", FILE_APPEND | LOCK_EX);
			WriteDbFields($file, array($datas));
//			file_put_contents($nomficlog, date('Y-m-d H:i:s').'Bannis créé Apres ecr ipvisiteur: '.$ipvisiteur.' rechecheip: '.$rechecheip.' ipcompteur: '.$ipcompteur."\n", FILE_APPEND | LOCK_EX);
			WriteCounter($filecompteursip,$ipcompteur);
//			file_put_contents($nomficlog, date('Y-m-d H:i:s').'Compteur créé apres bannis ecr ipvisiteur: '.$ipvisiteur.' rechecheip: '.$rechecheip.' ipcompteur: '.$ipcompteur."\n", FILE_APPEND | LOCK_EX);
			
		}	
		PurgeSecurityLog(BAN_REP, $cfg['retention']);
		PurgeSecurityCounters(BAN_REPCOUNTERS, $cfg['retention'], $filecompteursip);		
	}
	if ($rejet) {
		if (!empty($msg) && ('on' == $cfg['inforparmail'])) {
			$eSub = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).' '.$web[451].$msg;
			$eMsg = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'<hr /><strong>'.$msg.'</strong><hr />'.$web[452].$web[478].'<br />';
			$eMsg .= $web[453].$datas[0].'.<br />';
			$eMsg .= $web[454].$datas[1].'.<br />';
			$eMsg .= $web[455].$datas[2].'.<br />';
			$eMsg .= $web[456].$datas[3].'.<br />';
			$eMsg .= $web[457].$datas[4].'.<br />';
			$eMsg .= $web[458].$datas[5].'.<br />';
			$eMsg .= $web[459].$datas[6].'.<br />';
			$eMsg .= $web[460].$datas[7].'.<br />';
			$eMsg .= $web[461].$datas[8].'.<br />';
			$eMsg .= $web[462].$datas[9].'.<br />';
			$eMsg .= $web[463].$datas[10].'.<br />';
			$eMsg .= '<hr />';
			eMailHtmlTo($eSub, $eMsg, '');
		}
		switch($url) 
		{
			case 'error403.php' :
				switch($msg)
				{
					case '401' :
							//HTTP/1.0 401 Unauthorized";
					case '403' :
						//HTTP/1.0 403 Forbidden";
					case '404' :
					case '406' :
						// HTTP/1.0 404 Not Found";
					case '410' :
						//HTTP/1.0 410 Gone";	

					$url .='?err='.$msg;
					header('location:'.$site[3].$url);
					exit();
				}       
			 default :
				header('location:'.$url);
				exit();
		}
	}
}
function ExploreFileSemaine($dir) {
    $dir = AddCHEMIN($dir);
    $array = array();
    $dossier = opendir($dir);
    while ($fichier = readdir($dossier)) {
        if (is_file($dir.$fichier) && $fichier != 'index.php') {
		    $path_parts = pathinfo($fichier);
			$fichier = $path_parts['filename'];
/*
			Enlever toute la partie et conserver annee-semaine
*/
			$anneesemaine = substr($fichier, -7);
			$fichiersepasemaine = explode('-', $anneesemaine);
			if (isset($fichiersepasemaine[1]))
				$array[] = $anneesemaine;
        }
    }
    closedir($dossier);
    sort($array);
    return $array;
}
function ExploreFileSemainechoisi($dir, $semainechoisi) {
    $dir = AddCHEMIN($dir);
    $array = array();
    $dossier = opendir($dir);
	$nombre = 0;
    while ($fichier = readdir($dossier)) {
        if (is_file($dir.$fichier) && $fichier != 'index.php') {
		    $path_parts = pathinfo($fichier);
			$fichiernom = $path_parts['filename'];
/*
			Enlever recherche de - pour avoir la position
			enlever la partie dtb  pour l'année et la semaine
			enlever 2 caractère pour avoir la semaine
*/
			$posrecherche = strpos($fichiernom, '-');
			if ($posrecherche != '')
			{
				$posrecherche = $posrecherche - 5;
				$nomfic= substr($fichiernom, 0,$posrecherche);
//				echo 'nomfic: '.$nomfic.'<br />';
				$posrechercheautre = strpos($fichier, '.dtb');
				if ($posrechercheautre != '')
				{				
					$semaine= substr($fichier, 0,$posrechercheautre);
					$semaine = substr($semaine, -2);
//					echo 'semaine: '.$semaine.'<br />';
					if ($semaine == $semainechoisi)
					{
						$array[$nombre][0] = date ("d/m/Y H:i:s", filemtime(BAN_REPCOUNTERS.$fichier));
						$array[$nombre][1] = $nomfic;
						$array[$nombre][2] = ReadCounter(BAN_REPCOUNTERS.$fichier);
						$nombre++;
						
					}
				}
			}
        }
    }
    closedir($dossier);
	$datas = array_reverse($array);
    return $datas;
}
// Destruction des anciens logs 
function PurgeSecurityLog($dir, $retention) {
    if (0 == $retention) return;
    $lastyear = date('Y');
    $lastweek = date('W') - $retention;
    if ($lastweek < 1) {
        $lastyear--;
        $lastweek += 52;
    }
    $lastfile = sprintf('%4d-%02d.dtb', $lastyear, $lastweek);
    $files = ExploreFile($dir);
    foreach ($files as $file) {
        if ($file < $lastfile) {
            DestroyDBFile($dir.$file);
        }
    }
}
// Suppression des anciens compteurs
function PurgeSecurityCounters($dir, $retention) {
$datjourl = new DateTime('now');
$dateheureminiutesecl = $datjourl->format('Y_m_d');
$nomficlog = CHEMIN.'data/log/PurgeSecurityCounters'.'_'.$dateheureminiutesecl.'.log';
// file_put_contents($nomficlog, date('Y-m-d H:i:s').'dir: '.$dir.' retention: '.$retention."\n", FILE_APPEND | LOCK_EX);
    if (0 == $retention) return;
    $lastyear = date('Y');
    $lastweek = date('W') - $retention;
    if ($lastweek < 1) {
        $lastyear--;
        $lastweek += 52;
    }
    $lastfile = sprintf('%4d-%02d.dtb', $lastyear, $lastweek);
    $files = ExploreFile($dir);
    foreach ($files as $filew) {
// file_put_contents($nomficlog, date('Y-m-d H:i:s').'file: '.$file."\n", FILE_APPEND | LOCK_EX);
		$possuite = strpos($filew, '.dtb');
		$annesemainrech= substr($filew, 0,$possuite);
// file_put_contents($nomficlog, date('Y-m-d H:i:s').'annesemainrech: '.$annesemainrech."\n", FILE_APPEND | LOCK_EX);
		$file = substr($annesemainrech, -7).'.dtb';
// file_put_contents($nomficlog, date('Y-m-d H:i:s').'lastfile: '.$lastfile.' file: '.$file."\n", FILE_APPEND | LOCK_EX);
        if ($file < $lastfile) {
// file_put_contents($nomficlog, date('Y-m-d H:i:s').'suppression de  $filew: '.$filew.' lastfile: '.$lastfile."\n", FILE_APPEND | LOCK_EX);
            DestroyDBFile($dir.$filew);
        }
    }
}
?>
statcalc.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/statcalc.inc'
View Content
<?php
/*******************************************************************************
 *   Stats calculation
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.03 (August 10, 2021) : adaptation to php 8
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'statcalc.inc')) {
    header('location:../index.php');
    die();
}

if (!isset($npage)) {
    include(CHEMIN.INCREP."lang/".$lng."-web".INCEXT);
    if ($lng == $lang[0]) {
        $npage = array($web[169], getLabel($nom[1]), getLabel($nom[24]), getLabel($nom[22]), getLabel($nom[9]), getLabel($nom[0]), getLabel($nom[3]),
            getLabel($nom[7]), getLabel($nom[2]), '', getLabel($nom[20]), getLabel($nom[26]), $web[144], getLabel($nom[42]),
            $web[485], $web[486], $web[487], $web[488], $web[489], $web[490]
            );
    } else {
        $npage = array($web[169], getLabel($nom[11]), getLabel($nom[25]), getLabel($nom[23]), getLabel($nom[19]), getLabel($nom[10]), getLabel($nom[13]),
            getLabel($nom[17]), getLabel($nom[12]), '', getLabel($nom[21]), getLabel($nom[27]), $web[144], getLabel($nom[43]),
            $web[485], $web[486], $web[487], $web[488], $web[489], $web[490]
            );
    }
}

function CalcDay($file = '') {
    if (empty($file)) {
        $statslog = ReadDBFields(DBLOGD);
        $dbt1 = ReadDBFields(DBLOGH);
        for ($i = 0; $i < STATS_NBPAGE;     $i++)   { $statslog[1][$i] = $statslog[1][$i]+$dbt1[1][$i]; }
        for ($i = 0; $i < STATS_NBLANGUE;   $i++)   { $statslog[2][$i] = $statslog[2][$i]+$dbt1[2][$i]; }
        for ($i = 0; $i < STATS_NBBROWSER;  $i++)   { $statslog[3][$i] = $statslog[3][$i]+$dbt1[3][$i]; }
        for ($i = 0; $i < STATS_NBOS;       $i++)   { $statslog[4][$i] = $statslog[4][$i]+$dbt1[4][$i]; }
        $statslog[5][$dbt1[0][0]] = $statslog[5][$dbt1[0][0]]+$dbt1[5][0];
        $statslog[6][$dbt1[0][0]] = $statslog[6][$dbt1[0][0]]+$dbt1[6][0];
        return $statslog;
    } else {
        return ReadDBFields(OLDSSTATSREP.$file);
    }
}

function CalcMonth($file = '') {
    if (empty($file)) {
        $statslog = ReadDBFields(DBLOGM);
        $dbt1 = ReadDBFields(DBLOGH);
        $dbt2 = ReadDBFields(DBLOGD);
        for ($i = 0; $i < STATS_NBPAGE;     $i++)   { $dbt2[1][$i] = $dbt2[1][$i]+$dbt1[1][$i]; }
        for ($i = 0; $i < STATS_NBLANGUE;   $i++)   { $dbt2[2][$i] = $dbt2[2][$i]+$dbt1[2][$i]; }
        for ($i = 0; $i < STATS_NBBROWSER;  $i++)   { $dbt2[3][$i] = $dbt2[3][$i]+$dbt1[3][$i]; }
        for ($i = 0; $i < STATS_NBOS;       $i++)   { $dbt2[4][$i] = $dbt2[4][$i]+$dbt1[4][$i]; }
        $dbt2[5][$dbt1[0][0]] = $dbt2[5][$dbt1[0][0]]+$dbt1[5][0];
        $dbt2[6][$dbt1[0][0]] = $dbt2[6][$dbt1[0][0]]+$dbt1[6][0];
        for ($i = 0; $i < STATS_NBPAGE;     $i++)   { $statslog[1][$i] = (isset($statslog[1][$i]) ? $statslog[1][$i] : 0) + (isset($dbt2[1][$i]) ? $dbt2[1][$i] : 0); }
        for ($i = 0; $i < STATS_NBLANGUE;   $i++)   { $statslog[2][$i] = $statslog[2][$i]+$dbt2[2][$i]; }
        for ($i = 0; $i < STATS_NBBROWSER;  $i++)   { $statslog[1][$i] = (isset($statslog[3][$i]) ? $statslog[3][$i] : 0) + (isset($dbt2[3][$i]) ? $dbt2[3][$i] : 0); }
        for ($i = 0; $i < STATS_NBOS;       $i++)   { $statslog[4][$i] = $statslog[4][$i]+$dbt2[4][$i]; }
        for ($i = 0; $i < STATS_NBHEURE;    $i++)   { $statslog[5][$dbt2[0][0]-1] = $statslog[5][$dbt2[0][0]-1]+$dbt2[5][$i]; }
        for ($i = 0; $i < STATS_NBHEURE;    $i++)   { $statslog[6][$dbt2[0][0]-1] = $statslog[6][$dbt2[0][0]-1]+$dbt2[6][$i]; }
        return $statslog;
    } else {
        return ReadDBFields(OLDSSTATSREP.$file);
    }
}

function CalcYear($file = '') {
    if (empty($file)) {
        $statslog = ReadDBFields(DBLOGY);
        $dbt1 = ReadDBFields(DBLOGH);
        $dbt2 = ReadDBFields(DBLOGD);
        $dbt3 = ReadDBFields(DBLOGM);
        for ($i = 0; $i < STATS_NBPAGE;     $i++)   { $dbt2[1][$i] = $dbt2[1][$i]+$dbt1[1][$i]; }
        for ($i = 0; $i < STATS_NBLANGUE;   $i++)   { $dbt2[2][$i] = $dbt2[2][$i]+$dbt1[2][$i]; }
        for ($i = 0; $i < STATS_NBBROWSER;  $i++)   { $dbt2[3][$i] = $dbt2[3][$i]+$dbt1[3][$i]; }
        for ($i = 0; $i < STATS_NBOS;       $i++)   { $dbt2[4][$i] = $dbt2[4][$i]+$dbt1[4][$i]; }
        $dbt2[5][$dbt1[0][0]] = $dbt2[5][$dbt1[0][0]]+$dbt1[5][0];
        $dbt2[6][$dbt1[0][0]] = $dbt2[6][$dbt1[0][0]]+$dbt1[6][0];
        for ($i = 0; $i < STATS_NBPAGE;     $i++)   { $dbt3[1][$i] = $dbt3[1][$i]+$dbt2[1][$i]; }
        for ($i = 0; $i < STATS_NBLANGUE;   $i++)   { $dbt3[2][$i] = $dbt3[2][$i]+$dbt2[2][$i]; }
        for ($i = 0; $i < STATS_NBBROWSER;  $i++)   { $dbt3[3][$i] = $dbt3[3][$i]+$dbt2[3][$i]; }
        for ($i = 0; $i < STATS_NBOS;       $i++)   { $dbt3[4][$i] = $dbt3[4][$i]+$dbt2[4][$i];}
        for ($i = 0; $i < STATS_NBHEURE;    $i++)   { $dbt3[5][$dbt2[0][0]-1] = $dbt3[5][$dbt2[0][0]-1]+$dbt2[5][$i]; }
        for ($i = 0; $i < STATS_NBHEURE;    $i++)   { $dbt3[6][$dbt2[0][0]-1] = $dbt3[6][$dbt2[0][0]-1]+$dbt2[6][$i]; }
        for ($i = 0; $i < STATS_NBPAGE;     $i++)   { $statslog[1][$i] = $statslog[1][$i]+$dbt3[1][$i]; }
        for ($i = 0; $i < STATS_NBLANGUE;   $i++)   { $statslog[2][$i] = $statslog[2][$i]+$dbt3[2][$i]; }
        for ($i = 0; $i < STATS_NBBROWSER;  $i++)   { $statslog[3][$i] = $statslog[3][$i]+$dbt3[3][$i]; }
        for ($i = 0; $i < STATS_NBOS;       $i++)   { $statslog[4][$i] = $statslog[4][$i]+$dbt3[4][$i]; }
        for ($i = 0; $i < STATS_NBJOUR;     $i++)   { $statslog[5][$dbt3[0][0]-1] = $statslog[5][$dbt3[0][0]-1]+$dbt3[5][$i]; }
        for ($i = 0; $i < STATS_NBJOUR;     $i++)   { $statslog[6][$dbt3[0][0]-1] = $statslog[6][$dbt3[0][0]-1]+$dbt3[6][$i]; }
        return $statslog;
    } else {
        return ReadDBFields(OLDSSTATSREP.$file);
    }
}

function AnalyzeDay($statslog) {
    $nhour = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23);
    $shit = array();
    $snbpage = array();
    $maxshit = 1;
    $maxsnbpage = 1;
    for ($j = 0; $j < count($nhour); $j++) {
        $shit[$j][0] = $statslog[6][$j];
        $shit[$j][1] = $nhour[$j];
        $maxshit = Max($maxshit,$shit[$j][0]);
        $snbpage[$j][0] = $statslog[5][$j];
        $snbpage[$j][1] = $nhour[$j];
        $maxsnbpage = Max($maxsnbpage,$snbpage[$j][0]);
    }
    return array(
        'max1' => $maxshit,
        'tab1' => $shit,
        'max2' => $maxsnbpage,
        'tab2' => $snbpage
        );
}

function AnalyzeMonth($statslog) {
    $nmonth = array();
    $nbday = empty($statslog[0][2]) ? 0 : date('t', mktime(0, 0, 0, intval(substr($statslog[0][2], 5, 2)), 2, intval(substr($statslog[0][2], 0, 4))));
    for ($n = 0; $n < $nbday; $n++) {
        $nmonth[$n] = $n + 1;
    }
    $shit = array();
    $snbpage = array();
    $maxshit = 1;
    $maxsnbpage = 1;
    for ($j = 0; $j < count($nmonth); $j++) {
        $shit[$j][0] = $statslog[6][$j];
        $shit[$j][1] = $nmonth[$j];
        $maxshit = Max($maxshit,$shit[$j][0]);
        $snbpage[$j][0] = $statslog[5][$j];
        $snbpage[$j][1] = $nmonth[$j];
        $maxsnbpage = Max($maxsnbpage,$snbpage[$j][0]);
    }
    return array(
        'max1' => $maxshit,
        'tab1' => $shit,
        'max2' => $maxsnbpage,
        'tab2' => $snbpage
        );
}

function AnalyzeYear($statslog) {
    $nyear = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
    $shit = array();
    $snbpage = array();
    $maxshit = 1;
    $maxsnbpage = 1;
    for ($j = 0; $j < count($nyear); $j++) {
        $shit[$j][0] = $statslog[6][$j];
        $shit[$j][1] = $nyear[$j];
        $maxshit = Max($maxshit,$shit[$j][0]);
        $snbpage[$j][0] = $statslog[5][$j];
        $snbpage[$j][1] = $nyear[$j];
        $maxsnbpage = Max($maxsnbpage,$snbpage[$j][0]);
    }
    return array(
        'max1' => $maxshit,
        'tab1' => $shit,
        'max2' => $maxsnbpage,
        'tab2' => $snbpage
        );
}

function compare($a, $b) {
	if ($a[0] == $b[0]) {
		return strtolower($a[1]) > strtolower($b[1]) ? +1 : -1;

	} else {
		return $a[0] < $b[0] ? +1 : -1;
	}
}

function AnalyzeLang($statslog) {
    global $npage, $show_stat_admin, $lang;
    $slang = array();
    $maxslang = 1;
    for ($j = 0; $j < count($lang); $j++) {
        $slang[$j][0] = $statslog[2][$j];
        $slang[$j][1] = $lang[$j];
        $maxslang = Max($maxslang,$slang[$j][0]);
    }
    @rsort($slang);
    $spage = array();
    $maxspage = 1;
    for ($j = 0; $j < count($npage); $j++) {
        if (12 == $j && isset($show_stat_admin) && !$show_stat_admin ) continue;
        $spage[$j][0] = $statslog[1][$j];
        $spage[$j][1] = $npage[$j];
        $maxspage = Max($maxspage,$spage[$j][0]);
    }
    if (isset($show_stat_admin) && !$show_stat_admin) {
        unset($spage[12]);
        $spage = array_values($spage);
    }
    usort($spage, 'compare');
    return array(
        'max1' => $maxslang,
        'tab1' => $slang,
        'max2' => $maxspage,
        'tab2' => $spage
        );
}

function AnalyzeNavOs($statslog) {
    $nnav = array('Netscape', 'MSIE', 'Mozilla', 'DA', 'Opera', 'iCab', 'Konqueror', 'Robot', 'Other',
        'Wget', 'Avant Browser', 'Crazy Browser', 'Maxthon', 'Lynx', 'Safari', 'Seamonkey',
        'Playstation portable', 'Playstation 3', 'Nintendo Wii', 'Firefox', 'Flock',
        'Iceweasel', 'Chrome', 'Camino', 'Dillo', 'Element Browser', 'Epiphany',
        'Galeon', 'K-Meleon', 'Kazehakase', 'Minifield');
    $nos = array('Windows', 'Mac', 'Linux', 'FreeBSD', 'SunOS', 'IRIX', 'BeOS', 'OS/2', 'AIX', 'Other');
    $snav = array();
    $maxsnav = 1;
    $sos = array();
    $maxsos = 1;
    for ($j = 0; $j < count($nnav); $j++) {
        $snav[$j][0] = $statslog[3][$j];
        $snav[$j][1] = $nnav[$j];
        $maxsnav = Max($maxsnav,$snav[$j][0]);
    }
    usort($snav, 'compare');
    for ($j = 0; $j < count($nos); $j++) {
        $sos[$j][0] = $statslog[4][$j];
        $sos[$j][1] = $nos[$j];
        $maxsos = Max($maxsos,$sos[$j][0]);
    }
    @rsort($sos);
    return array(
        'max1' => $maxsnav,
        'tab1' => $snav,
        'max2' => $maxsos,
        'tab2' => $sos
        );
}

function ListStatsFiles() {
    $files = ExploreFile(STATSREP.'olds/');
    rsort($files);
    $foptions = array();
    foreach ($files as $file) {
        if ($file == 'index.php') continue;
        $name = substr($file, 0, -4);
        switch (strlen($name)) {
        case 4  : $foptions[$name] = '3,'.$file; break;
        case 7  : $foptions[$name] = '2,'.$file; break;
        case 10 : $foptions[$name] = '1,'.$file; break;
        default : $foptions[$name] = '0,'.$file;
        }
    }
    return $foptions;
}
?>
statshow.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/statshow.inc'
View Content
<?php
/*******************************************************************************
 *   Statistics Reporting
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.19 (August 26, 2024) : modification to best views of statistics
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'statshow.inc')) {
  header('location:../index.php');
  die();
}

$per = import('per');
$anal = import('anal');

if (empty($per)) {
    $per = 1;
}
echo '
<form name="chgestat" action="'.(CHEMIN == '' ? 'stats.php?lng='.$lng.'&amp;tconfig='.$tconfig.$z2 : 'admin.php?lng='.$lng.'&amp;pg=statsvw').'" method="post">
<div class="table-responsive-md">
<table class="table m-auto text-center">
  <tr>
    <td class="tdstats"><b>'.$web[71].'</b></td>
    <td class="tdstats">
      <select class="form-control" style="max-width:200px;" name="per">
        <optgroup label="'.$web[447].'">
        <option value="1"'.Selected($per == 1).'>'.$web[72].'</option>
        <option value="2"'.Selected($per == 2).'>'.$web[73].'</option>
        <option value="3"'.Selected($per == 3).'>'.$web[74].'</option>
        </optgroup>';
$foptions = ListStatsFiles();
if (!empty($foptions)) {
    echo '
        <optgroup label="'.$web[448].'">';
    foreach ($foptions as $name => $value) {
    echo '
        <option value="'.$value.'"'.Selected($per === $value).'>'.$name.'</option>';
    }
    echo '
        </optgroup>';
}
echo '
      </select>
    </td>
  </tr>
  <tr>
    <td class="tdstats"><b>'.$web[76].'</b></td>
    <td class="tdstats">
      <select class="form-control" style="max-width:260px;" name="anal">
        <option value="1"'.Selected($anal == 1).'>'.$web[77].'</option>
        <option value="2"'.Selected($anal == 2).'>'.$web[78].'</option>
        <option value="3"'.Selected($anal == 3).'>'.$web[79].'</option>
      </select>
    </td>
  </tr>
  <tr class="text-center">
    <td class="tdstats" colspan="2">'.SubmitButton($web[80]).'</td>
  </tr>
</table>
</div>
</form>';

if (!empty($anal)) {
    $tmp = explode(',', $per);
    $per = $tmp[0];
    $file = isset($tmp[1]) ? $tmp[1] : '';
    echo '
<hr />';
}

if ($anal == 1) {
    switch($per) {
    case 1 : $result = AnalyzeDay(CalcDay($file));     $txt = $web[81]; break;
    case 2 : $result = AnalyzeMonth(CalcMonth($file)); $txt = $web[82]; break;
    case 3 : $result = AnalyzeYear(CalcYear($file));   $txt = $web[83]; break;
    }
    echo '
<p class="quest text-center"><b>'.$txt.'</b></p>
<div class="table-responsive w-90">
<table class="table m-auto text-center">
  <tr>';

    $bar = 200/$result['max1'];
    for ($k = 0; $k < count($result['tab1']); $k++) {
        echo '
<style>
.vertbarre1'.$k.' {
    width: 10px;
    margin: 0 2px;
    height: '.round($result['tab1'][$k][0]*$bar).'px;
}
</style>
    <td class="align-bottom text-center vertbarStat">
      '.$result['tab1'][$k][0].'<br />
        <img src="'.CHEMIN.'inc/img/bars/vertbleu.gif" class="vertbarre1'.$k.'" alt="'.$result['tab1'][$k][0].'"/>
    </td>';
    }
    echo '
  </tr>
  <tr>';
    for ($k = 0; $k < count($result['tab1']); $k++) {
        echo '
    <td class="align-bottom text-center vertbarStat">
      <b>'.$result['tab1'][$k][1].'</b>
    </td>';
    }
    switch($per) {
    case 1 : $txt = $web[84]; break;
    case 2 : $txt = $web[85]; break;
    case 3 : $txt = $web[86]; break;
    }
    echo '
  </tr>
</table>
</div>
<br />
<p class="quest text-center"><b>'.$txt.'</b></p>
<div class="table-responsive w-90">
<table class="table m-auto text-center">
  <tr>';

    $bar = 200/$result['max2'];
    for ($k = 0; $k < count($result['tab2']); $k++) {
        echo '
<style>
.vertbarre2'.$k.' {
    width: 10px;
    margin: 0 2px;
    height: '.round($result['tab2'][$k][0]*$bar).'px;
}
</style>
    <td class="align-bottom text-center vertbarStat">
      '.$result['tab2'][$k][0].'<br />
        <img src="'.CHEMIN.'inc/img/bars/vertbleu.gif" class="vertbarre2'.$k.'"/>
    </td>';
    }
    echo '
  </tr>
  <tr>';
    for ($k = 0; $k < count($result['tab2']); $k++) {
        echo '
    <td class="align-bottom text-center vertbarStat">
      <b>'.$result['tab2'][$k][1].'</b>
    </td>';
    }
    echo '
  </tr>
</table>
</div>';
}

elseif ($anal == "2") {
    switch($per) {
    case 1 : $result = AnalyzeLang(CalcDay($file));  break;
    case 2 : $result = AnalyzeLang(CalcMonth($file));    break;
    case 3 : $result = AnalyzeLang(CalcYear($file)); break;
    }
    echo '
<p class="quest text-center"><b>'.$web[87].'</b></p>
<div class="table-responsive w-90">
<table class="table m-auto text-left">';
    $bar = 250/$result['max1'];
    for ($k = 0; $k < count($result['tab1']); $k++) {
        if ($result['tab1'][$k][0] > 0) {
            echo '
<style>
.horizbarre1'.$k.' {
    width: '.round($result['tab1'][$k][0]*$bar).'px;
    height: 10px;
    margin: 0 5px;
}
</style>
  <tr>
    <td class="horiztxtStat"><b>'.$result['tab1'][$k][1].' </b></td>
    <td class="horizbarStat">
      <img src="'.CHEMIN.'inc/img/bars/vert.gif" class="horizbarre1'.$k.'" alt="'.$result['tab1'][$k][1].'"/> '.$result['tab1'][$k][0].'
    </td>
  </tr>';
        }
    }
    echo '
</table>
</div>
<br />
<p class="quest text-center"><b>'.$web[88].'</b></p>
<div class="table-responsive w-90">
<table class="table m-auto text-left">';
    $bar = 250/$result['max2'];
    for ($k = 0; $k < count($result['tab2']); $k++) {
        if ($result['tab2'][$k][0] > 0) {
            echo '
<style>
.horizbarre2'.$k.' {
    width: '.round($result['tab2'][$k][0]*$bar).'px;
    height: 10px;
    margin: 0 5px;
}
</style>
  <tr>
    <td class="horiztxtStat"><b>'.$result['tab2'][$k][1].' </b></td>
    <td class="horizbarStat">
      <img src="'.CHEMIN.'inc/img/bars/orange.gif" class="horizbarre2'.$k.'" alt="'.$result['tab2'][$k][1].'" /> '.$result['tab2'][$k][0].'
    </td>
  </tr>';
        }
    }
    echo '
</table>
</div>
<br />';
}

elseif ($anal == "3") {
    switch($per) {
    case 1 : $result = AnalyzeNavOs(CalcDay($file));  break;
    case 2 : $result = AnalyzeNavOs(CalcMonth($file));    break;
    case 3 : $result = AnalyzeNavOs(CalcYear($file)); break;
    }
    echo '
<p class="quest text-center"><b>'.$web[89].'</b></p>
<div class="table-responsive w-90">
<table class="table m-auto text-left">';
    $bar = 250/$result['max1'];
    for ($k = 0; $k < count($result['tab1']); $k++) {
        if ($result['tab1'][$k][0] > 0) {
            echo '
<style>
.horizbarre1'.$k.' {
    width:'.round($result['tab1'][$k][0]*$bar).'px;
    height: 10px;
    margin: 0 5px;
}
</style>
  <tr>
    <td class="horiztxtStat"><b>'.$result['tab1'][$k][1].' </b></td>
    <td class="horizbarStat">
      <img src="'.CHEMIN.'inc/img/bars/rouge.gif" class="horizbarre1'.$k.'" alt="'.$result['tab1'][$k][1].'" /> '.$result['tab1'][$k][0].'
    </td>
  </tr>';
        }
    }
    echo '
</table>
</div>
<br />
<p class="quest text-center"><b>'.$web[90].'</b></p>
<div class="table-responsive w-90">
<table class="table m-auto text-left">';
    $bar = 250/$result['max2'];
    for ($k = 0; $k < count($result['tab2']); $k++) {
        if ($result['tab2'][$k][0] > 0) {
            echo '
<style>
.horizbarre2'.$k.' {
    width: '.round($result['tab2'][$k][0]*$bar).'px;
    height: 10px;
    margin: 0 5px;
}
</style>
  <tr>
    <td class="horiztxtStat"><b>'.$result['tab2'][$k][1].' </b></td>
    <td class="horizbarStat">
      <img src="'.CHEMIN.'inc/img/bars/bleu.gif" class="horizbarre2'.$k.'" alt="'.$result['tab2'][$k][1].'" /> '.$result['tab2'][$k][0].'
    </td>
  </tr>';
        }
    }
    echo '
</table>
</div>';
}

switch($anal) {
    case 1 :
        echo '
<br />
<p>'.$web[449].'</p>';
        break;
    case 2 :
    case 3 :
        echo '
<br />
<p>'.$web[510].'</p>';
        break;
}
?>
tinymsg.js
wget 'https://sme10.lists2.roe3.org/guppy/inc/tinymsg.js'
View Content
function AddSmiley(a){if(document.selection){document.nmsgr.msg.focus();var b=document.selection.createRange();b.text=a}else document.nmsgr.msg.focus(),document.nmsgr.msg.value=document.nmsgr.msg.value+a;document.nmsgr.msg.focus()}function format(a){if(document.selection){var b=document.selection.createRange().text;document.nmsgr.msg.focus();var c=document.selection.createRange();return c.text="["+a+"]"+b+"[/"+a+"]",void document.nmsgr.msg.focus()}if("Gecko"==navigator.product&&navigator.productSub>=20030210){var d=document.nmsgr.msg.selectionStart,e=document.nmsgr.msg.selectionEnd,f=document.nmsgr.msg.value;return document.nmsgr.msg.value=f.substring(0,d)+"["+a+"]"+f.substring(d,e)+"[/"+a+"]"+f.substring(e,f.length),void document.nmsgr.msg.focus()}var f=document.nmsgr.msg.value;return document.nmsgr.msg.value=f+"["+a+"] [/"+a+"]",void document.nmsgr.msg.focus()}function dolink(a){if(document.selection){var b=document.selection.createRange().text;document.nmsgr.msg.focus();var c=document.selection.createRange();return c.text="[l]"+a+b+"[/l]",void document.nmsgr.msg.focus()}if("Gecko"==navigator.product&&navigator.productSub>=20030210){var d=document.nmsgr.msg.selectionStart,e=document.nmsgr.msg.selectionEnd,f=document.nmsgr.msg.value;return document.nmsgr.msg.value=f.substring(0,d)+"[l]"+a+f.substring(d,e)+"[/l]"+f.substring(e,f.length),void document.nmsgr.msg.focus()}var f=document.nmsgr.msg.value;return document.nmsgr.msg.value=f+"[l]"+a+"[/l]",void document.nmsgr.msg.focus()}
user.inc
wget 'https://sme10.lists2.roe3.org/guppy/inc/user.inc'
View Content
<?php
/*******************************************************************************
 *   Confirm User preferencies
 *******************************************************************************
 *   GuppY PHP Script - version 6
 *   CeCILL Copyright (C) 2004-2022 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 *  v6.00.19 (August 26, 2024) : correction password																	
 ******************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], 'user.inc')) {
    header('location:../index.php');
    die();
}

class GY_user {
    public $tconfig;
    public $topmess;
    protected $modif;
    protected $uuser;
    protected $modif_ok;
    
    public function __construct() {
        global $nom, $menuico, $serviz, $page, $charset, $userprefs;
        $this->tconfig  = $serviz[172] == 'ALL' ? import('tconfig', '', true, 0) : $serviz[172];
        $this->modif    = import('modif');
        $this->uuser    = import('uuser');
        $this->modif_ok = ($this->uuser == 'old' && $this->modif == 1 && $userprefs[1] != '');
    }
    
    public function USR_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $out = '';
        if ($serviz[28] != 'on') {
            $out = '
    <div class="text-center web342">'.$web[143];
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out .= '
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            return array('USR', $out);
        }
        elseif ($members[19] == '0' || ($members[19] == '3' && ($pseudo != $serviz[31] || $pseudo != $serviz[176])) && !$this->modif_ok) {
            $out .= '
<script>
alert("'.addslashes($web[512]).'");
window.location="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng).'";
</script>';
            return array('USR', $out);
        }
        return array('');
    }
    
    public function USR_content() {
        global $lang, $lng, $web, $nom, $serviz, $urlrw, $site, $z2, $userprefs, $aml, $wbm, $user,
               $members, $drtuser, $supervision, $_DOMAIN, $_SECURE, $_HTTPONLY, $page, $meskin, 
               $skn_logo, $help, $charset, $headinc;
        $topmess       = getLabel($nom[($lng == $lang[0] ? 34 : 35)]);
        $this->topmess = mb_substr($topmess, 0, 1, $charset) == '§' ? mb_substr($topmess, 1, mb_strlen($topmess ,$charset) ,$charset) : $topmess;
        $crypt         = isset($_POST['crypt']) ? strip_tags($_POST['crypt']) : NULL;
        $cryptok       = (!$crypt) ? false : chk_crypt($crypt);
        $setusercookie = import('setusercookie');
        $REMOTE_ADDR   = getIPadress($site[6] == 'on' ? (isset($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']): $_SERVER['REMOTE_ADDR']);
        $out           = '';
        switch ($setusercookie) {
        case NULL :
            $token      = uniqid(rand(), true);
            $token_time = time();
            setcookie(PREF_COOKIE, $token.CONNECTOR.$token_time, time() + (30 * 60), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
            break;
        case 1 :
            if (isset($_COOKIE[PREF_COOKIE]))
			{
				$tokens     = explode(CONNECTOR, $_COOKIE[PREF_COOKIE]);
				$token_time = time() - (15 * 60);
				$msg = $REMOTE_ADDR.'<br />'.(empty($tokens[0]) ? 'NULL' : $tokens[0]).' => '.@intval($token_time - $tokens[0] / 60);
			}
			else
			{
				$tokens[0] = '';
				$tokens[1] = '0';
			}
            if (empty($tokens[0]) || $tokens[1] < time() - (30 * 60)) {
                $out .= '
        <script>
        var sto = "'.str_replace('<br />', '\n', stripslashes($web[681])).'";
        alert(sto);
        </script>';
                $setusercookie = NULL;
                $token         = uniqid(rand(), true);
                $token_time    = time();
                setcookie(PREF_COOKIE, $token.CONNECTOR.$token_time, time() + (30 * 60), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
            }
            elseif ($tokens[1] + 2 > time()) {
                $out .= '
        <script>
        var sto = "'.str_replace('<br />', '\n', stripslashes($web[682])).'";
        alert(sto);
        </script>';
                $setusercookie = NULL;
                $token         = uniqid(rand(), true);
                $token_time    = time();
                setcookie(PREF_COOKIE, $token.CONNECTOR.$token_time, time() + (30 * 60), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
            }
            break;
        }
        $ctrl_spam  = import('code_pseudo', 'POST');
        $unreg      = import('unreg');
        $ulang      = import('ulang');
        $upseudo    = trim(import('upseudo'));
        $upseudo    = 1 == preg_match('/^[-a-zA-Z0-9_]{2,'.$serviz[148].'}$/', $upseudo) && mb_strtolower($upseudo) != 'admin' ? $upseudo : '';
        $uemail     = checkEmail(CutLongWord(import('uemail')));
        $uboxes     = import('uboxes');
        $ushow      = import('ushow');
        $usign      = WrapLongWords(stripslashes(import('usign')));
        $uuid       = import('uuid');
        $uuid2      = import('uuid2');
        $avatar     = import('avatar');
        $avatar     = substr($avatar, 0, 3) == 'ava' ? $avatar : 'ava-00';
        $uwebsite   = import('uwebsite');
        $uextavatar = import('uextavatar');
        $suite      = import('suite');
        $umailct    = import('umailct');
        $umpct      = import('umpct');
        $usendmail  = import('usendmail');
        $usendct    = import('usendct');
        $uredir     = import('uredir');
        $rgpd       = import('rgpd', 'POST', true, '');
        $ishttps    = 1 != preg_match('!^https!', $site[3]) ? false : true;
        $preprot    = $ishttps ? 'https://' : 'http://';
        $uwebsite   = empty($uwebsite) ? 'http://' : $uwebsite;
        $uextavatar = empty($uextavatar) ? $preprot : $uextavatar;
        $err_pseudo = (empty($upseudo) || $upseudo != import('upseudo')) && $setusercookie == 1 ? true: false;
        $notPassOK  = !empty($uuid) && (!ctrlPasswordOK($uuid));
        $err_uid    = ((empty($uuid) && $this->modif != '1') || $notPassOK) && $setusercookie == 1 ? true: false;
        $err_uid2   = $uuid != $uuid2 && $setusercookie == 1 ? true: false;
        $err_uemail = empty($uemail) && $setusercookie == 1 ? true: false;
        $err_uweb   = 'http://' != $uwebsite && 'https://' != $uwebsite && 1 != preg_match('/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/', $uwebsite) && $setusercookie == 1 ? true : false;
        $err_uext   = $avatar == 'ava-00' && 1 != preg_match('/(http|https|inc\/img\/avatars):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/', $uextavatar) && $setusercookie == 1 ? true : false;
        $err_uext   = $err_uext && !IsImage(substr($uextavatar, -3));
        $err_crypt  = $serviz[100] != '0' && $serviz[88] == 'on' && ($userprefs[1] == '' || $serviz[98] == '') && !$cryptok && $setusercookie == 1 ? true: false;
        $err_rgpd   = !empty($serviz[177]) && empty($rgpd) && !OK_RGPD_date($userprefs[1]) && $setusercookie == 1 ? true: false;
        $erreur     = '';
        $erreur    .= $err_pseudo ? '<li>'.$web[266].'</li>': '';
        $erreur    .= $err_uid    ? '<li>'.$web[302].'</li>': '';
        $erreur    .= $err_uid2   ? '<li>'.$web[466].'</li>': '';
        $erreur    .= $err_uemail ? '<li>'.$web[42].'</li>': '';
        $erreur    .= $err_uweb   ? '<li>'.$web[545].$web[51].$web[554].'</li>': '';
        $erreur    .= $err_uext   ? '<li>'.$web[545].$web[627].$web[554].'</li>': '';
        $erreur    .= $err_crypt  ? '<li>'.$web[529].'</li>': '';
        $erreur    .= $err_rgpd   ? '<li>'.$web[405].'</li>': '';
        $uwebsite   = $err_uweb ? 'http://' : $uwebsite;
        $uextavatar = $err_uext ? $preprot : $uextavatar;
        $usermess   = '';
        // contrôle en attente déjà inscrit
        if (is_file(MSGREP.$upseudo.DBEXT)) {
            $dbmsg = ReadDBFields(MSGREP.$upseudo.DBEXT);
            $dbmsg[1][31] = empty($dbmsg[1][31]) ? '0' : $dbmsg[1][31];
            if ($dbmsg[1][31] == '1' || $dbmsg[1][31] == '2') {
                switch($suite) {
                    case '' : // inscription en attente
                        $out = '
<br />
<p class="text-center"><strong>'.$web[577].'</strong></p>';
                        break;
                    case 'ok' : // confirmation mail
                        $md5 = md5(gy_decrypt(CRYPT_KEY, $dbmsg[0][0]));
                        if ($md5 == $dbmsg[1][8] && $uuid == $dbmsg[1][8]) {
                            $dbmsg[0][0]  = $md5;
                            $dbmsg[1][31] = 'ok';
                            WriteDBFields(MSGREP.$upseudo.DBEXT, $dbmsg);
                            unset($dbmsg);
                            $out = '
<script>
window.location="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 : 'connect.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'"
</script>';
                        } 
                        else {
                            $out = 'STOP : bad password';
                        }
                        break;
                    case 'go' : // confirmation webmaster
                        if ($userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176] || $drtuser[42] == 'admin') {
                            $uuid         = gy_decrypt(CRYPT_KEY, $dbmsg[0][0]);
                            $dbmsg[0][0]  = md5($uuid);
                            $dbmsg[1][31] = 'ok';
                            WriteDBFields(MSGREP.$upseudo.DBEXT, $dbmsg);
                            $out   .= sprintf($web[558], $upseudo);
                            $uemail = $dbmsg[1][3];
                            $to     = $uemail;
                            $sujet  = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).' - '.$web[515];
                            $bodycorps  = $web[245].sprintf($web[516], $upseudo, stripslashes($site[($lang[0] == $lng ? 0 : 11)])).'<br /><br />';
                            $bodycorps  .= $web[49].' '.$upseudo.'<br />'.$web[300].' : '.$uuid.'<br />'.$web[517];
                            $bodycorps  .= '<a href="'.$site[3].'index.php?lng='.$lng.'">'.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'</a><br />';
                            $bodycorps  .= $web[235].'<br />'.$user[0].'<br />';
                            eMailHtmlTo($sujet,$bodycorps,$to);
                        } 
                        else {
                            $out = '
<br />
<p class="text-center"><strong>'.$web[513].'</strong></p>';                    
                        }
                        break;
                    case 'no' : // refus
                        if ($userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176] || $drtuser[42] == 'admin') {
                            DestroyDBFile(MSGREP.$upseudo.DBEXT);
                            $uemail = $dbmsg[1][3];
                            $to     = $uemail;
                            $sujet  = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).' - '.$web[518];
                            $bodycorps  = $web[240].sprintf($web[519], $upseudo, stripslashes($site[($lang[0] == $lng ? 0 : 11)])).'<br /><br />';
                            $bodycorps  .= $web[235].'<br />'.$user[0].'<br />';
                            eMailHtmlTo($sujet,$bodycorps,$to);                    
                            $out = '
<br />
<p class="text-center"><strong>'.$web[518].'<br />'.$upseudo.'</strong></p>';                    
                        } 
                        else {
                            $out = '
<script> window.location="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-0-0'.$z2 : 'connect.php?lng='.$lng.'&tconfig=0'.$z2).'" </script>';
                        }
                        break;
                    default: /// attente de confirmation
                        switch($members[19]) {
                        case 1 :
                            $out = '
<br />
<p class="text-center"><strong>'.$web[513].'</strong></p>';
                            break;
                        case 2 :
                            $out = '
<br />
<p class="text-center"><strong>'.$web[514].'</strong></p>';
                            break;
                        }
                        break;
                }
                return array('USR', $out);
            }
        }
        if ($suite != '') {
            switch($suite) {
                case 'ok' : // confirmation mail
                    $out = '
<script>
window.location="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 : 'connect.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'"
</script>';
                    break;
                case 'no' : // refus
                    $out = '
<br />
<p class="text-center"><strong>'.$web[518].'</strong></p>';
                    break;
                default :
                    $out = '
<script> window.location="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng).'" </script>';
            }
            return array('USR', $out);
        }
        // enregistrement nouveau ou modif
        if ($setusercookie == 1 && empty($ctrl_spam)) {
            $aconnect  = isset($_COOKIE[CNCT_COOKIE]) ? explode(CONNECTOR, gy_decrypt(CRYPT_KEY, $_COOKIE[CNCT_COOKIE])) : array(0, '');
            $is_pseudo = !empty($aconnect[1]);
            $pseudok   = ($this->uuser == 'old' && $userprefs[1] == $upseudo && $is_pseudo) || $this->uuser == 'new' ? true : false;
            if ($pseudok) {
                $msg    = '';
                $dbmail = array();
                $bad    = array('.', '..', 'index.php');
                $files  = scandir(MSGREP);
                $files  = array_diff($files, $bad);
                foreach ($files as $file) {
                    if ($file == $upseudo.DBEXT) {
                        if ($this->uuser == 'new') {
                            $pseudok = false;
                            $msg     = $web[231];
                            break;                
                        }
                    }
                    else {
                        $userdb = ReadDBFields(MSGREP.$file);
                        if (!empty($userdb[1][3])) $dbmail[] = $userdb[1][3];
                    }
                }
            } 
            else $msg = $web[404];        
            if ($pseudok && ($this->uuser == 'new' || ($this->modif == 1 && $userprefs[2] != $uemail)) && in_array($uemail, $dbmail)) {
                $pseudok    = false;
                $msg       .= ' - '.$web[557];
                $err_uemail = true;
                $err_uid    = $uuid != $uuid2 ? true: false;
				$err_uid    = $uuid != '' ? true: false;
                $err_uid2   = $uuid != $uuid2 ? true: false;
            }
            if ($pseudok) {
                $continue = true;
                if (($serviz[100] != '0' && $serviz[88] == 'on' && ($userprefs[1] == '' || $serviz[98] == '')) && $err_crypt) {
                    $msg     .= ' - '.$web[529];
                    $continue = false;
                }
                if ($continue) {
                    if ($uextavatar != $preprot) {
                        $imghttps   = 1 != preg_match('!^https!', $uextavatar) ? false : true;
                        $uextavatar = $ishttps && !$imghttps ? 'inc/img/avatars/'.basename($uextavatar) : $uextavatar;
                        $avaexist   = $ishttps && !$imghttps ? CHEMIN.$uextavatar : $uextavatar;
                        if (file_exists($avaexist)) {
                            list($wimg, $himg, $timg, $aimg) = getimagesize($avaexist);
                            if ($wimg == 0 || $himg == 0 || $wimg > 64 || $himg > 64) {
                                $msg .= ' - '.$web[628];
                                $continue = false;
                            }
                        }
                    }
                }
                if ($continue && empty($erreur)) {
                    $uuid    = empty($uuid) && $this->uuser == 'new' ? GenerateUID() : $uuid;
					$apachepassword  = Md5Crypt::apache ($uuid, $salt ='');
                    $userdb  = is_file(MSGREP.$upseudo.DBEXT) ? ReadDBFields(MSGREP.$upseudo.DBEXT) : array();
                    $lng     = $ulang;
                    $uavaext = !empty($userdb[1][22]) ? $userdb[1][22] : 'user21';
                    $uimgext = !empty($userdb[1][23]) ? $userdb[1][23] : 'user22';
                    $usign     = str_replace(chr(10), '<br />', RemoveConnector(stripslashes($usign)));
                    $cryptpass = $apachepassword;
                    if (is_file(CHEMIN.'data/config/.htpasswd')) {
                        $htpasswd = @file(CHEMIN.'data/config/.htpasswd');
                        $protoht  = trim($htpasswd[0]);
                        if (!empty($protoht)) $cryptpass = $protoht == '#:0-1-0' ? gy_crypt(CRYPT_KEY, $uuid) : $apachepassword;
                    }
                    $userdb[0][0] = $this->uuser == 'new' 
                      ? (in_array($members[19], array('1', '2')) ? gy_crypt(CRYPT_KEY, $uuid) : md5($uuid)) 
                      : ($this->modif == '1' && empty($uuid) ? $userdb[0][0] : md5($uuid));
                    $userdb[0][1]  = $cryptpass;
                    $userdb[1][0]  = '0';
                    $userdb[1][1]  = $ulang;    // langue
                    $userdb[1][2]  = $upseudo;  // pseudo
                    $userdb[1][3]  = $uemail;   // email
                    $userdb[1][4]  = '';        // inutilisé
                    $userdb[1][5]  = $ulang;    // langue
                    $userdb[1][6]  = $ushow;    // afficher pseudo dans connectés
                    $userdb[1][7]  = $usign;    // signature forum
                    $userdb[1][8]  = $this->modif == '1' && empty($uuid) ? $userdb[0][0] : md5($uuid);   // pass
                    $userdb[1][9]  = $avatar;                                                            // avatar
                    $userdb[1][10] = $uwebsite == 'https://' || $uwebsite == 'http://' ? '' : $uwebsite; // site web
                    $userdb[1][11] = '';    // inutilisé
                    $userdb[1][12] = '';    // éditeur
                    $userdb[1][13] = 'on';  // 'on' par défaut
                    $userdb[1][14] = is_file(MSGREP.$upseudo.DBEXT) && !empty($userprefs[13]) ? $userprefs[13] : GetCurrentDateTime(); // date enregistrement
                    $userdb[1][15] = is_file(MSGREP.$upseudo.DBEXT) && !empty($userprefs[14]) ? $userprefs[14] : GetCurrentDateTime(); // date dernière connexion
                    $userdb[1][16] = $uextavatar == $preprot || $avatar != 'ava-00' || $uavaext == 'on' ? '' : $uextavatar;        // avatar externe
                    $userdb[1][17] = is_file(MSGREP.$upseudo.DBEXT) ? $userprefs[14] : GetCurrentDateTime();                           // date déconnexion
                    $userdb[1][18] = @$userdb[1][18];   // pas autorisé MP
                    $userdb[1][19] = @$userdb[1][19];   // pas autorisé email
                    $userdb[1][20] = @$userdb[1][20];   // pas autorisé profils membres
                    $userdb[1][21] = @$userdb[1][21];   // pas autorisé liste des membres
                    $userdb[1][22] = $uavaext;         // interdire avatar externe
                    $userdb[1][23] = $uimgext;         // interdire image signature externe
                    $userdb[1][24] = $umailct;         // membres peuvent envoyer email
                    $userdb[1][25] = $umpct;           // membres peuvent envoyer MP
                    $userdb[1][26] = $usendmail;       // avertir par email arrivée MP
                    $userdb[1][27] = $usendct;         // accusé lecture MP
                    $userdb[1][28] = $this->uuser == 'new' || $rgpd == 'on' ? date('Ymd') : @$userdb[1][28]; // acceptation RGPD
                    $userdb[1][29] = '';               // inutilisé
                    $userdb[1][30] = $uredir;          // redirection vers l'accueil
                    $userdb[1][31] = $members[19] == '' ? 'ok' : ($this->uuser == 'new' ? $members[19] : $userdb[1][31]);   // flag inscription 
                    
                    if ($this->uuser == 'new') {
                        $padmin = trim($serviz[31]) == '' ? (trim($serviz[176]) == '' ? $user[0] : $serviz[176]) : $serviz[31];
                        if ($serviz[31] != '') {
                            $userdb[2][0] = $padmin.CONNECTOR.GetCurrentDateTime().CONNECTOR.'&nbsp; '.
                            $web[253].' '.sprintf($web[167], stripslashes($site[($lang[0] == $lng ? 0 : 11)]), $upseudo).CONNECTOR.'new'.CONNECTOR.
                                CONNECTOR.CONNECTOR.CONNECTOR.$serviz[43].CONNECTOR.substr($page[23], 4);
                        }
                        if (!empty($upseudo) && $ushow == 'on' && $serviz[111] == 'on') {
                            $regusers    = ReadDBFields(DBIPSTATS);
                            $usersonline = array();
                            $myIP        = '';
                            foreach ($regusers as $reg) {
                                if (!empty($reg[2])) {
                                    if ($upseudo == $reg[2]) $myIP = $reg[0];
                                    $usersonline[] = array($reg[2], $reg[0]);
                                }
                            }
                            @usort($usersonline,'AsciiCompare');
                            $uniqueusers   = array();
                            $uniqueusers[] = $usersonline[0];
                            for ($i = 1; $i < count($usersonline); $i++) {
                                if ($usersonline[$i][0] != $usersonline[$i-1][0]) {
                                    $uniqueusers[] = $usersonline[$i];
                                }
                            }
                            $visits  = ReadDBFields(USERREP.'visitsofday.dtb');
                            $today   = date('Ymd');
                            $visits1 = array();
                            foreach ($visits as $visit) if ($visit[1] == $today) $visits1[] = $visit;
                            $found = false;
                            foreach ($uniqueusers as $unuser) {
                                foreach ($visits1 as $visit) if ($visit[0] == $unuser[0]) $found = true;
                                if (!$found && !empty($unuser[0])) $visits1[] = array($unuser[0], $today);
                            }
                            WriteDBFields(USERREP.'visitsofday.dtb', $visits1);
                        }
                    }
                    if (!empty($userprefs[4])) include CHEMIN.'inc/lang/'.$userprefs[4].'-web'.INCEXT;
                    else include CHEMIN.'inc/lang/'.$lng.'-web'.INCEXT;
                    if ($this->uuser == 'new' && $supervision[11] == 'on') {
                        $sujet = $web[608];
                        $bodycorps  = $web[253].' '.$user[0].'<br /><br />'.sprintf($web[609], $upseudo, stripslashes($site[($lang[0] == $lng ? 0 : 11)])).'<br /><br />';
                        $bodycorps .= $web[455].getIPadress($site[6] == 'on' ? (isset($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']): $_SERVER['REMOTE_ADDR']).'<br /><br />';
                        $to    = $user[1];
                        eMailHtmlTo($sujet, $bodycorps, $to);
                    }
                    if ($members[19] == '' || $this->modif == '1') {
                        WriteDBFields(MSGREP.$upseudo.DBEXT, $userdb);
                        $userdata = '';
                        for ($i = 1; $i < 32; $i++) {
                            $stri      = sprintf("%02d", $i - 1);
                            $strlen    = empty($userdb[1][$i]) ? '03' : sprintf("%02d", strlen($userdb[1][$i]));
                            $userdata .= $stri.$strlen.(empty($userdb[1][$i]) ? 'off' : $userdb[1][$i]);
                        }
// avant                        $usertime = !empty($members[21]) ? intval($members[21]) : 157680000;
// avant                        $expires  = (is_file(CHEMIN.'admin/'.REDACREP.$userprefs[1].INCEXT) || $userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176]) ? 157680000 : $usertime;
//  avant               setcookie(USER_COOKIE, gy_crypt(CRYPT_KEY, $userdata), time() + $expires, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
						setcookie(USER_COOKIE, gy_crypt(CRYPT_KEY, $userdata), strtotime( '+365 days' ), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
                        $userconnect = gy_crypt(CRYPT_KEY, time().CONNECTOR.$userprefs[1].CONNECTOR.date('Ymdhi'));
 // avant               setcookie(CNCT_COOKIE, $userconnect, time() + $expires, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
						setcookie(CNCT_COOKIE, $userconnect, strtotime( '+365 days' ), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
                        $usermess = $web[161];
                        if ($this->uuser == 'old' && !empty($uuid)) {
                            UpdateCollaboratorPass($upseudo, md5($uuid));
                            UpdateProtectMember($upseudo, $cryptpass);
                        }
                        $out .= '
<br />
<p class="text-center"><b>'.$usermess.'</b></p>';
                        $out .= '
<br />
<script>
window.setTimeout(\'window.location="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-14-'.$this->tconfig.$z2 : 'compte.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'"\', 3000);
</script>';
                        return array('USR', $out);
                    }
                    WriteDBFields(MSGREP.$upseudo.DBEXT, $userdb);
                    if ($members[19] == '1') { // confirmation par mail
                        $to    = $uemail;
                        $sujet = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).' - '.$web[523];
                        $img   = explode('|', $page[4]);
                        $urli  = substr($img[0], 0, 1) == 'I' ? CHEMIN.'img/' : $meskin.'img/';
                        $logo  = $skn_logo != '' && empty($page[4]) ? $skn_logo : $urli.$img[1];
                        $bodycorps  = '<div style="margin:auto;padding:8px;width:600px;border: solid 1px #000000;border-radius:4px;">';
                        $bodycorps .= '<p style="text-align:center;"><img src="'.$site[3].$logo.'" style="max-width:580px;" /></p><hr />';
                        $bodycorps .= '<p style="text-align:left;font:12pt Arial;">';
                        $bodycorps .= $web[245].sprintf($web[524], $upseudo, stripslashes($site[($lang[0] == $lng ? 0 : 11)])).'<br /><br />';
                        $bodycorps .= $web[49].' <b>'.$upseudo.'</b><br />'.$web[300].' : <b>'.$uuid.'</b><br /><br />';
                        $bodycorps .= $web[525];
                        $bodycorps .= '<a href="'.$site[3].($site['URLR'] == 'on' ? $lng.'-'.$urlrw[15].'-1-ok-'.$upseudo.'-'.md5($uuid).'-'.$this->tconfig.$z2 : $site['USR'].'.php?lng='.$lng.'&suite=ok&upseudo='.$upseudo.'&uuid='.md5($uuid).'&amp;tconfig='.$this->tconfig.$z2).'">'.stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'</a><br />';
                        $bodycorps .= $web[235].'<br />'.$user[0].'<br />';
                        $bodycorps .= '</p></div>';
                        eMailHtmlTo($sujet, $bodycorps, $to);
                        $response = '<br /><p style="text-align:center;"><strong>'.$web[513].'</strong></p>';
                    }
                    elseif ($members[19] == '2') { // confirmation webmaster
                        $sujet = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).' - '.ucfirst($web[321]);
                        $img   = explode('|', $page[4]);
                        $urli  = substr($img[0], 0, 1) == 'I' ? CHEMIN.'img/' : $meskin.'img/';
                        $logo  = $skn_logo != '' && empty($page[4]) ? $skn_logo : $urli.$img[1];
                        $bodycorps  = '<div style="margin:auto;padding:8px;width:600px;border: solid 1px #000000;border-radius:4px;">';
                        $bodycorps .= '<p style="text-align:center;"><img src="'.$site[3].$logo.'" style="max-width:580px;" /></p><hr />';
                        $bodycorps .= '<p style="text-align:left;font:12pt Arial;">';
                        $bodycorps .= sprintf($web[520], $upseudo, $uemail, stripslashes($site[($lang[0] == $lng ? 0 : 11)])).'<hr />';
                        $bodycorps .= $web[521].' : ';
                        $bodycorps .= '<a href="'.$site[3].($site['URLR'] == 'on'
                            ? $lng.'-'.$urlrw[15].'-2-go-'.$upseudo.'-'.$this->tconfig.$z2 
                            : $site['USR'].'.php?lng='.$lng.'&suite=go&upseudo='.$upseudo.'&amp;tconfig='.$this->tconfig.$z2).'">'
                            .$site[3].($site['URLR'] == 'on'? $lng.'-'.$urlrw[15].'-2-go-'.$upseudo: 'user.php?lng='.$lng.'&suite=go&upseudo='.$upseudo).'</a><br />';
                        $bodycorps .= $web[522].' : ';
                        $bodycorps .= '<a href="'.$site[3].($site['URLR'] == 'on' 
                            ? $lng.'-'.$urlrw[15].'-2-no-'.$upseudo.'-'.$this->tconfig.$z2 
                            : $site['USR'].'.php?lng='.$lng.'&suite=no&upseudo='.$upseudo.'&amp;tconfig='.$this->tconfig.$z2).'">'
                            .$site[3].($site['URLR'] == 'on'? $lng.'-'.$urlrw[15].'-2-no-'.$upseudo: 'user.php?lng='.$lng.'&suite=no&upseudo='.$upseudo).'</a>';
                        eMailHtmlTo($sujet, $bodycorps);
                        $response = '<br /><p style="text-align:center;"><strong>'.$web[514].'</strong></p>';
                    }
                    $out .= $response;
                    return array('USR', $out);
                }
            }
            if (!empty($msg)) $out .= '<script>alert("'.addslashes($msg).'");</script>';
        }
        // suppression des préférences
        if ($unreg == 1) {
            $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
            if ($userprefs[1] == $dbmsg[1][2]) {
                $username = $userprefs[1];
                DeleteMemberProtect($username);
                DestroyMemberCol($username);
                DestroyMember($username);
                DestroyDBFile(CHEMIN.'admin/'.REDACREP.$username.INCEXT);
                DestroyDBFile(MSGREP.$username.DBEXT);
                DestroyDBFile(COUNTMSGREP.$username.DBEXT);
                DeleteAdmin($username);
                if ($supervision[11] == 'on') {
                    $sujet = $web[610];
                    $bodycorps  = $web[253].' '.$user[0].'<br /><br />'.sprintf($web[611], $username, stripslashes($site[($lang[0] == $lng ? 0 : 11)])).'<br /><br />';
                    $bodycorps .= $web[455].getIPadress($site[6] == 'on' ? (isset($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']): $_SERVER['REMOTE_ADDR']).'<br /><br />';
                    $to    = $user[1];
                    eMailHtmlTo($sujet, $bodycorps, $to);
                }
                $userprefs = array_fill(0, 31, '');
                if (isset($_COOKIE[USER_COOKIE])) @setcookie(USER_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
                if (isset($_COOKIE[PREF_COOKIE])) @setcookie(PREF_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
                if (isset($_COOKIE[CNCT_COOKIE])) @setcookie(CNCT_COOKIE, '', -1, $_DOMAIN, $_SECURE, $_HTTPONLY);
                if (isset($_COOKIE[COOKIE_COOKIE])) @setcookie(COOKIE_COOKIE, '', -1, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
                $usermess = $web[163];
                $out .= '
<br />
<p class="text-center"><b>'.$username.' '.$usermess.'...!</b></p>
<br />';
                $out .= '
<script>
window.setTimeout(\'window.location="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng).'"\', 3000);
</script>';
            }
            return array('USR', $out);
        }
        // cas normal inscription ou modif
        if (empty($userprefs[7])) $userprefs[7] = GenerateUID();
        else $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
        $headinc .= '
<script>
function VerifyForm() {
	var sto = "";
	var erreur = false;
	var modif = "'.$this->modif.'";
	var uid   = document.userprefnow.uuid.value;
	var uid2  = document.userprefnow.uuid2.value;
	var uweb  = document.userprefnow.uwebsite.value;
	var uext  = document.userprefnow.uextavatar.value;
	regexp = /^[-a-zA-Z0-9_]{2,'.$serviz[148].'}$/;
	if (!regexp.test(document.userprefnow.upseudo.value)) {
		sto += "  - '.str_replace('"', '\"', stripslashes($web[266])).'\n";
		document.userprefnow.upseudo.className = "errorInputText";
		erreur = true;
	}
	if (modif == "1" && uid != "") {
        regexp = /^\S{5,40}$/;
		if (!regexp.test(uid)) {
			sto += "  - '.str_replace('"', '\"', stripslashes($web[302])).'\n";
			document.userprefnow.uuid.className = "errorInputText";
			erreur = true;
		}
	}
	if (uid != uid2) {
		sto += "  - '.str_replace('"', '\"', stripslashes($web[466])).'\n";
		document.userprefnow.uuid.className = "errorInputText";
		document.userprefnow.uuid2.className = "errorInputText";
		erreur = true;
	}
	regexp = /^[^\.\s]+(\.[^\.\s]+)*@[^\.\s]+(\.[^\.\s]+)+$/;
	if (!regexp.test(document.userprefnow.uemail.value)) {
		sto += "  - '.str_replace('"', '\"', stripslashes($web[42])).'\n";
		document.userprefnow.uemail.className = "errorInputText";
		erreur = true;
	}';
        $headinc .= '
	regexp = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
    if (uweb != "http://" && uweb != "https://" && !regexp.test(uweb)) {
        sto += "  - '.str_replace('"', '\"', stripslashes($web[545].$web[51].$web[554])).'\n";
		document.userprefnow.uwebsite.className = "errorInputText";
		document.userprefnow.uwebsite.value = "http://";
        erreur = true;
    }';
        if ($page[23] != 'none') {
            $headinc .= '
	regexp = /(http|https|inc/img/avatars):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
    if (uext != "'.$preprot.'" && !regexp.test(uext)) {
        sto += "  - '.str_replace('"', '\"', stripslashes($web[545].$web[627].$web[554])).'\n";
		document.userprefnow.uextavatar.className = "errorInputText";
		document.userprefnow.uextavatar.value = "'.$preprot.'";
        erreur = true;
    }';
        }
        if ($serviz[100] != '0' && ($serviz[98] == '' || $userprefs[1] == '') && $crypt) {
            $headinc .= '
    regexp = /^[a-zA-Z0-9_]{2,20}$/;
	if (!regexp.test(document.userprefnow.crypt.value)) {
		sto += "  - '.str_replace('"', '\"', stripslashes($web[529])).'\n";
		document.userprefnow.crypt.className = "errorInputText";
		erreur = true;
	}';
        }
        $headinc .= '
	if (erreur) {
        sto = "'.str_replace('"', '\"', stripslashes($web[265])).'\n\n" + sto;
		alert(sto);
		return false;
	}
}
</script>';
        if (!empty($erreur)) $out .= displayErrorMsg($web[638], $erreur);
        $out .= '
<div class="text-center w-100 m-auto user-form">
	<p class="text-center">'.$web[156].'</p>
	<p class="text-center">'.$web[157].'</p>
	<hr />
  <div class="text-left w-100">';
        if (!empty($usermess)) {
            $out .= '
	<p class="text-center"><b>'.$usermess.'</b></p>
	<br />';
        }
        if ($userprefs[1] != '') $value_pseudo = 'value="'.$userprefs[1].'" readonly="readonly"';
        else $value_pseudo = 'value="'.$upseudo.'"';
        $out .= '
    <style>
    .testuid .input-group-text, .confirmuid .input-group-text { margin-top: 0.4rem; height: 3.35rem; }
    .testuid .input-group-text i, .confirmuid .input-group-text i { font-size: 1.5rem; }
    .testuid .popuserpwd { padding-right: 14px; }
    .userselect { background-color: inherit; }
    </style>
    <script>
        $("#testuid").on("keyup", function(e) {
          var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\\\W).*$", "ig");
          var mediumRegex = new RegExp("^(?=.{8,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
          var okRegex = new RegExp("(?=.{8,}).*", "g");
          if (okRegex.test($(this).val()) === false) {
            $("#testuid-strength").removeClass().addClass("alert alert-error").html("'.$help[21].'");
          } else if (strongRegex.test($(this).val())) {
            $("#testuid-strength").removeClass().addClass("alert alert-success").html("'.$help[22].'");
          } else if (mediumRegex.test($(this).val())) {
            $("#testuid-strength").removeClass().addClass("alert alert-info").html("'.$help[23].'");
          } else {
            $("#testuid-strength").removeClass().addClass("alert alert-error").html("'.$help[24].'");
          }
          return true;
        });
      });
    </script>
	<form name="userprefnow" 
      action="'.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[15].'-'.$this->tconfig.$z2 
        : $site['USR'].'.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
        method="post" 
        onsubmit="return VerifyForm(); return false;">
	  <input type="hidden" name="setusercookie" value="1" />';
        if ($this->modif == '1') {
            $out .= '
	  <input type="hidden" name="modif" value="1" />
	  <input type="hidden" name="uuser" value="old" />';
        } 
        else
            $out .= '
	  <input type="hidden" name="uuser" value="'.$this->uuser.'" />
      <span class="d-none"><input type="text" name="code_pseudo" value="" /></span>';
        $out .= '
	  <fieldset class="mt-4"><legend>'.$web[377].'</legend>
        <div class="form-row">
		  <div class="col-md-5">&bull; '.$web[49].'</div>
		  <div class="col-md-7">
            <input type="text"  class="'.($err_pseudo ? 'errorInputText' : 'texte').' form-control" name="upseudo" '.$value_pseudo.' />
          </div>
        </div>
        <div class="form-row">
		  <div class="col-md-12" id="testuid-strength"></div>
        </div>
        <div class="form-row">
		  <div class="col-md-5">&bull; '.$web[300].' :</div>
		  <div class="col-md-5 col-10 pr-0">
            <div class="testuid input-group mb-3 pr-0 w-100">
              <input 
                id="testuid" 
                type="password" 
                class="'.($err_uid ? 'errorInputText' : 'texte').' form-control float-left" 
                name="uuid" 
                value="'.($this->modif == '1' ? '' : ($userprefs[1] != '' ? $userprefs[7] : $uuid)).'" 
              />
              <div id="testuid-eye" class="input-group-append c-pointer">
                <span class="input-group-text"><i id="testuid-i" class="far fa-eye"></i></span>
              </div>
              <script>
                document.getElementById("testuid-eye").addEventListener("click", function(e){
                  var pwd = document.getElementById("testuid");
                  var eye = document.getElementById("testuid-i");
                  if(pwd.getAttribute("type") == "password") {
                    pwd.setAttribute("type", "text");
                    eye.setAttribute("class", "far fa-eye-slash");
                  } else {
                    pwd.setAttribute("type", "password");
                    eye.setAttribute("class", "far fa-eye");
                  }
                });
              </script>
            </div>
          </div>
		  <div class="col-md-2 col-2 px-0">
            '.($this->modif == '1' ? '
            <script>
              $(document).ready(function(){
                $(\'.popuserpwd\').popover({
                  title:"'.$web[300].'",
                  content:"'.$help[3].'",
                  trigger:"hover",
                  placement:"auto",
                  html:true
                });
              });
            </script>
            <div class="overpop">&nbsp;
              <a class="popuserpwd float-left" title="">
                <i class="far fa-comment-dots"></i>
              </a>
            </div>
            ' : '').'
          </div>
        </div>
        <div class="form-row">
		  <div class="col-md-5">&bull; '.$web[467].' :</div>
		  <div class="col-md-5 col-10 pr-0">
            <div class="confirmuid input-group mb-3 px-0 w-100">
              <input 
                id="confirmuid" 
                type="password" 
                class="'.($err_uid ? 'errorInputText' : 'texte').' form-control inputuid float-left" 
                name="uuid2" 
                value="'.($this->modif == '1' ? '' : ($userprefs[1] != '' ? $userprefs[7] : $uuid2)).'" 
              />
              <div id="confirmuid-eye" class="input-group-append c-pointer">
                <span class="input-group-text"><i id="confirmuid-i" class="far fa-eye"></i></span>
              </div>
              <script>
                document.getElementById("confirmuid-eye").addEventListener("click", function(e){
                  var pwd = document.getElementById("confirmuid");
                  var eye = document.getElementById("confirmuid-i");
                  if(pwd.getAttribute("type") == "password") {
                    pwd.setAttribute("type", "text");
                    eye.setAttribute("class", "far fa-eye-slash");
                  } else {
                    pwd.setAttribute("type", "password");
                    eye.setAttribute("class", "far fa-eye");
                  }
                });
              </script>
            </div>
          </div>
		  <div class="col-md-1 col-1 px-0">&nbsp;</div>
        </div>
        <div class="form-row">
		  <div class="col-md-5">&bull; '.$web[50].'</div>
		  <div class="col-md-7">
            <input 
              type="text" 
              class="'.($err_uemail ? 'errorInputText' : 'texte').' form-control" 
              name="uemail" 
              value="'.(empty($userprefs[2]) ? $uemail : $userprefs[2]).'" 
            />
          </div>
        </div>
        <div class="form-row">
		  <div class="col-md-5">&bull; '.$web[51].'</div>
		  <div class="col-md-7">
            <input 
              type="text" 
              class="'.($err_uweb ? 'errorInputText' : 'texte').' form-control" 
              name="uwebsite" 
              value="'.(empty($userprefs[9]) ? $uwebsite : $userprefs[9]).'" 
            />
          </div>
        </div>
        <div class="form-row">
		  <div class="col-md-5">&bull; '.$web[219].'</div>
		  <div class="col-md-7">
            <textarea name="usign" class="form-control">'.(empty($userprefs[6]) ? $usign : stripslashes($userprefs[6])).'</textarea>
          </div>
	    </div>';
        $out .= '
        <div class="form-row mt-4">
          <div class="col-10 col-sm-10 col-md-6"><label for="ushow">&bull; '.$web[213].'</label></div>
          <div class="col-2 col-sm-2 col-md-2 form-check pt-1">
            <input type="checkbox" class="form-check-input" id="ushow" name="ushow"'.Checked($userprefs[5] == 'on' || $ushow == 'on').' />
          </div>
        </div>
        <div class="form-row">
          <div class="col-10 col-sm-10 col-md-6"><label for="umailct">&bull; '.$web[654].'</label></div>
          <div class="col-2 col-sm-2 col-md-2 form-check pt-1">
              <input type="checkbox" class="form-check-input" id="umailct" name="umailct"'.Checked($userprefs[23] == 'on' || $umailct == 'on').' />
          </div>
        </div>';
        if ($serviz[18] != 'on') { $out .= '
        <div class="form-row">
          <div class="col-10 col-sm-10 col-md-6"><label for="umpct">&bull; '.$web[655].'</label></div>
          <div class="col-2 col-sm-2 col-md-2 form-check pt-1">
            <input type="checkbox" class="form-check-input" id="umpct" name="umpct"'.Checked($userprefs[24] == 'on' || $umpct == 'on').' />
          </div>
        </div>
        <div class="form-row">
          <div class="col-10 col-sm-10 col-md-6"><label for="usendmail">&bull; '.$web[656].'</label></div>
          <div class="col-2 col-sm-2 col-md-2 form-check pt-1">
            <input type="checkbox" class="form-check-input" id="usendmail" name="usendmail"'.Checked($userprefs[25] == 'on' || $usendmail == 'on').' />
          </div>
        </div>
        <div class="form-row">
          <div class="col-10 col-sm-10 col-md-6"><label for="usendct">&bull; '.$web[657].'</label></div>
          <div class="col-2 col-sm-2 col-md-2 form-check pt-1">
            <input type="checkbox" class="form-check-input" id="usendct" name="usendct"'.Checked($userprefs[26] == 'on' || $usendct == 'on').' />
          </div>
	    </div>';
        }
        $out .= '
	  </fieldset>
	  <fieldset class="pt-2"><legend>'.$web[378].'</legend>';
        if ($lang[1] != '') $out .= '
        <div class="form-row">
		  <div class="col-7 col-sm-7 col-md-5">&bull; '.$web[155].'</div>
		  <div class="col-5 col-sm-5 col-md-7">
			<select class="userselect custom-select-sm form-control-lg" name="ulang">
			  <option value="'.$lang[0].'"'.Selected($ulang == $lang[0] || $userprefs[0] == $lang[0]).'>'.$lang[0].'</option>
			  <option value="'.$lang[1].'"'.Selected($ulang == $lang[1] || $userprefs[0] == $lang[1]).'>'.$lang[1].'</option>
			</select>
		  </div>
	    </div>
          ';
        else $out .= '
		  <input type="hidden" name="ulang" value="'.$lang[0].'" />';
        $out .= '
        <div class="form-row">
		  <div class="col-5 col-sm-5 col-md-5">
            <label for="uredir">&bull; '.$web[475].'</label>
          </div>
		  <div class="col-4 col-sm-2 col-md-4 form-check">
            <input type="checkbox" class="mt-2 form-check-input" id="uredir" name="uredir"'.Checked($uredir == 'on' || $userprefs[29]).' />
          </div>
		</div>
        <div class="w-auto">';
        if ($page[23] != 'none') {
            $out .= '
              <fieldset class="w-auto m-auto usermainava"><legend>'.$web[303].'</legend>
                <div class="table-responsive-md divuserava">
                  <table class="table table-borderless m-auto tbluseravaW">
                    <tr>
            ';
            @include CHEMIN.'inc/img/avatars/'.$page[23].'.inc';
            $nbrimgavatar = 0; $j = $imgavatars;
            for ($i = 1; $i < $imgavatars; $i++) {
                $ava  = substr('0'.(string)$i, -2);
                $out .= '
			          <td class="text-center">
                        <label for="'.$ava.'">
                          <i class="ava-'.$ava.'" title="'.$page[23].'-'.$ava.'"></i>
			              <div>
                            <input id="'.$ava.'" type="radio" value="ava-'.$ava.'" name="avatar"'.Checked($avatar == 'ava-'.$ava || $userprefs[8] == 'ava-'.$ava).' />
                          </div>
                        </label>
			          </td>';
                $nbrimgavatar++; $j--;
                if ($nbrimgavatar == 7 && $j != 0) {
                    $nbrimgavatar = 0;
                    $out .= '
                    </tr>
		            <tr>
            ';
                }
            }
            $vid = 7 - $imgavatars%7 ;
            if ($vid != 7) {
                for ($i = 0; $i < $vid; $i++)
                    $out .= '
			          <td class="text-center">&nbsp;</td>';
            }
            $out .= '
		            </tr>
		          </table>
		        </div>';
            $out .= '
              </fieldset>';
            if ($userprefs[21] != 'on') {
                $out .= '
                <div class="text-center divuseravaextW">
                  <label>
                    <input 
                      type="radio" 
                      value="ava-00" name="avatar"
                      '.Checked(($avatar == 'ava-00' && $uextavatar != $preprot) || ($userprefs[8] == 'ava-00' || (!empty($userprefs[15]) && $userprefs[15] != $preprot))).' 
                    />
                    &nbsp;'.$web[627].' :
                  </label>
                  <script>
                    $(document).ready(function(){
                      $(\'.popavaext\').popover({
                        title:"'.$web[627].'",
                        content:"'.$help[8].'",
                        trigger:"hover",
                        placement:"auto",
                        html:true
                      });
                    });
                  </script>
                  <span class="overpop">&nbsp;
                    <a class="popavaext" title="">
                      <i class="far fa-comment-dots"></i>
                    </a>
                  </span>
                  <div class="w-100">
                    <input 
                      type="text" 
                      class="'.($err_uext ? 'errorInputText' : 'texte').' userextavaW form-control" 
                      name="uextavatar" 
                      value="'.($uextavatar == $preprot ? (empty($userprefs[15]) ? $preprot : $userprefs[15]) : $uextavatar).'" 
                    />
                  </div>
                </div>
                <div class="clearfix"></div>';
                if ($userprefs[8] == 'ava-00' && !empty($userprefs[15]))
                    $out .= '
                <div class="text-center w-100 m-auto">
                  <img src="'.$userprefs[15].'" alt="" title="'.$userprefs[1].'" />
                </div>';
            }
        }
        $out .= '
		</div>
	  </fieldset>';
        if (!empty($serviz[177]) && !OK_RGPD_date($userprefs[1])) $out .= '
	  <br />
	  <fieldset><legend>'.$web[14].'</legend>
        <p><strong>'.$web[646].'</strong></p>
        <p>'.$web[684].'</p>
        <div>
          <label for="rgpd">'.$web[415].' : </label><input type="checkbox" id="rgpd" name="rgpd"'.Checked($rgpd).' />
        </div>
      </fieldset>
	  <br />';
        if ($serviz[100] != '0' && $serviz[88] == 'on' && ($userprefs[1] == '' || $serviz[98] == '')) {
            $lbl = $serviz[100] == '3' ? $web[642] : '';
            $out .= '
              <div class="text-center">'.dsp_crypt(0, 1, 3, 2, $lbl, $serviz[115] == 'on' ? $web[643] : '').'<div>';
            if ($serviz[100] == '1') $out .= '<br />';
            $out .= '
              <div class="text-center">'.($serviz[100] == '3' ? '' : $web[530]).'
                <input 
                  class="form-control mx-auto '.($err_crypt ? 'errorInputText' : 'texte').' inputcrypt" 
                  type="text" 
                  name="crypt" 
                  onpaste="return false;");" 
                />
              </div>';
        }
        $out .= '
	  <p class="text-center">'.SubmitButton($web[154]).'</p>
	</form>
  </div>
</div>';
        if ($userprefs[1] != '') { // suppression des préférences
            $out .= '
<hr />
<div class="text-center">
  <form name="userbye" 
    action="'.CHEMIN.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[15].'-'.$this->tconfig.$z2 
      : $site['USR'].'.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
      method="post">
	<input type="hidden" name="unreg" value="1" />
'.SubmitButton($web[162]).'
  </form>
</div>';
        }
        return array('USR', $out);
    }
    
    public function CMPT_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web, $z2, $members;
        $out = '';
        if ($serviz[28] != 'on') {
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out = '
    <div class="text-center web342">'.$web[143].'
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            $this->topmess = $web[317];
            return array('CMPT', $out);
        }
        elseif (empty($pseudo)) {
            $href2 = CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
              : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$this->tconfig.$z2);
            $out .= '
        <div class="text-center web342">'.$web[342];
            if ($members[19] != '0' && $members[19] != '3') {
                $out .= '
          <p class="text-center">
            '.SubmitButton($web[160], 'self.location.href=\''.$href2.'\'').'
          </p>';
            }
            $out .= '
        </div>';
            $this->topmess = $web[317];
            return array('CMPT', $out);
        }
        return array('');
    }
    
    public function CMPT_content() {        
        global $lang, $lng, $web, $help, $serviz, $urlrw, $site, $z2, $userprefs, 
               $page, $members, $templates, $xposbox;
        $usermess = import('usermess');
        $action   = import('action', 'POST');
        if ($action == 1) {
            $list = ReadDBFields(NEWSLET_LIST);
            for ($i = 0; $i < count($list); $i++) {
                if ($list[$i][0] == $userprefs[1]) {
                    $list[$i][1] = $userprefs[2];
                    break;
                }
            }
            WriteDBFields(NEWSLET_LIST, $list);
        }
    	if (!OK_RGPD_date($userprefs[1])) 
		{
			setRGPDdate();
		}
        $out = '
<br />';
        if (!empty($usermess)) $out .= '
<p class="text-center"><b>'.$usermess.'</b></p>
<br />';
        $out .= '
<div class="table-responsive-md">
<table class="table bord text-center w-98 m-auto">
  <tr>
    <td class="forum2 w-45 cmptlbl">'.$web[49].'</td>
    <td class="rep cmptlbl"><b>'.$userprefs[1].'</b></td>
  </tr>
  <tr class="cmptlbl">
    <td class="forum2 w-45 cmptlbl">'.$web[50].'</td>
	<td class="rep cmptlbl"><b>'.$userprefs[2].'</b>';
        $list = ReadDBFields(NEWSLET_LIST);
        for ($i = 0; $i < count($list); $i++) {
            if ($list[$i][0] == $userprefs[1] && $list[$i][1] != $userprefs[2]) {
                $out .= '
      <script>
        $(document).ready(function(){
          $(\'.popsyncmail\').popover({
            title:"'.$web[50].'",
            content:"'.$help[9].'",
            trigger:"hover",
            placement:"auto",
            html:true
          });
        });
      </script>
      <span class="overpop float-right">&nbsp;
        <a class="popsyncmail" title="">&nbsp;
          <i class="far fa-comment-dots"></i>
        </a>
      </span>
	  <div class="float-right cmptsyncmail">
		<form name="syncmail" 
            action="'.CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[3].'-14-'.$this->tconfig.$z2 
              : 'compte.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
              method="post">
		  <input type="hidden" name="action" value="1" />
		  '.SubmitButton($web[631]).'
	    </form>
      </div>
      <div class="clearfix"></div>';
                break;
            }
        }
        $out .= '
    </td>
  </tr>
  <tr>
    <td class="forum2 w-45 cmptlbl">'.$web[51].'</td>
	<td class="rep cmptlbl"><b>'.($userprefs[9] == '' ? $web[316] : $userprefs[9]).'</b></td>
  </tr>
  <tr>
    <td class="forum2 w-45 cmptlbl">'.$web[219].'</td>
	<td class="rep cmptlbl"><b>'.($userprefs[6] != '' ? stripslashes($userprefs[6]) : $web[309]).'</b></td>
  </tr>
  <tr>
    <td class="forum2 w-45 cmptlbl">'.$web[155].'</td>
	<td class="rep cmptlbl"><b>'.$userprefs[0].'</b></td>
  </tr>';
        if ($page[23] != 'none') {
                $out .= '
  <tr>
    <td class="forum2 w-45 align-middle cmptlbl">'.$web[311].'</td>
    <td class="rep valignMiddle cmptlbl">';
            if (!empty($userprefs[15]) || $userprefs[8] != 'ava-00') {
                if ($userprefs[8] == 'ava-00' && !empty($userprefs[15])) $out .= '
      <img src="'.$userprefs[15].'" alt="'.$userprefs[1].'" title="'.$userprefs[1].'" />';
                else $out .= '
      <i class="'.$userprefs[8].' ava-img" title="'.$userprefs[1].'"></i>';
            }
            elseif ($userprefs[8] == 'ava-00') {
                $out .= '
	  <i class="ava-00 ava-img" title="'.$web[305].'"></i>';
            }
            $out .= '
	</td>
  </tr>';
        }
        $out .= '
  <tr>
    <td class="forum2 cmptlbl">'.$web[312].'</td>
	<td class="rep cmptlbl"><b>'.$web[$userprefs[5] != '' ? 313 : 314].'</b></td>
  </tr>
  <tr>
	<td class="forum2 cmptlbl">'.$web[654].'</td>
	<td class="rep cmptlbl"><b>'.$web[$userprefs[23] != '' ? 313 : 314].'</b></td>
  </tr>
  <tr>
	<td class="forum2 cmptlbl">'.$web[655].'</td>
	<td class="rep cmptlbl"><b>'.$web[$userprefs[24] != '' ? 313 : 314].'</b></td>
  </tr>
  <tr>
	<td class="forum2 cmptlbl">'.$web[656].'</td>
	<td class="rep cmptlbl"><b>'.$web[$userprefs[25] != '' ? 313 : 314].'</b></td>
  </tr>
  <tr>
	<td class="forum2 cmptlbl">'.$web[657].'</td>
	<td class="rep cmptlbl"><b>'.$web[$userprefs[26] != '' ? 313 : 314].'</b></td>
  </tr>
  <tr>
	<td class="forum2 cmptlbl">'.$web[475].'</td>
	<td class="rep cmptlbl"><b>'.$web[$userprefs[29] != '' ? 313 : 314].'</b></td>
  </tr>
  <tr>
    <td class="forum2 cmptlbl">'.$web[625].'</td>
	<td class="rep cmptlbl"><b>'.(isset($userprefs[13]) ? FormatDate($userprefs[13]) : '???').'</b></td>
  </tr>
  <tr>
    <td class="forum2 cmptlbl">'.$web[626].'</td>
    <td class="rep cmptlbl"><b>'.(isset($userprefs[14]) ? FormatDate($userprefs[14]) : '???').'</b></td>
  </tr>
  <tr>
    <td class="forum2 cmptlbl">'.$web[694].'</td>
    <td class="rep cmptlbl"><b>'.(isset($userprefs[27]) ? FormatDate($userprefs[27]) : '???').'</b></td>
  </tr>
</table>
</div>
<div class="text-center">
  <form 
    name="userpref2" 
    action="'.CHEMIN.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[15].'-6-1-old-'.$this->tconfig.$z2 
      : $site['USR'].'.php?lng='.$lng.'&amp;modif=1&amp;uuser=old&amp;tconfig='.$this->tconfig.$z2).'" 
      method="post">
    '.SubmitButton($web[308]).'
  </form>
  <hr />
  <form 
    name="userbye" 
    action="'.CHEMIN.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[15].'-7-1-'.$this->tconfig.$z2 
      : $site['USR'].'.php?lng='.$lng.'&amp;unreg=1&amp;tconfig='.$this->tconfig.$z2).'" 
      method="post">
    '.SubmitButton($web[162]).'
  </form>
</div>';
        $this->topmess = $web[317].' - '.$userprefs[1];
        return array('CMPT', $out);
    }
    
    public function CNCT_ok($pseudo, $lng) {
        global $site, $urlrw, $serviz, $web;
        if (is_file(MSGREP.'.dtb')) @unlink(MSGREP.'.dtb');
        $out = '';
        if ($serviz[28] != 'on') {
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out = '
    <div class="text-center web342">'.$web[143].'
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            $this->topmess = $web[630];
            return array('CNCT', $out);
        }
		
        return array('');
    }
    
    public function CNCT_content() {
        global $lang, $lng, $web, $serviz, $urlrw, $site, $z2, $userprefs, $members, $headinc, $nom, 
               $drtuser, $supervision, $_DOMAIN, $_SECURE, $_HTTPONLY, $page, $charset, $cryptos;
        CreateDir(TEMPREP);
        $connect    = import('connect');
        $pseudo     = import('pseudo');
        $pseudo     = 1 == preg_match('/^[-a-zA-Z0-9_]{2,'.$serviz[148].'}$/', $pseudo) ? $pseudo : '';
        $uid        = import('uid');
        $uuser      = import('uuser');
        $err_pseudo = empty($pseudo) && $connect == 'on' && $uuser == 'old' ? true: false;
        $err_uid    = (empty($uid) || !ctrlPasswordOK($uid)) && $connect == 'on' && $uuser == 'old' ? true: false;
        $err_crypt  = $serviz[100] != '0' && ($userprefs[1] == '' || $serviz[98] == '') && $connect == 'on' && $uuser == 'old' ? true: false;
        $erreur     = '';
        $erreur    .= $err_pseudo ? '<li>'.$web[266].'</li>': '';
        $erreur    .= $err_uid ? '<li>'.$web[302].'</li>': '';
        $erreur    .= $err_crypt ? '<li>'.$web[529].'</li>': '';
        $out        = '';

        $this->topmess = $web[630];
        switch ($connect) {
        case 'on':
            if ($connect == 'on' && $uuser == 'new') {
                $userdest = $site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[15].'-5-new-'.$this->tconfig.$z2 
                  : $site['USR'].'.php?lng='.$lng.'&uuser=new&tconfig='.$this->tconfig.$z2;
                $out = '
<script> setTimeout(\'window.location="'.CHEMIN.$userdest.'"\', 300); </script>';
                return array('CNCT', $out, $web[630]);
            }
            if ($members[19] == '0' && !FileDBExist(MSGREP.$pseudo.DBEXT)) {
                $out = '
<script>
alert("'.addslashes($web[512]).'");
history.back();
</script>';
                return array('CNCT', $out);
            }
            if (is_file(TEMPREP.'cnt-'.$pseudo.DBEXT)) {
                $dbw = ReadDBFields(TEMPREP.'cnt-'.$pseudo.DBEXT);
                $dt  = GetCurrentDateTime() - $dbw[0][2];
                if ($dt > 60) {
                    unlink(TEMPREP.'cnt-'.$pseudo.DBEXT);
                } 
                else {
                    $ntc = $site['NTC'];
                    $nt  = $dbw[0][0];
                    if ($nt == $ntc) {
                        $location = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-16-'.$this->tconfig.$z2 : 'lostpass.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2);
                        $out = '
<script>
alert("'.sprintf($web[614].$web[615], $pseudo).'");
window.location="'.$location.'";
</script>';
                        $out .= '<br /><p class="text-center"><strong>'.sprintf($web[614], $pseudo, $site['NTC']).'</strong>';
                        return array('CNCT', $out);
                    }
                }
            }
            if (is_file(TEMPREP.$pseudo.DBEXT)) {
                switch($members[19]) {
                case 1 :
                    $out = '
<br />
<p class="text-center"><strong>'.$web[513].'</strong></p>';
                    break;
                case 2 :
                    $out = '
<br />
<p class="text-center"><strong>'.$web[514].'</strong></p>';
                    break;
                }
                return array('CNCT', $out);
            }
            else {
                if (!empty($pseudo) && FileDBExist(MSGREP.$pseudo.DBEXT) && $uuser != 'new') {
                    $userdb = ReadDBFields(MSGREP.$pseudo.DBEXT);
                    if (isset($userdb[1][31]) && 'ok' != $userdb[1][31] && $pseudo != '') {
                        $out = '
<script>
alert("'.addslashes($web[679]).'");
history.back();
</script>';
                        $out .= '<p class="text-center"><br />'.$web[679].'</p>';
                        return array('CNCT', $out);
                    } 
                    elseif (isset($userdb[1][13]) && 'off' == $userdb[1][13] && $pseudo != '') {
                        $out = '
<script>
alert("'.addslashes($web[620]).'");
history.back();
</script>';
                        $out .= '<p class="text-center"><br />'.$web[620].'</p>';
                        return array('CNCT', $out);
                    } 
                    elseif (empty($userdb[1][3])) {
                        $location = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[15].'-3-'.$pseudo.'-'.$uuser.'-'.$this->tconfig.$z2 : $site['USR'].'.php?lng='.$lng.'&upseudo='.$pseudo.'&uuser='.$uuser.'&tconfig='.$this->tconfig.$z2);
                        $out = '
<script>
alert("'.addslashes($pseudo.stripslashes($web[374])).'");
window.location="'.$location.'"
</script>';
                        $out .= '<p class="text-center"><br /><strong>'.$pseudo.stripslashes($web[374]).'</strong></p>';
                        return array('CNCT', $out);
                    }
                    elseif (isset($userdb[1][8]) && md5($uid) == $userdb[1][8] && $pseudo != '') {
                        $userprefs[0]  = $userdb[1][1];
                        $userprefs[1]  = $userdb[1][2];
                        $userprefs[2]  = $userdb[1][3];
                        $userprefs[3]  = '';
                        $userprefs[4]  = $userdb[1][5];
                        $userprefs[5]  = $userdb[1][6];
                        $userprefs[6]  = $userdb[1][7];
                        $userprefs[7]  = $userdb[1][8];
                        $userprefs[8]  = $userdb[1][9];
                        $userprefs[9]  = $userdb[1][10];
                        $userprefs[10] = '';
                        $userprefs[11] = $userdb[1][12];
                        $userprefs[12] = $userdb[1][13];
                        $userprefs[13] = $userdb[1][14];
                        $userprefs[14] = GetCurrentDateTime();
                        $userprefs[15] = $userdb[1][16];
                        $userprefs[16] = $userdb[1][17];
                        $userprefs[17] = $userdb[1][18];
                        $userprefs[18] = $userdb[1][19];
                        $userprefs[19] = $userdb[1][20];
                        $userprefs[20] = $userdb[1][21];
                        $userprefs[21] = $userdb[1][22];
                        $userprefs[22] = $userdb[1][23];
                        $userprefs[23] = $userdb[1][24];
                        $userprefs[24] = $userdb[1][25];
                        $userprefs[25] = $userdb[1][26];
                        $userprefs[26] = $userdb[1][27];
                        $userprefs[27] = $userdb[1][28];
                        $userprefs[28] = '';
                        $userprefs[29] = $userdb[1][30];
                        $userprefs[30] = $userdb[1][31];
                        $userdata      = '';
                        for ($i = 0; $i < count($userprefs); $i++) {
                            $stri      = sprintf("%02d", $i);
                            $strlen    = empty($userprefs[$i]) ? '03' : sprintf("%02d", strlen($userprefs[$i]));
                            $userdata .= $stri.$strlen.(empty($userprefs[$i]) ? 'off' : $userprefs[$i]);
                        }
// avant                      $usertime = !empty($members[21]) ? intval($members[21]) : 157680000;
// avant                     $expires  = (is_file(CHEMIN.'admin/'.REDACREP.$userprefs[1].INCEXT) || $userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176]) ? 157680000 : $usertime;
// avant                      setcookie(USER_COOKIE, gy_crypt(CRYPT_KEY, $userdata), time() + $expires, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
						@setcookie(USER_COOKIE, gy_crypt(CRYPT_KEY, $userdata), strtotime( '+365 days' ), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);	
                        $userconnect = gy_crypt(CRYPT_KEY, time().CONNECTOR.$userprefs[1].CONNECTOR.date('Ymdhi'));
 // avant               setcookie(CNCT_COOKIE, $userconnect, time() + $expires, '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
						setcookie(CNCT_COOKIE, $userconnect, strtotime( '+365 days' ), '/', $_DOMAIN, $_SECURE, $_HTTPONLY);
                        DejaVote(DBIPSTATS);
                        $userdb[0][0]  = $userprefs[7];
                        $userdb[1][15] = $userprefs[14];
                        WriteDBFields(MSGREP.$userprefs[1].DBEXT, $userdb);
                        if (!defined('NO_CRYPT') && $serviz[100] > 0) include CRYPTREP.$cryptos[$serviz[100]].'.php';
                        if (is_file(TEMPREP.'cnt-'.$pseudo.DBEXT)) unlink(TEMPREP.'cnt-'.$pseudo.DBEXT);
                        $out .= '
<br />
<p class="text-center"><b>'.sprintf($web[167], stripslashes($site[($lang[0] == $lng ? 0 : 11)]).'...!', $userprefs[1]).'</b></p>';
                        $location = CHEMIN.($userprefs[29] == 'on' ? ($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng) : ($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-14-'.$this->tconfig.$z2 : 'compte.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2));
                        $out .= '
<br />
<script> window.setTimeout(\'window.location="'.$location.'"\', 2000); </script>';
                        return array('CNCT', $out);
                    }
                    elseif (md5($uid) == $userdb[0][0] && $pseudo != '' && $uuser == 'old') {
                        $location = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[15].'-3-'.$pseudo.'-'.$uuser.'-'.$this->tconfig.$z2 : $site['USR'].'.php?lng='.$lng.'&upseudo='.$pseudo.'&uuser='.$uuser.'&tconfig='.$this->tconfig.$z2);
                        $out .= '
<script>
alert("'.$pseudo.addslashes(stripslashes($web[374])).'");
window.location="'.$location.'"
</script>';
                        $out .= '<p class="text-center"><br /><strong>'.$pseudo.stripslashes($web[374]).'</strong>';
                        return array('CNCT', $out);
                    }
                    elseif ($pseudo != '') {
                        if ($supervision[12] == 'on') {
                            $uuid  = strlen($uid) > 3 ? substr($uid, 0, strlen($uid) - 3).'***' : '***';
                            $sujet = $web[606];
  //         				$body  = $web[253].' '.$user[0].'<br /><br />'.sprintf($web[607], $pseudo, $uuid).'<br /><br />';	                 
							$bodycorps   = $web[253].' '.$userprefs[2].'<br /><br />'.sprintf($web[607], $pseudo, $uuid).'<br /><br />';
                            $bodycorps .= $web[455].getIPadress($site[6] == 'on' ? (isset($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']): $_SERVER['REMOTE_ADDR']).'<br /><br />';
                            eMailHtmlTo($sujet, $bodycorps);
                        }
                        $ntc = $site['NTC'];
                        if ($ntc > 0) { // contrôle du nombre de tentatives
                            if (is_file(TEMPREP.'cnt-'.$pseudo.DBEXT)) {
                                $dbw = ReadDBFields(TEMPREP.'cnt-'.$pseudo.DBEXT);
                                $nt  = $dbw[0][0];
                            }
                            else {
                                $dbw = array();
                                $nt  = 0;
                            }
                            $nt++;
                            $dbw[0][0] = $nt;
                            $dbw[0][1] = getIPadress($site[6] == 'on' ? (isset($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']): $_SERVER['REMOTE_ADDR']);
                            $dbw[0][2] = GetCurrentDateTime();
                            WriteDBFields(TEMPREP.'cnt-'.$pseudo.DBEXT, $dbw);
                            if ($nt == $ntc - 1) {
                                $location = $site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng;
                                $out .= '
<script>
alert("'.sprintf($web[613], $pseudo, $ntc).'");
history.back();
<script>';
                                $out .= '<p class="text-center"><br />'.sprintf($web[613], $pseudo, $ntc).'</p>';
                                return array('CNCT', $out);
                            }
                            if ($nt == $ntc) {
                                $location = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-16-'.$this->tconfig.$z2 : 'lostpass.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2);
                                $out .= '
<script>
alert("'.sprintf($web[614], $pseudo).'");
window.location="'.$location.'";
</script>';
                                $out .= '<p class="text-center"><br />'.sprintf($web[614], $pseudo).'</p>';
                                return array('CNCT', $out);
                            }
                        }
                        $location = ($site['URLR'] == 'on') ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng;
                        $out .= '
<script>
alert("'.addslashes($web[231]).'");
history.back();
</script>';
                        $out .= '<p class="text-center"><br />'.$web[231].'</p>';
                        return array('CNCT', $out);
                    }
                }
                else {
                    if ($members[19] == '3' || ($pseudo != '' && $uid != '')) {
                        $userdest = $site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng;
                        $out .= '
<script> setTimeout(\'window.location="'.CHEMIN.$userdest.'"\', 300); <script>';
                    }
                }
            }
            return array('CNCT', $out);
            break;
        case 'off':
            $dbuser        = $userprefs[1];
            $userdb        = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
            $userdb[1][17] = GetCurrentDateTime();
            WriteDBFields(MSGREP.$userprefs[1].DBEXT, $userdb);
            $userprefs = array_fill(0, 31, '');
            ClearCookies();
            DejaVote(DBIPSTATS);
            $topmess = getLabel($nom[$lng == $lang[0] ? 34 : 35]);
            $topmess = mb_substr($topmess, 0, 1, $charset) == '§' ? mb_substr($topmess, 1, mb_strlen($topmess ,$charset) ,$charset) : $topmess;
            $out .= '
<br />
<p class="text-center"><b>'.$web[376].$dbuser.'...!</b></p>
<br />';
            $location = CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng);
            $out .= '
<script> setTimeout(\'window.location="'.$location.'"\', 3000); </script>';
            return array('CNCT', $out);
            break;	
        case 'no' ;
            if (!empty($userprefs[1])) {
                $out .= '
<div class="text-center m-auto mainConnect">
  <fieldset>'.
    fbox_user().'
  </fieldset>
</div>';
                return array('CNCT', $out);
                break;
            }
            else {
                $location = CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng);
                $out .= '
<script> setTimeout(\'window.location="'.$location.'"\', 3000); </script>';
                return array('CNCT', $out);
                break;
            }
        }
        $headinc .= '
<script>
function VerifyForm() {
    var sto = "";
    var messok = "";
    var erreur = false;
    var largeur = 300;
	var uid = document.userin.uid.value;

    regexp = /^[-a-zA-Z0-9_]{2,'.$serviz[148].'}$/;
    if (!regexp.test(document.userin.pseudo.value)) {
        sto += "  - '.addslashes($web[266]).'\n";
		document.userin.pseudo.className = "errorInputText";
        erreur = true;
    }
	/*regexp = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\W).{8,40}$/;*/
    regexp = /^\S{5,40}$/;
	if (!regexp.test(uid)) {
		sto += \'  - '.addslashes($web[302]).'\n\';
		document.userin.uid.className = "errorInputText";
		erreur = true;
	}
	';
        $headinc .= '
    if (erreur == true) {
        sto = "'.addslashes($web[638]).'\n\n" + sto;
        alert(sto);
        return false;
    }
}
</script>';
        if (!empty($erreur))
            $out .= displayErrorMsg($web[638], $erreur);
        if ($members[19] != "0" && $members[19] != "3") {
            $out .= '
<div class="text-center">
  <form name="usernew" action="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 : 'connect.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" method="post">
    <input type="hidden" name="connect" value="on"/>
    <input type="hidden" name="uuser" value="new"/>
    '.SubmitButton($web[160]).'
  </form>
</div>
<hr />';
        }
        $out .= '
<style>
#uid-eye, #pseudo-user { margin-top: 0.4rem; height: 3.35rem; }
#uid-eye i, #pseudo-user i { font-size: 1.5rem; }
</style>
';
        $out .= '
<form name="userin" 
    action="'.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[3].'-0-'.$this->tconfig.$z2 : 'connect.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
    method="post" 
    onsubmit="return VerifyForm(); return false;">
  <input type="hidden"  name="connect" value="on" />
  <input type="hidden" name="uuser" value="old"/>
  <div class="m-auto userCnct">
    <div class="input-group mb-3">
      <div id="pseudo-user" class="input-group-prepend">
        <span class="input-group-text"><i class="fas fa-user"></i></span>
      </div>
      <input 
        class="'.($err_pseudo ? 'errorInputText' : 'texte').' form-control" 
        type="text" 
        name="pseudo" 
        placeholder="'.$web[49].'" 
        value="'.$pseudo.'" 
      />
    </div>
    <div class="input-group mb-3">
      <input 
        id="uid" 
        type="password" 
        class="uid '.($err_uid ? 'errorInputText' : 'texte').' form-control float-left" 
        name="uid" 
        placeholder="'.$web[300].'" 
        value="'.$uid.'" 
      />
      <div id="uid-eye" class="input-group-append c-pointer" title="'.$web[473].'">
        <span class="input-group-text"><i id="uid-i" class="far fa-eye"></i></span>
      </div>
<script>
  document.getElementById("uid-eye").addEventListener("click", function(e){
    var pwd = document.getElementById("uid");
    var eye = document.getElementById("uid-i");
    if(pwd.getAttribute("type") == "password") {
      pwd.setAttribute("type", "text");
      eye.setAttribute("class", "far fa-eye-slash");
    } else {
      pwd.setAttribute("type", "password");
      eye.setAttribute("class", "far fa-eye");
    }
  });
</script>
    </div>';
$out .= '
    <div class="text-center">'.SubmitButton($web[52]).'</div>
  </div>
</form>
<div class="text-center">
  <a href="'.CHEMIN.($site['URLR'] == 'on'
    ? $lng.'-'.$urlrw[3].'-16-'.$this->tconfig.$z2 
    : 'lostpass.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" class="lostconnect">'.$web[592].'
  </a>
</div>';
        return array('CNCT', $out);
    }
    
    public function LOST_content() {
        global $lang, $lng, $web, $serviz, $urlrw, $site, $z2, $userprefs, $members, $headinc, 
               $drtuser, $supervision, $_DOMAIN, $_SECURE, $_HTTPONLY, $page, $charset;
        CreateDir(TEMPREP);
		$out = '';
        $action    = import('action');
        $pseudo    = import('pseudo');
        $email     = import('email');
        $ask       = import('ask');
        $err_email = (empty($email) || 1 != preg_match('/^[^\.\s]+(\.[^\.\s]+)*@[^\.\s]+(\.[^\.\s]+)+$/', $email)) && $ask == 1;
        $erreur    = '';
        $erreur   .= $err_email ? '<li>'.$web[42].'</li>': '';
        if ($action != 'lost' && !empty($action)) {
            $out .= BeginJavascript().'
alert("'.addslashes($web[599]).'");
window.location="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng).'";
'.EndJavascript();
            $this->topmess = $web[594];
            return array('LOST', $out);
        }
        if ($action == 'lost') {
            if (is_file(MSGREP.$pseudo.DBEXT)) {
                $userdb = ReadDBFields(MSGREP.$pseudo.DBEXT);
                if (isset($userdb[1][3]) && $userdb[1][3] != $email) {
                    $out .= BeginJavascript().'
alert("'.addslashes($web[599]).'");
window.setTimeout(\'window.location="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng).'"\', 1000);
'.EndJavascript();
                    $this->topmess = $web[594];
                    return array('LOST', $out);
                }
            }
            $newpass   = GenerateUID();
//            $cryptpass = crypt($newpass, '');
//            $decrypt   = crypt($newpass, '');
			$apachepassword  = Md5Crypt::apache ($newpass, $salt ='');
			$cryptpass = $apachepassword;
			 $decrypt   = $apachepassword;
            if (is_file(CHEMIN.'data/config/.htpasswd')) {
                $htpasswd = @file(CHEMIN.'data/config/.htpasswd');
                $protoht  = trim($htpasswd[0]);
                if (!empty($protoht)) {
                    $cryptpass = $protoht == '#:0-1-0' ? gy_crypt(CRYPT_KEY, $newpass) : $apachepassword;
                    $decrypt   = $protoht == '#:0-1-0' ? $newpass : $apachepassword;
                }
            }
            $userdb[0][0] = md5($newpass);
            $userdb[0][1] = $apachepassword;
            $userdb[1][8] = md5($newpass);
            WriteDBFields(MSGREP.$pseudo.DBEXT, $userdb);
            $numava = isset($userdb[2][8]) ? $userdb[2][8] : substr($page[23], 4);
            $padmin = trim($serviz[31]) == '' ? (trim($serviz[176]) == '' ? $user[0] : $serviz[176]) : $serviz[31];
            $msg = array(
                $padmin,
                GetCurrentDateTime(),
                $web[253].' '.sprintf($web[612], $pseudo),
                'new',
                '',
                '',
                '',
                $serviz[43],
                $numava);
            AppendDBFields(MSGREP.$pseudo.DBEXT, $msg);
            UpdateCollaboratorPass($pseudo, md5($newpass));
            UpdateProtectMember($pseudo, $decrypt);
            $sujet = $web[600];
            $bodycorps  = $web[601];
            $bodycorps .= $web[457].'<b>'.$pseudo.'</b><br /><br />';
            $bodycorps .= $web[602].'<b>'.$newpass.'</b><br /><br />';
            $bodycorps .= $web[603].'<br /><br /><a href="'.$site[3].'">'.$site[3].'</a>';
            eMailHtmlTo($sujet, $bodycorps, $email);
            if (is_file(TEMPREP.'cnt-'.$pseudo.DBEXT)) unlink(TEMPREP.'cnt-'.$pseudo.DBEXT);
            $email = import('email');
            $out .= '<div class="text-center afterlost">'.$web[604].'<br />'.$email.'</div>';
            $this->topmess = $web[594];
            return array('LOST', $out);
        }
        if ($ask == 1 && empty($erreur)) {
            $continue = true;
            $bad      = array('.', '..', 'index.php');
            $files    = scandir(TEMPREP);
            $files    = array_diff($files, $bad);
            foreach ($files as $file) {
                if (is_file(TEMPREP.$file) && substr($file, -3) == 'dtb') {
                    $userdb = ReadDBFields(TEMPREP.$file);
                    if (isset($userdb[1][3])) {
                        if ($email == $userdb[1][3]) {
                            $out .= BeginJavascript().'
alert("'.addslashes($web[596]).'");
                            '.EndJavascript();
                            $continue = false;
                            $erreur  .= '<li>'.$web[596].'</li>';
                        }
                    }
                }
            }
            if ($continue) {
                $pseudo = '';
                $files  = scandir(MSGREP);
                $files  = array_diff($files, $bad);
                foreach ($files as $file) {
                    if (is_file(MSGREP.$file) && substr($file, -3) == 'dtb') {
                        $userdb = ReadDBFields(MSGREP.$file);
                        if (isset($userdb[1][3])) {
                            if ($email == $userdb[1][3]) {
                                $pseudo = $userdb[1][2];
                                break;
                            }
                        }
                    }
                }
            }
            if ($continue) {
                if ($pseudo == '') {
                    $out .= BeginJavascript().'
alert("'.addslashes($web[595]).'");
'.EndJavascript();
                    $continue = false;
                    $erreur  .= '<li>'.$web[595].'</li>';
                }
            }
            if ($continue) {
                $sujet = $web[597];
                $bodycorps  = $web[253].' '.$pseudo.',<br /><br />';
                $bodycorps .= sprintf($web[598], stripslashes($site[($lang[0] == $lng ? 0 : 11)]), getIPadress($site[6] == 'on' ? (isset($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']): $_SERVER['REMOTE_ADDR']));
                $bodycorps .= '<a href="'.$site[3].'lostpass.php?lng='.$lng.'&amp;pseudo='.$pseudo.'&amp;email='.$email.'&amp;action=lost&amp;tconfig='.$this->tconfig.$z2.'">'.$site[3].'lostpass.php?lng='.$lng.'&amp;pseudo='.$pseudo.'&email='.$email.'&action=lost</a>';
                eMailHtmlTo($sujet, $bodycorps, $email);
                $email = import('email');
                $out .= '<div class="text-center afterlost">'.$web[605].'<br />'.$email.'</div>';
                $this->topmess = $web[594];
                return array('LOST', $out);
            } 
            else {
                $out .= BeginJavascript().'
window.location="'.CHEMIN.($site['URLR'] == 'on'? $lng.'-'.$urlrw[0]: 'index.php?lng='.$lng).'";
'.EndJavascript();
                $this->topmess = $web[594];
                return array('LOST', $out);
            }
        }
        $headinc .= '
<script>
function VerifyForm() {
    var sto    = "";
    var erreur = false;
    regexp = /^[^\.\s]+(\.[^\.\s]+)*@[^\.\s]+(\.[^\.\s]+)+$/;
    if (!regexp.test(document.userlostpass.email.value)) {
		sto += \'  - '.addslashes($web[42]).'\n\';
		document.userlostpass.email.className = "errorInputText";
        erreur = true;
    }
    if (erreur == true) {
		sto = \''.addslashes($web[638]).'\n\n\' + sto;
        alert(sto);
        return false;
    }
}
</script>';
        if (empty($action) && empty($ask)) {
            if (!empty($erreur)) $out .= displayErrorMsg($web[638], $erreur);
            $out .= '
<p class="text-center">'.$web[593].'</p>
<div class="text-center m-auto">
  <style>
    .mlost i { font-size: 1.5rem; width: 1.85rem; }
    .mlost .input-group-text { margin-top: 4px; ; height: 3.4rem; }
  </style>
  <form 
      name="userlostpass" 
      action="'.($site['URLR'] == 'on'
        ? $lng.'-'.$urlrw[3].'-161-1-'.$this->tconfig.$z2 
        : 'lostpass.php?lng='.$lng.'&amp;ask=1&amp;tconfig='.$this->tconfig.$z2).'" 
      method="POST" 
      onsubmit="return VerifyForm(); return false;">
    <div class="mlost input-group mb-3 w-100 mx-auto" style="max-width:320px;">
      <div class="input-group-prepend">
        <span class="input-group-text"><i class="fas fa-at"></i></i></span>
      </div>
      <input class="form-control texte" type="text" name="email" placeholder="'.$web[13].'" />
    </div>
	'.SubmitButton($web[52]).'
  </form>
</div><br />';
            $this->topmess = $web[594];
            return array('LOST', $out);
        }
		else return array('LOST', $out);
    }
    
    public function MEMB_ok($pseudo, $lng) {
        global $serviz, $userprefs, $web;
        if ($serviz[28] != 'on' || $userprefs[19] == 'on' || $userprefs[20] == 'on' || !isAccessGranted($serviz[179], $pseudo)) {
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out = '
    <div class="text-center web342">'.$web[143].'
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            $this->topmess = $web[673];
            return array('MEMB', $out);
        }
        return array('');
    }

    protected function GetStatus($pseudo) {
        global $web, $serviz;
        if ($pseudo == $serviz[31] || $pseudo == $serviz[176]) return strtoupper($web[144]);
        $status = '';
        if (is_file(CHEMIN.'admin/'.REDACREP.$pseudo.INCEXT)) {
            include CHEMIN.'admin/'.REDACREP.$pseudo.INCEXT;
            $status = ' / '.$drtuser[30];
        }
        $admins = ReadDBFields(ADMINS);
        foreach ($admins as $adm)
            if ($pseudo == $adm[0]) {
                return ucfirst($adm[1]).$status;
            }
        return ucfirst($web[322]);
    }
    
    public function MEMB_content() {
        global $lng, $web, $serviz, $urlrw, $site, $z2, $userprefs, $drtuser, $page;
        $upseudo = import('upseudo');
        $mb      = array();
        if (is_file(MSGREP.$upseudo.DBEXT)) {
            $userdb = ReadDBFields(MSGREP.$upseudo.DBEXT);
            $avatar = ($userdb[1][9] == 'ava-00' || substr($userdb[1][9], 0, 4) != 'ava-' ? 'ava-00' : $userdb[1][9]);
            $avatar = $userdb[1][16] != '' ? $userdb[1][16] : $avatar;
            $mb     = array(
              'pseudo' => $upseudo,
              'status' => $this->GetStatus($upseudo),
              'avatar' => $avatar, 
              'web'    => $userdb[1][10],
              'mail'   => $userdb[1][3],
              'reg'    => substr(FormatDate($userdb[1][14]), 0, 10), 
              'date'   => substr(FormatDate($userdb[1][15]), 0, 10),
              'okmail' => $userdb[1][24],
              'okmp'   => $userdb[1][25]
            );
        }
        if (!empty($mb)) {
            $out .= '
<div class="m-auto prfAdmButton">';
            if ($drtuser[10] == 'on' || $serviz[31] == $userprefs[1] || $serviz[176] == $userprefs[1]) $out .= '
  <div class="float-right">
    <form name="compte" action="'.CHEMIN.'admin/admin.php?lng='.$lng.'&pg=compte&edit='.$upseudo.'" target="_blank" method="POST">
      '.SubmitButton($web[144]).'
    </form>
  </div>
  <div class="clearfix"></div>
  <br />';
            $out .= '
  <div class="table-responsive-md">
  <table class="table w-100 prftblborder">
    <tr class="rep">
	  <td class="text-center prftblborder prfheadtbl">
	    '.$web[673].' '.$web[208].' <b>'.$upseudo.'</b>
	  </td>
    </tr>
  </table>
  </div>
  <div class="table-responsive-md">
  <table class="table w-100 prftblborder">
	<tr>
	  <td class="w-45 text-center prftblborder">
	    '.$web[108].'<br /><b>'.$mb['status'].'</b><br /><br />'.$web[667].'
	  </td>
	  <td class="text-center align-bottom prftblborder">'.$web[515].' '.$web[208].' '.$upseudo.'</div>
	</tr>
	<tr>
	  <td class="text-center align-middle prftblborder prfheadtbl">';
            if (substr($mb['avatar'], 0, 4) == 'ava-') $out .= '
        <i class="'.$mb['avatar'].' ava-img"></i>';
            else $out .= '
	    <img src="'.$mb['avatar'].'" alt="" title="" class="mbrlistimgava" />';
            $out .= '
	  </td>
	  <td class="text-center align-top prftblborder">
        <div class="table-responsive-md">
	    <table class="table table-borderless m-auto">
		  <tr>
            <td class="text-right">'.$web[669].' </td>
            <td>'.$mb['reg'].'</td>
          </tr>
		  <tr>
            <td class="text-right">'.$web[674].' </td>
            <td>'.$mb['date'].'</td>
          </tr>
		</table>
        </div>
        <div class="table-responsive-md">
	    <table class="table table-borderless m-auto">
          <tr>
			<td class="text-center prfwebsite">
			  '.$web[304].' : '.(empty($mb['web']) ? '&nbsp;' : '
                <a href="'.$mb['web'].'" title="" target="_blank">
                  <i class="fas fa-globe align-middle prfimgmail" title="'.$web[304].'"></i>
                </a>').'
			</td>
		  </tr>
		</table>
        </div>
	  </td>
	</tr>
	<tr class="rep">
	  <td class="text-center prftblborder prfwebsite">'.$web[13].' ';
            if ($mb['okmail'] == 'on' && $userprefs[18] != 'on') $out .= 
              displayWriteEmail('mbprf', $mb['pseudo'], $mb['mail'], ' <i class="fas fa-at" title="'.$web[173].' '.$mb['pseudo'].'"></i>');
            $out .= '
	  </td>
	  <td class="text-center prftblborder prfwebsite">'.$web[668].' ';
            $act = ($serviz[18] == 'on' ? '0' : '1');
            if ($mb['okmp'] == 'on' && $userprefs[17] != 'on') $out .= '
		<a href="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[13].'-2-'.$act.'-'.$mb['pseudo'].'-'.$userprefs[1].'-'.$this->tconfig.$z2 
            : 'tinymsg.php?lng='.$lng.'&amp;action='.$act.'&amp;to='.$mb['pseudo'].'&amp;from='.$userprefs[1].'&amp;tconfig='.$this->tconfig.$z2).'" 
            title="'.$web[214].'">
	      <i class="far fa-envelope" title="'.$web[214].' '.$mb['pseudo'].'"></i>
		</a>';
            $out .= '
	  </td>
	</tr>
  </table>
  </div>
</div>
<br />
<div class="text-center">
  '.SubmitButton(
     $web[135].' '.$web[664], 
     'self.location.href=\''.CHEMIN.($site['URLR'] == 'on' 
       ? $lng.'-'.$urlrw[15].'-9-'.$this->tconfig.$z2 
       : 'memberlist.php?lng='.$lng.'&tconfig='.$this->tconfig.$z2).'\''
    ).'
</div>';
            $this->topmess = $web[673];
            return array('MEMB', $out);
        }
    }
    
    public function LSTMB_ok($pseudo, $lng) {
        global $serviz, $userprefs, $web;
        if ($serviz[28] != 'on' || $userprefs[19] == 'on' || $userprefs[20] == 'on' || !isAccessGranted($serviz[179], $pseudo)) {
            $href1 = CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[0] : 'index.php?lng='.$lng);
            $out = '
    <div class="text-center web342">'.$web[143].'
      <p class="text-center">
        '.SubmitButton($web[135], 'self.location.href=\''.$href1.'\'').'
      </p>
    </div>';
            $this->topmess = $web[664];
            return array('LSTMB', $out);
        }
        return array('');
    }
    
    public function LSTMB_content() {
        global $lng, $web, $serviz, $urlrw, $site, $z2, $userprefs, $page, $xposbox;
        $dbusers    = array();
        $spseudo    = '';
        $file_users = opendir(MSGREP);
        while ($nomfichier = readdir($file_users)) {
            if (substr($nomfichier, -3) == 'dtb') {
                $pseudo = str_replace(substr($nomfichier, -4), '', $nomfichier);
                $userdb = ReadDBFields(MSGREP.$nomfichier);
                $okgrp  = $serviz[180] == 'on' ? true : isAccessGranted($serviz[179], $pseudo);
                if (($okgrp || $userprefs[1] == $serviz[31] || $userprefs[1] == $serviz[176])
                    && @$userdb[1][13] == 'on' 
                    && (empty($userdb[1][31]) || (!empty($userdb[1][31]) 
                    && $userdb[1][31] != '1' 
                    && $userdb[1][31] != 2))) {
                    $avatar    = ($userdb[1][9] == 'ava-00' || substr($userdb[1][9], 0, 4) != 'ava-' ? 'ava-00' : $userdb[1][9]);
                    $avatar    = $userdb[1][16] != '' ? $userdb[1][16] : $avatar;
                    $dbusers[] = array(
                      'tri'    => strtoupper(substr($pseudo, 0, 1)),
                      'pseudo' => $pseudo, 
                      'status' => $this->GetStatus($pseudo),
                      'avatar' => $avatar, 
                      'web'    => $userdb[1][10], 
                      'mail'   => $userdb[1][3],
                      'reg'    => substr(FormatDate($userdb[1][14]), 0, 10), 
                      'date'   => substr(FormatDate($userdb[1][15]), 0, 10),
                      'okprf'  => $userdb[1][20],
                      'okmail' => $userdb[1][24],
                      'okmp'   => $userdb[1][25]
                    );
                    if ($userprefs[1] == $pseudo) {
                        $userprefs[17] = $userdb[1][18];
                        $userprefs[18] = $userdb[1][19];
                    }
                }
            }
        }
        closedir($file_users);
        sort($dbusers);
        $mblist = array();
        $scope  = import('scope');
        $search = import('search');
        $idpg   = import('idpg');
        if (!empty($scope)) {
            switch ($scope) {
            case 'ALL' :
                $mblist = $dbusers;
                break;
            case 'SEARCH' :
                $mblist = $dbusers;
                $nbdb   = count($mblist);
                $key    = 0;
                for ($i = 0; $i < $nbdb; $i++)
                    if (false !== stripos($mblist[$i]['pseudo'], $search) || false !== stripos($mblist[$i]['mail'], $search)) {
                        $key     = $i;
                        $spseudo = $mblist[$i]['pseudo'];
                        break;
                    }
                $idpg = floor($key / $serviz[75]) + 1;
                break;
            default :
                foreach ($dbusers as $user) if ($user['tri'] == $scope) $mblist[] = $user;
            }
        }
        else {
            $mblist = $dbusers;
            $scope  = 'ALL';
        }
        $nbdb = count($mblist);
        if (empty($idpg)) $idpg = 1;
        else while ($nbdb <= ($idpg - 1) * $serviz[75]) $idpg--;
        $navbar = GetNavBar(($site['URLR'] == 'on' ? $lng.'-'.$urlrw[15].'-910-'.$scope.'-'.$this->tconfig.'-' : 'memberlist.php?lng='.$lng.'&amp;scope='.$scope.'&amp;tconfig='.$this->tconfig.'&amp;idpg='), $nbdb, $idpg, $serviz[75], $z2);
        $out = '
<div class="mbrlistmain">
  <form name="frmsearch" 
      action="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[15].'-9-'.$this->tconfig.$z2 : 'memberlist.php?lng='.$lng.'&amp;tconfig='.$this->tconfig.$z2).'" 
      method="POST">
    <input type="hidden" name="scope" value="SEARCH" />
    <div class="table-responsive-md">
    <table class="w-100">
      <tr class="forum">
        <td>'.$web[665].'</td>
	    <td><input type="text" class="form-control texte" name="search" size="40" /></td>
	    <td>'.SubmitButton($web[58]).'</td>
      </tr>
    </table>
    </div>
  </form>
  <div class="rep text-center">|';
        for ($i=65; $i<91; $i++) $out .= '
    <a href="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[15].'-91-'.chr($i).'-'.$this->tconfig.$z2 : 'memberlist.php?lng='.$lng.'&amp;scope='.chr($i).'&amp;tconfig='.$this->tconfig.$z2).'" title="'.chr($i).'"><b><i>'.chr($i).'</i></b></a> |';
        $out .= '
    <a href="'.CHEMIN.($site['URLR'] == 'on' ? $lng.'-'.$urlrw[15].'-91-ALL-'.$this->tconfig.$z2 : 'memberlist.php?lng='.$lng.'&amp;scope=ALL&amp;tconfig='.$this->tconfig.$z2).'" title="'.$web[666].'"><b><i>'.$web[666].'</i></b></a> |
  </div>';
        if ($navbar != '')
            $out .= '
  <br />
  '.$navbar.'
  <br />';
        $out .= '
  <div class="table-responsive-md">
  <table class="table w-100">
    <tr class="forum2">
	  <th class="align-middle text-center">'.$web[667].'</th>
	  <th class="align-middle text-center">'.$web[172].'</th>
	  <th class="align-middle text-center">'.trim(substr($web[292], 0, -1)).'</th>
	  <th class="align-middle text-center">'.$web[304].'</th>
	  <th class="align-middle text-center">'.$web[13].'</th>
	  <th class="align-middle text-center">'.$web[668].'</th>
	  <th class="align-middle text-center">'.$web[669].'<br />'.$web[674].'</th>
	</tr>';
        for ($i = $serviz[75]*($idpg-1); $i < Min($serviz[75]*$idpg, $nbdb); $i++) {
            $mb = $mblist[$i];
            $out .= '
    <a id="'.$mb['pseudo'].'"></a>
	<tr class="'.($i%2 ? 'rep' : 'quest').'">
	  <td class="align-middle text-center">';
            if (substr($mb['avatar'], 0, 4) == 'ava-') $out .= '
        <i class="'.$mb['avatar'].' ava-img"></i>';
            else $out .= '
	    <img src="'.$mb['avatar'].'" alt="" title="" class="mbrlistimgava" />';
            $out .= '
	  </td>
	  <td class="'.($spseudo == $mb['pseudo'] ? 'forum ' : '').'align-middle text-center">
	    '.($mb['okprf'] == '' 
          ? '<a href="'.CHEMIN.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[15].'-92-'.$mb['pseudo'].'-'.$this->tconfig.$z2 
            : 'memberprf.php?lng='.$lng.'&amp;upseudo='.$mb['pseudo'].'&amp;tconfig='.$this->tconfig.$z2).'" title="'.$mb['pseudo'].'">' 
          : '').
		'<b>'.$mb['pseudo'].'</b>'.($mb['okprf'] == '' ? '</a>' : '').'
	  </td>
	  <td class="align-middle text-center">'.$mb['status'].'</td>
	  <td class="align-middle text-center">
	    '.(empty($mb['web']) 
          ? '<a href="#">&nbsp;</a>' 
          : '<a href="'.$mb['web'].'" title="" target="_blank"><i class="fas fa-globe align-middle" title="'.$web[304].'"></i></a>').'
	  </td>
	  <td class="align-middle text-center">';
            if ($mb['okmail'] == 'on' && $userprefs[18] != 'on')
                $out .= displayWriteEmail('mblst'.$i, $mb['pseudo'], $mb['mail'], 
		  ' <i class="fas fa-at align-middle" title="'.$web[173].' '.$mb['pseudo'].'"></i>');
            $out .= '
	  </td>
	  <td class="align-middle text-center">';
            $act = ($serviz[18] == 'on' ? '0' : '1');
            if ($mb['okmp'] == 'on' && $userprefs[17] != 'on') $out .= '
		<a href="'.CHEMIN.($site['URLR'] == 'on' 
          ? $lng.'-'.$urlrw[13].'-2-'.$act.'-'.$mb['pseudo'].'-'.$userprefs[1].'-'.$this->tconfig.$z2 
          : 'tinymsg.php?lng='.$lng.'&amp;action='.$act.'&amp;to='.$mb['pseudo'].'&amp;from='.$userprefs[1].'&amp;tconfig='.$this->tconfig.$z2).'" title="'.$web[214].'">
	      <i class="far fa-envelope align-middle" title="'.$web[214].' '.$mb['pseudo'].'"></i>
		</a>';
            $out .= '
	  </td>
	  <td class="align-middle text-center">'.$mb['reg'].'<br />'.$mb['date'].'</td>
	</div>';
        }
        $out .= '
  </table>
  </div>';
        if ($navbar != '')
            $out .= '
  <br />
  '.$navbar.'
  <br />';
        $out .= '
</div>';
        $this->topmess = $web[664];
        return array('LSTMB', $out);
    }
    
    protected function UpdateFicForm($fic, $form, $id) {
        $array      = explode("\n", fread(fopen($fic, "r"), filesize($fic)));
        $delete     = array_pop($array);
        $new        = $form;
        $array[$id] = $new;
        $fhandle    = fopen($fic,"w");
        for($a=0; $a< count($array); $a++) {
            fwrite($fhandle,stripslashes($array[$a])."\n");
        }
        fclose($fhandle);
    }
    
    public function TMSG_content() {
        global $lng, $web, $serviz, $urlrw, $site, $z2, $userprefs, $page, $souriez, $lang;
        $action     = import('action');
        $action2    = import('action2');
        $fic        = import('fic');
        $form       = import('form');
        $ancienmsg  = addslashes(import('ancienmsg'));
        $anciendate = import('anciendate');
        $msg        = addslashes(import('msg'));
        $maxcar     = '1500'; // max length of tiny messages in chr
        $from       = KeepGoodChars(CutLongWord(import('from'),20));
        $to         = KeepGoodChars(CutLongWord(import('to'),20));
        $id         = import('id');
        $out        = '';
        $this->topmess = $web[215].' - '.$userprefs[1];
        if (empty($userprefs[1])) {
            $out = '<strong>'.$web[357].'</strong><br /><br />'.$web[358].'<br />';
            return array('TMSG', $out);
        }
        elseif ($serviz[18] == 'on' && empty($action2)) {
            $out = '<strong>'.$web[357].'</strong>';
            return array('TMSG', $out);
        }
        $action = ($action == 0 ? 3 : $action);
        if ($action == 1) {  // Envoyer un tiny
            $from = $userprefs[1];
            if (empty($to)) {
                $out = '<strong>'.$web[357].'</strong><br /><br />'.$web[359].'<br />';
                return array('TMSG', $out);
            }
            $out .= JavaScriptfile(CHEMIN.'inc/tinymsg.js').'
<form name="nmsgr" 
    action="'.($site['URLR'] == 'on' ? 
      $lng.'-'.$urlrw[13].'-2-2-'.$to.'-'.$from.'-'.$this->tconfig.$z2 : 
      'tinymsg.php?lng='.$lng.'&amp;action=2&amp;to='.$to.'&amp;from='.$from.'&amp;tconfig='.$this->tconfig.$z2).'" 
    method="post">
  <input type="hidden" name="action2" value="'.$action.'" />
  <p class="textLeft">'.$web[208].'&nbsp;&nbsp;<strong>'.$from.'</strong><br />'.$web[204].'&nbsp;&nbsp;<strong>'.$to.'</strong></p>';
            if (!empty($userprefs[1]) && FileDBExist(MSGREP.$userprefs[1].DBEXT)) {
                $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
                if ($id != '') {
                    if ($dbmsg[0][0] == $userprefs[7]) {
                        if ($dbmsg[$id][3] == 'new') {
                            $dbmsg[$id][3] = 'lu';
                            $this->UpdateFicForm(MSGREP.$userprefs[1].DBEXT, implode(CONNECTOR, $dbmsg[$id]), $id);
                        }
                    }
                    $out .= '
  <p class="text-left"><input type="hidden" name="anciendate" value="'.$dbmsg[$id][1].'" /></p>
  <p class="text-center">'.$web[216].'</p>
  <input type="hidden" name="ancienmsg" value="'.stripslashes($dbmsg[$id][2]).'" />
  <div class="rep w-100 m-auto tdrepmsg">'.stripslashes(souriez($dbmsg[$id][2])).'</div>';
                }
            }
            $out .= '
  <p class="text-center">'.$web[56].'</p>
  <div class="text-center">
    <textarea name="msg" rows="8" class="w-100 msgtinysend"></textarea>
  </div>
  <div class="text-center align-middle">
    <a href="javascript:format(\'b\')" class="c-pointer" title="'.$web[98].'"><i class="fas fa-bold"></i></a>&nbsp;
    <a href="javascript:format(\'i\')" class="c-pointer" title="'.$web[100].'"><i class="fas fa-italic"></i></a>&nbsp;
    <a href="javascript:format(\'u\')" class="c-pointer" title="'.$web[99].'"><i class="fas fa-underline"></i></a>&nbsp;
    <a href="javascript:dolink(\'href=http://\')" class="c-pointer" title="'.$web[170].'"><i class="fas fa-link"></i></a>&nbsp;  &nbsp;';
            $dsm = '';
			$num = '';
            for ($i = 0; $i < count($souriez); $i++) 
                $dsm .= '
    <a href="JavaScript:AddSmiley'.$num.'(\''.$souriez[$i][0].'\')" class="c-pointer" title="'.$souriez[$i][0].'  => '.$souriez[$i][2].'">
      '.$souriez[$i][1].'
    </a>&nbsp;';
            $out .= $dsm.'
  </div>';
            $href1 = CHEMIN.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[13].'-3-3-'.$this->tconfig.$z2 
              : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;tconfig='.$this->tconfig.$z2);
            $out .= '
  <p class="text-center">'.SubmitButton($web[52]).'&nbsp;'.SubmitButton($web[205], 'self.location.href=\''.$href1.'\'', '', '', 'reset').'</p>
</form>
<script> document.nmsgr.msg.focus(); </script>
<p class="text-center">
  <a href="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[13].($serviz[18] != 'on' ? '-3-3-' : '-32-3-3-').$this->tconfig.$z2 
      : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;action2=3&amp;tconfig='.$this->tconfig.$z2).'">
    <button type="button" class="btn btn-info btn-lg"><i class="fas fa-undo-alt" title="'.$web[135].'"></i></button>
  </a>
</p>';
        }
        elseif ($action == 2) { // Voir un tiny
            $from = $userprefs[1];
            if (empty($to)) {
                $out = '<p><strong>'.$web[357].'</strong><br /><br />'.$web[359].'</p>';
                return array('TMSG', $out);
            }
            if (strlen($msg) > $maxcar) {
                $out = '
<script>
  alert("'.strlen($msg).' '.$web[408].' '.$maxcar.')");
  history.back();
</script>';
                return array('TMSG', $out);
            }
            $msg   = str_replace(chr(10), '<br />', $msg);
            $msg   = str_replace(chr(13), '', $msg);
            $msg   = str_replace('[b]',   '<b>', $msg);
            $msg   = str_replace('[/b]',  '</b>', $msg);
            $msg   = str_replace('[i]',   '<i>', $msg);
            $msg   = str_replace('[/i]',  '</i>', $msg);
            $msg   = str_replace('[u]',   '<u>', $msg);
            $msg   = str_replace('[/u]',  '</u>', $msg);
            $msg   = str_replace('[l]href=','<a href="', $msg);
            $msg   = str_replace('[/l]',  '" target="_blank"><i class="fas fa-globe" title="'.$web[304].'"></i></a>', $msg);
            $msg   = str_replace('"',     "'", $msg);
            $dbmsg = array();
            if (!empty($to) && FileDBExist(MSGREP.$to.DBEXT)) {
                $dbmsg[0] = $from;
                $dbmsg[1] = GetCurrentDateTime();
                $dbmsg[2] = RemoveConnector(stripslashes($msg));
                $dbmsg[3] = 'new';
                $dbmsg[4] = '';
                $dbmsg[5] = RemoveConnector(stripslashes($ancienmsg));
                $dbmsg[6] = $anciendate;
                $dbmsg[7] = $userprefs[8];
                AppendDBFields(MSGREP.$to.DBEXT, $dbmsg);
                $dbmsg[0] = $to;
                $dbmsg[1] = GetCurrentDateTime();
                $dbmsg[2] = RemoveConnector(stripslashes($msg));
                $dbmsg[3] = 'lu';
                $dbmsg[4] = 'send';
                $dbmsg[5] = RemoveConnector(stripslashes($ancienmsg));
                $dbmsg[6] = $anciendate;
                $dbmsg[7] = $userprefs[8];
                AppendDBFields(MSGREP.$from.DBEXT, $dbmsg);
                $dbmsg2 = ReadDBFields(MSGREP.$to.DBEXT);
                $eto    = $dbmsg2[1][3];
                $sujet  = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).' - '.$web[670];
                $bodycorps  = '<div style="margin:auto;padding:8px;width:440px;border: solid 1px #000000;border-radius:4px;">';
                $bodycorps  .= '<p style="text-align:left;font:12pt Arial;">';
                $bodycorps  .= $web[245].sprintf($web[672], $to, $from).'<a href="'.$site[3].'" title="'.$site[3].'">'.$site[3].'</a>';
                $bodycorps  .= '</p></div>';
                eMailHtmlTo($sujet, $bodycorps, $eto);
                $out .= '
    <br />
	<div class="m-auto text-center">
	  <p>'.$web[332].'<br /><br />
	    <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[13].($serviz[18] != 'on' ? '-3-3-' : '-32-3-3-').$this->tconfig.$z2 
            : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;action2=3&amp;tconfig='.$this->tconfig.$z2).'">'.$web[135].'
          <button type="button" class="btn btn-info btn-lg"><i class="fas fa-undo-alt" title="'.$web[135].'"></i></button>
	    </a>
	  </p>
    </div>
    <form name="suit2" 
      action="'.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[13].'-3-3-'.$this->tconfig.$z2 
        : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;tconfig='.$this->tconfig.$z2).'" method="post">
      <input type="hidden" name="action2" value="3" />
    </form>
<script> setTimeout("document.suit2.submit();",4000);</script>';
            }
            else {
                $out .= '
    <br />
    <p class="text-center">'.$web[230].'</p>';
            }
        }
        elseif ($action == 3) { // Gérer les tiny
            $nbrtinymsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
            if(count($nbrtinymsg) > ($serviz[48]+2)) {
                DeleteDBFieldById(MSGREP.$userprefs[1].DBEXT, 2);
            }
            $dbmsg = Array();
            if (!empty($userprefs[1]) && FileDBExist(MSGREP.$userprefs[1].DBEXT)) {
                $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
                if ($dbmsg[0][0] == $userprefs[7]) {
                    $out .= '
<script>
  function selectAllMsg(opt) {
	var option = opt.name;
	var allSelected = opt.checked;
	switch (option) {
	case "delRecu_all" :
      var allMsg = document.forms["boxtinymsg"].elements["delRecu_id[]"];
      break;
	case "delSend_all" :
	  var allMsg = document.forms["boxtinymsg"].elements["delSend_id[]"];
	  break;
	default :
	  return false;
	}
	if (allMsg.length != undefined) {
	  for (i = 0; i < allMsg.length; i++) {
		allMsg[i].checked = (allSelected)? true : false;
	  }
	} else {
	  allMsg.checked = (allSelected)? true : false;
	}
	return false;
  }
  function verifyTinyMsgChecked() {
	var error = true;
	var message = "'.$web[428].'";
	if (document.forms["boxtinymsg"].elements["delRecu_id[]"]) {
	  var allMsgRecu = document.forms["boxtinymsg"].elements["delRecu_id[]"];
	  if (allMsgRecu.length != undefined) {
		for (i = 0; i < allMsgRecu.length; i++) {
		  if (allMsgRecu[i].checked) { error = false; }
		}
	  } else {
		if (allMsgRecu.checked) { error = false; }
	  }
	}
	if (document.forms["boxtinymsg"].elements["delSend_id[]"]) {
	  var allMsgSend = document.forms["boxtinymsg"].elements["delSend_id[]"];
	  if (allMsgSend.length != undefined) {
		for (i = 0; i < allMsgSend.length; i++) {
		  if (allMsgSend[i].checked) { error = false; }
		}
	  } else {
		if (allMsgSend.checked) { error = false; }
	  }
	}
	if (error) {
	  alert(message);
	  return false;
	} else {
	  return true;
	}
  }
</script>
<p class="text-center">'.$web[291].' '.$serviz[48].' '.$web[335].'</p>
<p class="text-center">
  <i class="far fa-envelope text-danger"></i> '.$web[211].'&nbsp;&nbsp;&nbsp;&nbsp;
  <i class="far fa-check-circle text-dark"></i> '.$web[209].'
</p>
<hr />
<form name="boxtinymsg" 
  action="'.($site['URLR'] == 'on' 
    ? $lng.'-'.$urlrw[13].'-3-5-'.$this->tconfig.$z2 
    : 'tinymsg.php?lng='.$lng.'&amp;action=5&amp;tconfig='.$this->tconfig.$z2).'" 
  method="post" 
  onsubmit="return verifyTinyMsgChecked(); return false;"
>
  <input type="hidden" name="action2" value="5" />
  <div class="text-center m-auto"><strong>'.$web[207].'</strong></div>
  <div class="table-responsive-md">
  <div class="d-table m-auto w-100 tbltinymain">
    <div class="forum d-table-row text-center">
      <div class="d-table-cell py-2 w-10"><strong>'.$web[206].'</strong></div>
      <div class="d-table-cell py-2 w-35"><strong>'.$web[210].'</strong></div>
      <div class="d-table-cell py-2 w-35"><strong>'.$web[325].'</strong></div>
      <div class="d-table-cell py-2 w-20">
        <div class="table-responsive-md">
        <div class="d-table m-auto">
          <div class="d-table-row">
            <div class="d-table-cell text-center"><strong>'.$web[323].'</strong></div>
          </div>
        </div>
        </div>
      </div>
    </div>';
                    $nbMsgRecu = 0;
                    for ($i = 2; $i < count($dbmsg); $i++) {
                        if (isset($dbmsg[$i][4]) && $dbmsg[$i][4] != 'send') {
                            $trcolor = $dbmsg[$i][3] == 'new' ? 'quest ' : ($dbmsg[$i][3] == 'lu' ? 'rep ' : '');
                            $out .= '
    <div class="d-table-row '.$trcolor.'text-center trmsgtiny">
      <div class="d-table-cell w-10">
        '.($dbmsg[$i][3] == 'lu' 
            ? '<i class="far fa-check-circle text-dark" title="'.$dbmsg[$i][3].'"></i>' 
            : '<i class="far fa-envelope text-danger blink" title="'.$dbmsg[$i][3].'"></i>').'
      </div>
      <div class="d-table-cell w-35 text-left tdmsglnk">
	    <a href="'.($site['URLR'] == 'on' 
            ? $lng.'-'.$urlrw[13].($serviz != 'on' ? '-4-1-' : '-42-1-1-').$i.'-'.$dbmsg[$i][0].'-'.$userprefs[1].'-'.$this->tconfig.$z2 
            : 'tinymsg.php?lng='.$lng.'&amp;action=1&amp;action2=1&amp;id='.$i.'&amp;to='.$dbmsg[$i][0].'&amp;from='.$userprefs[1].'&amp;tconfig='.$this->tconfig.$z2).'" 
            title="'.$web[140].'">
          <strong>'.$dbmsg[$i][0].'</strong>
        </a>
	  </div>
      <div class="d-table-cell w-35">'.FormatDate($dbmsg[$i][1]).'</div>
      <div class="d-table-cell w-20 text-center">
        <div class="table-responsive-md">
        <div class="d-table m-auto w-100">
          <div class="d-table-row">
            <div class="d-table-cell w-40 text-center">
              <a href="'.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[13].($serviz != 'on' ? '-5-4-' : '-52-4-4-').$i.'-'.$this->tconfig.$z2 
                  : 'tinymsg.php?lng='.$lng.'&amp;action=4&amp;action2=4&amp;id='.$i.'&amp;tconfig='.$this->tconfig.$z2).'">
                <i class="far fa-eye text-primary" title="'.$web[326].'"></i>
              </a>
            </div>
            <div class="d-table-cell w60 text-center">
              <input type="checkbox" id="delRecu_id[]" name="delRecu_id[]" value="'.$i.'" />
              <i class="fas fa-times text-danger" title="'.$web[324].'"></i>
            </div>
          </div>
        </div>
        </div>
      </div>
    </div>';
                            $nbMsgRecu++;
                        }
                    }
                    $out .= '
  </div>
  </div>';
                    if ($nbMsgRecu > 0) { //Case Tout supprimer
                        $out .= '
  <div class="table-responsive-md">
  <div class="d-table m-auto w-100 tbltinymain">
	<div class="d-table-row text-center trmsgtiny">
      <div class="d-table-cell text-right"><label for="delRecu_all">'.$web[425].'</label></div>
      <div class="d-table-cell w-12">
        <input title="'.$web[426].'" type="checkbox" id="delRecu_all" name="delRecu_all" value="" onclick="selectAllMsg(this)" />
        <i class="fas fa-times text-danger" title="'.$web[324].'"></i>
      </div>
    </div>
  </div>
  </div>';
                    }
                    $out .= '
  <br />
  <div class="m-auto text-center"><strong>'.$web[327].'</strong></div>
  <div class="table-responsive-md">
  <div class="d-table m-auto w-100 tbltinymain">
    <div class="forum d-table-row text-center">
      <div class="d-table-cell py-2 w-10"><strong>'.$web[206].'</strong></div>
      <div class="d-table-cell py-2 w-35"><strong>'.$web[328].'</strong></div>
      <div class="d-table-cell py-2 w-35"><strong>'.$web[325].'</strong></div>
      <div class="d-table-cell py-2 w-20">
        <div class="table-responsive-md">
        <div class="d-table m-auto">
          <div class="d-table-row">
            <div class="d-table-cell text-center"><strong>'.$web[323].'</strong></div>
          </div>
        </div>
        </div>
      </div>
    </div>';
                    $nbMsgSend = 0;
                    for ($i = 2; $i < count($dbmsg); $i++) {
                        if ($dbmsg[$i][4] == 'send') {
                            $out .= '
    <div class="rep d-table-row text-center trmsgtiny">
      <div class="d-table-cell w-10">
        '.($dbmsg[$i][3] == 'lu' 
            ? '<i class="far fa-check-circle text-dark" title="'.$dbmsg[$i][3].'"></i>' 
            : '<i class="far fa-envelope text-danger blink" title="'.$dbmsg[$i][3].'"></i>').'
      </div>
      <div class="d-table-cell w-35 textLeft tdmsglnk"><label for="delSend_id[]"><strong>'.$dbmsg[$i][0].'</strong></label></div>
      <div class="d-table-cell w-35">'.FormatDate($dbmsg[$i][1]).'</div>
      <div class="d-table-cell w-20 text-center">
        <div class="table-responsive-md">
        <div class="d-table m-auto w-100">
          <div class="d-table-row">
            <div class="d-table-cell w-40">
              <a href="'.($site['URLR'] == 'on' 
                  ? $lng.'-'.$urlrw[13].($serviz != 'on' ? '-5-6-' : '-52-6-6-').$i.'-'.$this->tconfig.$z2 
                  : 'tinymsg.php?lng='.$lng.'&amp;action=4&amp;action2=4&amp;id='.$i.'&amp;tconfig='.$this->tconfig.$z2).'">
                <i class="far fa-eye text-primary" title="'.$web[326].'"></i>
              </a>
            </div>
            <div class="d-table-cell width60">
              <input type="checkbox" id="delSend_id[]" name="delSend_id[]" value="'.$i.'" />
              <i class="fas fa-times text-danger" title="'.$web[324].'"></i>
            </div>
          </div>
        </div>
        </div>
      </div>
    </div>';
                            $nbMsgSend++;
                        }
                    }
                    $out .= '
  </div>
  </div>';
                    if ($nbMsgSend > 0) { //Case Tout supprimer
                        $out .= '
  <div class="table-responsive-md">
  <div class="d-table m-auto w-100 tbltinymain">
	<div class="d-table-row text-center trmsgtiny">
      <div class="d-table-cell text-right"><label for="delSend_all">'.$web[425].'</label></div>
      <div class="d-table-cell w-12">
        <input title="'.$web[427].'" type="checkbox" id="delSend_all" name="delSend_all" value="" onclick="selectAllMsg(this)" />
        <i class="fas fa-times text-danger" title="'.$web[324].'"></i>
      </div>
    </div>
  </div>
  </div>';
                    }
                    if (($nbMsgSend + $nbMsgRecu) > 0) { //Case Tout supprimer
                        $out .= '
  <div class="m-auto text-right btntinymain">
    '.SubmitButton($web[424]).' <i class="fas fa-level-up-alt align-middle pr-5"></i>
  </div>';
                    }
                    $out .= '
</form>';
                }
            }
        }
        elseif ($action == 4) { // Répondre à  ou Supprimer un tiny
            if (empty($id)) {
                $out = 'tinymsg.php : action=4 empty id';
                return array('TMSG', $out);
            }
            $dbmsg = array();
            if (!empty($userprefs[1]) && FileDBExist(MSGREP.$userprefs[1].DBEXT)) {
                $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
                if ($dbmsg[0][0] == $userprefs[7]) {
                    $sendRR = $dbmsg[$id][3] == 'lu' ? true : false;
                    $dbmsg[$id][3] = 'lu';
                    $this->UpdateFicForm(MSGREP.$userprefs[1].DBEXT, implode(CONNECTOR, $dbmsg[$id]), $id);
                    $out .= '
    <p class="text-center"><b>'.$web[330]." ".$dbmsg[$id][0].'</b> '.$web[7]." ".FormatDate($dbmsg[$id][1]).'</p>';
			$imgavexp = $page[23] != 'none' ? $dbmsg[$id][7] != '' ? $dbmsg[$id][7] : 'ava-00' : '';
			$out .= '
    <br />
	<fieldset>
      <div class="table-responsive-md">
      <table class="table table-borderless w-98 m-auto">
        <tr class="rep">
          <td class="w-10 text-center">
            '.($page[23] != 'none' ?  '<img src="'.CHEMIN.'inc/img/avatars/'.$imgavexp.'" alt="'.$dbmsg[$id][0].'" title="'.$dbmsg[$id][0].'" />' : '&nbsp;').'
          </td>
          <td class="w-90"><p>'.stripslashes(souriez($dbmsg[$id][2])).'</p></td>
        </tr>
      </table>
      </div>';
                    if($dbmsg[$id][5] != '') {
                        $imgavdest = ($page[23] != 'none' ? ($userprefs[8] != '' ? $userprefs[8] : 'ava-00') : '');
                        $out .= '
      <div class="table-responsive-md">
      <table class="table table-borderless w-98 m-auto">
        <tr class="forum text-center">
          <td><p>'.$web[329]." ".FormatDate($dbmsg[$id][6]).'</p></td>
        </tr>
      </table>
      </div>
      <div class="table-responsive-md">
      <table class="table table-borderless w-98 m-auto">
        <tr>
          <td class="w-10 text-center">
            '.($page[23] != 'none' ?  '<img src="inc/img/avatars/'.($page[23] != 'none' ? $imgavdest : '&nbsp;').'" alt="Avatar '.$dbmsg[$id][0].'" />' : '&nbsp;').'
          </td>
          <td class="w-90"><p>'.stripslashes(souriez($dbmsg[$id][5])).'</p></td>
        </tr>
      </table>
      </div>';
                    }
                    $out .= '
	</fieldset>
	<div class="text-center divcmdtiny">
	  <div class="float-left">
	    <form name="msg_answer" 
            action="'.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[13].'-4-1-'.$id.'-'.$dbmsg[$id][0].'-'.$userprefs[1].'-'.$this->tconfig.$z2 
              : 'tinymsg.php?lng='.$lng.'&amp;action=1&amp;id='.$id.'&amp;to='.$dbmsg[$id][0].'&amp;from='.$userprefs[1].'&amp;tconfig='.$this->tconfig.$z2).'" method="post" 
            class="frmcmdtiny">
          <input type="hidden" name="action2" value="1" />
		  '.SubmitButton($web[140]).'
	    </form>
	  </div>
	  <div>
	    <form name="msg_del" 
            action="'.($site['URLR'] == 'on' 
              ? $lng.'-'.$urlrw[13].'-3-5-'.$this->tconfig.$z2 
              : 'tinymsg.php?lng='.$lng.'&amp;action=5&amp;tconfig='.$this->tconfig.$z2).'" 
            class="frmcmdtiny" 
            method="post">
          <input type="hidden" name="action2" value="5" />
	      <input type="hidden" name="delRecu_id[]" value="'.$id.'" />
		  '.SubmitButton($web[324]).'
	    </form>
	  </div>
	</div>';
                    if ($dbmsg[1][27] == 'on' && $sendRR) {
                        $dbmsg2 = ReadDBFields(MSGREP.$dbmsg[$id][0].DBEXT);
                        $to     = $dbmsg2[1][3];
                        $sujet  = stripslashes($site[($lang[0] == $lng ? 0 : 11)]).' - '.$web[670];
                        $bodycorps  = '<div style="margin:auto;padding:8px;width:440px;border: solid 1px #000000;border-radius:4px;">';
                        $bodycorps  .= '<p style="text-align:left;font:12pt Arial;">';
                        $bodycorps  .= $web[245].sprintf($web[671], $dbmsg2[1][2], $userprefs[1]).'<a href="'.$site[3].'" title="'.$site[3].'">'.$site[3].'</a><br /><br />';
                        $bodycorps  .= $web[56].'<br /><br />'.$dbmsg[$id][2].'<br /><br />';
                        $bodycorps  .= '</p></div>';
                        eMailHtmlTo($sujet, $bodycorps, $to);
                    }
                }
            }
            $out .= '
  <p class="text-center">
    <a href="'.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[13].($serviz[18] != 'on' ? '-3-3-' : '-32-3-3-').$this->tconfig.$z2 
        : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;action2=3&amp;tconfig='.$this->tconfig.$z2).'" title="">
      <button type="button" class="btn btn-info btn-lg"><i class="fas fa-undo-alt" title="'.$web[135].'"></i></button>
	</a>
  </p>';
        }
        elseif ($action == 5) { // Supprimer des tiny
            $id      = array();
            $id_recu = (isset($_POST['delRecu_id']) && is_array($_POST['delRecu_id']))? $_POST['delRecu_id'] : array();
            $id_send = (isset($_POST['delSend_id']) && is_array($_POST['delSend_id']))? $_POST['delSend_id'] : array();
            $id      = array_merge($id_recu, $id_send);
            if (!empty($userprefs[1]) && FileDBExist(MSGREP.$userprefs[1].DBEXT) && !empty($id)) { //Vérification de l'existence du membre
                $dbmsg = array();
                $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
                if ($dbmsg[0][0] == $userprefs[7]) { //Vérification du mot de passe
                    for ($i = 0; $i < count($id); $i++) {
                        unset($dbmsg[$id[$i]]);
                    }
                    $dbmsg = array_values($dbmsg);
                    WriteDBFields(MSGREP.$userprefs[1].DBEXT, $dbmsg);
                }
            }
            $out .= '
  <p class="text-center">'.$web[331].'</p>
  <br />
  <p class="text-center">
    <a href="'.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[13].($serviz[18] != 'on' ? '-3-3-' : '-32-3-3-').$this->tconfig.$z2 
        : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;action2=3&amp;tconfig='.$this->tconfig.$z2).'" title="">
      <button type="button" class="btn btn-info btn-lg"><i class="fas fa-undo-alt" title="'.$web[135].'"></i></button>
	</a>
  </p>
  <form name="suit5" 
    action="'.($site['URLR'] == 'on' 
      ? $lng.'-'.$urlrw[13].'-3-3-'.$this->tconfig.$z2 
      : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;tconfig='.$this->tconfig.$z2).'" 
    method="post">
    <input type="hidden" name="action2" value="3" />
  </form>
  <script> setTimeout("document.suit5.submit();",2400); </script>';
        }
        elseif ($action == 6) {
            if (empty($id)) {
                $out = 'tinymsg.php : action=6 empty id';
                return array('TMSG', $out);
            }
            $dbmsg = Array();
            if (!empty($userprefs[1]) && FileDBExist(MSGREP.$userprefs[1].DBEXT)) {
                $dbmsg = ReadDBFields(MSGREP.$userprefs[1].DBEXT);
                if ($dbmsg[0][0] == $userprefs[7]) {
                    $dbmsg[$id][3] = 'lu';
                    $this->UpdateFicForm(MSGREP.$userprefs[1].DBEXT, implode(CONNECTOR, $dbmsg[$id]), $id);
                    $out .= '
      <p class="text-center">'.$web[328]." : &nbsp;" .' <strong>'.$dbmsg[$id][0].'</strong> '." &nbsp;".$web[7]." &nbsp;".FormatDate($dbmsg[$id][1]).'</p>
      <div class="rep w-98 divreptiny">'.stripslashes(souriez($dbmsg[$id][2])).'</div>';
                }
            }
            $out .= '
  <div class="text-center">
  <hr />
    <a href="'.($site['URLR'] == 'on' 
        ? $lng.'-'.$urlrw[13].($serviz[18] != 'on' ? '-3-3-' : '-32-3-3-').$this->tconfig.$z2 
        : 'tinymsg.php?lng='.$lng.'&amp;action=3&amp;action2=3&amp;tconfig='.$this->tconfig.$z2).'">
      <button type="button" class="btn btn-info btn-lg"><i class="fas fa-undo-alt" title="'.$web[135].'"></i></button>
	</a>
  </div>';
        }
        return array('TMSG', $out);
    }
}
?>