示例#1
0
function exec_articles_forum_args($id_article, $date, $debut, $pas, $enplus)
{
	if (!autoriser('modererforum', 'article', $id_article)) {
		include_spip('inc/minipres');
		echo minipres();
	} else {

	$query = array('SELECT' => "pied.id_forum,pied.id_parent,pied.id_rubrique,pied.id_article,pied.id_breve,pied.id_message,pied.id_syndic,pied.date_heure,pied.titre,pied.texte,pied.auteur,pied.email_auteur,pied.nom_site,pied.url_site,pied.statut,pied.ip,pied.id_auteur, max(thread.date_heure) AS date", 
		       'FROM' => "spip_forum AS pied LEFT JOIN spip_forum AS thread ON pied.id_forum=thread.id_thread",
		       'WHERE' => "pied.id_article=$id_article AND pied.id_parent=0 AND pied.statut IN ('publie', 'off', 'prop', 'spam')",
		       'GROUP BY' => "pied.id_forum",
		       'ORDER BY' => "date DESC");

	if (!$pas) $pas = 5;
	$nav = affiche_navigation_forum($query, "articles_forum", "id_article=$id_article", $debut, $pas, $enplus, $date);

	$res = afficher_forum($query, '', '', $id_article, 'articles_forum', "id_article=$id_article");
	$res =  "<br />$nav<br />$res<br />$nav";	

	if (_AJAX) {
		ajax_retour($res);
	} else {

		$ancre = 'articles_forum';
		$res =  "<div class='serif2' id='$ancre'>$res</div>";

	 	pipeline('exec_init',array('args'=>array('exec'=>'articles_forum','id_article'=>$id_article),'data'=>''));

		$row = sql_fetsel("titre, id_rubrique", "spip_articles", "id_article=$id_article");

		if ($row) {
			$titre = $row["titre"];
			$id_rubrique = $row["id_rubrique"];
		}

		$commencer_page = charger_fonction('commencer_page', 'inc');
		echo $commencer_page($titre, "naviguer", "articles", $id_rubrique);

		articles_forum_cadres($id_rubrique, $id_article, $titre, 'articles', "id_article=$id_article");

		echo $res;
		echo fin_gauche(), fin_page();
	}
	}
}
示例#2
0
文件: discuter.php 项目: rhertzog/lcs
function inc_discuter_dist($id, $script, $objet, $statut='prive', $debut=NULL, $pas=NULL, $id_parent = 0)
{
	if ($GLOBALS['meta']['forum_prive_objets'] == 'non')
		return '';

	$debut = intval($debut);
	if (!$pas = intval($pas)) $pas = 10;
	$id = intval($id);
	$args = ($objet ? "$objet=$id&" : '') . "statut=$statut";
	$ancre = "poster_forum_prive" . ($objet ? '' : "-$id");

	if ($id_parent) {
	  $id_t = sql_getfetsel('id_thread', 'spip_forum', "id_forum=$id_parent");
	  $query = array('SELECT' => "*", 'FROM' => "spip_forum", 'WHERE' => "id_forum=$id_t");

	  $res = afficher_forum($query, $script, $args);

	} else {
		$clic = _T('icone_poster_message');
		$logo = ($script == 'forum_admin') ?
		  "forum-admin-24.gif" : "forum-interne-24.gif";
		$lien = generer_url_ecrire("poster_forum_prive", "statut=$statut&id=$id&script=$script");
		$res = icone_inline($clic, $lien, $logo, "creer.gif",'center', $ancre);

		$where = ((!$objet OR !$id) ? '' : ($objet . "=" . sql_quote($id) . " AND "))
		  . "id_parent=0 AND statut=" . sql_quote($statut);

		$n = sql_countsel('spip_forum', $where);
		if ($n) {

			$nav = ($n <= $pas) ? '' :
			  formulaire_discuter($script, "id=$id&$objet=$id&statut=$statut", $debut, $pas, $ancre, $n, $objet);

			$query = array('SELECT' => "*", 'FROM' => "spip_forum", 'WHERE' =>  $where, 'ORDER BY' => "date_heure DESC", 'LIMIT' => "$debut,$pas");
			$q = afficher_forum($query, $script,  $args, false);
			$res .= $nav . $q	. "<br />" . $nav;
		}
	}
	return ajax_action_greffe($ancre, '', $res);
}
示例#3
0
文件: forum.php 项目: rhertzog/lcs
function afficher_forum($query, $retour, $arg, $controle_id_article = false, $script='', $argscript='') {
	global $spip_display;
	static $compteur_forum = 0;
	static $nb_forum = array();
	static $thread = array();

	$request = sql_allfetsel($query['SELECT'], $query['FROM'], $query['WHERE'], $query['GROUP BY'], $query['ORDER BY'], $query['LIMIT']);
	$compteur_forum++;
	$nb_forum[$compteur_forum] = count($request);
	$thread[$compteur_forum] = 1;
	
	$res = '';

	foreach($request as  $row) {
		$statut=$row['statut'];
		$id_parent=$row['id_parent'];
		if (($controle_id_article) ? ($statut!="perso") :
			(($statut=="prive" OR $statut=="privrac" OR $statut=="privadm" OR $statut=="perso")
			 OR ($statut=="publie" AND $id_parent > 0))) {

			$query = array('SELECT' => "*", 
				'FROM' => "spip_forum",
				'WHERE' => "id_parent='" . $row['id_forum'] . "'" . ($controle_id_article ? '':" AND statut<>'off'"),
				'ORDER BY' => "date_heure");

			$bloc = afficher_forum_thread($row, $controle_id_article, $compteur_forum, $nb_forum, $thread, $retour, $arg, $script, $argscript)
			  . afficher_forum($query, $retour, $arg, $controle_id_article, $script, $argscript);

			$res .= ajax_action_greffe('poster_forum_prive', $row['id_forum'], $bloc); 
		}
		$thread[$compteur_forum]++;
	}
	$compteur_forum--;
	if ($spip_display == 4 AND $res) $res = "<ul>$res</ul>";	
	return $res;
}