|
From: Jon O. <jon...@us...> - 2006-07-04 18:07:07
|
Update of /cvsroot/mxbb/mx_linkdb/linkdb/admin In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26247/modules/mx_linkdb/linkdb/admin Added Files: admin_auth_manage.php Log Message: adding permissions --- NEW FILE: admin_auth_manage.php --- <?php /** * * @package mxBB Portal Module - mx_kb * @version $Id: admin_auth_manage.php,v 1.1 2006/07/04 18:07:02 jonohlsson Exp $ * @copyright (c) 2002-2006 [wGEric, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) || IN_ADMIN != true ) { die( "Hacking attempt" ); } class linkdb_auth_manage extends linkdb_public { function main( $action ) { global $db, $template, $lang, $phpEx, $linkdb_functions, $phpbb_root_path, $module_root_path, $mx_root_path, $mx_request_vars; // // Includes // include( $phpbb_root_path . 'includes/functions_search.' . $phpEx ); // // Start adminCP // if ( !isset( $_POST['submit'] ) ) { $s_auth_cat_list = $this->generate_jumpbox( 0, 0, '', true ); $template->set_filenames( array( 'body' => 'admin/linkdb_admin_select_body.tpl' ) ); $template->assign_vars( array( 'L_LINKDB_AUTH_TITLE' => $lang['Linkdb_Auth_Title'], 'L_LINKDB_AUTH_EXPLAIN' => $lang['Linkdb_Auth_Explain'], 'L_SELECT_CAT' => $lang['Select_a_Category'], 'S_LINKDB_ACTION' => append_sid( "admin_linkdb.$phpEx?action=auth_manage" ), 'L_LOOK_UP_CAT' => $lang['Look_up_Category'], 'CAT_SELECT_TITLE' => $s_auth_cat_list )); $template->pparse( 'body' ); } else { if ( !isset( $_GET['cat_id'] ) ) { $cat_id = $mx_request_vars->request('cat_id', MX_TYPE_INT, ''); $template->set_filenames( array( 'body' => 'admin/linkdb_admin_auth_body.tpl' ) ); $template->assign_vars( array( 'L_LINKDB_AUTH_TITLE' => $lang['Linkdb_Auth_Title'], 'L_LINKDB_AUTH_EXPLAIN' => $lang['Linkdb_Auth_Explain'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'L_GROUPS' => $lang['Usergroups'], 'L_VIEW' => $lang['View'], 'L_UPLOAD' => $lang['Upload'], 'L_RATE' => $lang['Rate'], 'L_COMMENT' => $lang['Comment'], 'L_EDIT' => $lang['Edit'], 'L_DELETE' => $lang['Delete'], // 'L_APPROVAL' => $lang['Approval'], // 'L_APPROVAL_EDIT' => $lang['Approval_edit'], 'L_IS_MODERATOR' => $lang['Is_Moderator'], 'S_ALBUM_ACTION' => append_sid( "admin_linkdb.$phpEx?action=auth_manage&cat_id=$cat_id" ), )); // // Get the list of phpBB usergroups // $sql = "SELECT group_id, group_name FROM " . GROUPS_TABLE . " WHERE group_single_user <> " . true . " ORDER BY group_name ASC"; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, 'Could not get group list', '', __LINE__, __FILE__, $sql ); } while ( $kb_row = $db->sql_fetchrow( $result ) ) { $groupdata[] = $kb_row; } // // Get info of this cat // $sql = "SELECT cat_id, cat_name, auth_view_groups, auth_post_groups, auth_rate_groups, auth_comment_groups, auth_edit_groups, auth_delete_groups, auth_approval_groups, auth_approval_edit_groups, auth_moderator_groups FROM " . LINK_CATEGORIES_TABLE . " WHERE cat_id = '$cat_id'"; if ( !$result = $db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, 'Could not get Category information', '', __LINE__, __FILE__, $sql ); } $thiscat = $db->sql_fetchrow( $result ); $view_groups = @explode( ',', $thiscat['auth_view_groups'] ); $post_groups = @explode( ',', $thiscat['auth_post_groups'] ); $rate_groups = @explode( ',', $thiscat['auth_rate_groups'] ); $comment_groups = @explode( ',', $thiscat['auth_comment_groups'] ); $edit_groups = @explode( ',', $thiscat['auth_edit_groups'] ); $delete_groups = @explode( ',', $thiscat['auth_delete_groups'] ); // $approval_groups = @explode( ',', $thiscat['auth_approval_groups'] ); // $approval_edit_groups = @explode( ',', $thiscat['auth_approval_edit_groups'] ); $moderator_groups = @explode( ',', $thiscat['auth_moderator_groups'] ); for ( $i = 0; $i < count( $groupdata ); $i++ ) { $template->assign_block_vars( 'grouprow', array( 'GROUP_ID' => $groupdata[$i]['group_id'], 'GROUP_NAME' => $groupdata[$i]['group_name'], 'VIEW_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $view_groups ) ) ? 'checked="checked"' : '', 'POST_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $post_groups ) ) ? 'checked="checked"' : '', 'RATE_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $rate_groups ) ) ? 'checked="checked"' : '', 'COMMENT_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $comment_groups ) ) ? 'checked="checked"' : '', 'EDIT_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $edit_groups ) ) ? 'checked="checked"' : '', 'DELETE_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $delete_groups ) ) ? 'checked="checked"' : '', // 'APPROVAL_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $approval_groups ) ) ? 'checked="checked"' : '', // 'APPROVAL_EDIT_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $approval_edit_groups ) ) ? 'checked="checked"' : '', 'MODERATOR_CHECKED' => ( in_array( $groupdata[$i]['group_id'], $moderator_groups ) ) ? 'checked="checked"' : '' )); } $template->pparse( 'body' ); } else { $cat_id = $mx_request_vars->request('cat_id', MX_TYPE_INT, ''); $view_groups = @implode( ',', $_POST['view'] ); $post_groups = @implode( ',', $_POST['post'] ); $rate_groups = @implode( ',', $_POST['rate'] ); $comment_groups = @implode( ',', $_POST['comment'] ); $edit_groups = @implode( ',', $_POST['edit'] ); $delete_groups = @implode( ',', $_POST['delete'] ); // $approval_groups = @implode( ',', $_POST['approval'] ); // $approval_edit_groups = @implode( ',', $_POST['approval_edit'] ); $moderator_groups = @implode( ',', $_POST['moderator'] ); $sql = "UPDATE " . LINK_CATEGORIES_TABLE . " SET auth_view_groups = '$view_groups', auth_post_groups = '$post_groups', auth_rate_groups = '$rate_groups', auth_comment_groups = '$comment_groups', auth_edit_groups = '$edit_groups', auth_delete_groups = '$delete_groups', auth_approval_groups = '$approval_groups', auth_approval_edit_groups = '$approval_edit_groups', auth_moderator_groups = '$moderator_groups' WHERE cat_id = '$cat_id'"; if ( !$result = $db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, 'Could not update Linkdb config table', '', __LINE__, __FILE__, $sql ); } $message = $lang['Linkdb_Auth_successfully'] . '<br /><br />' . sprintf( $lang['Click_return_Linkdb_auth'], '<a href="' . append_sid( "admin_linkdb.$phpEx?action=auth_manage" ) . '">', '</a>' ) . '<br /><br />' . sprintf( $lang['Click_return_admin_index'], '<a href="' . append_sid( $mx_root_path . "admin/index.$phpEx?pane=right" ) . '">', '</a>' ); mx_message_die( GENERAL_MESSAGE, $message ); } } } } ?> |