[80] | 1 | <?php |
---|
| 2 | |
---|
| 3 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
| 4 | include_spip('inc/presentation'); |
---|
| 5 | |
---|
| 6 | include_spip('inc/arty_selecteur'); |
---|
| 7 | include_spip('inc/user_session'); |
---|
| 8 | |
---|
| 9 | function exec_arty() { |
---|
| 10 | |
---|
| 11 | global $connect_statut; |
---|
| 12 | if ($connect_statut != "0minirezo" ) { |
---|
| 13 | echo "<p><b>"._T('magusine:acces_a_la_page')."</b></p>"; |
---|
| 14 | fin_page(); |
---|
| 15 | exit; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | traiter_post(); |
---|
| 19 | $params= charger_parametres(); |
---|
| 20 | |
---|
| 21 | traiter_get(); |
---|
| 22 | |
---|
| 23 | echo debut_page(); |
---|
| 24 | echo barre_onglets("arty", "base"); //affiche la barre des onglets du groupe "magusine", l'onglet courant est "base". |
---|
| 25 | echo debut_gauche(); |
---|
| 26 | echo debut_cadre_relief(_DIR_PLUGIN_ARTY.'/images/aide.png', true, "", _T('arty:info')); |
---|
| 27 | echo _T("arty:sideinfo_arty"); |
---|
| 28 | echo fin_cadre_relief(true); |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | echo debut_droite(); |
---|
| 32 | gros_titre(_T("arty:titre_configuration_base")); |
---|
| 33 | |
---|
| 34 | // choix de l'edito |
---|
| 35 | echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."images/document-properties.png", true, "", _T('arty:edito')); |
---|
| 36 | $edito=array( |
---|
| 37 | "exec" => "arty", |
---|
| 38 | "#" => "acces_a", |
---|
| 39 | "ajouter" => "edito", |
---|
| 40 | "verif" => $_SESSION['id_check'] |
---|
| 41 | ); |
---|
| 42 | |
---|
| 43 | $message = afficher_selectionne("arty", "edito"); |
---|
| 44 | if (!$message) { echo _T("arty:pas_de_edito"); } |
---|
| 45 | |
---|
| 46 | echo "<div><a href='javascript:montrer_item(\"#show_edito\")' class='bouton-montrer-options'>"._T("arty:modifier_cette_option")."</a></div>"; |
---|
| 47 | echo "<div id='show_edito'>"; |
---|
| 48 | |
---|
| 49 | afficher_selecteur($edito); |
---|
| 50 | |
---|
| 51 | echo "</div>"; |
---|
| 52 | echo "<script type='text/javascript'> |
---|
| 53 | jQuery('#show_edito').css({ |
---|
| 54 | display: 'none' |
---|
| 55 | }); |
---|
| 56 | </script>"; |
---|
| 57 | |
---|
| 58 | $resultat = spip_query("SELECT * FROM spip_arty_parametres WHERE parametre='cacher_edito'"); |
---|
| 59 | $resultat = spip_fetch_array($resultat); |
---|
| 60 | |
---|
| 61 | if($resultat) { |
---|
| 62 | $cacher = $resultat['valeur']; |
---|
| 63 | $lien = $resultat['valeur2']; |
---|
| 64 | } else { |
---|
| 65 | $cacher = "false"; |
---|
| 66 | $lien= "false"; |
---|
| 67 | } |
---|
| 68 | echo "<br />"; |
---|
| 69 | echo "<form action='".generer_url_ecrire('arty')."' method='post'>"; |
---|
| 70 | echo "<input type='hidden' name='cacher_edito' value='false' />"; |
---|
| 71 | echo "<p><input type='checkbox' id='cacher_edito' name='cacher_edito' value='true' ".($cacher == "true" ? "checked='checked'" : '')." />"; |
---|
| 72 | echo "<label for='cacher_edito'>"._T("arty:cacher_edito")."</label></p>"; |
---|
| 73 | |
---|
| 74 | echo "<p><input type='checkbox' id='lire_autres_editos' name='lire_autres_editos' value='true' ".($lien == "true" ? "checked='checked'" : '')." />"; |
---|
| 75 | echo "<label for='lire_autres_editos'>"._T("arty:lire_autres_editos")."</label></p>"; |
---|
| 76 | |
---|
| 77 | echo "<input type='submit' class='fondo' value='"._T('arty:enregistrer')."' />"; |
---|
| 78 | echo "</form>"; |
---|
| 79 | |
---|
| 80 | echo fin_cadre_trait_couleur(); |
---|
| 81 | |
---|
| 82 | // choix de la une |
---|
| 83 | echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."images/folder-new.png", true, "", _T('arty:rubrique_article_une')); |
---|
| 84 | $rubart_une=array( |
---|
| 85 | "exec" => "arty", |
---|
| 86 | "#" => "rubart_une", |
---|
| 87 | "ajouter" => "rubart_une", |
---|
| 88 | "verif" => $_SESSION['id_check'] |
---|
| 89 | ); |
---|
| 90 | |
---|
| 91 | $message = afficher_selectionne("arty", "rubart_une"); |
---|
| 92 | if (!$message) { echo "<p>"._T("arty:pas_de_une")."</p>"; } |
---|
| 93 | |
---|
| 94 | echo "<div><a href='javascript:montrer_item(\"#show_une\")' class='bouton-montrer-options'>"._T("arty:modifier_cette_option")."</div>"; |
---|
| 95 | echo "<div id='show_une'>"; |
---|
| 96 | afficher_selecteur($rubart_une); |
---|
| 97 | |
---|
| 98 | echo "</div>"; |
---|
| 99 | echo "<script type='text/javascript'> |
---|
| 100 | jQuery('#show_une').css({ |
---|
| 101 | display: 'none' |
---|
| 102 | }); |
---|
| 103 | </script>"; |
---|
| 104 | echo fin_cadre_trait_couleur(); |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | // rubrique de news |
---|
| 108 | echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."images/edit-find.png", true, "", _T('arty:choix_rubrique_news')); |
---|
| 109 | // controle l'existence du parametre, sinon injecte par defaut |
---|
| 110 | |
---|
| 111 | echo "<p>"._T("arty:explication_choix_rubrique_news")."</p>"; |
---|
| 112 | |
---|
| 113 | $news=array( |
---|
| 114 | "exec" => "arty", |
---|
| 115 | "#" => "news", |
---|
| 116 | "ajouter" => "rubrique-news", |
---|
| 117 | "verif" => $_SESSION['id_check'] |
---|
| 118 | ); |
---|
| 119 | |
---|
| 120 | $message = afficher_selectionne("arty", "rubrique-news"); |
---|
| 121 | if (!$message) { echo "<p>"._T("arty:pas_de_rubrique_news")."</p>"; } |
---|
| 122 | |
---|
| 123 | echo "<div><a href='javascript:montrer_item(\"#show_news\")' class='bouton-montrer-options'>"._T("arty:modifier_cette_option")."</div>"; |
---|
| 124 | echo "<div id='show_news'>"; |
---|
| 125 | afficher_selecteur($news, true, false); |
---|
| 126 | echo "</div>"; |
---|
| 127 | echo "<script type='text/javascript'> |
---|
| 128 | jQuery('#show_news').css({ |
---|
| 129 | display: 'none' |
---|
| 130 | }); |
---|
| 131 | </script>"; |
---|
| 132 | |
---|
| 133 | echo fin_cadre_trait_couleur(); |
---|
| 134 | |
---|
| 135 | |
---|
| 136 | echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."images/camera-video.png", true, "", _T('arty:video_au_hasard')); |
---|
| 137 | $edito=array( |
---|
| 138 | "exec" => "arty", |
---|
| 139 | "#" => "access-d", |
---|
| 140 | "ajouter" => "video-hasard", |
---|
| 141 | "verif" => $_SESSION['id_check'] |
---|
| 142 | ); |
---|
| 143 | |
---|
| 144 | $message = afficher_selectionne("arty", "video-hasard"); |
---|
| 145 | if (!$message) { echo "<p>"._T("arty:pas_de_video_hasard")."</p>"; } |
---|
| 146 | |
---|
| 147 | echo "<div><a href='javascript:montrer_item(\"#show_video_hasard\")' class='bouton-montrer-options'>"._T("arty:modifier_cette_option")."</div>"; |
---|
| 148 | echo "<div id='show_video_hasard'>"; |
---|
| 149 | afficher_selecteur($edito); |
---|
| 150 | echo "</div>"; |
---|
| 151 | echo "<script type='text/javascript'> |
---|
| 152 | jQuery('#show_video_hasard').css({ |
---|
| 153 | display: 'none' |
---|
| 154 | }); |
---|
| 155 | </script>"; |
---|
| 156 | echo fin_cadre_trait_couleur(); |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."images/camera-photo.png", true, "", _T('arty:image_au_hasard')); |
---|
| 160 | $image=array( |
---|
| 161 | "exec" => "arty", |
---|
| 162 | "#" => "acces-e", |
---|
| 163 | "ajouter" => "image-hasard", |
---|
| 164 | "verif" => $_SESSION['id_check'] |
---|
| 165 | ); |
---|
| 166 | |
---|
| 167 | $message = afficher_selectionne("arty", "image-hasard"); |
---|
| 168 | if (!$message) { echo _T("arty:pas_de_image_hasard"); } |
---|
| 169 | |
---|
| 170 | echo "<div><a href='javascript:montrer_item(\"#show_image_hasard\")' class='bouton-montrer-options'>"._T("arty:modifier_cette_option")."</div>"; |
---|
| 171 | echo "<div id='show_image_hasard'>"; |
---|
| 172 | afficher_selecteur($image); |
---|
| 173 | echo "</div>"; |
---|
| 174 | echo "<script type='text/javascript'> |
---|
| 175 | jQuery('#show_image_hasard').css({ |
---|
| 176 | display: 'none' |
---|
| 177 | }); |
---|
| 178 | </script>"; |
---|
| 179 | echo fin_cadre_trait_couleur(); |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | |
---|
| 183 | // reglage des parametres : afficher la date et les auteurs |
---|
| 184 | echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."images/edit-find.png", true, "", _T('arty:config_date_auteur')); |
---|
| 185 | |
---|
| 186 | $resultat= spip_query("SELECT * FROM spip_arty_parametres WHERE parametre='date_auteur'"); |
---|
| 187 | $resultat=spip_fetch_array($resultat); |
---|
| 188 | //print_r($resultat); |
---|
| 189 | if($resultat) { |
---|
| 190 | $date=$resultat['valeur']; |
---|
| 191 | $auteur=$resultat['valeur2']; |
---|
| 192 | $suite=$resultat['valeur3']; |
---|
| 193 | } else { |
---|
| 194 | $date="false"; |
---|
| 195 | $auteur="false"; |
---|
| 196 | $suite="false"; |
---|
| 197 | } |
---|
| 198 | |
---|
| 199 | echo _T("arty:intro_config_date_auteur"); |
---|
| 200 | echo "<form action='".generer_url_ecrire('arty')."' method='post'>\n"; |
---|
| 201 | echo "<input type='hidden' name='action' value='config_date_auteur' />"; |
---|
| 202 | echo "<p class='label_radio'>"._T("arty:intro_date")."</p>"; |
---|
| 203 | echo "<input class='radio' id='datetrue' type='radio' name='date' value='true' ".(($date=="true")?'checked="checked"':'')."> <label for='datetrue'>"._T("arty:afficher_date")."</label><br />"; |
---|
| 204 | echo "<input class='radio' id='datefalse' type='radio' name='date' value='false' ".(($date=="false")?'checked="checked"':'')."> <label for='datefalse'>"._T("arty:pas_de_date")."</label><br />"; |
---|
| 205 | |
---|
| 206 | echo "<p class='label_radio'>"._T("arty:intro_auteur")."</p>"; |
---|
| 207 | echo "<input class='radio' id='auteurtrue' type='radio' name='auteur' value='true' ".(($auteur=="true")?'checked="checked"':'')."> <label for='auteurtrue'>"._T("arty:afficher_auteur")."</label><br />"; |
---|
| 208 | echo "<input class='radio' id='auteurfalse' type='radio' name='auteur' value='false' ".(($auteur=="false")?'checked="checked"':'')."> <label for='auteurfalse'>"._T("arty:pas_afficher_auteur")."</label><br />"; |
---|
| 209 | |
---|
| 210 | echo "<p class='label_radio'>"._T("arty:intro_suite")."</p>"; |
---|
| 211 | echo "<input class='radio' id='suitetrue' type='radio' name='suite' value='true' ".(($suite=="true")?'checked="checked"':'')."> <label for='suitetrue'>"._T("arty:afficher_suite")."</label><br />"; |
---|
| 212 | echo "<input class='radio' id='suitefalse' type='radio' name='suite' value='false' ".(($suite=="false")?'checked="checked"':'')."> <label for='suitefalse'>"._T("arty:pas_de_suite")."</label><br />"; |
---|
| 213 | |
---|
| 214 | |
---|
| 215 | echo "<br /><input type='submit' value='"._T("arty:enregistrer")."' class='fondo' />"; |
---|
| 216 | |
---|
| 217 | echo "</form>"; |
---|
| 218 | echo fin_cadre_trait_couleur(); |
---|
| 219 | |
---|
| 220 | // forum dans la meme page ou dans la page forum |
---|
| 221 | echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."images/edit-find.png", true, "", _T('arty:config_forum')); |
---|
| 222 | |
---|
| 223 | //print_r($params); |
---|
| 224 | |
---|
| 225 | if(!$params['config_forum']) { |
---|
| 226 | $params['config_forum']="false"; |
---|
| 227 | } |
---|
| 228 | |
---|
| 229 | echo "<p>"._T("arty:intro_config_forum")."</p>"; |
---|
| 230 | echo "<form action='".generer_url_ecrire('arty')."' method='post'>\n"; |
---|
| 231 | echo "<input type='hidden' name='action' value='config_forum' />"; |
---|
| 232 | echo "<p>"._T("arty:explication_forum")."</p>"; |
---|
| 233 | echo "<input class='radio' type='radio' name='config_forum' value='true' ".(($params['config_forum']=="true")?'checked="checked"':'')."> <label for='config_forum'>"._T("arty:forum_self")."</label><br />"; |
---|
| 234 | echo "<input class='radio' type='radio' name='config_forum' value='false' ".(($params['config_forum']=="false")?'checked="checked"':'')."> <label for='config_forum'>"._T("arty:forum_forum")."</label><br />"; |
---|
| 235 | |
---|
| 236 | echo "<br /><input type='submit' value='"._T("arty:enregistrer")."' class='fondo' />"; |
---|
| 237 | echo "</form>"; |
---|
| 238 | echo fin_cadre_trait_couleur(); |
---|
| 239 | |
---|
| 240 | |
---|
| 241 | echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."images/edit-find.png", true, "", _T('arty:config_google_maps')); |
---|
| 242 | |
---|
| 243 | //print_r($params); |
---|
| 244 | |
---|
| 245 | if (!isset($params['google_api_key'])) { |
---|
| 246 | $params['google_api_key'] = ""; |
---|
| 247 | } |
---|
| 248 | if (!isset($params['gmaps_afficher_controles'])) { |
---|
| 249 | $params['gmaps_afficher_controles'] = "false"; |
---|
| 250 | } |
---|
| 251 | |
---|
| 252 | echo "<p>"._T("arty:intro_config_api_key")."</p>"; |
---|
| 253 | echo "<form action='".generer_url_ecrire('arty')."' method='post'>\n"; |
---|
| 254 | echo "<input type='text' style='width:90%' name='google_api_key' value='".$params['google_api_key']."' /><br />"; |
---|
| 255 | echo "<input type='hidden' name='gmaps_afficher_controles' value='false' />"; |
---|
| 256 | echo "<p><input class='radio' type='checkbox' id='gmaps_afficher_controles' name='gmaps_afficher_controles' value='true' ".($params['gmaps_afficher_controles'] == "true" ? "checked='checked'" : '')." />"; |
---|
| 257 | echo "<label for='gmaps_afficher_controles'>"._T("arty:gmaps_afficher_controles")."</label></p>"; |
---|
| 258 | echo "<br /><input type='submit' value='"._T("arty:enregistrer")."' class='fondo' />"; |
---|
| 259 | echo "</form>"; |
---|
| 260 | echo fin_cadre_trait_couleur(); |
---|
| 261 | |
---|
| 262 | echo fin_gauche(); |
---|
| 263 | |
---|
| 264 | echo fin_page(); |
---|
| 265 | |
---|
| 266 | } |
---|
| 267 | |
---|
| 268 | |
---|
| 269 | |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | function traiter_post() { |
---|
| 273 | //print_r($_POST); |
---|
| 274 | |
---|
| 275 | if($_POST['action']=='config_date_auteur') { |
---|
| 276 | $date=addslashes($_POST['date']); |
---|
| 277 | $auteur=addslashes($_POST['auteur']); |
---|
| 278 | $suite=addslashes($_POST['suite']); |
---|
| 279 | $resultat = spip_query("SELECT * FROM spip_arty_parametres WHERE parametre = 'date_auteur'"); |
---|
| 280 | if(!spip_num_rows($resultat)) { |
---|
| 281 | spip_query("INSERT INTO spip_arty_parametres (parametre,valeur,valeur2, valeur3) VALUES ('date_auteur','$date', '$auteur', '$suite')"); |
---|
| 282 | } else { |
---|
| 283 | spip_query("UPDATE spip_arty_parametres SET valeur= '$date',valeur2='$auteur', valeur3='$suite' WHERE parametre = 'date_auteur'"); |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | } |
---|
| 287 | |
---|
| 288 | if($_POST['action']=='config_forum') { |
---|
| 289 | $config_forum=addslashes($_POST['config_forum']); |
---|
| 290 | $resultat = spip_query("SELECT * FROM spip_arty_parametres WHERE parametre = 'config_forum'"); |
---|
| 291 | if(!spip_num_rows($resultat)) { |
---|
| 292 | spip_query("INSERT INTO spip_arty_parametres (parametre,valeur) VALUES ('config_forum','$config_forum')"); |
---|
| 293 | } else { |
---|
| 294 | spip_query("UPDATE spip_arty_parametres SET valeur= '$config_forum' WHERE parametre = 'config_forum'"); |
---|
| 295 | } |
---|
| 296 | |
---|
| 297 | } |
---|
| 298 | |
---|
| 299 | if (isset($_POST['cacher_edito'])) { |
---|
| 300 | $cacher = addslashes($_POST['cacher_edito']); |
---|
| 301 | $lien=addslashes($_POST['lire_autres_editos']); |
---|
| 302 | $resultat = spip_query("SELECT * FROM spip_arty_parametres WHERE parametre = 'cacher_edito'"); |
---|
| 303 | if(!spip_num_rows($resultat)) { |
---|
| 304 | spip_query("INSERT INTO spip_arty_parametres (parametre,valeur,valeur2) VALUES ('cacher_edito','$cacher','$lien')"); |
---|
| 305 | } else { |
---|
| 306 | spip_query("UPDATE spip_arty_parametres SET valeur='$cacher',valeur2='$lien' WHERE parametre = 'cacher_edito'"); |
---|
| 307 | } |
---|
| 308 | |
---|
| 309 | |
---|
| 310 | |
---|
| 311 | } |
---|
| 312 | |
---|
| 313 | if (isset($_POST['google_api_key'])) { |
---|
| 314 | $api_key = addslashes($_POST['google_api_key']); |
---|
| 315 | $resultat = spip_query("SELECT * FROM spip_arty_parametres WHERE parametre = 'google_api_key'"); |
---|
| 316 | if(!spip_num_rows($resultat)) { |
---|
| 317 | spip_query("INSERT INTO spip_arty_parametres (parametre,valeur) VALUES ('google_api_key','$api_key')"); |
---|
| 318 | } else { |
---|
| 319 | spip_query("UPDATE spip_arty_parametres SET valeur='$api_key' WHERE parametre = 'google_api_key'"); |
---|
| 320 | } |
---|
| 321 | |
---|
| 322 | $controles = addslashes($_POST['gmaps_afficher_controles']); |
---|
| 323 | $resultat = spip_query("SELECT * FROM spip_arty_parametres WHERE parametre = 'gmaps_afficher_controles'"); |
---|
| 324 | if(!spip_num_rows($resultat)) { |
---|
| 325 | spip_query("INSERT INTO spip_arty_parametres (parametre,valeur) VALUES ('gmaps_afficher_controles','$controles')"); |
---|
| 326 | } else { |
---|
| 327 | spip_query("UPDATE spip_arty_parametres SET valeur='$controles' WHERE parametre = 'gmaps_afficher_controles'"); |
---|
| 328 | } |
---|
| 329 | |
---|
| 330 | //enregistrement des formats kml et kmz |
---|
| 331 | $resultat = spip_query("SELECT * FROM spip_types_documents WHERE extension = 'kml'"); |
---|
| 332 | if(!spip_num_rows($resultat)) { |
---|
| 333 | spip_query("INSERT INTO spip_types_documents (titre, extension, mime_type, inclus, upload) VALUES ('Keyhole Markup Language','kml', 'application/vnd.google-earth.kml+xml', 'non', 'oui')"); |
---|
| 334 | } |
---|
| 335 | $resultat = spip_query("SELECT * FROM spip_types_documents WHERE extension = 'kmz'"); |
---|
| 336 | if(!spip_num_rows($resultat)) { |
---|
| 337 | spip_query("INSERT INTO spip_types_documents (titre, extension, mime_type, inclus, upload) VALUES ('Keyhole Markup Language (compressed)','kmz', 'application/vnd.google-earth.kmz', 'non', 'oui')"); |
---|
| 338 | } |
---|
| 339 | |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | |
---|
| 343 | } |
---|
| 344 | |
---|
| 345 | function charger_parametres() { |
---|
| 346 | $params=array(); |
---|
| 347 | $resultat= spip_query("SELECT * FROM spip_arty_parametres"); |
---|
| 348 | if (spip_num_rows($resultat)) { |
---|
| 349 | while ($row=spip_fetch_array($resultat)) { |
---|
| 350 | $params[$row['parametre']] = $row['valeur']; |
---|
| 351 | } |
---|
| 352 | } |
---|
| 353 | |
---|
| 354 | return $params; |
---|
| 355 | } |
---|
| 356 | |
---|
| 357 | function traiter_get() { |
---|
| 358 | //print_r($_GET); |
---|
| 359 | |
---|
| 360 | $param_accepte=array('edito','video-hasard','rubrique-news','image-hasard', 'rubart_une'); |
---|
| 361 | |
---|
| 362 | if(isset($_GET['ajouter']) && isset($_GET['verif'])){ |
---|
| 363 | $param=$_GET['ajouter']; |
---|
| 364 | if(in_array($param, $param_accepte) && $_GET['verif']==$_SESSION['id_check']) { |
---|
| 365 | |
---|
| 366 | if(isset($_GET['id_rubrique'])) { |
---|
| 367 | $id_rubrique=(int) $_GET['id_rubrique']; |
---|
| 368 | |
---|
| 369 | if(is_numeric($id_rubrique)){ |
---|
| 370 | $resultat = spip_query("SELECT * FROM spip_arty_paramassoc WHERE param = '$param' AND id_rubrique = $id_rubrique"); |
---|
| 371 | if(!spip_num_rows($resultat)) { |
---|
| 372 | spip_query("INSERT INTO spip_arty_paramassoc (param, id_rubrique) VALUES ('$param', $id_rubrique)"); |
---|
| 373 | } |
---|
| 374 | |
---|
| 375 | } |
---|
| 376 | |
---|
| 377 | } elseif(isset($_GET['id_article'])) { |
---|
| 378 | $id_article=(int) $_GET['id_article']; |
---|
| 379 | |
---|
| 380 | if(is_numeric($id_article)){ |
---|
| 381 | $resultat = spip_query("SELECT * FROM spip_arty_paramassoc WHERE param = '$param' AND id_article = $id_article"); |
---|
| 382 | if(!spip_num_rows($resultat)) { |
---|
| 383 | spip_query("INSERT INTO spip_arty_paramassoc (param, id_article) VALUES ('$param', $id_article)"); |
---|
| 384 | } |
---|
| 385 | |
---|
| 386 | } |
---|
| 387 | |
---|
| 388 | } |
---|
| 389 | |
---|
| 390 | |
---|
| 391 | } |
---|
| 392 | |
---|
| 393 | } |
---|
| 394 | |
---|
| 395 | if(isset($_GET['supprimer']) && isset($_GET['verif'])){ |
---|
| 396 | $id_assoc=(int) $_GET['supprimer']; |
---|
| 397 | if( is_numeric($id_assoc) && $_GET['verif']==$_SESSION['id_check']) { |
---|
| 398 | spip_query("DELETE FROM spip_arty_paramassoc WHERE id_assoc = $id_assoc"); |
---|
| 399 | } |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | } |
---|
| 403 | |
---|
| 404 | |
---|
| 405 | function afficher_selectionne($page, $param) { |
---|
| 406 | |
---|
| 407 | $resultat = spip_query("SELECT * FROM spip_arty_paramassoc WHERE param = '$param'"); |
---|
| 408 | if(spip_num_rows($resultat)) { |
---|
| 409 | echo "<ul class='liste-association'>"; |
---|
| 410 | while($row=spip_fetch_array($resultat)) { |
---|
| 411 | //print_r($row); |
---|
| 412 | if(is_numeric($row['id_article'])) { |
---|
| 413 | $lart=spip_query("SELECT titre FROM spip_articles WHERE id_article =".$row['id_article']); |
---|
| 414 | if(spip_num_rows($lart)) { |
---|
| 415 | |
---|
| 416 | $lart=spip_fetch_array($lart); |
---|
| 417 | |
---|
| 418 | |
---|
| 419 | echo "<li class='liste-article'>— ".$lart['titre']; |
---|
| 420 | echo "<a href='?exec=$page&supprimer=".$row['id_assoc']."&verif=".$_SESSION['id_check']."#$param'>"; |
---|
| 421 | echo "<img src='"._DIR_IMG_PACK."/croix-rouge.gif' alt ='x' title='"._T("arty:supprimer")."' />"; |
---|
| 422 | echo "</a>"; |
---|
| 423 | |
---|
| 424 | echo "</li>"; |
---|
| 425 | |
---|
| 426 | |
---|
| 427 | } else { |
---|
| 428 | |
---|
| 429 | spip_query("DELETE FROM spip_arty_paramassoc WHERE id_assoc =".$row['id_assoc']); |
---|
| 430 | |
---|
| 431 | } |
---|
| 432 | } |
---|
| 433 | //print_r($row); |
---|
| 434 | elseif(is_numeric($row['id_rubrique'])) { |
---|
| 435 | $lart=spip_query("SELECT titre FROM spip_rubriques WHERE id_rubrique =".$row['id_rubrique']); |
---|
| 436 | if(spip_num_rows($lart)) { |
---|
| 437 | |
---|
| 438 | $lart=spip_fetch_array($lart); |
---|
| 439 | |
---|
| 440 | |
---|
| 441 | echo "<li class='liste-rubrique'>— ".$lart['titre']; |
---|
| 442 | echo "<a href='?exec=$page&supprimer=".$row['id_assoc']."&verif=".$_SESSION['id_check']."#$param'>"; |
---|
| 443 | echo "<img src='"._DIR_IMG_PACK."/croix-rouge.gif' alt ='x' title='"._T("arty:supprimer")."' />"; |
---|
| 444 | echo "</a>"; |
---|
| 445 | |
---|
| 446 | echo "</li>"; |
---|
| 447 | |
---|
| 448 | |
---|
| 449 | } else { |
---|
| 450 | |
---|
| 451 | spip_query("DELETE FROM spip_arty_paramassoc WHERE id_assoc =".$row['id_assoc']); |
---|
| 452 | |
---|
| 453 | } |
---|
| 454 | } |
---|
| 455 | } |
---|
| 456 | echo "</ul>"; |
---|
| 457 | return true; |
---|
| 458 | |
---|
| 459 | } else { return false; } |
---|
| 460 | |
---|
| 461 | } |
---|
| 462 | |
---|
| 463 | |
---|
| 464 | ?> |
---|