-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_page.php
49 lines (34 loc) · 893 Bytes
/
edit_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
<?php
require 'bin/h2o/h2o.php';
// load db functions
include('model.php');
// connect to the DB in readonly mode
db_connect();
// make sure we're logged in
include_once("Alibaba.class.php");
Alibaba::forceAuthentication();
$name=$_GET['name'];
if ($name != null) {
# get page detail (content, author, etc)
$details = getPageDetails($name);
// if (! $details['body']) { show404(); }
# data to hand to the template
$data = array(
'blog' => $blog,
'title' => 'Edit page',
'page' => $details,
'currDate' => $details['isoDate']
);
} else {
# data to hand to the template
$data = array(
'blog' => $blog,
'title' => 'Create new page',
'currDate' => date('Y-m-d H:i:s')
);
}
# init template engine
$h2o = new h2o('tmpl/page-edit.html');
# render the page
echo $h2o->render(compact('data'));
?>