Récupere la liste des mails loggés
Si un parametres idUtilisateur est précisé en GET , on affiche pas la colonne des mails ( inutile sur la fiche de l'utilisateur)

@param array $params Paramètres

@return string HTML
182116
public function getLoggedMails($params = array())
    {
        $html             = "";
        $titre            = "<h1>Log des mails du site";
        $sqlSelect        = "";
        $arrayUtilisateur = array();
        if (isset($this->variablesGet['idUtilisateur'])) {
            $u                     = new archiUtilisateur();
            $arrayInfosUtilisateur = $u->getArrayInfosFromUtilisateur($this->variablesGet['idUtilisateur']);
            $sqlSelect             = " AND destinataire='".$arrayInfosUtilisateur['mail']."' ";
            $arrayUtilisateur      = array('idUtilisateur'=>$this->variablesGet['idUtilisateur']);

            // pour le passage de parametres
            $titre .= " pour ".$arrayInfosUtilisateur['nom']." ".$arrayInfosUtilisateur['prenom'];
        }
        $titre .= "</h1>";
        $html .= $titre;

        // gestion de la recherche
        $sqlSelectRecherche = "";
        if (isset($this->variablesGet['recherche']) && $this->variablesGet['recherche']=='1' && isset($this->variablesPost['motCleRechercheLogsMail'])) {
            $motCle                    = $this->variablesPost['motCleRechercheLogsMail'];
            $arraySqlSelectRecherche[] = "destinataire LIKE \"%".$motCle."%\"";
            $arraySqlSelectRecherche[] = "sujet LIKE \"%".$motCle."%\"";
            $arraySqlSelectRecherche[] = "message LIKE \"%".$motCle."%\"";
            $arraySqlSelectRecherche[] = "date LIKE \"%".$motCle."%\"";
            $sqlSelectRecherche        = " AND (".implode(" OR ", $arraySqlSelectRecherche).") ";
        }

        // formulaire de recherche
        $f = new formGenerator();
        $configFields = array("motCleRechercheLogsMail"=>array('type'=>'text', 'htmlCode'=>'', 'error'=>'', 'libelle'=>'Recherche :', 'default'=>'', 'value'=>'', 'required'=>false), "pageCourante"=>array('type'=>'hidden', 'htmlCode'=>'', 'error'=>'', 'default'=>'', 'value'=>'', 'required'=>false));
        if (isset($this->variablesGet['archiAffichage']) && $this->variablesGet['archiAffichage']=='utilisateurDetail') {
            $configForm = array('titrePage'=>'', 'fields'=>$configFields, 'submitButtonValue'=>'Envoyer', 'formAction'=>$this->creerUrl('', 'utilisateurDetail', array_merge(array('recherche'=>1), $arrayUtilisateur)), 'templateFileName'=>'rechercheLogsMail.tpl', 'formName'=>'formRechercheLogsMail');
        } else {
            $configForm = array('titrePage'=>'', 'fields'=>$configFields, 'submitButtonValue'=>'Envoyer', 'formAction'=>$this->creerUrl('', 'afficheLogsMails', array_merge(array('recherche'=>1), $arrayUtilisateur)), 'templateFileName'=>'rechercheLogsMail.tpl', 'formName'=>'formRechercheLogsMail');
        }
        $html                    .= $f->afficherFromArray($configForm);
        $reqCount                 = "SELECT idMail FROM logMails WHERE 1=1 $sqlSelect $sqlSelectRecherche";
        $resCount                 = $this->connexionBdd->requete($reqCount);
        $nbEnregistrementTotaux   = mysql_num_rows($resCount);
        $pagination               = new paginationObject();
        $nbEnregistrementsParPage = 15;
        $arrayPagination          = $pagination->pagination(array('nbEnregistrementsParPage'=>$nbEnregistrementsParPage, 'nbEnregistrementsTotaux'=>$nbEnregistrementTotaux, 'typeLiens'=>'formulaire', 'champPageCourante'=>'pageCourante', 'nomParamPageCourante'=>'pageCourante', 'idFormulaire'=>'formRechercheLogsMail'));
        $req                      = "
                SELECT * 
                FROM logMails 
                LEFT JOIN utilisateur ON utilisateur.mail = logMails.destinataire 
                WHERE 1=1 $sqlSelect $sqlSelectRecherche
        ";

        // on affiche pas les mails de debugs
        $req     = $pagination->addLimitToQuery($req);
        $res     = $this->connexionBdd->requete($req);
        $tableau = new tableau();
        if (!isset($this->variablesGet['idUtilisateur'])) {
            $tableau->addValue("<h3>Destinataire</h3>");
        }
        $tableau->addValue("<h3>Sujet</h3>");
        $tableau->addValue("<h3>Message</h3>");
        $tableau->addValue("<h3>Date</h3>");
        while ($fetch = mysql_fetch_assoc($res)) {
            if (!isset($this->variablesGet['idUtilisateur'])) {
                $tableau->addValue("<a href='".$this->creerUrl('', 'afficheLogsMails', array('idUtilisateur'=>$fetch["idUtilisateur"]))."'>".$fetch["destinataire"]."</a>");
            }
            $tableau->addValue(stripslashes(stripslashes($fetch["sujet"])));
            $tableau->addValue(stripslashes("<textarea style='width:250px;height:150px;'>".stripslashes($fetch["message"]))."</textarea>");
            $tableau->addValue($this->date->toFrench($fetch["date"]));
        }
        $html .= $arrayPagination['html'];
        $nbColonnes = 3;
        if (!isset($this->variablesGet['idUtilisateur'])) {
            $nbColonnes = 4;
        }
        $html .= $tableau->createHtmlTableFromArray($nbColonnes);
        $html .= $arrayPagination['html'];
        return $html;
    }
968731
public function getHrefWithDoAppend(array $params): string
    {
        $href = [];
        $href[] = static::makeParam('p', $this->p);
        $href[] = $this->parseParameter('do', $this->do == '_default' ? '' : $this->do, $params);

        foreach ($params as $key => $value) {
            $href[] = static::makeParam($key, $value);
        }

        return '?' . implode('&', $href);
    }
53158
public function getUrl($params): string
    {
        // prepare params
        $params = $this->getParams($params);

        // retrieve URL
        return Router::getUrl(
            $this->getModule(),
            $this->getController(),
            $params
        );
    }
1072460
public function saveMailToLogs($params = array())
    {
        if (isset($params['destinataire'])
            && isset($params['sujet'])
            && isset($params['message'])
            && isset($params['debug'])
        ) {
            $debugValue=false;
            if ($params['debug']==true) {
                $debugValue=true;
            }
                
            
            $message = strip_tags($params['message'], '<br>');
            if (file_exists($this->getCheminPhysique().'logs/'.$params['logfile'])) {
                $lastlog = popen(
                    'tac '.escapeshellcmd(
                        $this->getCheminPhysique().
                        'logs/'.$params['logfile']
                    ), 'r'
                );

                $lastline = json_decode(fgets($lastlog));
                pclose($lastlog);
            } else {
                $lastline[3]='';
            }

            if ($lastline[3] == $message) {
                $fn = $this->getCheminPhysique().'/logs/'.$params['logfile'];
                $size = filesize($fn);
                $block = 4096;
                $trunc = max($size - $block, 0);

                $f = fopen($fn, "c+");
                if (flock($f, LOCK_EX)) {
                    fseek($f, $trunc);
                    $bin = rtrim(fread($f, $block), "\n");
                    if ($r = strrpos($bin, "\n")) {
                        ftruncate($f, $trunc + $r + 1);
                    }
                }
                fclose($f);
                error_log(
                    json_encode(
                        array($lastline[0], array_merge(
                            $lastline[1],
                            array($params['destinataire'])
                        ), $params['sujet'], $message)
                    )
                    .PHP_EOL, 3, $this->getCheminPhysique().
                    '/logs/'.$params['logfile']
                );
            } else {
                error_log(
                    json_encode(
                        array(date('c'), array($params['destinataire']),
                        $params['sujet'], $message)
                    ).PHP_EOL, 3, $this->getCheminPhysique().
                    '/logs/'.$params['logfile']
                );
            }
        } else {
            echo "mailObject.class.php : ".
            "sauvegarde dans les logs impossible, il manque un champ.<br>";
        }
    }
1198553
public function search(array $params)
    {
        $response = $this->requestAndResponse('SEARCH', $params);
        if (!$response) {
            return $response;
        }

        foreach ($response as $ids) {
            if ($ids[0] == 'SEARCH') {
                array_shift($ids);
                return $ids;
            }
        }
        return array();
    }
1082628
public function search($params)
    {
        $subquery = (new Query())
                    ->select(['m2.replyto'])
                    ->from(['m1' => Message::tableName()])
                    ->leftJoin(['m2' => Message::tableName()], 'm1.replyto = m2.id')
                    ->where(['is not', 'm2.replyto', null]);
        $query = static::find()->where(['and',
            ['receiver_id' => User::loggedId()],
            ['!=', 'receiver_status', self::STATUS_DELETED],
            ['not in', 'message_id', $subquery]
        ]);
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        $dataProvider->sort->attributes['senderName'] = [
            'asc' => [
                User::tableName() . '.username' => SORT_ASC,
                User::tableName() . '.id' => SORT_ASC
            ],
            'desc' => [
                User::tableName() . '.username' => SORT_DESC,
                User::tableName() . '.id' => SORT_DESC
            ],
            'default' => SORT_ASC
        ];
        $dataProvider->sort->defaultOrder = ['id' => SORT_DESC];
        $dataProvider->pagination->pageSize = Yii::$app->session->get('per-page', 20);

        if (!($this->load($params) && $this->validate())) {
            $dataProvider->query->joinWith(['message' => function ($q) {
                $q->joinWith(['sender']);
            }]);
            return $dataProvider;
        }

        $dataProvider->query->andFilterWhere(['like', 'topic', $this->topic]);

        if (preg_match('/^(forum|orum|rum|um|m)?#([0-9]+)$/', strtolower($this->senderName), $matches)) {
            $dataProvider->query->joinWith(['message' => function ($q) use ($matches) {
                $q->joinWith(['sender' => function ($q) use ($matches) {
                    $q->andFilterWhere(['and',
                        [User::tableName() . '.id' => $matches[2]],
                        ['or',
                            ['username' => ''],
                            ['username' => null]
                        ]
                    ]);
                }]);
            }]);
        } elseif (preg_match('/^([0-9]+)$/', $this->senderName, $matches)) {
            $dataProvider->query->joinWith(['message' => function ($q) use ($matches) {
                $q->joinWith(['sender' => function ($q) use ($matches) {
                    $q->andFilterWhere(['or',
                        ['like', 'username', $this->senderName],
                        ['and',
                            ['id' => $matches[1]],
                            ['or',
                                ['username' => ''],
                                ['username' => null]
                            ]
                        ],
                    ]);
                }]);
            }]);
        } else {
            $dataProvider->query->joinWith(['message' => function ($q) {
                $q->joinWith(['sender' => function ($q) {
                    $q->andFilterWhere(['like', User::tableName() . '.username', $this->senderName]);
                }]);
            }]);
        }
        return $dataProvider;
    }
1017747
public function get($params = null) {
		$this->buffer = $this->getConfigs();

		if (isset($params)) {
			$params = trim($params);
			$params_list = explode('/', $params);
			$params_count = count($params_list);

			for ($i=0; $i<$params_count; $i++) {
				if ($i == $params_count) { return $this->buffer[$params_list[$i]]; }

				$this->buffer = $this->buffer[$params_list[$i]];
			}
		}

		return $this->buffer;
	}
1314795
public function getParamTokens(array $params)
    {
        foreach ($params as $k => $p) {
            if (is_array($p)) {
                $params[$k] = isset($p[2]) ? $p[2] : 0;
            }
        }

        return $params;
    }
334245
protected function getClientParams( array $params, array $prefixes = array( 'f', 'l', 'd', 'a' ) )
	{
		$list = [];

		foreach( $params as $key => $value )
		{
			if( in_array( $key[0], $prefixes ) && $key[1] === '_' ) {
				$list[$key] = $value;
			}
		}

		return $list;
	}
550687
public static function decodeParams($params)
    {
        if(!$params) {
            return [];
        }
        $paramsArrayList = json_decode(json_encode($params), true);
        $decodedParams = [];
        foreach($paramsArrayList as $paramKey=>$paramValue){
            if(is_array($paramValue)) {
                foreach($paramValue as $languageSlug=>$langParamValue){
                    if($languageSlug == App::getLocale()) {
                        $decodedParams[$paramKey] = $langParamValue;
                        break;
                    }else{
                        $decodedParams[$paramKey] = "";
                    }
                }
            }else{
                $decodedParams[$paramKey] = $paramValue;
            }
        }
        return $decodedParams;
    }
869190
protected function encodePayload(array $params)
  {
    $encoded = [];
    foreach ($params as $key => $value)
    {
      if (is_array($value))                 $encoded[$key] = $this->encodePayload($value);
      else if ($value instanceof \DateTime) $encoded[$key] = $value->format(\DateTime::ISO8601);
      else                                  $encoded[$key] = $value;
    }

    return $encoded;
  }
180141
public static function makeUrl(array $params): string
    {
        $href = [];

        foreach ($params as $key => $value) {
            $href[] = static::makeParam($key, (string)$value);
        }

        return '?' . implode('&', $href);
    }
145475
private function decodeParams($params)
    {
        if (is_string($params)) {
            $params = urldecode($params);
        } elseif (is_array($params)) {
            foreach ($params as &$currentParam) {
                $currentParam = $this->decodeParams($currentParam);
            }
        }

        return $params;
    }
1294664
public static function load($params = null)
    {
        if (!isset(self::$_instance)) {
            self::$_instance = new Email($params);
        }

        return self::$_instance;
    }
1170074
public function getRealParams(array $params)
    {
        foreach ($params as $k => $p) {
            if (is_array($p)) {
                $params[$k] = $p[1];
            }
        }

        return $params;
    }
979913
protected function getQueryParams(array $params = []): string
    {
        if (empty($params)) {
            return '';
        }
        $query = $params['query'] ?? [];
        if (is_string($query)) {
            return $query;
        }
        return empty($query) ? '' : http_build_query($query);
    }
483816
private function getNestedParams(array $params)
    {
        $query = http_build_query($params, null, '&');
        $params = explode('&', $query);
        $result = [];

        foreach ($params as $param) {
            list($key, $value) = explode('=', $param, 2);
            $result[urldecode($key)] = urldecode($value);
        }

        return $result;
    }