"._T('magusine:acces_a_la_page')."

"; fin_page(); exit; } $message_upload = traiter_post(); traiter_get(); echo debut_page(); echo barre_onglets("arty", "avance"); //affiche la barre des onglets du groupe "magusine", l'onglet courant est "avance". echo debut_gauche(); if ($message_upload && $message_upload != "arty:upload_reussi") { echo debut_cadre_relief(_DIR_PLUGIN_ARTY.'/images/emblem-important.png', true, "", _T('arty:erreur')); echo "

"._T($message_upload)."

"; echo fin_cadre_relief(true); } echo debut_cadre_relief(_DIR_PLUGIN_ARTY.'/images/aide.png', true, "", _T('arty:info')); echo _T("arty:sideinfo_avance"); echo fin_cadre_relief(true); echo debut_droite(); gros_titre(_T("arty:gestion_bloc_libre")); echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."/images/config.png", true, "", _T('arty:creer_un_bloc_libre')); echo "
"; echo "
"; echo _T('arty:entrez_donnees_nouveau_bloc'); echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "

"._T('arty:bloc_lien')."
\n"; echo "\n"; echo "

"._T('arty:bloc_image')."
\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo fin_cadre_trait_couleur(); $tousblocs = spip_query("SELECT * FROM spip_arty_bloclibre"); while ($row=spip_fetch_array($tousblocs)) { echo debut_cadre_trait_couleur(_DIR_PLUGIN_ARTY."/images/config.png", true, "", htmlspecialchars($row['titre'])); echo ""; $chem = creer_repertoire_documents("illu-bloc-libre"); $chem=_DIR_DOC."illu-bloc-libre/"; $handle = @opendir($chem); $logo = false; while($fichier = @readdir($handle)) { if (ereg("^illu_bloc_libre-".$row['id_bloc_libre']."\.(jpg|png|gif)$", $fichier)) { $logo = $fichier; } } if ($logo){ // le nombre aléatoire permet d'éviter que le navigateur affiche la version en cache de l'image. $image = "

"._T("arty:logo_actuel").":

"; $image .="
\n" ."" ."" ."

" ."
"; } else { $image=""; } $texte = $image."
\n" ."" ."" .(isset($_POST['retour']) ? "" : "") ."" ."" ."

"._T('arty:bloc_lien')."
" ."" ."

"._T('arty:bloc_image')."
" ."


" ."" ._T("arty:attention_modif_globale")."
" ."
" ."
\n" ."" ."" ."
" ."
"; $visible = ($_POST['bloc'] == $row['id_bloc_libre']) ? true : false; echo block_parfois_visible("bloc".$row['id_bloc_libre'], _T('arty:modifier_ce_bloc'), $texte, '', $visible); echo fin_cadre_trait_couleur(); } echo fin_gauche(); echo fin_page(); } function traiter_post() { $message_upload = ""; if ($_POST['action']=='nouveaubloc' && isset($_POST['titre']) && isset($_POST['texte']) ) { $titre=trim(addslashes($_POST['titre'])); $texte=trim(addslashes($_POST['texte'])); $lien=trim(addslashes($_POST['lien'])); if($lien=="http://") { $lien=""; } if ($titre!="") { // && $texte!="") { spip_query("INSERT INTO spip_arty_bloclibre(titre, contenu,lien) VALUES('$titre', '$texte', '$lien')"); $result = spip_query("SELECT LAST_INSERT_ID();"); if ($result){ $arr = spip_fetch_array($result); $id = (int) current($arr); if (!is_nan($id)){ $message_upload = traiter_upload_image('illu_bloc_libre','illu-bloc-libre',$id); } } } } if ($_POST['action']=='supprimerbloc' && isset($_POST['id_bloc'])) { $id_bloc=(int) $_POST['id_bloc']; if (!is_nan($id_bloc)) { spip_query("DELETE FROM spip_arty_bloclibre WHERE id_bloc_libre= $id_bloc"); supprimer_illu_bloc($id_bloc); // supprimer les associations spip_query("DELETE FROM spip_arty_bloclibreassoc WHERE id_bloc_libre= $id_bloc"); } } if ($_POST['action']=='supprimerillu' && isset($_POST['id_bloc'])) { $id_bloc=(int) $_POST['id_bloc']; if (!is_nan($id_bloc)) { //spip_query("DELETE FROM spip_arty_bloclibre WHERE id_bloc_libre= $id_bloc"); supprimer_illu_bloc($id_bloc); } } if ($_POST['action']=='modifierbloc' && isset($_POST['id_bloc']) && isset($_POST['titre']) && isset($_POST['texte']) ) { //print_r($_POST); $id_bloc=(int) $_POST['id_bloc']; $titre=trim(addslashes($_POST['titre'])); $texte=trim(addslashes($_POST['texte'])); $lien=trim(addslashes($_POST['lien'])); if($lien=="http://") { $lien=""; } if ($titre!="" && !is_nan($id_bloc)) { spip_query("UPDATE spip_arty_bloclibre SET titre='$titre', contenu='$texte', lien='$lien' WHERE id_bloc_libre=$id_bloc"); $message_upload = traiter_upload_image('illu_bloc_libre','illu-bloc-libre',$id_bloc); } //redirection vers la page d'origine if (isset($_POST['retour'])) { header('Location: '.$_POST['retour']); } } return $message_upload; } function supprimer_illu_bloc($id_bloc) { //$chem = creer_repertoire_documents("illu-bloc-libre"); $chem = _DIR_DOC."illu-bloc-libre/"; $handle = @opendir($chem); while($fichier = @readdir($handle)) { if (!$id_bloc) { if (ereg("^illu_bloc_libre\.(jpg|png|gif)$", $fichier)){ @unlink($chem.$fichier); } } else { if (ereg("^illu_bloc_libre-$id_bloc\.(jpg|png|gif)$", $fichier)){ @unlink($chem.$fichier); } } } } function traiter_get() { //print_r($_GET); $param_accepte=array('edito'); if(isset($_GET['ajouter']) && isset($_GET['verif'])){ $param=$_GET['ajouter']; if(in_array($param, $param_accepte) && $_GET['verif']==$_SESSION['id_check']) { if(isset($_GET['id_rubrique'])) { $id_rubrique=(int) $_GET['id_rubrique']; if(is_numeric($id_rubrique)){ $resultat = spip_query("SELECT * FROM spip_arty_paramassoc WHERE param = '$param' AND id_rubrique = $id_rubrique"); if(!spip_num_rows($resultat)) { spip_query("INSERT INTO spip_arty_paramassoc (param, id_rubrique) VALUES ('$param', $id_rubrique)"); } } } elseif(isset($_GET['id_article'])) { $id_article=(int) $_GET['id_article']; if(is_numeric($id_article)){ $resultat = spip_query("SELECT * FROM spip_arty_paramassoc WHERE param = '$param' AND id_article = $id_article"); if(!spip_num_rows($resultat)) { spip_query("INSERT INTO spip_arty_paramassoc (param, id_article) VALUES ('$param', $id_article)"); } } } } } if(isset($_GET['supprimer']) && isset($_GET['verif'])){ $id_assoc=(int) $_GET['supprimer']; if( is_numeric($id_assoc) && $_GET['verif']==$_SESSION['id_check']) { spip_query("DELETE FROM spip_arty_paramassoc WHERE id_assoc = $id_assoc"); } } } ?>