Browse Source

nettoyage de code mort encore (documents)

pull/1/head
Cerdic 3 years ago
parent
commit
588eb3cbb2
  1. 22
      action/crayons_upload.php

22
action/crayons_upload.php

@ -32,23 +32,11 @@ function action_crayons_upload() {
// on n'accepte qu'un seul document à la fois, dans la variable 'upss'
if ($file = $_FILES['upss']
and $file['error'] == 0) {
$source = $file['tmp_name']; # /tmp/php/phpxxx
$nom_envoye = $file['name']; # mon-image.jpg
include_spip('plugins/installer'); // spip_version_compare dans SPIP 3.x
include_spip('inc/plugin'); // spip_version_compare dans SPIP 2.x
if (function_exists('spip_version_compare')) { // gerer son absence dans les branche precedente a SPIP 2.x
if (spip_version_compare($GLOBALS['spip_version_branche'], '3.0.0alpha', '>=')) {
define('_SPIP3', true);
}
}
if (defined('_SPIP3')) {
include_spip('action/ajouter_documents');
$ajouter_un_document = charger_fonction('ajouter_un_document', 'action');
$id = $ajouter_un_document('new', $file, $type, $id, 'document');
} else {
include_spip('inc/ajouter_documents');
$id = ajouter_un_document($source, $nom_envoye, $type, $id, 'document', $id_document = 0, $documents_actifs, $titrer = true);
$ajouter_documents = charger_fonction('ajouter_documents', 'action');
$id = $ajouter_documents('new', array($file), $type, $id, 'document');
if ($id) {
$id = reset($id);
}
}

Loading…
Cancel
Save