Created basis for mod dashboard
This commit is contained in:
parent
e16a05cda7
commit
bbb7910398
25
inc/mod.php
Normal file
25
inc/mod.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
// Generates a <ul> element with a list of linked
|
||||
// boards and their subtitles.
|
||||
function ulBoards() {
|
||||
$body = '<ul>';
|
||||
|
||||
// List of boards
|
||||
$boards = listBoards();
|
||||
|
||||
foreach($boards as &$b) {
|
||||
$body .= '<li>' .
|
||||
'<a href="?/' .
|
||||
sprintf(BOARD_PATH, $b['uri']) . FILE_INDEX .
|
||||
'">' .
|
||||
sprintf(BOARD_ABBREVIATION, $b['uri']) .
|
||||
'</a>' .
|
||||
(isset($b['subtitle']) ? ' - ' . $b['subtitle'] : '') .
|
||||
'</li>';
|
||||
}
|
||||
|
||||
return $body . '</ul>';
|
||||
}
|
||||
|
||||
?>
|
18
mod.php
18
mod.php
@ -7,6 +7,7 @@
|
||||
require 'inc/config.php';
|
||||
require 'inc/template.php';
|
||||
require 'inc/user.php';
|
||||
require 'inc/mod.php';
|
||||
|
||||
// If not logged in
|
||||
if(!$mod) {
|
||||
@ -45,7 +46,19 @@
|
||||
if(preg_match('/^\/?$/', $query)) {
|
||||
// Dashboard
|
||||
|
||||
|
||||
// Body
|
||||
$body = '';
|
||||
|
||||
$body .= '<fieldset><legend>Boards</legend>' .
|
||||
ulBoards() .
|
||||
'</fieldset>';
|
||||
|
||||
die(Element('page.html', Array(
|
||||
'index'=>ROOT,
|
||||
'title'=>'Dashboard',
|
||||
'body'=>$body
|
||||
)
|
||||
));
|
||||
} elseif(preg_match('/^\/' . $regex['board'] . '(' . preg_quote(FILE_INDEX, '/') . ')?$/', $query, $matches)) {
|
||||
// Board index
|
||||
|
||||
@ -59,5 +72,8 @@
|
||||
error("Page not found.");
|
||||
}
|
||||
}
|
||||
|
||||
// Close the connection in-case it's still open
|
||||
sql_close();
|
||||
?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user