PluginProbe
User Access Manager / 1.2.14
User Access Manager v1.2.14
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
← All changes | tpl/adminSetup.php +97 -44 1.0 → 1.2.14 View file →
@@ -8,63 +8,116 @@
8 8 *
9 9 * @category UserAccessManager
10 10 * @package UserAccessManager
11 11 * @author Alexander Schneider <[email protected]>
12 - * @copyright 2008-2010 Alexander Schneider
12 + * @copyright 2008-2016 Alexander Schneider
13 13 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
14 14 * @version SVN: $Id$
15 15 * @link http://wordpress.org/extend/plugins/user-access-manager/
16 16 */
17 +global $oUserAccessManager;
17 18
18 -if (isset($_POST['action'])) {
19 - $post_action = $_POST['action'];
20 -} else {
21 - $post_action = null;
22 -}
19 +$sPostAction = (isset($_POST['action'])) ? $_POST['action'] : null;
23 20
24 -if ($post_action == 'reset_uam') {
25 - if (isset($_POST['uam_reset'])) {
26 - $reset = $_POST['uam_reset'];
27 - } else {
28 - $reset = null;
21 +if ($sPostAction === 'update_db') {
22 + if (empty($_POST) || !wp_verify_nonce($_POST['uamSetupUpdateNonce'], 'uamSetupUpdate')) {
23 + wp_die(TXT_UAM_NONCE_FAILURE);
29 24 }
25 +
26 + $sUpdate = isset($_POST['uam_update_db']) ? $_POST['uam_update_db'] : null;
27 +
28 + if ($sUpdate === 'blog' || $sUpdate === 'network' ) {
29 + $blNetwork = ($sUpdate == 'network') ? true : false;
30 + $oUserAccessManager->update($blNetwork);
31 + ?>
32 + <div class="updated">
33 + <p><strong><?php echo TXT_UAM_UAM_DB_UPDATE_SUC; ?></strong></p>
34 + </div>
35 + <?php
36 + }
37 +} elseif ($sPostAction === 'reset_uam') {
38 + if (empty($_POST) || !wp_verify_nonce($_POST['uamSetupResetNonce'], 'uamSetupReset')) {
39 + wp_die(TXT_UAM_NONCE_FAILURE);
40 + }
41 +
42 + $sReset = (isset($_POST['uam_reset'])) ? $_POST['uam_reset'] : null;
30 43
31 - if ($reset == 'true') {
32 - $userAccessManager = new UserAccessManager();
33 - $userAccessManager->uninstall();
34 - $userAccessManager->install();
44 + if ($sReset === 'reset') {
45 + $oUserAccessManager = new UserAccessManager();
46 + $oUserAccessManager->uninstall();
47 + $oUserAccessManager->install();
35 48 ?>
36 - <div class="updated">
37 - <p><strong><?php echo TXT_UAM_RESET_SUC; ?></strong></p>
38 - </div>
49 + <div class="updated">
50 + <p><strong><?php echo TXT_UAM_UAM_RESET_SUCCSESS; ?></strong></p>
51 + </div>
39 52 <?php
40 53 }
41 54 }
42 55 ?>
43 56
44 -<div class="wrap">
45 - <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
46 - <input type="hidden" value="reset_uam" name="action" />
47 - <h2><?php echo TXT_SETUP; ?></h2>
48 - <table class="form-table">
49 - <tbody>
50 - <tr valign="top">
51 - <th scope="row"><?php echo TXT_RESET_UAM; ?></th>
52 - <td>
53 - <label for="uam_reset_yes">
54 - <input type="radio" id="uam_reset_yes" class="uam_reset_yes" name="uam_reset" value="true" />
55 - <?php echo TXT_YES; ?>
56 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
57 - <label for="uam_reset_no">
58 - <input type="radio" id="uam_reset_no" class="uam_reset_no" name="uam_reset" value="false" checked="checked" />
59 - <?php echo TXT_NO; ?>
60 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
61 - <input type="submit" class="button" name="uam_reset_submit" value="<?php echo TXT_RESET; ?>" /> <br />
62 - <p style="color: red; font-size: 12px; font-weight: bold;">
63 - <?php echo TXT_RESET_UAM_DESC; ?>
64 - </p>
65 - </td>
66 - </tr>
67 - </tbody>
68 - </table>
69 - </form>
57 +<div class="wrap">
58 + <h2><?php echo TXT_UAM_SETUP; ?></h2>
59 +<?php
60 +if ($oUserAccessManager->isDatabaseUpdateNecessary()) {
61 + $blShowNetworkUpdate = is_super_admin()
62 + && defined('MULTISITE')
63 + && defined('WP_ALLOW_MULTISITE')
64 + && WP_ALLOW_MULTISITE;
65 +
66 + ?>
67 + <table class="form-table">
68 + <tbody>
69 + <tr valign="top">
70 + <form method="post" action="<?php echo htmlspecialchars($_SERVER["REQUEST_URI"]); ?>">
71 + <?php wp_nonce_field('uamSetupUpdate', 'uamSetupUpdateNonce'); ?>
72 + <input type="hidden" value="update_db" name="action" />
73 + <th scope="row"><?php echo TXT_UAM_UPDATE_UAM_DB; ?></th>
74 + <td>
75 + <?php
76 + if ($blShowNetworkUpdate) {
77 + ?>
78 + <input type="radio" id="uam_update_db_network" class="uam_update_db_network" name="uam_update_db" value="network" />
79 + <label for="uam_update_db_network"><?php echo TXT_UAM_UPDATE_NETWORK; ?></label>&nbsp;&nbsp;&nbsp;&nbsp;
80 + <input type="radio" id="uam_update_db_blog" class="uam_update_db" name="uam_update_db" value="blog" checked="checked" />
81 + <label for="uam_update_db_blog"> <?php echo TXT_UAM_UPDATE_BLOG; ?></label>
82 + <?php
83 + } else {
84 + ?>
85 + <input type="hidden" value="blog" name="uam_update_db" />
86 + <?php
87 + }
88 + ?>
89 + <input type="submit" class="button" name="uam_update_db_submit" value="<?php echo TXT_UAM_UPDATE; ?>" /> <br />
90 + <p style="color: red; font-size: 12px; font-weight: bold;">
91 + <?php echo TXT_UAM_UPDATE_UAM_DB_DESC; ?>
92 + </p>
93 + </td>
94 + </form>
95 + </tr>
96 + </tbody>
97 + </table>
98 + <?php
99 +}
100 +?>
101 + <h2 style="color:red;"><?php echo TXT_UAM_SETUP_DANGER_ZONE; ?></h2>
102 + <table class="form-table">
103 + <tbody>
104 + <tr valign="top">
105 + <th scope="row"><?php echo TXT_UAM_RESET_UAM; ?></th>
106 + <td>
107 + <form method="post" action="<?php echo htmlspecialchars($_SERVER["REQUEST_URI"]); ?>">
108 + <?php wp_nonce_field('uamSetupReset', 'uamSetupResetNonce'); ?>
109 + <input type="hidden" value="reset_uam" name="action" />
110 + <input id="uam_reset_confirm" class="uam_reset_confirm" name="uam_reset" />
111 + <input id="uam_reset_submit" disabled="disabled" type="submit" class="button" name="uam_reset_submit" value="<?php echo TXT_UAM_RESET; ?>" /> <br />
112 + <p style="font-size: 12px; font-weight: bold;">
113 + <?php echo TXT_UAM_RESET_UAM_DESC; ?>
114 + </p>
115 + <p style="color: red; font-size: 12px; font-weight: bold;">
116 + <?php echo TXT_UAM_RESET_UAM_DESC_WARNING; ?>
117 + </p>
118 + </form>
119 + </td>
120 + </tr>
121 + </tbody>
122 + </table>
70 123 </div>