From 9554291802cb8ac712ba25d1a59ced31d20b07f0 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Fri, 17 Dec 2010 02:20:16 +1100 Subject: Mod controls and permissions --- mod.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'mod.php') diff --git a/mod.php b/mod.php index 6b3d17c3..7b52735f 100644 --- a/mod.php +++ b/mod.php @@ -56,14 +56,26 @@ if(preg_match('/^\/?$/', $query)) { // Dashboard - $body = ''; + $fieldset = Array( + 'Boards' => '', + 'Administration' => '' + ); - $body .= '
Boards' . - ulBoards() . - '
'; + // Boards + $fieldset['Boards'] .= ulBoards(); + + if($mod['type'] >= MOD_SHOW_CONFIG) { + $fieldset['Administration'] .= '
  • Show configuration
  • '; + } // TODO: Statistics, etc, in the dashboard. + $body = ''; + foreach($fieldset as $title => $data) { + if($data) + $body .= "
    {$title}
    "; + } + echo Element('page.html', Array( 'index'=>ROOT, 'title'=>'Dashboard', @@ -72,7 +84,7 @@ ) ); } elseif(preg_match('/^\/config$/', $query)) { - if($mod['type'] != MOD_ADMIN) error(ERROR_NOACCESS); + if($mod['type'] < MOD_SHOW_CONFIG) error(ERROR_NOACCESS); // Show instance-config.php @@ -92,7 +104,7 @@ ) ); } elseif(preg_match('/^\/new$/', $query)) { - if($mod['type'] != MOD_ADMIN) error(ERROR_NOACCESS); + if($mod['type'] < MOD_NEWBOARD) error(ERROR_NOACCESS); // New board $body = ''; @@ -186,6 +198,7 @@ echo $page; } elseif(preg_match('/^\/' . $regex['board'] . 'delete\/(\d+)$/', $query, $matches)) { + if($mod['type'] < MOD_DELETE) error(ERROR_NOACCESS); // Delete post $boardName = $matches[1]; -- cgit v1.3