function LinkURL($url, $linktext='') { if(my_ereg("[<>\"]", $url)) { return "<b><u>BAD URL -- remove all of <, >, "</u></b>"; } if(empty($linktext)) $linktext = htmlspecialchars($url); return "<a href=\"$url\">$linktext</a>"; }
function verif_num($texte_ver) { if (!my_ereg("^[0-9]+\$", $texte_ver)) { $texte_ver = ""; } else { $texte_ver = $texte_ver; } return $texte_ver; }
function DoResponse() { if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) { return; } // Get the main request informaiton. $sCommand = $_GET['Command']; $sResourceType = $_GET['Type']; $sCurrentFolder = $_GET['CurrentFolder']; // Check if it is an allowed type. if (!in_array($sResourceType, array('File', 'Image', 'Flash', 'Media'))) { return; } // Check the current folder syntax (must begin and start with a slash). if (!my_ereg('/$', $sCurrentFolder)) { $sCurrentFolder .= '/'; } if (strpos($sCurrentFolder, '/') !== 0) { $sCurrentFolder = '/' . $sCurrentFolder; } // Check for invalid folder paths (..) if (strpos($sCurrentFolder, '..')) { SendError(102, ""); } // File Upload doesn't have to Return XML, so it must be intercepted before anything. if ($sCommand == 'FileUpload') { FileUpload($sResourceType, $sCurrentFolder); return; } CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder); // Execute the required command. switch ($sCommand) { case 'GetFolders': GetFolders($sResourceType, $sCurrentFolder); break; case 'GetFoldersAndFiles': GetFoldersAndFiles($sResourceType, $sCurrentFolder); break; case 'CreateFolder': CreateFolder($sResourceType, $sCurrentFolder); break; } CreateXmlFooter(); exit; }
$tbs_message = 'Erreur lors du chargement de ' . $titreItem; } //+++++++++++++++++++++++++++ $titreItem = ''; $texteItem = ""; if (!$droitAffiche->set_entree($statutItem, $titreItem, $texteItem)) { $tbs_message = 'Erreur lors du chargement de ' . $titreItem; } $titreItem = 'GepiAccesBulletinSimpleEleve'; $texteItem = "a accès à ses bulletins simplifiés<br />"; $acces_app_ele_resp = getSettingValue('acces_app_ele_resp'); if ($acces_app_ele_resp == "") { $acces_app_ele_resp = 'manuel'; } $delais_apres_cloture = getSettingValue('delais_apres_cloture'); if (!my_ereg("^[0-9]*\$", $delais_apres_cloture)) { $delais_apres_cloture = 0; } $texteItem .= "<em>"; if ($acces_app_ele_resp == 'manuel') { $texteItem .= "L'accès aux appréciations est donné manuellement dans <a href='../classes/acces_appreciations.php' onclick=\"return confirm_abandon(this, change, '{$themessage}')\">Accès aux appréciations et avis du conseil</a>.<br />"; } elseif ($acces_app_ele_resp == 'date') { $texteItem .= "L'accès aux appréciations est ouvert à la date saisie dans <a href='../classes/acces_appreciations.php' onclick=\"return confirm_abandon(this, change, '{$themessage}')\">Accès aux appréciations et avis du conseil</a>.<br />"; } elseif ($acces_app_ele_resp == 'periode_close') { $texteItem .= "L'accès aux appréciations est ouvert automatiquement "; if ($delais_apres_cloture > 0) { $texteItem .= $delais_apres_cloture . " jours après "; } $texteItem .= "la clôture de la période par un compte scolarité."; $texteItem .= "<br />"; }
/** * Fonction prepare_date * * @param $traite_date text une date au format jj/mm/aaa * @return Date Date Une date au bon format pour être enregistrée dans la base * */ function prepare_date($traite_date) { if (my_ereg("([0-9]{2})/([0-9]{2})/([0-9]{4})", $traite_date)) { $annee = substr($traite_date, 6, 4); $mois = substr($traite_date, 3, 2); $jour = substr($traite_date, 0, 2); } else { $annee = strftime("%Y"); $mois = strftime("%m"); $jour = strftime("%d"); } $date = $annee . "-" . $mois . "-" . $jour . " 00:00:00"; return $date; }
$precision = getPref($_SESSION['login'], 'eval_cumul_precision', 's1'); $famille = getPref($_SESSION['login'], 'eval_cumul_vision_famille', 'no'); } $matiere_nom = $current_group["matiere"]["nom_complet"]; $matiere_nom_court = $current_group["matiere"]["matiere"]; $nom_classe = $current_group["classlist_string"]; // enregistrement des données if (isset($_POST['is_posted'])) { check_token(); $msg = ""; $nom_court = traitement_magic_quotes($_POST['nom_court']); $nom_complet = traitement_magic_quotes($_POST['nom_complet']); $description = traitement_magic_quotes($_POST['description']); $precision = $_POST['precision']; $famille = $_POST['famille']; if (!my_ereg("^(s1|s5|se|p1|p5|pe)\$", $precision)) { $msg .= "Précision '{$precision}' invalide; Elle a été remplacée par 's1'."; } // Il faudrait plutôt permettre de paramétrer ce choix dans utilisateurs/mon_compte.php savePref($_SESSION['login'], 'eval_cumul_precision', $precision); savePref($_SESSION['login'], 'eval_cumul_vision_famille', $famille); if (!isset($id_dev)) { $sql = "INSERT INTO cc_dev SET id_groupe='{$id_groupe}', nom_court='{$nom_court}', nom_complet='{$nom_complet}', description='{$description}', arrondir='{$precision}', vision_famille='{$famille}';"; $insert = mysqli_query($GLOBALS["mysqli"], $sql); if (!$insert) { $msg .= "Erreur lors de la création du {$nom_cc}."; } else { $id_dev = is_null($___mysqli_res = mysqli_insert_id($GLOBALS["mysqli"])) ? false : $___mysqli_res; $msg .= "Création du {$nom_cc} effectuée."; } header("Location: index_cc.php?id_racine={$id_racine}&msg={$msg}");
} } if (isset($_POST['releve_photo_hauteur_max'])) { if (!saveSetting("releve_photo_hauteur_max", $_POST['releve_photo_hauteur_max'])) { $msg .= "Erreur lors de l'enregistrement de releve_photo_hauteur_max !"; $reg_ok = 'no'; } } if (isset($_POST['releve_photo_largeur_max'])) { if (!saveSetting("releve_photo_largeur_max", $_POST['releve_photo_largeur_max'])) { $msg .= "Erreur lors de l'enregistrement de releve_photo_largeur_max !"; $reg_ok = 'no'; } } if (isset($_POST['releve_categ_font_size'])) { if (!my_ereg("^[0-9]{1,}\$", $_POST['releve_categ_font_size'])) { $_POST['releve_categ_font_size'] = 10; } if (!saveSetting("releve_categ_font_size", $_POST['releve_categ_font_size'])) { $msg .= "Erreur lors de l'enregistrement de releve_categ_font_size !"; $reg_ok = 'no'; } } if (isset($_POST['releve_affiche_INE_eleve'])) { if (!saveSetting("releve_affiche_INE_eleve", $_POST['releve_affiche_INE_eleve'])) { $msg .= "Erreur lors de l'enregistrement de releve_affiche_INE_eleve !"; $reg_ok = 'no'; } } if (isset($_POST['releve_affiche_tel'])) { if (!saveSetting("releve_affiche_tel", $_POST['releve_affiche_tel'])) {
$unzipped_max_filesize = 10; $msg .= "Caractères invalides pour le paramètre unzipped_max_filesize<br />Initialisation à 10 Mo !"; } if (!saveSetting("unzipped_max_filesize", $unzipped_max_filesize)) { $msg .= "Erreur lors de l'enregistrement du paramètre unzipped_max_filesize !"; } } if (isset($_POST['bul_rel_nom_matieres'])) { $bul_rel_nom_matieres = $_POST['bul_rel_nom_matieres']; if (!saveSetting("bul_rel_nom_matieres", $bul_rel_nom_matieres)) { $msg .= "Erreur lors de l'enregistrement du paramètre bul_rel_nom_matieres !"; } } if (isset($_POST['delais_apres_cloture'])) { $delais_apres_cloture = $_POST['delais_apres_cloture']; if (!my_ereg("^[0-9]{1,}\$", $delais_apres_cloture) || $delais_apres_cloture < 0) { //$delais_apres_cloture=0; $msg .= "Erreur lors de l'enregistrement de delais_apres_cloture !"; } else { if (!saveSetting("delais_apres_cloture", $delais_apres_cloture)) { $msg .= "Erreur lors de l'enregistrement de delais_apres_cloture !"; } } } if (isset($_POST['acces_app_ele_resp'])) { $acces_app_ele_resp = $_POST['acces_app_ele_resp']; if (!saveSetting("acces_app_ele_resp", $acces_app_ele_resp)) { $msg .= "Erreur lors de l'enregistrement de acces_app_ele_resp !"; } } }
$annee = mb_substr($_POST['display_date'], 6, 4); $mois = mb_substr($_POST['display_date'], 3, 2); $jour = mb_substr($_POST['display_date'], 0, 2); } else { $annee = strftime("%Y"); $mois = strftime("%m"); $jour = strftime("%d"); } } else { $annee = strftime("%Y"); $mois = strftime("%m"); $jour = strftime("%d"); } $date = $annee . "-" . $mois . "-" . $jour . " 00:00:00"; if ($_POST['vision_famille ']) { if (my_ereg("([0-9]{2})/([0-9]{2})/([0-9]{4})", $_POST['vision_famille '])) { $annee = mb_substr($_POST['vision_famille '], 6, 4); $mois = mb_substr($_POST['vision_famille '], 3, 2); $jour = mb_substr($_POST['vision_famille '], 0, 2); } else { $annee = strftime("%Y"); $mois = strftime("%m"); $jour = strftime("%d"); } } else { $annee = strftime("%Y"); $mois = strftime("%m"); $jour = strftime("%d"); } $vision_famille = $annee . "-" . $mois . "-" . $jour . " 00:00:00"; $sql = "UPDATE cc_eval SET nom_court='{$nom_court}', nom_complet='{$nom_complet}', description='{$description}', note_sur='{$note_sur}', date='" . $date . "', vision_famille ='" . $vision_famille . "' WHERE id='{$id_eval}';";
//echo "$i: $comment<br />"; // Contrôle des saisies pour supprimer les sauts de lignes surnuméraires. $comment = my_ereg_replace('(\\\\r\\\\n)+', "\r\n", $comment); } //============================== //echo "$reg_eleve_login : $note <br />"; if ($note == 'disp' || $note == 'd') { $note = '0'; $elev_statut = 'disp'; } elseif ($note == 'abs' || $note == 'a') { $note = '0'; $elev_statut = 'abs'; } elseif ($note == '-' || $note == 'n') { $note = '0'; $elev_statut = '-'; } elseif (my_ereg("^[0-9\\.\\,]{1,}\$", $note)) { $note = str_replace(",", ".", "{$note}"); $appel_note_sur = mysqli_query($GLOBALS["mysqli"], "SELECT note_sur FROM cc_eval WHERE id='{$id_eval}'"); $note_sur_verif = old_mysql_result($appel_note_sur, 0, 'note_sur'); if ($note < 0 or $note > $note_sur_verif) { $note = ''; $elev_statut = 'v'; } } else { $note = ''; $elev_statut = 'v'; } $test_eleve_note_query = mysqli_query($GLOBALS["mysqli"], "SELECT * FROM cc_notes_eval WHERE (login='******' AND id_eval = '{$id_eval}')"); $test = mysqli_num_rows($test_eleve_note_query); if ($test != "0") { $sql = "UPDATE cc_notes_eval SET comment='" . $comment . "', note='{$note}',statut='{$elev_statut}' WHERE (login='******' AND id_eval='" . $id_eval . "')";
if ($_POST['ponderation']) { $sql = "UPDATE cn_conteneurs SET ponderation = '" . $_POST['ponderation'] . "' WHERE id = '{$id_conteneur}'"; //echo "$sql<br />"; $reg = mysqli_query($GLOBALS["mysqli"], $sql); if (!$reg) { $reg_ok = "no"; } } else { $sql = "UPDATE cn_conteneurs SET ponderation = '0' WHERE id = '{$id_conteneur}'"; //echo "$sql<br />"; $reg = mysqli_query($GLOBALS["mysqli"], $sql); if (!$reg) { $reg_ok = "no"; } } if ($_POST['precision'] and my_ereg("^(s1|s5|se|p1|p5|pe)\$", $_POST['precision'])) { $sql = "UPDATE cn_conteneurs SET arrondir = '" . $_POST['precision'] . "' WHERE id = '{$id_conteneur}'"; //echo "$sql<br />"; $reg = mysqli_query($GLOBALS["mysqli"], $sql); if (!$reg) { $reg_ok = "no"; } } if (isset($_POST['display_parents'])) { $display_parents = 1; } else { $display_parents = 0; } $sql = "UPDATE cn_conteneurs SET display_parents = '{$display_parents}' WHERE id = '{$id_conteneur}'"; //echo "$sql<br />"; $reg = mysqli_query($GLOBALS["mysqli"], $sql);
closedir($handle); arsort($tab_file); if ($n > 0) { echo "<h3>Fichiers de chargement des données de test</h3>\n"; //echo "<center>\n<table border=\"1\" cellpadding=\"5\" cellspacing=\"1\">\n<tr><td><b>Nom du fichier de sauvegarde</b></td><td> </td><td> </td><td> </td><td> </td></tr>\n"; echo "<center>\n<table class='boireaus' cellpadding=\"5\" cellspacing=\"1\">\n<tr><th><b>Nom du fichier de sauvegarde</b></th><th> </th><th> </th><th> </th></tr>\n"; $m = 0; $alt = 1; foreach ($tab_file as $value) { if ($value == "doc.html") { continue; } //echo "<tr><td><i>".$value."</i> (". round((filesize("../backup/".$dirname."/".$value)/1024),0)." Ko) </td>\n"; $alt = $alt * -1; echo "<tr class='lig{$alt}'><td><i>" . $value . "</i> (" . round(filesize("../backup/" . $dirname . "/" . $value) / 1024, 0) . " Ko) </td>\n"; if (my_ereg('^_photos', $value) && my_ereg('.zip$', $value) || my_ereg('^_cdt', $value) && my_ereg('.zip$', $value)) { echo "<td> </td>\n"; } else { echo "<td><a href='gestion_base_test.php?action=restaure_confirm&file={$value}" . add_token_in_url() . "'>Charger les données</a></td>\n"; } echo "<td><a href='savebackup.php?fileid={$m}'>Télécharger</a></td>\n"; echo "<td><a href='../backup/" . $dirname . "/" . $value . "'>Téléch. direct</a></td>\n"; echo "</tr>\n"; $m++; } clearstatcache(); echo "</table>\n</center>\n<hr />\n"; } ?> <H3>Créer un fichier de sauvegarde/restauration de la base de test <?php
} } echo "<tr><td>" . htmlspecialchars($current_group["matiere"]["nom_complet"]) . "</td>\n"; $k = '1'; while ($k < $nb_periode) { $moyenne_classe_query = mysqli_query($GLOBALS["mysqli"], "SELECT round(avg(note),1) as moyenne FROM matieres_notes WHERE (periode='$k' AND id_groupe='" . $current_group["id"] . "' AND statut = '')"); $moyenne_classe = old_mysql_result($moyenne_classe_query, 0, "moyenne"); $moyenne_classe2_query = mysqli_query($GLOBALS["mysqli"], "SELECT round(avg(note),1) as moyenne FROM matieres_notes WHERE (periode='$k' AND id_groupe='" . $current_group2["id"] . "' AND statut = '')"); $moyenne_classe2 = old_mysql_result($moyenne_classe2_query, 0, "moyenne"); if ($moyenne_classe == '') {$moyenne_classe = '-';} if ($moyenne_classe2 == '') {$moyenne_classe2 = '-';} echo "<td>$moyenne_classe</td><td>$moyenne_classe2</td>\n"; (my_ereg ("^[0-9\.\,]{1,}$", $moyenne_classe)) ? array_push($datay1[$k],"$moyenne_classe") : array_push($datay1[$k],"0"); (my_ereg ("^[0-9\.\,]{1,}$", $moyenne_classe2)) ? array_push($datay2[$k],"$moyenne_classe2") : array_push($datay2[$k],"0"); if ($k == '1') { //array_push($etiquette,$current_group["matiere"]["nom_complet"]); array_push($etiquette,rawurlencode($current_group["matiere"]["nom_complet"])); } $compteur++; $k++; } } $i++; } echo "</table>\n"; echo "<a name=\"graph\"></a>\n"; echo "<p class='bold'>|<a href='../accueil.php'>Accueil</a>|<a href='index.php'>Autre outil de visualisation</a>|<a href='classe_classe.php?id_classe='>Choix des classes</a>|</p>\n"; $etiq = implode("|", $etiquette); $graph_title = urlencode($graph_title);
$test_eleve_naissance = @old_mysql_result($call_eleve_test, "0", "naissance"); $format = mb_strlen($test_eleve_naissance); // Cas de la création d'un élève $reg_nom = trim($reg_nom); $reg_prenom = trim($reg_prenom); $reg_email = trim($reg_email); if ($reg_resp1 == '(vide)') { $reg_resp1 = ''; } if (!my_ereg("^[0-9]{4}\$", $birth_year)) { $birth_year = "1900"; } if (!my_ereg("^[0-9]{2}\$", $birth_month)) { $birth_month = "01"; } if (!my_ereg("^[0-9]{2}\$", $birth_day)) { $birth_day = "01"; } if ($format == '10') { // YYYY-MM-DD $reg_naissance = $birth_year . "-" . $birth_month . "-" . $birth_day . " 00:00:00"; } else { if ($format == '8') { // YYYYMMDD $reg_naissance = $birth_year . $birth_month . $birth_day; settype($reg_naissance, "integer"); } else { // Format inconnu $reg_naissance = $birth_year . $birth_month . $birth_day; } }
if ($resultat_session == '0') { header("Location: ../logout.php?auto=1"); die; } } if (!checkAccess()) { header("Location: ../logout.php?auto=1"); die; } $msg = ''; if (isset($new_name_defined)) { if (!my_ereg("^[[:print:]]{1,10}\$", trim($nom_court))) { $msg .= "Le nom court doit être composé de caractères alphanumériques (de 1 à 10 caractères).<br />"; unset($new_name_defined); } if (!my_ereg("^([[:print:]]|[âäàéèêëüûöôîï]){1,50}\$", trim($nom_complet))) { $msg .= "Le nom complet doit être composé de caractères alphanumériques (de 1 à 50 caractères).<br />"; unset($new_name_defined); } } if (isset($eleves_selected)) { check_token(); // On fait l'enregistrement de la nouvelle classe $get_settings = mysqli_query($GLOBALS["mysqli"], "SELECT * FROM classes WHERE id='{$id_classe}'"); $suivi_par = traitement_magic_quotes(corriger_caracteres(@old_mysql_result($get_settings, "0", "suivi_par"))); $formule = traitement_magic_quotes(corriger_caracteres(@old_mysql_result($get_settings, "0", "formule"))); $nom_court = traitement_magic_quotes(corriger_caracteres(urldecode($nom_court))); $nom_complet = traitement_magic_quotes(corriger_caracteres(urldecode($nom_complet))); $register_newclass = mysqli_query($GLOBALS["mysqli"], "INSERT INTO classes SET\n classe='{$nom_court}',\n nom_complet='{$nom_complet}',\n formule='{$formule}',\n suivi_par='{$suivi_par}',\n format_nom='np'"); if (!$register_newclass) { $msg .= "Erreur lors de l'enregistrement de la nouvelle classe.<br />";
echo "</tr>\n"; } } $alt=$alt*(-1); echo "<tr class='lig$alt'><td><p>" . htmlspecialchars($current_group["description"]) . "</p></td>\n"; $k="1"; while ($k < $nb_periode) { $note_eleve_query=mysqli_query($GLOBALS["mysqli"], "SELECT * FROM matieres_notes WHERE (login='******' AND periode='$k' AND id_groupe='" . $current_group["id"] . "')"); $eleve_matiere_statut = @old_mysql_result($note_eleve_query, 0, "statut"); $note_eleve = @old_mysql_result($note_eleve_query, 0, "note"); if ($eleve_matiere_statut != "") { $note_eleve = $eleve_matiere_statut;} if ($note_eleve == '') {$note_eleve = '-';} echo "<td><p>$note_eleve"; echo "</p></td>\n"; (my_ereg ("^[0-9\.\,]{1,}$", $note_eleve)) ? array_push($datay[$k],"$note_eleve") : array_push($datay[$k],"0"); if ($k == '1') { //array_push($etiquette,$current_group["description"]); array_push($etiquette,rawurlencode($current_group["description"])); } $compteur++; $k++; } echo "</tr>\n"; $compteur++; $i++; } echo "</table>\n";
header("Location: ../logout.php?auto=1"); die; } $msg = ''; if (isset($_POST['max_size_ko'])) { check_token(); if (my_ereg("^[0-9]{1,}\$", $_POST['max_size_ko'])) { $max_size = $_POST['max_size_ko'] * 1024; if (!saveSetting("max_size", $max_size)) { $msg = "Erreur lors de l'enregistrement de la taille maximale autorisée pour un fichier !"; } } } if (isset($_POST['total_max_size_ko'])) { check_token(); if (my_ereg("^[0-9]{1,}\$", $_POST['total_max_size_ko'])) { $total_max_size = $_POST['total_max_size_ko'] * 1024; if (!saveSetting("total_max_size", $total_max_size)) { $msg = "Erreur lors de l'enregistrement de la taille de l'espace disque maximal autorisé pour une rubrique !"; } } } if (isset($_POST['is_posted']) and $msg == '') { $msg = "Les modifications ont été enregistrées !"; } // header $titre_page = "Gestion des cahiers de texte"; require_once "../lib/header.inc.php"; ?> <p class=bold> <a href="index.php"><img src='../images/icons/back.png' alt='Retour' class='back_link'/> Retour</a>
echo "lycee"; $chaine .= "lycee"; } } else { echo " "; $chaine .= ""; } } else { echo " "; } echo "</td>\n"; $chaine .= ";"; // TYPE echo "<td>"; if (isset($eleves[$i]["scolarite_an_dernier"]["denom_princ"])) { if (my_ereg("PRIVE", $eleves[$i]["scolarite_an_dernier"]["denom_princ"])) { echo "prive"; $chaine .= "prive"; } else { echo "public"; $chaine .= "public"; } } else { echo " "; } echo "</td>\n"; $chaine .= ";"; // CODE POSTAL: Non présent dans le fichier ElevesSansAdresses.xml // Ca y est, il a été ajouté. // Il faudrait le fichier Communes.xml ou quelque chose de ce genre. echo "<td>";
echo "Manuel</div>\n"; } } } } } } } elseif ($_GET['mode'] == 'date') { $choix_date = isset($_GET['choix_date']) ? $_GET['choix_date'] : NULL; // Contrôler que la date est valide $poursuivre = "y"; if ($choix_date == '') { $poursuivre = "n"; //echo "<script type='text/javascript'>alert('Veuillez saisir une date valide.');</script>\n"; echo "<span style='color:red'>Date saisie invalide</span>"; } elseif (!my_ereg("[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}", $choix_date)) { $poursuivre = "n"; echo "<span style='color:red'>Date saisie invalide</span>"; } else { $tabdate = explode("/", $choix_date); $jour = $tabdate[0]; $mois = $tabdate[1]; $annee = $tabdate[2]; if (!checkdate($mois, $jour, $annee)) { $poursuivre = "n"; echo "<span style='color:red'>Date saisie invalide</span>"; } } if ($poursuivre == "y") { $choix_date = $annee . "-" . $mois . "-" . $jour; $display_date = $jour . "/" . $mois . "/" . $annee;
} } } } } } } } // AU CAS OU ON NE VEUT PAS LES IDENTIFIANTS ELEVES, CREER SYSTEMATIQUEMENT UN IDENTIFIANT TEMPORAIRE ASSOCIé A UN LOGIN ELEVE // $tab_id_csv_eleve[login]=id_temp $nom_fic = "export_donnees_bulletins_" . date("Ymd_His") . ".csv"; $now = gmdate('D, d M Y H:i:s') . ' GMT'; header('Content-Type: text/x-csv'); header('Expires: ' . $now); // lem9 & loic1: IE need specific headers if (my_ereg('MSIE', $_SERVER['HTTP_USER_AGENT'])) { header('Content-Disposition: inline; filename="' . $nom_fic . '"'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } else { header('Content-Disposition: attachment; filename="' . $nom_fic . '"'); header('Pragma: no-cache'); } echo $csv; die; } // ======================== CSS et js particuliers ======================== $utilisation_win = "non"; $utilisation_jsdivdrag = "non"; //$javascript_specifique = ".js"; //$style_specifique = ".css";
function myWriteHTML($html) { global $my_echo_debug, $mode_my_echo_debug; //================================ // Options de debug // Passer à 1 pour débugger $my_echo_debug = 0; //$my_echo_debug=1; // Les modes sont 'fichier' ou n'importe quoi d'autre qui provoque des echo... donc un échec de la génération de PDF... à ouvrir avec un bloc-notes, pas avec un lecteur PDF // Voir la fonction my_echo_debug() pour l'emplacement du fichier généré $mode_my_echo_debug = 'fichier'; //$mode_my_echo_debug=''; //================================ if ($my_echo_debug == 1) { my_echo_debug("\n =====================================\n"); } if ($my_echo_debug == 1) { my_echo_debug(" myWriteHTML: Lancement sur \"{$html}\" \n"); } //Parseur HTML $html = str_replace("\n", ' ', $html); $html = str_replace("\r", '', $html); $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($a as $i => $e) { if ($i % 2 == 0) { // Il se passe un truc bizarre avec un saut de 10cm quasiment sur l'abscisse de retour après écriture d'une cellule vide. if ($e != "") { if ($my_echo_debug == 1) { my_echo_debug(" myWriteHTML: Avant écriture de \"{$e}\"\n myWriteHTML: x=" . $this->GetX() . " et y=" . $this->GetY() . "\n"); } if ($my_echo_debug == 1) { my_echo_debug(" myWriteHTML: Largeur de \"{$e}\": " . $this->GetStringWidth($e) . "\n"); } $this->Cell($this->GetStringWidth($e), 5, $e, 0, 0, ''); if ($my_echo_debug == 1) { my_echo_debug(" myWriteHTML: Après écriture de \"{$e}\"\n myWriteHTML: x=" . $this->GetX() . " et y=" . $this->GetY() . "\n"); } } } else { //Balise if ($e[0] == '/') { $tag = strtoupper(substr($e, 1)); if ($tag == 'B' or $tag == 'I' or $tag == 'U') { if ($my_echo_debug == 1) { my_echo_debug(" myWriteHTML: Avant fermeture de \"{$tag}\"\n myWriteHTML: x=" . $this->GetX() . " et y=" . $this->GetY() . "\n"); } $this->MyCloseTag($tag); if ($my_echo_debug == 1) { my_echo_debug(" myWriteHTML: Après fermeture de \"{$tag}\"\n myWriteHTML: x=" . $this->GetX() . " et y=" . $this->GetY() . "\n"); } } } else { //Extraction des attributs $a2 = explode(' ', $e); $tag = strtoupper(array_shift($a2)); $attr = array(); if (function_exists("mb_ereg")) { foreach ($a2 as $v) { if (mb_ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) { $attr[strtoupper($a3[1])] = $a3[2]; } } } else { foreach ($a2 as $v) { if (my_ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) { $attr[strtoupper($a3[1])] = $a3[2]; } } } if ($tag == 'B' or $tag == 'I' or $tag == 'U') { if ($my_echo_debug == 1) { my_echo_debug(" myWriteHTML: Avant ouverture de \"{$tag}\"\n myWriteHTML: x=" . $this->GetX() . " et y=" . $this->GetY() . "\n"); } $this->MyOpenTag($tag, $attr); if ($my_echo_debug == 1) { my_echo_debug(" myWriteHTML: Après ouverture de \"{$tag}\"\n myWriteHTML: x=" . $this->GetX() . " et y=" . $this->GetY() . "\n"); } } } } } }
if(!$user_tmp){ $msg="Votre dossier temporaire n'est pas accessible."; header("Location: index.php?msg=".rawurlencode($msg)); die(); } //$chemin_temp="../temp/".getSettingValue("temp_directory"); $chemin_temp="../temp/".$user_tmp; $chemin_modele_ods="export_note_app_modele_ods"; if(isset($nettoyage)){ if(!my_ereg(".ods$",$nettoyage)){ $msg="Le fichier n'est pas d'extension ODS."; } elseif(!my_ereg("^".$_SESSION['login'],$nettoyage)){ $msg="Vous tentez de supprimer des fichiers qui ne vous appartiennent pas."; } else{ if(mb_strlen(my_ereg_replace("[a-zA-Z0-9_.]","",strtr($nettoyage,"-","_")))!=0){ $msg="Le fichier proposé n'est pas valide: '".my_ereg_replace("[a-zA-Z0-9_.]","",strtr($nettoyage,"-","_"))."'"; } else{ if(!file_exists("$chemin_temp/$nettoyage")){ $msg="Le fichier choisi n'existe pas."; } else{ unlink("$chemin_temp/$nettoyage"); $msg=rawurlencode("Suppression réussie!"); } }
//======================= //=== Initialisation des variables === //======================= $titre_page = "Fiches Brevet"; // Récupération des variables: // Tableau des classes: $id_classe = isset($_POST['id_classe']) ? $_POST['id_classe'] : (isset($_GET['id_classe']) ? $_GET['id_classe'] : NULL); $type_brevet = isset($_POST['type_brevet']) ? $_POST['type_brevet'] : (isset($_GET['type_brevet']) ? $_GET['type_brevet'] : NULL); if(isset($type_brevet)) { if((!my_ereg("[0-9]",$type_brevet))||(mb_strlen(my_ereg_replace("[0-9]","",$type_brevet))!=0)) { $type_brevet=NULL; } } $avec_app=isset($_POST['avec_app']) ? $_POST['avec_app'] : "n"; //===================================== //=== PARAMÉTRAGE GENERAL DES FICHES BREVETS === //===================================== if (isset($_GET['parametrer'])) { //**************** EN-TETE *****************
function privDeleteByRule(&$p_result_list, &$p_options) { //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDeleteByRule", ""); $v_result=1; $v_list_detail = array(); // ----- Open the zip file //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode"); if (($v_result=$this->privOpenFd('rb')) != 1) { // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } // ----- Read the central directory informations $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privCloseFd(); //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } // ----- Go to beginning of File //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'"); @rewind($this->zip_fd); //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'"); // ----- Scan all the files // ----- Start at beginning of Central Dir $v_pos_entry = $v_central_dir['offset']; //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'"); @rewind($this->zip_fd); //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'"); if (@fseek($this->zip_fd, $v_pos_entry)) { // ----- Close the zip file $this->privCloseFd(); // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); return PclZip::errorCode(); } //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'"); // ----- Read each entry $v_header_list = array(); $j_start = 0; for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$i')"); // ----- Read the file header $v_header_list[$v_nb_extracted] = array(); if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) { // ----- Close the zip file $this->privCloseFd(); //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$i') : '".$v_header_list[$v_nb_extracted]['stored_filename']."'"); // ----- Store the index $v_header_list[$v_nb_extracted]['index'] = $i; // ----- Look for the specific extract rules $v_found = false; // ----- Look for extract by name rule if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'"); // ----- Look if the filename is in the list for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'"); // ----- Look for a directory if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory"); // ----- Look if the directory is in the filename path if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path"); $v_found = true; } elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory"); $v_found = true; } } // ----- Look for a filename elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one."); $v_found = true; } } } // ----- Look for extract by ereg rule else if ( (isset($p_options[PCLZIP_OPT_BY_EREG])) && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'"); if (my_ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression"); $v_found = true; } } // ----- Look for extract by preg rule else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'"); if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression"); $v_found = true; } } // ----- Look for extract by index rule else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'"); // ----- Look if the index is in the list for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]"); if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range"); $v_found = true; } if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop"); $j_start = $j+1; } if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop"); break; } } } else { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "No argument mean remove all file"); $v_found = true; } // ----- Look for deletion if ($v_found) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need to be deleted"); unset($v_header_list[$v_nb_extracted]); } else { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will not be deleted"); $v_nb_extracted++; } } // ----- Look if something need to be deleted if ($v_nb_extracted > 0) { // ----- Creates a temporay file $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; // ----- Creates a temporary zip archive $v_temp_zip = new PclZip($v_zip_temp_name); // ----- Open the temporary zip file in write mode //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode"); if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) { $this->privCloseFd(); // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } // ----- Look which file need to be kept for ($i=0; $i<sizeof($v_header_list); $i++) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$i' : '".$v_header_list[$i]['filename']."'"); // ----- Calculate the position of the header //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'"); //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'"); @rewind($this->zip_fd); //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'"); if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { // ----- Close the zip file $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); return PclZip::errorCode(); } //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'"); // ----- Read the file header $v_local_header = array(); if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) { // ----- Close the zip file $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } // ----- Check that local file header is same as central file header if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) { // TBC } unset($v_local_header); // ----- Write the file header if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) { // ----- Close the zip file $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'"); // ----- Read/write the data block if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) { // ----- Close the zip file $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } } // ----- Store the offset of the central dir $v_offset = @ftell($v_temp_zip->zip_fd); //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset"); // ----- Re-Create the Central Dir files header //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory"); for ($i=0; $i<sizeof($v_header_list); $i++) { // ----- Create the file header //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']); if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) { $v_temp_zip->privCloseFd(); $this->privCloseFd(); @unlink($v_zip_temp_name); // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } // ----- Transform the header to a 'usable' info $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); } //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer"); // ----- Zip file comment $v_comment = ''; if (isset($p_options[PCLZIP_OPT_COMMENT])) { $v_comment = $p_options[PCLZIP_OPT_COMMENT]; } // ----- Calculate the size of the central header $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset; // ----- Create the central dir footer if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { // ----- Reset the file list unset($v_header_list); $v_temp_zip->privCloseFd(); $this->privCloseFd(); @unlink($v_zip_temp_name); // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } // ----- Close $v_temp_zip->privCloseFd(); $this->privCloseFd(); // ----- Delete the zip file // TBC : I should test the result ... @unlink($this->zipname); // ----- Rename the temporary file // TBC : I should test the result ... //@rename($v_zip_temp_name, $this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); // ----- Destroy the temporary archive unset($v_temp_zip); } // ----- Remove every files : reset the file else if ($v_central_dir['entries'] != 0) { $this->privCloseFd(); if (($v_result = $this->privOpenFd('wb')) != 1) { //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) { //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } $this->privCloseFd(); } // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; }