This repository has been 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
/
page.php
132 lines (120 loc) · 4.03 KB
/
page.php
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/**
* Index file
*
* PHP Version 5.3.6
*
* @category PHP
* @package StrasWeb
* @author Pierre Rudloff <rudloff@strasweb.fr>
* @license https://creativecommons.org/licenses/by/2.0/fr/ CC BY 2.0
* @link http://strasweb.fr
*/
require_once "classes/XMLDocument.php";
header("Content-type: text/html;charset=utf-8");
$dom=XMLDocument::Create();
$dom->html->setAttribute("itemscope", null);
$dom->html->setAttribute("itemtype", "http://schema.org/Organization");
$dom->html->setAttribute("id", "strasweb");
$dom->html->setAttribute("itemid", "strasweb");
$dom->html->setAttribute("lang", "fr");
require_once "inc/vars.php";
if (isset($_GET["page"])) {
$page=$_GET["page"];
} else {
$page="about";
}
require_once "inc/head.php";
if (isset($menu[strval($page)])) {
$dom->head->addElement("title", "StrasWeb - ".$menu[strval($page)]);
} else {
$dom->head->addElement("title", "StrasWeb");
}
$dom->body->setAttribute("id", "page");
$dom->body->setAttribute("lang", "fr");
$dom->body->setAttribute("class", "page ".strval($page));
$div=$dom->body->addElement(
"div", null, array("id"=>"bg_wrapper",
"class"=>"bg_wrapper ".strval($page))
)->addElement(
"div", null, array("id"=>"mainwrapper",
"class"=>"mainwrapper ".strval($page), "data-role"=>"page", "data-theme"=>"d")
);
$header=$div->addElement(
"header", null, array("data-role"=>"header", "data-theme"=>"c")
);
$h1=$header->addElement("h1");
$homelink=$h1->addElement(
"a", null, array("href"=>"page.php?page=about&mobile=".MOBILE,
"title"=>"$menu[about]", "id"=>"homelink", "class"=>"homelink")
);
$logo=isset($_SERVER["HTTP_ACCEPT"]) && stristr(
$_SERVER["HTTP_ACCEPT"],
"application/xhtml+xml"
)!=strval(false)?"logo.svg":"logo.png";
$homelink->addElement(
"img", null, array(
"src"=>"img/".$logo, "alt"=>"StrasWeb",
"style"=>"width:286px; max-width:100%;",
"itemprop"=>"image"
)
);
$homelink->addElement("br", null, array("class"=>"hidden"));
$homelink->addElement(
"span", "Agence Web associative", array("id"=>"agence_web",
"class"=>"agence_web nineteen", "itemprop"=>"description")
);
$nav=$header->addElement(
"nav", null, array(
"id"=>"menu_left", "class"=>"menu_left fifteen", "data-role"=>"navbar"
)
);
$ul=$nav->addElement("ul", null, array("class"=>"ul_menu"));
foreach ($menu as $url=>$item) {
if ($url!="mentions") {
$dom->head->addElement(
"link", null, array("rel"=>"prefetch", "href"=>"page.php?page=".$url)
);
$li=$ul->addElement("li");
$a=$li->addElement(
"a", $item, array(
"href"=>"page.php?page=".$url."&mobile=".MOBILE,
"class"=>"menuItem", "id"=>"menuItem_".$url
)
);
if (strval($page)===$url) {
$a->setAttribute("class", "menuItem current");
$a->removeAttribute("href");
if ($url==="about") {
$homelink->removeAttribute("href");
$homelink->removeAttribute("id");
$homelink->removeAttribute("title");
}
} else if ($url==="contact") {
$a->setAttribute("rel", "author");
}
}
}
$ul->addElement("li")->addElement("a", "Blog", array("href"=>"http://blog.strasweb.fr/", "class"=>"menuItem", "id"=>"menuItem_blog"));
$nav->addElement("div", null, array("id"=>"menu_cursor", "class"=>"menu_cursor"));
$wrapper=$div->addElement(
"div", null, array(
"id"=>"page_wrapper" , "class"=>"page_wrapper ".strval($page),
"data-role"=>"content"
)
);
$validPages = array("about", "refs", "services", "asso", "contact", "mentions");
if (in_array($page, $validPages)) {
include_once "inc/".$page.".php";
} else {
header("HTTP/1.0 404 Not Found");
$wrapper->addElement("p", "Page introuvable");
}
$wrapper->addElement(
"div", null, array("class"=>"background ".strval($page), "id"=>"background")
);
$wrapper->addElement(
"div", null, array("class"=>"background2 ".strval($page), "id"=>"background2")
);
print($dom->saveHTML());
?>