-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpages.php
46 lines (33 loc) · 911 Bytes
/
pages.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
<?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();
# get all pages
$query = "SELECT name, pubDate, author, draft, standalone " .
"FROM pages " .
"ORDER BY name ASC LIMIT 50";
# get result
$result=mysql_query($query) or die("Unable to retrieve page listing");
$pages = array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
# reformat date
$dateStamp = strtotime( $row['pubDate'] );
$row['pubDate'] = strftime( "%m/%d/%y", $dateStamp );
array_push($pages, $row);
}
db_close();
# init template engine
$h2o = new h2o('tmpl/panel-pages.html');
# data to hand to the template
$data = array(
'blog' => $blog,
'pages' => $pages
);
# render the page
echo $h2o->render(compact('data'));
?>