This repository was archived by the owner on Dec 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
99 lines (93 loc) · 3.02 KB
/
index.php
File metadata and controls
99 lines (93 loc) · 3.02 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* Index file
*
* PHP Version 5.3.6
*
* @category Front
* @package Chaton
* @author Pierre Rudloff <rudloff@strasweb.fr>
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License
* @link http://cms.strasweb.fr
*/
/*
* Chez Free.fr, le fichier doit être renommé en .php5,
* mais du coup certains liens ne marchent plus...
* */
if (!is_file("config.php")) {
header('Location: install.php');
} else {
include_once "classes/Config.php";
$config=new Config();
include_once "classes/Plugin.php";
$plugins=Plugin::getList();
include "inc/localization.php";
//Essayons de garder les pages valides (HTML5).
include_once "classes/dom-enhancer/XMLDocument.php";
$doc=new DOMenhancer_XMLDocument();
$dom=$doc->DOM;
include "inc/version.php";
foreach ($plugins as $dir) {
$plugin=new Plugin($dir);
if ($plugin->enabled) {
$plugin->preHook();
}
}
include "inc/head.php";
$dom->html->body->addElement("div", null, array("id"=>"wrapper",
"data-role"=>"page"));
include "inc/header.php";
$mainsection=$dom->html->body->div->div->addElement(
"section", null, array(
"id"=>"main", "class"=>"main", "data-role"=>"collapsible-set",
"data-content-theme"=>"d"
)
);
include_once "classes/Article.php";
$lang=$config->multilingual?$config->lang:null;
$articles=Article::getList($lang);
if (isset($_GET["plugin"])) {
$curPage="plugin_".$_GET["plugin"];
include_once "classes/Plugin.php";
$plugin=new Plugin($_GET["plugin"]);
$plugin->displayPage();
} elseif (isset($_GET["page"])) {
if ($_GET["page"]=="news") {
$curPage="news";
include "inc/news.php";
} else {
$curPage="page_".$_GET["page"];
$page=new Page($config->lang, $_GET["page"]);
include "inc/page.php";
}
} elseif ($config->homepage=="news") {
$curPage="news";
$dom->getElementById("newsMenu")
->firstChild->setAttribute("class", "current");
include "inc/news.php";
} else {
$dom->getElementById("homepageMenu")
->firstChild->setAttribute("class", "current");
$curPage="page_".$config->homepage;
$page=new Page($config->lang, $config->homepage);
include "inc/page.php";
}
$dom->html->body->div->setAttribute(
"class", $dom->html->body->div->getAttribute("class")." ".$curPage." wrapper"
);
if (count($articles)==0&&count($pages)>0) {
$dom->getElementById("newsMenu")
->removeChild($dom->getElementById("newsMenuItem"));
}
include "inc/footer.php";
foreach ($plugins as $dir) {
$plugin=new Plugin($dir);
if ($plugin->enabled) {
$plugin->hook();
}
}
$mainwrapper=$dom->getElementById("mainwrapper");
$mainwrapper->addElement("div", null, array("class"=>"clear"));
print($dom->saveHTML());
}
?>