Skip to content
Extraits de code Groupes Projets
Valider c65b8758 rédigé par Antoine Pitrou's avatar Antoine Pitrou
Parcourir les fichiers

nouveaux types de documents (Gaetan)

parent 5aa7bb81
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
* text=auto !eol * text=auto !eol
IMG/icones/ai-dist.png -text
IMG/icones/aiff-dist.png -text IMG/icones/aiff-dist.png -text
IMG/icones/asf-dist.png -text IMG/icones/asf-dist.png -text
IMG/icones/avi-dist.png -text IMG/icones/avi-dist.png -text
IMG/icones/bmp-dist.png -text IMG/icones/bmp-dist.png -text
IMG/icones/bz2-dist.png -text IMG/icones/bz2-dist.png -text
IMG/icones/deb-dist.png -text
IMG/icones/defaut-dist.png -text IMG/icones/defaut-dist.png -text
IMG/icones/doc-dist.png -text IMG/icones/doc-dist.png -text
IMG/icones/dvi-dist.png -text
IMG/icones/eps-dist.png -text IMG/icones/eps-dist.png -text
IMG/icones/gif-dist.png -text IMG/icones/gif-dist.png -text
IMG/icones/gz-dist.png -text IMG/icones/gz-dist.png -text
...@@ -25,16 +28,20 @@ IMG/icones/qt-dist.png -text ...@@ -25,16 +28,20 @@ IMG/icones/qt-dist.png -text
IMG/icones/ra-dist.png -text IMG/icones/ra-dist.png -text
IMG/icones/ram-dist.png -text IMG/icones/ram-dist.png -text
IMG/icones/rm-dist.png -text IMG/icones/rm-dist.png -text
IMG/icones/rpm-dist.png -text
IMG/icones/rtf-dist.png -text IMG/icones/rtf-dist.png -text
IMG/icones/sdd-dist.png -text IMG/icones/sdd-dist.png -text
IMG/icones/sdw-dist.png -text IMG/icones/sdw-dist.png -text
IMG/icones/sit-dist.png -text IMG/icones/sit-dist.png -text
IMG/icones/sxc-dist.png -text
IMG/icones/sxi-dist.png -text IMG/icones/sxi-dist.png -text
IMG/icones/sxw-dist.png -text IMG/icones/sxw-dist.png -text
IMG/icones/tex-dist.png -text
IMG/icones/tgz-dist.png -text IMG/icones/tgz-dist.png -text
IMG/icones/tif-dist.png -text IMG/icones/tif-dist.png -text
IMG/icones/txt-dist.png -text IMG/icones/txt-dist.png -text
IMG/icones/wav-dist.png -text IMG/icones/wav-dist.png -text
IMG/icones/xcf-dist.png -text
IMG/icones/xls-dist.png -text IMG/icones/xls-dist.png -text
IMG/icones/xml-dist.png -text IMG/icones/xml-dist.png -text
IMG/icones/zip-dist.png -text IMG/icones/zip-dist.png -text
......
IMG/icones/ai-dist.png

4,02 ko

IMG/icones/deb-dist.png

4,06 ko

IMG/icones/dvi-dist.png

4,14 ko

IMG/icones/rpm-dist.png

4,01 ko

IMG/icones/sxc-dist.png

3,08 ko

IMG/icones/tex-dist.png

4,07 ko

IMG/icones/xcf-dist.png

4,2 ko

...@@ -514,53 +514,71 @@ function creer_base() { ...@@ -514,53 +514,71 @@ function creer_base() {
function remplir_type_documents() { function remplir_type_documents() {
// Images reconnues par PHP
$query = "INSERT IGNORE spip_types_documents (id_type, extension, titre, inclus) VALUES ". $query = "INSERT IGNORE spip_types_documents (id_type, extension, titre, inclus) VALUES ".
"(1, 'jpg', 'JPEG', 'image'), ". "(1, 'jpg', 'JPEG', 'image'), ".
"(2, 'png', 'PNG', 'image'), ". "(2, 'png', 'PNG', 'image'), ".
"(3, 'gif', 'GIF', 'image')"; "(3, 'gif', 'GIF', 'image')";
spip_query($query); spip_query($query);
// Autres images (peuvent utiliser le tag <img>)
$query = "INSERT IGNORE spip_types_documents (extension, titre, inclus) VALUES ". $query = "INSERT IGNORE spip_types_documents (extension, titre, inclus) VALUES ".
"('bmp', 'BMP', 'image'), ". "('bmp', 'BMP', 'image'), ".
"('psd', 'Photoshop', 'image'), ". "('psd', 'Photoshop', 'image'), ".
"('tif', 'TIFF', 'image')"; "('tif', 'TIFF', 'image')";
spip_query($query); spip_query($query);
// Multimedia (peuvent utiliser le tag <embed>)
$query = "INSERT IGNORE spip_types_documents (extension, titre, inclus) VALUES ". $query = "INSERT IGNORE spip_types_documents (extension, titre, inclus) VALUES ".
"('aiff', 'AIFF', 'embed'), ". "('aiff', 'AIFF', 'embed'), ".
"('asf', 'Windows Media', 'embed'), ". "('asf', 'Windows Media', 'embed'), ".
"('avi', 'Windows Media', 'embed'), ". "('avi', 'Windows Media', 'embed'), ".
"('mid', 'Midi', 'embed'), ".
"('mng', 'MNG', 'embed'), ".
"('mov', 'QuickTime', 'embed'), ".
"('mp3', 'MP3', 'embed'), ".
"('mpg', 'MPEG', 'embed'), ".
"('ogg', 'Ogg', 'embed'), ".
"('qt', 'QuickTime', 'embed'), ".
"('ra', 'RealAudio', 'embed'), ".
"('ram', 'RealAudio', 'embed'), ".
"('rm', 'RealAudio', 'embed'), ".
"('swf', 'Flash', 'embed'), ".
"('wav', 'WAV', 'embed'), ".
"('wmv', 'Windows Media', 'embed')";
spip_query($query);
// Documents varies
$query = "INSERT IGNORE spip_types_documents (extension, titre, inclus) VALUES ".
"('ai', 'Adobe Illustrator', 'non'), ".
"('bz2', 'BZip', 'non'), ". "('bz2', 'BZip', 'non'), ".
"('c', 'C source', 'non'), ".
"('deb', 'Debian', 'non'), ".
"('doc', 'Word', 'non'), ". "('doc', 'Word', 'non'), ".
"('djvu', 'DjVu', 'non'), ". "('djvu', 'DjVu', 'non'), ".
"('dvi', 'LaTeX DVI', 'non'), ".
"('eps', 'PostScript', 'non'), ". "('eps', 'PostScript', 'non'), ".
"('gz', 'GZ', 'non'), ". "('gz', 'GZ', 'non'), ".
"('h', 'C header', 'non'), ".
"('html', 'HTML', 'non'), ". "('html', 'HTML', 'non'), ".
"('mid', 'Midi', 'embed'), ". "('pas', 'Pascal', 'non'), ".
"('mov', 'QuickTime', 'embed'), ".
"('mp3', 'MP3', 'embed'), ".
"('mpg', 'MPEG', 'embed'), ".
"('ogg', 'Ogg Vorbis', 'embed'), ".
"('pdf', 'PDF', 'non'), ". "('pdf', 'PDF', 'non'), ".
"('ppt', 'PowerPoint', 'non'), ". "('ppt', 'PowerPoint', 'non'), ".
"('ps', 'PostScript', 'non'), ". "('ps', 'PostScript', 'non'), ".
"('qt', 'QuickTime', 'embed'), ". "('rpm', 'RedHat/Mandrake/SuSE', 'non'), ".
"('ra', 'RealAudio', 'embed'), ".
"('ram', 'RealAudio', 'embed'), ".
"('rm', 'RealAudio', 'embed'), ".
"('rtf', 'RTF', 'non'), ". "('rtf', 'RTF', 'non'), ".
"('sdd', 'StarOffice', 'non'), ". "('sdd', 'StarOffice', 'non'), ".
"('sdw', 'StarOffice', 'non'), ". "('sdw', 'StarOffice', 'non'), ".
"('sit', 'Stuffit', 'non'), ". "('sit', 'Stuffit', 'non'), ".
"('sxc', 'OpenOffice Calc', 'non'), ".
"('sxi', 'OpenOffice Impress', 'non'), ". "('sxi', 'OpenOffice Impress', 'non'), ".
"('sxw', 'OpenOffice', 'non'), ". "('sxw', 'OpenOffice', 'non'), ".
"('swf', 'Flash', 'embed'), ". "('tex', 'LaTeX', 'non'), ".
"('tgz', 'TGZ', 'non'), ". "('tgz', 'TGZ', 'non'), ".
"('txt', 'texte', 'non'), ". "('txt', 'texte', 'non'), ".
"('wav', 'WAV', 'embed'), ". "('xcf', 'GIMP multi-layer', 'non'), ".
"('xls', 'Excel', 'non'), ". "('xls', 'Excel', 'non'), ".
"('xml', 'XML', 'non'), ". "('xml', 'XML', 'non'), ".
"('wmv', 'Windows Media', 'embed'), ".
"('zip', 'Zip', 'non')"; "('zip', 'Zip', 'non')";
spip_query($query); spip_query($query);
} }
...@@ -1213,6 +1231,11 @@ function maj_base() { ...@@ -1213,6 +1231,11 @@ function maj_base() {
spip_query("ALTER TABLE spip_forum ADD INDEX id_syndic (id_syndic)"); spip_query("ALTER TABLE spip_forum ADD INDEX id_syndic (id_syndic)");
maj_version (1.601); maj_version (1.601);
} }
if ($version_installee < 1.602) {
// juste des types de documents en plus (creer_base())
maj_version (1.602);
}
} }
?> ?>
...@@ -144,10 +144,10 @@ if ($flag_ecrire) { ...@@ -144,10 +144,10 @@ if ($flag_ecrire) {
// (utilise pour les modifs de la base de donnees) // (utilise pour les modifs de la base de donnees)
// version de la base // version de la base
$spip_version = 1.601; $spip_version = 1.602;
// version de spip // version de spip
$spip_version_affichee = "1.6b7 CVS"; $spip_version_affichee = "1.6b8 CVS";
// version de spip / tag cvs // version de spip / tag cvs
if (ereg('Name: v(.*) ','$Name$', $regs)) $spip_version_affichee = $regs[1]; if (ereg('Name: v(.*) ','$Name$', $regs)) $spip_version_affichee = $regs[1];
......
...@@ -238,7 +238,6 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='', ...@@ -238,7 +238,6 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='',
if (!verifier_action_auteur("ajout_doc", $hash, $hash_id_auteur)) { if (!verifier_action_auteur("ajout_doc", $hash, $hash_id_auteur)) {
exit; exit;
} }
if (ereg("\.([^.]+)$", $orig, $match)) { if (ereg("\.([^.]+)$", $orig, $match)) {
$ext = addslashes(strtolower($match[1])); $ext = addslashes(strtolower($match[1]));
...@@ -257,9 +256,21 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='', ...@@ -257,9 +256,21 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='',
else return false; else return false;
// //
// Preparation // Recopier le fichier
// //
$dest = 'IMG/';
if (creer_repertoire('IMG', $ext))
$dest .= $ext.'/';
$dest .= ereg_replace("[^.a-zA-Z0-9_=-]+", "_", translitteration(ereg_replace("\.([^.]+)$", "", supprimer_tags(basename($orig)))));
$n = 0;
while (file_exists($newFile = $dest.($n++ ? '-'.$n : '').'.'.$ext));
$dest_path = $newFile;
if (!deplacer_fichier_upload($source, $dest_path)) return false;
//
// Preparation
//
if ($mode == 'vignette') { if ($mode == 'vignette') {
$id_document_lie = $id_document; $id_document_lie = $id_document;
$query = "UPDATE spip_documents SET mode='document' where id_document=$id_document_lie"; $query = "UPDATE spip_documents SET mode='document' where id_document=$id_document_lie";
...@@ -277,17 +288,9 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='', ...@@ -277,17 +288,9 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='',
} }
} }
$dest = 'IMG/'; //
if (creer_repertoire('IMG', $ext))
$dest .= $ext.'/';
$dest .= ereg_replace("[^.a-zA-Z0-9_=-]+", "_", translitteration(ereg_replace("\.([^.]+)$", "", supprimer_tags(basename($orig)))));
$n = 0;
while (file_exists($newFile = $dest.($n++ ? '-'.$n : '').'.'.$ext));
$dest_path = $newFile;
if (!deplacer_fichier_upload($source, $dest_path)) return false;
// Creer une vignette automatiquement // Creer une vignette automatiquement
//
$creer_preview=lire_meta("creer_preview"); $creer_preview=lire_meta("creer_preview");
$taille_preview=lire_meta("taille_preview"); $taille_preview=lire_meta("taille_preview");
$gd_formats = lire_meta("gd_formats"); $gd_formats = lire_meta("gd_formats");
...@@ -314,9 +317,8 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='', ...@@ -314,9 +317,8 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='',
} }
// //
// Recopier le fichier // Mettre a jour les infos du document uploade
// //
$size_image = getimagesize($dest_path); $size_image = getimagesize($dest_path);
$type_image = decoder_type_image($size_image[2]); $type_image = decoder_type_image($size_image[2]);
if ($type_image) { if ($type_image) {
...@@ -351,7 +353,6 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='', ...@@ -351,7 +353,6 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document, $doc_vignette='',
} }
return $id_document; return $id_document;
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter