-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.php
53 lines (38 loc) · 1.01 KB
/
edit.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
<?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();
$guid=$_GET['id'];
if ($guid != null) {
# single post; more detail, get tags, etc
$details = getPostDetails($guid);
if (! $details['post']['guid']) { show404(); }
# data to hand to the template
$data = array(
'blog' => $blog,
'title' => 'Edit post',
'post' => $details['post'],
'tags' => implode(", ", $details['tags']),
'currDate' => $details['post']['isoDate']
);
} else {
# data to hand to the template
$data = array(
'blog' => $blog,
'title' => 'Create new post',
'currDate' => date('Y-m-d H:i:s'),
'post' => array(
'draft' => (int) TRUE
)
);
}
# init template engine
$h2o = new h2o('tmpl/panel-edit.html');
# render the page
echo $h2o->render(compact('data'));
?>