2015-04-11 17:30:01 +00:00
|
|
|
<?php
|
|
|
|
register_module([
|
|
|
|
"name" => "Page list",
|
2015-07-15 16:11:32 +00:00
|
|
|
"version" => "0.6",
|
2015-04-11 17:30:01 +00:00
|
|
|
"author" => "Starbeamrainbowlabs",
|
2015-05-24 20:00:30 +00:00
|
|
|
"description" => "Adds a page that lists all the pages in the index along with their metadata.",
|
2015-04-11 17:30:01 +00:00
|
|
|
"id" => "page-list",
|
|
|
|
"code" => function() {
|
|
|
|
add_action("list", function() {
|
|
|
|
global $pageindex, $settings;
|
2015-07-15 16:11:32 +00:00
|
|
|
|
|
|
|
$sorted_pageindex = get_object_vars($pageindex);
|
|
|
|
ksort($sorted_pageindex, SORT_NATURAL);
|
2015-04-11 17:30:01 +00:00
|
|
|
$title = "All Pages";
|
|
|
|
$content = " <h1>$title on $settings->sitename</h1>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>Page Name</th>
|
|
|
|
<th>Size</th>
|
|
|
|
<th>Last Editor</th>
|
|
|
|
<th>Last Edit Time</th>
|
|
|
|
</tr>\n";
|
2015-07-13 14:22:57 +00:00
|
|
|
// todo list the pages in alphabetical order
|
2015-07-15 16:11:32 +00:00
|
|
|
foreach($sorted_pageindex as $pagename => $pagedetails)
|
2015-04-11 17:30:01 +00:00
|
|
|
{
|
|
|
|
$content .= "\t\t<tr>
|
|
|
|
<td><a href='index.php?page=$pagename'>$pagename</a></td>
|
|
|
|
<td>" . human_filesize($pagedetails->size) . "</td>
|
|
|
|
<td>$pagedetails->lasteditor</td>
|
|
|
|
<td>" . human_time_since($pagedetails->lastmodified) . " <small>(" . date("l jS \of F Y \a\\t h:ia T", $pagedetails->lastmodified) . ")</small></td>
|
|
|
|
|
|
|
|
</tr>\n";
|
|
|
|
}
|
|
|
|
$content .= " </table>";
|
2015-05-24 20:00:30 +00:00
|
|
|
exit(page_renderer::render_main("$title - $settings->sitename", $content));
|
2015-04-11 17:30:01 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
?>
|