forked from anwiki/anwiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
76 lines (68 loc) · 2.07 KB
/
index.php
File metadata and controls
76 lines (68 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* Anwiki is a multilingual content management system <http://www.anwiki.com>
* Copyright (C) 2007-2009 Antoine Walter <http://www.anw.fr>
*
* Anwiki is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Anwiki is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Anwiki. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Anwiki main script.
* @package Anwiki
* @version $Id: index.php 350 2010-12-12 22:12:07Z anw $
* @copyright 2007-2009 Antoine Walter
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License 3
*/
try
{
//should we load minimal mode?
if (in_array(@$_GET['a'], array('install')) || isset($_GET['anwiki_mode_minimal']))
{
define('ANWIKI_MODE_MINIMAL', true);
}
require_once("engine.inc.php");
//install redirect
if (!file_exists(ANWIKI_INSTALL_LOCK) && AnwEnv::_GET('a')!='install')
{
$sUrlInstall = AnwEnv::_SERVER('SCRIPT_URI').'?a=install';
header("Location: ".$sUrlInstall);
print '<a href="'.AnwUtils::xQuote($sUrlInstall).'">'.AnwUtils::xQuote($sUrlInstall).'</a>';
exit;
}
AnwDebug::startbench("preparing action", true);
//load action code
try
{
$sAction = strtolower( AnwEnv::_GET(AnwAction::GET_ACTIONNAME, "view") );
$oAction = AnwAction::loadComponent($sAction);
}
catch(AnwException $e)
{
$sAction = "view";
$oAction = AnwAction::loadComponent($sAction);
}
//security check
if (ANWIKI_MODE_MINIMAL && !($oAction instanceof AnwActionMinimal))
{
AnwDieCriticalError("Unauthorized mode / bad URL");
}
$oAction->setAsCurrentAction();
AnwDebug::log("Action : ".$sAction);
AnwDebug::stopbench("preparing action");
//run
$oAction->runAndOutput();
}
catch(AnwException $e)
{
errorApp($e);
}
?>