[SPIP] +2.1.12
[velocampus/web/www.git] / www / ecrire / exec / documenter.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2011 *
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/@exec_documenter_dist
16 function exec_documenter_dist()
17 {
18 $script = _request('script'); // generalisation a tester
19 $iframe = _request('iframe');
20 $album = _request('s');
21 $type = _request('type');
22 $id = intval(_request(id_table_objet($type)));
23 exec_documenter_args($id, $type, $script, $album, $iframe);
24 }
25
26 // http://doc.spip.org/@exec_documenter_args
27 function exec_documenter_args($id, $type, $script, $album='', $iframe=false)
28 {
29 if (!$id OR !autoriser('modifier', $type, $id) OR !preg_match('/^\w*$/', $script)) {
30 include_spip('inc/minipres');
31 echo minipres();
32 } else {
33 $album = !$album ? 'documents' : 'portfolio';
34 include_spip('inc/actions');
35 $documenter = charger_fonction('documenter', 'inc');
36 if ($iframe==='iframe') {
37 $res = $documenter($id, $type, "portfolio", 'ajax', '', $script).
38 $documenter($id, $type, "documents", 'ajax', '', $script);
39 ajax_retour("<div class='upload_answer upload_document_added'>".$res."</div>",false);
40 } else ajax_retour($documenter($id, $type, $album, 'ajax', '', $script));
41 }
42 }
43 ?>