Example #1
0
function configuration_langue_dist()
{
 $l_site = $GLOBALS['meta']['langue_site'];
 $langue_site = traduire_nom_langue($l_site);

 $res = "<option value='$l_site' selected='selected'>$langue_site</option>\n";
 
 foreach (explode(",",$GLOBALS['meta']['langues_proposees']) as $l) {
	if ($l <> $l_site)
		$res .= "<option value='$l'>".traduire_nom_langue($l)."</option>\n";
 }

 $res = ajax_action_post('configurer',
			 'langue',
			 'config_lang', '',
			 "<label for='changer_langue_site'>" .
			 _T('info_langue_principale') .
			 "</label>" .
			 " : <select name='changer_langue_site' id='changer_langue_site'>\n$res</select>\n",
			 '');

 $res =  debut_cadre_couleur("langues-24.gif", true, "", _T('info_langue_principale') . "&nbsp;:&nbsp;" . $langue_site) .
	   _T('texte_selection_langue_principale') .
	  $res .
	   fin_cadre_couleur(true);

 return ajax_action_greffe("configurer-langue", '', $res);
}
Example #2
0
function affiche_stats_lang($critere)
{
    global $spip_lang_right;
    $taille = 450;
    //
    // Statistiques par langue
    //
    $out = "";
    $r = sql_fetsel("SUM({$critere}) AS total_visites", "spip_articles");
    $visites = 1;
    // attention a '0.0'
    if ($r and $r['total_visites'] > 0) {
        $total_visites = $r['total_visites'];
    } else {
        $total_visites = 1;
    }
    $result = sql_select("lang, SUM(" . $critere . ") AS cnt", "spip_articles", "statut='publie' ", "lang");
    $out .= "\n<table cellpadding='2' cellspacing='0' border='0' width='100%' style='border: 1px solid #aaaaaa;'>";
    $ifond = 1;
    $visites_abs = 0;
    while ($row = sql_fetch($result)) {
        $lang = $row['lang'];
        if ($row['cnt']) {
            $visites = round($row['cnt'] / $total_visites * $taille);
            $pourcent = round($row['cnt'] / $total_visites * 100);
        }
        if ($visites > 0) {
            if ($ifond == 0) {
                $ifond = 1;
                $couleur = "white";
            } else {
                $ifond = 0;
                $couleur = "eeeeee";
            }
            $out .= "\n<tr style='background-color: {$couleur}'>";
            $dir = lang_dir($lang, '', ' dir="rtl"');
            $out .= "<td style='width: 100%; border-bottom: 1px solid #cccccc;'><p {$dir}><span style='float: {$spip_lang_right};'>{$pourcent}%</span>" . traduire_nom_langue($lang) . "</p></td>";
            $out .= "<td style='border-bottom: 1px solid #cccccc;'>";
            $out .= "\n<table cellpadding='0' cellspacing='0' border='0' width='" . ($taille + 5) . "'>";
            $out .= "\n<tr><td style='align:{$spip_lang_right}; background-color: #eeeeee; border: 1px solid #999999; white-space: nowrap;'>";
            if ($visites_abs > 0) {
                $out .= "<img src='" . chemin_image('rien.gif') . "' width='{$visites_abs}' height='10' alt=' ' />";
            }
            if ($visites > 0) {
                $out .= "<img src='" . chemin_image('rien.gif') . "' class='couleur_langue' style='border: 0px;' width='{$visites}' height='8' alt=' ' />";
            }
            $out .= "</td></tr></table>\n";
            $out .= "</td>";
            $out .= "</tr>";
            $visites_abs += $visites;
        }
    }
    $out .= "</table>\n";
    return $out;
}
Example #3
0
function afficher_langues_choix($langues, $name, $id, $selected)
{
    include_spip('inc/lang');
    $ret = '';
    sort($langues);
    foreach ($langues as $l) {
        $checked = $l == $selected ? ' checked=\'checked\'' : '';
        $ret .= "<div class='choix'>" . "<input type='radio' name='{$name}' id='{$id}_{$l}' value='{$l}'{$checked} />" . "<label for='{$id}_{$l}'>" . traduire_nom_langue($l) . "</label>" . "</div>";
    }
    return $ret;
}
Example #4
0
function inc_plonger_dist($id_rubrique, $idom = "", $list = array(), $col = 1, $exclu = 0, $do = 'aff')
{
    global $spip_lang_left;
    if ($list) {
        $id_rubrique = $list[$col - 1];
    }
    $ret = '';
    # recherche les filles et petites-filles de la rubrique donnee
    # en excluant une eventuelle rubrique interdite (par exemple, lorsqu'on
    # deplace une rubrique, on peut la deplacer partout a partir de la
    # racine... sauf vers elle-meme ou sa propre branche)
    $ordre = array();
    $rub = array();
    $res = sql_select("rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant", "spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)", "rub1.id_parent = " . sql_quote($id_rubrique) . "\n\t\t\tAND rub1.id_rubrique!=" . sql_quote($exclu) . "\n\t\t\tAND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=" . sql_quote($exclu) . ")", "", "0+rub1.titre,rub1.titre");
    while ($row = sql_fetch($res)) {
        if (autoriser('voir', 'rubrique', $row['id_rubrique'])) {
            $rub[$row['id_rubrique']]['enfants'] = $row['id_enfant'];
            if ($row['id_parent'] == $id_rubrique) {
                $t = trim(typo(supprimer_numero($row['titre'])));
                if ($row['langue_choisie'] != 'oui') {
                    $t .= ' <small title="' . traduire_nom_langue($row['lang']) . '">[' . $row['lang'] . ']</small>';
                }
                $ordre[$row['id_rubrique']] = $t;
            }
        }
    }
    $next = isset($list[$col]) ? $list[$col] : 0;
    if ($ordre) {
        $rec = generer_url_ecrire('plonger', "rac={$idom}&exclus={$exclu}&do={$do}&col=" . ($col + 1));
        $info = generer_url_ecrire('informer', "type=rubrique&rac={$idom}&do={$do}&id=");
        $args = "'{$idom}',this,{$col},'{$spip_lang_left}','{$info}',event";
        while (list($id, $titrebrut) = each($ordre)) {
            $titre = supprimer_numero($titrebrut);
            $classe1 = $id_rubrique ? 'petite-rubrique' : "petit-secteur";
            if (isset($rub[$id]["enfants"])) {
                $classe2 = " class='rub-ouverte'";
                $url = "\nhref='{$rec}&amp;id={$id}'";
            } else {
                $classe2 = $url = '';
                $url = "\nhref='javascript:void(0)'";
            }
            $js_func = $do . '_selection_titre';
            $click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn " . (!is_array($list) ? ' false' : "aff_selection_provisoire({$id},{$args})") . "\"\nondblclick=\"" . "{$js_func}(this." . "firstChild.nodeValue," . $id . ",'selection_rubrique','id_parent');" . "\nreturn aff_selection_provisoire({$id},{$args});" . "\"";
            $ret .= "<div class='" . ($id == $next ? "item on" : "item") . "'><div class='" . $classe1 . "'><div{$classe2}><a" . $url . $click . ">" . $titre . "</a></div></div></div>";
        }
    }
    $idom2 = $idom . "_col_" . ($col + 1);
    $left = $col * 150;
    return http_img_pack("searching.gif", "*", "style='visibility: hidden; position: absolute; {$spip_lang_left}: " . ($left - 30) . "px; top: 2px; z-index: 2;' id='img_{$idom2}'") . "<div style='width: 150px; height: 100%; overflow: auto; position: absolute; top: 0px; {$spip_lang_left}: " . ($left - 150) . "px;'>" . $ret . "\n</div>\n<div id='{$idom2}'>" . ($next ? inc_plonger_dist($id_rubrique, $idom, $list, $col + 1, $exclu) : "") . "\n</div>";
}
Example #5
0
function formulaires_configurer_langue_charger_dist()
{
    $valeurs = array();
    include_spip('inc/lang');
    $l_site = $GLOBALS['meta']['langue_site'];
    $langue_site = traduire_nom_langue($l_site);
    $langues = explode(",", $GLOBALS['meta']['langues_proposees']);
    if (!in_array($l_site, $langues)) {
        $langues[] = $l_site;
    }
    sort($langues);
    $res = "";
    foreach ($langues as $l) {
        $res .= "<option value='{$l}'" . ($l == $l_site ? " selected='selected'" : "") . ">" . traduire_nom_langue($l) . "</option>\n";
    }
    $valeurs = array('_langues' => $res, '_langue_site' => $langue_site, 'changer_langue_site' => '');
    return $valeurs;
}
function html_9491858aea5af6033788aa1936ebca8d($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0)
{
    if (isset($Pile[0]["doublons"]) and is_array($Pile[0]["doublons"])) {
        $doublons = nettoyer_env_doublons($Pile[0]["doublons"]);
    }
    $connect = '';
    $page = '

' . (($t1 = BOUCLE_langueshtml_9491858aea5af6033788aa1936ebca8d($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? '
	<div id="menu-lang">
		<span class="structure">' . _T('public|spip|ecrire:info_langues') . ' : </span>
		' . (($t3 = strval(traduire_nom_langue(spip_htmlentities(@$Pile[0]['lang'] ? @$Pile[0]['lang'] : $GLOBALS['spip_lang'])))) !== '' ? '<strong class="langue_contexte">' . $t3 . '</strong>' : '') . '
' . $t1 . '
	</div>
' : '') . '

';
    return analyse_resultat_skel('html_9491858aea5af6033788aa1936ebca8d', $Cache, $page, 'squelettes/inc/inc-bas_menu-lang.html');
}
Example #7
0
function afficher_raccourcis($module = "public") {
	global $spip_lang;
	
	charger_langue($spip_lang, $module);

	$tableau = $GLOBALS['i18n_' . $module . '_' . $spip_lang];
	ksort($tableau);

	$aff_nom_module= "";
	if ($module != "public" AND $module != "local")
		$aff_nom_module = "$module:";

	echo "<div class='arial2'>"._T('module_texte_explicatif')."</div>";
	echo "<div>&nbsp;</div>";

	foreach (preg_files(repertoire_lang().$module.'_[a-z_]+\.php[3]?$') as $f)
		if (preg_match(",^".$module."\_([a-z_]+)\.php[3]?$,", $f, $regs))
				$langue_module[$regs[1]] = traduire_nom_langue($regs[1]);

	if (isset($langue_module) && ($langue_module)) {
		ksort($langue_module);
		echo "<div class='arial2'>"._T('module_texte_traduction',
			array('module' => $module));
		echo " ".join(", ", $langue_module).".";
		echo "</div><div>&nbsp;</div>";
	}

	echo debut_cadre_relief('',true,'','','raccourcis');
	echo "\n<table class='spip' style='border:0;'>";
	echo "\n<tr class='titrem'><th class='verdana1'>"._T('module_raccourci')."</th>\n<th class='verdana2'>"._T('module_texte_affiche')."</th></tr>\n";

	$i = 0;
	foreach ($tableau as $raccourci => $val) {
		$bgcolor = alterner(++$i, 'row_even','row_odd');
		echo "\n<tr class='$bgcolor'><td class='verdana2'><b>&lt;:$aff_nom_module$raccourci:&gt;</b></td>\n<td class='arial2'>".$val."</td></tr>";
	}

	echo "</table>",fin_cadre_relief(true);
}
Example #8
0
function selecteur_rubrique_html($id_rubrique, $type, $restreint, $idem=0) {
	$data = array();
	if ($type == 'rubrique')
		$data[0] = _T('info_racine_site');
	if ($type == 'auteur')
		$data[0] = '&nbsp;'; # premier choix = neant (rubriques restreintes)

	//
	// creer une structure contenant toute l'arborescence
	//

	include_spip('base/abstract_sql');
	$where = array();
	if ($type == 'breve')
		$where[]= ' id_parent=0 ';
	if (is_array($restreint) AND $restreint)
		$where[]= sql_in('id_rubrique', $restreint);

	$q = sql_select("id_rubrique, id_parent, titre, statut, lang, langue_choisie", "spip_rubriques", join(' AND ', $where), '', "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'];
		}
	}


	$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;
}
Example #9
0
function tw_traiter_raccourci_lien_atts($texte)
{
    $bulle = $hlang = '';
    // title et hreflang donnes par le raccourci ?
    if (strpbrk($texte, "|{") !== false and preg_match(_RACCOURCI_ATTRIBUTS, $texte, $m)) {
        $n = count($m);
        // |infobulle ?
        if ($n > 2) {
            $bulle = $m[3];
            // {hreflang} ?
            if ($n > 4) {
                // si c'est un code de langue connu, on met un hreflang
                if (traduire_nom_langue($m[5]) != $m[5]) {
                    $hlang = $m[5];
                } elseif (!$m[5]) {
                    $hlang = test_espace_prive() ? $GLOBALS['lang_objet'] : $GLOBALS['spip_lang'];
                    // sinon c'est un italique
                } else {
                    $m[1] .= $m[4];
                }
                // S'il n'y a pas de hreflang sous la forme {}, ce qui suit le |
                // est peut-etre une langue
            } else {
                if (preg_match('/^[a-z_]+$/', $m[3])) {
                    // si c'est un code de langue connu, on met un hreflang
                    // mais on laisse le title (c'est arbitraire tout ca...)
                    if (traduire_nom_langue($m[3]) != $m[3]) {
                        $hlang = $m[3];
                    }
                }
            }
        }
        $texte = $m[1];
    }
    return array(trim($texte), $bulle, $hlang);
}
Example #10
0
function statistiques_lang_ok()
{
	global $spip_ecran, $spip_lang_right;

	$commencer_page = charger_fonction('commencer_page', 'inc');
	echo $commencer_page(_T('onglet_repartition_lang'), "statistiques_visites", "repartition-langues");

	if ($spip_ecran == "large") {
		$largeur_table = 974;
	} else {
		$largeur_table = 750;
	}
	$taille = $largeur_table - 200;	
	echo "<table class='centered' width='$largeur_table'><tr><td style='width: $largeur_table" . "px; text-align:center;' class='verdana2'>";
	echo "<br /><br />";

	echo gros_titre(_T('onglet_repartition_lang'),'', false);

//barre_onglets("repartition", "langues");

	if (_request('critere') == "debut") {
		$critere = "visites";
//	echo gros_titre(_T('onglet_repartition_debut','', false));	
	} else {
		$critere = "popularite";
//	echo gros_titre(_T('onglet_repartition_actuelle','', false));	
}

	echo ($critere == "popularite") ? barre_onglets("rep_depuis", "popularite"): barre_onglets("rep_depuis", "debut");


//
// Statistiques par langue
//


	echo debut_cadre_enfonce("langues-24.gif", true);

	$r = sql_fetsel("SUM($critere) AS total_visites", "spip_articles");

	$visites = 1;
	if ($r)
		$total_visites = $r['total_visites'];
	else
		$total_visites = 1;

	$result = sql_select("lang, SUM(".$critere.") AS cnt", "spip_articles", "statut='publie' ", "lang");
		
	$ifond = 1;
	$visites_abs = 0;
	$res = '';
	while ($row = sql_fetch($result)) {

		$lang = $row['lang'];
		$visites = round($row['cnt'] / $total_visites * $taille);
		$pourcent = round($row['cnt'] / $total_visites * 100);

		if ($visites > 0) {

				if ($ifond==0){
					$ifond=1;
					$couleur="white";
				}else{
					$ifond=0;
					$couleur="eeeeee";
				}
	
				$res .= "\n<tr style='background-color: $couleur'>";
				$dir=lang_dir($lang,'',' dir="rtl"');
				$res .= "<td style='width: 100%; border-bottom: 1px solid #cccccc;'><span class='verdana2'$dir><span style='float: $spip_lang_right;'>$pourcent%</span>".traduire_nom_langue($lang)."</span></td>";
				
				$res .= "<td style='border-bottom: 1px solid #cccccc;'>";
				$res .= "\n<table cellpadding='0' cellspacing='0' border='0' width='".($taille+5)."'>";
				$res .= "\n<tr><td style='align:$spip_lang_right; background-color: #eeeeee; border: 1px solid #999999; white-space: nowrap;'>";
				if ($visites_abs > 0) $res .= "<img src='" . chemin_image('rien.gif') . "' width='$visites_abs' height='8' alt=' ' />";
				if ($visites>0) $res .= "<img src='" . chemin_image('rien.gif') . "' class='couleur_langue' style='border: 0px;' width='$visites' height='8' alt=' ' />";
				$res .= "</td></tr></table>\n";
	
				$res .= "</td>";
				$res .= "</tr>";
				$visites_abs += $visites;
		}
	}
	if ($res)
		echo "\n<table cellpadding='2' cellspacing='0' border='0' width='100%' style='border: 1px solid #aaaaaa;'>", $res, "</table>\n";


//echo "<p><span class='verdana1 spip_medium'>"._T('texte_signification')."</span>";

	echo fin_cadre_enfonce(true);

	echo "</td></tr></table>";
	echo fin_page();
}
Example #11
0
function exec_suivi_revisions_dist()
{
	$debut = intval(_request('debut'));
	$lang_choisie = _request('lang_choisie');
	$id_auteur = intval(_request('id_auteur'));
	$id_secteur = intval(_request('id_secteur'));

	$nom_auteur = $GLOBALS['visiteur_session']['nom'];
	$connecte = $GLOBALS['visiteur_session']['id_auteur'];
	//if ($id_auteur == $connecte) $id_auteur = false;

	$commencer_page = charger_fonction('commencer_page', 'inc');
	echo $commencer_page(_T("icone_suivi_revisions"));

	echo debut_gauche('', true);

	if (autoriser('voir', 'article'))
	  $req_where = sql_in('articles.statut', array('prepa','prop','publie')); 
	else $req_where = sql_in('articles.statut', array('prop','publie')); 

	echo debut_cadre_relief('', true);

	echo "<div class='arial11'><ul>";

	if (!$id_auteur AND $id_secteur < 1) echo "\n<li><b>"._T('info_tout_site')."</b></li>";
	else echo "\n<li><a href='" . generer_url_ecrire("suivi_revisions") . "'>"._T('info_tout_site')."</a></li>";


	if ($id_auteur) echo "\n<li><b>$nom_auteur</b></li>";
	else echo "\n<li><a href='" . generer_url_ecrire("suivi_revisions","id_auteur=$connecte") . "'>$nom_auteur</a></li>";

	if (($GLOBALS['meta']['multi_rubriques'] == 'oui') OR ($GLOBALS['meta']['multi_articles'] == 'oui'))
		$langues = explode(',', $GLOBALS['meta']['langues_multilingue']);
	else
		$langues = array();

	$result = sql_select("id_rubrique, titre", "spip_rubriques", 'id_parent=0','', '0+titre,titre');

	while ($row = sql_fetch($result)) {
		$id_rubrique = $row['id_rubrique'];
		$titre = typo($row['titre']);

		if ($id_rubrique == $id_secteur)  echo "\n<li><b>$titre</b>";
		else {
		  if (sql_countsel('spip_versions AS versions LEFT JOIN spip_articles AS articles ON versions.id_article = articles.id_article', "versions.id_version > 1 AND articles.id_secteur=$id_rubrique AND $req_where"))
		    echo "\n<li><a href='" . generer_url_ecrire("suivi_revisions","id_secteur=$id_rubrique") . "'>$titre</a></li>";
		}
	}
	foreach ($langues as $lang) {
		$titre = traduire_nom_langue($lang);

		if ($lang == $lang_choisie)  echo "\n<li><b>$titre</b></li>";
		else {
			$n = sql_countsel('spip_versions AS versions LEFT JOIN spip_articles AS articles ON versions.id_article = articles.id_article', "versions.id_version > 1 AND articles.lang='$lang' AND $req_where");
			if ($n) echo "\n<li><a href='" . generer_url_ecrire("suivi_revisions","lang_choisie=$lang") . "'>$titre</a></li>";
		}
	}
	echo "</ul></div>\n";

// lien vers le rss

	$args = array('id_secteur' => $id_secteur);
	if ($id_auteur) {
		$args['id_auteur'] = $id_auteur;
		$args['statut'] = 'prepa';
	}

	echo bouton_spip_rss('revisions', $args, $lang_choisie);

	echo fin_cadre_relief(true);

	echo debut_droite("", true);
	echo afficher_suivi_versions($debut, $id_secteur, $id_auteur, $lang_choisie);
	echo fin_gauche(), fin_page();
}
Example #12
0
function inc_formater_article_dist($row, $own='')
{
	global $spip_lang_right, $spip_display;
	static $pret = false;
	static $chercher_logo, $img_admin, $formater_auteur, $nb, $langue_defaut, $afficher_langue, $puce_statut;

	$id_article = $row['id_article'];

	if (!autoriser('voir','article',$id_article)) return '';

	if (!$pret) {
		$chercher_logo = ($spip_display != 1 AND $spip_display != 4 AND $GLOBALS['meta']['image_process'] != "non");
		if ($chercher_logo) 
			$chercher_logo = charger_fonction('chercher_logo', 'inc');
		$formater_auteur = charger_fonction('formater_auteur', 'inc');
		$img_admin = http_img_pack("admin-12.gif", "", " width='12' height='12'", _T('titre_image_admin_article'));

		if (($GLOBALS['meta']['multi_rubriques'] == 'oui' AND (!isset($GLOBALS['id_rubrique']))) OR $GLOBALS['meta']['multi_articles'] == 'oui') {
			$afficher_langue = true;
			$langue_defaut = !isset($GLOBALS['langue_rubrique'])
			  ? $GLOBALS['meta']['langue_site']
			  : $GLOBALS['langue_rubrique'];
		}
		$puce_statut = charger_fonction('puce_statut', 'inc');
		$pret = true;
	}

	if ($chercher_logo) {
		if ($logo = $chercher_logo($id_article, 'id_article', 'on')) {
			list($fid, $dir, $nom, $format) = $logo;
			include_spip('inc/filtres_images_mini');
			$logo = "<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>" .
			  image_reduire("<img src='$fid' alt='' />", 26, 20) .
			  "</span>";
		} else $logo = '';
	} else $logo ='';

	$titre = supprime_img($row['titre'],'');
	$id_rubrique = $row['id_rubrique'];
	$date = $row['date'];
	$statut = $row['statut'];
	$descriptif = $row['descriptif'];
	$lang = $row['lang'];
	$dir = "dir='" . lang_dir($lang ? changer_typo($lang) : '') . "'";
	if ($lang AND $afficher_langue AND $lang != $GLOBALS['meta']['langue_site'])
		$lang = " <span class='spip_xx-small' style='color: #666666' "
		  . $dir
		  . '>('
		  . traduire_nom_langue($lang)
		  . ')</span>';
	else $lang = '';

	$arg = "id_article=$id_article";
	$url_a = generer_url_ecrire("articles", $arg);
	if (!$row['petition'])
		$petition = '';
	else
		$petition = " <a href='" . generer_url_ecrire('controle_petition', $arg) . "' class='spip_xx-small' style='color: red'>"._T('lien_petitions') . "</a>";

	$lien = "<div>"
	. $logo
	. (acces_restreint_rubrique($id_rubrique) ? $img_admin : '')
	. "<a href='"
	. $url_a
	. "'"
	. (!$descriptif ? '': (' title="'.attribut_html(typo($descriptif)).'"'))
	. " $dir>"
	. typo(strlen($titre) ? $titre : _T('ecrire:info_sans_titre'))
	. "</a>"
	. $lang
	. $petition
	. "</div>";
	
	if ($spip_display == 4) return array($lien);

	$puce = $puce_statut($id_article, $statut, $id_rubrique,'article');

	$auteurs = auteurs_article($id_article); 
	foreach ($auteurs as $k => $r) {
		list(, $mail, $nom,,) = $formater_auteur($r['id_auteur']);
		$auteurs[$k]= "$mail&nbsp;$nom";
	}

	$date = affdate_jourcourt($date);
	if (!$date) $date = '&nbsp;';

	$num = afficher_numero_edit($id_article, 'id_article', 'article');

	// Afficher le numero (JMB)

	return array($puce, $lien, join('<br />', $auteurs), $date, $num);
}
Example #13
0
function articles_traduction($row, $id_article)
{
	global $connect_toutes_rubriques;

	$vals = array();
	$id_rubrique_trad = $row["id_rubrique"];
	$id_article_trad = $row["id_article"];
	$id_trad = $row["id_trad"];
	$titre_trad = $row["titre"];
	$lang_trad = $row["lang"];
	$statut_trad = $row["statut"];

	changer_typo($lang_trad);
	$lang_dir = lang_dir($lang_trad);
	$titre_trad = "<span dir='$lang_dir'>$titre_trad</span>";

	$puce_statut = charger_fonction('puce_statut', 'inc');
	$vals[] = $puce_statut($id_article_trad, $statut_trad, $id_rubrique_trad, 'article');
		
	if ($id_article_trad == $id_trad) {
			$vals[] = http_img_pack('langues-12.gif', "", " class='lang'");
			$titre_trad = "<b>$titre_trad</b>";
	} else {
		if (!$connect_toutes_rubriques)
			$vals[] = http_img_pack('langues-off-12.gif', "", " class='lang'");
		else 
		    $vals[] = ajax_action_auteur("referencer_traduction", "$id_article,$id_trad,$id_article_trad", 'articles', "id_article=$id_article", array(http_img_pack('langues-off-12.gif', _T('trad_reference'), "class='lang'"), ' title="' . _T('trad_reference') . '"'));
	}

	$s = typo(supprime_img($titre_trad,''));
	if ($id_article_trad != $id_article) 
			$s = "<a href='" . generer_url_ecrire("articles","id_article=$id_article_trad") . "'>$s</a>";
	if ($id_article_trad == $id_trad)
			$s .= " "._T('trad_reference');

	$vals[] = $s;
	$vals[] = traduire_nom_langue($lang_trad);
	return $vals;
}
Example #14
0
function inc_barre_langues_dist($id_article){
	include_spip('inc/config');
	include_spip('inc/actions');
	if(!function_exists('icone_verticale')) {
	       include_spip('inc/presentation');
	   }	
	$row = sql_fetsel("*", "spip_articles", "id_article=$id_article");
		
	$id_rubrique = $row['id_rubrique'];
	$id_trad = $row["id_trad"];
		
	$virtuel = (strncmp($row["chapo"],'=',1)!==0) ? '' :
	chapo_redirige(substr($row["chapo"], 1));
		
	$objet='article';	
	
	//création des onglets traduction
	
	// Les langues du site ou si restreint celle définis par config
	
	$langues_dispos=lire_config('taa/utiliser_langues')?lire_config('taa/utiliser_langues'):explode(',',lire_config('langues_multilingue'));

	
	// On établit les traductions de l'article
	$traductions	= array();
	
	if($langues_dispos){	
		
	// L'article est traduit	
	if($id_trad>0){
	
		// les traductions de l'article
		$sql=sql_select('lang,id_article','spip_articles','id_trad='.$id_trad);
	
		while($row=sql_fetch($sql)){
			$traductions[$row['lang']]=$row['id_article'];
			}
		$clic = _T('trad_delier');	
		$options = '<div class="options delier ajax">'.icone_verticale($clic, redirige_action_auteur('traduction',$id_article.'-article-0',"article&amp;id_article=$id_article"), "traductions-24.gif", "supprimer.gif",'right', false).'</div>';		
		}
	// L'article n'est pas traduit	
	else{
		$id_trad=$id_article;
		$row=sql_fetsel('lang,id_article','spip_articles','id_article='.$id_article);
		
		// Seul l'aticle présent est pris dans l'array traductions
		$traductions[$row['lang']]=$row['id_article'];
		
		$options =  '<div class="options form_lier"><h2>'._T('taa:lier_traduction').'</h2>'.redirige_action_auteur("traduction",
			$id_article.'-article',
			"article",
			"id_article=$id_article",
			("<label for='lier_trad'>" . _T('trad_lier') . "</label>" .
			"\n<input type='text' class='fondl' name='lier_trad' id='lier_trad' size='5' />\n"),
			_T('bouton_valider'),
			" class='fondl'").'</div>';
		}
	
	// Pour chaque langue présente on crée un bouton
	
	// indique l'article par défaut
	$span_content='<div class="ref_article">*<span>'._T('spip:trad_reference').'</span></div>';	
	
	foreach($langues_dispos as $key => $value){
		$class='';
		$span='';	
		$trad='';

		// les boutons hors article présent
		if($traductions[$value]!=$id_article){
					
			//Si il existe une traduction dans une langue du site on crée le bouton avec le lien de l'article
			if(array_key_exists($value,$traductions)){
				// Article de référence?	
				if($traductions[$value]==$id_trad){
					$span=$span_content;					
					}
				$onglets_traduction.='<li class="traduit box_onglet ajax">'.$span.'<a href="'.generer_url_ecrire($objet,'id_article='.$traductions[$value]).'">'.traduire_nom_langue($value).'</a></li>';					
			}
			// Sinon on crée un nouvel article dans la langue souhaitée
			else{
				// Si le plugin traduction rubriques est activé on regarde si on trouve la rubrique traduite
				if ($trad_rub=test_plugin_actif('tradrub')) {
					$id_rubrique_traduite=rubrique_traduction($value,$id_rubrique);

					if($id_rubrique_traduite){
						$onglets_traduction.= '<li class="non_traduit box_onglet"><a href="'.generer_url_ecrire($objet.'_edit','new=oui&lier_trad='.$id_trad.'&id_rubrique='.$id_rubrique_traduite.'&lang_dest='.$value).'" title="'._T('ecrire:info_tout_site2').'">'.traduire_nom_langue($value).'</a></li>';
						}
					elseif(test_plugin_actif('trad_rub')){
                       
						$donnes_trad=destination_traduction($value,$id_rubrique,$creer_racine='');
						$parent_trad=$donnes_trad[0];
						$trad=$donnes_trad[1];
						
						$onglets_traduction.='<li class="non_traduit box_onglet"><a href="'.generer_url_ecrire('rubrique_edit','new=oui&id_parent='.$parent_trad.'&lang_dest='.$value.'&lier_trad='.$trad.'&trad_new='.$trad_new.'&retour=nav').'" class="avis_source" title="'._T('tra:avis_rubrique_source').'">'.traduire_nom_langue($value).'</a>';
						} 					
					
					$section='oui';

					}
				else{
					$onglets_traduction.= '<li class="non_traduit box_onglet"><a href="'.generer_url_ecrire($objet.'_edit','new=oui&lier_trad='.$id_trad.'&lang_dest='.$value).'" title="'._T('ecrire:info_tout_site2').'">'.traduire_nom_langue($value).'</a></li>';				
				}

				$action=redirige_action_auteur ('changer_langue',$id_article.'-'.$value,$objet,"id_article=$id_article");
				// Si le plugin traduction rubriques est activé on affiche pas les onglets changement de langue car la langue se change en modifiant la rubrique
				if(!$section){
					$changer_traduction.='<li class="item  lang box_onglet"><a href="'.parametre_url($action,'changer_lang',$value).'">'.traduire_nom_langue($value).'</a></li>';					
					}

				}
			}
		// le bouton de l'article présent	
		else{
			if($traductions[$value]==$id_trad){
					$span=$span_content;					
					}
			$onglets_traduction.='<li class="box_onglet"><strong class="on">'.$span.traduire_nom_langue($value).'</strong></li>';
			}
		}
	}

	$contexte=array(
		'onglets_traduction'=>$onglets_traduction,
		'options'=>$options,
		'langue_article'=>$langue_article,
		'changer_traduction'=>$changer_traduction,
		'edition_seule'=>$edition_seule,
		'id_article'=>$id_article,	
		'voir'=>_request('voir'),									
		);
		
		$retour=recuperer_fond('prive/editer/barre_traductions_article',$contexte,array('ajax'=>true));
	return $retour;
	
}
Example #15
0
function init_body($rubrique='accueil', $sous_rubrique='accueil', $id_rubrique='',$menu=true) {
	global $connect_id_auteur, $auth_can_disconnect;
	global $spip_display, $spip_ecran;

	if ($spip_ecran == "large") $largeur = 974; else $largeur = 750;

	$res = pipeline('body_prive',"<body class='ecrire $rubrique $sous_rubrique $spip_ecran "._request('exec')."'"
			. ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : "")
			.'>');

	if ($spip_display == "4") {
		$res .= "<ul>"
		. "\n<li><a href='" . generer_url_ecrire() ."'>"._T('icone_a_suivre')."</a></li>"
		. "\n<li><a href='" . generer_url_ecrire("naviguer") . "'>"._T('icone_edition_site')."</a></li>"
		. "\n<li><a href='" . generer_url_ecrire("forum"). "'>"._T('titre_forum')."</a></li>"
		. "\n<li><a href='" . generer_url_ecrire("auteurs") . "'>"._T('icone_auteurs')."</a></li>"
		. "\n<li><a href=\"".url_de_base()."\">"._T('icone_visiter_site')."</a></li>"
		. "</ul>";

		return $res;
	}
	if (!$menu) return $res;


	$items = "<div class='h-list centered vcentered' style='width:{$largeur}px'><ul>"
		. "<li id='bandeau_couleur1' class='bandeau_couleur'><div class='menu-item'>"
		.  installer_gadgets($id_rubrique)
		. "</div></li>"
		. "<li id='bandeau_couleur2' class='bandeau_couleur' style='width:"

	// Redacteur connecte
	// overflow pour masquer les noms tres longs
	// (et eviter debords, notamment en ecran etroit)

		//. "<div style='width: "
		. (($spip_ecran == "large") ? 300 : 110)
		. "px;'><div class='menu-item' style='width:"
    . (($spip_ecran == "large") ? 300 : 110)
    . "px; overflow: hidden;'>"
		. "<a href='"
		. generer_url_ecrire("auteur_infos","id_auteur=$connect_id_auteur")
		. "' class='icone26' title=\""
		. entites_html(_T('icone_informations_personnelles'))
		. '">'
		. typo($GLOBALS['visiteur_session']['nom'])
		. "</a></div></li>" 
	  	. "<li id='bandeau_couleur4' class='bandeau_couleur'><div class='menu-item'>";

		// couleurs
	$couleurs = charger_fonction('couleurs', 'inc');
	$items .= "<div id='preferences_couleurs'>";
	$items .= $couleurs() . "</div>";

	$items .= "</div></li>";

	// choix de la langue
	if ($i = menu_langues('var_lang_ecrire')) {
			$items .= "<li id='bandeau_couleur5' class='bandeau_couleur'><div class='menu-item'>"
			. (_request('lang')?$i:"<a href='".parametre_url(self(),'lang',$GLOBALS['spip_lang'])
			."' title='".attribut_html(_T('info_langues'))."'>"
			. traduire_nom_langue($GLOBALS['spip_lang'])
			."</a>")
			. "</div></li>";
	}

	$items .= "<li id='bandeau_couleur6' class='bandeau_couleur'><div class='menu-item'>";

	if ($auth_can_disconnect) {
			$alt=_T('icone_deconnecter');
			$items .= "<a href='".
			  generer_url_action("logout","logout=prive") .
			  "' class='icone26' onmouseover=\"changestyle('bandeaudeconnecter');\" onfocus=\"changestyle('bandeaudeconnecter');\" onblur=\"changestyle('bandeaudeconnecter');\">" .
			  http_img_pack("deconnecter-24.gif", "$alt", "width='26' height='20'") .
			  "</a>";
	}
	$items .= "</div></li>"
	  . "</ul></div>";

	// <div> pour la barre des gadgets
	// (elements invisibles qui s'ouvrent sous la barre precedente)

	$items .= bandeau_gadgets($largeur, true, $id_rubrique);

	$bandeau = charger_fonction('bandeau', 'inc');

	return $res 
		. "<div class='invisible_au_chargement' style='position: absolute; height: 0px; visibility: hidden;'><a href='oo'>"
		._T("access_mode_texte")
		."</a></div>"
		. "<div id='haut-page'>\n"
		.  $bandeau($rubrique, $sous_rubrique, $largeur)
		. "\n<div id='bandeau_couleur'>"
		.  $items
	  	.  "</div></div>\n";
}
Example #16
0
function traiter_raccourci_lien_atts($texte)
{
    $bulle = $hlang = false;
    // title et hreflang donnes par le raccourci ?
    if (strpbrk($texte, "|{") !== false and preg_match(_RACCOURCI_ATTRIBUTS, $texte, $m)) {
        $n = count($m);
        // |infobulle ?
        if ($n > 2) {
            $bulle = $m[3];
            // {hreflang} ?
            if ($n > 4) {
                // si c'est un code de langue connu, on met un hreflang
                if (traduire_nom_langue($m[5]) != $m[5]) {
                    $hlang = $m[5];
                } elseif (!$m[5]) {
                    $hlang = test_espace_prive() ? $GLOBALS['lang_objet'] : $GLOBALS['spip_lang'];
                    // sinon c'est un italique ou un gras dans le title ou dans le texte du lien
                } else {
                    if ($bulle) {
                        $bulle .= $m[4];
                    } else {
                        $m[1] .= $m[2] . $m[4];
                    }
                }
            } else {
                if (preg_match('/^[a-z_]+$/', $m[3])) {
                    // si c'est un code de langue connu, on met un hreflang
                    // mais on laisse le title (c'est arbitraire tout ca...)
                    if (traduire_nom_langue($m[3]) != $m[3]) {
                        $hlang = $m[3];
                    }
                }
            }
        }
        $texte = $m[1];
    }
    if ($bulle) {
        $bulle = nettoyer_raccourcis_typo($bulle);
        $bulle = corriger_typo($bulle);
    }
    return array(trim($texte), $bulle, $hlang);
}
function BOUCLE_secteurshtml_7b757a9211fae3c1871c26ec4415f046(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    if (!isset($command['table'])) {
        $command['table'] = 'rubriques';
        $command['id'] = '_secteurs';
        $command['from'] = array('rubriques' => 'spip_rubriques');
        $command['type'] = array();
        $command['groupby'] = array();
        $command['select'] = array("rubriques.id_rubrique", "rubriques.lang", "0+rubriques.titre AS num1", "rubriques.titre");
        $command['orderby'] = array('rubriques.lang DESC', 'num1', 'rubriques.titre');
        $command['join'] = array();
        $command['limit'] = '';
        $command['having'] = array();
    }
    $command['where'] = array(quete_condition_statut('rubriques.statut', '!', 'publie', ''), array('=', 'rubriques.id_parent', 0), array('=', 'rubriques.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/plan.html', 'html_7b757a9211fae3c1871c26ec4415f046', '_secteurs', 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']);
            $t0 .= '
			' . (($t1 = strval(traduire_nom_langue(unique(spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang'])), 'langues'))) !== '' ? '<h2>' . $t1 . '</h2>' : '') . '
				<div class="plan-archives" style="clear:both;">
				' . 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_logo_right spip_logos\" alt=\"\" style=\"float:right\" src=\"{$l['0']}\"" . $l[2] . ($l[1] ? " onmouseover=\"this.src='{$l['1']}'\" onmouseout=\"this.src='{$l['0']}'\"" : "") . ' />', '120', '0')) . '
				<h3><a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_rubrique'], 'rubrique', '', '', true))) . '">' . interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '</a></h3>
				</div>
				' . (($t1 = BOUCLE_articles_racinehtml_7b757a9211fae3c1871c26ec4415f046($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? '
				<ul>
					' . $t1 . '
				</ul>
				' : '') . '
					' . (($t1 = BOUCLE_rubriqueshtml_7b757a9211fae3c1871c26ec4415f046($Cache, $Pile, $doublons, $Numrows, $SP)) !== '' ? '
					<ul>
						' . $t1 . '
					</ul>
				' : '') . '
			';
            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_secteurs @ squelettes/plan.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
function BOUCLE_langueshtml_76ddbc2b5f1671bea60186a8fa5bb500(&$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' . 'contexte'])) {
        $doublons[$d] = '';
    }
    if (!isset($command['table'])) {
        $command['table'] = 'articles';
        $command['id'] = '_langues';
        $command['from'] = array('articles' => 'spip_articles');
        $command['type'] = array();
        $command['groupby'] = array();
        $command['select'] = array("articles.lang", "articles.id_article", "articles.titre");
        $command['orderby'] = array('articles.lang');
        $command['join'] = array();
        $command['limit'] = '';
        $command['having'] = array();
    }
    $command['where'] = array(array(sql_in('articles.id_article', $doublons[$doublons_index[] = 'articles' . 'contexte'], 'NOT')));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('squelettes/agenda.html', 'html_76ddbc2b5f1671bea60186a8fa5bb500', '_langues', 26, $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 .= ($t1 = strval(traduire_nom_langue(unique(spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang'])), 'lang'))) !== '' ? '
				<li 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']) . '" dir="' . lang_dir($Pile[$SP]['lang'], 'ltr', 'rtl') . '">
					<a href="spip.php?action=converser&amp;redirect=' . self() . '&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 . '</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_langues @ squelettes/agenda.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
Example #19
0
function afficher_articles_trad_boucle($row, $own='')
{
  	global $spip_lang_right, $spip_display;

	$id_article = $row['id_article'];
	if (!autoriser('voir','article',$id_article)) return '';

	$titre = $row['titre'];
	$id_rubrique = $row['id_rubrique'];
	$statut = $row['statut'];
	$id_trad = $row['id_trad'];
	$lang = $row['lang'];

	$lang_dir = lang_dir($GLOBALS['lang_objet']);
	$dates_art = $langues_art = array();
	$ligne = "";

	$res_trad = sql_select("id_article, lang, date_modif", "spip_articles", "id_trad = $id_trad AND id_trad > 0");

	while ($row_trad = sql_fetch($res_trad)) {
		$id_article_trad = $row_trad["id_article"];
		$lang_trad = $row_trad["lang"];
		$date = $row_trad['date_modif'];
		$dates_art[$lang_trad] = $date;
		$langues_art[$lang_trad] = $id_article_trad;
		if ($id_article_trad == $id_trad) $date_ref = $date;
	}

	// faudrait sortir ces invariants de boucle

	if (($GLOBALS['meta']['multi_rubriques'] == 'oui' AND (!isset($GLOBALS['id_rubrique']))) OR $GLOBALS['meta']['multi_articles'] == 'oui') {
			$langue_defaut = isset($GLOBALS['langue_rubrique'])
			  ? $GLOBALS['meta']['langue_site']
			  : $GLOBALS['langue_rubrique'];
			if ($lang != $langue_defaut)
				$afficher_langue = " <span class='spip_xx-small' style='color: #666666'  dir='$lang_dir'>(".traduire_nom_langue($lang).")</span>";
	} else $afficher_langue = '';

	foreach(explode(',', $GLOBALS['meta']['langues_multilingue']) as $k){
		if (isset($langues_art[$k]) AND $langues_art[$k]<> $id_trad){
			$h = generer_url_ecrire("articles", "id_article=".$langues_art[$k]);
			$style = strtotime($dates_art[$k]) < strtotime($date_ref);
			$style = $style ? 'claire' : 'foncee';
			$ligne .= "<a href='$h' class='$style'>$k</a>";
		}
	}

	if (acces_restreint_rubrique($id_rubrique))
		$img = http_img_pack("admin-12.gif", _T('titre_image_administrateur'), "width='12' height='12'", _T('titre_image_admin_article'));
	else $img = '';

	if (!$titre) $titre =  _T('ecrire:info_sans_titre');
	if ($id_article == $id_trad) $titre = "<b>$titre</b>";

	$h = generer_url_ecrire("articles", "id_article=$id_article");

	$titre = "\n<div>"
	  . $img
	  . "<a href='$h' dir='$lang_dir' style=\"display:block;\">"
	  . typo(supprime_img($titre,''))
	  . "</a></div>";

	if ($spip_display == 4) return array($ligne);

	$ligne .= "<a href='$h'><span class='lang_base'>$lang</span></a>";

	// La petite puce de changement de statut
	$puce_statut = charger_fonction('puce_statut', 'inc');
	$puce = $puce_statut($id_article, $statut, $id_rubrique,'article');

	return array($puce,
		      $titre,
		      $afficher_langue,
		      "<div style='float: $spip_lang_right; margin-right: -10px;'>"
		      . $ligne
		      . "</div>");
}
Example #20
0
function formulaire_affiche_tous($aff_art, $aff_statut,$sel_lang)
{
	global $spip_lang_left, $spip_lang_right, $spip_lang;
	
	$out = "\n<input type='hidden' name='aff_art[]' value='x' />\n"
	. "<b>"._T('titre_cadre_afficher_article')."&nbsp;:</b><br />\n";
	
	if (isset($aff_statut['prepa']) && $aff_statut['prepa'])
		$out .= http_label_img('prepa',
				    in_array('prepa', $aff_art),
				    'aff_art',
				    'puce-blanche-breve.gif',
				    _T('texte_statut_en_cours_redaction'));
	
	if (isset($aff_statut['prop']) && $aff_statut['prop'])
		$out .= http_label_img('prop',
				    in_array('prop', $aff_art),
				    'aff_art',
				    'puce-orange-breve.gif',
				    _T('texte_statut_attente_validation'));
		
	if (isset($aff_statut['publie']) && $aff_statut['publie'])
		$out .= http_label_img('publie',
				    in_array('publie', $aff_art),
				    'aff_art',
				    'puce-verte-breve.gif',
				    _T('texte_statut_publies'));
	
	if (isset($aff_statut['refuse']) && $aff_statut['refuse'])
		$out .= http_label_img('refuse',
				    in_array('refuse', $aff_art),
				    'aff_art',
				    'puce-rouge-breve.gif',
				    _T('texte_statut_refuses'));
	
	if (isset($aff_statut['poubelle']) && $aff_statut['poubelle'])
		$out .= http_label_img('poubelle',
				    in_array('poubelle', $aff_art),
				    'aff_art',
				    'puce-poubelle-breve.gif',
				    _T('texte_statut_poubelle'));
	
	$out .= "\n<div style='text-align: $spip_lang_right'><input type='submit' value='"._T('bouton_changer')."' /></div>";
	
	
	// GERER LE MULTILINGUISME
	if (($GLOBALS['meta']['multi_rubriques'] == 'oui' OR $GLOBALS['meta']['multi_articles'] == 'oui') AND $GLOBALS['meta']['gerer_trad'] == 'oui') {

		// bloc legende
		$lf = $GLOBALS['meta']['langue_site'];
		$out .= "<hr />\n<div class='verdana2'>";
		$out .= _T('info_tout_site6');
		$out .= "\n<div><span class='lang_base'>$lf</span> ". _T('info_tout_site5') ." </div>";
		$out .= "\n<div><span class='creer'>$lf</span> ". _T('info_tout_site2') ." </div>";
		$out .= "\n<div><a class='claire'>$lf</a> ". _T('info_tout_site3'). " </div>";
		$out .= "\n<div><a class='foncee'>$lf</a> ". _T('info_tout_site4'). " </div>";
		$out .= "</div>\n";
	
		// bloc choix de langue
		$langues = explode(',', $GLOBALS['meta']['langues_multilingue']);
		if (count($langues) > 1) {
			sort($langues);
			$out .= "\n<br />\n<div class='verdana2'><b><label for='sel_lang'>"._T('titre_cadre_afficher_traductions')."</label></b>\n<br />";
			$out .= "<select style='width:100%' name='sel_lang[]' id='sel_lang' size='".count($langues)."' multiple='multiple'>";
			while (list(, $l) = each ($langues)) {
			  $out .= "<option value='$l'" .
			    (in_array($l,$sel_lang) ? " selected='selected'" : "") .
			    ">" .
			    traduire_nom_langue($l) .
			    "</option>\n"; 
			}
			$out .= "</select></div>\n";
	
			$out .= "\n<div style='text-align: $spip_lang_right'><input type='submit' value='"._T('bouton_changer')."' /></div>";
		}
	}

	$out = debut_boite_info(true) . $out  . fin_boite_info(true);

	return generer_form_ecrire('articles_tous', $out);
}
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;
}
Example #22
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;
}
function html_2ac554317f8f8f8aa21871c007ab234d($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0)
{
    if (isset($Pile[0]["doublons"]) and is_array($Pile[0]["doublons"])) {
        $doublons = nettoyer_env_doublons($Pile[0]["doublons"]);
    }
    $connect = '';
    $page = '
<div id="bas">
	<a href="' . spip_htmlspecialchars(sinon($GLOBALS['meta']['adresse_site'], '.')) . '" title="' . _T('public|spip|ecrire:accueil_site') . '">' . _T('public|spip|ecrire:accueil_site') . '</a> | 
	<a href="' . vider_url(urlencode_1738(generer_url_entite('1', 'auteur', '', '', true))) . '" title="' . _T('public|spip|ecrire:info_contact') . '">' . _T('public|spip|ecrire:info_contact') . '</a> | 
	<a href="' . interdire_scripts(generer_url_public('plan', '')) . '" title="' . _T('public|spip|ecrire:plan_site') . '">' . _T('public|spip|ecrire:plan_site') . '</a>
		' . (($t1 = strval(interdire_scripts(invalideur_session($Cache, table_valeur($GLOBALS["visiteur_session"], (string) 'id_auteur', null) ? '' : ' ')))) !== '' ? $t1 . (' | <a href="' . interdire_scripts(parametre_url(generer_url_public('login', ''), 'url', self())) . '" rel="nofollow" class=\'login_modal\'>' . _T('public|spip|ecrire:lien_connecter') . '</a>') : '') . (($t1 = strval(invalideur_session($Cache, (function_exists("autoriser") || include_spip("inc/autoriser")) && autoriser('ecrire') ? " " : ""))) !== '' ? $t1 . ('| <a href="' . interdire_scripts(eval('return ' . '_DIR_RESTREINT_ABS' . ';')) . '">' . _T('public|spip|ecrire:espace_prive') . '</a>') : '') . (($t1 = strval(interdire_scripts(invalideur_session($Cache, table_valeur($GLOBALS["visiteur_session"], (string) 'id_auteur', null) ? ' ' : '')))) !== '' ? $t1 . (' | <a href="' . executer_balise_dynamique('URL_LOGOUT', array(), array('squelettes/inc/inc-bas.html', 'html_2ac554317f8f8f8aa21871c007ab234d', '', 1, $GLOBALS['spip_lang'])) . '" rel="nofollow">' . _T('public|spip|ecrire:icone_deconnecter') . '</a>') : '') . ' | 
	<a href="' . interdire_scripts(generer_url_public('statistiques', '')) . '" title="' . _T('public|spip|ecrire:titre_statistiques') . '">' . _T('public|spip|ecrire:titre_statistiques') . '</a> | 
	<span style="white-space: nowrap;">' . _T('public|spip|ecrire:info_visiteurs') . ' : 
	' . BOUCLE_art_visiteshtml_2ac554317f8f8f8aa21871c007ab234d($Cache, $Pile, $doublons, $Numrows, $SP) . '
	' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-affvisit') . ', array(\'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/inc/inc-bas.html\',\'html_2ac554317f8f8f8aa21871c007ab234d\',\'\',13,$GLOBALS[\'spip_lang\'])), _request("connect"));
?' . '></span>

	<p>
		<a href="' . interdire_scripts(generer_url_public('backend', '')) . '" rel="nofollow" title="' . _T('public|spip|ecrire:bouton_radio_syndication') . ' ' . traduire_nom_langue(spip_htmlentities(@$Pile[0]['lang'] ? @$Pile[0]['lang'] : $GLOBALS['spip_lang'])) . '"><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 style="text-transform: uppercase;">&nbsp;' . spip_htmlentities(@$Pile[0]['lang'] ? @$Pile[0]['lang'] : $GLOBALS['spip_lang']) . '&nbsp;</span></a>

' . BOUCLE_rubriques_cheminhtml_2ac554317f8f8f8aa21871c007ab234d($Cache, $Pile, $doublons, $Numrows, $SP) . '

' . BOUCLE_syndic_rubhtml_2ac554317f8f8f8aa21871c007ab234d($Cache, $Pile, $doublons, $Numrows, $SP) . '
	<big>&nbsp;
		<b><a href="http://' . spip_htmlentities(@$Pile[0]['lang'] ? @$Pile[0]['lang'] : $GLOBALS['spip_lang']) . '.wikipedia.org/wiki/Really_Simple_Syndication">?</a></b>
	</big>
' . BOUCLE_syndic_testhtml_2ac554317f8f8f8aa21871c007ab234d($Cache, $Pile, $doublons, $Numrows, $SP) . '
	</p>
	
	<p>
		<a href="http://www.spip.net" title="' . _T('public|spip|ecrire:site_realise_avec_spip') . ' ' . spip_version() . '"> ' . _T('public|spip|ecrire:site_realise_avec_spip') . ' ' . interdire_scripts('3.1.0') . '</a> + 
		<a href="http://edu.ca.edu/rubrique43.html" title="' . _T('spip:squelette') . ' AHUNTSIC - ' . calcul_version_squelette() . '">AHUNTSIC</a>
	</p>



' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-bas_cc') . ', array(\'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/inc/inc-bas.html\',\'html_2ac554317f8f8f8aa21871c007ab234d\',\'\',44,$GLOBALS[\'spip_lang\'])), _request("connect"));
?' . '>


' . (($t1 = strval(interdire_scripts(filtre_info_plugin_dist("visiteurs_connectes", "est_actif") ? ' ' : ''))) !== '' ? $t1 . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc-visiteurs') . ', array(\'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/inc/inc-bas.html\',\'html_2ac554317f8f8f8aa21871c007ab234d\',\'\',47,$GLOBALS[\'spip_lang\'])), _request("connect"));
?' . '>' : '') . '
' . (($t1 = strval(interdire_scripts(filtre_info_plugin_dist("couteau_suisse", "est_actif") ? ' ' : ''))) !== '' ? $t1 . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('fonds/visiteurs_connectes') . ', array(\'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/inc/inc-bas.html\',\'html_2ac554317f8f8f8aa21871c007ab234d\',\'\',48,$GLOBALS[\'spip_lang\'])), _request("connect"));
?' . '>' : '') . ' 


</div><!-- fin bas -->

' . '<' . '?php echo recuperer_fond( ' . argumenter_squelette('inc/inc-bas_menu-lang') . ', array(\'lang\' => ' . argumenter_squelette($GLOBALS["spip_lang"]) . '), array("compil"=>array(\'squelettes/inc/inc-bas.html\',\'html_2ac554317f8f8f8aa21871c007ab234d\',\'\',53,$GLOBALS[\'spip_lang\'])), _request("connect"));
?' . '>

	' . interdire_scripts(@$Pile[0]['spip_cron']) . '
';
    return analyse_resultat_skel('html_2ac554317f8f8f8aa21871c007ab234d', $Cache, $page, 'squelettes/inc/inc-bas.html');
}
Example #24
0
File: lang.php Project: JLuc/SPIP
function menu_langues($nom_select, $default = '')
{
    include_spip('inc/actions');
    $langues = liste_options_langues($nom_select);
    $ret = "";
    if (!count($langues)) {
        return '';
    }
    if (!$default) {
        $default = $GLOBALS['spip_lang'];
    }
    foreach ($langues as $l) {
        $selected = $l == $default ? ' selected=\'selected\'' : '';
        $ret .= "<option value='{$l}'{$selected}>[" . $l . "] " . traduire_nom_langue($l) . "</option>\n";
    }
    if (!test_espace_prive()) {
        $cible = self();
        $base = '';
    } else {
        $cible = self();
        $base = spip_connect() ? 'base' : '';
    }
    $change = ' onchange="this.parentNode.parentNode.submit()"';
    return generer_action_auteur('converser', $base, $cible, select_langues($nom_select, $change, $ret) . "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>", " method='post'");
}
Example #25
0
function liste_options_langues($nom_select, $default='', $herit='') {

	if ($default == '') $default = $GLOBALS['spip_lang'];
	switch($nom_select) {
		# #MENU_LANG
		case 'var_lang':
		# menu de changement de la langue d'un article
		# les langues selectionnees dans la configuration "multilinguisme"
		case 'changer_lang':
			$langues = explode(',', $GLOBALS['meta']['langues_multilingue']);
			break;
	# menu de l'interface (privee, installation et panneau de login)
	# les langues presentes sous forme de fichiers de langue
	# on force la relecture du repertoire des langues pour etre synchrone.
		case 'var_lang_ecrire':
		default:
			$GLOBALS['meta']['langues_proposees'] = '';
			init_langues();
			$langues = explode(',', $GLOBALS['meta']['langues_proposees']);
			break;

# dernier choix possible : toutes les langues = langues_proposees
# + langues_multilingues ; mais, ne sert pas
#			$langues = explode(',', $GLOBALS['all_langs']);
	}
	if (count($langues) <= 1) return '';
	$ret = '';
	sort($langues);
	foreach ($langues as $l) {
		$selected = ($l == $default) ? ' selected=\'selected\'' : '';
		if ($l == $herit) {
			$ret .= "<option class='maj-debut' style='font-weight: bold;' value='herit'$selected>"
				.traduire_nom_langue($herit)." ("._T('info_multi_herit').")</option>\n";
		}
		## ici ce serait bien de pouvoir choisir entre "langue par defaut"
		## et "langue heritee"
		else
			$ret .= "<option class='maj-debut' value='$l'$selected>".traduire_nom_langue($l)."</option>\n";
	}
	return $ret;
}