| 1 |
<?php |
| 2 |
/** |
| 3 |
* adminSetup.php |
| 4 |
* |
| 5 |
* Shows the setup page at the admin panel. |
| 6 |
* |
| 7 |
* PHP versions 5 |
| 8 |
* |
| 9 |
* @category UserAccessManager |
| 10 |
* @package UserAccessManager |
| 11 |
* @author Alexander Schneider <alexanderschneider85@googlemail.com> |
| 12 |
* @copyright 2008-2016 Alexander Schneider |
| 13 |
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 |
| 14 |
* @version SVN: $Id$ |
| 15 |
* @link http://wordpress.org/extend/plugins/user-access-manager/ |
| 16 |
*/ |
| 17 |
global $oUserAccessManager; |
| 18 |
|
| 19 |
$sPostAction = (isset($_POST['action'])) ? $_POST['action'] : null; |
| 20 |
|
| 21 |
if ($sPostAction === 'update_db') { |
| 22 |
if (empty($_POST) || !wp_verify_nonce($_POST['uamSetupUpdateNonce'], 'uamSetupUpdate')) { |
| 23 |
wp_die(TXT_UAM_NONCE_FAILURE); |
| 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; |
| 43 |
|
| 44 |
if ($sReset === 'reset') { |
| 45 |
$oUserAccessManager = new UserAccessManager(); |
| 46 |
$oUserAccessManager->uninstall(); |
| 47 |
$oUserAccessManager->install(); |
| 48 |
?> |
| 49 |
<div class="updated"> |
| 50 |
<p><strong><?php echo TXT_UAM_UAM_RESET_SUCCSESS; ?></strong></p> |
| 51 |
</div> |
| 52 |
<?php |
| 53 |
} |
| 54 |
} |
| 55 |
?> |
| 56 |
|
| 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> |
| 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> |
| 123 |
</div> |