3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2013 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
13 if (!defined("_ECRIRE_INC_VERSION")) return;
17 * Cette action permet de basculer du mode image au mode document et vice versa
19 * http://doc.spip.org/@action_changer_mode_document_dist
21 * @param int $id_document
25 function action_changer_mode_document_dist($id_document=null, $mode=null){
26 if (is_null($id_document) OR is_null($mode)){
27 $securiser_action = charger_fonction('securiser_action', 'inc');
28 $arg = $securiser_action();
30 if (!preg_match(",^(\d+)\W(\w+)$,", $arg, $r))
31 spip_log("action_changer_mode_document $arg pas compris");
34 list($id_document, $mode) = $r;
39 AND include_spip('inc/autoriser')
40 AND autoriser('modifier','document',$id_document))
41 action_changer_mode_document_post($id_document, $mode);
44 // http://doc.spip.org/@action_changer_mode_document_post
45 function action_changer_mode_document_post($id_document, $mode){
46 // - id_document le doc a modifier
47 // - mode le mode a lui donner
48 if ($id_document = intval($id_document)
49 AND in_array($mode, array('vignette', 'image', 'document'))) {
50 include_spip('action/editer_document');
51 document_modifier($id_document,array('mode'=>$mode));