'General Settings',
'tab2' => '.htaccess File',
'tab3' => 'wp-config.php File',
);
var $menu_tabs_handler = array(
'tab1' => 'render_tab1',
'tab2' => 'render_tab2',
'tab3' => 'render_tab3',
);
function __construct()
{
$this->render_menu_page();
}
function get_current_tab()
{
$tab_keys = array_keys($this->menu_tabs);
$tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
return $tab;
}
/*
* Renders our tabs of this menu as nav items
*/
function render_menu_tabs()
{
$current_tab = $this->get_current_tab();
echo '
';
foreach ( $this->menu_tabs as $tab_key => $tab_caption )
{
$active = $current_tab == $tab_key ? 'nav-tab-active' : '';
echo '' . $tab_caption . '';
}
echo '
';
}
/*
* The menu rendering goes here
*/
function render_menu_page()
{
$tab = $this->get_current_tab();
?>
render_menu_tabs();
//$tab_keys = array_keys($this->menu_tabs);
call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
?>
debug_logger->log_debug("Nonce check failed on disable all security features!",4);
die("Nonce check failed on disable all security features!");
}
AIOWPSecurity_Configure_Settings::turn_off_all_security_features();
$this->show_msg_updated(__('All the security features have been disabled successfully!', 'aiowpsecurity'));
}
?>
debug_logger->log_debug("Nonce check failed on htaccess file save!",4);
die("Nonce check failed on htaccess file save!");
}
$htaccess_path = ABSPATH . '.htaccess';
$result = AIOWPSecurity_Utility_File::backup_a_file($htaccess_path); //Backup the htaccess file
if ($result)
{
if (rename(ABSPATH.'.htaccess.backup', ABSPATH.'htaccess_backup.txt'))
{
$backup_file_url = AIOWPSEC_WP_URL . '/htaccess_backup.txt';
echo '';
_e('Your .htaccess file was successfully backed up! Right click on the following file name and save the backup to your computer.','aiowpsecurity');
echo '
';
_e('Your .htaccess File: ');
echo ''.$backup_file_url.'';
echo '
';
echo '
';
}
else
{
$aio_wp_security->debug_logger->log_debug("htaccess file rename failed during backup!",4);
$this->show_msg_error(__('htaccess file rename failed during backup. Please check your root directory for the backup file using FTP.','aiowpsecurity'));
}
}
else
{
$aio_wp_security->debug_logger->log_debug("htaccess - Backup operation failed!",4);
$this->show_msg_error(__('htaccess backup failed.','aiowpsecurity'));
}
}
if(isset($_POST['aiowps_restore_htaccess_button']))//Do form submission tasks
{
$nonce=$_REQUEST['_wpnonce'];
if (!wp_verify_nonce($nonce, 'aiowpsec-restore-htaccess-nonce'))
{
$aio_wp_security->debug_logger->log_debug("Nonce check failed on htaccess file restore!",4);
die("Nonce check failed on htaccess file restore!");
}
if (empty($_POST['aiowps_htaccess_file']))
{
$this->show_msg_error(__('Please choose a .htaccess to restore from.', 'aiowpsecurity'));
}
else
{
//Let's copy the uploaded .htaccess file into the active root file
$new_htaccess_file_path = trim($_POST['aiowps_htaccess_file']);
//TODO
//Verify that file chosen has contents which are relevant to .htaccess file
$is_htaccess = AIOWPSecurity_Utility_Htaccess::check_if_htaccess_contents($new_htaccess_file_path);
if ($is_htaccess == 1)
{
$active_root_htaccess = ABSPATH.'.htaccess';
if (!copy($new_htaccess_file_path, $active_root_htaccess))
{
//Failed to make a backup copy
$aio_wp_security->debug_logger->log_debug("htaccess - Restore from .htaccess operation failed!",4);
$this->show_msg_error(__('htaccess file restore failed. Please attempt to restore the .htaccess manually using FTP.','aiowpsecurity'));
}
else
{
$this->show_msg_updated(__('Your .htaccess file has successfully been restored!', 'aiowpsecurity'));
}
}
else
{
$aio_wp_security->debug_logger->log_debug("htaccess restore failed - Contents of restore file appear invalid!",4);
$this->show_msg_error(__('htaccess Restore operation failed! Please check the contents of the file you are trying to restore from.','aiowpsecurity'));
}
}
}
?>
'.__('Your ".htaccess" file is a key component of your website\'s security and it can be modified to implement various levels of protection mechanisms.', 'aiowpsecurity').'
'.__('This feature allows you to backup and save your currently active .htaccess file should you need to re-use the the backed up file in the future.', 'aiowpsecurity').'
'.__('You can also restore your site\'s .htaccess settings using a backed up .htaccess file.', 'aiowpsecurity').'
';
?>
debug_logger->log_debug("Nonce check failed on wp_config file save!",4);
die("Nonce check failed on wp_config file save!");
}
$wp_config_path = ABSPATH . 'wp-config.php';
$result = AIOWPSecurity_Utility_File::backup_a_file($wp_config_path); //Backup the wp_config.php file
if ($result)
{
if (rename(ABSPATH.'wp-config.php.backup', ABSPATH.'wp-config.php.backup.txt'))
{
$backup_file_url = AIOWPSEC_WP_URL . '/wp-config.php.backup.txt';
echo '';
_e('Your wp-config.php file was successfully backed up! Right click on the following file name and save the backup to your computer.','aiowpsecurity');
echo '
';
_e('Your wp-config.php File: ');
echo ''.$backup_file_url.'';
echo '
';
echo '
';
}
else
{
$aio_wp_security->debug_logger->log_debug("wp-config.php file rename failed during backup!",4);
$this->show_msg_error(__('wp-config.php file rename failed during backup. Please check your root directory for the backup file using FTP.','aiowpsecurity'));
}
}
else
{
$aio_wp_security->debug_logger->log_debug("wp-config.php - Backup operation failed!",4);
$this->show_msg_error(__('wp-config.php backup failed.','aiowpsecurity'));
}
}
if(isset($_POST['aiowps_restore_wp_config_button']))//Do form submission tasks
{
$nonce=$_REQUEST['_wpnonce'];
if (!wp_verify_nonce($nonce, 'aiowpsec-restore-wp-config-nonce'))
{
$aio_wp_security->debug_logger->log_debug("Nonce check failed on wp-config file restore!",4);
die("Nonce check failed on wp-config file restore!");
}
if (empty($_POST['aiowps_wp_config_file']))
{
$this->show_msg_error(__('Please choose a wp-config.php file to restore from.', 'aiowpsecurity'));
}
else
{
//Let's copy the uploaded wp-config.php file into the active root file
$new_wp_config_file_path = trim($_POST['aiowps_wp_config_file']);
//TODO
//Verify that file chosen has contents which are relevant to .htaccess file
$is_wp_config = $this->check_if_wp_config_contents($new_wp_config_file_path); //TODO - write the function
if ($is_wp_config == 1)
{
$active_root_wp_config = ABSPATH.'wp-config.php';
if (!copy($new_wp_config_file_path, $active_root_wp_config))
{
//Failed to make a backup copy
$aio_wp_security->debug_logger->log_debug("wp-config.php - Restore from backed up wp-config operation failed!",4);
$this->show_msg_error(__('wp-config.php file restore failed. Please attempt to restore this file manually using FTP.','aiowpsecurity'));
}
else
{
$this->show_msg_updated(__('Your wp-config.php file has successfully been restored!', 'aiowpsecurity'));
}
}
else
{
$aio_wp_security->debug_logger->log_debug("wp-config.php restore failed - Contents of restore file appear invalid!",4);
$this->show_msg_error(__('wp-config.php Restore operation failed! Please check the contents of the file you are trying to restore from.','aiowpsecurity'));
}
}
}
?>
'.__('Your "wp-config.php" file is one of the most important in your WordPress installation. It is a primary configuration file and contains crucial things such as details of your database and other critical components.', 'aiowpsecurity').'
'.__('This feature allows you to backup and save your currently active wp-config.php file should you need to re-use the the backed up file in the future.', 'aiowpsecurity').'
'.__('You can also restore your site\'s wp-config.php settings using a backed up wp-config.php file.', 'aiowpsecurity').'
';
?>