added ')' when trimming message string
This commit is contained in:
parent
ab2f9b87a7
commit
715b647844
@ -1,19 +0,0 @@
|
||||
|
||||
<strong>Documentation pour l'importation des langues.</strong>
|
||||
|
||||
Depuis <a href="https://lite.framacalc.org/9mfo-traduction">https://lite.framacalc.org/9mfo-traduction</a>
|
||||
<ol>
|
||||
<li>cliquer sur enregistrer</li>
|
||||
<li>choisir "ODS" comme format d'export</li>
|
||||
<li>ouvrir avec "LibreOffice Calc"</li>
|
||||
<li>dans "LibreOffice Calc" , menu "Fichier" => "enregistrer sous ..."</li>
|
||||
<li>sélectionner le dossier dans lequel vous voulez enregistrer le fichier</li>
|
||||
<li>choisir le format "Texte CSV(.csv)"à la place de "Classeur ODF(.ods)" (en bas à droite de la fenêtre)</li>
|
||||
<li>cliquer sur enregistrer</li>
|
||||
<li>cliquer sur "Utiliser le format Texte CSV"</li>
|
||||
<li>sélectionner le Jeu de caractère "Unicode (UTF-8)"</li>
|
||||
<li>dans "Séparateur de champ" sélectionner "|" (barre verticale - AltGr + -)</li>
|
||||
<li>cliquer sur valider</li>
|
||||
<li>uploader le fichier sur le serveur dans le dossier lang/</li>
|
||||
<li>en admin lancer le script genere_lang.php</li>
|
||||
</ol>
|
@ -1,17 +0,0 @@
|
||||
|
||||
Documentation pour l'importation des langues.
|
||||
|
||||
Depuis https://lite.framacalc.org/9mfo-traduction
|
||||
1 - cliquer sur enregistrer
|
||||
2 - choisir "ODS" comme format d'export
|
||||
3 - ouvrir avec "LibreOffice Calc"
|
||||
4 - dans "LibreOffice Calc" , menu "Fichier" => "enregistrer sous ..."
|
||||
5 - sélectionner le dossier dans lequel vous voulez enregistrer le fichier
|
||||
6 - choisir le format "Texte CSV(.csv)"à la place de "Classeur ODF(.ods)" (en bas à droite de la fenêtre)
|
||||
7 - cliquer sur enregistrer
|
||||
8 - cliquer sur "Utiliser le format Texte CSV"
|
||||
9 - sélectionner le Jeu de caractère "Unicode (UTF-8)"
|
||||
10 - dans "Séparateur de champ" sélectionner "|" (barre verticale - AltGr + -)
|
||||
11 - cliquer sur valider
|
||||
12 - uploader le fichier sur le serveur dans le dossier lang/
|
||||
13 - en admin lancer le script genere_lang.php
|
@ -20,7 +20,7 @@ $site = "Avion Poème";
|
||||
$dossier = "/www";
|
||||
$basedir = dirname( $_SERVER['DOCUMENT_ROOT'] ) . $dossier;
|
||||
|
||||
$base_url = "https://avion-poe.me";
|
||||
$base_url = "http://avion-poe.me";
|
||||
$base_path = "/flex/storage/avion-poe.me/site/www/";
|
||||
$url_admin = $base_url . "/gestion";
|
||||
$accueil = $base_url . "/index.html";
|
||||
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
date_default_timezone_set("Europe/Paris");
|
||||
set_include_path(get_include_path() . ':../include');
|
||||
|
||||
define( 'EOL', "\n" );
|
||||
define( 'LF', "\r\n" );
|
||||
define( 'TAB', "\t" );
|
||||
|
||||
//constantes des niveaux de log
|
||||
define( "INFO", 1 );
|
||||
define( "ALERT", 2 );
|
||||
define( "ERROR", 3 );
|
||||
|
||||
define( "DATE_MYSQL", "Y-m-d H:i:s" );
|
||||
|
||||
//variables diverses
|
||||
$admin = "Daniel";
|
||||
$site = "Avion Poème";
|
||||
$dossier = "/www";
|
||||
$basedir = dirname( $_SERVER['DOCUMENT_ROOT'] ) . $dossier;
|
||||
|
||||
$base_url = "https://avion-poe.me";
|
||||
$base_path = "/flex/storage/avion-poe.me/site/www/";
|
||||
//$url_admin = $base_url . "/admin";
|
||||
$accueil = $base_url . "/index.html";
|
||||
|
||||
if ( !isset( $_SESSION['base_url']) )
|
||||
{
|
||||
$_SESSION['base_url'] = $base_url;
|
||||
}
|
||||
|
||||
?>
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
include "log.php";
|
||||
$table_prefix = "";
|
||||
class db
|
||||
{
|
||||
private $server = "db351634-avionpoeme.sql-pro.online.net";
|
||||
private $port = 3306;
|
||||
private $user = "db120904";
|
||||
private $passwd = "AvionPoème*DB";
|
||||
private $database = "db351634_avionpoeme";
|
||||
public $connect;
|
||||
public $result;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->open();
|
||||
}
|
||||
|
||||
function open()
|
||||
{
|
||||
if ( !$this->connect )
|
||||
{
|
||||
$this->connect = new mysqli( $this->server, $this->user, $this->passwd, $this->database );
|
||||
if ( $this->connect->connect_errno )
|
||||
{
|
||||
log_error( "Échec de la connexion : => " . $this->connect->connect_error . "<br />" . __file__ . ' ligne ' . __line__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->connect->set_charset("utf8");
|
||||
return true;
|
||||
}
|
||||
|
||||
function close()
|
||||
{
|
||||
$this->connect->close();
|
||||
$this->connect = 0;
|
||||
}
|
||||
|
||||
function protect( $string )
|
||||
{
|
||||
return $this->connect->real_escape_string( $string );
|
||||
}
|
||||
|
||||
function query( $string )
|
||||
{
|
||||
|
||||
//log_write( $string );
|
||||
if ( empty( $this->connect ) ) $this->open();
|
||||
|
||||
$this->result = $this->connect->query( $string ) ;
|
||||
|
||||
if ( $this->connect->error ) log_error( "Échec de la commande query => " . $this->connect->error . "<br />" . __file__ . ' ligne ' . __line__ . "\n" . $string, true, true);
|
||||
//print_r( $this );
|
||||
}
|
||||
|
||||
function print_error()
|
||||
{
|
||||
print_r( $this );
|
||||
//$this->error = $this->error;
|
||||
return $this->connect->error;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
if ( !isset($site) )
|
||||
{
|
||||
require_once( "config.inc.php" );
|
||||
header( 'Location: ' . $accueil );;
|
||||
}
|
||||
$webmaster="contact@avion-poe.me";
|
||||
$headers = "From: contact@avion-poe.me\r\n";
|
||||
//$headers .= "MIME-Version: 1.0\r\n";
|
||||
$headers .= "Content-type: text/plain; charset=UTF-8\r\n";
|
||||
$headers .= "DATE: " . date( 'r' ) . "\r\n\r\n";
|
||||
|
||||
$html_headers = "From: contact@avion-poe.me\r\n";
|
||||
//$headers .= "MIME-Version: 1.0\r\n";
|
||||
$html_headers .= "Content-type: text/html; charset=UTF-8\r\n";
|
||||
$html_headers .= "DATE: " . date( 'r' ) . "\r\n\r\n";
|
||||
|
||||
?>
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
require_once 'log.php';
|
||||
|
||||
function envoiMail($destinataire, $sujet, $text)
|
||||
{
|
||||
$headers = "From: contact@avion-poe.me" . LF;
|
||||
$headers .= "Content-type: text/plain; charset=UTF-8" . LF;
|
||||
$headers .= "DATE: " . date( 'r' ) . LF . LF;
|
||||
|
||||
$html_headers = "From: contact@avion-poe.me" . LF;
|
||||
$html_headers .= "Content-type: text/html; charset=UTF-8" . LF;
|
||||
$html_headers .= "DATE: " . date( 'r' ) . LF . LF;
|
||||
|
||||
log_write(__FILE__ . __LINE__ . " Envoi d'un courriel à " . $courriel . "sujet:" . $sujet, INFO);
|
||||
if( !mail($destinataire, $sujet, $text, $headers) ) //Sending mail
|
||||
{
|
||||
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel n'est pas parti:" .$courriel . EOL . $sujet . EOL, ERROR);
|
||||
return 0;
|
||||
}else
|
||||
{
|
||||
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel avec les pièces jointes est parti:" .$courriel . EOL, INFO);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,289 +0,0 @@
|
||||
<?php
|
||||
|
||||
// affiche le contenu dans dossier à télécharger
|
||||
|
||||
function affich_dir($dirname)
|
||||
{
|
||||
|
||||
$dir = scandir($dirname);
|
||||
echo "<ul>";
|
||||
foreach($dir as $file)
|
||||
{
|
||||
if($file != '.' && $file != '..' && !is_dir( $dirname . $file ) )
|
||||
{
|
||||
echo '<li><a href="' . $dirname . $file . '">' . $file . '</a></li>';
|
||||
}
|
||||
|
||||
}
|
||||
echo "</ul><br /><br />";
|
||||
}
|
||||
|
||||
|
||||
// vérifie que la césure de la chaine de caractère ne se fait pas au mileiu d'une balise html
|
||||
// $n l nombre de caractères à garder
|
||||
|
||||
function verif_partiel( $string, $n)
|
||||
{
|
||||
$string = trim( stripslashes( $string ) );
|
||||
$string = mb_substr( $string, 0, $n );
|
||||
$pos = strrpos( $string, " " );
|
||||
$string = substr( $string, 0, $pos );
|
||||
$x = $z = 0;
|
||||
$pos1 = $pos_d = 0;
|
||||
$balises = array();
|
||||
|
||||
do
|
||||
{
|
||||
$z = $z + 1;
|
||||
if ( $z >=50 )
|
||||
{
|
||||
log_error( "verif_partiel : erreur de boucle sans fin dans la ligne : $string<br />" . print_r( $balises ) . __file__ . " ligne " . __line__ );
|
||||
}
|
||||
|
||||
$pos1 = strpos( $string, "<", $pos_d );
|
||||
if ( $pos1 !== FALSE )
|
||||
{
|
||||
$pos2 = strpos( $string, ">", $pos1 );
|
||||
$pos3 = strpos( $string, "<", $pos1+1 );
|
||||
|
||||
if ( $pos1 AND $pos2 === FALSE )
|
||||
{
|
||||
$string = substr( $string, 0, $pos1);
|
||||
}else
|
||||
{
|
||||
if ( $pos3 !== FALSE AND $pos3 < $pos2 )
|
||||
{
|
||||
$pos1 = $pos3;
|
||||
}
|
||||
$pos_d = $pos2 + 1;
|
||||
|
||||
$balise_e = $titre = "panier";
|
||||
$css = "main.css";substr( $string, $pos1, $pos2 - $pos1 + 1 );
|
||||
$pos = strpos( $balise_e, " " );
|
||||
|
||||
if ( $pos !== FALSE )
|
||||
{
|
||||
$pos2 = $pos + $pos1;
|
||||
}
|
||||
$pos_slash = strpos( $balise_e, "/" );
|
||||
if ( $pos_slash !== FALSE AND $pos_slash == 1 )
|
||||
{
|
||||
//echo "BALISE FERMANTE<br />";
|
||||
$balise = trim( substr ( $balise_e, 2, ($pos2 - $pos1 - 2) ) );
|
||||
if ( $balises[ $x-1 ] != $balise )
|
||||
{
|
||||
log_error( "verif_partiel : erreur de balise '$balise_e' dans la ligne : $string<br />" . print_r( $balises ) . __file__ . " ligne " . __line__ );
|
||||
}else
|
||||
{
|
||||
$x = $x -1;
|
||||
}
|
||||
}elseif ( $pos_slash === FALSE )
|
||||
{
|
||||
//echo "BALISE OUVRANTE<br />";
|
||||
$balises[ $x++ ] = trim( substr ( $balise_e, 1, ($pos2 - $pos1 -1) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}while ( $pos1 !== FALSE );
|
||||
$string .= " ...";
|
||||
if ( $x >0 )
|
||||
{
|
||||
for ( $i = $x-1; $i >= 0; $i--)
|
||||
{
|
||||
$string .= "</" . $balises[ $i ] . ">";
|
||||
}
|
||||
}
|
||||
//echo "string finale => $string<br />";
|
||||
return $string;
|
||||
}
|
||||
|
||||
// $var clef à rechercher dans $_POST, $_GET, et $_SESSION (si $session=true)
|
||||
// $default valeur retournée si aucune valeur n'est trouvée
|
||||
// $session: si true, rechercher aussi dans $_SESSION
|
||||
|
||||
//
|
||||
|
||||
function getpost( $var, $default="", $session=false )
|
||||
{
|
||||
//echo '$var =>' . $var . "<br />";
|
||||
if ( isset($_GET[$var]) )
|
||||
{
|
||||
//echo '$_get -> $var =>' . $var . "<br />";
|
||||
return $_GET[$var];
|
||||
}
|
||||
elseif ( isset($_POST[$var]) )
|
||||
{
|
||||
//echo '$_POST -> $var =>' . $var . "<br />";
|
||||
return $_POST[$var];
|
||||
}else
|
||||
{
|
||||
if ( isset($_SESSION[$var]) AND $session==true )
|
||||
{
|
||||
return $_SESSION[$var];
|
||||
}else
|
||||
{
|
||||
//echo 'default -> $var =>' . $var . "<br />";
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// affiche les composants du menus
|
||||
// pas de retour
|
||||
|
||||
function menu($page, $text)
|
||||
{
|
||||
echo '<a href="' . $page . '" class="menu"';
|
||||
if ( $_SERVER['SCRIPT_NAME'] == $page ) echo ' style="color : red"';
|
||||
echo '>' . $text . ' </a>';
|
||||
}
|
||||
|
||||
function bouton_rouge( $text, $lien )
|
||||
{
|
||||
print '<div style="position:relative; height:400px">
|
||||
<div style="position:absolute;z-index:1">
|
||||
<img src="/images/bouton_rouge.png">
|
||||
</div>
|
||||
<div style="position:absolute;top:10px; z-index:2;">
|
||||
<a href="' . $lien . '">
|
||||
<center><b>' . $text .'</b></center></a>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
// MET LA PREMIÈRE LETTRE D'UN MOT EN MAJUSCULE ( utf8 compliant )
|
||||
|
||||
function mb_ucfirst($str) {
|
||||
$char = mb_substr($str,0,1,"UTF8");
|
||||
$str = mb_substr( $str, 1, NULL, "UTF8");
|
||||
$char = mb_strtoupper( $char, "UTF8");
|
||||
return $char . $str;
|
||||
}
|
||||
|
||||
// affiche le panier en cours
|
||||
// si $modif =,= true affiche une case de saisie avec la quantité
|
||||
|
||||
function affiche_panier( $modif=false )
|
||||
{
|
||||
global $base_url, $path, $page;
|
||||
$total = 0;
|
||||
$hc = 0;
|
||||
//echo "============";print_r($_SESSION);echo "#################";
|
||||
$nombre_ref = $_SESSION['panier_n_ref'];
|
||||
$nombre_art = 0;
|
||||
echo '<table class="panier_tab"><tr><th style="width : 3em; text-align : center;">n°</th><th style="width : 5em; text-align : center;">quantité</th><th align="center" style="width: 40%;">Produit</th><th style="width : 7em; text-align : center;">Durée</th><th style="width : 7em; text-align : center;">Type</th><th style="width : 8em;" align="center">Huile chaude<br />Supplément 5€</th><th style="width : 6em; text-align : center;">prix</th><th style="width : 8em; text-align : center;">total</th><th style="width : 8em; text-align : center;">valable jusqu\'au</th></tr>';
|
||||
$art = $_SESSION["panier"];
|
||||
for ($i = 0 ; $i < $nombre_ref ; $i++ )
|
||||
{
|
||||
$nombre_art += $art["qte"][$i];
|
||||
$total += $total_col = $art["qte"][$i] * ( $art["prix"][$i] + ($art["huile_chaude"][$i]?5:0) );
|
||||
echo '<tr><td style="padding : 5px; text-align : center;">' . ($i + 1) . '</td><td align="center">';
|
||||
if ( $modif )
|
||||
{
|
||||
echo '<input style="color: brown;" type="text" name="qtes[' . $i . ']" value="' . $art["qte"][$i] . '" maxlength="3" size="2" onchange="document.getElementById( \'commande\' ).submit()" />';
|
||||
}else
|
||||
{
|
||||
echo $art["qte"][$i];
|
||||
}
|
||||
echo '</td><td style="width: 40%;">' . $art["libelle"][$i] . '</td><td align="center">' . $art["duree"][$i] . '</td><td align="center">' . $art["type"][$i] . '</td>';
|
||||
echo '<td align="center">';
|
||||
if ($modif)
|
||||
{
|
||||
if ( $art["hc"][$i] )
|
||||
{
|
||||
echo '<input type="checkbox" name="huile_chaude[' . $i . ']" onchange="javascript:window.location.replace( \'' . $base_url . $path . $page . '?action=recalc&i=' . $i . '\');"';
|
||||
if ( $art["huile_chaude"][$i] )
|
||||
{
|
||||
echo 'checked ';
|
||||
}
|
||||
echo '/>';
|
||||
}else
|
||||
{
|
||||
echo 'non disponible';
|
||||
}
|
||||
}else
|
||||
{
|
||||
if ( $art["huile_chaude"][$i] )
|
||||
{
|
||||
echo 'oui';
|
||||
$hc = 5;
|
||||
}else
|
||||
{
|
||||
echo 'non';
|
||||
$hc = 0;
|
||||
}
|
||||
}
|
||||
echo '</td>';
|
||||
$prix_article = $art["prix"][$i] + $hc;
|
||||
echo '<td align="right">' . $prix_article . ' €</td><td align="right">' . $total_col . ' €</td><td align="right">' . $art["date_validite"][$i]->format("j/m/Y") . '</td></tr>';
|
||||
}
|
||||
echo '<tr><td colspan="4"></td><td colspan="3" align="center">total du panier</td><td align="right">' . "$total €</td><td></td></tr>";
|
||||
echo '</table>';
|
||||
|
||||
echo "nombre de références : $nombre_ref<br />";
|
||||
echo "nombre d'articles : $nombre_art";
|
||||
|
||||
}
|
||||
|
||||
function ajout_panier( $id )
|
||||
{
|
||||
//echo '<form method="post" action=""><input type="number" name="' . $id . '" min="0" max="999" value="1" />';
|
||||
return '<img title="Ajouter au panier" src="./img/shop.png" width="24" height="24" alt="Ajouter au panier" onclick="javascript:open_panier_add(\'' . $id . '\');" />';
|
||||
}
|
||||
|
||||
function affiche_commande( $id )
|
||||
{
|
||||
$total = 0;
|
||||
$db = new db();
|
||||
$db->open();
|
||||
$query = "SELECT * FROM commandes_articles AS ca LEFT JOIN articles AS art ON ca.id_art=art.id LEFT join libelle_art AS la ON la.id=art.id_libelle WHERE ca.id_commande='" . $db->protect($id) . "'";
|
||||
$db->query( $query );
|
||||
echo '<tr style="font-weight: bold;"><td text-align : center;">Article</td>';
|
||||
echo '<td text-align : center;">Quantité</td>';
|
||||
echo "<td text-align : center;>huile_chaude</td>";
|
||||
echo '<td text-align : center;">Prix</td>';
|
||||
echo '<td text-align : center;">Type</td>';
|
||||
echo '<td text-align : center;">Date de validité</td>';
|
||||
echo '<td style="width : 3em; text-align : center;">Total article</td>';
|
||||
echo '</tr>';
|
||||
while ( $donnees = mysqli_fetch_array($db->result) )
|
||||
{
|
||||
|
||||
echo '<tr><td text-align : center;">' . $donnees["libelle"] . '</td>';
|
||||
echo '<td text-align : center;">' . $donnees["quantite"] . '</td>';
|
||||
if ( $donnees["huile_chaude"] )
|
||||
{
|
||||
echo "<td text-align : center;>huile_chaude</td>";
|
||||
}
|
||||
echo '<td text-align : center;">' . $donnees["prix"] . '</td>';
|
||||
echo '<td text-align : center;">' . $donnees["type"] . '</td>';
|
||||
echo '<td text-align : center;">' . $donnees["date_validite"] . '</td>';
|
||||
$total_article = $donnees["prix"] * $donnees["quantite"];
|
||||
$total += $total_article;
|
||||
echo '<td style="width : 3em; text-align : center;">' . $total_article . '</td>';
|
||||
|
||||
|
||||
}
|
||||
echo '<tr><th>Total de la commande</th><th style="width : 3em; text-align : center;">' . $total . '</th></tr>';
|
||||
return $total;
|
||||
$db->close();
|
||||
}
|
||||
|
||||
function delete_cart()
|
||||
{
|
||||
$_SESSION['panier'] = array();
|
||||
$_SESSION['panier_n_ref'] = 0;
|
||||
if ( ! session_regenerate_id( true) )
|
||||
{
|
||||
log_error("impossible de régénérer l'ID de session");
|
||||
}
|
||||
print '<script type="text/javascript">
|
||||
<!--
|
||||
|
||||
window.opener.document.getElementById("panier").style.visibility="hidden";
|
||||
window.close();
|
||||
-->
|
||||
</script>';
|
||||
}
|
||||
?>
|
155
include/log.php~
155
include/log.php~
@ -1,155 +0,0 @@
|
||||
<?php
|
||||
if ( !isset($site) )
|
||||
{
|
||||
require_once( "config.inc.php" );
|
||||
header( 'Location: ' . $accueil );
|
||||
}
|
||||
require_once( "db.class.php" );
|
||||
require_once( "entete_mail.php" );
|
||||
|
||||
// $level => INFO, ALERT, ERROR
|
||||
function log_write($log, $level=INFO)
|
||||
{
|
||||
global $table_prefix, $webmaster, $headers;
|
||||
$user = ( !empty( $_SERVER["PHP_AUTH_USER"])?$_SERVER["PHP_AUTH_USER"]:'' );
|
||||
$log_mail = str_replace ( "<br />", "\n", $log ) . "\n";
|
||||
$log_mail .= ( !empty( $_SERVER["REQUEST_METHOD"])?'$_SERVER["REQUEST_METHOD"]' . $_SERVER["REQUEST_METHOD"] . "\n":'' );
|
||||
$log_mail .= ( !empty( $_SERVER["QUERY_STRING"])?'$_SERVER["QUERY_STRING"]' . $_SERVER["QUERY_STRING"] . "\n":'' );
|
||||
$log_mail .= ( !empty( $_SERVER["HTTP_ACCEPT_LANGUAGE"])?'$_SERVER["HTTP_ACCEPT_LANGUAGE"]' . $_SERVER["HTTP_ACCEPT_LANGUAGE"] . "\n":'' );
|
||||
$log_mail .= ( !empty( $_SERVER["HTTP_USER_AGENT"])?'$_SERVER["HTTP_USER_AGENT"]' . $_SERVER["HTTP_USER_AGENT"] . "\n":'' );
|
||||
$log_mail .= ( !empty( $_SERVER["REMOTE_ADDR"])?'$_SERVER["REMOTE_ADDR"]' . $_SERVER["REMOTE_ADDR"] . "\n":'' );
|
||||
$log_mail .= ( !empty( $_SERVER["REMOTE_HOST"])?'$_SERVER["REMOTE_HOST"]' . $_SERVER["REMOTE_HOST"] . "\n":'' );
|
||||
$log_mail .= ( !empty( $_SERVER["REMOTE_USER"])?'$_SERVER["REMOTE_USER"]' . $_SERVER["REMOTE_USER"] . "\n":'' );
|
||||
$log_mail .= ( !empty( $_SERVER["REQUEST_URI"])?'$_SERVER["REQUEST_URI"]' . $_SERVER["REQUEST_URI"] . "\n":'' );
|
||||
$log_mail .= "Utilisateur: $user \n";
|
||||
$log_mail .= ( !empty( $_SERVER["ORIG_PATH_INFO"])?'$_SERVER["ORIG_PATH_INFO"]' . $_SERVER["ORIG_PATH_INFO"] . "\n":'' );
|
||||
$log_mail .= ( !empty( $_SERVER["PATH_INFO"])?'$_SERVER["PATH_INFO"]' . $_SERVER["PATH_INFO"] . "\n":'' );
|
||||
$db1 = new db();
|
||||
$db1->open();
|
||||
if( !empty( $db1->connect ) )
|
||||
{
|
||||
$query = 'INSERT INTO ' . $db1->protect($table_prefix) . 'logs SET date=NOW(), auteur="' . $db1->protect( $user ) . '", log="' . $db1->protect($log) . '", niveau="' . $db1->protect($level) . '"';
|
||||
$db1->query( $query );
|
||||
if ( !$db1->result )
|
||||
{
|
||||
$text = $db1->error() . "\n\n" . $log_mail;
|
||||
mail( $webmaster, "Erreur écriture logs => " . __file__ . " ligne " . __line__, $text, $headers );
|
||||
}
|
||||
$db1->close();
|
||||
}else
|
||||
{
|
||||
echo $db1->error();
|
||||
mail( $webmaster, "Erreur écriture logs => " . __file__ . " ligne " . __line__ , $log_mail, $headers );
|
||||
}
|
||||
if ( $level == ALERT )
|
||||
{
|
||||
mail( $webmaster, "Alerte Site Web", $log_mail, $headers );
|
||||
}elseif ( $level == ERROR )
|
||||
{
|
||||
mail( $webmaster, "Erreur Site Web", $log_mail, $headers );
|
||||
}
|
||||
}
|
||||
|
||||
// $db = true -> écrire les logs dans la base (défaut)
|
||||
// $die = true -> execute die()
|
||||
function log_error($log, $w_db=true, $die=false)
|
||||
{
|
||||
global $webmaster, $headers, $accueil, $db;
|
||||
if ( $w_db ) log_write($log, ERROR);
|
||||
echo "$log<br />\n";
|
||||
$log_err = 'erreur dans la requête<br/>un rapport détaillé a été envoyé au webmaster';
|
||||
if ( $die )
|
||||
{
|
||||
echo "\n";
|
||||
die( $log_err );
|
||||
}else
|
||||
{
|
||||
$_SESSION['error'] = $log_err;
|
||||
//header( 'Location: ' . $accueil );
|
||||
}
|
||||
}
|
||||
|
||||
function affich_log( $nl, $np = 1, $level=INFO )
|
||||
{
|
||||
global $table_prefix, $webmaster, $headers, $base_url , $path , $page;
|
||||
if( !empty( $db->open() ) )
|
||||
{
|
||||
$level_s = array( "aucune" , "info" , "alerte" , "erreur" );
|
||||
$query = 'SELECT * FROM ' . $table_prefix . 'logs';
|
||||
if ( $level != 0 )
|
||||
{
|
||||
$query .= " WHERE niveau='" . $db->protect($level) . "'";
|
||||
}
|
||||
$db->query($query) OR log_error($db->error() . "<br />" . __file__ . " ligne " . __line__ );
|
||||
$total_lignes = $db->result->num_rows();
|
||||
if ($total_lignes != 0 )
|
||||
{
|
||||
|
||||
$n_pages = round( $total_lignes / $nl ) +1;
|
||||
|
||||
if ( $np == 0 )
|
||||
{
|
||||
$np = 1;
|
||||
}elseif ( $np > $n_pages )
|
||||
{
|
||||
$np = $n_pages;
|
||||
}
|
||||
echo '<table><tr>';
|
||||
if ( $np > 1 )
|
||||
{
|
||||
echo '<td><a href="logs.php?np=' . ($np - 1) . '">Page précédente</a></td><td>';
|
||||
}
|
||||
echo "\n" . '<form action="none" method="post" enctype="multipart/form-data">';
|
||||
echo 'Page n° <select id="np" name="np" size="0" onchange="window.location.href = \'logs.php?np=\' + document.getElementById(\'np\').value + \'&level=\' + document.getElementById(\'level\').value ;">';
|
||||
for ( $n = 1; $n<= $n_pages; $n++ )
|
||||
{
|
||||
echo '<option value="' . $n . '"';
|
||||
if ( $n == $np )
|
||||
{
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $n . '</option>';
|
||||
}
|
||||
|
||||
echo '</select><noscript><input type="submit" name="submit" Value="none" /></noscript>';
|
||||
echo "</form>\n</td>";
|
||||
if ( $np < $n_pages )
|
||||
{
|
||||
echo '<td><a href="logs.php?np=' . ($np + 1) . '">Page suivante</a></td>';
|
||||
}
|
||||
echo "\n<td>" . '<form action="none" method="post" enctype="multipart/form-data">';
|
||||
echo "niveau de log" . ' <select id="level" size="0" onchange="window.location.href = \'logs.php?np=\' + document.getElementById(\'np\').value + \'&level=\' + document.getElementById(\'level\').value ;">';
|
||||
for ( $n = 0; $n <= count( $level_s ) - 1; $n++ )
|
||||
{
|
||||
echo '<option value="' . $n . '"';
|
||||
if ( $n == $level )
|
||||
{
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $level_s[ $n ] . '</option>';
|
||||
}
|
||||
|
||||
echo '</select><noscript><input type="submit" name="submit" Value="Envoyer" /></noscript>';
|
||||
echo "</form>\n</td></tr>";
|
||||
$query = 'SELECT * FROM ' . $table_prefix . 'logs';
|
||||
if ( $level != 0 )
|
||||
{
|
||||
$query .= " WHERE niveau='" . $level . "'";
|
||||
}
|
||||
|
||||
$query .= ' ORDER BY date DESC LIMIT ' . ( ( ( $np - 1 ) * $nl ) ) . ',' . $nl;
|
||||
$db->query( $query ) OR log_error( $db->error( ) . "<br />" . __file__ . " ligne " . __line__ );
|
||||
echo "<table border='1' width='90%'><tr><td><b>date</b></td><td><b>auteur</b></td><td><b>log</b></td><td><b>niveau</b></td></tr>\n";
|
||||
while ( $db->connect->mysqli_fetch_array( $db->result ) )
|
||||
{
|
||||
$niveau = $donnees["niveau"];
|
||||
echo "<tr><td>" . $donnees["date"] . "</td><td>" . $donnees["auteur"] . "</td><td>" . $donnees["log"] . "</td><td>" . $level_s[ $niveau ] . "</td></tr>\n";
|
||||
}
|
||||
echo "</table>\n";
|
||||
}else
|
||||
{
|
||||
"aucune réponse";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Bootstrap the library.
|
||||
*/
|
||||
|
||||
namespace Egulias;
|
||||
|
||||
require_once __DIR__ . '/egulias/email-validator/AutoLoader.php';
|
||||
require_once __DIR__ . '/lib/swift_required.php';
|
||||
$autoloader = new EguliasAutoLoader(__NAMESPACE__, dirname(__DIR__));
|
||||
|
||||
$autoloader->register();
|
Reference in New Issue
Block a user