PluginProbe
wpForo Forum / 1.0.0
wpForo Forum v1.0.0
3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 138 releases
wpforo / wpf-admin / options-tabs / accesses.php

accesses.php in wpForo Forum 1.0.0, at wpf-admin/options-tabs/accesses.php

66 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4 if( !current_user_can('administrator') ) exit;
5 ?>
6
7 <?php if( !isset($_GET['action']) ): ?>
8 <?php $accesses = $wpforo->perm->get_accesses() ?>
9 <h2 style="margin-top:0px; margin-bottom:20px;"><a href="?page=wpforo-settings&tab=accesses&action=add" class="add-new-h2"><?php _e('Add New Forum Access', 'wpforo'); ?></a></h2>
10 <table id="usergroup_table" class="wp-list-table widefat fixed posts" cellspacing="0">
11 <thead>
12 <tr>
13 <th scope="col" id="title" class="manage-column column-title sorted desc" style="padding:10px; font-size:14px; padding-left:15px; font-weight:bold;"><span><?php _e('Access names', 'wpforo'); ?></span></th>
14 </tr>
15 </thead>
16 <tbody id="the-list">
17 <?php foreach($accesses as $key => $access) : ?>
18 <?php $bgcolor = ( $key % 2 ) ? '#FFFFFF' : '#FCFCFC' ; ?>
19 <tr id="post-2" class="post-1 type-post status-publish format-standard hentry category-uncategorized alternate iedit author-self" valign="top">
20 <td class="post-title page-title column-title" style="border-bottom:1px dotted #CCCCCC; padding-left:20px; background:<?php echo esc_attr($bgcolor) ?>;">
21 <strong class="row-title">
22 <a href="?page=wpforo-settings&tab=accesses&action=edit&access=<?php echo esc_attr($access['access']) ?>" title="<?php echo esc_attr($access['title']) ?>">
23 <?php _e( $access['title'], 'wpforo') ?>
24 </a>
25 </strong>
26 <div class="row-actions">
27 <span class="edit"><a href="?page=wpforo-settings&tab=accesses&action=edit&access=<?php echo esc_attr($access['access']) ?>"><?php _e('edit', 'wpforo'); ?></a> |</span>
28 <span class="trash"><a class="submitdelete" href="<?php echo wp_nonce_url( '?page=wpforo-settings&tab=accesses&action=del&accessid=' . esc_attr($access['accessid']) , 'wpforo_access_delete' ) ?>" onclick = "if (! confirm('<?php _e('Are you sure you want to remove this access set? Usergroups which attached to this access will lost all forum permissions.'); ?>')) { return false; }" ><?php _e('delete', 'wpforo'); ?></a></span>
29 </div>
30 </td>
31 </tr>
32 <?php endforeach ?>
33 </tbody>
34 </table>
35 <?php elseif( isset($_GET['action']) && ( $_GET['action'] == 'edit' || $_GET['action'] == 'add' ) ) : ?>
36 <div class="form-wrap">
37 <div class="form-wrap">
38 <form id="add_access" action="" method="post">
39 <?php wp_nonce_field( 'wpforo-access-addedit' ); ?>
40 <input type="hidden" name="access[action]" value="<?php echo ( $_GET['action'] == 'add' ? 'add' : 'edit' ) ?>" />
41 <input type="hidden" name="access[key]" value="<?php echo ( isset($_GET['access']) ? esc_attr(sanitize_text_field($_GET['access'])) : '' ) ?>" />
42 <label class="wpf-label-big"><?php _e('Access name', 'wpforo'); ?></label>
43 <?php if( isset( $_GET['access'] ) ){ $access = $wpforo->perm->get_access( $_GET['access'] );} ?>
44 <input name="access[name]" type="text" size="40" required="TRUE" value="<?php echo ( $_GET['action'] == 'edit' ? esc_attr($access['title']) : '') ?>" style="background:#FDFDFD; width:30%; min-width:320px;">
45 <p>&nbsp;</p>
46
47 <?php
48 $access_key = ( isset( $_GET['access'] ) ? $_GET['access'] : 0 );
49 $cans = $wpforo->perm->forum_cans_form( $access_key ); ?>
50 <?php $n = 0; foreach( $cans as $can => $data ): ?>
51 <?php if( $n%4 == 0 ): ?>
52 </table>
53 <table class="wpf-table-box-left" style="margin-right:15px; margin-bottom:15px; min-width:320px;">
54 <?php endif; ?>
55 <tr>
56 <th class="wpf-dw-td-nowrap"><label class="wpf-td-label" for="wpf-can-<?php echo esc_attr($can) ?>"><?php echo esc_html( __( $data['name'], 'wpforo' ) ) ?></label></th>
57 <td class="wpf-dw-td-value" style="text-align:center;"><input id="wpf-can-<?php echo esc_attr($can) ?>" type="checkbox" name="cans[<?php echo esc_attr($can) ?>]" value="1" <?php echo ( $data['value'] ) ? 'checked="checked"' : ''; ?>></td>
58 </tr>
59 <?php $n++; endforeach ?>
60 </table>
61 <div class="clear"></div>
62 <input type="submit" class="button button-primary forum_submit" value="<?php echo ( $_GET['action'] == 'add' ? __('Save', 'wpforo') : __('Update', 'wpforo') ) ?>">
63 </form>
64 </div>
65 </div>
66 <?php endif ?>