From 1977912f40df9a583016017fa5fb2ef253b5e4ba Mon Sep 17 00:00:00 2001 From: Nic Waller Date: Sat, 1 Jun 2013 23:30:15 -0700 Subject: [PATCH] First impressions of web GUI for authmgr #10 --- authmgr/plugin.php | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/authmgr/plugin.php b/authmgr/plugin.php index b8731a2..032102c 100644 --- a/authmgr/plugin.php +++ b/authmgr/plugin.php @@ -132,7 +132,42 @@ function authmgr_add_page() { } function authmgr_display_page() { - echo "Get option content and render page here!"; + if ( count( $_POST ) > 0 ) { + $rolenames = $_POST['rolenames']; + $roledefs = array(); + foreach ($rolenames as $role) { + $roledefs[$role] = $_POST['role-'.$role]; + } + yourls_update_option( 'authmgr_roles', json_encode( $roledefs ) ); + echo 'Updated authmgr roles'; + } + + $roles = json_decode( yourls_get_option( 'authmgr_roles' ), true ); + + echo '
'; + echo ''; + $allcaps = AuthmgrCapability::all(); + echo ''; + foreach ($allcaps as $cap) { + echo ""; + } + echo ''; + foreach ($roles as $role => $selcaps) { + echo ''; + echo ''; + echo ""; + foreach ($allcaps as $cap) { + echo ''; + } + echo ''; + } + echo '
$cap
$role'; + $active = in_array( $cap, $selcaps ); + $selstr = ( $active ? 'checked' : '' ); + echo ''; + echo '
'; + echo ''; + echo '
'; } /**************** CAPABILITY TEST/ENUMERATION ****************/