314c311a |
1 | <?php |
2 | /** |
3 | * Fichier racine - porte d'entrée principale du site |
4 | * |
5 | * Ce fichier permet de faire appel aux différentes entités (documents), via leur id, leur |
6 | * identifier (lien permanent). Il permet aussi d'appeler un template particulier (via l'argument |
7 | * page=) |
8 | * Voici des exemples d'utilisations |
9 | * <code> |
10 | * index.php?/histoire/france/charlemagne-le-pieux |
11 | * index.php?id=48 |
12 | * index.php?page=rss20 |
13 | * index.php?do=view&idtype=2 |
14 | * </code> |
15 | * |
16 | * PHP versions 4 et 5 |
17 | * |
18 | * LODEL - Logiciel d'Edition ELectronique. |
19 | * |
20 | * Copyright (c) 2001-2002, Ghislain Picard, Marin Dacos |
21 | * Copyright (c) 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot |
22 | * Copyright (c) 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou |
23 | * Copyright (c) 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou |
24 | * Copyright (c) 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse |
25 | * Copyright (c) 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot |
26 | * Copyright (c) 2008, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière |
27 | * Copyright (c) 2009, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière |
28 | * |
29 | * Home page: http://www.lodel.org |
30 | * |
31 | * E-Mail: lodel@lodel.org |
32 | * |
33 | * All Rights Reserved |
34 | * |
35 | * This program is free software; you can redistribute it and/or modify |
36 | * it under the terms of the GNU General Public License as published by |
37 | * the Free Software Foundation; either version 2 of the License, or |
38 | * (at your option) any later version. |
39 | * |
40 | * This program is distributed in the hope that it will be useful, |
41 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
42 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
43 | * GNU General Public License for more details. |
44 | * |
45 | * You should have received a copy of the GNU General Public License |
46 | * along with this program; if not, write to the Free Software |
47 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
48 | * |
49 | * @author Ghislain Picard |
50 | * @author Jean Lamy |
51 | * @author Pierre-Alain Mignot |
52 | * @copyright 2001-2002, Ghislain Picard, Marin Dacos |
53 | * @copyright 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot |
54 | * @copyright 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou |
55 | * @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou |
56 | * @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse |
57 | * @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot |
58 | * @copyright 2008, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière |
59 | * @copyright 2009, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière |
60 | * @licence http://www.gnu.org/copyleft/gpl.html |
61 | * @version CVS:$Id: |
62 | * @package lodel/source |
63 | */ |
64 | |
65 | require 'siteconfig.php'; |
66 | |
67 | try |
68 | { |
69 | //gestion de l'authentification |
70 | include 'auth.php'; |
71 | authenticate(); |
72 | |
73 | // record the url if logged |
74 | if (C::get('visitor', 'lodeluser')) { |
75 | recordurl(); |
76 | } |
77 | |
78 | if(!C::get('debugMode', 'cfg') && !C::get('visitor', 'lodeluser')) |
79 | { |
80 | if(View::getView()->renderIfCacheIsValid()) exit(); |
81 | } |
82 | |
83 | $accepted_logic = array(); |
84 | $called_logic = null; |
85 | |
86 | if ($do = C::get('do')) |
87 | { |
88 | if ($do === 'edit' || $do === 'view') |
89 | { |
90 | // check for the right to change this document |
91 | if (!($idtype = C::get('idtype'))) { |
92 | trigger_error('ERROR: idtype must be given', E_USER_ERROR); |
93 | } |
94 | defined('INC_CONNECT') || include 'connect.php'; // init DB if not already done |
95 | $vo = DAO::getDAO('types')->find("id='{$idtype}' and public>0 and status>0"); |
96 | if (!$vo) { |
97 | trigger_error("ERROR: you are not allowed to add this kind of document", E_USER_ERROR); |
98 | } |
99 | unset($vo); |
100 | if(!C::get('editor', 'lodeluser')) |
101 | { |
102 | $lodeluser['temporary'] = true; |
103 | $lodeluser['rights'] = LEVEL_REDACTOR; // grant temporary |
104 | $lodeluser['visitor'] = 1; |
105 | $lodeluser['groups'] = 1; |
106 | $lodeluser['editor'] = 0; |
107 | $lodeluser['redactor'] = 1; |
108 | $lodeluser['admin'] = 0; |
109 | $lodeluser['adminlodel'] = 0; |
110 | $GLOBALS['nodesk'] = true; |
111 | C::setUser($lodeluser); |
112 | unset($lodeluser); |
113 | $_REQUEST['clearcache'] = false; |
114 | C::set('nocache', false); |
115 | } |
116 | $accepted_logic = array('entities_edition'); |
117 | C::set('lo', 'entities_edition'); |
118 | $called_logic = 'entities_edition'; |
119 | } elseif('_' === $do{0}) { |
120 | $accepted_logic = array('plugins'); |
121 | C::set('lo', 'plugins'); |
122 | } else { |
123 | trigger_error('ERROR: unknown action', E_USER_ERROR); |
124 | } |
125 | } |
126 | |
127 | Controller::getController()->execute($accepted_logic, $called_logic); |
128 | exit(); |
129 | } |
130 | catch(LodelException $e) |
131 | { |
132 | echo $e->getContent(); |
133 | exit(); |
134 | } |
135 | ?> |