Exemplo n.º 1
0
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;
        }
    }
}
Exemplo n.º 2
0
            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 {
        ?>
		<p><?php 
        _e('Using this editor you can easily modify your htaccess file without having to use an FTP client.', 'wphe');
        ?>
</p>
		<p class="wphe-red"><?php 
        _e('<strong>WARNING:</strong> Any error in this file may cause malfunction of your site!', 'wphe');
        ?>
<br />
Exemplo n.º 3
0
            echo '</div>';
        }
        //============================== Create Backup ===================================
    } elseif (!empty($_POST['submit']) && !empty($_POST['create_backup']) && check_admin_referer('wphe_createb', 'wphe_createb')) {
        if (WPHE_CreateBackup()) {
            echo '<div id="message" class="updated fade"><p><strong>' . __('Backup file was created successfully', 'wphe') . '</strong></p></div>';
            echo '<div class="postbox wphe-box">';
            echo '<p>' . __('The backup file is located in the <code>wp-content</code> folder.', 'wphe') . '</p>';
            echo '</div>';
        } else {
            echo '<div id="message" class="error fade"><p><strong>' . __('Unable to create backup! <code>wp-content</code> folder is not writeable! Change the permissions this folder manually!', '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>';
        }
        //============================== Delete Backup ====================================
    } elseif (!empty($_POST['submit']) && !empty($_POST['delete_backup']) && check_admin_referer('wphe_deleteb', 'wphe_deleteb')) {
        if (WPHE_DeleteBackup()) {
            echo '<div id="message" class="updated fade"><p><strong>' . __('Backup file was successfully removed', 'wphe') . '</strong></p></div>';
        } else {
            echo '<div id="message" class="error fade"><p><strong>' . __('Backup file could not be removed! Probably the wrong setting write permissions to the files.', '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>';
        }
        //============================== Home ==============================================
    } else {
        if (file_exists(ABSPATH . 'wp-content/htaccess.backup')) {
            echo '<div class="postbox wphe-box" style="background: #FFEECE;">';
            ?>
			<form method="post" action="admin.php?page=<?php 
            echo $WPHE_dirname;
            ?>
_backup">
			<?php