diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2010-12-17 02:20:16 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2010-12-17 02:20:16 +1100 |
| commit | 9554291802cb8ac712ba25d1a59ced31d20b07f0 (patch) | |
| tree | 6861b6ebffe4e2f54573907cc789b34648d59c24 /mod.php | |
| parent | 4052d6350214e5384cfe15823e29197d2eaf7326 (diff) | |
Mod controls and permissions
Diffstat (limited to 'mod.php')
| -rw-r--r-- | mod.php | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -56,14 +56,26 @@ if(preg_match('/^\/?$/', $query)) { // Dashboard - $body = ''; + $fieldset = Array( + 'Boards' => '', + 'Administration' => '' + ); - $body .= '<fieldset><legend>Boards</legend>' . - ulBoards() . - '</fieldset>'; + // Boards + $fieldset['Boards'] .= ulBoards(); + + if($mod['type'] >= MOD_SHOW_CONFIG) { + $fieldset['Administration'] .= '<li><a href="?/config">Show configuration</a></li>'; + } // TODO: Statistics, etc, in the dashboard. + $body = ''; + foreach($fieldset as $title => $data) { + if($data) + $body .= "<fieldset><legend>{$title}</legend><ul>{$data}</ul></fieldset>"; + } + 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]; |
