Ejemplo n.º 1
0
function menu_lang_pour_tous($nom, $default) {
	include_spip('inc/lang');

	if ($GLOBALS['spip_lang'] <> $default) {
		$opt = lang_select($default);	# et remplace
		if ($GLOBALS['spip_lang'] <> $default) {
			$default = '';	# annule tout choix par defaut
			if ($opt) lang_select();
		}
	}

	$opt = liste_options_langues($nom, $default);
	if (!$opt)
		return '';

	# lien a partir de /
	$cible = parametre_url(self(), 'lang' , '', '&');
	$post = generer_url_action('converser', 'redirect='. rawurlencode($cible), '&');

	return array('formulaires/menu_lang',
		3600,
		array('nom' => $nom,
			'url' => $post,
			'langues' => $opt
		)
	);
}
function lister_traductions($id_trad, $objet)
{
    $table_objet_sql = table_objet_sql($objet);
    $primary = id_table_objet($objet);
    $rows = sql_allfetsel("{$primary} as id,lang", $table_objet_sql, 'id_trad=' . intval($id_trad));
    lang_select();
    return $rows;
}
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&amp;redirect=' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '%2F' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '&amp;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 BOUCLE_art_agendahtml_78503d8cb0bd66f2d97f4b9c0f7d329a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    if (!isset($command['table'])) {
        $command['table'] = 'articles';
        $command['id'] = '_art_agenda';
        $command['from'] = array('articles' => 'spip_articles', 'L1' => 'spip_mots_liens', 'L2' => 'spip_mots');
        $command['type'] = array();
        $command['groupby'] = array("articles.id_article");
        $command['select'] = array("articles.date_redac", "articles.id_article", "articles.texte", "articles.descriptif", "articles.chapo", "articles.titre", "articles.lang");
        $command['orderby'] = array('articles.date_redac');
        $command['join'] = array('L1' => array('articles', 'id_objet', 'id_article', 'L1.objet=' . sql_quote('article')), 'L2' => array('L1', 'id_mot'));
        $command['limit'] = '0,5';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), array('=', 'L2.titre', "'Agenda'"), array('<', 'TIMESTAMPDIFF(HOUR,articles.date_redac,NOW())/24', "1"), array('=', 'articles.lang', sql_quote($GLOBALS['spip_lang'], '', 'varchar(10) NOT NULL DEFAULT \'\'')));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-menu-agenda.html', 'html_78503d8cb0bd66f2d97f4b9c0f7d329a', '_art_agenda', 4, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= '
				<li>' . (($t1 = strval(affdate(normaliser_date($Pile[$SP]['date_redac'])))) !== '' ? '<span>' . $t1 . (' ' . (($t2 = strval(heures(normaliser_date($Pile[$SP]['date_redac'])) != '0' ? (($t3 = strval(heures(normaliser_date($Pile[$SP]['date_redac'])))) !== '' ? $t3 . ':' : '') . minutes(normaliser_date($Pile[$SP]['date_redac'])) : '')) !== '' ? '- ' . $t2 : '') . '</span>') : '') . '
					<a class="lien' . interdire_scripts(@$Pile[0]['exposer']) . ' article" href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '" ' . (($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>

				</li>
		';
            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_art_agenda @ squelettes/inc/inc-menu-agenda.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
Ejemplo n.º 5
0
/**
 * Ajout lors de l'insertion d'une traduction de rubrique
 * de la langue, qui peut ne pas être connue mais héritée
 * de la rubrique parente à la destination
 *
 * @param array $flux    Données du pipeline
 * @return array         Données du pipeline
**/
function tradrub_pre_insertion($flux) {
	// pour les rubriques
	if ($flux['args']['table'] == 'spip_rubriques') {
		// si on crée une traduction
		if ($id_rubrique_source = _request('lier_trad')) {
			$id_parent_trad = $flux['data']['id_parent'];

			$row = sql_fetsel("lang, id_secteur", "spip_rubriques", "id_rubrique=$id_parent_trad");
			$lang_rub = $row['lang'];


			$lang = "";
			$choisie = 'non';

			// La langue a la creation : si les liens de traduction sont autorises
			// dans les rubriques, on essaie avec la langue de l'auteur,
			// ou a defaut celle de la rubrique
			// Sinon c'est la langue de la rubrique qui est choisie + heritee
			if (in_array('spip_rubriques',explode(',',$GLOBALS['meta']['multi_objets']))) {
				lang_select($GLOBALS['visiteur_session']['lang']);
				if (in_array($GLOBALS['spip_lang'],
				explode(',', $GLOBALS['meta']['langues_multilingue']))) {
					$lang = $GLOBALS['spip_lang'];
					$choisie = 'oui';
				}
			}

			if (!$lang) {
				$choisie = 'non';
				$lang = $lang_rub ? $lang_rub : $GLOBALS['meta']['langue_site'];
			}

			$flux['data']['lang'] = $lang;
			$flux['data']['langue_choisie'] = $choisie;

			// ici on ignore changer_lang qui est poste en cas de trad,
			// car l'heuristique du choix de la langue est pris en charge ici
			// en fonction de la config du site et de la rubrique choisie
			set_request("changer_lang");
		}

	}

	return $flux;
}
function BOUCLE_langueshtml_9491858aea5af6033788aa1936ebca8d(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    if (!isset($command['table'])) {
        $command['table'] = 'rubriques';
        $command['id'] = '_langues';
        $command['from'] = array('rubriques' => 'spip_rubriques');
        $command['type'] = array();
        $command['groupby'] = array();
        $command['select'] = array("rubriques.lang", "rubriques.titre");
        $command['orderby'] = array('rubriques.lang');
        $command['join'] = array();
        $command['limit'] = '';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('rubriques.statut', '!', 'publie', ''), array('=', 'rubriques.id_parent', 0), array('NOT', array('=', 'rubriques.lang', sql_quote(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lang', null), true)), '', 'varchar(10) NOT NULL DEFAULT \'\''))));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-bas_menu-lang.html', 'html_9491858aea5af6033788aa1936ebca8d', '_langues', 18, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= ($t1 = strval(traduire_nom_langue(unique(spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']))))) !== '' ? '
		<span lang="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '" xml:lang="' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '">| 
		<a href="spip.php?action=converser&amp;var_lang=' . spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) . '&amp;redirect=/" rel="alternate"  title="' . _T('public|spip|ecrire:accueil_site') . ' : ' . traduire_nom_langue(spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang'])) . '" dir="' . lang_dir($Pile[$SP]['lang'], 'ltr', 'rtl') . '">' . $t1 . '</a>
		</span>
' : '';
            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_langues @ squelettes/inc/inc-bas_menu-lang.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
/**
 * Cherche l'existence un squelette par langue squelette.en.html
 *
 * Options de recherche de squelette par le styliseur, appelé par le pipeline 'styliser'
 *
 * @pipeline styliser
 *
 * @param array $flux Données du pipeline
 * @return array       Données du pipeline
 */
function squelettes_par_rubrique_styliser_par_langue($flux)
{
    // uniquement si un squelette a ete trouve
    if ($squelette = $flux['data']) {
        $ext = $flux['args']['ext'];
        // Affiner par lang
        if ($lang = $flux['args']['lang']) {
            $l = lang_select($lang);
            $f = "{$squelette}." . $GLOBALS['spip_lang'];
            if ($l) {
                lang_select();
            }
            if (@file_exists("{$f}.{$ext}")) {
                // sauver le squelette
                $flux['data'] = $f;
            }
        }
    }
    return $flux;
}
         echo '<input type="submit" name="junk" value="' . lang('Continue') . '">';
         echo '</form>';
         echo '</body></html>';
         break;
     } else {
         $GLOBALS['phpgw_setup']->html->show_header('Error generating header.inc.php', False, 'header');
         echo lang('Could not open header.inc.php for writing!') . '<br>' . "\n";
         echo lang('Please check read/write permissions on directories, or back up and use another option.') . '<br>';
         echo '</td></tr></table></body></html>';
     }
     break;
 default:
     $GLOBALS['phpgw_setup']->html->show_header($GLOBALS['phpgw_info']['setup']['HeaderFormMSG'], False, 'header');
     $detected = '';
     if (!get_var('ConfigLang', array('POST', 'COOKIE'))) {
         $detected .= '<br><form action="manageheader.php" method="Post">Please Select your language ' . lang_select(True, 'en') . "</form>\n";
     }
     $detected .= '<table border="0" width="100%" cellspacing="0" cellpadding="0">' . "\n";
     $detected .= '<tr><td colspan="2"><p>' . $GLOBALS['phpgw_info']['setup']['PageMSG'] . '<br />&nbsp;</p></td></tr>';
     $detected .= '<tr class="th"><td colspan="2">' . lang('Analysis') . '</td></tr><tr><td colspan="2">' . "\n";
     $supported_db = array();
     if (extension_loaded('mysql') || function_exists('mysql_connect')) {
         $detected .= lang('You appear to have MySQL support enabled') . '<br>' . "\n";
         $supported_db[] = 'mysql';
     } else {
         $detected .= lang('No MySQL support found. Disabling') . '<br>' . "\n";
     }
     if (extension_loaded('pgsql') || function_exists('pg_connect')) {
         $detected .= lang('You appear to have PostgreSQL support enabled') . '<br>' . "\n";
         $supported_db[] = 'pgsql';
     } else {
Ejemplo n.º 9
0
/**
 * Point d'entrée pour les erreurs de compilation
 *
 * Point d'entrée pour les appels involontaires ($message non vide => erreur)
 *  et volontaires (var_mode et var_profile)
 * 
 * Si pas d'autorisation, les erreurs ne sont pas affichées
 * (mais seront dans les logs)
 *
 * Si l'erreur vient de SPIP,  en parler sur `spip@rezo.net`
 * 
 * @param bool|string|array $message
 *     - Message d'erreur (string|array)
 *     - false pour retourner le texte des messages d'erreurs
 *     - vide pour afficher les messages d'erreurs
 * @param string|Contexte $lieu
 *     Contexte : lieu d'origine de l'erreur
 * @param array $opt
 *     Options pour debug ou tests unitaires
 *     - 'erreurs' = 'get' : Retourne le tableau des erreurs
 *     - 'erreurs' = 'reset' : Efface le tableau des erreurs
 * @return null|string
 *     - string si $message à false.
**/
function public_debusquer_dist($message = '', $lieu = '', $opt = array())
{
    global $visiteur_session;
    global $debug_objets;
    static $tableau_des_erreurs = array();
    // Pour des tests unitaires, pouvoir récupérer les erreurs générées
    if (isset($opt['erreurs'])) {
        if ($opt['erreurs'] == 'get') {
            return $tableau_des_erreurs;
        }
        if ($opt['erreurs'] == 'reset') {
            $tableau_des_erreurs = array();
            return true;
        }
    }
    // Erreur ou appel final ?
    if ($message) {
        $message = debusquer_compose_message($message);
        $tableau_des_erreurs[] = array($message, $lieu);
        set_request('var_mode', 'debug');
        $GLOBALS['bouton_admin_debug'] = true;
        // Permettre a la compil de continuer
        if (is_object($lieu) and (!isset($lieu->code) or !$lieu->code)) {
            $lieu->code = "''";
        }
        // forcer l'appel au debusqueur en cas de boucles infernales
        $urgence = (_DEBUG_MAX_SQUELETTE_ERREURS and count($tableau_des_erreurs) > _DEBUG_MAX_SQUELETTE_ERREURS);
        if (!$urgence) {
            return;
        }
    }
    if (empty($debug_objets['principal'])) {
        // espace public ?
        if (isset($GLOBALS['fond'])) {
            $debug_objets['principal'] = $GLOBALS['fond'];
        }
    }
    include_spip('inc/autoriser');
    if (!autoriser('debug')) {
        return;
    }
    include_spip('inc/headers');
    include_spip('inc/filtres');
    // en cas de squelette inclus,  virer le code de l'incluant:
    // - il contient souvent une Div restreignant la largeur a 3 fois rien
    // - ca fait 2 headers !
    // sauf si l'on se trouve deja dans un flux compresse (plugin compresseur
    // actif par exemple)
    if (ob_get_length() and !in_array('ob_gzhandler', ob_get_status())) {
        ob_end_clean();
    }
    lang_select($visiteur_session['lang']);
    $fonc = _request('var_mode_objet');
    $mode = _request('var_mode_affiche');
    $self = str_replace("\\'", '&#39;', self());
    $self = parametre_url($self, 'var_mode', 'debug');
    $res = debusquer_bandeau($tableau_des_erreurs) . '<br />' . debusquer_squelette($fonc, $mode, $self);
    if (!_DIR_RESTREINT or headers_sent()) {
        return $res;
    }
    if ($tableau_des_erreurs) {
        http_status(503);
    }
    http_no_cache();
    if (isset($_GET['var_profile'])) {
        $titre = parametre_url($GLOBALS['REQUEST_URI'], 'var_profile', '');
        $titre = parametre_url($titre, 'var_mode', '');
    } else {
        if (!$fonc) {
            $fonc = $debug_objets['principal'];
        }
        $titre = !$mode ? $fonc : $mode . (isset($debug_objets['sourcefile'][$fonc]) ? " " . $debug_objets['sourcefile'][$fonc] : "");
    }
    if ($message === false) {
        lang_select();
        return debusquer_entete($titre, $res);
    } else {
        echo debusquer_entete($titre, $res);
    }
    exit;
}
Ejemplo n.º 10
0
function action_crayons_store_args($store = 'crayons_store')
{
    header("Content-Type: text/plain; charset=" . $GLOBALS['meta']['charset']);
    lang_select($GLOBALS['auteur_session']['lang']);
    $r = $store();
    // Si on a ete appeles par jQuery, on renvoie tout, c'est le client
    // crayons.js qui va traiter l'affichage du resultat et status
    # Attention le test $_SERVER["HTTP_X_REQUESTED_WITH"] === "XMLHttpRequest"
    # n'est pas bon car le cas d'un fichier uploade via iframe n'est pas detecte
    // S'il y a une adresse de redirection, on renvoie vers elle
    // En cas d'erreur il faudrait ajouter &err=... dans l'url ?
    if (_request('redirect')) {
        if (!$r['$erreur'] or $r['$annuler']) {
            include_spip('inc/headers');
            redirige_par_entete(_request('redirect'));
        } else {
            echo "<h4 class='status'>" . $r['$erreur'] . "</h4>\n";
            foreach ($r as $wid => $v) {
                if ($wid !== '$erreur') {
                    echo "<div id='{$wid}'>{$v}</div><hr />\n";
                }
            }
            echo "<a href='" . quote_amp(_request('redirect')) . "'>" . quote_amp(_request('redirect')) . "</a>\n";
        }
    } else {
        echo crayons_json_export($r);
    }
    exit;
}
Ejemplo n.º 11
0
function public_parametrer_dist($fond, $contexte = '', $cache = '', $connect = '')
{
    static $composer, $styliser, $notes = null;
    $page = tester_redirection($fond, $contexte, $connect);
    if ($page) {
        return $page;
    }
    if (isset($contexte['lang'])) {
        $lang = $contexte['lang'];
    } elseif (!isset($lang)) {
        $lang = $GLOBALS['meta']['langue_site'];
    }
    $select = ((!isset($GLOBALS['forcer_lang']) or !$GLOBALS['forcer_lang']) and $lang != $GLOBALS['spip_lang']);
    if ($select) {
        $select = lang_select($lang);
    }
    $debug = defined('_VAR_MODE') && _VAR_MODE == 'debug';
    if (!$styliser) {
        $styliser = charger_fonction('styliser', 'public');
    }
    list($skel, $mime_type, $gram, $sourcefile) = $styliser($fond, $contexte, $GLOBALS['spip_lang'], $connect);
    if ($skel) {
        // sauver le nom de l'eventuel squelette en cours d'execution
        // (recursion possible a cause des modeles)
        if ($debug) {
            $courant = @$GLOBALS['debug_objets']['courant'];
            $GLOBALS['debug_objets']['contexte'][$sourcefile] = $contexte;
        }
        // charger le squelette en specifiant les langages cibles et source
        // au cas il faudrait le compiler (source posterieure au resultat)
        if (!$composer) {
            $composer = charger_fonction('composer', 'public');
        }
        $fonc = $composer($skel, $mime_type, $gram, $sourcefile, $connect);
    } else {
        $fonc = '';
    }
    if (!$fonc) {
        // squelette inconnu (==='') ou faux (===false)
        $page = $fonc;
    } else {
        // Preparer l'appel de la fonction principale du squelette
        spip_timer($a = 'calcul page ' . rand(0, 1000));
        // On cree un marqueur de notes unique lie a cette composition
        // et on enregistre l'etat courant des globales de notes...
        if (is_null($notes)) {
            $notes = charger_fonction('notes', 'inc', true);
        }
        if ($notes) {
            $notes('', 'empiler');
        }
        // Rajouter d'office ces deux parametres
        // (mais vaudrait mieux que le compilateur sache le simuler
        // car ca interdit l'usage de criteres conditionnels dessus).
        if (!isset($contexte['date'])) {
            $contexte['date'] = date("Y-m-d H:i:s");
            $contexte['date_default'] = true;
        } else {
            $contexte['date'] = normaliser_date($contexte['date'], true);
        }
        if (!isset($contexte['date_redac'])) {
            $contexte['date_redac'] = date("Y-m-d H:i:s");
            $contexte['date_redac_default'] = true;
        } else {
            $contexte['date_redac'] = normaliser_date($contexte['date_redac'], true);
        }
        // Passer le nom du cache pour produire sa destruction automatique
        $page = $fonc(array('cache' => $cache), array($contexte));
        // Restituer les globales de notes telles qu'elles etaient avant l'appel
        // Si l'inclus n'a pas affiche ses notes, tant pis (elles *doivent*
        // etre dans son resultat, autrement elles ne seraient pas prises en
        // compte a chaque calcul d'un texte contenant un modele, mais seulement
        // quand le modele serait calcule, et on aurait des resultats incoherents)
        if ($notes) {
            $notes('', 'depiler');
        }
        // reinjecter en dynamique la pile des notes
        // si il y a des inclure dynamiques
        // si la pile n'est pas vide
        // la generalisation de cette injection permettrait de corriger le point juste au dessus
        // en faisant remonter les notes a l'incluant (A tester et valider avant application)
        if ($notes) {
            $page['notes'] = $notes('', 'sauver_etat');
        }
        // spip_log: un joli contexte
        $infos = array();
        foreach (array_filter($contexte) as $var => $val) {
            if (is_array($val)) {
                $val = serialize($val);
            }
            if (strlen("{$val}") > 30) {
                $val = substr("{$val}", 0, 27) . '..';
            }
            if (strstr($val, ' ')) {
                $val = "'{$val}'";
            }
            $infos[] = $var . '=' . $val;
        }
        $profile = spip_timer($a);
        spip_log("calcul ({$profile}) [{$skel}] " . join(', ', $infos) . ' (' . strlen($page['texte']) . ' octets)');
        if (defined('_CALCUL_PROFILER') and intval($profile) > _CALCUL_PROFILER) {
            spip_log("calcul ({$profile}) [{$skel}] " . join(', ', $infos) . ' (' . strlen($page['texte']) . ' octets) | ' . $_SERVER['REQUEST_URI'], "profiler" . _LOG_AVERTISSEMENT);
        }
        if ($debug) {
            // si c'est ce que demande le debusqueur, lui passer la main
            $t = strlen($page['texte']) ? $page['texte'] : " ";
            $GLOBALS['debug_objets']['resultat'][$fonc . 'tout'] = $t;
            $GLOBALS['debug_objets']['courant'] = $courant;
            $GLOBALS['debug_objets']['profile'][$sourcefile] = $profile;
            if ($GLOBALS['debug_objets']['sourcefile'] and _request('var_mode_objet') == $fonc and _request('var_mode_affiche') == 'resultat') {
                erreur_squelette();
            }
        }
        // Si #CACHE{} n'etait pas la, le mettre a $delais
        if (!isset($page['entetes']['X-Spip-Cache'])) {
            // Dans l'espace prive ou dans un modeles/ on pose un cache 0 par defaut
            // si aucun #CACHE{} spécifié
            // le contexte implicite qui conditionne le cache assure qu'on retombe pas sur le meme
            // entre public et prive
            if (test_espace_prive() or strncmp($fond, 'modeles/', 8) == 0) {
                $page['entetes']['X-Spip-Cache'] = 0;
            } else {
                $page['entetes']['X-Spip-Cache'] = isset($GLOBALS['delais']) ? $GLOBALS['delais'] : 36000;
            }
        }
        $page['contexte'] = $contexte;
        // faire remonter le fichier source
        static $js_inclus = false;
        if (defined('_VAR_INCLURE') and _VAR_INCLURE) {
            $page['sourcefile'] = $sourcefile;
            $page['texte'] = "<div class='inclure_blocs'><h6>" . $page['sourcefile'] . "</h6>" . $page['texte'] . "</div>" . ($js_inclus ? "" : "<script type='text/javascript'>jQuery(function(){jQuery('.inclure_blocs > h6:first-child').hover(function(){jQuery(this).parent().addClass('hover')},function(){jQuery(this).parent().removeClass('hover')})});</script>");
            $js_inclus = true;
        }
        // Si un modele contenait #SESSION, on note l'info dans $page
        if (isset($GLOBALS['cache_utilise_session'])) {
            $page['invalideurs']['session'] = $GLOBALS['cache_utilise_session'];
            unset($GLOBALS['cache_utilise_session']);
        }
    }
    if ($select) {
        lang_select();
    }
    return $page;
}
function BOUCLE_breves_rubriqueshtml_11157eacea3e766769d2031f1e2eed04(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    if (!isset($command['table'])) {
        $command['table'] = 'breves';
        $command['id'] = '_breves_rubriques';
        $command['from'] = array('breves' => 'spip_breves');
        $command['type'] = array();
        $command['groupby'] = array();
        $command['select'] = array("breves.date_heure", "breves.date_heure AS date", "breves.id_breve", "breves.texte", "breves.titre", "breves.lang");
        $command['orderby'] = array('breves.date_heure DESC');
        $command['join'] = array();
        $command['limit'] = '0,10';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('breves.statut', 'publie,prop', 'publie', ''), array('=', 'breves.id_rubrique', sql_quote(@$Pile[0]['id_rubrique'], '', 'bigint(21) NOT NULL DEFAULT \'0\'')), array('=', 'breves.lang', sql_quote($GLOBALS['spip_lang'], '', 'varchar(10) NOT NULL DEFAULT \'\'')));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-breves.html', 'html_11157eacea3e766769d2031f1e2eed04', '_breves_rubriques', 2, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= '
          	<li>' . (($t1 = strval(interdire_scripts(affdate(normaliser_date($Pile[$SP]['date']))))) !== '' ? '<span>' . $t1 . '</span>' : '') . '
              <a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_breve'], 'breve', '', '', true))) . '" ' . (($t1 = strval(interdire_scripts(entites_html(textebrut(filtre_introduction_dist('', $Pile[$SP]['texte'], 300, $connect, null)))))) !== '' ? 'title="' . $t1 . '"' : '') . '>' . interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '</a>
          	</li>
            ';
            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_breves_rubriques @ squelettes/inc/inc-breves.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
function BOUCLE_article_headhtml_f7a72f7c15527e9fefe562fecb18cf87(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    if (!isset($command['table'])) {
        $command['table'] = 'articles';
        $command['id'] = '_article_head';
        $command['from'] = array('articles' => 'spip_articles', 'L1' => 'spip_mots_liens', 'L2' => 'spip_mots');
        $command['type'] = array();
        $command['groupby'] = array("articles.id_article");
        $command['select'] = array("articles.id_article", "articles.texte", "articles.descriptif", "articles.chapo", "articles.titre", "articles.lang", "articles.date");
        $command['orderby'] = array();
        $command['join'] = array('L1' => array('articles', 'id_objet', 'id_article', 'L1.objet=' . sql_quote('article')), 'L2' => array('L1', 'id_mot'));
        $command['limit'] = '';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), array('=', 'articles.id_article', sql_quote(@$Pile[0]['id_article'], '', 'bigint(21) NOT NULL AUTO_INCREMENT')), array('NOT', array('IN', 'articles.id_article', array('SELF', 'articles.id_article', array('REGEXP', 'L2.type', "'^_config'")))));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-meta.html', 'html_f7a72f7c15527e9fefe562fecb18cf87', '_article_head', 13, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= '
  <!-- META article -->
  ' . (($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)))))) !== '' ? '<meta name="Description" content="' . $t1 . '" />' : '') . '
' . (($t1 = BOUCLE_authorhtml_f7a72f7c15527e9fefe562fecb18cf87($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? '  <meta name="Author" content="' . $t1 . '" />' : '') . '
' . (($t1 = BOUCLE_keywords_articlehtml_f7a72f7c15527e9fefe562fecb18cf87($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? '  <meta name="Keywords" content="' . $t1 . '" />' : '') . '
  <!-- META Dublin Core - voir: http://uk.dublincore.org/documents/dcq-html/  -->
  ' . (($t1 = strval(interdire_scripts(entites_html(textebrut(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))))) !== '' ? '<meta name="DC.title" content="' . $t1 . '" />
  ' : '') . (($t1 = strval(spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']))) !== '' ? '<meta name="DC.language" scheme="ISO639-1" content="' . $t1 . '" />
  ' : '') . (($t1 = strval(spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')))) !== '' ? '<meta name="DC.identifier" scheme="DCTERMS.URI" content="' . $t1 . '/' : '') . (($t1 = strval(vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))))) !== '' ? $t1 . '" />
  ' : '') . (($t1 = strval(spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')))) !== '' ? '<meta name="DC.source" scheme="DCTERMS.URI" content="' . $t1 . '" />' : '') . BOUCLE_auteursDChtml_f7a72f7c15527e9fefe562fecb18cf87($Cache, $Pile, $doublons, $Numrows, $SP) . (($t1 = strval(interdire_scripts(attribut_html(entites_html(textebrut(filtre_introduction_dist($Pile[$SP]['descriptif'], strlen($Pile[$SP]['descriptif']) ? '' : $Pile[$SP]['chapo'] . "\n\n" . $Pile[$SP]['texte'], 500, $connect, null))))))) !== '' ? '
  <meta name="DC.description" content="' . $t1 . '" />' : '') . (($t1 = BOUCLE_subjectDChtml_f7a72f7c15527e9fefe562fecb18cf87($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? '
  <meta name="DC.subject" content="' . $t1 . '" />' : '') . (($t1 = strval(interdire_scripts(date_iso(normaliser_date($Pile[$SP]['date']))))) !== '' ? '
  <meta name="DC.date" scheme="ISO8601" content="' . $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_article_head @ squelettes/inc/inc-meta.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
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\'>&gt;</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;
}
Ejemplo n.º 15
0
/**
 * Insérer un nouvel article en base de données
 * 
 * En plus des données enregistrées par défaut, la fonction :
 * - retrouve un identifiant de rubrique pour stocker l'article (la
 *   première rubrique racine) si l'identifiant de rubrique transmis est
 *   nul.
 * - calcule la langue de l'article, soit
 *   - d'après la langue de la rubrique si les articles ne sont pas
 *     configurés comme pouvant être traduits,
 *   - d'après la langue de l'auteur en cours si les articles peuvent être traduits et
 *     si la langue de l'auteur est acceptée en tant que langue de traduction
 * - crée une liaison automatiquement entre l'auteur connecté et l'article
 *   créé, de sorte que la personne devient par défaut auteur de l'article
 *   qu'elle crée.
 *   
 * @pipeline_appel pre_insertion
 * @pipeline_appel post_insertion
 *
 * @global array $GLOBALS['meta']
 * @global array $GLOBALS['visiteur_session']
 * @global string $GLOBALS['spip_lang']
 * 
 * @param int $id_rubrique
 *     Identifiant de la rubrique parente
 * @return int
 *     Identifiant du nouvel article
 * 
 */
function article_inserer($id_rubrique)
{
    // Si id_rubrique vaut 0 ou n'est pas definie, creer l'article
    // dans la premiere rubrique racine
    if (!($id_rubrique = intval($id_rubrique))) {
        $row = sql_fetsel("id_rubrique, id_secteur, lang", "spip_rubriques", "id_parent=0", '', '0+titre,titre', "1");
        $id_rubrique = $row['id_rubrique'];
    } else {
        $row = sql_fetsel("lang, id_secteur", "spip_rubriques", "id_rubrique={$id_rubrique}");
    }
    // eviter $id_secteur = NULL (erreur sqlite) si la requete precedente echoue
    // cas de id_rubrique = -1 par exemple avec plugin "pages"
    $id_secteur = isset($row['id_secteur']) ? $row['id_secteur'] : 0;
    $lang_rub = $row['lang'];
    $lang = "";
    $choisie = 'non';
    // La langue a la creation : si les liens de traduction sont autorises
    // dans les rubriques, on essaie avec la langue de l'auteur,
    // ou a defaut celle de la rubrique
    // Sinon c'est la langue de la rubrique qui est choisie + heritee
    if (in_array('spip_articles', explode(',', $GLOBALS['meta']['multi_objets']))) {
        lang_select($GLOBALS['visiteur_session']['lang']);
        if (in_array($GLOBALS['spip_lang'], explode(',', $GLOBALS['meta']['langues_multilingue']))) {
            $lang = $GLOBALS['spip_lang'];
            $choisie = 'oui';
        }
    }
    if (!$lang) {
        $choisie = 'non';
        $lang = $lang_rub ? $lang_rub : $GLOBALS['meta']['langue_site'];
    }
    $champs = array('id_rubrique' => $id_rubrique, 'id_secteur' => $id_secteur, 'statut' => 'prepa', 'date' => date('Y-m-d H:i:s'), 'lang' => $lang, 'langue_choisie' => $choisie);
    // Envoyer aux plugins
    $champs = pipeline('pre_insertion', array('args' => array('table' => 'spip_articles'), 'data' => $champs));
    $id_article = sql_insertq("spip_articles", $champs);
    pipeline('post_insertion', array('args' => array('table' => 'spip_articles', 'id_objet' => $id_article), 'data' => $champs));
    // controler si le serveur n'a pas renvoye une erreur
    if ($id_article > 0 and $GLOBALS['visiteur_session']['id_auteur']) {
        include_spip('action/editer_auteur');
        auteur_associer($GLOBALS['visiteur_session']['id_auteur'], array('article' => $id_article));
    }
    return $id_article;
}
Ejemplo n.º 16
0
 $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']);
 // eval $page et affecte $res
 include _ROOT_RESTREINT . "public/evaluer_page.php";
 envoyer_entetes($page['entetes']);
 if ($res === false) {
     $msg = array('zbug_erreur_execution_page');
     erreur_squelette($msg);
 }
 //
 // Envoyer le resultat apres post-traitements
 //
 // (c'est ici qu'on fait var_recherche, validation, boutons d'admin,
 // cf. public/assembler.php)
 echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']);
 if ($lang) {
     lang_select();
 }
 // l'affichage de la page a pu lever des erreurs (inclusion manquante)
 // il faut tester a nouveau
 $debug = (_request('var_mode') == 'debug' or $tableau_des_temps) ? array(1) : array();
 // Appel au debusqueur en cas d'erreurs ou de demande de trace
 // at last
 if ($debug) {
     // en cas d'erreur, retester l'affichage
     if ($html and ($affiche_boutons_admin or $debug)) {
         $var_mode_affiche = _request('var_mode_affiche');
         $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = $var_mode_affiche == 'validation' ? $page['texte'] : "";
         echo erreur_squelette(false);
     }
 } else {
     if (isset($GLOBALS['meta']['date_prochain_postdate']) and $GLOBALS['meta']['date_prochain_postdate'] <= time()) {
function BOUCLE_art_agendahtml_7e58ec237019eff13c867a6e81765d14(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    if (!isset($command['table'])) {
        $command['table'] = 'articles';
        $command['id'] = '_art_agenda';
        $command['from'] = array('articles' => 'spip_articles', 'L1' => 'spip_mots_liens', 'L2' => 'spip_mots');
        $command['type'] = array();
        $command['groupby'] = array("articles.id_article");
        $command['select'] = array("articles.lang", "articles.titre");
        $command['orderby'] = array();
        $command['join'] = array('L1' => array('articles', 'id_objet', 'id_article', 'L1.objet=' . sql_quote('article')), 'L2' => array('L1', 'id_mot'));
        $command['limit'] = '0,1';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), array('=', 'L2.titre', "'Agenda'"), array('=', 'articles.lang', sql_quote($GLOBALS['spip_lang'], '', 'varchar(10) NOT NULL DEFAULT \'\'')));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-menu-principal.html', 'html_7e58ec237019eff13c867a6e81765d14', '_art_agenda', 14, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= '
			<li id="menu-principal-agenda"><a class="lien" href="' . interdire_scripts(generer_url_public('agenda', '')) . '" title="' . _T('public|spip|ecrire:icone_agenda') . '"  accesskey="2">' . _T('public|spip|ecrire:icone_agenda') . '</a></li>
			';
            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_art_agenda @ squelettes/inc/inc-menu-principal.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
Ejemplo n.º 18
0
/**
 * Régler les boutons dans la langue de l'admin (sinon tant pis)
 *
 * @return string
 *     Code de langue
 **/
function admin_lang()
{
    $alang = sql_getfetsel('lang', 'spip_auteurs', "login=" . sql_quote(preg_replace(',^@,', '', @$_COOKIE['spip_admin'])));
    if (!$alang) {
        return '';
    }
    $l = lang_select($alang);
    $alang = $GLOBALS['spip_lang'];
    if ($l) {
        lang_select();
    }
    return $alang;
}
Ejemplo n.º 19
0
 function login_form()
 {
     /* begin use TEMPLATE login_main.tpl */
     $GLOBALS['setup_tpl']->set_var('ConfigLoginMSG', @$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] ? $GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] : '&nbsp;');
     $GLOBALS['setup_tpl']->set_var('HeaderLoginMSG', @$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] ? $GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] : '&nbsp;');
     if ($GLOBALS['phpgw_info']['setup']['stage']['header'] == '10') {
         /*
          Begin use SUB-TEMPLATE login_stage_header,
          fills V_login_stage_header used inside of login_main.tpl
         */
         $GLOBALS['setup_tpl']->set_var('lang_select', lang_select());
         if (count($GLOBALS['phpgw_domain']) > 1) {
             foreach ($GLOBALS['phpgw_domain'] as $domain => $data) {
                 $domains .= "<option value=\"{$domain}\" ";
                 if ($domain == @$GLOBALS['phpgw_info']['setup']['LastDomain']) {
                     $domains .= ' SELECTED';
                 } elseif ($domain == $_SERVER['SERVER_NAME']) {
                     $domains .= ' SELECTED';
                 }
                 $domains .= ">{$domain}</option>\n";
             }
             $GLOBALS['setup_tpl']->set_var('domains', $domains);
             // use BLOCK B_multi_domain inside of login_stage_header
             $GLOBALS['setup_tpl']->parse('V_multi_domain', 'B_multi_domain');
             // in this case, the single domain block needs to be nothing
             $GLOBALS['setup_tpl']->set_var('V_single_domain', '');
         } else {
             reset($GLOBALS['phpgw_domain']);
             $default_domain = each($GLOBALS['phpgw_domain']);
             $GLOBALS['setup_tpl']->set_var('default_domain_zero', $default_domain[0]);
             /* Use BLOCK B_single_domain inside of login_stage_header */
             $GLOBALS['setup_tpl']->parse('V_single_domain', 'B_single_domain');
             /* in this case, the multi domain block needs to be nothing */
             $GLOBALS['setup_tpl']->set_var('V_multi_domain', '');
         }
         /*
          End use SUB-TEMPLATE login_stage_header
          put all this into V_login_stage_header for use inside login_main
         */
         $GLOBALS['setup_tpl']->parse('V_login_stage_header', 'T_login_stage_header');
     } else {
         /* begin SKIP SUB-TEMPLATE login_stage_header */
         $GLOBALS['setup_tpl']->set_var('V_multi_domain', '');
         $GLOBALS['setup_tpl']->set_var('V_single_domain', '');
         $GLOBALS['setup_tpl']->set_var('V_login_stage_header', '');
     }
     /*
      end use TEMPLATE login_main.tpl
      now out the login_main template
     */
     $GLOBALS['setup_tpl']->pparse('out', 'T_login_main');
 }
Ejemplo n.º 20
0
function signature_langue($id_article, $url_page)
{
	$row = sql_fetsel('titre,lang', 'spip_articles', "id_article=$id_article");
	$lang = lang_select($row['lang']);
	$titre = textebrut(typo($row['titre']));

	if ($lang) lang_select();
	if ($lang != $GLOBALS['meta']['langue_site'])
		  $url_page = parametre_url($url_page, "lang", $lang,'&');

	return array($titre, $url_page);
}
Ejemplo n.º 21
0
function signature_a_confirmer($id_article, $url_page, $nom, $mail, $site, $url, $msg, $lang, &$statut)
{
    include_spip('inc/texte');
    include_spip('inc/filtres');
    // Si on est deja connecte et que notre mail a ete valide d'une maniere
    // ou d'une autre, on entre directement la signature dans la base, sans
    // envoyer d'email. Sinon email de verification
    if (isset($GLOBALS['visiteur_session']['statut']) and $GLOBALS['visiteur_session']['session_email'] == $GLOBALS['visiteur_session']['email'] and strlen($GLOBALS['visiteur_session']['email']) or isset($GLOBALS['visiteur_session']['email_confirme']) and $GLOBALS['visiteur_session']['session_email'] == $GLOBALS['visiteur_session']['email_confirme'] and strlen($GLOBALS['visiteur_session']['session_email'])) {
        // Si on est en ajax on demande a reposter sans ajax, car il faut
        // recharger toute la page pour afficher la signature
        refuser_traiter_formulaire_ajax();
        $statut = 'publie';
        // invalider le cache !
        include_spip('inc/invalideur');
        suivre_invalideur("id='article/{$id_article}'");
        // message de reussite
        return _T('petitions:form_pet_signature_validee');
    }
    //
    // Cas normal : envoi d'une demande de confirmation
    //
    $row = sql_fetsel('titre,lang', 'spip_articles', "id_article=" . intval($id_article));
    $lang = lang_select($row['lang']);
    $titre = textebrut(typo($row['titre']));
    if ($lang) {
        lang_select();
    }
    if (!strlen($statut)) {
        $statut = signature_test_pass();
    }
    if ($lang != $GLOBALS['meta']['langue_site']) {
        $url_page = parametre_url($url_page, "lang", $lang, '&');
    }
    $url_page = parametre_url($url_page, 'var_confirm', $statut, '&') . "#sp{$id_article}";
    $r = _T('petitions:form_pet_mail_confirmation', array('titre' => $titre, 'nom_email' => $nom, 'nom_site' => $site, 'url_site' => $url, 'url' => $url_page, 'message' => $msg));
    $titre = _T('petitions:form_pet_confirmation') . " " . $titre;
    $envoyer_mail = charger_fonction('envoyer_mail', 'inc');
    if ($envoyer_mail($mail, $titre, $r)) {
        return _T('petitions:form_pet_envoi_mail_confirmation', array('email' => $mail));
    }
    return false;
    # erreur d'envoi de l'email
}
function BOUCLE_articleshtml_a80389532d86f8e6929960268237a0a8(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    $doublons_index = array();
    // Initialise le(s) critère(s) doublons
    if (!isset($doublons[$d = 'articles'])) {
        $doublons[$d] = '';
    }
    if (!isset($command['table'])) {
        $command['table'] = 'articles';
        $command['id'] = '_articles';
        $command['from'] = array('articles' => 'spip_articles');
        $command['type'] = array();
        $command['groupby'] = array();
        $command['select'] = array("articles.date", "articles.lang", "articles.id_article", "articles.texte", "articles.descriptif", "articles.chapo", "articles.titre");
        $command['orderby'] = array('articles.date DESC');
        $command['join'] = array();
        $command['limit'] = '0,3';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), array(sql_in('articles.id_article', $doublons[$doublons_index[] = 'articles'], 'NOT')));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-trad.html', 'html_a80389532d86f8e6929960268237a0a8', '_articles', 6, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            foreach ($doublons_index as $k) {
                $doublons[$k] .= "," . $Pile[$SP]['id_article'];
            }
            // doublons
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= '
          	<li>' . (($t1 = strval(interdire_scripts(affdate(normaliser_date($Pile[$SP]['date']))))) !== '' ? '<span>' . $t1 . ((($t2 = strval(traduire_nom_langue(spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang'])))) !== '' ? ' - <dfn class="lang">' . $t2 . '</dfn>' : '') . '</span>') : '') . ' 
          	    
              <a href="' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '/spip.php?action=converser&amp;redirect=' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '%2F' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '&amp;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>
          	</li>
            ';
            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/inc/inc-trad.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
Ejemplo n.º 23
0
function lang_select_public($lang, $lang_select, $titre = null)
{
    // Cas 1. forcer_lang = true et pas de critere {lang_select}
    if (isset($GLOBALS['forcer_lang']) and $GLOBALS['forcer_lang'] and $lang_select !== 'oui') {
        $lang = $GLOBALS['spip_lang'];
    } elseif (!strlen($lang)) {
        $lang = $GLOBALS['spip_lang'];
    } elseif ($lang_select !== 'oui' and strlen($titre) > 10 and strpos($titre, '<multi>') !== false and strpos(echappe_html($titre), '<multi>') !== false) {
        $lang = $GLOBALS['spip_lang'];
    }
    // faire un lang_select() eventuellement sur la langue inchangee
    lang_select($lang);
    return;
}
Ejemplo n.º 24
0
/**
 * Inserer en base un objet generique
 * @param string $objet
 * @param int $id_parent
 * @param array|null $set
 * @return bool|int
 */
function objet_inserer($objet, $id_parent = null, $set = null)
{
    if (include_spip('action/editer_' . $objet) and function_exists($inserer = $objet . "_inserer")) {
        return $inserer($id_parent);
    }
    $table_sql = table_objet_sql($objet);
    $trouver_table = charger_fonction('trouver_table', 'base');
    $desc = $trouver_table($table_sql);
    if (!$desc or !isset($desc['field'])) {
        return 0;
    }
    $lang_rub = "";
    $champs = array();
    if (isset($desc['field']['id_rubrique'])) {
        // Si id_rubrique vaut 0 ou n'est pas definie, creer l'objet
        // dans la premiere rubrique racine
        if (!($id_rubrique = intval($id_parent))) {
            $row = sql_fetsel("id_rubrique, id_secteur, lang", "spip_rubriques", "id_parent=0", '', '0+titre,titre', "1");
            $id_rubrique = $row['id_rubrique'];
        } else {
            $row = sql_fetsel("lang, id_secteur", "spip_rubriques", "id_rubrique=" . intval($id_rubrique));
        }
        $champs['id_rubrique'] = $id_rubrique;
        if (isset($desc['field']['id_secteur'])) {
            $champs['id_secteur'] = $row['id_secteur'];
        }
        $lang_rub = $row['lang'];
    }
    // La langue a la creation : si les liens de traduction sont autorises
    // dans les rubriques, on essaie avec la langue de l'auteur,
    // ou a defaut celle de la rubrique
    // Sinon c'est la langue de la rubrique qui est choisie + heritee
    if (isset($desc['field']['lang']) and $GLOBALS['meta']['multi_objets'] and in_array($table_sql, explode(',', $GLOBALS['meta']['multi_objets']))) {
        lang_select($GLOBALS['visiteur_session']['lang']);
        if (in_array($GLOBALS['spip_lang'], explode(',', $GLOBALS['meta']['langues_multilingue']))) {
            $champs['lang'] = $GLOBALS['spip_lang'];
            if (isset($desc['field']['langue_choisie'])) {
                $champs['langue_choisie'] = 'oui';
            }
        }
    } elseif (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) {
        $champs['lang'] = $lang_rub ? $lang_rub : $GLOBALS['meta']['langue_site'];
        $champs['langue_choisie'] = 'non';
    }
    if (isset($desc['field']['statut'])) {
        if (isset($desc['statut_textes_instituer'])) {
            $cles_statut = array_keys($desc['statut_textes_instituer']);
            $champs['statut'] = reset($cles_statut);
        } else {
            $champs['statut'] = 'prepa';
        }
    }
    if (isset($desc['date']) and $d = $desc['date'] or isset($desc['field'][$d = 'date'])) {
        $champs[$d] = date('Y-m-d H:i:s');
    }
    if ($set) {
        $champs = array_merge($champs, $set);
    }
    // Envoyer aux plugins
    $champs = pipeline('pre_insertion', array('args' => array('table' => $table_sql), 'data' => $champs));
    $id = sql_insertq($table_sql, $champs);
    if ($id) {
        pipeline('post_insertion', array('args' => array('table' => $table_sql, 'id_objet' => $id), 'data' => $champs));
        // controler si le serveur n'a pas renvoye une erreur
        // et associer l'auteur sinon
        // si la table n'a pas deja un champ id_auteur
        // et si le form n'a pas poste un id_auteur (meme vide, ce qui sert a annuler cette auto association)
        if ($id > 0 and !isset($desc['field']['id_auteur'])) {
            $id_auteur = (is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ? $GLOBALS['visiteur_session']['id_auteur'] : _request('id_auteur');
            if ($id_auteur) {
                include_spip('action/editer_auteur');
                auteur_associer($id_auteur, array($objet => $id));
            }
        }
    }
    return $id;
}
/**
 * Ajoute les scripts css et js nécessaires aux crayons dans le code HTML
 *
 * @uses crayons_var2js()
 *
 * @param string $page
 *     Code HTML de la page complète ou du header seulement
 * @param string $droits
 *     - Liste de css définissant les champs crayonnables
 *       (séparés par virgule) dont l'édition est autorisée
 *     - "*" si tous sont autorisés
 * @param array $wdgcfg
 *     Description de la configuration des crayons (attribut => valeur)
 * @param string $mode
 *     - page : toute la page est présente dans `$page`
 *     - head : seul le header est présent dans `$page`
 * @return
**/
function &Crayons_preparer_page(&$page, $droits, $wdgcfg = array(), $mode = 'page')
{
    /**
     * Si pas forcer_lang, on charge le contrôleur dans la langue que l'utilisateur a dans le privé
     */
    if (!isset($GLOBALS['forcer_lang']) or !$GLOBALS['forcer_lang'] or $GLOBALS['forcer_lang'] === 'non') {
        lang_select($GLOBALS['auteur_session']['lang']);
    }
    $jsFile = generer_url_public('crayons.js');
    if (_DEBUG_CRAYONS) {
        $jsFile = parametre_url($jsFile, 'debug_crayons', 1, '&');
    }
    include_spip('inc/filtres');
    // rien que pour direction_css() :(
    $cssFile = direction_css(find_in_path('crayons.css'));
    $config = crayons_var2js(array('imgPath' => dirname(find_in_path('images/crayon.png')), 'droits' => $droits, 'dir_racine' => _DIR_RACINE, 'self' => self('&'), 'txt' => array('error' => _U('crayons:svp_copier_coller'), 'sauvegarder' => $wdgcfg['msgAbandon'] ? _U('crayons:sauvegarder') : ''), 'img' => array('searching' => array('txt' => _U('crayons:veuillez_patienter')), 'crayon' => array('txt' => _U('crayons:editer')), 'edit' => array('txt' => _U('crayons:editer_tout')), 'img-changed' => array('txt' => _U('crayons:deja_modifie'))), 'cfg' => $wdgcfg));
    // Est-ce que PortePlume est la ?
    $meta_crayon = isset($GLOBALS['meta']['crayons']) ? unserialize($GLOBALS['meta']['crayons']) : array();
    $pp = '';
    if (isset($meta_crayon['barretypo']) && $meta_crayon['barretypo']) {
        if (function_exists('chercher_filtre') and $f = chercher_filtre('info_plugin') and $f('PORTE_PLUME', 'est_actif')) {
            $pp = <<<EOF
cQuery(function() {
\tif (typeof onAjaxLoad == 'function') {
\t\tfunction barrebouilles_crayons() {
\t\t\t\$('.formulaire_crayon textarea.crayon-active')
\t\t\t.barre_outils('edition');
\t\t}
\t\tonAjaxLoad(barrebouilles_crayons);
\t}
});
EOF;
        }
    }
    $incCSS = "<link rel=\"stylesheet\" href=\"{$cssFile}\" type=\"text/css\" media=\"all\" />";
    $incJS = <<<EOH
<script type="text/javascript">/* <![CDATA[ */
var configCrayons;
function startCrayons() {
\tconfigCrayons = new cQuery.prototype.cfgCrayons({$config});
\tcQuery.fn.crayonsstart();
{$pp}
}
var cr = document.createElement('script');
cr.type = 'text/javascript'; cr.async = true;
cr.src = '{$jsFile}&callback=startCrayons';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(cr, s);
/* ]]> */</script>

EOH;
    if ($mode == 'head') {
        //js inline avant les css, sinon ca bloque le chargement
        $page = $page . $incJS . $incCSS;
        return $page;
    }
    $pos_head = strpos($page, '</head>');
    if ($pos_head === false) {
        return $page;
    }
    // js inline avant la premiere css, ou sinon avant la fin du head
    $pos_link = strpos($page, '<link ');
    if (!$pos_link) {
        $pos_link = $pos_head;
    }
    $page = substr_replace($page, $incJS, $pos_link, 0);
    // css avant la fin du head
    $pos_head = strpos($page, '</head>');
    $page = substr_replace($page, $incCSS, $pos_head, 0);
    return $page;
}
function BOUCLE_syndic_rubhtml_2ac554317f8f8f8aa21871c007ab234d(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    if (!isset($command['table'])) {
        $command['table'] = 'rubriques';
        $command['id'] = '_syndic_rub';
        $command['from'] = array('rubriques' => 'spip_rubriques');
        $command['type'] = array();
        $command['groupby'] = array();
        $command['select'] = array("rubriques.id_rubrique", "rubriques.titre", "rubriques.lang");
        $command['orderby'] = array();
        $command['join'] = array();
        $command['limit'] = '';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('rubriques.statut', '!', 'publie', ''), array('=', 'rubriques.id_rubrique', sql_quote(@$Pile[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/inc/inc-bas.html', 'html_2ac554317f8f8f8aa21871c007ab234d', '_syndic_rub', 22, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= '
		<a href="' . interdire_scripts(generer_url_public('backend', 'id_rubrique=' . $Pile[$SP]['id_rubrique'])) . '" rel="nofollow" title="' . _T('public|spip|ecrire:syndiquer_rubrique') . '"><img src="' . find_in_path('styles/img/rss.png') . '" alt="' . _T('public|spip|ecrire:icone_suivi_activite') . '" style="position:relative;bottom:-0.3em;" width="16" height="16" class="format_png" /><span>&nbsp;' . interdire_scripts(couper(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])), '60')) . '</span></a>
';
            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_syndic_rub @ squelettes/inc/inc-bas.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
/**
 * Construitre l'email personalise de notification d'un forum
 *
 * @param array $t
 * @param string $email
 * @param array $contexte
 * @return string
 */
function inc_email_notification_forum_dist($t, $email, $contexte = array())
{
    static $contextes_store = array();
    if (!isset($contextes_store[$t['id_forum']])) {
        $url = '';
        $id_forum = $t['id_forum'];
        if ($t['statut'] == 'prive') {
            if ($t['id_objet']) {
                $url = generer_url_entite($t['id_objet'], $t['objet'], '', 'forum' . $id_forum, false);
            }
        } else {
            if ($t['statut'] == 'privrac') {
                $url = generer_url_ecrire('forum') . '#forum' . $id_forum;
            } else {
                if ($t['statut'] == 'privadm') {
                    $url = generer_url_ecrire('forum', 'quoi=admin') . '#forum' . $id_forum;
                } else {
                    if ($t['statut'] == 'publie') {
                        $url = generer_url_entite($id_forum, 'forum');
                    } else {
                        $url = generer_url_ecrire('controler_forum', "debut_id_forum=" . $id_forum);
                    }
                }
            }
        }
        if (!$url) {
            spip_log("forum {$id_forum} sans referent", 'notifications');
            $url = './';
        }
        if ($t['id_objet']) {
            include_spip('inc/filtres');
            $t['titre_source'] = generer_info_entite($t['id_objet'], $t['objet'], 'titre');
        }
        $t['url'] = $url;
        // detecter les url des liens du forum
        // pour la moderation (permet de reperer les SPAMS avec des liens caches)
        // il faut appliquer le traitement de raccourci car sinon on rate des liens sous forme [->..] utilises par les spammeurs !
        include_spip("public/interfaces");
        $table_objet = "forum";
        $links = array();
        foreach ($t as $champ => $v) {
            $champ = strtoupper($champ);
            $traitement = isset($GLOBALS['table_des_traitements'][$champ]) ? $GLOBALS['table_des_traitements'][$champ] : null;
            if (is_array($traitement) and (isset($traitement[$table_objet]) or isset($traitement[0]))) {
                $traitement = $traitement[isset($traitement[$table_objet]) ? $table_objet : 0];
                $traitement = str_replace('%s', "'" . texte_script($v) . "'", $traitement);
                eval("\$v = {$traitement};");
            }
            $links = $links + extraire_balises($v, 'a');
        }
        $links = extraire_attribut($links, 'href');
        $links = implode("\n", $links);
        $t['liens'] = $links;
        $contextes_store[$t['id_forum']] = $t;
    }
    $fond = "notifications/forum_poste";
    if (isset($contexte['fond'])) {
        $fond = $contexte['fond'];
        unset($contexte['fond']);
    }
    $t = array_merge($contextes_store[$t['id_forum']], $contexte);
    // Rechercher eventuellement la langue du destinataire
    if (null !== ($l = sql_getfetsel('lang', 'spip_auteurs', "email=" . sql_quote($email)))) {
        $l = lang_select($l);
    }
    $parauteur = strlen($t['auteur']) <= 2 ? '' : " " . _T('forum_par_auteur', array('auteur' => $t['auteur'])) . ($t['email_auteur'] ? ' <' . $t['email_auteur'] . '>' : '');
    $titre = textebrut(typo($t['titre_source']));
    if ($titre) {
        $forum_poste_par = _T($t['objet'] == 'article' ? 'forum:forum_poste_par' : 'forum:forum_poste_par_generique', array('parauteur' => $parauteur, 'titre' => $titre, 'objet' => $t['objet']));
    } else {
        $forum_poste_par = _T('forum:forum_poste_par_court', array('parauteur' => $parauteur));
    }
    $t['par_auteur'] = $forum_poste_par;
    $envoyer_mail = charger_fonction('envoyer_mail', 'inc');
    // pour nettoyer_titre_email
    $corps = recuperer_fond($fond, $t);
    if ($l) {
        lang_select();
    }
    return $corps;
}
function BOUCLE_rubriques_editohtml_0167a54ed63f4fd0ee2bbef24b5ac307(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    $in = array();
    if (!is_array($a = @$Pile[0]['lang'])) {
        $in[] = $a;
    } else {
        $in = array_merge($in, $a);
    }
    if (!isset($command['table'])) {
        $command['table'] = 'rubriques';
        $command['id'] = '_rubriques_edito';
        $command['from'] = array('rubriques' => 'spip_rubriques', 'L1' => 'spip_mots_liens', 'L2' => 'spip_mots');
        $command['type'] = array();
        $command['groupby'] = array("rubriques.id_rubrique");
        $command['select'] = array("0+rubriques.titre AS num", "rubriques.titre", "rubriques.id_rubrique", "rubriques.descriptif", "rubriques.texte", "rubriques.lang");
        $command['orderby'] = array('num', 'rubriques.titre');
        $command['join'] = array('L1' => array('rubriques', 'id_objet', 'id_rubrique', 'L1.objet=' . sql_quote('rubrique')), 'L2' => array('L1', 'id_mot'));
        $command['limit'] = '0,10';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('rubriques.statut', '!', 'publie', ''), !(is_array(@$Pile[0]['lang']) ? count(@$Pile[0]['lang']) : strlen(@$Pile[0]['lang'])) ? '' : (is_array(@$Pile[0]['lang']) ? sql_in('rubriques.lang', sql_quote($in)) : array('=', 'rubriques.lang', sql_quote($GLOBALS['spip_lang'], '', 'varchar(10) NOT NULL DEFAULT \'\''))), array('=', 'L2.titre', "'Editorial'"));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-sommaire-edito.html', 'html_0167a54ed63f4fd0ee2bbef24b5ac307', '_rubriques_edito', 8, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        lang_select($GLOBALS['spip_lang']);
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']);
            $t0 .= '
	  <br class="nettoyeur" />
      ' . (($t1 = strval(interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))) !== '' ? '<h3 class="edito-titre"><a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_rubrique'], 'rubrique', '', '', true))) . '">' . $t1 . '</a></h3>' : '') . '
	  ' . (($t1 = strval(filtrer('image_graver', filtrer('image_reduire', strlen($logo = !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']}'\"" : "") . ' />') ? '<a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_rubrique'], 'rubrique', '', '', true))) . '">' . $logo . '</a>' : '', '150', '0')))) !== '' ? '<div class="logo-liste-art">
		' . $t1 . '
	  </div>' : '') . '
      ' . (($t1 = strval(interdire_scripts(($a = propre($Pile[$SP]['descriptif'], $connect, $Pile[0]) or is_string($a) and strlen($a)) ? $a : interdire_scripts(propre($Pile[$SP]['texte'], $connect, $Pile[0]))))) !== '' ? '<div class="chapo ' . interdire_scripts($Pile[$SP]['descriptif'] ? '' : '') . '">' . $t1 . '
        	<div style="clear: both; height: .1em;">&nbsp;</div>
       </div>' : '') . '
';
            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_rubriques_edito @ squelettes/inc/inc-sommaire-edito.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
Ejemplo n.º 29
0
/**
 * Calcule un squelette avec un contexte et retourne son contenu
 *
 * La fonction de base de SPIP : un squelette + un contexte => une page.
 * $fond peut etre un nom de squelette, ou une liste de squelette au format array.
 * Dans ce dernier cas, les squelettes sont tous evalues et mis bout a bout
 * $options permet de selectionner les options suivantes :
 *
 * - trim => true (valeur par defaut) permet de ne rien renvoyer si le fond ne produit que des espaces ;
 * - raw  => true permet de recuperer la strucure $page complete avec entetes et invalideurs
 *          pour chaque $fond fourni.
 *
 * @api
 * @param string/array $fond
 *     - Le ou les squelettes à utiliser, sans l'extension, {@example prive/liste/auteurs}
 *     - Le fichier sera retrouvé dans la liste des chemins connus de SPIP (squelettes, plugins, spip)
 * @param array $contexte
 *     - Informations de contexte envoyées au squelette, {@example array('id_rubrique' => 8)}
 *     - La langue est transmise automatiquement (sauf option étoile).
 * @param array $options
 *     Options complémentaires :
 *
 *     - trim   : applique un trim sur le résultat (true par défaut)
 *     - raw    : retourne un tableau d'information sur le squelette (false par défaut)
 *     - etoile : ne pas transmettre la langue au contexte automatiquement (false par défaut),
 *                équivalent de INCLURE*
 *     - ajax   : gere les liens internes du squelette en ajax (équivalent du paramètre {ajax})
 * @param string $connect
 *     Non du connecteur de bdd a utiliser
 * @return string|array
 *     - Contenu du squelette calculé
 *     - ou tableau d'information sur le squelette.
 */
function recuperer_fond($fond, $contexte = array(), $options = array(), $connect = '')
{
    if (!function_exists('evaluer_fond')) {
        include_spip('public/assembler');
    }
    // assurer la compat avec l'ancienne syntaxe
    // (trim etait le 3eme argument, par defaut a true)
    if (!is_array($options)) {
        $options = array('trim' => $options);
    }
    if (!isset($options['trim'])) {
        $options['trim'] = true;
    }
    if (isset($contexte['connect'])) {
        $connect = $connect ? $connect : $contexte['connect'];
        unset($contexte['connect']);
    }
    $texte = "";
    $pages = array();
    $lang_select = '';
    if (!isset($options['etoile']) or !$options['etoile']) {
        // Si on a inclus sans fixer le critere de lang, on prend la langue courante
        if (!isset($contexte['lang'])) {
            $contexte['lang'] = $GLOBALS['spip_lang'];
        }
        if ($contexte['lang'] != $GLOBALS['meta']['langue_site']) {
            $lang_select = lang_select($contexte['lang']);
        }
    }
    if (!isset($GLOBALS['_INC_PUBLIC'])) {
        $GLOBALS['_INC_PUBLIC'] = 0;
    }
    $GLOBALS['_INC_PUBLIC']++;
    foreach (is_array($fond) ? $fond : array($fond) as $f) {
        $page = evaluer_fond($f, $contexte, $connect);
        if ($page === '') {
            $c = isset($options['compil']) ? $options['compil'] : '';
            $a = array('fichier' => $fond);
            $erreur = _T('info_erreur_squelette2', $a);
            // squelette introuvable
            erreur_squelette($erreur, $c);
            // eviter des erreurs strictes ensuite sur $page['cle'] en PHP >= 5.4
            $page = array('texte' => '', 'erreur' => $erreur);
        }
        $page = pipeline('recuperer_fond', array('args' => array('fond' => $f, 'contexte' => $contexte, 'options' => $options, 'connect' => $connect), 'data' => $page));
        if (isset($options['ajax']) and $options['ajax']) {
            if (!function_exists('encoder_contexte_ajax')) {
                include_spip('inc/filtres');
            }
            $page['texte'] = encoder_contexte_ajax(array_merge($contexte, array('fond' => $f)), '', $page['texte'], $options['ajax']);
        }
        if (isset($options['raw']) and $options['raw']) {
            $pages[] = $page;
        } else {
            $texte .= $options['trim'] ? rtrim($page['texte']) : $page['texte'];
        }
    }
    $GLOBALS['_INC_PUBLIC']--;
    if ($lang_select) {
        lang_select();
    }
    if (isset($options['raw']) and $options['raw']) {
        return is_array($fond) ? $pages : reset($pages);
    } else {
        return $options['trim'] ? ltrim($texte) : $texte;
    }
}
Ejemplo n.º 30
0
/**
 * Construitre l'email personalise de notification d'un forum
 *
 * @param array $t
 * @param string $email
 * @return string
 */
function email_notification_forum ($t, $email) {
	static $contexte = array();

	if(!isset($contexte[$t['id_forum']])){
		$url = '';
		$id_forum = $t['id_forum'];

		if ($t['statut'] == 'prive') # forum prive
		{
			if ($t['id_article'])
				$url = generer_url_ecrire('articles', 'id_article='.$t['id_article']).'#id'.$id_forum;
			else if ($t['id_breve'])
				$url = generer_url_ecrire('breves_voir', 'id_breve='.$t['id_breve']).'#id'.$id_forum;
			else if ($t['id_syndic'])
				$url = generer_url_ecrire('sites', 'id_syndic='.$t['id_syndic']).'#id'.$id_forum;
		}
		else if ($t['statut'] == 'privrac') # forum general
		{
			$url = generer_url_ecrire('forum').'#id'.$id_forum;
		}
		else if ($t['statut'] == 'privadm') # forum des admins
		{
			$url = generer_url_ecrire('forum_admin').'#id'.$id_forum;
		}
		else if ($t['statut'] == 'publie') # forum publie
		{
			$url = generer_url_entite($id_forum, 'forum');
		}
		else #  forum modere, spam, poubelle direct ....
		{
			$url = generer_url_ecrire('controle_forum', "debut_id_forum=".$id_forum);
		}

		if (!$url) {
			spip_log("forum $id_forum sans referent",'notifications');
			$url = './';
		}
		if ($t['id_article']) {
			$titre = sql_getfetsel("titre", "spip_articles", "id_article=".sql_quote($t['id_article']));
		}
		if ($t['id_message']) {
			$titre = sql_getfetsel("titre", "spip_messages", "id_message=".sql_quote($t['id_message']));
		}

		$t['titre_source'] = $titre;
		$t['url'] = $url;

		// detecter les url des liens du forum
		// pour la moderation (permet de reperer les SPAMS avec des liens caches)
		$links = array();
		foreach ($t as $champ)
			$links = $links + extraire_balises($champ,'a');
		$links = extraire_attribut($links,'href');
		$links = implode("\n",$links);
		$t['liens'] = $links;

		$contexte[$t['id_forum']] = $t;
	}

	$t = $contexte[$t['id_forum']];
		// Rechercher eventuellement la langue du destinataire
	if (NULL !== ($l = sql_getfetsel('lang', 'spip_auteurs', "email=" . sql_quote($email))))
		$l = lang_select($l);

	$parauteur = (strlen($t['auteur']) <= 2) ? '' :
		(" " ._T('forum_par_auteur', array(
			'auteur' => $t['auteur'])
		) .
		 ($t['email_auteur'] ? ' <' . $t['email_auteur'] . '>' : ''));

	$titre = textebrut(typo($t['titre_source']));
	$forum_poste_par = ($t['id_article']
		? _T('forum_poste_par', array(
			'parauteur' => $parauteur, 'titre' => $titre))
		: $parauteur . ' (' . $titre . ')');

	$t['par_auteur'] = $forum_poste_par;

	$envoyer_mail = charger_fonction('envoyer_mail','inc'); // pour nettoyer_titre_email
	$corps = recuperer_fond("notifications/forum_poste",$t);

	if ($l)
		lang_select();

	return $corps;
}