| [ Index ] |
|
Code source de SPIP 1.9.2c |
1 <?php 2 3 /***************************************************************************\ 4 * SPIP, Systeme de publication pour l'internet * 5 * * 6 * Copyright (c) 2001-2007 * 7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * 8 * * 9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * 10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * 11 \***************************************************************************/ 12 13 if (!defined("_ECRIRE_INC_VERSION")) return; 14 15 include_spip('inc/presentation'); 16 charger_generer_url(); 17 include_spip('inc/forum'); 18 19 20 // http://doc.spip.org/@forum_parent 21 function forum_parent($id_forum) { 22 $row=spip_fetch_array(spip_query("SELECT * FROM spip_forum WHERE id_forum=$id_forum AND statut != 'redac'")); 23 if (!$row) return ''; 24 $id_forum=$row['id_forum']; 25 $forum_id_parent=$row['id_parent']; 26 $forum_id_rubrique=$row['id_rubrique']; 27 $forum_id_article=$row['id_article']; 28 $forum_id_breve=$row['id_breve']; 29 $forum_id_syndic=$row['id_syndic']; 30 $forum_stat=$row['statut']; 31 32 if ($forum_id_article > 0) { 33 $row=spip_fetch_array(spip_query("SELECT id_article, titre, statut FROM spip_articles WHERE id_article='$forum_id_article'")); 34 $id_article = $row['id_article']; 35 $titre = $row['titre']; 36 $statut = $row['statut']; 37 if ($forum_stat == "prive" OR $forum_stat == "privoff") { 38 return array('pref' => _T('item_reponse_article'), 39 'url' => generer_url_ecrire("articles","id_article=$id_article"), 40 'type' => 'id_article', 41 'valeur' => $id_article, 42 'titre' => $titre); 43 } else { 44 return array('pref' => _T('lien_reponse_article'), 45 'url' => generer_url_article($id_article), 46 'type' => 'id_article', 47 'valeur' => $id_article, 48 'titre' => $titre, 49 'avant' => "<a href='" . generer_url_ecrire("articles_forum","id_article=$id_article") . "'><span style='color: red'>"._T('lien_forum_public'). "</span></a><br />"); 50 } 51 } 52 else if ($forum_id_rubrique > 0) { 53 $row = spip_fetch_array(spip_query("SELECT * FROM spip_rubriques WHERE id_rubrique='$forum_id_rubrique'")); 54 $id_rubrique = $row['id_rubrique']; 55 $titre = $row['titre']; 56 return array('pref' => _T('lien_reponse_rubrique'), 57 'url' => generer_url_rubrique($id_rubrique), 58 'type' => 'id_rubrique', 59 'valeur' => $id_rubrique, 60 'titre' => $titre); 61 } 62 else if ($forum_id_syndic > 0) { 63 $row = spip_fetch_array(spip_query("SELECT * FROM spip_syndic WHERE id_syndic='$forum_id_syndic'")); 64 $id_syndic = $row['id_syndic']; 65 $titre = $row['nom_site']; 66 $statut = $row['statut']; 67 return array('pref' => _T('lien_reponse_site_reference'), 68 'url' => generer_url_ecrire("sites","id_syndic=$id_syndic"), 69 'type' => 'id_syndic', 70 'valeur' => $id_syndic, 71 'titre' => $titre); 72 } 73 else if ($forum_id_breve > 0) { 74 $row = spip_fetch_array(spip_query("SELECT * FROM spip_breves WHERE id_breve='$forum_id_breve'")); 75 $id_breve = $row['id_breve']; 76 $date_heure = $row['date_heure']; 77 $titre = $row['titre']; 78 if ($forum_stat == "prive") { 79 return array('pref' => _T('lien_reponse_breve'), 80 'url' => generer_url_ecrire("breves_voir","id_breve=$id_breve"), 81 'type' => 'id_breve', 82 'valeur' => $id_breve, 83 'titre' => $titre); 84 } else { 85 return array('pref' => _T('lien_reponse_breve_2'), 86 'url' => generer_url_breve($id_breve), 87 'type' => 'id_breve', 88 'valeur' => $id_breve, 89 'titre' => $titre); 90 } 91 } 92 else if ($forum_stat == "privadm") { 93 $retour = forum_parent($forum_id_parent); 94 if ($retour) return $retour; 95 else return array('pref' => _T('info_message'), 96 'url' => generer_url_ecrire('forum_admin'), 97 'titre' => _T('info_forum_administrateur')); 98 } 99 else { 100 $retour = forum_parent($forum_id_parent); 101 if ($retour) return $retour; 102 else return array('pref' => _T('info_message'), 103 'url' => generer_url_ecrire('forum'), 104 'titre' => _T('info_forum_interne')); 105 } 106 } 107 108 // http://doc.spip.org/@controle_un_forum 109 function controle_un_forum($row) { 110 111 $id_forum = $row['id_forum']; 112 $forum_id_parent = $row['id_parent']; 113 $forum_id_rubrique = $row['id_rubrique']; 114 $forum_id_article = $row['id_article']; 115 $forum_id_breve = $row['id_breve']; 116 $forum_date_heure = $row['date_heure']; 117 $forum_titre = echapper_tags($row['titre']); 118 $forum_texte = $row['texte']; 119 $forum_auteur = echapper_tags(extraire_multi($row['auteur'])); 120 $forum_email_auteur = echapper_tags($row['email_auteur']); 121 $forum_nom_site = echapper_tags($row['nom_site']); 122 $forum_url_site = echapper_tags($row['url_site']); 123 $forum_stat = $row['statut']; 124 $forum_ip = $row['ip']; 125 $forum_id_auteur = $row["id_auteur"]; 126 127 $r = forum_parent($id_forum); 128 $avant = $r['avant']; 129 $url = $r['url']; 130 $titre = $r['titre']; 131 $type = $r['type']; 132 $valeur = $r['valeur']; 133 $pref = $r['pref']; 134 135 $cadre = ""; 136 137 $controle = "\n<br /><br /><a id='id$id_forum'></a>"; 138 139 $controle .= debut_cadre_thread_forum("", true, "", typo($forum_titre)); 140 141 if ($forum_stat=="off" OR $forum_stat == "privoff") { 142 $controle .= "<div style='border: 2px #ff0000 dashed;'>"; 143 } 144 else if ($forum_stat=="prop") { 145 $controle .= "<div style='border: 2px yellow solid; background-color: white;'>"; 146 } 147 else { 148 $controle .= "<div>"; 149 } 150 151 $controle .= "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n<tr><td style='width: 100%' valign='top'><table width='100%' cellpadding='5' cellspacing='0'>\n<tr><td class='serif'><span class='arial2'>" . 152 date_interface($forum_date_heure) . 153 "</span>"; 154 if ($forum_email_auteur) { 155 if (email_valide($forum_email_auteur)) 156 $forum_email_auteur = "<a href='mailto:" 157 .htmlspecialchars($forum_email_auteur) 158 ."?subject=".rawurlencode($forum_titre)."'>".$forum_email_auteur 159 ."</a>"; 160 $forum_auteur .= " — $forum_email_auteur"; 161 } 162 $controle .= safehtml("<span class='arial2'> / <b>$forum_auteur</b></span>"); 163 164 $controle .= boutons_controle_forum($id_forum, $forum_stat, $forum_id_auteur, "$type=$valeur", $forum_ip); 165 166 $suite = "\n<br />$avant<b>$pref 167 <a href='$url'>$titre</a></b>" . justifier(propre($forum_texte)); 168 169 if (strlen($forum_url_site) > 10 AND strlen($forum_nom_site) > 3) 170 $suite .= "\n<div align='left' class='serif'><b><a href='$forum_url_site'>$forum_nom_site</a></b></div>"; 171 172 $controle .= safehtml($suite); 173 174 if ($GLOBALS['meta']["mots_cles_forums"] == "oui") { 175 $result_mots = spip_query("SELECT * FROM spip_mots AS mots, spip_mots_forum AS lien WHERE lien.id_forum = '$id_forum' AND lien.id_mot = mots.id_mot"); 176 177 178 while ($row_mots = spip_fetch_array($result_mots)) { 179 $titre_mot = propre($row_mots['titre']); 180 $type_mot = propre($row_mots['type']); 181 $controle .= "\n<li> <b>$type_mot :</b> $titre_mot"; 182 } 183 } 184 185 $controle .= "</td></tr></table>"; 186 $controle .= "</td></tr></table>\n"; 187 188 $controle .= "</div>".fin_cadre_thread_forum(true); 189 return $controle; 190 } 191 192 // 193 // Debut de la page de controle 194 // 195 196 // http://doc.spip.org/@exec_controle_forum_dist 197 function exec_controle_forum_dist() 198 { 199 200 global $type, $debut, $debut_id_forum, $id_rubrique, $connect_statut, $connect_toutes_rubriques; 201 202 $debut= intval($debut); 203 $id_rubrique = intval($id_rubrique); 204 if (!preg_match('/^\w+$/', $type)) $type = "public"; 205 206 list($from,$where)=critere_statut_controle_forum($type, $id_rubrique); 207 208 // Si un id_controle_forum est demande, on adapte le debut 209 if ($debut_id_forum = intval($debut_id_forum) 210 AND $d = spip_fetch_array(spip_query("SELECT date_heure FROM spip_forum WHERE id_forum=$debut_id_forum"))) { 211 $debut = spip_fetch_array(spip_query($q = "SELECT COUNT(*) AS n FROM $from " . (!$where ? '' : "WHERE $where ") . (!$d ? '' : (" AND F.date_heure > '".$d['date_heure']."'")))); 212 $debut = $debut['n']; 213 } 214 215 $pack = 20; // nb de forums affiches par page 216 $enplus = 200; // intervalle affiche autour du debut 217 $limitdeb = ($debut > $enplus) ? $debut-$enplus : 0; 218 $limitnb = $debut + $enplus - $limitdeb; 219 $args = (!$id_rubrique ? "" : "id_rubrique=$id_rubrique&") . 'type='; 220 221 $query = spip_query("SELECT F.id_forum, F.id_parent, F.id_rubrique, F.id_article, F.id_breve, F.date_heure, F.titre, F.texte, F.auteur, F.email_auteur, F.nom_site, F.url_site, F.statut, F.ip, F.id_auteur FROM $from " . (!$where ? '' : "WHERE $where ") . "ORDER BY F.date_heure DESC LIMIT $limitdeb, $limitnb"); 222 # LIMIT $limitnb OFFSET $limitdeb" #PG 223 224 $ancre = 'controle_forum'; 225 $mess = affiche_navigation_forum('controle_forum', $args . $type, $debut, $limitdeb, $pack, $ancre, $query) 226 . affiche_tranche_forum($debut, $limitdeb, $pack, $query); 227 228 # TODO autoriser 229 $droit = (($connect_statut != "0minirezo") OR 230 (!$connect_toutes_rubriques AND 231 (!$id_rubrique OR !autoriser('publierdans','rubrique',$id_rubrique)))); 232 233 if (_request('var_ajaxcharset') AND !$droit) { 234 ajax_retour($mess); 235 } else { 236 237 pipeline('exec_init',array('args'=>array('exec'=>'controle_forum', 'type'=>$type),'data'=>'')); 238 239 240 $commencer_page = charger_fonction('commencer_page', 'inc'); 241 echo $commencer_page(_T('titre_page_forum_suivi'), "forum", "forum-controle"); 242 243 echo "<br /><br /><br />"; 244 echo gros_titre(_T('titre_forum_suivi'),'',false); 245 246 echo debut_onglet(); 247 echo onglet(_T('onglet_messages_publics'), generer_url_ecrire('controle_forum', $args . "public"), "public", '', "forum-public-24.gif"); 248 echo onglet(_T('onglet_messages_internes'), generer_url_ecrire('controle_forum', $args . "interne"), "interne", '', "forum-interne-24.gif"); 249 250 list($from,$where) = critere_statut_controle_forum('vide', $id_rubrique); 251 $n = spip_fetch_array(spip_query("SELECT id_forum FROM $from WHERE $where LIMIT 1")); 252 if ($n) echo onglet(_T('onglet_messages_vide'), generer_url_ecrire('controle_forum', $args . "vide"), "vide", ''); 253 254 list($from,$where) = critere_statut_controle_forum('prop', $id_rubrique); 255 $f = spip_fetch_array(spip_query("SELECT F.id_forum FROM $from " . (!$where ? '' : "WHERE $where ") . " LIMIT 1")); 256 if ($f) 257 echo onglet(_T('texte_statut_attente_validation'), generer_url_ecrire('controle_forum', $args . "prop"), "prop", ''); 258 259 echo fin_onglet(); 260 261 if ($droit) { 262 echo "<b>"._T('avis_non_acces_page')."</b>"; 263 } else { 264 265 debut_gauche(); 266 debut_boite_info(); 267 echo "<span class='verdana1 spip_small'>", _T('info_gauche_suivi_forum_2'), aide("suiviforum"), "</span>"; 268 269 // Afficher le lien RSS 270 271 echo "<div style='text-align: " 272 . $GLOBALS['spip_lang_right'] 273 . ";'>" 274 . bouton_spip_rss('forums', array('page' => $type)) 275 . "</div>"; 276 277 fin_boite_info(); 278 279 echo pipeline('affiche_gauche',array('args'=>array('exec'=>'controle_forum', 'type'=>$type),'data'=>'')); 280 creer_colonne_droite(); 281 echo pipeline('affiche_droite',array('args'=>array('exec'=>'controle_forum', 'type'=>$type),'data'=>'')); 282 283 284 debut_droite(); 285 echo pipeline('affiche_milieu',array('args'=>array('exec'=>'controle_forum', 'type'=>$type),'data'=>'')); 286 287 echo "<div id='$ancre' class='serif2'>$mess</div>"; 288 289 echo fin_gauche(), fin_page(); 290 } 291 } 292 } 293 294 // http://doc.spip.org/@affiche_tranche_forum 295 function affiche_tranche_forum($debut, $i, $pack, $query) 296 { 297 298 $res = ''; 299 while ($row = spip_fetch_array($query)) { 300 if (($i>=$debut) AND ($i<($debut + $pack))) 301 $res .= controle_un_forum($row); 302 $i ++; 303 } 304 return $res; 305 } 306 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Wed Nov 21 10:20:27 2007 | par Balluche grâce à PHPXref 0.7 |
|