Server : Apache System : Linux webd348.cluster026.gra.hosting.ovh.net 5.15.148-ovh-vps-grsec-zfs-classid #1 SMP Thu Feb 8 09:41:04 UTC 2024 x86_64 User : hednacluml ( 122243) PHP Version : 8.3.9 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Directory : /home/hednacluml/aides/tmp/cache/skel/ |
<?php /* * Squelette : plugins/auto/article_pdf/rubrique_pdf.html * Date : Thu, 10 Oct 2024 10:22:09 GMT * Compile : Sat, 12 Oct 2024 08:54:30 GMT * Boucles : _rubrique_mere, _auteurs, _keywords, _yahoo, _principale */ function BOUCLE_rubrique_merehtml_4e9dfb73f38552aceae6d8960331dca1(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!isset($command['table'])) { $command['table'] = 'rubriques'; $command['id'] = '_rubrique_mere'; $command['from'] = array('rubriques' => 'spip_rubriques'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("rubriques.titre", "rubriques.lang"); $command['orderby'] = array(); $command['join'] = array(); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array( quete_condition_statut('rubriques.statut','!','publie',''), array('=', 'rubriques.id_rubrique', sql_quote($Pile[$SP]['id_parent'], '','bigint NOT NULL AUTO_INCREMENT'))); if (defined("_BOUCLE_PROFILER")) $timer = time()+(float)microtime(); $t0 = ""; // REQUETE $iter = Spip\Compilateur\Iterateur\Factory::create( "SQL", $command, array('plugins/auto/article_pdf/rubrique_pdf.html','html_4e9dfb73f38552aceae6d8960331dca1','_rubrique_mere',20,$GLOBALS['spip_lang']) ); if (!$iter->err()) { lang_select($GLOBALS['spip_lang']); $SP++; // RESULTATS while ($Pile[$SP]=$iter->fetch()) { lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']); $t0 .= interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(supprimer_numero(supprimer_numero(typo($Pile[$SP]['titre'], "TYPO", $connect, $Pile[0]))))))); lang_select(); } lang_select(); $iter->free(); } if (defined("_BOUCLE_PROFILER") AND 1000*($timer = (time()+(float)microtime())-$timer) > _BOUCLE_PROFILER) spip_log(intval(1000*$timer)."ms BOUCLE_rubrique_mere @ plugins/auto/article_pdf/rubrique_pdf.html","profiler"._LOG_AVERTISSEMENT); return $t0; } function BOUCLE_auteurshtml_4e9dfb73f38552aceae6d8960331dca1(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!isset($command['table'])) { $command['table'] = 'auteurs'; $command['id'] = '_auteurs'; $command['from'] = array('auteurs' => 'spip_auteurs','L1' => 'spip_auteurs_liens'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("auteurs.nom"); $command['orderby'] = array(); $command['join'] = array('L1' => array('auteurs','id_auteur')); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array( quete_condition_statut('auteurs.statut','!5poubelle','!5poubelle',''), array('=', 'L1.id_objet', sql_quote($Pile[$SP]['id_rubrique'], '','bigint NOT NULL DEFAULT \'0\'')), array('=', 'L1.objet', sql_quote('rubrique'))); if (defined("_BOUCLE_PROFILER")) $timer = time()+(float)microtime(); $t0 = ""; // REQUETE $iter = Spip\Compilateur\Iterateur\Factory::create( "SQL", $command, array('plugins/auto/article_pdf/rubrique_pdf.html','html_4e9dfb73f38552aceae6d8960331dca1','_auteurs',24,$GLOBALS['spip_lang']) ); if (!$iter->err()) { $SP++; // RESULTATS while ($Pile[$SP]=$iter->fetch()) { $t1 = interdire_scripts(texte_script(pdf_first_clean(safehtml(supprimer_numero(typo($Pile[$SP]['nom'], "TYPO", $connect, $Pile[0])))))); $t0 .= ((strlen($t1) && strlen($t0)) ? ', ' : '') . $t1; } $iter->free(); } if (defined("_BOUCLE_PROFILER") AND 1000*($timer = (time()+(float)microtime())-$timer) > _BOUCLE_PROFILER) spip_log(intval(1000*$timer)."ms BOUCLE_auteurs @ plugins/auto/article_pdf/rubrique_pdf.html","profiler"._LOG_AVERTISSEMENT); return $t0; } function BOUCLE_keywordshtml_4e9dfb73f38552aceae6d8960331dca1(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!isset($command['table'])) { $command['table'] = 'mots'; $command['id'] = '_keywords'; $command['from'] = array('mots' => 'spip_mots','L1' => 'spip_mots_liens'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("mots.titre"); $command['orderby'] = array(); $command['join'] = array('L1' => array('mots','id_mot')); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array( array('=', 'L1.id_objet', sql_quote($Pile[$SP]['id_rubrique'], '','bigint NOT NULL DEFAULT \'0\'')), array('=', 'L1.objet', sql_quote('rubrique'))); if (defined("_BOUCLE_PROFILER")) $timer = time()+(float)microtime(); $t0 = ""; // REQUETE $iter = Spip\Compilateur\Iterateur\Factory::create( "SQL", $command, array('plugins/auto/article_pdf/rubrique_pdf.html','html_4e9dfb73f38552aceae6d8960331dca1','_keywords',25,$GLOBALS['spip_lang']) ); if (!$iter->err()) { $SP++; // RESULTATS while ($Pile[$SP]=$iter->fetch()) { $t1 = interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(supprimer_numero(typo($Pile[$SP]['titre'], "TYPO", $connect, $Pile[0])))))); $t0 .= ((strlen($t1) && strlen($t0)) ? ', ' : '') . $t1; } $iter->free(); } if (defined("_BOUCLE_PROFILER") AND 1000*($timer = (time()+(float)microtime())-$timer) > _BOUCLE_PROFILER) spip_log(intval(1000*$timer)."ms BOUCLE_keywords @ plugins/auto/article_pdf/rubrique_pdf.html","profiler"._LOG_AVERTISSEMENT); return $t0; } function BOUCLE_yahoohtml_4e9dfb73f38552aceae6d8960331dca1(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!($id_rubrique = intval($Pile[$SP]['id_rubrique']))) return ''; include_spip('inc/rubriques'); $hierarchie = calcul_hierarchie_in($id_rubrique,false); if (!$hierarchie) return ""; if (!isset($command['table'])) { $command['table'] = 'rubriques'; $command['id'] = '_yahoo'; $command['from'] = array('rubriques' => 'spip_rubriques'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("rubriques.titre", "rubriques.lang"); $command['join'] = array(); $command['limit'] = ''; $command['having'] = array(); } $command['orderby'] = array("FIELD(rubriques.id_rubrique, $hierarchie)"); $command['where'] = array( quete_condition_statut('rubriques.statut','!','publie',''), array('IN', 'rubriques.id_rubrique', "($hierarchie)")); if (defined("_BOUCLE_PROFILER")) $timer = time()+(float)microtime(); $t0 = ""; // REQUETE $iter = Spip\Compilateur\Iterateur\Factory::create( "SQL", $command, array('plugins/auto/article_pdf/rubrique_pdf.html','html_4e9dfb73f38552aceae6d8960331dca1','_yahoo',26,$GLOBALS['spip_lang']) ); if (!$iter->err()) { lang_select($GLOBALS['spip_lang']); $SP++; // RESULTATS while ($Pile[$SP]=$iter->fetch()) { lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']); $t0 .= ( ' ' . interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(supprimer_numero(supprimer_numero(typo($Pile[$SP]['titre'], "TYPO", $connect, $Pile[0]))))))) . ' - '); lang_select(); } lang_select(); $iter->free(); } if (defined("_BOUCLE_PROFILER") AND 1000*($timer = (time()+(float)microtime())-$timer) > _BOUCLE_PROFILER) spip_log(intval(1000*$timer)."ms BOUCLE_yahoo @ plugins/auto/article_pdf/rubrique_pdf.html","profiler"._LOG_AVERTISSEMENT); return $t0; } function BOUCLE_principalehtml_4e9dfb73f38552aceae6d8960331dca1(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!isset($command['table'])) { $command['table'] = 'rubriques'; $command['id'] = '_principale'; $command['from'] = array('rubriques' => 'spip_rubriques'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("rubriques.id_parent", "rubriques.id_rubrique", "rubriques.date", "rubriques.titre", "rubriques.descriptif", "rubriques.texte", "rubriques.lang"); $command['orderby'] = array(); $command['join'] = array(); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array( quete_condition_statut('rubriques.statut','!','publie',''), array('=', 'rubriques.id_rubrique', sql_quote(($Pile[0]['id_rubrique'] ?? null), '','bigint NOT NULL AUTO_INCREMENT'))); if (defined("_BOUCLE_PROFILER")) $timer = time()+(float)microtime(); $t0 = ""; // REQUETE $iter = Spip\Compilateur\Iterateur\Factory::create( "SQL", $command, array('plugins/auto/article_pdf/rubrique_pdf.html','html_4e9dfb73f38552aceae6d8960331dca1','_principale',12,$GLOBALS['spip_lang']) ); if (!$iter->err()) { lang_select($GLOBALS['spip_lang']); $SP++; // RESULTATS while ($Pile[$SP]=$iter->fetch()) { lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']); $t0 .= ( ' $conf_url_site = \'' . texte_script(url_absolue(vider_url(urlencode_1738(generer_objet_url($Pile[$SP]['id_rubrique'], 'rubrique', '', '', true))))) . '\' ; $conf_nom_site = \'' . interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(typo($GLOBALS['meta']['nom_site'], "TYPO", $connect, $Pile[0]))))) . '\' ; // Recuperation et definition des differents elements $site=\'' . interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(typo($GLOBALS['meta']['nom_site'], "TYPO", $connect, $Pile[0]))))) . '\'; $rubrique=\'' . (($t1 = BOUCLE_rubrique_merehtml_4e9dfb73f38552aceae6d8960331dca1($Cache, $Pile, $doublons, $Numrows, $SP))!=='' ? $t1 : (interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(typo($GLOBALS['meta']['nom_site'], "TYPO", $connect, $Pile[0]))))))) . '\'; $DateParution=\'' . texte_script(pdf_first_clean(affdate(normaliser_date(($Pile[0]['date_redac'] ?? null))))) . '\'; $DateMiseEnLigne=\'' . interdire_scripts(texte_script(nom_jour(normaliser_date($Pile[$SP]['date'])))) . ' ' . interdire_scripts(texte_script(pdf_first_clean(affdate(normaliser_date($Pile[$SP]['date']))))) . '\'; /*$auteur=\'' . BOUCLE_auteurshtml_4e9dfb73f38552aceae6d8960331dca1($Cache, $Pile, $doublons, $Numrows, $SP) . '\';*/ $motsclef=/*\'' . BOUCLE_keywordshtml_4e9dfb73f38552aceae6d8960331dca1($Cache, $Pile, $doublons, $Numrows, $SP) . '\'*/\'\'; $yahoo=\'-' . BOUCLE_yahoohtml_4e9dfb73f38552aceae6d8960331dca1($Cache, $Pile, $doublons, $Numrows, $SP) . '\'; $logo_site=\'' . texte_script(extraire_attribut(quete_html_logo(quete_logo('id_syndic', 'ON', "'0'", ''), '', ''),'src')) . '\'; // attention à l\'ordre des filtres SPIP ' . (($t1 = strval(filtre_supprimer_param_logo(texte_script(extraire_attribut(quete_html_logo(quete_logo('id_rubrique', 'ON', $Pile[$SP]['id_rubrique'], quete_parent($Pile[$SP]['id_rubrique'])), '', ''),'src')))))!=='' ? ('$logo_fichier=\'' . $t1 . '\';') : '') . ' // ' . (($t1 = strval(vider_url(urlencode_1738(generer_objet_url(($Pile[0]['id_article'] ?? null), 'article', '', '', true)))))!=='' ? ('$logo_lien="' . $t1 . '";') : '') . ' ' . (($t1 = strval(interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(typo(($Pile[0]['surtitre'] ?? null), "TYPO", $connect, $Pile[0])))))))!=='' ? ('$surtitre=\'' . $t1 . '\';') : '') . ' ' . (($t1 = strval(interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(supprimer_numero(supprimer_numero(typo($Pile[$SP]['titre'], "TYPO", $connect, $Pile[0])))))))))!=='' ? ('$titre=\'' . $t1 . '\';') : '') . ' ' . (($t1 = strval(interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(typo(($Pile[0]['soustitre'] ?? null), "TYPO", $connect, $Pile[0])))))))!=='' ? ('$soustitre=\'' . $t1 . '\';') : '') . ' ' . (($t1 = strval(interdire_scripts(texte_script(pdf_first_clean(propre(($Pile[0]['chapo'] ?? null), $connect, $Pile[0]))))))!=='' ? ('$chapo=\'' . $t1 . '\';') : '') . ' ' . (($t1 = strval(interdire_scripts(texte_script(pdf_first_clean(propre($Pile[$SP]['descriptif'], $connect, $Pile[0]))))))!=='' ? ('$descriptif=\'' . $t1 . '\';') : '') . ' ' . (($t1 = strval(interdire_scripts(texte_script(pdf_first_clean(propre($Pile[$SP]['texte'], $connect, $Pile[0]))))))!=='' ? ('$texte= \'' . $t1 . '\';') : '') . ' ' . (($t1 = strval(interdire_scripts(texte_script(pdf_first_clean(propre(($Pile[0]['ps'] ?? null), $connect, $Pile[0]))))))!=='' ? ('$ps=\'' . $t1 . '\';') : '') . ' ' . (($t1 = strval(interdire_scripts(texte_script(pdf_first_clean(calculer_notes())))))!=='' ? ('$notes=\'' . $t1 . '\';') : '') . ' $copyright = \'' . texte_script(pdf_first_clean(_T('articlepdf:copyright'))) . interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(typo($GLOBALS['meta']['nom_site'], "TYPO", $connect, $Pile[0]))))) . texte_script(pdf_first_clean(_T('articlepdf:tous_droits_reserves'))) . '\'; $id_rubrique = "' . $Pile[$SP]['id_rubrique'] . '"; $titre_rubrique = translitteration(corriger_caracteres(\'' . interdire_scripts(texte_script(supprimer_tags(pdf_first_clean(supprimer_numero(supprimer_numero(typo($Pile[$SP]['titre'], "TYPO", $connect, $Pile[0]))))))) . '\')); // Reprise du code de urls/propres.php (pourquoi c\'est pas une fonction de l\'API de SPIP ?) // on va convertir tous les caracteres de ponctuation et espaces // a l\'exception de l\'underscore (_), car on veut le conserver dans l\'url $titre_rubrique = str_replace(\'_\', chr(7), $titre_rubrique); $titre_rubrique = @preg_replace(\',[[:punct:][:space:]]+,u\', \' \', $titre_rubrique); $titre_rubrique = str_replace(chr(7), \'_\', $titre_rubrique); // S\'il reste trop de caracteres non latins, les gerer comme wikipedia // avec rawurlencode : if (preg_match_all(",[^a-zA-Z0-9 _]+,", $titre_rubrique, $r, PREG_SET_ORDER)) { foreach ($r as $regs) { $titre_rubrique = substr_replace($titre_rubrique, rawurlencode($regs[0]), strpos($titre_rubrique, $regs[0]), strlen($regs[0])); } } // S\'il reste trop peu, on retombe sur rubrique12 if (strlen($titre_rubrique) == 0 ) { $titre_rubrique = "rubrique"; } // Sinon couper les mots et les relier par des tirets else { $mots = preg_split(",[^a-zA-Z0-9_%]+,", $titre_rubrique); $titre_rubrique = \'\'; foreach ($mots as $mot) { if (!strlen($mot)) continue; $titre_rubrique2 = $titre_rubrique.\'-\'.$mot; // Si on depasse _URLS_PROPRES_MAX caracteres, s\'arreter // ne pas compter 3 caracteres pour %E9 mais un seul $long = preg_replace(\',%.,\', \'\', $titre_rubrique2); if (strlen($long) > _URLS_PROPRES_MAX) { break; } $titre_rubrique = $titre_rubrique2; } $titre_rubrique = substr($titre_rubrique, 1); // On enregistre en utf-8 dans la base $titre_rubrique = rawurldecode($titre_rubrique); if (strlen($titre_rubrique) == 0) $titre_rubrique = "rubrique"; } $files_pdf = $titre_rubrique."_".$id_rubrique.".pdf"; $file_out = $path_pdf . $files_pdf ; if (file_exists($file_out)) { clearstatcache; $damo = date(YmdHi , strtotime("' . normaliser_date(($Pile[0]['date_modif'] ?? null)) . '")) ; $dage = date(YmdHi , filemtime($file_out)) ; if ($damo > $dage) { unlink($file_out); } } '); lang_select(); } lang_select(); $iter->free(); } if (defined("_BOUCLE_PROFILER") AND 1000*($timer = (time()+(float)microtime())-$timer) > _BOUCLE_PROFILER) spip_log(intval(1000*$timer)."ms BOUCLE_principale @ plugins/auto/article_pdf/rubrique_pdf.html","profiler"._LOG_AVERTISSEMENT); return $t0; } // // Fonction principale du squelette plugins/auto/article_pdf/rubrique_pdf.html // Temps de compilation total: 73.576 ms // function html_4e9dfb73f38552aceae6d8960331dca1($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { if (isset($Pile[0]["doublons"]) AND is_array($Pile[0]["doublons"])) $doublons = nettoyer_env_doublons($Pile[0]["doublons"]); $connect = ''; $page = ( '<'.'?php header("X-Spip-Cache: 0"); ?'.'>'.'<'.'?php header("Cache-Control: no-cache, must-revalidate"); ?'.'><'.'?php header("Pragma: no-cache"); ?'.'><?php //au choix, selon le cas (voir les avantages et les inconvéniants de chaque selon le site): $path_pdf = sous_repertoire(_DIR_CACHE, "article_PDF"); // stockage dans le cache SPIP $path_pdf = sous_repertoire(_DIR_IMG, "article_PDF"); //stockage sous le dossier IMG // Mode release => $debug=0 // Mode debug => $debug=1 (ne fonctionne pas sous Internet Explorer)=> ??? si, ça fonctionne ! $debug=1; ' . (($t1 = BOUCLE_principalehtml_4e9dfb73f38552aceae6d8960331dca1($Cache, $Pile, $doublons, $Numrows, $SP))!=='' ? $t1 : (' header("Location: index.php"); exit; ')) . ' if ($debug == 1 && file_exists($file_out)) { unlink($file_out); } if (!file_exists($file_out)) { define(\'FPDF_FONTPATH\',_DIR_FPDF_LIB.\'font\'); include_spip(_DIR_FPDF_LIB.\'fpdf\'); include_spip(\'pdf/lib_pdf_global\'); include_spip(\'pdf/lib_pdf_spip\'); //-------------------------------- // Debut génération du PDF //-------------------------------- $pdf->debug=$debug; $pdf=new PDF_SPIP(); $pdf->SetCompression(false); $pdf->SetDisplayMode(\'fullpage\', \'single\'); // haut, gauche, bas, droite $pdf->SetAllMargins(12,15,12,10); $pdf->SetTitle($titre); $pdf->SetCreator($site); $pdf->SetCopyright($copyright); $pdf->SetSubject($rubrique); $pdf->SetKeywords($motsclef); $pdf->Build($file_out); } // Vous voulez afficher un pdf header("Content-type: application/pdf"); if ($debug==1) { // Affiche le PDF directement dans l\'onglet de Firefox // Ne fonctionne pas sous IE 6 SP2 : le pdf n\'est pas reconnu (pris pour un fichier texte) header("location: ". url_de_base() . $file_out); } else { // Il sera nommé $files_pdf // ATTENTION : pour "filename", mettre un nom de fichier court (<nom>.<extension>) // sinon IE 6 SP2 ne reconnaîtra pas le type de fichier // Semble poser problème sous IE6 SP1 // Ah, Microsoft, je vous jure ! header(\'Content-Disposition: attachment; filename=\' . $files_pdf); // Le source du PDF original.pdf readfile($file_out); } exit; ?> '); return analyse_resultat_skel('html_4e9dfb73f38552aceae6d8960331dca1', $Cache, $page, 'plugins/auto/article_pdf/rubrique_pdf.html'); }