コード例 #1
0
ファイル: legender.php プロジェクト: rhertzog/lcs
function legender_corps($ancre, $flag, $id, $id_document, $script, $type, $document, $label, $taille)
{
	include_spip('inc/editer');

	$contenu = '';
	$descriptif = $document['descriptif'];
	if ($descriptif)
	  $contenu .=  "<p>".PtoBR(lignes_longues(propre($descriptif),25)) . "</p>\n";
	if ($document['largeur'] OR $document['hauteur'])
	  $contenu .= _T('info_largeur_vignette',
		     array('largeur_vignette' => $document['largeur'],
			   'hauteur_vignette' => $document['hauteur']))
			 . ' &mdash; ';

	  $contenu .= taille_en_octets($document['taille']);

	$date = $document['date'];
	if ($date AND ($GLOBALS['meta']["documents_date"] == 'oui'))
		$contenu .= "<br />\n" . affdate($date);

	$corps = (!$contenu ? '' :
		  "<div class='verdana1' style='text-align: center; margin-bottom: 10px;'>$contenu</div>") .
	  "<div class='formulaire_spip formulaire_spip_compact'><ul><li class='editer_titre'><label for='titre_document$id_document'>$label</label>\n" .

	  "<input type='text' name='titre_document' id='titre_document$id_document' class='text' value=\"".entites_html($document['titre']).
	  "\" size='40'	onfocus=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\" /></li>\n"
	  . (($GLOBALS['meta']["documents_date"] == 'oui')
	  	? "<li class='editer_date'>".date_formulaire_legender($date, $id_document)."</li>"
	  	:'' )
	  . "<li class='editer_descriptif'><label for='descriptif_document$id_document'>".
	  _T('info_description_2').
	  "</label>\n" .
	  "<textarea name='descriptif_document' id='descriptif_document$id_document' rows='4' class='textarea' cols='*' onfocus=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\">" .
	    entites_html($descriptif) .
	  "</textarea></li></ul></div>\n" .
	  $taille
	  
	  .controles_md5($document);

	$att_bouton = "";

	$att_span = " id='valider_doc$id_document' "
	. ($flag == 'ajax' ? '' : "class='display_au_chargement'")
	.  " style='text-align:"
	.  $GLOBALS['spip_lang_right']
	. ($flag == 'ajax' ? ';display:block' : "")
	. "'";

	if (test_espace_prive())
		return ajax_action_post("legender", $id_document, $script, "show_docs=$id_document&id_$type=$id#legender-$id_document", $corps, _T('bouton_enregistrer'), $att_bouton, $att_span, "&id_document=$id_document&id=$id&type=$type&ancre=$ancre")
		  . "<div class='nettoyeur'></div>";
	else {
		$corps = "<div class='boutons'>"
		       . $corps 
		       . "<span"
		       . $att_span
		       . "><input type='submit' value='"
		       . _T('bouton_enregistrer')
		       ."' /></span></div>";
		$redirect = parametre_url($script,'show_docs',$id_document,'&');
		$redirect = parametre_url($redirect,"id_$type",$id,'&');
		$redirect = parametre_url($redirect,"id_$type",$id,'&');
		$redirect = ancre_url($redirect,"legender-$id_document");
		return generer_action_auteur("legender", $id_document, $redirect, $corps, "\nmethod='post'");
	}
}
コード例 #2
0
ファイル: controle_forum.php プロジェクト: rhertzog/lcs
function controle_forum_boucle($row, $args) {

	$id_forum = $row['id_forum'];
	$forum_id_parent = $row['id_parent'];
	$forum_id_rubrique = $row['id_rubrique'];
	$forum_id_article = $row['id_article'];
	$forum_id_breve = $row['id_breve'];
	$forum_date_heure = $row['date_heure'];
	$forum_titre = echapper_tags($row['titre']);
	$forum_texte = $row['texte'];
	$forum_auteur = echapper_tags(extraire_multi($row['auteur']));
	$forum_email_auteur = echapper_tags($row['email_auteur']);
	$forum_nom_site = echapper_tags($row['nom_site']);
	$forum_url_site = echapper_tags($row['url_site']);
	$forum_stat = $row['statut'];
	$forum_ip = $row['ip'];
	$forum_id_auteur = $row["id_auteur"];

	$r = forum_parent($id_forum);
	$avant = $r['avant'];
	$url = $r['url'];
	$titre = $r['titre'];
	$type = $r['type'];
	$valeur = $r['valeur'];
	$pref = $r['pref'];

	if ($documents = sql_allfetsel('doc.id_document, doc.fichier AS fichier', 'spip_documents AS doc LEFT JOIN spip_documents_liens AS lien ON doc.id_document=lien.id_document', 'lien.id_objet='.intval($id_forum)." AND objet='forum'")) {
		include_spip('inc/documents');
		foreach ($documents as $k => $t) {
			$h = generer_url_entite($t['id_document'], 'document');
			$documents[$k] = "<a href='".$h."'>".basename($t['fichier'])."</a>";
		}
	}

	switch($forum_stat) {
		case 'off':
		case 'privoff':
			$style = " style='border: 2px #ff0000 dashed;'";
			break;
		case 'prop':
			$style = " style='border: 2px yellow solid; background-color: white;'";
			break;
		case 'spam':
			$style = " style='border: 2px black dotted;'";
			break;
		default:
			$style = "";
			break;
	}

	if ($forum_email_auteur) {
		if (email_valide($forum_email_auteur))
			$forum_email_auteur = "<a href='mailto:"
			.htmlspecialchars($forum_email_auteur)
			."?subject=".rawurlencode($forum_titre)."'>".$forum_email_auteur
			."</a>";
		$forum_auteur .= " &mdash; $forum_email_auteur";
	}

	$suite = "\n<br />$avant<b>$pref\n<a href='$url' class='controle'>$titre</a></b>"  
	. "<div class='controle'>".justifier(propre($forum_texte))."</div>";
	include_spip('public/composer');
	if ($forum_notes = safehtml(calculer_notes()))
		$suite .= "<div class='notes controle'>".justifier(safehtml($forum_notes))."</div>";

	if (strlen($forum_url_site) > 10 AND strlen($forum_nom_site) >= 3)
		$suite .= "\n<div style='text-align: left' class='serif'><b><a href='$forum_url_site'>$forum_nom_site</a></b></div>";

	return 	"\n<div><br /><a id='forum$id_forum'></a></div>" .
	  debut_cadre_forum("", true, "", typo($forum_titre)) .
	  "<div$style>" .
	  date_interface($forum_date_heure) .
	  safehtml("<span class='arial2'> / <b>$forum_auteur</b></span>") .
	  boutons_controle_forum($id_forum, $forum_stat, $forum_id_auteur, "$type=$valeur", $forum_ip, 'controle_forum', $args) .
	  safehtml(lignes_longues($suite)) .
	  afficher_forum_mots($id_forum) .
	  join(', ', $documents) .
	  "<div class='nettoyeur'></div></div>".
	  fin_cadre_forum(true);
}
コード例 #3
0
ファイル: presenter_liste.php プロジェクト: rhertzog/lcs
function inc_presenter_liste_dist($requete, $fonc, &$prims, $own, $force, $styles, $idom='', $title='', $icone='', $url='', $cpt=NULL)
{
	global $spip_display, $spip_lang_left;

	// $requete est passe par reference, pour modifier l'index LIMIT
	if ($idom AND $spip_display != 4)
		$tranches = affiche_tranche_bandeau($requete, $idom, $url, $cpt, _TRANCHES);
	else $tranches = '';

	$prim = $prims;
	$prims = array();
	$result = sql_allfetsel((isset($requete["SELECT"]) ? $requete["SELECT"] : "*"), $requete['FROM'], $requete['WHERE'], $requete['GROUP BY'], $requete['ORDER BY'], $requete['LIMIT']);

	if (!count($result)) {
		if (!$force) return '';
	} else {
	if ($spip_display != 4) {
		$evt = !preg_match(",msie,i", $GLOBALS['browser_name']) ? ''
		: "
			onmouseover=\"changeclass(this,'tr_liste_over');\"
			onmouseout=\"changeclass(this,'tr_liste');\"" ;

		$table = $head = '';
		$th = 0;
		foreach ($result as $r) {
		  if ($prim) $prims[]= $r[$prim];
		  if ($vals = $fonc($r, $own)) {
			reset($styles);
			$res = '';
			foreach ($vals as $t) {
				$style = $largeur = $nom = "";
				list(,$s) = each($styles);
				if (count($s)) $style = array_shift($s);
				if (count($s)) $largeur = array_shift($s);
				if (count($s)) $nom = array_shift($s);
				if ($largeur) $largeur = " style='width: $largeur" ."px;'";
				if ($style) $style = " class=\"$style\"";
				$t = !trim($t) ? "&nbsp;" : lignes_longues($t);
				$res .= "\n<td$style$largeur>$t</td>";
				if (!$table) {
				  $th |= $nom ? 1 : 0;
				  $head .= "\n<th style='text-align:center'>$nom</th>";
				}
			}
			$table .= "\n<tr class='tr_liste'$evt>$res</tr>";
		  }
		}
		if (!$th) $head= '';
		$tranches .= "<table width='100%' cellpadding='2' cellspacing='0' border='0'>$head$table</table>";
	} else {
		foreach ($result as $r) {
			if ($prim) $prims[]= $r[$prim];
			if ($t = $fonc($r, $own)) {
			  	$tranches = '<li>' . join('</li><li>', $t) . '</li>';
		$tranches = "\n<ul style='text-align: $spip_lang_left; background-color: white;'>"
		. $tranches
		. "</ul>";
			}
		}
	}
	}

	$id = 't'.substr(md5(join('',$requete)),0,8);
	$bouton = !$icone ? '' : bouton_block_depliable($title, true, $id);

	return debut_cadre('liste', $icone, "", $bouton, "", "", false)
	  . debut_block_depliable(true,  $id)
	  . $tranches
	  . fin_block()
	  . fin_cadre('liste');
}
コード例 #4
0
ファイル: documents.php プロジェクト: rhertzog/lcs
function afficher_case_document($id_document, $id, $script, $type, $deplier=false) {
	global $spip_lang_right;

	$document = sql_fetsel("D.id_document, D.id_vignette,D.extension,D.titre,D.descriptif,D.fichier,D.largeur,D.hauteur,D.taille,D.mode,D.distant, D.date, L.vu", "spip_documents AS D INNER JOIN spip_documents_liens AS L ON L.id_document=D.id_document", "L.id_objet=".intval($id)." AND objet=".sql_quote($type)." AND L.id_document=".intval($id_document));

	if (!$document) return "";

	$id_vignette = $document['id_vignette'];
	$extension = $document['extension'];
	$descriptif = $document['descriptif'];
	$fichier = $document['fichier'];
	$largeur = $document['largeur'];
	$hauteur = $document['hauteur'];
	$mode = $document['mode'];
	$distant = $document['distant'];
	$titre = $document['titre'];
	$legender = charger_fonction('legender', 'inc');
	$dist = '';

	$r = sql_fetsel("titre,inclus", "spip_types_documents", "extension=".sql_quote($extension));
	if ($r) {
		$type_inclus = $r['inclus'];
		$type_titre = $r['titre'];
	}

	if ($mode == 'document') {

		if ($distant == 'oui') {
			include_spip('inc/tourner');
			$dist = "\n<div class='verdana1' style='float: $spip_lang_right; text-align: $spip_lang_right;'>"
			. "\n<img src='" . chemin_image('attachment.gif') . "'\n\talt=\"$fichier\"\n\ttitle=\"$fichier\" />\n"
			. bouton_copier_local($document, $type, $id, $id_document, $script)
			. "</div>\n";
		}

		if (est_inclus($id_document))
			$raccourci = affiche_raccourci_doc('doc', $id_document, '');
		else {
			$vign= (($type_inclus == "embed" OR $type_inclus == "image") AND $largeur > 0 AND $hauteur > 0);
			$raccourci = $vign ? ("<b>"._T('info_inclusion_vignette')."</b><br />") : '';

			$raccourci .= "<div style='color: 333333'>"
			. affiche_raccourci_doc('doc', $id_document, 'left')
			. affiche_raccourci_doc('doc', $id_document, 'center')
			. affiche_raccourci_doc('doc', $id_document, 'right')
			. "</div>\n";

			if ($vign) {
				$raccourci .= "<div style='padding:2px; ' class='arial1 spip_xx-small'>";
				$raccourci .= "<b>"._T('info_inclusion_directe')."</b><br />";
				$raccourci .= "<div style='color: 333333'>"
				. affiche_raccourci_doc('emb', $id_document, 'left')
				. affiche_raccourci_doc('emb', $id_document, 'center')
				. affiche_raccourci_doc('emb', $id_document, 'right')
				. "</div>\n";
				$raccourci .= "</div>";
			}
		}
		$ninclus = false;
		$icone = 'doc-24.gif';
		$style = 'e';

	} else if ($mode == 'image') {

		$icone = 'image-24.gif';
		$style = 'r';
		$ninclus = ($type_inclus !== 'image');
		$doc = ($descriptif OR $titre) ? 'doc' : 'img';

		if (est_inclus($id_document))
			$raccourci = affiche_raccourci_doc($doc, $id_document, '');
		else {
			$raccourci =
				affiche_raccourci_doc($doc, $id_document, 'left')
				. affiche_raccourci_doc($doc, $id_document, 'center')
				. affiche_raccourci_doc($doc, $id_document, 'right');
		}

	}
	if ($titre)
	  $cadre = $titre;
	elseif (!$distant)
	  $cadre = basename($fichier);
	else {
	  preg_match('@^[^/]*/*([^/]*)@', $fichier, $cadre);
	  $cadre = $cadre[1];
	}
	$cadre = lignes_longues($cadre, 20);
	// encapsuler chaque document dans un container pour permettre son remplacement en ajax
	return  '<div>'
		. debut_cadre($style, $icone, '', $cadre, "document$id_document")
		. ($ninclus ? '' :
		   ("\n<div style='text-align: center'>"
		    . $dist
		    . document_et_vignette($document, '', true)
		    . '</div>'
		    . "\n<div class='verdana1' style='text-align: center; color: black;'>\n"
		    . ($type_titre ? $type_titre :
		       ( _T('info_document').' '.majuscules($extension)))
		    . "</div>"))
		. $apercu
		. "\n<div style='padding:2px;' class='arial1 spip_xx-small'>"
		. $raccourci
		. "</div>\n"
		. $legender($id_document, $document, $script, $type, $id, "document$id_document", $deplier)
		. fin_cadre($style)
		. '</div>';
}