function balise_FOREACH($p) { $_tableau = interprete_argument_balise(1,$p); $_tableau = str_replace("'", "", strtoupper($_tableau)); $_tableau = sinon($_tableau, 'ENV'); $f = 'balise_'.$_tableau; $balise = function_exists($f) ? $f : (function_exists($g = $f.'_dist') ? $g : ''); if($balise) { $_modele = interprete_argument_balise(2,$p); $_modele = str_replace("'", "", strtolower($_modele)); $__modele = 'foreach_'.strtolower($_tableau); $_modele = (!$_modele AND find_in_path('modeles/'.$__modele.'.html')) ? $__modele : ($_modele ? $_modele : 'foreach'); $p->param = @array_shift(@array_shift($p->param)); $p = $balise($p); $filtre = chercher_filtre('foreach'); $p->code = $filtre . "(unserialize(" . $p->code . "), '" . $_modele . "')"; } //On a pas trouve la balise correspondant au tableau a traiter else { erreur_squelette( _L(/*zbug*/'erreur #FOREACH: la balise #'.$_tableau.' n\'existe pas'), $p->id_boucle ); $p->code = "''"; } return $p; }
/** * Un parametre permet de forcer le statut (exemple: plugin antispam) * * http://code.spip.net/@inc_forum_insert_dist * * @param $objet * @param $id_objet * @param $id_forum * en reponse a * @param null $force_statut * @return bool */ function inc_forum_insert_dist($objet, $id_objet, $id_forum, $force_statut = null) { if (!in_array($force_statut, array('privrac', 'privadm'))) { if (!strlen($objet) or !intval($id_objet)) { spip_log("Erreur insertion forum sur objet='{$objet}', id_objet={$id_objet}", 'forum.' . _LOG_ERREUR); return 0; } } spip_log("insertion de forum {$force_statut} sur {$objet} {$id_objet} (+{$id_forum})", 'forum'); include_spip('inc/filtres'); include_spip('inc/modifier'); include_spip('inc/session'); $champs = objet_info('forum', 'champs_editables'); $c = collecter_requests($champs, array()); $c['statut'] = 'off'; $c['objet'] = $objet; $c['id_objet'] = $id_objet; $c['auteur'] = sinon(session_get('nom'), session_get('session_nom')); $c['email_auteur'] = sinon(session_get('email'), session_get('session_email')); $c = pipeline('pre_edition', array('args' => array('table' => 'spip_forum', 'id_objet' => $id_forum, 'action' => 'instituer'), 'data' => forum_insert_statut($c, $force_statut))); $id_reponse = forum_insert_base($c, $id_forum, $objet, $id_objet, $c['statut'], _request('ajouter_mot')); if (!$id_reponse) { spip_log("Echec insertion forum sur {$objet} {$id_objet} (+{$id_forum})", 'forum.' . _LOG_ERREUR); } else { spip_log("forum insere' {$id_reponse} sur {$objet} {$id_objet} (+{$id_forum})", 'forum'); } return $id_reponse; }
function html_f3666965c018303599bb64189cbac96c($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 = ' <div' . (($t1 = strval(interdire_scripts(entites_html(sinon(table_valeur(@$Pile[0], (string) 'divclass', null), 'spip-admin-bloc'), true)))) !== '' ? ' class="' . $t1 . '"' : '') . ' id=\'spip-admin\' dir="' . lang_dir(@$Pile[0]['lang'], 'ltr', 'rtl') . '">' . (($t1 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'analyser', null), true)))) !== '' ? ' <a href="' . $t1 . ('" class="spip-admin-boutons" id="analyser">' . _T('public|spip|ecrire:analyse_xml') . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'xhtml_error', null), true)))) !== '' ? ' (' . $t2 . ')' : '') . '</a>') : '') . ' ' . (($t1 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'objet', null), true) ? ' ' : ''))) !== '' ? $t1 . (' ' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'id_objet', null), true)))) !== '' ? '<a href="' . interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) ('voir_' . interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'objet', null), true))), null), true)) . '" class="spip-admin-boutons" id="voir_' . interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'objet', null), true)) . '">' . interdire_scripts(_T(objet_info(entites_html(table_valeur(@$Pile[0], (string) 'objet', null), true), 'texte_objet'))) . ' (' . $t2 . ')</a>' : '') . ' ') : '') . '<!--extra-->' . (($t1 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'ecrire', null), true)))) !== '' ? ' <a href="' . $t1 . ('" class="spip-admin-boutons" id="ecrire">' . _T('public|spip|ecrire:espace_prive') . '</a>') : '') . ' <a href="' . parametre_url(self(), 'var_mode', interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'calcul', null), true))) . '" class="spip-admin-boutons" id="var_mode">' . _T('public|spip|ecrire:admin_recalculer') . interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'use_cache', null), true)) . '</a>' . (($t1 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'preview', null), true)))) !== '' ? ' <a href="' . $t1 . ('" class="spip-admin-boutons" id="preview">' . _T('public|spip|ecrire:previsualisation') . '</a>') : '') . (($t1 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'debug', null), true)))) !== '' ? ' <a href="' . $t1 . ('" class="spip-admin-boutons" id="debug">' . _T('public|spip|ecrire:admin_debug') . '</a>') : '') . ' </div> '; return analyse_resultat_skel('html_f3666965c018303599bb64189cbac96c', $Cache, $page, 'squelettes-dist/formulaires/administration.html'); }
function exec_articles_args($id_article) { pipeline('exec_init',array('args'=>array('exec'=>'articles','id_article'=>$id_article),'data'=>'')); $row = sql_fetsel("*", "spip_articles", "id_article=$id_article"); if (!$row OR !autoriser('voir', 'article', $id_article)) { include_spip('inc/minipres'); echo minipres(_T('public:aucun_article')); } else { $row['titre'] = sinon($row["titre"],_T('info_sans_titre')); $res = debut_gauche('accueil',true) . articles_affiche($id_article, $row, _request('cherche_auteur'), _request('ids'), _request('cherche_mot'), _request('select_groupe'), _request('trad_err'), _request('debut')) . "<br /><br /><div class='centered'>" . "</div>" . fin_gauche(); $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page("« ". $row['titre'] ." »", "naviguer", "articles", $row['id_rubrique']); echo debut_grand_cadre(true), afficher_hierarchie($row['id_rubrique'],_T('titre_cadre_interieur_rubrique'),$id_article,'article',$row['id_secteur'],($row['statut'] == 'publie')), fin_grand_cadre(true), $res, fin_page(); } }
function BOUCLE_documenthtml_b8a8020987dd01f8087ad24f961857eb(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; $in = array(); if (!is_array($a = @$Pile[0]['mode'])) { $in[] = $a; } else { $in = array_merge($in, $a); } if (!isset($command['table'])) { $command['table'] = 'documents'; $command['id'] = '_document'; $command['from'] = array('documents' => 'spip_documents', 'L1' => 'spip_types_documents'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("documents.id_document", "L1.titre AS type_document", "documents.taille", "documents.mode", "documents.largeur", "documents.hauteur", "documents.titre", "L1.mime_type"); $command['orderby'] = array(); $command['join'] = array('L1' => array('documents', 'extension')); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array(array('(documents.taille > 0 OR documents.distant=\'oui\')'), array('=', 'documents.id_document', sql_quote(@$Pile[0]['id_document'], '', 'bigint(21) NOT NULL AUTO_INCREMENT')), !(is_array(@$Pile[0]['mode']) ? count(@$Pile[0]['mode']) : strlen(@$Pile[0]['mode'])) ? '' : (is_array(@$Pile[0]['mode']) ? sql_in('documents.mode', sql_quote($in)) : array('=', 'documents.mode', sql_quote(@$Pile[0]['mode'], '', 'varchar(10) NOT NULL DEFAULT \'document\'')))); if (defined("_BOUCLE_PROFILER")) { $timer = time() + microtime(); } $t0 = ""; // REQUETE $iter = IterFactory::create("SQL", $command, array('plugins-dist/medias/modeles/img.html', 'html_b8a8020987dd01f8087ad24f961857eb', '_document', 1, $GLOBALS['spip_lang'])); if (!$iter->err()) { $SP++; // RESULTATS while ($Pile[$SP] = $iter->fetch()) { $t0 .= ' ' . vide($Pile['vars'][$_zzz = (string) 'image'] = interdire_scripts(($a = match(entites_html(sinon(table_valeur(@$Pile[0], (string) 'mode_force', null), interdire_scripts($Pile[$SP]['mode'])), true), 'image|vignette') or is_string($a) and strlen($a)) ? $a : interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'embed', null), true)) ? ' ' : '')) . (($t1 = strval(table_valeur($Pile["vars"], (string) 'image', null))) !== '' ? $t1 . (' <span class=\'spip_document_' . $Pile[$SP]['id_document'] . ' spip_documents' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true)))) !== '' ? ' spip_documents_' . $t2 : '') . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'class', null), true)))) !== '' ? ' ' . $t2 : '') . ' spip_lien_ok\'' . (($t2 = strval(interdire_scripts(match(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true), 'left|right')))) !== '' ? ' style=\'float:' . $t2 . ';\'' : '') . '> ' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true)))) !== '' ? '<a href="' . $t2 . ('"' . (($t3 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien_class', null), true)))) !== '' ? ' class="' . $t3 . '"' : '') . '>') : '') . '<img src=\'' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_document'], 'document', '', '', true))) . '\'' . (($t2 = strval(interdire_scripts($Pile[$SP]['largeur']))) !== '' ? ' width="' . $t2 . '"' : '') . (($t2 = strval(interdire_scripts($Pile[$SP]['hauteur']))) !== '' ? ' height="' . $t2 . '"' : '') . ' alt="' . interdire_scripts(texte_backend(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '"' . (($t2 = strval(interdire_scripts(texte_backend(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))) !== '' ? ' title="' . $t2 . '"' : '') . ' />' . interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true) ? '</a>' : '') . '</span> ') : '') . (!table_valeur($Pile["vars"], (string) 'image', null) ? ' ' . (' ' . vide($Pile['vars'][$_zzz = (string) 'fichier'] = extraire_attribut(quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, ''), 'src')) . ' ' . vide($Pile['vars'][$_zzz = (string) 'width'] = extraire_attribut(quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, ''), 'width')) . ' ' . vide($Pile['vars'][$_zzz = (string) 'height'] = extraire_attribut(quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, ''), 'height')) . ' <span class=\'spip_document_' . $Pile[$SP]['id_document'] . ' spip_documents' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true)))) !== '' ? ' spip_documents_' . $t2 : '') . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'class', null), true)))) !== '' ? ' ' . $t2 : '') . ' spip_lien_ok\'' . (($t2 = strval(interdire_scripts(match(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true), 'left|right')))) !== '' ? ' style=\'float:' . $t2 . (';' . (($t3 = strval(table_valeur($Pile["vars"], (string) 'width', null))) !== '' ? ' width:' . $t3 . 'px;' : '') . '\'') : '') . '><a href="' . interdire_scripts(($a = entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true) or is_string($a) and strlen($a)) ? $a : vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_document'], 'document', '', '', true)))) . '"' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true) ? '' : 'type="' . interdire_scripts($Pile[$SP]['mime_type']) . '"'))) !== '' ? ' ' . $t2 : '') . (($t2 = strval(interdire_scripts(texte_backend(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))) !== '' ? ' title="' . $t2 . '"' : '') . '><img src=\'' . table_valeur($Pile["vars"], (string) 'fichier', null) . '\' width=\'' . table_valeur($Pile["vars"], (string) 'width', null) . '\' height=\'' . table_valeur($Pile["vars"], (string) 'height', null) . '\' alt=\'' . interdire_scripts(attribut_html(strlen(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])) ? interdire_scripts(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])) . ' {' . interdire_scripts($Pile[$SP]['type_document']) . '}' : interdire_scripts($Pile[$SP]['type_document']))) . '\' /></a></span> ') : ''); } $iter->free(); } if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) { spip_log(intval(1000 * $timer) . "ms BOUCLE_document @ plugins-dist/medias/modeles/img.html", "profiler" . _LOG_AVERTISSEMENT); } return $t0; }
function legender_entete($document) { $titre = $document['titre']; $entete = basename($document['fichier']); if (strlen($entete) > 20) $entete = substr($entete, 0, 20)."..."; if (strlen($titre)) $entete = "<strong>". lignes_longues(typo($titre),25) . "</strong>"; return sinon($entete,_T('info_sans_titre')); }
/** * Retourne la classe ChampExtra du champ demande * permettant ainsi d'exploiter ses donnees. * * <BOUCLE_x(TABLE)> * - #CHAMP_EXTRA{nom_du_champ} * </BOUCLE_x> * * @return ChampExtra **/ function balise_CHAMP_EXTRA_dist($p) { // prendre nom de la cle primaire de l'objet pour calculer sa valeur $id_boucle = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; $objet = $p->boucles[$id_boucle]->id_table; // recuperer les parametres : colonne sql (champ) $colonne = interprete_argument_balise(1, $p); $demande = sinon(interprete_argument_balise(2, $p), "''"); $p->code = "calculer_balise_CHAMP_EXTRA('$objet', $colonne, $demande)"; return $p; }
function balise_CONFIG($p) { if (!$arg = interprete_argument_balise(1,$p)) { $arg = "''"; } $sinon = interprete_argument_balise(2,$p); $unserialize = sinon(interprete_argument_balise(3,$p),"false"); $p->code = 'lire_config(' . $arg . ',' . ($sinon && $sinon != "''" ? $sinon : 'null') . ',' . $unserialize . ')'; return $p; }
function exec_cfg_dist($class = null) { include_spip('inc/filtres'); $cfg = cfg_charger_classe('cfg', 'inc'); $config =& new $cfg($nom = sinon(_request('cfg'), ''), $cfg_id = sinon(_request('cfg_id'), '')); // traitements du formulaire poste $config->traiter(); // // affichages // include_spip("inc/presentation"); if (!$config->autoriser()) { echo $config->acces_refuse(); exit; } pipeline('exec_init', array('args' => array('exec' => 'cfg'), 'data' => '')); $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page($config->get_boite(), 'cfg', $config->get_nom()); echo "<br /><br /><br />\n"; echo gros_titre(sinon($config->get_titre(), _T('cfg:configuration_modules')), '', false); echo $config->barre_onglets(); // colonne gauche echo debut_gauche('', true); // si un formulaire cfg est demande if ($s = $config->descriptif()) { echo debut_boite_info(true) . $s . fin_boite_info(true); } echo pipeline('affiche_gauche', array('args' => array('exec' => 'cfg'), 'data' => '')); echo creer_colonne_droite('', true); echo pipeline('affiche_droite', array('args' => array('exec' => 'cfg'), 'data' => '')); // affichage des messages envoyes par cfg if ($s = $config->messages()) { echo debut_boite_info(true) . $s . fin_boite_info(true); } // affichage des liens if ($s = $config->liens()) { echo debut_boite_info(true) . $s . fin_boite_info(true); } if ($s = $config->liens_multi()) { echo debut_boite_info(true) . $s . fin_boite_info(true); } echo debut_droite("", true); // centre de la page if ($config->get_presentation() == 'auto') { echo debut_cadre_trait_couleur('', true, '', $config->get_boite()); echo $config->formulaire(); echo fin_cadre_trait_couleur(true); } else { echo $config->formulaire(); } // pied echo fin_gauche() . fin_page(); }
function cextras_enum($enum, $val='', $type='valeur', $name='') { $enums = array(); foreach ($vals = explode("\n", $enum) as $x) { list($cle, $desc) = explode(',', trim($x), 2); $enums[$cle] = _T($desc); } $val_t = explode(',', $val); foreach($enums as $cle => $desc) { switch($type) { case 'valeur': $enums[$cle] = ($cle == $val OR in_array($cle, $val_t)) ? sinon(sinon($desc,$cle),_T('cextra:cextra_par_defaut')) : ''; break; case 'option': $enums[$cle] = '<option value="'.entites_html($cle).'"' . ($cle == $val ? " selected='selected'" : '' ) .'> '.sinon(sinon($desc,$cle),_T('cextra:cextra_par_defaut')) .'</option>' ."\n"; break; case 'radio': $enums[$cle] = "<div class='choix'><input type='radio' name='$name' id='${name}_$cle' value=\"".entites_html($cle).'"' . ($cle == $val ? " checked='checked'" : '' ) ."><label for='${name}_$cle'>" . sinon(sinon($desc,$cle),_T('cextra:cextra_par_defaut')) .'</label></div>' ."\n"; break; case 'cases': $enums[$cle] = "<div class='choix'><input type='checkbox' name='${name}[]' id='${name}_$cle' value=\"".entites_html($cle).'"' . (in_array($cle, $val_t) ? " checked='checked'" : '' ) ." /><label for='${name}_$cle'>" . sinon(sinon($desc,$cle),_T('cextra:cextra_par_defaut')) .'</label></div>' ."\n"; break; } } return trim(join("\n", $enums)); }
function inc_formater_auteur_dist($id_auteur, $row=NULL) { global $connect_id_auteur, $connect_statut; $id_auteur = intval($id_auteur); if ($row===NULL) $row = sql_fetsel("*, (en_ligne<DATE_SUB(NOW(),INTERVAL 15 DAY)) AS parti", "spip_auteurs", "id_auteur=$id_auteur"); $vals = array(); $statut = $row['statut']; $href = generer_url_ecrire("auteurs","statut=$statut"); $vals[] = "<a href='$href'>" . bonhomme_statut($row) . '</a>'; if (($id_auteur == $connect_id_auteur) OR $row['parti']) $vals[]= ' '; else $vals[]= formater_auteur_mail($row, $id_auteur); if (!$nom = typo($row['nom'])) $nom = "<span style='color: red'>" . _T('texte_vide') . '</span>'; $vals[] = "<a href='" . generer_url_ecrire('auteur_infos', "id_auteur=$id_auteur") . "'" . (!$row['bio'] ? '' : (" title=\"" . attribut_html(couper(textebrut($row["bio"]), 200)) ."\"")) . ">$nom</a>"; $url = traiter_lien_explicite($row["url_site"]); $vals[] = !$url ? " " : "<a href='$url'>".couper(sinon(typo($row['nom_site']), $row["url_site"]),30)."</a>"; $contributions = array(); if (autoriser('modifier', 'auteur', $id_auteur, $row)) { $in = sql_in('statut', ($connect_statut == "0minirezo" ? array('prepa', 'prop', 'publie', 'refuse') : array('prop', 'publie'))); if ($cpt = sql_countsel("spip_auteurs_articles AS L LEFT JOIN spip_articles AS A ON A.id_article=L.id_article", "L.id_auteur=$id_auteur AND $in")) $contributions[] = ($cpt>1?$cpt.' '._T('info_article_2'):_T('info_1_article')); } else { if ($cpt = sql_countsel("spip_forum AS F", "F.id_auteur=$id_auteur")) $contributions[] = ($cpt>1?$cpt.' '._T('public:messages_forum'):('1 ' . _T('public:message'))); } $contributions = pipeline('compter_contributions_auteur',array('args'=>array('id_auteur'=>$id_auteur,'row'=>$row),'data'=>$contributions)); $vals[] = count($contributions)?implode('<br />',$contributions):" "; return $vals; }
function cextras_enum($enum, $val='', $type='valeur', $name='', $class='') { // transformer la saisie utilisateur en tableau $enums = cextras_enum_array($enum); $val_t = explode(',', $val); $class = $class ? " class='$class'" : ''; foreach($enums as $cle => $desc) { switch($type) { case 'valeur': $enums[$cle] = ($cle == $val OR in_array($cle, $val_t)) ? sinon(sinon($desc,$cle),_T('cextras:cextra_par_defaut')) : ''; break; case 'option': $enums[$cle] = '<option value="'.entites_html($cle).'"' . ($cle == $val ? " selected='selected'" : '' ) .'> '.sinon(sinon($desc,$cle),_T('cextras:cextra_par_defaut')) .'</option>' ."\n"; break; case 'radio': $enums[$cle] = "<div class='choix'><input type='radio' name='$name'$class id='${name}_$cle' value=\"".entites_html($cle).'"' . ($cle == $val ? " checked='checked'" : '' ) ."><label for='${name}_$cle'>" . sinon(sinon($desc,$cle),_T('cextras:cextra_par_defaut')) .'</label></div>' ."\n"; break; case 'cases': $enums[$cle] = "<div class='choix'><input type='checkbox' name='${name}[]'$class id='${name}_$cle' value=\"".entites_html($cle).'"' . (in_array($cle, $val_t) ? " checked='checked'" : '' ) ." /><label for='${name}_$cle'>" . sinon(sinon($desc,$cle),_T('cextras:cextra_par_defaut')) .'</label></div>' ."\n"; break; } } return trim(join("\n", $enums)); }
/** * Retourne la description de la saisie du champ demandé * permettant ainsi d'exploiter ses données. * * @example * ``` * <BOUCLE_x(TABLE)> * - #CHAMP_EXTRA{nom_du_champ} * - #CHAMP_EXTRA{nom_du_champ, label} * </BOUCLE_x> * ``` * * @balise * @note * Lève une erreur de squelette si le nom de champs extras * n'est pas indiqué en premier paramètre de la balise * * @param Champ $p * AST au niveau de la balise * @return Champ * AST complété par le code PHP de la balise **/ function balise_CHAMP_EXTRA_dist($p) { // prendre nom de la cle primaire de l'objet pour calculer sa valeur $id_boucle = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; $objet = $p->boucles[$id_boucle]->id_table; // recuperer les parametres : colonne sql (champ) if (!($colonne = interprete_argument_balise(1, $p))) { $msg = array('zbug_balise_sans_argument', array('balise' => ' CHAMP_EXTRA')); erreur_squelette($msg, $p); } $demande = sinon(interprete_argument_balise(2, $p), "''"); $p->code = "calculer_balise_CHAMP_EXTRA('{$objet}', {$colonne}, {$demande})"; return $p; }
function balise_LESMOTS_dist($p){ $i_boucle = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; // #LESMOTS hors boucle ? ne rien faire if (!$type = $p->boucles[$i_boucle]->type_requete) { $p->code = "''"; $p->interdire_scripts = false; return $p; } // le compilateur 1.9.2 ne calcule pas primary pour les tables secondaires // il peut aussi arriver une table sans primary (par ex: une vue) if (!($primary = $p->boucles[$i_boucle]->primary)) { include_spip('inc/vieilles_defs'); # 1.9.2 pour trouver_def_table list($nom, $desc) = trouver_def_table( $p->boucles[$i_boucle]->type_requete, $p->boucles[$i_boucle]); $primary = $desc['key']['PRIMARY KEY']; } $primary = explode(',',$primary); $id = array(); foreach($primary as $key) $id[] = champ_sql(trim($key),$p); $primary = implode(".'-'.",$id); $p->code = "classe_boucle_crayon('" . $type ."'," .sinon(interprete_argument_balise(1,$p),"''") ."," . $primary .").' '"; $p->interdire_scripts = false; return $p; // Cherche le champ 'lesmots' dans la pile $_lesmots = champ_sql('lesmots', $p); // Si le champ n'existe pas (cas de spip_articles), on applique // le fond les_mots.html en passant id_article dans le contexte; // dans le cas contraire on prend le champ SQL 'lesmots' if ($_lesmots AND $_lesmots != '$Pile[0][\'lesmots\']') { $p->code = "safehtml($_lesmots)"; // $p->interdire_scripts = true; } else { if ($cle = $p->boucles[$p->id_boucle]->primary) $id = champ_sql($primary, $p); $p->code = "recuperer_fond('fonds/lesmots', array($cle => $id))"; // securite imposee par recuperer_fond() $p->interdire_scripts = false; } return $p; }
function cfg_header_prive($flux) { if (!_request('cfg') || !_request('exec') == 'cfg') { return $flux; } // Ajout des css de cfg (uniquement balise arbo pour l'instant) dans le header prive $flux .= '<link rel="stylesheet" href="' . _DIR_PLUGIN_CFG . 'css/cfg.css" type="text/css" media="all" />'; include_spip('inc/filtres'); $cfg_formulaire = cfg_charger_classe('cfg_formulaire', 'inc'); $config =& new $cfg_formulaire(sinon(_request('cfg'), ''), sinon(_request('cfg_id'), '')); if ($config->param->head) { $flux .= "\n" . $config->param->head; } return $flux; }
function html_e3cac34669117ef67c3fe7b2fef7351d($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 = '<!-- L\'entete du site --> <div id="entete" class="pas_surlignable"> <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])) . '" class="nom-site"><span>' . interdire_scripts(typo($GLOBALS['meta']['nom_site'], "TYPO", $connect, $Pile[0])) . '</span></a> </div><!-- entete -->'; return analyse_resultat_skel('html_e3cac34669117ef67c3fe7b2fef7351d', $Cache, $page, 'squelettes/inc/inc-bandeau.html'); }
function BOUCLE_articleshtml_ce97d1249b67fffb20134bd49b8a9e29(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; if (!isset($command['table'])) { $command['table'] = 'articles'; $command['id'] = '_articles'; $command['from'] = array('articles' => 'spip_articles', 'L1' => 'spip_auteurs_liens'); $command['type'] = array(); $command['groupby'] = array("articles.id_article"); $command['select'] = array("articles.titre", "articles.id_article", "articles.lang", "articles.texte", "articles.descriptif", "articles.chapo", "articles.date"); $command['orderby'] = array('articles.titre'); $command['join'] = array('L1' => array('articles', 'id_objet', 'id_article', 'L1.objet=' . sql_quote('article'))); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), array('=', 'L1.id_auteur', sql_quote($Pile[$SP]['id_auteur'], '', 'bigint(21) NOT NULL DEFAULT \'0\''))); if (defined("_BOUCLE_PROFILER")) { $timer = time() + microtime(); } $t0 = ""; // REQUETE $iter = IterFactory::create("SQL", $command, array('squelettes/auteur.html', 'html_ce97d1249b67fffb20134bd49b8a9e29', '_articles', 39, $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']); $t1 = ' <h3><a href="' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '/spip.php?action=converser&redirect=' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '%2F' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '&var_lang=' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '" hreflang="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '" ' . (($t1 = strval(interdire_scripts(entites_html(textebrut(filtre_introduction_dist($Pile[$SP]['descriptif'], strlen($Pile[$SP]['descriptif']) ? '' : $Pile[$SP]['chapo'] . "\n\n" . $Pile[$SP]['texte'], 500, $connect, null)))))) !== '' ? 'title="' . $t1 . '"' : '') . '>' . interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '</a></h3> <div class="detail"> ' . interdire_scripts(nom_jour(normaliser_date($Pile[$SP]['date']))) . ' ' . interdire_scripts(affdate(normaliser_date($Pile[$SP]['date']))) . ' </div> '; $t0 .= (strlen($t1) && strlen($t0) ? '<br />' : '') . $t1; 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_articles @ squelettes/auteur.html", "profiler" . _LOG_AVERTISSEMENT); } return $t0; }
function balise_CONFIG($p) { if (!($arg = interprete_argument_balise(1, $p))) { $arg = "''"; } $sinon = interprete_argument_balise(2, $p); $unserialize = sinon(interprete_argument_balise(3, $p), "false"); // cas particulier historique : |in_array{#CONFIG{toto,'',''}} // a remplacer par |in_array{#CONFIG{toto/,#ARRAY}} // il sert aussi a lire $GLOBALS['meta']['param'] qui serait un array()... if ($sinon === "''" and $unserialize === "''" and false === strpos('::', $arg)) { $sinon = "array()"; $unserialize = true; $arg = "'metapack::'." . $arg; } $p->code = 'lire_config(' . $arg . ',' . ($sinon && $sinon != "''" ? $sinon : 'null') . ',' . $unserialize . ')'; return $p; }
function formulaires_signature_charger_dist($id_article) { include_spip('base/abstract_sql'); // pas de petition, pas de signature if (!($r = sql_fetsel('*', 'spip_petitions', 'id_article=' . intval($id_article)))) { return false; } // pas de signature sur une petition fermee (TODO) ou poubelle if (isset($r['statut']) and in_array($r['statut'], array('off', 'poubelle'))) { return false; } $id_petition = $r['id_petition']; $valeurs = array('id_petition' => $id_petition, 'id_article' => $id_article, 'session_nom' => sinon($GLOBALS['visiteur_session']['session_nom'], $GLOBALS['visiteur_session']['nom']), 'session_email' => sinon($GLOBALS['visiteur_session']['session_email'], $GLOBALS['visiteur_session']['email']), 'signature_nom_site' => '', 'signature_url_site' => 'http://', '_texte' => $r['texte'], '_message' => $r['message'] == 'oui' ? ' ' : '', 'message' => '', 'site_obli' => $r['site_obli'] == 'oui' ? ' ' : '', 'debut_signatures' => ''); if ($c = _request('var_confirm')) { $valeurs['_confirm'] = $c; $valeurs['editable'] = false; } return $valeurs; }
function html_6df0ecfade86092ec8be1bb468d967e1($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 = ' ' . (($t1 = strval(direction_css(find_in_path('spip_style.css')))) !== '' ? '<link rel="stylesheet" href="' . $t1 . '" type="text/css" media="all" />' : '') . ' ' . (($t1 = strval(direction_css(find_in_path('spip_formulaires.css')))) !== '' ? '<link rel="stylesheet" href="' . $t1 . '" type="text/css" media="projection, screen, tv" />' : '') . ' ' . (($t1 = strval(direction_css(find_in_path('styles/base.css')))) !== '' ? '<link rel="stylesheet" href="' . $t1 . '" type="text/css" media="projection, screen, tv" />' : '') . ' ' . (($t1 = strval(find_in_path('styles/alter.css'))) !== '' ? '<link rel="stylesheet" href="' . $t1 . '" type="text/css" media="projection, screen, tv" />' : '') . ' ' . (($t1 = strval(find_in_path('styles/habillages.css'))) !== '' ? '<link rel="stylesheet" href="' . $t1 . '" type="text/css" media="projection, screen, tv" />' : '') . ' ' . (($t1 = strval(find_in_path('styles/perso.css'))) !== '' ? '<link rel="stylesheet" href="' . $t1 . '" type="text/css" media="projection, screen, tv" />' : '') . ' ' . (($t1 = strval(find_in_path('styles/color.css'))) !== '' ? '<link rel="stylesheet" href="' . $t1 . '" type="text/css" media="projection, screen, tv" />' : '') . ' ' . (($t1 = strval(direction_css(find_in_path('styles/print.css')))) !== '' ? '<link rel="stylesheet" href="' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '/' . $t1 . '" type="text/css" media="print" />' : '') . ' ' . '<' . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?' . '>' . pipeline('insert_head', '<!-- insert_head -->') . ' ' . (($t1 = strval(find_in_path('js/base.js'))) !== '' ? '<script src="' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '/' . $t1 . '" type="text/javascript"></script>' : '') . ' ' . (($t1 = strval(find_in_path('js/perso.js'))) !== '' ? '<script src="' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '/' . $t1 . '" type="text/javascript"></script>' : '') . ' <!--[if lte IE 6]> <style> #menu-rubriques a, #extra a { height: 1em; } #menu-rubriques li, #extra li { height: 1em; float: left; clear: both;width: 100%; } </style> <![endif]--> <!--[if IE]> <style> body * {zoom:1} #menu-principal *, #bloc-contenu * {zoom: 0} #menu-rubriques li { clear: none;} </style> <![endif]--> ' . BOUCLE_polices_webfontshtml_6df0ecfade86092ec8be1bb468d967e1($Cache, $Pile, $doublons, $Numrows, $SP); return analyse_resultat_skel('html_6df0ecfade86092ec8be1bb468d967e1', $Cache, $page, 'squelettes/styles.html'); }
function formulaires_migrer_agenda_traiter_dist() { $id_rubrique = _request('id_parent'); $where_articles = migrer_agenda_where_articles($id_rubrique, _request('toute_la_branche')); $groupes = _request('groupes_mots'); if (!$groupes) { $groupes = array(); } $where_mots = migrer_agenda_where_mots($groupes); $horaire = _request('horaire') == 'oui' ? true : false; $champ_date_debut = _request('champ_date_debut'); $champ_date_fin = _request('champ_date_fin'); // poser le flag agenda sur la rubrique ! sql_updateq('spip_rubriques', array('agenda' => 1), 'id_rubrique=' . intval($id_rubrique)); // et migrer les articles $nb = migrer_articles($where_articles, $champ_date_debut, $champ_date_fin, $horaire, $where_mots); $message = _T('migreragenda:info_migration_articles_reussi') . ' '; $message .= sinon(singulier_ou_pluriel($nb, 'info_1_article', 'info_nb_articles'), _T('info_aucun_article')); return array('message_ok' => $message); }
/** * Gerer l'option <!-- head= xxx --> des fonds CFG * uniquement dans le prive * * @param Array $flux * @return Array */ function cfg_header_prive($flux){ if (!_request('cfg') || (!_request('exec') == 'cfg')) { return $flux; } // Ajout des css de cfg $flux .= '<link rel="stylesheet" href="' . generer_url_public('cfg.css'). '" type="text/css" media="all" />'; include_spip('inc/filtres'); include_spip('inc/cfg_formulaire'); $config = new cfg_formulaire( sinon(_request('cfg'), ''), sinon(_request('cfg_id'),'')); if ($config->param['head']) $flux .= "\n".$config->param['head']; return $flux; }
function formulaires_signature_charger_dist($id_article, $petition, $texte, $site_obli, $message) { $valeurs = array( 'id_article' => $id_article, 'session_nom' => sinon($GLOBALS['visiteur_session']['session_nom'], $GLOBALS['visiteur_session']['nom']), 'session_email'=> sinon($GLOBALS['visiteur_session']['session_email'], $GLOBALS['visiteur_session']['email']), 'signature_nom_site'=>'', 'signature_url_site'=>'http://', '_texte'=>$petition, '_message'=>$message, 'message'=>'', 'site_obli' => $site_obli, 'debut_signatures'=>'' // pour le nettoyer de l'url d'action ! ); if ($c = _request('var_confirm')) { $valeurs['_confirm'] = $c; $valeurs['editable'] = false; } return $valeurs; }
function inc_recherche_to_array_dist($recherche, $options = array()) { // options par defaut $options = array_merge(array('score' => true, 'champs' => false, 'toutvoir' => false, 'matches' => false, 'jointures' => false), $options); include_spip('inc/rechercher'); include_spip('inc/autoriser'); $requete = array("SELECT" => array(), "FROM" => array(), "WHERE" => array(), "GROUPBY" => array(), "ORDERBY" => array(), "LIMIT" => "", "HAVING" => array()); $table = sinon($options['table'], 'article'); if ($options['champs']) { $champs = $options['champs']; } else { $l = liste_des_champs(); $champs = $l['article']; } $serveur = $options['serveur']; list($methode, $q, $preg) = expression_recherche($recherche, $options); $jointures = $options['jointures'] ? liste_des_jointures() : array(); $_id_table = id_table_objet($table); // c'est un pis-aller : ca a peu de chance de marcher, mais mieux quand meme que en conservant la ',' // (aka ca marche au moins dans certains cas comme avec spip_formulaires_reponses_champs) if (strpos($_id_table, ",") !== false) { $_id_table = explode(',', $_id_table); $_id_table = reset($_id_table); } $requete['SELECT'][] = "t." . $_id_table; $a = array(); // Recherche fulltext foreach ($champs as $champ => $poids) { if (is_array($champ)) { spip_log("requetes imbriquees interdites"); } else { if (strpos($champ, ".") === FALSE) { $champ = "t.{$champ}"; } $requete['SELECT'][] = $champ; $a[] = $champ . ' ' . $methode . ' ' . $q; } } if ($a) { $requete['WHERE'][] = join(" OR ", $a); } $requete['FROM'][] = table_objet_sql($table) . ' AS t'; $results = array(); $s = sql_select($requete['SELECT'], $requete['FROM'], $requete['WHERE'], implode(" ", $requete['GROUPBY']), $requete['ORDERBY'], $requete['LIMIT'], $requete['HAVING'], $serveur); while ($t = sql_fetch($s, $serveur) and (!isset($t['score']) or $t['score'] > 0)) { $id = intval($t[$_id_table]); if ($options['toutvoir'] or autoriser('voir', $table, $id)) { // indiquer les champs concernes $champs_vus = array(); $score = 0; $matches = array(); $vu = false; foreach ($champs as $champ => $poids) { $champ = explode('.', $champ); $champ = end($champ); // translitteration_rapide uniquement si on est deja en utf-8 $value = $GLOBALS['meta']['charset'] == 'utf-8' ? translitteration_rapide($t[$champ]) : translitteration($t[$champ]); if ($n = $options['score'] || $options['matches'] ? preg_match_all($preg, $value, $regs, PREG_SET_ORDER) : preg_match($preg, $value)) { $vu = true; if ($options['champs']) { $champs_vus[$champ] = $t[$champ]; } if ($options['score']) { $score += $n * $poids; } if ($options['matches']) { $matches[$champ] = $regs; } if (!$options['champs'] and !$options['score'] and !$options['matches']) { break; } } } if ($vu) { if (!isset($results)) { $results = array(); } $results[$id] = array(); if ($champs_vus) { $results[$id]['champs'] = $champs_vus; } if ($score) { $results[$id]['score'] = $score; } if ($matches) { $results[$id]['matches'] = $matches; } } } } // Gerer les donnees associees // ici on est un peu naze : pas capables de reconstruire une jointure complexe // on ne sait passer que par table de laison en 1 coup if (isset($jointures[$table]) and $joints = recherche_en_base($recherche, $jointures[$table], array_merge($options, array('jointures' => false)))) { include_spip('action/editer_liens'); $trouver_table = charger_fonction('trouver_table', 'base'); $cle_depart = id_table_objet($table); $table_depart = table_objet($table, $serveur); $desc_depart = $trouver_table($table_depart, $serveur); $depart_associable = objet_associable($table); foreach ($joints as $table_liee => $ids_trouves) { // on peut definir une fonction de recherche jointe pour regler les cas particuliers if (!($rechercher_joints = charger_fonction("rechercher_joints_{$table}_{$table_liee}", "inc", true) or $rechercher_joints = charger_fonction("rechercher_joints_objet_{$table_liee}", "inc", true) or $rechercher_joints = charger_fonction("rechercher_joints_{$table}_objet_lie", "inc", true))) { $cle_arrivee = id_table_objet($table_liee); $table_arrivee = table_objet($table_liee, $serveur); $desc_arrivee = $trouver_table($table_arrivee, $serveur); // cas simple : $cle_depart dans la table_liee if (isset($desc_arrivee['field'][$cle_depart])) { $s = sql_select("{$cle_depart}, {$cle_arrivee}", $desc_arrivee['table_sql'], sql_in($cle_arrivee, array_keys($ids_trouves)), '', '', '', '', $serveur); } elseif (isset($desc_depart['field'][$cle_arrivee])) { $s = sql_select("{$cle_depart}, {$cle_arrivee}", $desc_depart['table_sql'], sql_in($cle_arrivee, array_keys($ids_trouves)), '', '', '', '', $serveur); } elseif ($l = objet_associable($table_liee)) { list($primary, $table_liens) = $l; $s = sql_select("id_objet as {$cle_depart}, {$primary} as {$cle_arrivee}", $table_liens, array("objet='{$table}'", sql_in($primary, array_keys($ids_trouves))), '', '', '', '', $serveur); } elseif ($l = $depart_associable) { list($primary, $table_liens) = $l; $s = sql_select("{$primary} as {$cle_depart}, id_objet as {$cle_arrivee}", $table_liens, array("objet='{$table_liee}'", sql_in('id_objet', array_keys($ids_trouves))), '', '', '', '', $serveur); } elseif ($t = $trouver_table($table_arrivee . "_" . $table_depart, $serveur) or $t = $trouver_table($table_depart . "_" . $table_arrivee, $serveur)) { $s = sql_select("{$cle_depart},{$cle_arrivee}", $t["table_sql"], sql_in($cle_arrivee, array_keys($ids_trouves)), '', '', '', '', $serveur); } } else { list($cle_depart, $cle_arrivee, $s) = $rechercher_joints($table, $table_liee, array_keys($ids_trouves), $serveur); } while ($t = is_array($s) ? array_shift($s) : sql_fetch($s)) { $id = $t[$cle_depart]; $joint = $ids_trouves[$t[$cle_arrivee]]; if (!isset($results)) { $results = array(); } if (!isset($results[$id])) { $results[$id] = array(); } if (isset($joint['score']) and $joint['score']) { if (!isset($results[$id]['score'])) { $results[$id]['score'] = 0; } $results[$id]['score'] += $joint['score']; } if (isset($joint['champs']) and $joint['champs']) { foreach ($joint['champs'] as $c => $val) { $results[$id]['champs'][$table_liee . '.' . $c] = $val; } } if (isset($joint['matches']) and $joint['matches']) { foreach ($joint['matches'] as $c => $val) { $results[$id]['matches'][$table_liee . '.' . $c] = $val; } } } } } return $results; }
function date_interface($date, $decalage_maxi = 43200) { return sinon(date_relative($date, $decalage_maxi), affdate_heure($date)); }
/** * Fabrique la liste a cocher des tables a traiter (copie, delete, sauvegarde) * * @param string $name * @param array $tables * @param array $exclude * @param array|null $post * @param string $serveur * @return array */ function base_saisie_tables($name, $tables, $exclude = array(), $post = null, $serveur = '') { include_spip('inc/filtres'); $res = array(); foreach ($tables as $k => $t) { // par defaut tout est coche sauf les tables dans $exclude if (is_null($post)) { $check = in_array($t, $exclude) ? false : true; } else { $check = in_array($t, $post); } $res[$k] = "<input type='checkbox' value='{$t}' name='{$name}" . "[]' id='{$name}{$k}'" . ($check ? " checked='checked'" : '') . "/>\n" . "<label for='{$name}{$k}'>" . $t . "</label>" . " (" . sinon(singulier_ou_pluriel(sql_countsel($t, '', '', '', $serveur), 'dump:une_donnee', 'dump:nb_donnees'), _T('dump:aucune_donnee')) . ")"; } return $res; }
/** * Affichage spécifique de la page de gestion des plugins * * Affiche la liste des plugins demandés et les erreurs éventuelles. * * @uses plugin_donne_erreurs() * @uses liste_chemin_plugin() * @uses plugin_installes_meta() * @uses affiche_les_plugins_verrouilles() * * @pipeline_appel affiche_gauche * @pipeline_appel affiche_droit * @pipeline_appel affiche_milieu * * @param string $quoi * Quels plugins afficher ? actifs, ou autre * @param string $erreur * Erreur éventuelle à afficher * @param string $format * Format d'affichage (liste ou arborescence) **/ function admin_plug_args($quoi, $erreur, $format) { if (!$quoi) { $quoi = 'actifs'; } // empecher l'affichage des erreurs dans le bandeau, on le donne ensuite // format brut par plugin $GLOBALS['erreurs_activation_raw'] = plugin_donne_erreurs(true, false); // format resume mis en forme $erreur_activation = plugin_donne_erreurs(); $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page(_T('icone_admin_plugin'), "configuration", "plugin"); echo debut_gauche('plugin', true); echo recuperer_fond('prive/squelettes/navigation/configurer', array('exec' => 'admin_plugin')); echo pipeline('affiche_gauche', array('args' => array('exec' => 'admin_plugin'), 'data' => afficher_librairies())); echo debut_droite('plugin', true); echo gros_titre(_T('icone_admin_plugin'), '', false); // Barre d'onglets de premier niveau echo barre_onglets("plugins", "plugins_actifs"); // Barre d'onglets de second niveau $onglet2 = $quoi == 'actifs' ? 'plugins_actifs' : 'admin_plugin'; echo debut_onglet('onglets_simple second'); echo onglet(_T('plugins_tous_liste'), generer_url_ecrire("admin_plugin", "voir=tous"), 'admin_plugin', $onglet2); echo onglet(_T('plugins_actifs_liste'), generer_url_ecrire("admin_plugin"), 'plugins_actifs', $onglet2); echo fin_onglet(); // message d'erreur au retour d'une operation if ($erreur) { echo "<div class='error'>{$erreur}</div>"; } if ($erreur_activation) { echo "<div class='error'>{$erreur_activation}</div>"; } // la mise a jour de cette meta a ete faite par ecrire_plugin_actifs $actifs = unserialize($GLOBALS['meta']['plugin']); $lcpa = $actifs + unserialize($GLOBALS['meta']['plugin_attente']); // Les affichages se basent sur le repertoire, pas sur le nom $actifs = liste_chemin_plugin($actifs, ''); if (defined('_DIR_PLUGINS_SUPPL')) { $lcpas = liste_chemin_plugin($lcpa, _DIR_PLUGINS_SUPPL); } $lcpa = liste_chemin_plugin($lcpa); // on installe les plugins maintenant, // cela permet aux scripts d'install de faire des affichages (moches...) plugin_installes_meta(); echo "<div class='liste-plugins formulaire_spip'>"; echo debut_cadre_trait_couleur('plugin-24.png', true, '', _T('plugins_liste'), 'plugins'); if ($quoi !== 'actifs') { $lpf = liste_plugin_files(); if ($lpf) { echo "<p>" . _T('texte_presente_plugin') . "</p>"; } else { if (!@is_dir(_DIR_PLUGINS)) { echo "<p>" . _T('plugin_info_automatique_ftp', array('rep' => joli_repertoire(_DIR_PLUGINS))) . " — " . _T('plugin_info_automatique_creer') . "</p>"; } } $lcpaffiche = $lpf; if (defined('_DIR_PLUGINS_SUPPL')) { $lcpaffichesup = liste_plugin_files(_DIR_PLUGINS_SUPPL); } } else { // la liste // $quoi=='actifs' $lcpaffiche = $lcpa; if (defined('_DIR_PLUGINS_SUPPL')) { $lcpaffichesup = $lcpas; } } if ($quoi == 'actifs' or $lpf) { $nb = count($lcpa); if (defined('_DIR_PLUGINS_SUPPL')) { $nb += count($lcpas); } echo "<h3>" . sinon(singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), _T('plugins_actif_aucun')) . "</h3>"; } if (empty($format)) { $format = 'liste'; } elseif (!in_array($format, array('liste', 'repertoires'))) { $format = 'repertoires'; } $afficher = charger_fonction("afficher_{$format}", 'plugins'); $corps = $afficher(self(), $lcpaffiche, $lcpa, $actifs); if (defined('_DIR_PLUGINS_SUPPL')) { $corps .= $afficher(self(), $lcpaffichesup, $lcpas, $actifs, _DIR_PLUGINS_SUPPL); } if ($corps) { $corps .= "\n<div class='boutons' style='display:none;'>" . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') . "' />" . "</div>"; } echo redirige_action_post('activer_plugins', 'activer', 'admin_plugin', '', $corps); echo fin_cadre_trait_couleur(true); if ($quoi == 'actifs') { echo affiche_les_plugins_verrouilles($actifs); } echo "</div>"; echo http_script("\n\tjQuery(function(){\n\t\tjQuery('.plugins li.item a[rel=info]').click(function(){\n\t\t\tvar li = jQuery(this).parents('li').eq(0);\n\t\t\tvar prefix = li.find('input.checkbox').attr('name');\n\t\t\tif (!jQuery('div.details',li).html()) {\n\t\t\t\tjQuery('div.details',li).prepend(ajax_image_searching).load(\n\t\t\t\t\tjQuery(this).attr('href').replace(/admin_plugin|plugins/, 'info_plugin'), function(){\n\t\t\t\t\t\tli.addClass('on');\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (jQuery('div.details',li).toggle().is(':visible'))\n\t\t\t\t\tli.addClass('on');\n\t\t\t\telse\n\t\t\t\t\tli.removeClass('on');\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t\tjQuery('.plugins li.item input.checkbox').change(function(){\n\t\t\tjQuery(this).parents('form').eq(0).find('.boutons').slideDown();\n\t\t});\n\t});\n\t"); echo pipeline('affiche_milieu', array('args' => array('exec' => 'admin_plugin'), 'data' => '')); echo fin_gauche(), fin_page(); }
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; }
/** * Génère le cache de la liste des rubriques pour la navigation du bandeau * * Le cache, qui comprend pour chaque rubrique ses rubriques enfants et leur titre, est : * * - réactualisé en fonction de la meta `date_calcul_rubriques` * - mis en cache dans le fichier défini par la constante `_CACHE_RUBRIQUES` * - stocké également dans la globale `db_art_cache` * * @return bool true. **/ function gen_liste_rubriques() { include_spip('inc/config'); // ici, un petit fichier cache ne fait pas de mal $last = lire_config('date_calcul_rubriques', 0); if (lire_fichier(_CACHE_RUBRIQUES, $cache)) { list($date, $GLOBALS['db_art_cache']) = @unserialize($cache); if ($date == $last) { return false; } // c'etait en cache :-) } // se restreindre aux rubriques utilisees recemment +secteurs $where = sql_in_select("id_rubrique", "id_rubrique", "spip_rubriques", "", "", "id_parent=0 DESC, date DESC", _CACHE_RUBRIQUES_MAX); // puis refaire la requete pour avoir l'ordre alphabetique $res = sql_select("id_rubrique, titre, id_parent", "spip_rubriques", $where, '', 'id_parent, 0+titre, titre'); // il ne faut pas filtrer le autoriser voir ici // car on met le resultat en cache, commun a tout le monde $GLOBALS['db_art_cache'] = array(); while ($r = sql_fetch($res)) { $t = sinon($r['titre'], _T('ecrire:info_sans_titre')); $GLOBALS['db_art_cache'][$r['id_parent']][$r['id_rubrique']] = supprimer_numero(typo($t)); } $t = array($last ? $last : time(), $GLOBALS['db_art_cache']); ecrire_fichier(_CACHE_RUBRIQUES, serialize($t)); return true; }
function traiter_modeles($texte, $doublons=false, $echap='', $connect='', $liens = null) { // preserver la compatibilite : true = recherche des documents if ($doublons===true) $doublons = array('documents'=>array('doc','emb','img')); // detecter les modeles (rapide) if (strpos($texte,"<")!==false AND preg_match_all('/<[a-z_-]{3,}\s*[0-9|]+/iS', $texte, $matches, PREG_SET_ORDER)) { include_spip('public/assembler'); foreach ($matches as $match) { // Recuperer l'appel complet (y compris un eventuel lien) $a = strpos($texte,$match[0]); preg_match(_RACCOURCI_MODELE_DEBUT, substr($texte, $a), $regs); $regs[]=""; // s'assurer qu'il y a toujours un 5e arg, eventuellement vide list(,$mod, $type, $id, $params, $fin) = $regs; if ($fin AND preg_match('/<a\s[^<>]*>\s*$/i', substr($texte, 0, $a), $r)) { $lien = array( 'href' => extraire_attribut($r[0],'href'), 'class' => extraire_attribut($r[0],'class'), 'mime' => extraire_attribut($r[0],'type') ); $n = strlen($r[0]); $a -= $n; $cherche = $n + strlen($regs[0]); } else { $lien = false; $cherche = strlen($mod); } // calculer le modele # hack articles_edit, breves_edit, indexation if ($doublons) $texte .= preg_replace(',[|][^|=]*,s',' ',$params); # version normale else { // si un tableau de liens a ete passe, reinjecter le contenu d'origine // dans les parametres, plutot que les liens echappes if (!is_null($liens)) $params = str_replace($liens[0], $liens[1], $params); $modele = inclure_modele($type, $id, $params, $lien, $connect); // en cas d'echec, // si l'objet demande a une url, // creer un petit encadre vers elle if ($modele === false) { if (!$lien) $lien = traiter_lien_implicite("$type$id", '', 'tout', $connect); if ($lien) $modele = '<a href="' .$lien['url'] .'" class="spip_modele' . '">' .sinon($lien['titre'], _T('ecrire:info_sans_titre')) ."</a>"; else { $modele = ""; if (test_espace_prive()) { $modele = entites_html(substr($texte,$a,$cherche)); if (!is_null($liens)) $modele = "<pre>".str_replace($liens[0], $liens[1], $modele)."</pre>"; } } } // le remplacer dans le texte if ($modele !== false) { $modele = protege_js_modeles($modele); $rempl = code_echappement($modele, $echap); $texte = substr($texte, 0, $a) . $rempl . substr($texte, $a+$cherche); } } // hack pour tout l'espace prive if (((!_DIR_RESTREINT) OR ($doublons)) AND ($id)){ foreach($doublons?$doublons:array('documents'=>array('doc','emb','img')) as $quoi=>$modeles) if (in_array($type,$modeles)) $GLOBALS["doublons_{$quoi}_inclus"][] = $id; } } } return $texte; }