# user-access-manager/1.1/tpl/adminSetup.php

User Access Manager, version 1.1. 114 lines.

- Page: https://pluginprobe.com/plugins/user-access-manager/1.1/code/tpl/adminSetup.php
- Raw: https://pluginprobe.com/plugins/user-access-manager/1.1/raw/tpl/adminSetup.php
- Modified: 2010-09-27T23:32:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/user-access-manager/1.1/code/tpl/adminSetup.php#L10-L20`.

```php
<?php
/**
 * adminSetup.php
 * 
 * Shows the setup page at the admin panel.
 * 
 * PHP versions 5
 * 
 * @category  UserAccessManager
 * @package   UserAccessManager
 * @author    Alexander Schneider <alexanderschneider85@googlemail.com>
 * @copyright 2008-2010 Alexander Schneider
 * @license   http://www.gnu.org/licenses/gpl-2.0.html  GNU General Public License, version 2
 * @version   SVN: $Id$
 * @link      http://wordpress.org/extend/plugins/user-access-manager/
 */
global $userAccessManager;

if (isset($_POST['action'])) {
    $postAction = $_POST['action'];
} else {
    $postAction = null;
}

if ($postAction == 'update_db') {
    if (isset($_POST['uam_update_db'])) {
        $update = $_POST['uam_update_db'];
    } else {
        $update = null;
    }
    
    if ($update == 'true') {
        $userAccessManager->update();
        ?>
    	<div class="updated">
    		<p><strong><?php echo TXT_UAM_DB_UPDATE_SUC; ?></strong></p>
    	</div>
    	<?php
    }
}

if ($postAction == 'reset_uam') {
    if (isset($_POST['uam_reset'])) {
        $reset = $_POST['uam_reset'];
    } else {
        $reset = null;
    }
    
    if ($reset == 'true') {
        $userAccessManager = new UserAccessManager();
        $userAccessManager->uninstall();
        $userAccessManager->install();
        ?>
		<div class="updated">
			<p><strong><?php echo TXT_UAM_RESET_SUC; ?></strong></p>
		</div>
        <?php
    }
}
?>

<div class="wrap"> 
    <h2><?php echo TXT_SETUP; ?></h2>
    <table class="form-table">
    	<tbody>
    		<tr valign="top">
    			<th scope="row"><?php echo TXT_RESET_UAM; ?></th>
    			<td>
        			<form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
    					<input type="hidden" value="reset_uam" name="action" />
        				<label for="uam_reset_yes"> 
        					<input type="radio" id="uam_reset_yes" class="uam_reset_yes" name="uam_reset" value="true" /> 
        					<?php echo TXT_YES; ?> 
        				</label>&nbsp;&nbsp;&nbsp;&nbsp;
        				<label for="uam_reset_no"> 
        					<input type="radio" id="uam_reset_no" class="uam_reset_no" name="uam_reset" value="false" checked="checked" /> 
        					<?php echo TXT_NO; ?> 
        				</label>&nbsp;&nbsp;&nbsp;&nbsp;
        				<input type="submit" class="button" name="uam_reset_submit" value="<?php echo TXT_RESET; ?>" /> <br />
        				<p style="color: red; font-size: 12px; font-weight: bold;">
        				    <?php echo TXT_RESET_UAM_DESC; ?>
        				</p>
        			</form>
    			</td>
    		</tr>
    		<?php 
if ($userAccessManager->isDatabaseUpdateNecessary()) {
        		?>
        		<tr valign="top">
        			<form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
    					<input type="hidden" value="update_db" name="action" />
            			<th scope="row"><?php echo TXT_UPDATE_UAM_DB; ?></th>
            			<td>
            				<label for="uam_update_db_yes"> 
            					<input type="radio" id="uam_update_db_yes" class="uam_reset_yes" name="uam_update_db" value="true" /> 
            					<?php echo TXT_YES; ?> 
            				</label>&nbsp;&nbsp;&nbsp;&nbsp;
            				<label for="uam_update_db_no"> 
            					<input type="radio" id="uam_update_db_no" class="uam_reset_no" name="uam_update_db" value="false" checked="checked" /> 
            					<?php echo TXT_NO; ?> 
            				</label>&nbsp;&nbsp;&nbsp;&nbsp;
            				<input type="submit" class="button" name="uam_update_db_submit" value="<?php echo TXT_UPDATE; ?>" /> <br />
            				<p style="color: red; font-size: 12px; font-weight: bold;">
            				    <?php echo TXT_UPDATE_UAM_DB_DESC; ?>
            				</p>
            			</td>
            		</form>
        		</tr>
        		<?php 
}
        	?>
    	</tbody>
    </table>
</div>
```
