forked from pepiuox/PHP-GrapesJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.php
198 lines (181 loc) · 6.97 KB
/
start.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<?php
$_SESSION['language'] = '';
$initweb = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$url = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$escaped_url = htmlspecialchars($url, ENT_QUOTES, 'UTF-8');
$url_path = parse_url($escaped_url, PHP_URL_PATH);
$basename = pathinfo($url_path, PATHINFO_BASENAME);
$active = 1;
$startpage = 1;
$nm = '';
if ($initweb === $url) {
$spg = $conn->prepare("SELECT * FROM page WHERE startpage = ? AND active = ? ");
$spg->bind_param("ii", $startpage, $active);
$spg->execute();
$rs = $spg->get_result();
$nm = $rs->num_rows;
$rpx = $rs->fetch_assoc();
} elseif (isset($_GET['page']) && !empty($_GET['page'])) {
$id = (int) $_GET['page'];
$spg = $conn->prepare("SELECT * FROM page WHERE id = ? AND active = ? ");
$spg->bind_param("ii", $active, $id);
$spg->execute();
$rs = $spg->get_result();
$rpx = $rs->fetch_assoc();
$namelink = $base . $rpx['link'];
header("Location: $namelink");
exit();
} elseif (isset($basename) && !empty($basename)) {
$spg = $conn->prepare("SELECT * FROM page WHERE link = ? AND active = ? ");
$spg->bind_param("si", $basename, $active);
$spg->execute();
$rs = $spg->get_result();
$nm = $rs->num_rows;
if ($nm > 0) {
$rpx = $rs->fetch_assoc();
} else {
$spg = $conn->prepare("SELECT * FROM page WHERE startpage = ? AND active = ? ");
$spg->bind_param("ii", $startpage, $active);
$spg->execute();
$rs = $spg->get_result();
$nm = $rs->num_rows;
$rpx = $rs->fetch_assoc();
}
}
if ($nm > 0) {
$bid = $rpx['id'];
$title = $rpx['title'];
$plink = $rpx['link'];
$keyword = $rpx['keyword'];
$classification = $rpx['classification'];
$description = $rpx['description'];
$cont = $rpx['type'];
$menu = $rpx['menu'];
$content = $rpx['content'];
$style = $rpx['style'];
$prnt = $rpx['parent'];
$lng = $rpx['language'];
$language = $_SESSION["language"] = $lng;
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<?php if (!empty($description)) { ?>
<meta name="description" content="<?php echo $description; ?>" />
<?php } else { ?>
<meta name="description" content="<?php echo SITE_DESCRIPTION; ?>" />
<?php
}
if (!empty($keyword)) {
?>
<meta name="keywords" content="<?php echo $keyword; ?>" />
<?php } else { ?>
<meta name="keywords" content="<?php echo SITE_KEYWORDS; ?>" />
<?php
}
if (!empty($classification)) {
?>
<meta name="classification" content="<?php echo $classification; ?>" />
<?php } else { ?>
<meta name="classification" content="<?php echo SITE_CLASSIFICATION; ?>" />
<?php } ?>
<title><?php echo $title; ?></title>
<link href="<?php echo $base; ?>assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<?php echo $base; ?>assets/plugins/font-awesome/css/font-awesome.min.css" />
<script src="<?php echo $base; ?>assets/plugins/jquery/jquery.min.js" type="text/javascript"></script>
<script src="<?php echo $base; ?>assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="<?php echo $base; ?>assets/js/popper.min.js" type="text/javascript"></script>
<style type="text/css">
/* ============ desktop view ============ */
@media all and (min-width: 992px) {
.dropdown-menu li{
position: relative;
}
.dropdown-menu .submenu{
display: none;
position: absolute;
left:100%; top:-7px;
}
.dropdown-menu .submenu-left{
right:100%; left:auto;
}
.dropdown-menu > li:hover{ background-color: #f1f1f1 }
.dropdown-menu > li:hover > .submenu{
display: block;
}
}
/* ============ desktop view .end// ============ */
/* ============ small devices ============ */
@media (max-width: 991px) {
.dropdown-menu .dropdown-menu{
margin-left:0.7rem; margin-right:0.7rem; margin-bottom: .5rem;
}
}
/* ============ small devices .end// ============ */
</style>
<script src="<?php echo $base; ?>assets/js/menu.js" type="text/javascript"></script>
<style>
#wrapper{
margin:0;
padding:0;
}
<?php
echo decodeContent($style);
?>
</style>
</head>
<body>
<div class="wrapper">
<?php
require 'elements/menu.php';
?>
<div class='container-fluid'>
<?php
echo decodeContent($content) . "\n";
?>
</div>
</div>
</body>
</html>
<?php
} else {
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="description" content="<?php echo SITE_DESCRIPTION; ?>" />
<meta name="keywords" content="<?php echo SITE_KEYWORDS; ?>" />
<meta name="classification" content="<?php echo SITE_CLASSIFICATION; ?>" />
<title><?php echo SITE_NAME; ?></title>
<link href="<?php echo $base; ?>assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<?php echo $base; ?>assets/font-awesome/css/font-awesome.min.css" />
<script src="<?php echo $base; ?>assets/plugins/jquery/jquery.min.js" type="text/javascript"></script>
<script src="<?php echo $base; ?>assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="<?php echo $base; ?>assets/js/popper.min.js" type="text/javascript"></script>
</head>
<body>
<div class="wrapper">
<?php
require 'navbar.php';
?>
<div class='container'>
<div class="row">
<div class="col-12 text-center">
<?php echo $initweb . ' - ' . $base; ?>
<h3> Start creating your first page of content </h3>
<a href="signin/login.php">Login</a> - <a href="admin/dashboard.php">Dashboard</a>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
}
?>