Esempio n. 1
0
function blocs_callback($matches) {
	list($titre, $corps) = preg_split(',(\n\n|\r\n\r\n|\r\r),', trim($matches[3]), 2);
	// pas de corps !
	if(!strlen($corps = trim($corps))) {
		$corps = $titre;
		$titre = preg_replace(',[\n\r]+,s', ' ', couper(propre($titre), 30));
	}
	// pas d'intertitre !
	$titre = preg_replace(',^{{{(.*)}}}$,', '$1', trim($titre));
	if(!strlen($titre)) $titre = '???';
	// un resume facultatif
	if(preg_match(',<resume>(.*)</resume>\s?(.*)$,ms', $corps, $res))
		{ $corps = $res[2]; $res = $res[1]; } else $res = '';
	// types de blocs : bloc|invisible|visible
	if ($matches[1]=='visible' || defined('_CS_PRINT')) {
		$h = $d = '';
		$r = ' blocs_invisible blocs_slide';
	} else {
		$h = ' blocs_replie';
		$d = ' blocs_invisible blocs_slide';
		$r = '';
	}

	// blocs numerotes
	$b = strlen($matches[2])?" cs_bloc$matches[2]":''; 
	// title
	$title = function_exists('blocs_title')
		?"<div class='blocs_title blocs_invisible'>".join(_BLOC_TITLE_SEP, blocs_title($titre, $corps, $matches[2], $h<>'')).'</div>'
		:''; // valeur par defaut geree en JS
	return "<div class='cs_blocs$b'><"._BLOC_TITRE_H." class='blocs_titre$h blocs_click'><a href='javascript:;'>$titre</a></"._BLOC_TITRE_H.">"
		.(strlen($res)?"<div class='blocs_resume$r'>\n$res\n</div>":"")
		."<div class='blocs_destination$d'>\n\n".blocs_rempl($corps)."\n\n</div>$title</div>";
}
Esempio n. 2
0
function sommaire_d_une_page(&$texte, &$nbh3, $page = 0, $num_pages = 0)
{
    static $index;
    if (!$index || $page === false) {
        $index = 0;
    }
    if ($page === false) {
        return;
    }
    // trouver quel <hx> est utilise
    $hierarchie = preg_match(',<h(\\d),', $GLOBALS['debut_intertitre'], $regs) ? $regs[1] : '3';
    @define('_sommaire_NB_CARACTERES', 30);
    $self = nettoyer_uri();
    //self();//$GLOBALS['REQUEST_URI'];
    // si on n'est pas en mode impression, on calcule l'image de retour au sommaire
    if (!defined('_CS_PRINT')) {
        $titre = _T('couteau:sommaire_titre');
        $haut = "<a title=\"{$titre}\" href=\"" . $self . "#sommaire\" class=\"sommaire_ancre\">&nbsp;</a>";
        // modif cld
    } else {
        $haut = '';
    }
    // traitement des intertitres <hx>
    preg_match_all(",(<h{$hierarchie}[^>]*)>(.*)</h{$hierarchie}>,Umsi", $texte, $regs);
    $nbh3 += count($regs[0]);
    $pos = 0;
    $sommaire = '';
    // calcul de la page
    $p = $page ? _T('couteau:sommaire_page', array('page' => $page)) : '';
    for ($i = 0; $i < count($regs[0]); $i++, $index++) {
        $ancre = " id=\"sommaire_{$index}\">";
        // modif cld
        if (($pos2 = strpos($texte, $regs[0][$i], $pos)) !== false) {
            $titre = preg_replace(',^<p[^>]*>(.*)</p>$,Umsi', '\\1', trim($regs[2][$i]));
            // ancre 'haut', sauf si les blocs depliables utilisent h3...
            $texte = substr($texte, 0, $pos2) . $regs[1][$i] . $ancre . (strpos($regs[0][$i], 'blocs_titre') === false ? $haut : '') . $titre . substr($texte, $pos2 + strlen($regs[1][$i]) + 1 + strlen($regs[2][$i]));
            $pos = $pos2 + strlen($ancre) + strlen($regs[0][$i]);
            // tout le texte, sans les notes
            $brut = preg_replace(',\\[<a href=["\']#nb.*?</a>\\],', '', echappe_retour($regs[2][$i], 'CS'));
            // pas de glossaire
            if (function_exists('cs_retire_glossaire')) {
                $brut = cs_retire_glossaire($brut);
            }
            // texte brut
            $brut = preg_replace(',[\\n\\r]+,', ' ', textebrut($brut));
            $lien = cs_propre(couper($brut, _sommaire_NB_CARACTERES));
            $lien = preg_replace('/(&nbsp;|\\s)*[!?,;.:]+$/', '', $lien);
            // eviter une ponctuation a la fin
            $titre = attribut_html(couper($brut, 100));
            // si la decoupe en page est active...
            $artpage = function_exists('decoupe_url') && (strlen(_request('artpage')) || $page > 1) ? decoupe_url($self, $page, $num_pages) : $self;
            $sommaire .= "<dd><a {$st} title=\"{$titre}\" href=\"{$artpage}#sommaire_{$index}\">{$lien}</a>{$p}</dd>";
            // modif cld
        }
    }
    return $sommaire;
}
Esempio n. 3
0
function sommaire_d_une_page(&$texte, &$nbh3, $page=0, $num_pages=0) {
	static $index = 0;
	if($page===false) $index = 0;
	static $self = NULL; 
	if(!isset($self)) 
		$self = str_replace('&', '&amp;', nettoyer_uri());//self();//$GLOBALS['REQUEST_URI'];
	if($page===false) return;
	// trouver quel <hx> est utilise
	$root = $niveau = $match = preg_match(',<h(\d),',$GLOBALS['debut_intertitre'],$regs)?$regs[1]:'3';
	@define('_sommaire_NB_CARACTERES', 30);
	@define('_sommaire_PROFONDEUR', 1);
	if(_sommaire_PROFONDEUR>1)
		$match = $match .'-' . ($match+_sommaire_PROFONDEUR-1);
	// traitement des intertitres <hx>
	preg_match_all(",(<h([$match])[^>]*)>(.*)</h\\2>,Umsi", $texte, $regs);
	$nbh3 += count($regs[0]);
	$pos = 0; $sommaire = '';
	// calcul de la page
	$suffixe = $page?_T('couteau:sommaire_page', array('page'=>$page)):'';
	$fct_lien_retour = function_exists('sommaire_lien_retour')?'sommaire_lien_retour':'sommaire_lien_retour_dist';
	$fct_id_ancre = defined('_sommaire_JOLIES_ANCRES')?'sommaire_id_ancre_ex'
		:(function_exists('sommaire_id_ancre')?'sommaire_id_ancre':'sommaire_id_ancre_dist');
	$nb = count($regs[0]);
	for($i=0;$i<$nb;$i++,$index++){
		$w = &$regs[0][$i]; $h = &$regs[1][$i]; $n = &$regs[2][$i];
		if (($pos2 = strpos($texte, $w, $pos))!==false) {
			$t = $regs[3][$i];
			// calcul de l'ancre, $t peut etre modifie
			$ancre = $fct_id_ancre($index, $t, $n);
			$id = " id=\"$ancre\">";
			//$titre = preg_replace(',^<p[^>]*>(.*)</p>$,Umsi', '\\1', trim($t));
			// ancre 'retour au sommaire', sauf :
			// si on imprime, ou si les blocs depliables utilisent h{$n}...
			$titre = (defined('_CS_PRINT') OR (strpos($w, 'blocs_titre')!==false))
				?$t//$titre
				:$fct_lien_retour($self, $t);//$titre);
			$texte = substr($texte, 0, $pos2) . $h . $id . $titre
				. substr($texte, $pos2 + strlen($h)+1 + strlen($regs[3][$i]));
			$pos = $pos2 + strlen($id) + strlen($w);
			$brut = sommaire_nettoyer_titre($t);
			// pas trop long quand meme...
			$lien = cs_propre(couper($brut, _sommaire_NB_CARACTERES));
			// eviter une ponctuation a la fin, surtout si la page est precisee
			$lien = preg_replace('/(&nbsp;|\s)*'.($page?'[!?,;.:]+$/':'[,;.:]+$/'), '', $lien);
			$titre = attribut_html(couper($brut, 100));
			// si la decoupe en page est active...
			$artpage = (function_exists('decoupe_url') && (strlen(_request('artpage')) || $page>1) )
				?decoupe_url($self, $page, $num_pages):$self;
			$artpage = "\n<li><a $st title=\"$titre\" href=\"{$artpage}#$ancre\">$lien</a>$suffixe";
			if($niveau==$n) $sommaire .= ($sommaire?'</li>':'').$artpage;
			elseif($niveau<$n) $sommaire .= "\n<ul>".$artpage;
			else $sommaire .= '</li></ul></li>'.$artpage;
			$niveau = $n;
		}
	}
	return $sommaire?$sommaire.'</li>'.($niveau!=$root?'</ul>':''):'';
}
Esempio n. 4
0
/**
 * Nom du fichier de sauvegarde
 * la fourniture de l'extension permet de verifier que le nom n'existe pas deja
 *
 * @param string $dir
 * @param string $extension
 * @return string
 */
function dump_nom_fichier($dir, $extension = 'sqlite')
{
    include_spip('inc/texte');
    $site = isset($GLOBALS['meta']['nom_site']) ? preg_replace(array(",\\W,is", ",_(?=_),", ",_\$,"), array("_", "", ""), couper(translitteration(trim($GLOBALS['meta']['nom_site'])), 30, "")) : 'spip';
    $site .= '_' . date('Ymd');
    $nom = $site;
    $cpt = 0;
    while (file_exists($dir . $nom . ".{$extension}")) {
        $nom = $site . sprintf('_%03d', ++$cpt);
    }
    return $nom . ".{$extension}";
}
function BOUCLE_documents_portfoliohtml_4dc0f36e18dd7a26ebc382429cbc9835(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    $doublons_index = array();
    $in = array();
    $in[] = 'png';
    $in[] = 'jpg';
    $in[] = 'gif';
    // Initialise le(s) critère(s) doublons
    if (!isset($doublons[$d = 'documents'])) {
        $doublons[$d] = '';
    }
    if (!isset($command['table'])) {
        $command['table'] = 'documents';
        $command['id'] = '_documents_portfolio';
        $command['from'] = array('documents' => 'spip_documents', 'L1' => 'spip_documents_liens', 'L2' => 'spip_types_documents');
        $command['type'] = array();
        $command['groupby'] = array();
        $command['select'] = array("0+documents.titre AS num", "documents.date", "documents.id_document", "L2.mime_type", "L1.id_objet AS id_rubrique", "documents.titre", "documents.fichier");
        $command['orderby'] = array('num', 'documents.date');
        $command['join'] = array('L1' => array('documents', 'id_document'), 'L2' => array('documents', 'extension'));
        $command['limit'] = '';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('documents.statut', 'publie,prop,prepa', 'publie', ''), array('(documents.taille > 0 OR documents.distant=\'oui\')'), array('=', 'L1.id_objet', sql_quote(@$Pile[0]['id_rubrique'], '', 'bigint(21) NOT NULL DEFAULT \'0\'')), array('=', 'L1.objet', sql_quote('rubrique')), array('=', 'documents.mode', "'document'"), sql_in('documents.extension', sql_quote($in)), array('=', 'L1.vu', "'non'"), array(sql_in('documents.id_document', $doublons[$doublons_index[] = 'documents'], 'NOT')));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/inc/inc-rub-documents.html', 'html_4dc0f36e18dd7a26ebc382429cbc9835', '_documents_portfolio', 2, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            foreach ($doublons_index as $k) {
                $doublons[$k] .= "," . $Pile[$SP]['id_document'];
            }
            // doublons
            $t0 .= ($t1 = strval(vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_document'], 'document', '', '', true))))) !== '' ? '
		<a href="' . $t1 . ('" type="' . interdire_scripts($Pile[$SP]['mime_type']) . '" onclick="location.href=\'' . parametre_url(vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_rubrique'], 'rubrique', '', '', true))), 'id_document', $Pile[$SP]['id_document']) . '#documents_portfolio\';return false;"' . (($t2 = strval(interdire_scripts(@$Pile[0]['exposer']))) !== '' ? ' class="' . $t2 . '"' : '') . (($t2 = strval(interdire_scripts(couper(attribut_html(traiter_doublons_documents($doublons, typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))), '80')))) !== '' ? ' title="' . $t2 . '"' : '') . '>' . interdire_scripts(inserer_attribut(inserer_attribut(filtrer('image_graver', filtrer('image_reduire', copie_locale(get_spip_doc($Pile[$SP]['fichier'])), '0', '100')), 'class', 'spip_vignette_portfolio'), 'alt', interdire_scripts(couper(attribut_html(traiter_doublons_documents($doublons, typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))), '80')))) . '</a>
	') : '';
        }
        $iter->free();
    }
    if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) {
        spip_log(intval(1000 * $timer) . "ms BOUCLE_documents_portfolio @ squelettes/inc/inc-rub-documents.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
Esempio n. 6
0
function formulaires_configurer_identite_traiter_dist()
{
    include_spip('inc/config');
    set_request('adresse_site', appliquer_adresse_site(_request('adresse_site')));
    include_spip('inc/meta');
    foreach (array('nom_site', 'slogan_site', 'descriptif_site', 'email_webmaster') as $k) {
        ecrire_meta($k, _request($k));
    }
    include_spip('inc/texte_mini');
    $reload = texte_script(couper(_request('nom_site'), 35));
    $reload = "<script type='text/javascript'>if (window.jQuery) jQuery('#bando_identite .nom_site_spip .nom').html('{$reload}');</script>";
    return array('message_ok' => _T('config_info_enregistree') . $reload, 'editable' => true);
}
Esempio n. 7
0
	function couper_intro3($texte, $long, $suite) {
		$texte = extraire_multi(preg_replace(",(</?)intro>,i", "\\1intro>", $texte)); // minuscules
		$intro = '';
		while ($fin = strpos($texte, "</intro>")) {
			$zone = substr($texte, 0, $fin);
			$texte = substr($texte, $fin + strlen("</intro>"));
			if ($deb = strpos($zone, "<intro>") OR substr($zone, 0, 7) == "<intro>")
				$zone = substr($zone, $deb + 7);
			$intro .= $zone;
		}
		$texte = nettoyer_raccourcis_typo($intro ? $intro : $texte);
		return PtoBR(traiter_raccourcis(preg_replace(',([|]\s*)+,S', '; ', couper($texte, $long, _INTRODUCTION_CODE))));
	}
Esempio n. 8
0
function lien_objet($id, $type, $longueur = 80, $connect = NULL)
{
    include_spip('inc/liens');
    $titre = traiter_raccourci_titre($id, $type, $connect);
    // lorsque l'objet n'est plus declare (plugin desactive par exemple)
    // le raccourcis n'est plus valide
    $titre = isset($titre['titre']) ? typo($titre['titre']) : '';
    if (!strlen($titre)) {
        $titre = _T('info_sans_titre');
    }
    $url = generer_url_entite($id, $type);
    return "<a href='{$url}' class='{$type}'>" . couper($titre, $longueur) . "</a>";
}
Esempio n. 9
0
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[]= '&nbsp;';
	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 ? "&nbsp;"
	  :  "<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):"&nbsp;";

	return $vals;
}
function formulaires_configurer_relayeur_verifier_dist()
{
    $erreurs = array();
    $http_proxy = relayeur_saisie_ou_config(_request('http_proxy'), lire_config('http_proxy', ''));
    $http_noproxy = _request('http_noproxy');
    if ($http_proxy and !tester_url_absolue($http_proxy)) {
        $erreurs['http_proxy'] = _T('info_url_proxy_pas_conforme');
    }
    if (!isset($erreurs['http_proxy']) and _request('tester_proxy')) {
        if (!$http_proxy) {
            $erreurs['http_proxy'] = _T('info_obligatoire');
        } else {
            include_spip('inc/distant');
            $test_proxy = _request('test_proxy');
            $t = parse_url($test_proxy);
            if (!@$t['host']) {
                $erreurs['test_proxy'] = _T('info_adresse_non_indiquee');
            } else {
                include_spip('inc/texte');
                // pour aide, couper, lang
                $info = "";
                if (!need_proxy($t['host'], $http_proxy, $http_noproxy)) {
                    $info = "<strong>" . _T('page_pas_proxy') . "</strong><br />";
                }
                // il faut fausser le proxy actuel pour faire le test !
                $cur_http_proxy = $GLOBALS['meta']['http_proxy'];
                $cur_http_noproxy = $GLOBALS['meta']['http_noproxy'];
                $GLOBALS['meta']['http_proxy'] = $http_proxy;
                $GLOBALS['meta']['http_noproxy'] = $http_noproxy;
                $page = recuperer_page($test_proxy, true);
                $GLOBALS['meta']['http_proxy'] = $cur_http_proxy;
                $GLOBALS['meta']['http_noproxy'] = $cur_http_noproxy;
                if ($page) {
                    $erreurs['message_ok'] = _T('info_proxy_ok') . "<br />{$info}\n<tt>" . couper(entites_html($page), 300) . "</tt>";
                    $erreurs['message_erreur'] = '';
                } else {
                    $erreurs['message_erreur'] = $info . _T('info_impossible_lire_page', array('test_proxy' => "<tt>{$test_proxy}</tt>")) . " <b><tt>" . no_password_proxy_url($http_proxy) . "</tt></b>." . aide('confhttpproxy');
                }
            }
        }
    }
    return $erreurs;
}
Esempio n. 11
0
function http_auteurs_ressemblants($cherche_auteur, $id_message)
{

  $cherche_auteur = htmlspecialchars($cherche_auteur);

  global $connect_id_auteur;
  $query = sql_select("id_auteur, nom", "spip_auteurs", "messagerie<>'non' AND id_auteur<>'$connect_id_auteur' AND pass<>'' AND login<>''");
  $table_auteurs = array();
  $table_ids = array();
  while ($row = sql_fetch($query)) {
    $table_auteurs[] = $row['nom'];
    $table_ids[] = $row['id_auteur'];
  }
  $resultat =  mots_ressemblants($cherche_auteur, $table_auteurs, $table_ids);
  if (!$resultat) {
    return '<b>' . _T('info_recherche_auteur_zero', array('cherche_auteur' => $cherche_auteur))."</b><br />";
  }
  else if (count($resultat) == 1) {
    // action/editer_message a du prendre en compte ce cas
    list(, $nouv_auteur) = each($resultat);
    $row = sql_fetsel("nom", "spip_auteurs", "id_auteur=$nouv_auteur");
    $nom_auteur = $row['nom'];
    return "<b>"._T('info_ajout_participant')."</b><br />" .
      "<ul><li><span class='verdana1 spip_small'><b><span class='spip_medium'>$nom_auteur</span></b></span></li>\n</ul>";
  }
  else if (count($resultat) < 16) {
    $res = '';
    $query = sql_select("*", "spip_auteurs", "id_auteur IN (" . join(',', $resultat) . ")", "", "nom");

    while ($row = sql_fetch($query)) {
      $id_auteur = $row['id_auteur'];
      $nom_auteur = $row['nom'];
      $email_auteur = $row['email'];
      $bio_auteur = $row['bio'];
      $res .= "\n<li><span class='spip_medium verdana1'><b>$nom_auteur</b></span>" .
	($email_auteur ? " ($email_auteur)" : '') .
	"\n <a href='" . redirige_action_auteur("editer_message","$id_message/@$id_auteur", 'message', "id_message=$id_message")
	. "'>" 
	. _T('lien_ajout_destinataire').
	"</a>" .
	(!trim($bio_auteur) ? '' :
	 ("<br />\n<span class='spip_x-small'>".propre(couper($bio_auteur, 100))."</span>\n")) .
	"</li>\n";
    }
    return  "<b>"._T('info_recherche_auteur_ok', array('cherche_auteur' => $cherche_auteur))."</b><br />" .($res ? "<ul>$res</ul>" : '');
  }
  else {
    return "<b>"._T('info_recherche_auteur_a_affiner', array('cherche_auteur' => $cherche_auteur))."</b><br />";
  }
}
Esempio n. 12
0
function debusquer_source($objet, $affiche)
{
    $quoi = $GLOBALS['debug_objets'][$affiche][$objet];
    if (!empty($GLOBALS['debug_objets']['boucle'][$objet]->id_boucle)) {
        $nom = $GLOBALS['debug_objets']['boucle'][$objet]->id_boucle;
    } else {
        $nom = $GLOBALS['debug_objets']['sourcefile'][$objet];
    }
    $res2 = "";
    if ($affiche == 'resultat') {
        $legend = $nom;
        $req = $GLOBALS['debug_objets']['requete'][$objet];
        if (function_exists('_mysql_traite_query')) {
            $c = strtolower(_request('connect'));
            $c = $GLOBALS['connexions'][$c ? $c : 0]['prefixe'];
            $req = _mysql_traite_query($req, '', $c);
        }
        //  permettre le copier/coller facile
        // $res = ancre_texte($req, array(), true);
        $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n";
        //  formatage et affichage des resultats bruts de la requete
        $ress_req = spip_query($req);
        $brut_sql = '';
        $num = 1;
        //  eviter l'affichage de milliers de lignes
        //  personnalisation possible dans mes_options
        $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50;
        while ($retours_sql = sql_fetch($ress_req)) {
            if ($num <= $max_aff) {
                $brut_sql .= "<h3>" . ($num == 1 ? $num . " sur " . sql_count($ress_req) : $num) . "</h3>";
                $brut_sql .= "<p>";
                foreach ($retours_sql as $key => $val) {
                    $brut_sql .= "<strong>" . $key . "</strong> => " . spip_htmlspecialchars(couper($val, 150)) . "<br />\n";
                }
                $brut_sql .= "</p>";
            }
            $num++;
        }
        $res2 = interdire_scripts($brut_sql);
        foreach ($quoi as $view) {
            //  ne pas afficher les $contexte_inclus
            $view = preg_replace(",<\\?php.+\\?[>],Uims", "", $view);
            if ($view) {
                $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . "</fieldset>";
            }
        }
    } elseif ($affiche == 'code') {
        $legend = $nom;
        $res = ancre_texte("<" . "?php\n" . $quoi . "\n?" . ">");
    } elseif ($affiche == 'boucle') {
        $legend = _T('zbug_boucle') . ' ' . $nom;
        // Le compilateur prefixe le nom des boucles par l'extension du fichier source.
        $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : '';
        $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle'));
    } elseif ($affiche == 'squelette') {
        $legend = $GLOBALS['debug_objets']['sourcefile'][$objet];
        $res = ancre_texte($GLOBALS['debug_objets']['squelette'][$objet]);
    }
    return array($legend, $res, $res2);
}
Esempio n. 13
0
function spiplistes_cherche_auteur () {
	if (!$cherche_auteur = _request('cherche_auteur')) return;
	
	$col = strpos($cherche_auteur, '@') !== false ? 'email' : 'nom';
	$like = '';
	if (strpos($cherche_auteur, '%') !== false) {
		$like = " WHERE $col LIKE '" . $cherche_auteur . "'";
		$cherche_auteur = str_replace('%', ' ', $cherche_auteur);
	}
	
	$sql_result = sql_select("id_auteur,$col", "spip_auteurs", $like);
	
	while($row = sql_fetch($sql_result)) {
		$table_auteurs[] = $row[$col];
		$table_ids[] = $row['id_auteur'];
	}
	
	$resultat = mots_ressemblants($cherche_auteur, $table_auteurs, $table_ids);

	$result = ""
		. "<div id='boite-result-chercher-auteur'>"
		. debut_boite_info(true)
		;
	if (!$resultat) {
		$result .= ""
			. "<strong>"._T('texte_aucun_resultat_auteur', array('cherche_auteur' => $cherche_auteur)).".</strong><br />\n"
			;
	}
	else if (count($resultat) == 1) {
		list(, $nouv_auteur) = each($resultat);
		$result .= ""
			. "<strong>"._T('spiplistes:une_inscription')."</strong>:<br />\n"
			. "<ul>"
			;
		$sql_result = sql_select("id_auteur,nom,email,bio", "spip_auteurs", "id_auteur=".sql_quote($nouv_auteur), '', '', 1);
		while ($row = sql_fetch($sql_result)) {
			$id_auteur = $row['id_auteur'];
			$nom_auteur = $row['nom'];
			$email_auteur = $row['email'];
			$bio_auteur = $row['bio'];

			$result .= ""
				. "<li class='auteur'>"
					. "<a class='nom_auteur' href=\"".generer_url_ecrire(_SPIPLISTES_EXEC_ABONNE_EDIT, "id_auteur=$id_auteur")."\">".typo($nom_auteur)."</a>"
				. " | $email_auteur"
				. "</li>\n"
				;
		}
		$result .= ""
			. "</ul>\n"
			;
	}
	else if (count($resultat) < 16) {
		reset($resultat);
		unset($les_auteurs);
		while (list(, $id_auteur) = each($resultat)) {
			$les_auteurs[] = $id_auteur;
		}
		if($les_auteurs) {
			$les_auteurs = join(',', $les_auteurs);
			$result .= ""
				. "<strong>"._T('texte_plusieurs_articles', array('cherche_auteur' => $cherche_auteur))."</strong><br />"
				. "<ul>"
				;
			$sql_select = array('id_auteur','nom','email','bio');
			$sql_result = sql_select($sql_select, "spip_auteurs", "id_auteur IN ($les_auteurs)", '', array('nom'));
			while ($row = sql_fetch($sql_result)) {
				$id_auteur = $row['id_auteur'];
				$nom_auteur = $row['nom'];
				$email_auteur = $row['email'];
				$bio_auteur = $row['bio'];
				
				$result .= ""
					. "<li class='auteur'><span class='nom_auteur'>".typo($nom_auteur)."</span>"
					;
				if ($email_auteur) {
					$result .= ""
						. " ($email_auteur)"
						;
				}
				$result .= ""
					. " | <a href=\"".generer_url_ecrire(_SPIPLISTES_EXEC_ABONNE_EDIT,"id_auteur=$id_auteur")."\">"
					. _T('spiplistes:choisir')."</a>"
					;
				if (trim($bio_auteur)) {
					$result .= ""
						. "<br /><font size=1>".couper(propre($bio_auteur), 100)."</font>\n"
						;
				}
				$result .= ""
					. "</li>\n"
					;
			}
			$result .= ""
				. "</ul>\n"
				;
		}
	}
	else {
		$result .= ""
			. "<strong>"._T('texte_trop_resultats_auteurs', array('cherche_auteur' => $cherche_auteur))."</strong><br />"
			;
	}
	
	$result .= ""
		. fin_boite_info(true)
		. "</div>"
		;

	return($result);
} // end spiplistes_cherche_auteur()
Esempio n. 14
0
function couper_intro($texte, $long)
{
    $texte = preg_replace("/(<\\/?)intro>/i", "\\1intro>", $texte);
    // minuscules
    while ($fin = strpos($texte, "</intro>")) {
        $zone = substr($texte, 0, $fin);
        $texte = substr($texte, $fin + strlen("</intro>"));
        if ($deb = strpos($zone, "<intro>") or substr($zone, 0, 7) == "<intro>") {
            $zone = substr($zone, $deb + 7);
        }
        $intro .= $zone;
    }
    if ($intro) {
        $intro = $intro . '&nbsp;(...)';
    } else {
        $intro = couper($texte, $long);
    }
    // supprimer un eventuel chapo redirecteur =http:/.....
    $intro = preg_replace("/^=[^[:space:]]+/", "", $intro);
    return $intro;
}
Esempio n. 15
0
function plugins_afficher_plugin_distant_dist($url_page, $zip_file, $info, $expose=false, $class_li="item"){
	static $id_input=0;
	static $versions = array();
	static $charger_plugin = null;

	$erreur = false;
	$s = "";

	$titre = $info[0];
	$url_doc = $info[1];
	$info = $info[2]; // recuperer le tableau

	$titre = typo('<multi>'.$titre.'</multi>'); // recuperer les blocs multi du flux de la zone (temporaire?)
	$nick = strtolower(basename($zip_file, '.zip'));
	$info['prefix'] = $nick;
	$plug_file = $zip_file;
	
	// numerotons les occurences d'un meme prefix
	$versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : '';
	$id = $info['prefix'] . $versions[$info['prefix']];
	
	$class = $class_li;
	$class .= $actif?" actif":"";
	$class .= $expose?" on":"";
	$erreur = isset($info['erreur']);
	if ($erreur)
		$class .= " erreur";
	$s .= "<li id='$id' class='$class'>";


	// checkbox pour activer ou desactiver
	// si $actif vaut -1, c'est actif, et ce n'est pas desactivable (extension)
	/*
	if (!$erreur AND $actif>=0){
		$id_input++;
		$check = "\n<input type='radio' name='url_zip_plugin' id='label_$id_input' value='O'";
		$check .= $actif?" checked='checked'":"";
		$check .= " class='checkbox' />";
		$check .= "<label for='label_$id_input'>".$titre."</label>";
		$s .= "<div class='check'>$check</div>";
	}*/

	if (!$erreur){
		// bouton de telechargement
		if (!$charger_plugin)
			$charger_plugin = generer_action_auteur('charger_plugin',"charger_zip","./");
		$balise_img = chercher_filtre('balise_img');
		$action = parametre_url($charger_plugin,'url_zip_plugin',$plug_file);
		$s .= "<div class='download'>".
		"<a href='$action' title='"._T('plugin_charger')."'>"
		. $balise_img(find_in_path("images/telecharger-16.png"),_T('plugin_charger'))
		."</a></div>"
		;
	}

	// Cartouche Resume
	$s .= "<div class='resume'>";

	$desc = $info['descriptif'];
	$url_stat = parametre_url($url_page, "plugin",$plug_file);

	$s .= "<h3 class='nom'><a href='$url_stat' rel='info'>".$titre."</a></h3>";
	$s .= "<div class='short'>".couper($desc,60)."</div>";
	if (isset($info['icon']) and $info['icon']) {
		include_spip("inc/filtres_images_mini");
		$s.= "<div class='icon'><a href='$url_stat' rel='info'><img src='".$info['icon']."' width='32' height='auto' /></a></div>";
	}
	$s .= "</div>";

	if ($erreur){
		$s .=  "<div class='erreur'>";
		foreach($info['erreur'] as $err)
			$s .= "$err <br/>";
		$s .=  "</div>";
	}

	// afficher les details d'un plug en secours ; la div sert pour l'ajax
	$s .= "<div class='details'>";
	if ($expose)
		$s .= affiche_bloc_plugin_distant($plug_file, $info);
	$s .= "</div>";

	$s .= "</li>";
	return $s;
}
function enfants_aff($id_parent, $decalage, $taille, $critere, $gauche = 0)
{
    global $spip_lang_right, $spip_lang_left;
    static $total_site = null;
    static $niveau = 0;
    static $nombre_branche;
    static $nombre_rub;
    if (is_null($total_site)) {
        $nombre_branche = array();
        $nombre_rub = array();
        $total_site = enfants(0, $critere, $nombre_branche, $nombre_rub);
        if ($total_site < 1) {
            $total_site = 1;
        }
    }
    $visites_abs = 0;
    $out = "";
    $width = intval(floor($nombre_branche[$id_parent] / $total_site * $taille));
    $width = "width:{$width}px;float:{$spip_lang_left};";
    $result = sql_select("id_rubrique, titre, descriptif", "spip_rubriques", "id_parent={$id_parent}", '', '0+titre,titre');
    while ($row = sql_fetch($result)) {
        $id_rubrique = $row['id_rubrique'];
        $titre = typo($row['titre']);
        $descriptif = attribut_html(couper(typo($row['descriptif']), 80));
        if ($nombre_branche[$id_rubrique] > 0 or $nombre_rub[$id_rubrique] > 0) {
            $largeur_branche = floor(($nombre_branche[$id_rubrique] - $nombre_rub[$id_rubrique]) * $taille / $total_site);
            $largeur_rub = floor($nombre_rub[$id_rubrique] * $taille / $total_site);
            if ($largeur_branche + $largeur_rub > 0) {
                if ($niveau == 0) {
                    $couleur = "#cccccc";
                } else {
                    if ($niveau == 1) {
                        $couleur = "#eeeeee";
                    } else {
                        $couleur = "white";
                    }
                }
                $out .= "<table cellpadding='2' cellspacing='0' border='0' width='100%'>";
                $out .= "\n<tr style='background-color: {$couleur}'>";
                $out .= "\n<td style='border-bottom: 1px solid #aaaaaa; padding-{$spip_lang_left}: " . ($niveau * 20 + 5) . "px;'>";
                if ($largeur_branche > 2) {
                    $out .= bouton_block_depliable("<a href='" . generer_url_entite($id_rubrique, 'rubrique') . "' style='color: black;' title=\"{$descriptif}\">{$titre}</a>", "incertain", "stats{$id_rubrique}");
                } else {
                    $out .= "<div class='rubsimple' style='padding-left: 18px;'>" . "<a href='" . generer_url_entite($id_rubrique, 'rubrique') . "' style='color: black;' title=\"{$descriptif}\">{$titre}</a>" . "</div>";
                }
                $out .= "</td>";
                // pourcentage de visites dans la branche par rapport au total du site
                $pourcent = round($nombre_branche[$id_rubrique] / $total_site * 1000) / 10;
                $out .= "\n<td class='verdana1' style='text-align: {$spip_lang_right}; width: 40px; border-bottom: 1px solid #aaaaaa;'>{$pourcent}%</td>";
                $out .= "\n<td align='right' style='border-bottom: 1px solid #aaaaaa; width:" . ($taille + 5) . "px'>";
                $out .= "\n<table cellpadding='0' cellspacing='0' border='0' width='" . ($decalage + 1 + $gauche) . "'>";
                $out .= "\n<tr>";
                if ($gauche > 0) {
                    $out .= "<td style='width: " . $gauche . "px'></td>";
                }
                $out .= "\n<td style='border: 0px; white-space: nowrap;'>";
                $out .= "<div style='border: 1px solid #999999; background-color: #dddddd; height: 1em; padding: 0px; margin: 0px;{$width}'>";
                if ($visites_abs > 0) {
                    $out .= "<img src='" . chemin_image('rien.gif') . "' style='vertical-align: top; height: 1em; border: 0px; width: " . $visites_abs . "px;' alt= ' '/>";
                }
                if ($largeur_branche > 0) {
                    $out .= "<img src='" . chemin_image('rien.gif') . "' class='couleur_cumul' style='vertical-align: top; height: 1em; border: 0px; width: " . $largeur_branche . "px;' alt=' ' />";
                }
                if ($largeur_rub > 0) {
                    $out .= "<img src='" . chemin_image('rien.gif') . "' class='couleur_nombre' style='vertical-align: top; width: " . $largeur_rub . "px; height: 1em; border: 0px' alt=' ' />";
                }
                $out .= "</div>";
                $out .= "</td></tr></table>\n";
                $out .= "</td></tr></table>";
            }
        }
        if (isset($largeur_branche) && $largeur_branche > 0) {
            $niveau++;
            $out .= debut_block_depliable(false, "stats{$id_rubrique}");
            $out .= enfants_aff($id_rubrique, $largeur_branche, $taille, $critere, $visites_abs + $gauche);
            $out .= fin_block();
            $niveau--;
        }
        $visites_abs = $visites_abs + round($nombre_branche[$id_rubrique] / $total_site * $taille);
    }
    return $out;
}
Esempio n. 17
0
function plugin_resume($info, $dir_plugins, $plug_file, $url_page)
{
    $prefix = $info['prefix'];
    $dir = "{$dir_plugins}{$plug_file}";
    $slogan = PtoBR(plugin_propre($info['slogan'], "{$dir}/lang/paquet-{$prefix}"));
    // une seule ligne dans le slogan : couper si besoin
    if (($p = strpos($slogan, "<br />")) !== FALSE) {
        $slogan = substr($slogan, 0, $p);
    }
    // couper par securite
    $slogan = couper($slogan, 80);
    $nom = plugin_nom($info, $dir_plugins, $plug_file);
    $url = parametre_url($url_page, "plugin", substr($dir, strlen(_DIR_RACINE)));
    if (isset($info['logo']) and $i = trim($info['logo'])) {
        include_spip("inc/filtres_images_mini");
        $i = inserer_attribut(image_reduire("{$dir}/{$i}", 32), 'alt', '');
        $i = "<div class='icon'><a href='{$url}' rel='info'>{$i}</a></div>";
    } else {
        $i = '';
    }
    return "<div class='resume'>" . "<h3><a href='{$url}' rel='info'>" . $nom . "</a></h3>" . " <span class='version'>" . $info['version'] . "</span>" . " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . "</span>" . "<div class='short'>" . $slogan . "</div>" . $i . "</div>";
}
Esempio n. 18
0
function filtre_introduction_dist($descriptif, $texte, $longueur, $connect)
{
    // Si un descriptif est envoye, on l'utilise directement
    if (strlen($descriptif)) {
        return propre($descriptif, $connect);
    }
    // De preference ce qui est marque <intro>...</intro>
    $intro = '';
    $texte = preg_replace(",(</?)intro>,i", "\\1intro>", $texte);
    // minuscules
    while ($fin = strpos($texte, "</intro>")) {
        $zone = substr($texte, 0, $fin);
        $texte = substr($texte, $fin + strlen("</intro>"));
        if ($deb = strpos($zone, "<intro>") or substr($zone, 0, 7) == "<intro>") {
            $zone = substr($zone, $deb + 7);
        }
        $intro .= $zone;
    }
    // [12025] On ne *PEUT* pas couper simplement ici car c'est du texte brut,
    // qui inclus raccourcis et modeles
    // un simple <articlexx> peut etre ensuite transforme en 1000 lignes ...
    // par ailleurs le nettoyage des raccourcis ne tient pas compte
    // des surcharges et enrichissement de propre
    // couper doit se faire apres propre
    //$texte = nettoyer_raccourcis_typo($intro ? $intro : $texte, $connect);
    // Cependant pour des questions de perfs on coupe quand meme, en prenant
    // large et en se mefiant des tableaux #1323
    if (strlen($intro)) {
        $texte = $intro;
    } else {
        if (strpos("\n" . $texte, "\n|") === false and strlen($texte) > 2.5 * $longueur) {
            if (strpos($texte, "<multi") !== false) {
                $texte = extraire_multi($texte);
            }
            $texte = couper($texte, 2 * $longueur);
        }
    }
    // ne pas tenir compte des notes
    if ($notes = charger_fonction('notes', 'inc', true)) {
        $notes('', 'empiler');
    }
    // Supprimer les modèles avant le propre afin d'éviter qu'ils n'ajoutent du texte indésirable
    // dans l'introduction.
    $texte = supprime_img($texte, '');
    $texte = propre($texte, $connect);
    if ($notes) {
        $notes('', 'depiler');
    }
    if (!defined('_INTRODUCTION_SUITE')) {
        define('_INTRODUCTION_SUITE', '&nbsp;(...)');
    }
    $texte = couper($texte, $longueur, _INTRODUCTION_SUITE);
    // et reparagrapher si necessaire (coherence avec le cas descriptif)
    if ($GLOBALS['toujours_paragrapher']) {
        // Fermer les paragraphes
        $texte = paragrapher($texte, $GLOBALS['toujours_paragrapher']);
    }
    return $texte;
}
Esempio n. 19
0
/**
 * Determiner un titre automatique,
 * a partir des champs textes de contenu
 *
 * @param array $champs_contenu
 *   liste des champs contenu textuels
 * @param array|null $c
 *   tableau qui contient les valeurs des champs de contenu
 *   si null on utilise les valeurs du POST
 * @param int $longueur
 *   longueur de coupe
 * @return string
 */
function inc_titrer_contenu_dist($champs_contenu, $c = null, $longueur = 50)
{
    // trouver un champ texte non vide
    $t = "";
    foreach ($champs_contenu as $champ) {
        if ($t = _request($champ, $c)) {
            break;
        }
    }
    if ($t) {
        include_spip('inc/texte_mini');
        $t = couper($t, $longueur, "...");
    }
    return $t;
}
Esempio n. 20
0
function spiplistes_boitelistes_planning_jour ($planning, $prefix_titre, $coef_graph) {
	$result = "";
	$ii = 0;
	foreach($planning as $liste) {
		$titre_nb_abos = spiplistes_nb_destinataire_str_get($liste['nb_abos']);
		$titre = $prefix_titre.": ".couper($liste['titre'])." ($titre_nb_abos)";
		$height = "height:".max(_SPIPLISTES_MIN_HEIGHT_BAR, ceil($liste['nb_abos'] * $coef_graph))."px;";
		$href = generer_url_ecrire(_SPIPLISTES_EXEC_LISTE_GERER, "id_liste=".$liste['id_liste']);
		$bgcolor = "background-color:#".spiplistes_items_get_item("icon_color", $liste['statut']).";";
		$result .= ""
			. "<a href='$href' class='a-fond-".intval($ii++ % 2)."' title='".$titre."' style='$height $bgcolor'>\n"
			. "</a>\n"
			;
	}
	return($result);
}
Esempio n. 21
0
function configuration_relayeur_post ($http_proxy, $http_noproxy, $test_proxy, $tester_proxy) 
{
	// http_proxy : ne pas prendre en compte la modif si le password est '****'
	if (preg_match(',:\*\*\*\*@,', $http_proxy))
		$http_proxy = $GLOBALS['meta']['http_proxy'];

	$retour = $page = '';

	if ($tester_proxy AND preg_match(",https?://,", $http_proxy)) {
		include_spip('inc/distant');
		$t = parse_url($test_proxy);

		if (!@$t['host']) {
			$retour = _T('info_adresse_non_indiquee');
		} elseif (!need_proxy($t['host'])) {

			$retour = "<p>"._T('page_pas_proxy')."</p>\n";
		} elseif ($page = recuperer_page($test_proxy, true)) {
			include_spip('inc/texte'); // pour aide, couper, lang
			$retour = "<p>"._T('info_proxy_ok')."</p>\n<tt>"
			. couper(entites_html($page),300)."</tt>";
		} else	$retour = _T('info_impossible_lire_page',
					array('test_proxy' => $test_proxy))
			. " <tt>".no_password_proxy_url($http_proxy)."</tt>."
			. aide('confhttpproxy');
	}

	if ($http_proxy !== NULL) {
		ecrire_meta('http_proxy', $http_proxy);
	}
	if ($http_noproxy !== NULL) {
		ecrire_meta('http_noproxy', $http_noproxy);
	}
	if ($page) {
		include_spip('install/etape_fin');
		$retour .= install_verifier_htaccess();
	}
	return $retour;
}
Esempio n. 22
0
function filtre_introduction_dist($descriptif, $texte, $longueur, $connect) {
	// Si un descriptif est envoye, on l'utilise directement
	if (strlen($descriptif))
		return propre($descriptif,$connect);

	// De preference ce qui est marque <intro>...</intro>
	$intro = '';
	$texte = preg_replace(",(</?)intro>,i", "\\1intro>", $texte); // minuscules
	while ($fin = strpos($texte, "</intro>")) {
		$zone = substr($texte, 0, $fin);
		$texte = substr($texte, $fin + strlen("</intro>"));
		if ($deb = strpos($zone, "<intro>") OR substr($zone, 0, 7) == "<intro>")
			$zone = substr($zone, $deb + 7);
		$intro .= $zone;
	}

	// [12025] On ne *PEUT* pas couper simplement ici car c'est du texte brut,
	// qui inclus raccourcis et modeles
	// un simple <articlexx> peut etre ensuite transforme en 1000 lignes ...
	// par ailleurs le nettoyage des raccourcis ne tient pas compte
	// des surcharges et enrichissement de propre
	// couper doit se faire apres propre
	//$texte = nettoyer_raccourcis_typo($intro ? $intro : $texte, $connect);

	// Cependant pour des questions de perfs on coupe quand meme, en prenant
	// large et en se mefiant des tableaux #1323

	if (strlen($intro))
		$texte = $intro;

	else
	if (strpos("\n".$texte, "\n|")===false
	AND strlen($texte) > 2.5*$longueur)
		$texte = couper($texte, 2*$longueur);

	// ne pas tenir compte des notes
	$notes = charger_fonction('notes', 'inc');
	$notes('','empiler');
	$texte = propre($texte,$connect);
	$notes('','depiler');

	if (!defined('_INTRODUCTION_SUITE')) define('_INTRODUCTION_SUITE', '&nbsp;(...)');
	$texte = couper($texte, $longueur, _INTRODUCTION_SUITE);

	return $texte;
}
Esempio n. 23
0
function tw_traiter_raccourci_notes($letexte, $marqueur_notes)
{
    global $compt_note, $les_notes, $notes_vues;
    global $ouvre_ref, $ferme_ref;
    if (strpos($letexte, '[[') === false or !preg_match_all(_RACCOURCI_NOTES_TW, $letexte, $m, PREG_SET_ORDER)) {
        return array($letexte, array());
    }
    // quand il y a plusieurs series de notes sur une meme page
    $mn = !$marqueur_notes ? '' : $marqueur_notes . '-';
    $mes_notes = array();
    foreach ($m as $r) {
        list($note_source, $note_all, $ref, $nom, $note_texte) = $r;
        // reperer une note nommee, i.e. entre chevrons
        // On leve la Confusion avec une balise en regardant
        // si la balise fermante correspondante existe
        // Cas pathologique:   [[ <a> <a href="x">x</a>]]
        if (!(isset($nom) and $ref and (strpos($note_texte, '</' . $nom . '>') === false or preg_match(",<{$nom}\\W.*</{$nom}>,", $note_texte)))) {
            $nom = ++$compt_note;
            $note_texte = $note_all;
        }
        // eliminer '%' pour l'attribut id
        $ancre = $mn . str_replace('%', '_', rawurlencode($nom));
        // ne mettre qu'une ancre par appel de note (XHTML)
        $att = $notes_vues[$ancre]++ ? '' : " id='nh{$ancre}'";
        // creer le popup 'title' sur l'appel de note
        ## attention : propre() est couteux !
        ## utiliser nettoyer_raccourcis_typo() ?
        if ($title = supprimer_tags(nettoyer_raccourcis_typo($note_texte))) {
            $title = " title='" . couper($title, 80) . "'";
        }
        // ajouter la note aux notes precedentes
        if ($note_texte) {
            $mes_notes[] = array($ancre, $nom, $note_texte);
        }
        // dans le texte, mettre l'appel de note a la place de la note
        if ($nom) {
            $nom = "{$ouvre_ref}<a href='#nb{$ancre}' class='spip_note' rel='footnote'{$title}{$att}>{$nom}</a>{$ferme_ref}";
        }
        $pos = strpos($letexte, $note_source);
        $letexte = rtrim(substr($letexte, 0, $pos), ' ') . code_echappement($nom) . substr($letexte, $pos + strlen($note_source));
    }
    return array($letexte, $mes_notes);
}
Esempio n. 24
0
function plugin_resume($info, $dir_plugins, $plug_file, $url_page)
{
	$desc = plugin_propre($info['description']);
	$dir = $dir_plugins.$plug_file;
	if (($p=strpos($desc, "<br />"))!==FALSE)
		$desc = substr($desc, 0,$p);
	$url = parametre_url($url_page, "plugin", $dir);

	if (isset($info['icon']) and $i = trim($info['icon'])) {
		include_spip("inc/filtres_images_mini");
		$i = inserer_attribut(image_reduire("$dir/$i", 32),'alt','');
		$i = "<div class='icon'><a href='$url' rel='info'>$i</a></div>";
	} else $i = '';

	return "<div class='resume'>"
	. "<h3 class='nom'><a href='$url' rel='info'>"
	. typo($info['nom'])
	. "</a></h3>"
	. " <span class='version'>".$info['version']."</span>"
	. " <span class='etat'> - "
	. plugin_etat_en_clair($info['etat'])
	. "</span>"
	. "<div class='short'>".couper($desc,70)."</div>"
	. $i
	. "</div>";

}
Esempio n. 25
0
/**
 * Sélecteur de rubriques pour l'espace privé en mode classique (menu)
 *
 * @uses sous_menu_rubriques()
 * 
 * @param int $id_rubrique
 *     Identifiant de rubrique courante (0 si NEW)
 * @param string $type
 *     Type de l'objet à placer.
 * @param bool $restreint
 *     True pour indiquer qu'il faut limiter les rubriques affichées
 *     aux rubriques éditables par l'admin restreint
 * @param int $idem
 *     En mode rubrique, identifiant de soi-même
 * @return string
 *     Code HTML du sélecteur
**/
function selecteur_rubrique_html($id_rubrique, $type, $restreint, $idem = 0)
{
    $data = array();
    if ($type == 'rubrique' and autoriser('publierdans', 'rubrique', 0)) {
        $data[0] = _T('info_racine_site');
    } elseif ($type == 'auteur' or !$id_rubrique) {
        $data[0] = '&nbsp;';
    }
    //
    // creer une structure contenant toute l'arborescence
    //
    include_spip('base/abstract_sql');
    $q = sql_select("id_rubrique, id_parent, titre, statut, lang, langue_choisie", "spip_rubriques", $type == 'breve' ? ' id_parent=0 ' : '', '', "0+titre,titre");
    while ($r = sql_fetch($q)) {
        if (autoriser('voir', 'rubrique', $r['id_rubrique'])) {
            // titre largeur maxi a 50
            $titre = couper(supprimer_tags(typo($r['titre'])) . " ", 50);
            if ($GLOBALS['meta']['multi_rubriques'] == 'oui' and ($r['langue_choisie'] == "oui" or $r['id_parent'] == 0)) {
                $titre .= ' [' . traduire_nom_langue($r['lang']) . ']';
            }
            $data[$r['id_rubrique']] = $titre;
            $enfants[$r['id_parent']][] = $r['id_rubrique'];
            if ($id_rubrique == $r['id_rubrique']) {
                $id_parent = $r['id_parent'];
            }
        }
    }
    // si une seule rubrique comme choix possible,
    // inutile de mettre le selecteur sur un choix vide par defaut
    // sauf si le selecteur s'adresse a une rubrique puisque on peut la mettre a la racine dans ce cas
    if (count($data) == 2 and isset($data[0]) and !in_array($type, array('auteur', 'rubrique')) and !$id_rubrique) {
        unset($data[0]);
    }
    $opt = sous_menu_rubriques($id_rubrique, 0, 0, $data, $enfants, $idem, $restreint, $type);
    $att = " id='id_parent' name='id_parent'\nclass='selecteur_parent verdana1'";
    if (preg_match(',^<option[^<>]*value=.(\\d*).[^<>]*>([^<]*)</option>$,', $opt, $r)) {
        $r = "<input{$att} type='hidden' value='" . $r[1] . "' />" . $r[2];
    } else {
        $r = "<select" . $att . " size='1'>\n{$opt}</select>\n";
    }
    # message pour neuneus (a supprimer ?)
    #	if ($type != 'auteur' AND $type != 'breve')
    #		$r .= "\n<br />"._T('texte_rappel_selection_champs');
    return $r;
}
Esempio n. 26
0
function inserer_article_syndique($data, $now_id_syndic, $statut, $url_site, $url_syndic, $resume, $documents, &$faits)
{
    // Creer le lien s'il est nouveau - cle=(id_syndic,url)
    // On coupe a 255 caracteres pour eviter tout doublon
    // sur une URL de plus de 255 qui exloserait la base de donnees
    $le_lien = substr($data['url'], 0, 255);
    // si true, un lien deja syndique arrivant par une autre source est ignore
    // par defaut [false], chaque source a sa liste de liens, eventuellement
    // les memes
    define('_SYNDICATION_URL_UNIQUE', false);
    // Si false, on ne met pas a jour un lien deja syndique avec ses nouvelles
    // donnees ; par defaut [true] : on met a jour si le contenu a change
    // Attention si on modifie a la main un article syndique, les modifs sont
    // ecrasees lors de la syndication suivante
    define('_SYNDICATION_CORRECTION', true);
    // Chercher les liens de meme cle
    // S'il y a plusieurs liens qui repondent, il faut choisir le plus proche
    // (ie meme titre et pas deja fait), le mettre a jour et ignorer les autres
    $n = 0;
    $s = sql_select("id_syndic_article,titre,id_syndic,statut", "spip_syndic_articles", "url=" . sql_quote($le_lien) . (_SYNDICATION_URL_UNIQUE ? '' : " AND id_syndic={$now_id_syndic}") . " AND " . sql_in('id_syndic_article', $faits, 'NOT'), "", "maj DESC");
    while ($a = sql_fetch($s)) {
        $id = $a['id_syndic_article'];
        $id_syndic = $a['id_syndic'];
        if ($a['titre'] == $data['titre']) {
            $id_syndic_article = $id;
            break;
        }
        $n++;
    }
    // S'il y en avait qu'un, le prendre quel que soit le titre
    if ($n == 1) {
        $id_syndic_article = $id;
    } elseif (!isset($id_syndic_article)) {
        $champs = array('id_syndic' => $now_id_syndic, 'url' => $le_lien, 'date' => date("Y-m-d H:i:s", $data['date'] ? $data['date'] : $data['lastbuilddate']), 'statut' => $statut);
        // Envoyer aux plugins
        $champs = pipeline('pre_insertion', array('args' => array('table' => 'spip_syndic_articles'), 'data' => $champs));
        $ajout = $id_syndic_article = sql_insertq('spip_syndic_articles', $champs);
        if (!$ajout) {
            return;
        }
        pipeline('post_insertion', array('args' => array('table' => 'spip_syndic_articles', 'id_objet' => $id_syndic_article), 'data' => $champs));
    }
    $faits[] = $id_syndic_article;
    // Si le lien n'est pas nouveau, plusieurs options :
    if (!$ajout) {
        // 1. Lien existant : on corrige ou pas ?
        if (!_SYNDICATION_CORRECTION) {
            return;
        }
        // 2. Le lien existait deja, lie a un autre spip_syndic
        if (_SYNDICATION_URL_UNIQUE and $id_syndic != $now_id_syndic) {
            return;
        }
    }
    // Descriptif, en mode resume ou mode 'full text'
    // on prend en priorite data['descriptif'] si on est en mode resume,
    // et data['content'] si on est en mode "full syndication"
    if ($resume != 'non') {
        // mode "resume"
        $desc = strlen($data['descriptif']) ? $data['descriptif'] : $data['content'];
        $desc = couper(trim_more(textebrut($desc)), 300);
    } else {
        // mode "full syndication"
        // choisir le contenu pertinent
        // & refaire les liens relatifs
        $desc = strlen($data['content']) ? $data['content'] : $data['descriptif'];
        $desc = liens_absolus($desc, $url_syndic);
    }
    // tags & enclosures (preparer spip_syndic_articles.tags)
    $tags = $data['enclosures'] ? $data['enclosures'] : '';
    # eviter les doublons (cle = url+titre) et passer d'un tableau a une chaine
    if ($data['tags']) {
        $vus = array();
        foreach ($data['tags'] as $tag) {
            $cle = supprimer_tags($tag) . extraire_attribut($tag, 'href');
            $vus[$cle] = $tag;
        }
        $tags .= ($tags ? ', ' : '') . join(', ', $vus);
    }
    // Mise a jour du contenu (titre,auteurs,description,date?,source...)
    $vals = array('titre' => $data['titre'], 'lesauteurs' => $data['lesauteurs'], 'descriptif' => $desc, 'lang' => substr($data['lang'], 0, 10), 'source' => substr($data['source'], 0, 255), 'url_source' => substr($data['url_source'], 0, 255), 'tags' => $tags);
    // Mettre a jour la date si lastbuilddate
    if ($data['lastbuilddate']) {
        $vals['date'] = date("Y-m-d H:i:s", $data['lastbuilddate']);
    }
    sql_updateq('spip_syndic_articles', $vals, "id_syndic_article={$id_syndic_article}");
    // Point d'entree post_syndication
    pipeline('post_syndication', array('args' => array('table' => 'spip_syndic_articles', 'id_objet' => $id_syndic_article, 'url' => $le_lien, 'id_syndic' => $now_id_syndic, 'ajout' => $ajout), 'data' => $data));
    return $ajout;
}
Esempio n. 27
0
function vignette_automatique($img, $doc, $lien, $x = 0, $y = 0, $align = '', $class = 'spip_logos')
{
    include_spip('inc/distant');
    include_spip('inc/texte');
    include_spip('inc/filtres_images_mini');
    $e = $doc['extension'];
    if (!$img) {
        if ($img = image_du_document($doc)) {
            if (!$x and !$y) {
                // eviter une double reduction
                $img = image_reduire($img);
            }
        } else {
            $f = charger_fonction('vignette', 'inc');
            $img = $f($e, false);
            $size = @getimagesize($img);
            $img = "<img src='{$img}' " . $size[3] . " />";
        }
    } else {
        $size = @getimagesize($img);
        $img = "<img src='{$img}' " . $size[3] . " />";
    }
    // on appelle image_reduire independamment de la presence ou non
    // des librairies graphiques
    // la fonction sait se debrouiller et faire de son mieux dans tous les cas
    if ($x or $y) {
        $img = image_reduire($img, $x, $y);
    }
    $img = inserer_attribut($img, 'alt', '');
    $img = inserer_attribut($img, 'class', $class);
    if ($align) {
        $img = inserer_attribut($img, 'align', $align);
    }
    if (!$lien) {
        return $img;
    }
    $titre = supprimer_tags(typo($doc['titre']));
    $titre = " - " . taille_en_octets($doc['taille']) . ($titre ? " - {$titre}" : "");
    $type = sql_fetsel('titre, mime_type', 'spip_types_documents', "extension = " . sql_quote($e));
    $mime = $type['mime_type'];
    $titre = attribut_html(couper($type['titre'] . $titre, 80));
    return "<a href='{$lien}' type='{$mime}' title='{$titre}'>{$img}</a>";
}
function BOUCLE_articles_edito2html_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'] = 'articles';
        $command['id'] = '_articles_edito2';
        $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", "articles.titre", "articles.id_article", "articles.id_rubrique", "articles.descriptif", "articles.chapo", "articles.texte", "articles.lang");
        $command['orderby'] = array('articles.date DESC');
        $command['join'] = array('L1' => array('articles', 'id_objet', 'id_article', 'L1.objet=' . sql_quote('article')), 'L2' => array('L1', 'id_mot'));
        $command['limit'] = '0,10';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), !(is_array(@$Pile[0]['lang']) ? count(@$Pile[0]['lang']) : strlen(@$Pile[0]['lang'])) ? '' : (is_array(@$Pile[0]['lang']) ? sql_in('articles.lang', sql_quote($in)) : array('=', 'articles.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', '_articles_edito2', 60, $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_article'], 'article', '', '', true))) . '">' . $t1 . '</a></h3>' : '') . '
	  ' . (($t1 = strval(filtrer('image_graver', filtrer('image_reduire', strlen($logo = !is_array($l = quete_logo('id_article', 'ON', $Pile[$SP]['id_article'], $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_article'], 'article', '', '', true))) . '">' . $logo . '</a>' : '', '150', '0')))) !== '' ? '<div class="logo-liste-art">
		' . $t1 . '
	  </div>' : '') . '

	  ' . (($t1 = strval(interdire_scripts(propre($Pile[$SP]['descriptif'], $connect, $Pile[0]) ? (($t2 = strval(interdire_scripts(propre($Pile[$SP]['descriptif'], $connect, $Pile[0])))) !== '' ? '<div class="">' . $t2 . '</div>' : '') . '
		' : interdire_scripts(propre($Pile[$SP]['chapo'], $connect, $Pile[0]) ? (($t3 = strval(interdire_scripts(propre($Pile[$SP]['chapo'], $connect, $Pile[0])))) !== '' ? '<div class="">' . $t3 . '</div>' : '') . '
      		' : (($t3 = strval(interdire_scripts(couper(propre($Pile[$SP]['texte'], $connect, $Pile[0]), '300')))) !== '' ? '<div class="">' . $t3 . '</div>' : '') . '
		') . '
	'))) !== '' ? '<div class="chapo">' . $t1 . ('	<div class="suite"><a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '" title="...' . _T('public|spip|ecrire:suite') . ' : ' . interdire_scripts(attribut_html(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])))) . '" >' . _T('public|spip|ecrire:suite') . '</a></div>
	</div><!-- fin chapo -->') : '') . '

	';
            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_edito2 @ squelettes/inc/inc-sommaire-edito.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;
}
Esempio n. 30
0
function affiche_mots_ressemblant($cherche_mot, $objet, $id_objet, $resultat, $table, $table_id, $url_base)
{
	$les_mots = sql_in('id_mot', $resultat);
	$res = sql_allfetsel("*", "spip_mots", $les_mots, "", "titre", "17");

	foreach ($res as $k => $row) {
		$id_mot = $row['id_mot'];
		$titre = $row['titre'];
		$type = typo($row['type']);
		$descriptif = $row['descriptif'];

		$res[$k]= ajax_action_auteur('editer_mots', "$id_objet,,$table,$table_id,$objet,$id_mot", $url_base, "$table_id=$id_objet", array(typo($titre),' title="' . _T('info_ajouter_mot') .'"'),"&id_objet=$id_objet&objet=$objet") .
		  (!$descriptif ? '' : ("\n(<span class='spip_xx-small'>".supprimer_tags(couper(propre($descriptif), 100)).")</span><br />\n"));

	}

	$res2 = ($type
		? "<strong>$type</strong>&nbsp;: "
		: '' )
		. _T('info_plusieurs_mots_trouves', array('cherche_mot' => $cherche_mot))
		."<br />";

	if (count($resultat) > 17)
		$res2 .= "<br /><strong>" ._T('info_trop_resultat', array('cherche_mot' => $cherche_mot)) ."</strong><br />\n";

	return $res2 . '<ul><li>' . join("</li>\n<li>", $res) . '</li></ul>';
}