function blocs_callback($matches) { list($titre, $corps) = preg_split(',(\n\n|\r\n\r\n|\r\r),', trim($matches[3]), 2); // pas de corps ! if(!strlen($corps = trim($corps))) { $corps = $titre; $titre = preg_replace(',[\n\r]+,s', ' ', couper(propre($titre), 30)); } // pas d'intertitre ! $titre = preg_replace(',^{{{(.*)}}}$,', '$1', trim($titre)); if(!strlen($titre)) $titre = '???'; // un resume facultatif if(preg_match(',<resume>(.*)</resume>\s?(.*)$,ms', $corps, $res)) { $corps = $res[2]; $res = $res[1]; } else $res = ''; // types de blocs : bloc|invisible|visible if ($matches[1]=='visible' || defined('_CS_PRINT')) { $h = $d = ''; $r = ' blocs_invisible blocs_slide'; } else { $h = ' blocs_replie'; $d = ' blocs_invisible blocs_slide'; $r = ''; } // blocs numerotes $b = strlen($matches[2])?" cs_bloc$matches[2]":''; // title $title = function_exists('blocs_title') ?"<div class='blocs_title blocs_invisible'>".join(_BLOC_TITLE_SEP, blocs_title($titre, $corps, $matches[2], $h<>'')).'</div>' :''; // valeur par defaut geree en JS return "<div class='cs_blocs$b'><"._BLOC_TITRE_H." class='blocs_titre$h blocs_click'><a href='javascript:;'>$titre</a></"._BLOC_TITRE_H.">" .(strlen($res)?"<div class='blocs_resume$r'>\n$res\n</div>":"") ."<div class='blocs_destination$d'>\n\n".blocs_rempl($corps)."\n\n</div>$title</div>"; }
function exec_acces_restreint(){ if (!autoriser('administrer','zone',0)) { include_spip('inc/minipres'); echo minipres(); exit; } $commencer_page = charger_fonction('commencer_page','inc'); echo $commencer_page(_T('accesrestreint:page_zones_acces')); echo gros_titre(_T('accesrestreint:titre_zones_acces'),'',false); echo debut_gauche("acces_restreint",true); echo debut_boite_info(true); echo propre(_T('accesrestreint:info_page')); echo fin_boite_info(true); if (autoriser('webmestre')) { $res = icone_horizontale(_L('Configuration des accès .htaccess'), generer_url_ecrire("acces_restreint_config"), "../"._DIR_PLUGIN_ACCESRESTREINT."/img_pack/zones-acces-24.gif", "cadenas-24.gif",false); echo bloc_des_raccourcis($res); } echo debut_droite("acces_restreint",true); echo recuperer_fond('prive/acces_restreint',$_GET); if (autoriser('modifier','zone')) echo "<div>".icone_inline(_T('accesrestreint:creer_zone'), generer_url_ecrire("zones_edit","new=oui"), _DIR_PLUGIN_ACCESRESTREINT."/img_pack/zones-acces-24.gif", "creer.gif",'right')."</div>"; echo fin_gauche(),fin_page(); }
function traiter_ressources($r) { $html = null; if ($ressource = charger_fonction('ressource', 'inc', true)) { $html = $ressource($r[0]); } if (is_null($html)) { include_spip('inc/lien'); $url = explode(' ', trim($r[0], '<>')); $url = $url[0]; # <http://url/absolue> if (preg_match(',^https?://,i', $url)) { $html = PtoBR(propre("<span class='ressource spip_out'><[->" . $url . "]></span>")); } else { if (false !== strpos($url, '/')) { $html = PtoBR(propre("<span class='ressource spip_in'><[->" . $url . "]></span>")); } else { preg_match(',\\.([^.]+)$,', $url, $regs); if (file_exists($f = _DIR_IMG . $regs[1] . '/' . $url)) { $html = PtoBR(propre("<span class='ressource spip_in'><[" . $url . "->" . $f . "]></span>")); } else { $html = PtoBR(propre("<span class='ressource'><" . $url . "></span>")); } } } } return '<html>' . $html . '</html>'; }
function inc_informer_dist($id, $col, $exclus, $rac, $type, $do = 'aff') { include_spip('inc/texte'); if ($type == "rubrique") { $row = sql_fetsel("titre, descriptif", "spip_rubriques", "id_rubrique = {$id}"); if ($row) { $titre = typo($row["titre"]); $descriptif = propre($row["descriptif"]); } else { $titre = _T('info_racine_site'); } } else { $titre = ''; } $res = ''; if ($type == "rubrique" and $GLOBALS['spip_display'] != 1 and isset($GLOBALS['meta']['image_process'])) { if ($GLOBALS['meta']['image_process'] != "non") { $chercher_logo = charger_fonction('chercher_logo', 'inc'); if ($res = $chercher_logo($id, 'id_rubrique', 'on')) { list($fid, $dir, $nom, $format) = $res; include_spip('inc/filtres_images_mini'); $res = image_reduire("<img src='{$fid}' alt='' />", 100, 48); if ($res) { $res = "<div style='float: " . $GLOBALS['spip_lang_right'] . "; margin-" . $GLOBALS['spip_lang_right'] . ": -5px; margin-top: -5px;'>{$res}</div>"; } } } } $rac = spip_htmlentities($rac); # ce lien provoque la selection (directe) de la rubrique cliquee # et l'affichage de son titre dans le bandeau $titre = strtr(str_replace("'", "’", str_replace('"', """, textebrut($titre))), "\n\r", " "); $js_func = $do . '_selection_titre'; return "<div style='display: none;'>" . "<input type='text' id='" . $rac . "_sel' value='{$id}' />" . "<input type='text' id='" . $rac . "_sel2' value=\"" . entites_html($titre) . "\" />" . "</div>" . "<div class='informer' style='padding: 5px; border-top: 0px;'>" . (!$res ? '' : $res) . "<p><b>" . safehtml($titre) . "</b></p>" . (!$descriptif ? '' : "<div>" . safehtml($descriptif) . "</div>") . "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>" . "<input type='submit' class='fondo' value='" . _T('bouton_choisir') . "'\nonclick=\"{$js_func}('{$titre}',{$id},'selection_rubrique','id_parent'); return false;\" />" . "</div>" . "</div>"; }
function exec_description_outil_dist() { cs_log("INIT : exec_description_outil_dist() - Preparation du retour par Ajax (donnees transmises par GET)"); $script = _request('script'); $outil = _request('outil'); cs_log(" -- outil = $outil - script = $script"); cs_minipres(!preg_match('/^\w+$/', $script)); // ici on commence l'initialisation de tous les outils global $outils, $metas_vars, $metas_outils; include_spip('cout_utils'); // remplir $outils (et aussi $cs_variables qu'on n'utilise pas ici); include_spip('config_outils'); cs_log(" -- exec_description_outil_dist() - Appel de config_outils.php : nb_outils = ".count($outils)); // installer les outils cs_installe_outils(); cs_log(" -- appel de charger_fonction('description_outil', 'inc') et de description_outil($outil, $script) :"); include_spip('inc/cs_outils'); $description_outil = charger_fonction('description_outil', 'inc'); $descrip = cs_initialisation_d_un_outil($outil, $description_outil, true); cs_init_plugins(); cs_log(" FIN : exec_description_outil_dist() - Appel maintenant de ajax_retour() pour afficher la ligne de configuration de l'outil"); include_spip('inc/texte'); include_spip('cout_fonctions'); // fonctions pour les pipelines ajax_retour(propre($descrip)); }
function cs_propre($texte) { include_spip('inc/texte'); $mem = $GLOBALS['toujours_paragrapher']; $GLOBALS['toujours_paragrapher'] = false; $texte = propre($texte); $GLOBALS['toujours_paragrapher'] = $mem; return $texte; }
function exec_documents_liste_dist() { // // Recupere les donnees // $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page(_T('titre_page_documents_liste'), "naviguer", "documents"); echo debut_gauche('', true); ////////////////////////////////////////////////////// // Boite "voir en ligne" // echo debut_boite_info(true); echo propre(_T('texte_recapitiule_liste_documents')); echo fin_boite_info(true); echo debut_droite('', true); // recupere les titres des types $res = sql_select('extension, titre', "spip_types_documents"); while ($row = sql_fetch($res)) $types[$row['extension']] = $row; $result = sql_select("docs.id_document AS id_doc, docs.extension AS extension, docs.fichier AS fichier, docs.date AS date, docs.titre AS titre, docs.descriptif AS descriptif, R.id_rubrique AS id_rub, R.titre AS titre_rub", "spip_documents AS docs, spip_documents_liens AS lien, spip_rubriques AS R", "docs.id_document = lien.id_document AND R.id_rubrique = lien.id_objet AND lien.objet='rubrique' AND docs.mode = 'document'", "", "docs.date DESC"); while ($row=sql_fetch($result)){ $titre=$row['titre']; $descriptif=$row['descriptif']; $date=$row['date']; $id_document=$row['id_doc']; $id_rubrique=$row['id_rub']; $titre_rub = typo($row['titre_rub']); $fichier = $row['fichier']; if (!$titre) $titre = _T('info_document').' '.$id_document; debut_cadre_relief("doc-24.gif"); echo "<b>$titre</b> (" . $types[$row['extension']]['titre'] . ', ' . affdate($date) . ")"; if ($descriptif) echo propre($descriptif); else echo "<p><tt>$fichier</tt>" . '</p>'; echo "<p>"._T('info_dans_rubrique')." <a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") . "'>$titre_rub</a></p>"; echo fin_cadre_relief(true); } echo fin_gauche(), fin_page(); }
function propre_notes($texte) { global $notes; $texte = propre($texte); if ($r = $notes(array())) { $texte .= "<div class='notes'>{$r}</div>"; $notes('', 'depiler'); $notes('', 'empiler'); } return $texte; }
function action_tester_taille_dist() { if (!autoriser('configurer')) { return; } $taille = _request('arg'); $taille = explode('-', $taille); $GLOBALS['taille_max'] = end($taille); $GLOBALS['taille_min'] = 0; if (count($taille) > 1) { $GLOBALS['taille_min'] = reset($taille); } // si l'intervalle est assez petit, on garde la valeur min if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) { ecrire_meta('max_taille_vignettes', $t = $GLOBALS['taille_min'] * $GLOBALS['taille_min'] * 0.9, 'non'); echo round($t / 1000000, 3) . ' Mpx'; die; } $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2); include_spip('inc/filtres'); // des inclusions representatives d'un hit prive et/ou public pour la conso memoire include_spip('public/assembler'); include_spip('public/balises'); include_spip('public/boucles'); include_spip('public/cacher'); include_spip('public/compiler'); include_spip('public/composer'); include_spip('public/criteres'); include_spip('public/interfaces'); include_spip('public/parametrer'); include_spip('public/phraser_html'); include_spip('public/references'); include_spip('inc/presentation'); include_spip('inc/charsets'); include_spip('inc/documents'); include_spip('inc/header'); propre("<doc1>"); // charger propre avec le trairement d'un modele $i = _request('i') + 1; $image_source = chemin_image("test.png"); $GLOBALS['redirect'] = generer_url_action("tester_taille", "i={$i}&arg=" . $GLOBALS['taille_min'] . "-" . $GLOBALS['taille_test']); ob_start('action_tester_taille_error_handler'); filtrer('image_recadre', $image_source, $taille, $taille); $GLOBALS['redirect'] = generer_url_action("tester_taille", "i={$i}&arg={$taille}-" . $GLOBALS['taille_max']); // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee $taille = $GLOBALS['taille_max']; filtrer('image_recadre', $image_source, $taille, $taille); $GLOBALS['redirect'] = generer_url_action("tester_taille", "i={$i}&arg={$taille}-" . $GLOBALS['taille_max']); ob_end_clean(); // on est ici, donc pas de plantage echo redirige_formulaire($GLOBALS['redirect']); }
function inc_informer_auteur_dist($id) { global $spip_display,$spip_lang_right ; include_spip('inc/presentation'); include_spip('inc/formater_auteur'); $row = sql_fetsel("*", "spip_auteurs", "id_auteur = $id"); if ($row) { $nom = typo($row["nom"]); $bio = propre($row["bio"]); $mail = formater_auteur_mail($row, $id); $nb = sql_countsel("spip_auteurs_articles", "id_auteur=$id"); if ($nb > 1) $nb = $nb . " " . _T('info_article_2'); else if($nb == 1) $nb = "1 " . _T('info_article'); else $nb = " "; } else { $nom = "<span style='color:red'>" . _T('texte_vide') . '</span>'; $bio = $mail = $nb = ''; } $res = ''; if ($spip_display != 1 AND $spip_display!=4 AND $GLOBALS['meta']['image_process'] != "non") { $chercher_logo = charger_fonction('chercher_logo', 'inc'); if ($res = $chercher_logo($id, 'id_auteur', 'on')) { list($fid, $dir, $n, $format) = $res; include_spip('inc/filtres_images_mini'); $res = image_reduire("<img src='$fid' alt='' />", 100, 48); if ($res) $res = "<div style='float: $spip_lang_right; margin-$spip_lang_right: -5px; margin-top: -5px;'>$res</div>"; } } return "<div class='informer-auteur'>" . (!$res ? '' : $res) . "<div><a href='" . generer_url_ecrire('auteur_infos', "id_auteur=$id") . "'>" . bonhomme_statut($row) . "</a> " . $mail . " <b>" . $nom . "</b><br />" . $nb . "</div><br />" . "<div>$bio</div>" . "</div>"; }
function configuration_relayeur_dist($retour_proxy='') { global $spip_lang_left; $res = $submit = ''; $http_proxy = $GLOBALS['meta']["http_proxy"]; $http_noproxy = $GLOBALS['meta']["http_noproxy"]; if ($http_proxy) { include_spip('inc/distant'); // Masquer un eventuel password authentifiant $http_proxy=entites_html(no_password_proxy_url($http_proxy)); if ($http_proxy) { $res = "\n<p style='text-align: $spip_lang_left;' class='verdana1 spip_small'>" . "<label for='test_proxy'>" . _T('texte_test_proxy') . "</label>" . "</p>" . "\n<p>" . "<input type='text' name='test_proxy' id='test_proxy' value='http://www.spip.net/' size='40' class='forml' />" . "</p>"; if($retour_proxy) { $res .= debut_boite_info(true) . $retour_proxy . fin_boite_info(true); } $submit = array('valider_proxy' => _T('bouton_valider'), 'tester_proxy' => _T('bouton_test_proxy')); } } $encours = "<label for='http_proxy'>" . ($http_proxy ? $http_proxy : "http://proxy:8080") . '</label>' ; $exemple = "<label for='http_noproxy'>" . ($http_noproxy ? $http_noproxy : "127.0.0.1 .mondomaine.net") . "</label>"; $res = "\n<div class='verdana2'>" . propre(_T('texte_proxy', array('proxy_en_cours' => "<b><tt><html>$encours</html></tt></b>"))) . "</div>" . "\n<div class='verdana2'>" . "<input type='text' name='http_proxy' id='http_proxy' size='40' class='forml' value='$http_proxy' />" . "<br />" . propre(_T('pas_de_proxy_pour', array('exemple' => "<b><tt><html>$exemple</html></tt></b>"))) . "<input type='text' name='http_noproxy' id='http_noproxy' size='40' class='forml' value='$http_noproxy' />" . $res . "</div>"; $res = debut_cadre_trait_couleur("base-24.gif", true, "", _T('info_sites_proxy').aide ("confhttpproxy")) . ajax_action_post('configurer_relayeur', 0, 'config_fonctions', '', $res, $submit) . fin_cadre_trait_couleur(true); return ajax_action_greffe("configurer_relayeur", 0, $res); }
function filtre_text_csv_dist($t) { include_spip('inc/csv'); list($entete, $lignes) = analyse_csv($t); foreach ($lignes as &$l) { $l = join('|', $l); } $corps = join("\n", $lignes) . "\n"; $corps = $caption . "\n|{{" . join('}}|{{', $entete) . "}}|" . "\n|" . str_replace("\n", "|\n|", $corps); $corps = str_replace('"#', '"', $corps); include_spip('inc/texte'); return propre($corps); }
function formulaires_rediriger_article_charger_dist($id_article, $retour = '') { $row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . intval($id_article)); if (!$row['id_article']) { return false; } include_spip('inc/lien'); $redirection = virtuel_redirige($row["virtuel"]); if (!$redirection and $GLOBALS['meta']['articles_redirection'] != 'oui') { return false; } include_spip('inc/texte'); $valeurs = array('redirection' => $redirection, 'id' => $id_article, '_afficher_url' => $redirection ? propre("[->{$redirection}]") : ''); return $valeurs; }
/** * passe propre() sur un texte puis nettoye les trucs rajoutes par spip sur du html * ca s'utilise pour afficher un courrier dans l espace prive * on l'applique au courrier avant de confirmer l'envoi * @return string * @deprecated */ function spiplistes_courrier_propre ($texte) { //spiplistes_debug_log ('spiplistes_courrier_propre()'); static $adresse_site; if (!$adresse_site) { $adresse_site = $GLOBALS['meta']['adresse_site']; } static $style_rev = '__STYLE__'; if (preg_match ('@<style[^>]*>[^<]*</style>@' , $texte , $style_reg ) > 0 ) { } if (isset($style_reg[0])) { $style_str = $style_reg[0].'<!-- hole -->'; } else { $style_str = ''; } $texte = preg_replace ('@<style[^>]*>[^<]*</style>@', $style_rev, $texte); //passer propre si y'a pas de html (balises fermantes) if (!preg_match ('@</?('._BALISES_BLOCS.')[>[:space:]]@iS', $texte)) { $texte = propre($texte); // pb: enleve aussi <style>... } //nettoyer les spip class truc en trop $texte = spiplistes_courrier_propre_bloog ($texte); // remettre en place les styles $texte = str_replace ($style_rev, $style_str, $texte); //les liens avec double debut #URL_SITE_SPIP/#URL_ARTICLE $texte = preg_replace ( '@' . $adresse_site . '/' . $adresse_site . '@' , $adresse_site , $texte ); $texte = spiplistes_liens_absolus ($texte); return ($texte); }
function cs_introduction($texte, $descriptif, $lgr, $id, $racc, $connect) { @define('_INTRODUCTION_LGR', 100); // fonction couper_intro $couper = $GLOBALS['cs_couper_intro']; if (strlen($descriptif)) # si descriptif contient juste des espaces ca produit une intro vide, # c'est une fonctionnalite, pas un bug // ici le descriptif est coupe s'il est trop long $texte = $lgr<0?propre($couper($descriptif, -$lgr, _INTRODUCTION_CODE)):propre($descriptif); else { // pas de maths dans l'intro... $texte = preg_replace(',<math>.*</math>,imsU', '', $texte); // on coupe proprement... $lgr = $lgr>0?round($lgr*_INTRODUCTION_LGR/100):-$lgr; $texte = PtoBR(propre(supprimer_tags($couper(cs_introduire($texte), $lgr, _INTRODUCTION_CODE)))); } // si les points de suite ont ete ajoutes return remplace_points_de_suite($texte, $id, $racc); } // introduction()
function pack_action_rapide() { include_spip('inc/texte'); // pour attribut_html() switch($n = count($GLOBALS['cs_installer'])) { case 0 : $info = _T('couteauprive:pack_nb_zero'); break; case 1 : $info = _T('couteauprive:pack_nb_un'); break; default : $info = _T('couteauprive:pack_nb_plrs', array('nb' => $n)); } $liste = $script = ''; if($n) { $exec = _request('exec'); $fin_delete = _T('couteauprive:pack_delete'); $fin_delete = "\" class='pack_delete' title=\"$fin_delete\"><img src=\""._DIR_IMG_PACK."poubelle.gif\" width='12' height='12' alt=\"$fin_delete\" /></a> <a href=\""; $fin_install = _T('couteauprive:pack_installe'); $fin_install = "\" class='pack_install' title=\"$fin_install\"><img src=\""._DIR_IMG_PACK."secteur-12.gif\" width='12' height='12' alt=\"$fin_install\" /></a> "; foreach(array_keys($GLOBALS['cs_installer']) as $pack) { $u = urlencode($pack); $liste .= "\n-* <a href=\"" . generer_url_ecrire($exec,'cmd=delete&pack='.$u) . $fin_delete . generer_url_ecrire($exec,'cmd=install&pack='.$u) . $fin_install . $pack; } $liste = propre($liste); $script = "<script type=\"text/javascript\"><!-- if (window.jQuery) jQuery(function(){ jQuery('a.pack_delete').click( function() { msg=\"".cs_javascript('couteauprive:pack_supprimer')."\"; return window.confirm(msg.replace(/@pack@/,jQuery(this).parent().text().trim())); }); jQuery('a.pack_install').click( function() { msg=\"".cs_javascript('couteauprive:pack_installer').'\n\n'.cs_javascript('couteauprive:cs_reset2')."\"; return window.confirm(msg.replace(/@pack@/,jQuery(this).parent().text().trim())); }); }); //--></script>\n"; } // appel direct, sans ajax, histoire de mettre a jour le menu : return redirige_action_post('action_rapide', 'sauve_pack', 'admin_couteau_suisse', "cmd=pack#cs_infos", "\n$script<div style='padding:0.4em;'><p>$info</p>$liste<p>"._T('couteauprive:pack_sauver_descrip', array('file' => show_file_options())) ."</p><div style='text-align: center;'><input class='fondo' type='submit' value=\"" .attribut_html(_T('couteauprive:pack_sauver')) . "\" /></div></div>"); }
/** * Crée l'affichage des listes de rubriques dans le privé * * @param int $collection * L'identifiant numérique de la rubrique à lister * @param int $debut * Le numéro de la pagination si paginé (> 500) * @param int $limite * Le pas de pagination si paginé (> 500) * @return array $res * Un tableau des sous rubriques */ function enfant_rub($collection, $debut = 0, $limite = 500) { $voir_logo = (isset($GLOBALS['meta']['image_process']) and $GLOBALS['meta']['image_process'] != "non"); $logo = ""; if ($voir_logo) { $chercher_logo = charger_fonction('chercher_logo', 'inc'); include_spip('inc/filtres_images_mini'); } $res = array(); $result = sql_select("id_rubrique, id_parent, titre, descriptif, lang ", "spip_rubriques", "id_parent={$collection}", '', '0+titre,titre', "{$debut},{$limite}"); while ($row = sql_fetch($result)) { $id_rubrique = $row['id_rubrique']; $id_parent = $row['id_parent']; $titre = generer_info_entite($id_rubrique, 'rubrique', 'titre'); // pour etre sur de passer par tous les traitements if ('' !== ($rang = recuperer_numero($row['titre']))) { $rang = "{$rang}. "; } if (autoriser('voir', 'rubrique', $id_rubrique)) { $les_sous_enfants = sous_enfant_rub($id_rubrique); changer_typo($row['lang']); $lang_dir = lang_dir($row['lang']); $descriptif = propre($row['descriptif']); if ($voir_logo) { if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) { list($fid, $dir, $nom, $format) = $logo; $logo = image_reduire("<img src='{$fid}' alt='' />", 48, 36); if ($logo) { $logo = inserer_attribut($logo, 'class', 'logo'); } } } $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? "" : http_img_pack('auteur-0minirezo-16.png', '', " width='16' height='16'", _T('image_administrer_rubrique'))) . " <a dir='{$lang_dir}'" . ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') . " href='" . generer_url_entite($id_rubrique, 'rubrique') . "'>" . $rang . $titre . "</a>"; $titre = (is_string($logo) ? $logo : '') . bouton_block_depliable($lib_bouton, $les_sous_enfants ? false : -1, "enfants{$id_rubrique}"); $res[] = debut_cadre_sous_rub($id_parent ? "rubrique-24.png" : "secteur-24.png", true, "", $titre) . (!$descriptif ? '' : "\n<div class='descriptif'>{$descriptif}</div>") . $les_sous_enfants . fin_cadre_sous_rub(true); } } changer_typo($GLOBALS['spip_lang']); # remettre la typo de l'interface pour la suite return $res; }
/** * Traiter la valeur de la vue en fonction du env * si un traitement a ete fait en amont (champs extra) ne rien faire * si pas de traitement defini (formidable) passer typo ou propre selon le type du champ * * @param string $valeur * @param string|array $env * @return string */ function saisie_traitement_vue($valeur, $env) { if (is_string($env)) { $env = unserialize($env); } if (!function_exists('propre')) { include_spip('inc/texte'); } $valeur = trim($valeur); // si traitement est renseigne, alors le champ est deja mis en forme // (saisies) // sinon on fait une mise en forme smart if ($valeur and !isset($env['traitements'])) { if (in_array($env['type_saisie'], array('textarea'))) { $valeur = propre($valeur); } else { $valeur = '<p>' . typo($valeur) . '</p>'; } } return $valeur; }
function glossaire_verifie(&$c) { include_spip('public/parametrer'); // pour mes_fonctions $res = array(); $c = count($gloss = glossaire_query_tab()); for($i=0; $i<$c; $i++) for($j=$i+1; $j<$c; $j++) { $gi = &$gloss[$i]; $gj = &$gloss[$j]; if(!isset($gi['mots'])) list($gi['mots'],$gi['regs'],$gi['titre2']) = glossaire_parse(extraire_multi($gi['titre'])); if(!isset($gj['mots'])) list($gj['mots'],$gj['regs'],$gj['titre2']) = glossaire_parse(extraire_multi($gj['titre'])); $u = false; $titre = $gi['mots']?glossaire_gogogo($gj['titre2'], $gi['mots'], -1, $u):''; if(count($gi['regs'])) $titre .= preg_replace_callback($gi['regs'], "glossaire_echappe_mot_callback", $gj[titre], -1); if(strpos($titre,'@@GLOSS')!==false) { $a = '['.$gi['titre'].'->mot'.$gi['id_mot'].']'; $b = '['.$gj['titre'].'->mot'.$gj['id_mot'].']'; $res[] = "• "._T('couteauprive:glossaire_erreur', array('mot1'=>$a, 'mot2'=>$b))."\n_ "; } } if(count($res)) return propre(join('', $res)._T('couteauprive:glossaire_inverser')); return ''; }
function configuration_porte_plume_dist() { if (!$val = $GLOBALS['meta']["barre_outils_public"]) { $val = 'oui'; } $res = propre(_T("barre_outils:explication_barre_outils_public")); $res .= propre(_T("barre_outils:explication_barre_outils_public_2")); $res .= afficher_choix('barre_outils_public', $val, array( 'oui' => _T("barre_outils:label_barre_outils_public_oui"), 'non' => _T("barre_outils:label_barre_outils_public_non") ), " <br /> "); $res = debut_cadre_trait_couleur(find_in_path("images/porte-plume-24.png"), true, "", _T("barre_outils:info_porte_plume_titre")) . ajax_action_post('configurer', 'porte_plume', 'configuration','',$res) . fin_cadre_trait_couleur(true); return ajax_action_greffe('configurer-porte_plume', '', $res); }
function exec_cs_version_dist() { cs_minipres(); $version = _request('version'); $force = _request('force')=='oui'; // pour la version disponible, on regarde toutes les 2h00 $maj = isset($GLOBALS['meta']['tweaks_maj'])?unserialize($GLOBALS['meta']['tweaks_maj']):array(0, ''); if (!$force && $maj[1] && (time()-$maj[0] < 2*3600)) $distant = $maj[1]; else { include_spip('inc/distant'); $distant = recuperer_page(_URL_CS_PLUGIN_XML); if ($distant) $distant = $maj[1] = preg_match(',<version>([0-9.]+)</version>,', $distant, $regs)?$regs[1]:''; $maj[0] = time(); if ($distant) ecrire_meta('tweaks_maj', serialize($maj)); ecrire_metas(); } include_spip('inc/texte'); include_spip('cout_fonctions'); // fonctions pour les pipelines if (!$distant) return ajax_retour('<span style="color: red;">'._T('couteauprive:erreur:probleme', array('pb'=>cs_lien(_URL_CS_PLUGIN_XML,_T('couteauprive:erreur:distant')))).'</span>'); ajax_retour(ptobr(propre($distant==$version?_T('couteauprive:version_a_jour'):( $distant?_T('couteauprive:version_nouvelle', array('version' => "[{$distant}->http://files.spip.org/spip-zone/couteau_suisse.zip]")):'' )))); }
/** * Afficher le lien de redirection d'un article virtuel si il y a lieu * (rien si l'article n'est pas redirige) * * @param string $virtuel * @return string */ function lien_article_virtuel($virtuel) { include_spip('inc/lien'); if (!($virtuel = virtuel_redirige($virtuel))) { return ''; } return propre("[->" . $virtuel . "]"); }
function extraire_multi($letexte, $lang = null, $echappe_span = false) { if (preg_match_all(_EXTRAIRE_MULTI, $letexte, $regs, PREG_SET_ORDER)) { if (!$lang) { $lang = $GLOBALS['spip_lang']; } foreach ($regs as $reg) { // chercher la version de la langue courante $trads = extraire_trads($reg[1]); if ($l = approcher_langue($trads, $lang)) { $trad = $trads[$l]; } else { include_spip('inc/texte'); // langue absente, prendre la premiere dispo // mais typographier le texte selon les regles de celle-ci // Attention aux blocs multi sur plusieurs lignes $l = key($trads); $trad = $trads[$l]; $typographie = charger_fonction(lang_typo($l), 'typographie'); $trad = $typographie($trad); include_spip('inc/texte'); // Tester si on echappe en span ou en div // il ne faut pas echapper en div si propre produit un seul paragraphe $trad_propre = preg_replace(",(^<p[^>]*>|</p>\$),Uims", "", propre($trad)); $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span'; $trad = code_echappement($trad, 'multi', false, $mode); $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l)); if (lang_dir($l) !== lang_dir($lang)) { $trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l))); } if (!$echappe_span) { $trad = echappe_retour($trad, 'multi'); } } $letexte = str_replace($reg[0], $trad, $letexte); } } return $letexte; }
function type_urls_liste_urls_exec() { global $type_urls; $res = $id = ''; include_spip('base/abstract_sql'); if($s=_request('suppr')) { $s = explode(',', base64_decode($s), 3); sql_delete("spip_urls", $a="id_objet=$s[0] AND type=".sql_quote($s[1]).' AND url='.sql_quote($s[2])); include_spip('inc/headers'); redirige_par_entete(parametre_url(self(),'suppr','','&')); } include_spip('inc/texte'); include_spip('inc/presentation'); include_spip('public/assembler'); echo '<html><head>'.f_jQuery(envoi_link(_T('couteau:urls_propres_titre'))) .'</head><body style="text-align:center">' .propre(recuperer_fond('fonds/type_urls_liste', array('type'=>_request('type')))) .'</body></html>'; ; }
function exec_articles_versions_args($id_article, $id_version, $id_diff) { global $spip_lang_left, $spip_lang_right; if (!autoriser('voirrevisions', 'article', $id_article) OR !$row = sql_fetsel("*", "spip_articles", "id_article=".sql_quote($id_article))){ include_spip('inc/minipres'); echo minipres(); return; } include_spip('inc/suivi_versions'); include_spip('inc/presentation'); include_spip('inc/revisions'); // recuperer les donnees actuelles de l'article $id_article = $row["id_article"]; $id_rubrique = $row["id_rubrique"]; $titre = $row["titre"]; $statut_article = $row["statut"]; $lang = $row["lang"]; // Afficher le debut de la page (y compris rubrique) $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page(_T('info_historique')." « $titre »", "naviguer", "articles", $id_rubrique); echo debut_grand_cadre(true); echo afficher_hierarchie($id_rubrique); echo fin_grand_cadre(true); ////////////////////////////////////////////////////// // Affichage de la colonne de gauche // echo debut_gauche('', true); echo bloc_des_raccourcis(icone_horizontale(_T('icone_retour_article'), generer_url_ecrire("articles","id_article=$id_article"), "article-24.gif","rien.gif", false) . icone_horizontale(_T('icone_suivi_revisions'), generer_url_ecrire("suivi_revisions",""), "historique-24.gif","rien.gif", false)); ////////////////////////////////////////////////////// // Affichage de la colonne de droite // echo debut_droite('', true); $lang_dir = lang_dir(changer_typo($lang)); // // recuperer les donnees versionnees // $last_version = false; if (!$id_version) { $id_version = $row['id_version']; $last_version = true; } $textes = revision_comparee($id_article, $id_version, 'complet', $id_diff); unset($id_rubrique); # on n'en n'aura besoin que si on affiche un diff // // Titre, surtitre, sous-titre // $debut = $corps = ''; if (is_array($textes)) foreach ($textes as $var => $t) { switch ($var) { case 'id_rubrique': $debut .= "<div dir='$lang_dir' class='arial1 spip_x-small'>" . $t . "</div>\n"; break; case 'surtitre': case 'soustitre': $debut .= "<div dir='$lang_dir' class='arial1 spip_medium'><b>" . propre_diff($t) . "</b></div>\n"; break; case 'titre': $debut .= gros_titre(propre_diff($t), puce_statut($statut_article, " style='vertical-align: center'"), false); break; // trois champs a affichage combine case 'descriptif': case 'url_site': case 'nom_site': if (!$vudesc++) { $debut .= "<div style='text-align: $spip_lang_left; padding: 5px; border: 1px dashed #aaaaaa; background-color: #e4e4e4;' dir='$lang_dir'>"; $texte_case = ($textes['descriptif']) ? "{{"._T('info_descriptif')."}} ".$textes['descriptif']."\n\n" : ''; $texte_case .= ($textes['nom_site'].$textes['url_site']) ? "{{"._T('info_urlref')."}} [".$textes['nom_site']."->".$textes['url_site']."]" : ''; $debut .= "<span class='verdana1 spip_small'>" . propre($texte_case). "</span>"; $debut .= "</div>"; } break; default: $corps .= "<div dir='$lang_dir' class='champ contenu_$var'>" . "<div class='label'>$var</div>" . "<div class='$var'>" . propre_diff($t) . "</div></div>\n"; break; } } echo '<div id="contenu">'; echo debut_cadre_relief('', true); echo "\n<table id='diff' cellpadding='0' cellspacing='0' border='0' width='100%'>"; echo "<tr><td style='width: 100%' valign='top'>"; echo $debut; echo "</td><td>"; // Icone de modification if (autoriser('modifier', 'article', $id_article)) echo icone_inline( _T('icone_modifier_article').'<br />('._T('version')." $id_version)", generer_url_ecrire("articles_edit", "id_article=$id_article".((!$last_version)?"&id_version=$id_version":"")), "article-24.gif", "edit.gif", $spip_lang_right ); echo "</td>"; echo "</tr></table>"; echo fin_cadre_relief(true); ////////////////////////////////////////////////////// // Affichage des versions // $result = sql_select("id_version, titre_version, date, id_auteur", "spip_versions", "id_article=".sql_quote($id_article)." AND id_version>0", "", "id_version DESC"); echo debut_cadre_relief('', true); $zapn = 0; $lignes = array(); $points = '...'; $tranches = 10; while ($row = sql_fetch($result)) { $res = ''; // s'il y en a trop on zappe a partir de la 10e // et on s'arrete juste apres celle cherchee if ($zapn++ > $tranches AND abs($id_version - $row['id_version']) > $tranches<<1) { if ($points) { $lignes[]= $points; $points = ''; } if ($id_version > $row['id_version']) break; continue; } $date = affdate_heure($row['date']); $version_aff = $row['id_version']; $titre_version = typo($row['titre_version']); $titre_aff = $titre_version ? $titre_version : $date; if ($version_aff != $id_version) { $lien = parametre_url(self(), 'id_version', $version_aff); $lien = parametre_url($lien, 'id_diff', ''); $res .= "<a href='".($lien.'#diff')."' title=\""._T('info_historique_affiche')."\">$titre_aff</a>"; } else { $res .= "<b>$titre_aff</b>"; } if (is_numeric($row['id_auteur']) AND $t = sql_getfetsel('nom', 'spip_auteurs', "id_auteur=" . intval($row['id_auteur']))) { $res .= " (".typo($t).")"; } else { $res .= " (".$row['id_auteur'].")"; #IP edition anonyme } if ($version_aff != $id_version) { $res .= " <span class='verdana2'>"; if ($version_aff == $id_diff) { $res .= "<b>("._T('info_historique_comparaison').")</b>"; } else { $lien = parametre_url(self(), 'id_version', $id_version); $lien = parametre_url($lien, 'id_diff', $version_aff); $res .= "(<a href='".($lien.'#diff'). "'>"._T('info_historique_comparaison')."</a>)"; } $res .= "</span>"; } $lignes[]= $res; } if ($lignes) { echo "<ul class='verdana3'><li>\n"; echo join("\n</li><li>\n", $lignes); echo "</li></ul>\n"; } ////////////////////////////////////////////////////// // Corps de la version affichee // echo "\n\n<div id='wysiwyg' style='text-align: justify;'>$corps"; // notes de bas de page if (strlen($GLOBALS['les_notes'])) echo "<div class='champ contenu_notes'> <div class='label'>"._T('info_notes')."</div> <div class='notes' dir='$lang_dir'>" .$GLOBALS['les_notes'] ."</div></div>\n"; echo "</div>\n"; echo fin_cadre_relief(true); echo '</div>'; // /#contenu echo fin_gauche(), fin_page(); }
function BOUCLE_auteur_principalhtml_ce97d1249b67fffb20134bd49b8a9e29(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!isset($command['table'])) { $command['table'] = 'auteurs'; $command['id'] = '_auteur_principal'; $command['from'] = array('auteurs' => 'spip_auteurs'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("auteurs.id_auteur", "auteurs.lang", "auteurs.nom", "auteurs.bio", "auteurs.url_site", "auteurs.nom_site", "auteurs.email"); $command['orderby'] = array(); $command['join'] = array(); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array(quete_condition_statut('auteurs.statut', '!5poubelle', '!5poubelle', ''), array('=', 'auteurs.id_auteur', sql_quote(@$Pile[0]['id_auteur'], '', 'bigint(21) NOT NULL AUTO_INCREMENT'))); if (defined("_BOUCLE_PROFILER")) { $timer = time() + microtime(); } $t0 = ""; // REQUETE $iter = IterFactory::create("SQL", $command, array('squelettes/auteur.html', 'html_ce97d1249b67fffb20134bd49b8a9e29', '_auteur_principal', 1, $GLOBALS['spip_lang'])); if (!$iter->err()) { $SP++; // RESULTATS while ($Pile[$SP] = $iter->fetch()) { $t0 .= ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '" lang="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '" dir="' . lang_dir($Pile[$SP]['lang'], 'ltr', 'rtl') . '"> <head> <title>' . interdire_scripts(textebrut(typo(supprimer_numero($Pile[$SP]['nom']), "TYPO", $connect, $Pile[0]))) . ' - [' . interdire_scripts(textebrut(typo($GLOBALS['meta']['nom_site'], "TYPO", $connect, $Pile[0]))) . ']</title> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-meta') . ', array(\'id_auteur\' => ' . argumenter_squelette($Pile[$SP]['id_auteur']) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/auteur.html\',\'html_ce97d1249b67fffb20134bd49b8a9e29\',\'\',7,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> <link rel="alternate" type="application/rss+xml" title="' . interdire_scripts(textebrut(typo(supprimer_numero($Pile[$SP]['nom']), "TYPO", $connect, $Pile[0]))) . '" href="' . interdire_scripts(parametre_url(generer_url_public('backend', ''), 'id_auteur', $Pile[$SP]['id_auteur'])) . '" /> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('styles') . ', array(\'id_auteur\' => ' . argumenter_squelette($Pile[$SP]['id_auteur']) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/auteur.html\',\'html_ce97d1249b67fffb20134bd49b8a9e29\',\'\',9,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> </head> <body dir="' . lang_dir($Pile[$SP]['lang'], 'ltr', 'rtl') . '" class="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . ' auteur aut' . $Pile[$SP]['id_auteur'] . '"> <div id="page" class="auteur"> <!-- ***************************************************************** Bandeau, titre du site et menu langue Header and main menu (top and right) ************************************************************* --> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-bandeau') . ', array(\'id_auteur\' => ' . argumenter_squelette($Pile[$SP]['id_auteur']) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/auteur.html\',\'html_ce97d1249b67fffb20134bd49b8a9e29\',\'\',19,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> <!-- ***************************************************************** Contenu principal (centre) Main content (center) ************************************************************* --> <div id="bloc-contenu"> <div class="cartouche"> ' . (($t1 = strval(filtrer('image_graver', filtrer('image_reduire', !is_array($l = quete_logo('id_auteur', 'ON', $Pile[$SP]['id_auteur'], '', 0)) ? '' : "<img class=\"spip_logo spip_logos\" alt=\"\" src=\"{$l['0']}\"" . $l[2] . ($l[1] ? " onmouseover=\"this.src='{$l['1']}'\" onmouseout=\"this.src='{$l['0']}'\"" : "") . ' />', '120', '0')))) !== '' ? '<span style="float:right;">' . $t1 . '</span>' : '') . ' <h1 class="">' . interdire_scripts(typo(supprimer_numero($Pile[$SP]['nom']), "TYPO", $connect, $Pile[0])) . '</h1> <div class="texte"> ' . (($t1 = strval(interdire_scripts(propre($Pile[$SP]['bio'], $connect, $Pile[0])))) !== '' ? '<div class="bio">' . $t1 . '</div>' : '') . ' ' . (($t1 = strval(calculer_url($Pile[$SP]['url_site'], '', 'url', $connect))) !== '' ? '<b>' . interdire_scripts(typo(supprimer_numero(calculer_url($Pile[$SP]['url_site'], $Pile[$SP]['nom_site'], 'titre', $connect, false)), "TYPO", $connect, $Pile[0])) . ' : <a href="' . $t1 . ('">' . calculer_url($Pile[$SP]['url_site'], '', 'url', $connect) . '</a></b><br />') : '') . ' ' . (($t1 = strval(interdire_scripts(calculer_notes()))) !== '' ? $t1 . '<br />' : '') . ' <br /> ' . (($t1 = strval(executer_balise_dynamique('FORMULAIRE_ECRIRE_AUTEUR', array($Pile[$SP]['id_auteur'], @$Pile[0]['id_article'], $Pile[$SP]['email']), array('squelettes/auteur.html', 'html_ce97d1249b67fffb20134bd49b8a9e29', '_auteur_principal', 27, $GLOBALS['spip_lang'])))) !== '' ? '<h2 id="message">' . _T('public|spip|ecrire:info_envoyer_message_prive') . '</h2>' . $t1 : '') . ' </div><!-- texte --> </div><!-- cartouche --> <!-- Articles de l\'auteur --> <h2>' . _T('public|spip|ecrire:articles_auteur') . '</h2> ' . (($t1 = BOUCLE_articleshtml_ce97d1249b67fffb20134bd49b8a9e29($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? $t1 : ' ') . ' </div><!-- bloc-contenu --> <!-- ***************************************************************** Menus contextuels (droite) Contextual menus (right) ************************************************************* --> <div id="encart"> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-annonces') . ', array(\'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/auteur.html\',\'html_ce97d1249b67fffb20134bd49b8a9e29\',\'\',53,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> ' . (($t1 = BOUCLE_auteurshtml_ce97d1249b67fffb20134bd49b8a9e29($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? ' <!-- Tous les auteurs --> <div class="menu"> <ul class="titre"> <li><b>' . _T('public|spip|ecrire:icone_tous_auteur') . '</b> ' . $t1 . ' </li> </ul> </div><!-- menu --> ' : '') . ' </div><!-- encart --> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-menu') . ', array(\'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/auteur.html\',\'html_ce97d1249b67fffb20134bd49b8a9e29\',\'\',72,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-bas') . ', array(\'id_auteur\' => ' . argumenter_squelette($Pile[$SP]['id_auteur']) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/auteur.html\',\'html_ce97d1249b67fffb20134bd49b8a9e29\',\'\',73,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> </div><!-- page --> </body> </html> '; } $iter->free(); } if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) { spip_log(intval(1000 * $timer) . "ms BOUCLE_auteur_principal @ squelettes/auteur.html", "profiler" . _LOG_AVERTISSEMENT); } return $t0; }
function legender_corps($ancre, $flag, $id, $id_document, $script, $type, $document, $label, $taille) { include_spip('inc/editer'); $contenu = ''; $descriptif = $document['descriptif']; if ($descriptif) $contenu .= "<p>".PtoBR(lignes_longues(propre($descriptif),25)) . "</p>\n"; if ($document['largeur'] OR $document['hauteur']) $contenu .= _T('info_largeur_vignette', array('largeur_vignette' => $document['largeur'], 'hauteur_vignette' => $document['hauteur'])) . ' — '; $contenu .= taille_en_octets($document['taille']); $date = $document['date']; if ($date AND ($GLOBALS['meta']["documents_date"] == 'oui')) $contenu .= "<br />\n" . affdate($date); $corps = (!$contenu ? '' : "<div class='verdana1' style='text-align: center; margin-bottom: 10px;'>$contenu</div>") . "<div class='formulaire_spip formulaire_spip_compact'><ul><li class='editer_titre'><label for='titre_document$id_document'>$label</label>\n" . "<input type='text' name='titre_document' id='titre_document$id_document' class='text' value=\"".entites_html($document['titre']). "\" size='40' onfocus=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\" /></li>\n" . (($GLOBALS['meta']["documents_date"] == 'oui') ? "<li class='editer_date'>".date_formulaire_legender($date, $id_document)."</li>" :'' ) . "<li class='editer_descriptif'><label for='descriptif_document$id_document'>". _T('info_description_2'). "</label>\n" . "<textarea name='descriptif_document' id='descriptif_document$id_document' rows='4' class='textarea' cols='*' onfocus=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\">" . entites_html($descriptif) . "</textarea></li></ul></div>\n" . $taille .controles_md5($document); $att_bouton = ""; $att_span = " id='valider_doc$id_document' " . ($flag == 'ajax' ? '' : "class='display_au_chargement'") . " style='text-align:" . $GLOBALS['spip_lang_right'] . ($flag == 'ajax' ? ';display:block' : "") . "'"; if (test_espace_prive()) return ajax_action_post("legender", $id_document, $script, "show_docs=$id_document&id_$type=$id#legender-$id_document", $corps, _T('bouton_enregistrer'), $att_bouton, $att_span, "&id_document=$id_document&id=$id&type=$type&ancre=$ancre") . "<div class='nettoyeur'></div>"; else { $corps = "<div class='boutons'>" . $corps . "<span" . $att_span . "><input type='submit' value='" . _T('bouton_enregistrer') ."' /></span></div>"; $redirect = parametre_url($script,'show_docs',$id_document,'&'); $redirect = parametre_url($redirect,"id_$type",$id,'&'); $redirect = parametre_url($redirect,"id_$type",$id,'&'); $redirect = ancre_url($redirect,"legender-$id_document"); return generer_action_auteur("legender", $id_document, $redirect, $corps, "\nmethod='post'"); } }
function BOUCLE_rubrique_principalhtml_0caead67327defaf94febb642f511490(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!isset($command['table'])) { $command['table'] = 'rubriques'; $command['id'] = '_rubrique_principal'; $command['from'] = array('rubriques' => 'spip_rubriques'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("rubriques.id_rubrique", "rubriques.lang", "rubriques.titre", "rubriques.id_secteur", "rubriques.texte", "rubriques.descriptif"); $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'], '', 'bigint(21) NOT NULL AUTO_INCREMENT'))); if (defined("_BOUCLE_PROFILER")) { $timer = time() + microtime(); } $t0 = ""; // REQUETE $iter = IterFactory::create("SQL", $command, array('squelettes/rubrique.html', 'html_0caead67327defaf94febb642f511490', '_rubrique_principal', 1, $GLOBALS['spip_lang'])); if (!$iter->err()) { lang_select($GLOBALS['spip_lang']); $SP++; // RESULTATS while ($Pile[$SP] = $iter->fetch()) { lang_select_public($Pile[$SP]['lang'], 'oui', $Pile[$SP]['titre']); $t0 .= ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '" lang="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '" dir="' . lang_dir($Pile[$SP]['lang'], 'ltr', 'rtl') . '"> <head> <title>[' . interdire_scripts(textebrut(typo($GLOBALS['meta']['nom_site'], "TYPO", $connect, $Pile[0]))) . '] : ' . interdire_scripts(entites_html(textebrut(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))) . '</title> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-meta') . ', array(\'id_rubrique\' => ' . argumenter_squelette($Pile[$SP]['id_rubrique']) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/rubrique.html\',\'html_0caead67327defaf94febb642f511490\',\'\',7,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> <link rel="alternate" type="application/rss+xml" title="' . _T('public|spip|ecrire:syndiquer_rubrique') . ' : ' . interdire_scripts(entites_html(textebrut(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))) . '" href="' . interdire_scripts(parametre_url(generer_url_public('backend', ''), 'id_rubrique', $Pile[$SP]['id_rubrique'])) . '" /> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('styles') . ', array(\'id_rubrique\' => ' . argumenter_squelette($Pile[$SP]['id_rubrique']) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/rubrique.html\',\'html_0caead67327defaf94febb642f511490\',\'\',10,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> </head> <body dir="' . lang_dir($Pile[$SP]['lang'], 'ltr', 'rtl') . '" class="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . ' rubrique sect' . $Pile[$SP]['id_secteur'] . ' ' . BOUCLE_rubriques_bodyhtml_0caead67327defaf94febb642f511490($Cache, $Pile, $doublons, $Numrows, $SP) . ' rub' . $Pile[$SP]['id_rubrique'] . '"> <div id="page" class="rubrique rub' . $Pile[$SP]['id_rubrique'] . '"> <!-- ***************************************************************** Bandeau, titre du site et menu langue Header and main menu (top and right) ************************************************************* --> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-bandeau') . ', array(\'id_rubrique\' => ' . argumenter_squelette($Pile[$SP]['id_rubrique']) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/rubrique.html\',\'html_0caead67327defaf94febb642f511490\',\'\',20,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> <!-- ***************************************************************** Contenu principal (centre) Main content (center) ************************************************************* --> <div id="bloc-contenu"> <h5> <a href="' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '" title="' . _T('public|spip|ecrire:accueil_site') . ' : ' . interdire_scripts(typo($GLOBALS['meta']['nom_site'], "TYPO", $connect, $Pile[0])) . '">' . _T('public|spip|ecrire:accueil_site') . '</a> ' . (($t1 = BOUCLE_rubriques_cheminhtml_0caead67327defaf94febb642f511490($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? ' ' . $t1 . ' ' : '') . ' ' . (($t1 = strval(interdire_scripts(couper(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])), '60')))) !== '' ? '<b class=\'separateur\'>></b> ' . $t1 : '') . ' </h5> <div class="ligne-debut"></div><!-- ligne-debut --> ' . (($t1 = strval(filtrer('image_graver', filtrer('image_reduire', !is_array($l = quete_logo('id_rubrique', 'ON', $Pile[$SP]['id_rubrique'], quete_parent($Pile[$SP]['id_rubrique']), 0)) ? '' : "<img class=\"spip_logo spip_logos\" alt=\"\" src=\"{$l['0']}\"" . $l[2] . ($l[1] ? " onmouseover=\"this.src='{$l['1']}'\" onmouseout=\"this.src='{$l['0']}'\"" : "") . ' />', '120', '0')))) !== '' ? '<div class="logo-liste-art"> ' . $t1 . ' </div>' : '') . ' <h1 class="titre-article">' . interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '</h1> ' . (($t1 = strval(interdire_scripts(($a = filtrer('image_graver', filtrer('image_reduire', propre($Pile[$SP]['texte'], $connect, $Pile[0]), '560', '0')) or is_string($a) and strlen($a)) ? $a : interdire_scripts(propre($Pile[$SP]['descriptif'], $connect, $Pile[0]))))) !== '' ? '<div class="chapo ' . interdire_scripts($Pile[$SP]['texte'] ? '' : '') . '" id="description"> ' . $t1 . (' ' . (($t2 = strval(interdire_scripts(calculer_notes()))) !== '' ? '<div class="notes" style="padding: 0 1.5em;">' . $t2 . '</div>' : '') . ' </div><!-- chapo -->') : '') . ' ' . recuperer_fond('inc/inc-rub-documents', array_merge($Pile[0], array('id_rubrique' => $Pile[$SP]['id_rubrique'])), array('compil' => array('squelettes/rubrique.html', 'html_0caead67327defaf94febb642f511490', '_rubrique_principal', 43, $GLOBALS['spip_lang'])), _request('connect')) . ' ' . (($t1 = BOUCLE_type_miniplanhtml_0caead67327defaf94febb642f511490($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? $t1 . ' ' : ' ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-rub-articles') . ', array_merge(' . var_export($Pile[0], 1) . ',array(\'id_rubrique\' => ' . argumenter_squelette($Pile[$SP]['id_rubrique']) . ', \'id_secteur\' => ' . argumenter_squelette($Pile[$SP]['id_secteur']) . ', \'self\' => ' . argumenter_squelette(self()) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . ')), array("compil"=>array(\'squelettes/rubrique.html\',\'html_0caead67327defaf94febb642f511490\',\'\',63,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> ') . ' <br class="nettoyeur" /> </div><!-- bloc-contenu --> <!-- ***************************************************************** Menus contextuels (droite) Contextual menus (right) ************************************************************* --> <div id="encart"> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-annonces') . ', array_merge(' . var_export($Pile[0], 1) . ',array(\'self\' => ' . argumenter_squelette(self()) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . ')), array("compil"=>array(\'squelettes/rubrique.html\',\'html_0caead67327defaf94febb642f511490\',\'\',76,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-breves') . ', array_merge(' . var_export($Pile[0], 1) . ',array(\'id_rubrique\' => ' . argumenter_squelette($Pile[$SP]['id_rubrique']) . ', \'self\' => ' . argumenter_squelette(self()) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . ')), array("compil"=>array(\'squelettes/rubrique.html\',\'html_0caead67327defaf94febb642f511490\',\'\',78,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-syndic') . ', array_merge(' . var_export($Pile[0], 1) . ',array(\'id_rubrique\' => ' . argumenter_squelette($Pile[$SP]['id_rubrique']) . ', \'self\' => ' . argumenter_squelette(self()) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . ')), array("compil"=>array(\'squelettes/rubrique.html\',\'html_0caead67327defaf94febb642f511490\',\'\',80,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> </div><!-- encart --> <!-- ***************************************************************** Navigation principale et rubriques (haut et/ou gauche) Main and Sections Navigation (top and/orleft) ************************************************************* --> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-menu') . ', array(\'id_rubrique\' => ' . argumenter_squelette($Pile[$SP]['id_rubrique']) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/rubrique.html\',\'html_0caead67327defaf94febb642f511490\',\'\',88,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> <!-- ***************************************************************** Pied de page - Footer ************************************************************* --> ' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-bas') . ', array(\'id_rubrique\' => ' . argumenter_squelette($Pile[$SP]['id_rubrique']) . ', \'id_secteur\' => ' . argumenter_squelette($Pile[$SP]['id_secteur']) . ', \'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/rubrique.html\',\'html_0caead67327defaf94febb642f511490\',\'\',92,$GLOBALS[\'spip_lang\'])), _request("connect")); ?' . '> </div><!-- page --> </body> </html> '; lang_select(); } lang_select(); $iter->free(); } if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) { spip_log(intval(1000 * $timer) . "ms BOUCLE_rubrique_principal @ squelettes/rubrique.html", "profiler" . _LOG_AVERTISSEMENT); } return $t0; }
function propre_diff($texte) { $span_diff = array(); if (preg_match_all(',<(/)?(span|div) (class|rem)="diff-[^>]*>,', $texte, $regs, PREG_SET_ORDER)) { $regs = array_slice($regs, 0, 500); #limiter la casse s'il y en a trop foreach ($regs as $c => $reg) { $texte = str_replace($reg[0], '@@@SPIP_DIFF' . $c . '@@@', $texte); } } // [ ...<span diff> -> lien ] // < tag <span diff> > $texte = preg_replace(',<([^>]*?@@@SPIP_DIFF[0-9]+@@@),', '<\\1', $texte); # attention ici astuce seulement deux @@ finals car on doit eviter # deux patterns a suivre, afin de pouvoir prendre [ mais eviter [[ $texte = preg_replace(',(^|[^[])[[]([^[\\]]*@@@SPIP_DIFF[0-9]+@@),', '\\1[\\2', $texte); // desactiver TeX & toujours-paragrapher $tex = $GLOBALS['traiter_math']; $GLOBALS['traiter_math'] = ''; $mem = $GLOBALS['toujours_paragrapher']; $GLOBALS['toujours_paragrapher'] = false; $texte = propre($texte); // retablir $GLOBALS['traiter_math'] = $tex; $GLOBALS['toujours_paragrapher'] = $mem; // un blockquote mal ferme peut gener l'affichage, et title plante safari $texte = preg_replace(',<(/?(blockquote|title)[^>]*)>,i', '<\\1>', $texte); // Dans les <cadre> c'est un peu plus complique if (preg_match_all(',<textarea (.*)</textarea>,Uims', $texte, $area, PREG_SET_ORDER)) { foreach ($area as $reg) { $remplace = preg_replace(',@@@SPIP_DIFF[0-9]+@@@,', '**', $reg[0]); if ($remplace != $reg[0]) { $texte = str_replace($reg[0], $remplace, $texte); } } } // replacer les valeurs des <span> et <div> diff- if (is_array($regs)) { foreach ($regs as $c => $reg) { $bal = !$reg[1] ? $reg[0] : "</{$reg['2']}>"; $texte = str_replace('@@@SPIP_DIFF' . $c . '@@@', $bal, $texte); $GLOBALS['les_notes'] = str_replace('@@@SPIP_DIFF' . $c . '@@@', $bal, $GLOBALS['les_notes']); } } // quand le dernier tag est ouvrant le refermer ... $reg = end($regs); if (!$reg[1] and $reg[2]) { $texte .= "</{$reg['2']}>"; } // et interdire_scripts ! $texte = interdire_scripts($texte); return $texte; }
function filtre_introduction_dist($descriptif, $texte, $longueur, $connect) { // Si un descriptif est envoye, on l'utilise directement if (strlen($descriptif)) { return propre($descriptif, $connect); } // De preference ce qui est marque <intro>...</intro> $intro = ''; $texte = preg_replace(",(</?)intro>,i", "\\1intro>", $texte); // minuscules while ($fin = strpos($texte, "</intro>")) { $zone = substr($texte, 0, $fin); $texte = substr($texte, $fin + strlen("</intro>")); if ($deb = strpos($zone, "<intro>") or substr($zone, 0, 7) == "<intro>") { $zone = substr($zone, $deb + 7); } $intro .= $zone; } // [12025] On ne *PEUT* pas couper simplement ici car c'est du texte brut, // qui inclus raccourcis et modeles // un simple <articlexx> peut etre ensuite transforme en 1000 lignes ... // par ailleurs le nettoyage des raccourcis ne tient pas compte // des surcharges et enrichissement de propre // couper doit se faire apres propre //$texte = nettoyer_raccourcis_typo($intro ? $intro : $texte, $connect); // Cependant pour des questions de perfs on coupe quand meme, en prenant // large et en se mefiant des tableaux #1323 if (strlen($intro)) { $texte = $intro; } else { if (strpos("\n" . $texte, "\n|") === false and strlen($texte) > 2.5 * $longueur) { if (strpos($texte, "<multi") !== false) { $texte = extraire_multi($texte); } $texte = couper($texte, 2 * $longueur); } } // ne pas tenir compte des notes if ($notes = charger_fonction('notes', 'inc', true)) { $notes('', 'empiler'); } // Supprimer les modèles avant le propre afin d'éviter qu'ils n'ajoutent du texte indésirable // dans l'introduction. $texte = supprime_img($texte, ''); $texte = propre($texte, $connect); if ($notes) { $notes('', 'depiler'); } if (!defined('_INTRODUCTION_SUITE')) { define('_INTRODUCTION_SUITE', ' (...)'); } $texte = couper($texte, $longueur, _INTRODUCTION_SUITE); // et reparagrapher si necessaire (coherence avec le cas descriptif) if ($GLOBALS['toujours_paragrapher']) { // Fermer les paragraphes $texte = paragrapher($texte, $GLOBALS['toujours_paragrapher']); } return $texte; }