user_login, $buffer) AND $userdata->user_login != 'admin') {
aqontrol_login_template();
exit;
}
}
/* -------------------------------------------------------------
Name: aqontrol_login_template
Purpose: Shows to people when site is restricted.
Receive: -None-
Return: -None-
------------------------------------------------------------- */
function aqontrol_login_template() {
global $aqontrol_template;
get_header();
$template_title = stripslashes(html_entity_decode($aqontrol_template['title'], ENT_QUOTES));
$template_content = stripslashes(html_entity_decode($aqontrol_template['content'], ENT_QUOTES));
$template_content = str_replace('%login_link%', 'Login form', $template_content);
?>
You need to log in to enter this website';
$template['content'] = 'If you wish to log in you need an account. Please contact the system administrator if you do not have an account.
';
update_option('aqontrol_template', $template);
}
// If value not assigned insert default (upgrades)
if ( strlen($template['title']) < 1 or strlen($template['content'] ) < 1) {
$template['title'] = 'You need to log in to enter this website
';
$template['content'] = 'If you wish to log in you need an account. Please contact the system administrator if you do not have an account.
';
update_option('aqontrol_template', $template);
}
}
/*-------------------------------------------------------------
Name: aqontrol_options_submit
Purpose: Save options
Receive: $_POST
Return: -none-
-------------------------------------------------------------*/
function aqontrol_options_submit() {
//options page
$option['allow'] = $_POST['aqontrol_allow'];
$option['except'] = trim($_POST['aqontrol_except'], "\t\n ");
$template['title'] = htmlspecialchars(trim($_POST['aqontrol_title'], "\t\n "), ENT_QUOTES);
$template['content'] = htmlspecialchars(trim($_POST['aqontrol_content'], "\t\n "), ENT_QUOTES);
update_option('aqontrol_config', $option);
update_option('aqontrol_template', $template);
}
/*-------------------------------------------------------------
Name: aqontrol_uninstall
Purpose: Delete the entire database table and remove the
options on uninstall.
Receive: -none-
Return: -none-
-------------------------------------------------------------*/
function aqontrol_uninstall() {
// Delete Option
delete_option('aqontrol_config');
delete_option('aqontrol_template');
// Deactivate Plugin
$current = get_settings('active_plugins');
array_splice($current, array_search( "accessqontrol.php", $current), 1);
update_option('active_plugins', $current);
do_action('deactivate_' . trim( $_GET['plugin'] ));
die();
}
?>