[ 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/actions'); 16 17 // http://doc.spip.org/@inc_iconifier_dist 18 function inc_iconifier_dist($id_objet, $id, $script) { 19 20 $texteon = $GLOBALS['logo_libelles'][($id OR $id_objet != 'id_rubrique') ? $id_objet : 'id_racine']; 21 22 $chercher_logo = charger_fonction('chercher_logo', 'inc'); 23 24 // Add the redirect url when uploading via iframe 25 $iframe_script = generer_url_ecrire('iconifier',"type=$id_objet&$id_objet=$id&script=$script",true); 26 $iframe = "<input type='hidden' name='iframe_redirect' value='".rawurlencode($iframe_script)."' />\n"; 27 28 if (!$logo = $chercher_logo($id, $id_objet, 'on')) { 29 $masque = indiquer_logo($texteon, $id_objet, 'on', $id, $script, $iframe); 30 $res = block_parfois_visible('on', "<b>$texteon</b>", $masque); 31 } else { 32 list($img, $clic) = decrire_logo($id_objet,'on',$id, 170, 170, $logo, $texteon, $script); 33 34 $masque = block_parfois_visible('on', "<b>$texteon</b><br />$img", $clic, 'margin-bottom: -2px'); 35 36 $res = "<div style='text-align: center'>$masque</div><br /><br />";; 37 $texteoff = _T('logo_survol'); 38 39 if ($logo = $chercher_logo($id, $id_objet, 'off')) { 40 41 list($img, $clic) = decrire_logo($id_objet, 'off', $id, 170, 170, $logo, $texteoff, $script); 42 43 $masque = block_parfois_visible('off', "<b>$texteoff</b><br />$img", $clic, 'margin-bottom: -2px'); 44 45 $res .= "<div style='text-align: center'>$masque</div>"; 46 } else { 47 $masque = indiquer_logo($texteoff, $id_objet, 'off', $id, $script, $iframe); 48 $res .= block_parfois_visible('off', "<b>$texteoff</b>", $masque); 49 } 50 } 51 52 $res = debut_cadre_relief("image-24.gif", true) 53 . "<div class='verdana1' style='text-align: center;'>" 54 . $res 55 . "</div>" 56 . fin_cadre_relief(true); 57 58 $js = ""; 59 if(_request("exec")!="iconifier") { 60 $js .= "<script src='"._DIR_JAVASCRIPT."async_upload.js' type='text/javascript'></script>\n"; 61 $js .= <<<EOF 62 <script type='text/javascript'> 63 $("form.form_upload_icon").async_upload(async_upload_icon); 64 </script> 65 EOF; 66 } 67 68 return ajax_action_greffe("iconifier-$id", $res).$js; 69 70 } 71 72 global $logo_libelles; 73 $logo_libelles = array( 74 'id_article' => _T('logo_article').aide ("logoart"), 75 'id_auteur' => _T('logo_auteur').aide ("logoart"), 76 'id_breve' => _T('logo_breve').aide ("breveslogo"), 77 'id_syndic' => _T('logo_site')." ".aide ("rublogo"), 78 'id_mot' => _T('logo_mot_cle').aide("breveslogo"), 79 'id_rubrique' => _T('logo_rubrique')." ".aide ("rublogo"), 80 'id_racine' => _T('logo_standard_rubrique')." ".aide ("rublogo") 81 ); 82 83 // http://doc.spip.org/@indiquer_logo 84 function indiquer_logo($titre, $id_objet, $mode, $id, $script, $iframe_script) { 85 86 global $formats_logos; 87 $afficher = ""; 88 $reg = '[.](' . join('|', $formats_logos) . ')$'; 89 90 if ($GLOBALS['flag_upload'] 91 AND $dir_ftp = determine_upload() 92 AND $fichiers = preg_files($dir_ftp, $reg)) { 93 foreach ($fichiers as $f) { 94 $f = substr($f, strlen($dir_ftp)); 95 $afficher .= "\n<option value='$f'>$f</option>"; 96 } 97 } 98 if (!$afficher) { 99 if ($dir_ftp) { 100 $afficher = _T('info_installer_images_dossier', 101 array('upload' => '<b>' . joli_repertoire($dir_ftp) . '</b>')); 102 } 103 } else { 104 $afficher = "\n<div style='text-align: left'>" . 105 _T('info_selectionner_fichier', 106 array('upload' => '<b>' . joli_repertoire($dir_ftp) . '</b>')) . 107 ":</div>" . 108 "\n<select name='source' class='forml' size='1'>$afficher\n</select>" . 109 "\n<div align='" . 110 $GLOBALS['spip_lang_right'] . 111 "'><input name='sousaction2' type='submit' value='". 112 _T('bouton_choisir') . 113 "' class='fondo spip_xx-small' /></div>"; 114 } 115 116 $afficher = "\n" . 117 _T('info_telecharger_nouveau_logo') . 118 "<br />" . 119 "\n<input name='image' type='file' class='forml spip_xx-small' size='15' />" . 120 "<div align='" . $GLOBALS['spip_lang_right'] . "'>" . 121 "\n<input name='sousaction1' type='submit' value='" . 122 _T('bouton_telecharger') . 123 "' class='fondo spip_xx-small' /></div>" . 124 $afficher; 125 126 $type = type_du_logo($id_objet); 127 return generer_action_auteur('iconifier', 128 "$id+$type$mode$id", 129 generer_url_ecrire($script, "$id_objet=$id", true), 130 $iframe_script.$afficher, 131 " method='post' enctype='multipart/form-data' class='form_upload_icon'"); 132 } 133 134 // http://doc.spip.org/@decrire_logo 135 function decrire_logo($id_objet, $mode, $id, $width, $height, $img, $titre="", $script="") { 136 137 list($fid, $dir, $nom, $format) = $img; 138 include_spip('inc/filtres_images'); 139 $res = image_reduire("<img src='$fid' alt='' />", $width, $height); 140 141 if ($res) 142 $res = "<div><a href='" . $fid . "'>$res</a></div>"; 143 else 144 $res = "<img src='$fid' width='$width' height='$height' alt=\"" . htmlentities($titre) . '" />'; 145 if ($taille = @getimagesize($fid)) 146 $taille = _T('info_largeur_vignette', array('largeur_vignette' => $taille[0], 'hauteur_vignette' => $taille[1])); 147 148 return array($res, 149 "<div class='spip_xx-small'>" . 150 $taille . 151 "\n<br />[" . 152 ajax_action_auteur("iconifier", "$id-$nom.$format", $script, "$id_objet=$id&type=$id_objet", array(_T('lien_supprimer')),'',"function(r,status) {this.innerHTML = r; \$('.form_upload_icon',this).async_upload(async_upload_icon);}") . 153 "]</div>"); 154 } 155 ?>
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 |
![]() |