</a></p> </form> </div> <?php } else { echo '<div id="message" class="error fade"><p><strong>' . __('The file could not be saved!', 'wphe') . '</strong></p></div>'; echo '<div id="message" class="error fade"><p><strong>' . __('Due to server configuration can not change permissions on files or create new files', 'wphe') . '</strong></p></div>'; } } else { echo '<div id="message" class="error fade"><p><strong>' . __('The file could not be saved!', 'wphe') . '</strong></p></div>'; echo '<div id="message" class="error fade"><p><strong>' . __('Unable to create backup of the original file! <code>wp-content</code> folder is not writeable! Change the permissions this folder!', 'wphe') . '</strong></p></div>'; } unset($WPHE_new_content); //============================ Vytvoření nového Htaccess souboru ================================ } elseif (!empty($_POST['submit']) and !empty($_POST['create_htaccess']) and check_admin_referer('wphe_create', 'wphe_create')) { if (WPHE_WriteNewHtaccess('# Created by WP Htaccess Editor') === false) { echo '<div id="message" class="error fade"><p><strong>' . __('Htaccess file is not created.', 'wphe') . '</p></div>'; echo '<div id="message" class="error fade"><p><strong>' . __('Due to server configuration can not change permissions on files or create new files', 'wphe') . '</strong></p></div>'; } else { echo '<div id="message" class="updated fade"><p><strong>' . __('Htaccess file was successfully created.', 'wphe') . '</strong></p></div>'; echo '<div id="message" class="updated fade"><p><strong><a href="admin.php?page=' . $WPHE_dirname . '">' . __('View new Htaccess file', 'wphe') . '</a></strong></p></div>'; } //============================ Smazání zálohy ======================================= } elseif (!empty($_POST['submit']) and !empty($_POST['delete_backup']) and check_admin_referer('wphe_delete', 'wphe_delete')) { if (WPHE_DeleteBackup() === false) { echo '<div id="message" class="error fade"><p><strong>' . __('Backup file could not be removed! <code>wp-content</code> folder is not writeable! Change the permissions this folder!', 'wphe') . '</p></div>'; } else { echo '<div id="message" class="updated fade"><p><strong>' . __('Backup file has been successfully removed.', 'wphe') . '</strong></p></div>'; } //============================ Home ================================================ } else {
function WPHE_RestoreBackup() { $wphe_backup_path = ABSPATH . 'wp-content/htaccess.backup'; $WPHE_orig_path = ABSPATH . '.htaccess'; @clearstatcache(); if (!file_exists($wphe_backup_path)) { unset($wphe_backup_path); unset($WPHE_orig_path); return false; } else { if (file_exists($WPHE_orig_path)) { if (is_writable($WPHE_orig_path)) { @unlink($WPHE_orig_path); } else { @chmod($WPHE_orig_path, 0666); @unlink($WPHE_orig_path); } } $wphe_htaccess_content_backup = @file_get_contents($wphe_backup_path, false, NULL); if (WPHE_WriteNewHtaccess($wphe_htaccess_content_backup) === false) { unset($wphe_success); unset($WPHE_orig_path); unset($wphe_backup_path); return $wphe_htaccess_content_backup; } else { WPHE_DeleteBackup(); unset($wphe_success); unset($wphe_htaccess_content_backup); unset($WPHE_orig_path); unset($wphe_backup_path); return true; } } }