[ 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 // http://doc.spip.org/@action_iconifier_dist 16 function action_iconifier_dist() 17 { 18 include_spip('inc/actions'); 19 $securiser_action = charger_fonction('securiser_action', 'inc'); 20 $arg = $securiser_action(); 21 $iframe_redirect = _request('iframe_redirect'); 22 23 $arg = rawurldecode($arg); 24 25 if (!preg_match(',^-?\d*(\D)(.*)$,',$arg, $r)) 26 spip_log("action iconifier: $arg pas compris"); 27 elseif ($r[1] == '+') 28 action_spip_image_ajouter_dist($r[2]); 29 else action_spip_image_effacer_dist($r[2]); 30 31 if(_request("iframe") == 'iframe') { 32 $redirect = urldecode($iframe_redirect)."&iframe=iframe"; 33 redirige_par_entete(urldecode($redirect)); 34 } 35 } 36 37 // http://doc.spip.org/@action_spip_image_effacer_dist 38 function action_spip_image_effacer_dist($arg) { 39 40 if (!strstr($arg, "..")) 41 @unlink(_DIR_LOGOS . $arg); 42 } 43 44 // 45 // Ajouter un logo 46 // 47 48 // $source = $_FILES[0] 49 // $dest = arton12.xxx 50 // http://doc.spip.org/@action_spip_image_ajouter_dist 51 function action_spip_image_ajouter_dist($arg) { 52 global $sousaction2, $source, $formats_logos; 53 54 include_spip('inc/getdocument'); 55 if (!$sousaction2) { 56 if (!$_FILES) $_FILES = $GLOBALS['HTTP_POST_FILES']; 57 $source = (is_array($_FILES) ? array_pop($_FILES) : ""); 58 } 59 if ($source) { 60 $f =_DIR_LOGOS . $arg . '.tmp'; 61 62 if (!is_array($source)) 63 // fichier dans upload/ 64 $source = @copy(determine_upload() . $source, $f); 65 else { 66 // Intercepter une erreur a l'envoi 67 if (check_upload_error($source['error'])) 68 $source =""; 69 else 70 // analyse le type de l'image (on ne fait pas confiance au nom de 71 // fichier envoye par le browser : pour les Macs c'est plus sur) 72 73 $source = deplacer_fichier_upload($source['tmp_name'], $f); 74 } 75 } 76 if (!$source) 77 spip_log("pb de copie pour $f"); 78 else { 79 $size = @getimagesize($f); 80 $type = !$size ? '': ($size[2] > 3 ? '' : $formats_logos[$size[2]-1]); 81 if ($type) { 82 $poids = filesize($f); 83 84 if (_LOGO_MAX_SIZE > 0 85 AND $poids > _LOGO_MAX_SIZE*1024) { 86 @unlink ($f); 87 check_upload_error(6, 88 _T('info_logo_max_poids', 89 array('maxi' => taille_en_octets(_LOGO_MAX_SIZE*1024), 90 'actuel' => taille_en_octets($poids)))); 91 } 92 93 if (_LOGO_MAX_WIDTH * _LOGO_MAX_HEIGHT 94 AND ($size[0] > _LOGO_MAX_WIDTH 95 OR $size[1] > _LOGO_MAX_HEIGHT)) { 96 @unlink ($f); 97 check_upload_error(6, 98 _T('info_logo_max_taille', 99 array( 100 'maxi' => 101 _T('info_largeur_vignette', 102 array('largeur_vignette' => _LOGO_MAX_WIDTH, 103 'hauteur_vignette' => _LOGO_MAX_HEIGHT)), 104 'actuel' => 105 _T('info_largeur_vignette', 106 array('largeur_vignette' => $size[0], 107 'hauteur_vignette' => $size[1])) 108 ))); 109 } 110 @rename ($f, _DIR_LOGOS . $arg . ".$type"); 111 } 112 else { 113 @unlink ($f); 114 check_upload_error(6,_T('info_logo_format_interdit', 115 array('formats' => join(', ', $formats_logos)))); 116 } 117 118 } 119 } 120 ?>
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 |
![]() |