AnonSec Team
Server IP : 10.131.40.8  /  Your IP : 216.73.216.37
Web Server : Apache
System : Linux webd008.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : ludmqhh ( 137773)
PHP Version : 8.4.10
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/ludmqhh/www/hotel-forum/wp-content/plugins/wp-maintenance/views/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/ludmqhh/www/hotel-forum/wp-content/plugins/wp-maintenance/views/wp-maintenance-settings.php
<?php

defined( 'ABSPATH' ) or die( 'Not allowed' );

$messageUpdate = 0;
/* Update des paramètres */
if(isset($_POST['action']) && $_POST['action'] == 'update_settings' && wp_verify_nonce($_POST['security-settings'], 'valid-settings') ) {

    if(empty($_POST["wpoptions"]["pageperso"]) ) { $_POST["wpoptions"]["pageperso"] = 0; }
    if(empty($_POST["wpoptions"]["dashboard_delete_db"]) ) { $_POST["wpoptions"]["dashboard_delete_db"] = 0; }
    if(empty($_POST["wpoptions"]["error_503"]) ) { $_POST["wpoptions"]["error_503"] = 0; }
   
    $updateLimitSettings = wpm_update_settings($_POST["wp_maintenance_limit"], 'wp_maintenance_limit');
    $updateIpAdressSettings = wpm_update_settings($_POST["wp_maintenance_ipaddresses"], 'wp_maintenance_ipaddresses');
    
    $updateSetting = wpm_update_settings($_POST["wpoptions"], 'wp_maintenance_settings_options');
    if($updateSetting == true ) { $messageUpdate = 1; }

}

// Récupère les paramètres sauvegardés
if(get_option('wp_maintenance_settings_options')) { extract(get_option('wp_maintenance_settings_options')); }
$wpoptions = get_option('wp_maintenance_settings_options');

// Récupère les Rôles et capabilités
if(get_option('wp_maintenance_limit')) { extract(get_option('wp_maintenance_limit')); }
$paramLimit = get_option('wp_maintenance_limit');

// Récupère les ip autorisee
$paramIpAddress = get_option('wp_maintenance_ipaddresses');

?>
<script type="text/javascript">

jQuery(document).ready(function() {

  jQuery( ".postbox .hndle" ).on( "mouseover", function() {
    jQuery( this ).css( "cursor", "pointer" );
  });
  /* Sliding the panels */
  jQuery(".postbox").on('click', '.handlediv', function(){
    jQuery(this).siblings(".inside").slideToggle();
  });
  jQuery(".postbox").on('click', '.hndle', function(){
    jQuery(this).siblings(".inside").slideToggle();
  });
    
});
</script>
<style>
    .CodeMirror {
      border: 1px solid #eee;
      height: auto;
    }
</style>
<div class="wrap">
    
    <!-- HEADER -->
    <h2 class="headerpage"><?php _e('WP Maintenance - Settings', 'wp-maintenance'); ?> <sup>v.<?php _e(WPM_VERSION); ?></sup></h2>
    <?php if(isset($messageUpdate) && $messageUpdate == 1 ) { ?>
        <div id="message" class="updated fade"><p><strong><?php _e('Options saved.', 'wp-maintenance'); ?></strong></p></div>
    <?php } ?>
    <!-- END HEADER -->

    <div class="wp-maintenance-wrapper">
        
        <?php echo wpm_get_nav2(); ?>

        <div class="wp-maintenance-tab-content wp-maintenance-tab-content-welcome" id="wp-maintenance-tab-content">

            <form method="post" action="" name="valide_settings">
                <input type="hidden" name="action" value="update_settings" />
                <?php wp_nonce_field('valid-settings', 'security-settings'); ?>
            
                <div class="wp-maintenance-module-options-block">
                
                    <h3><?php _e('Theme maintenance page', 'wp-maintenance'); ?></h3>
                    <p>
                        <label class="wp-maintenance-container"><span class="wp-maintenance-label-text"><?php _e('Yes, I use a theme maintenance page', 'wp-maintenance'); ?></span>
                            <input type="checkbox" name="wpoptions[pageperso]" value="1" <?php if(isset($wpoptions['pageperso']) && $wpoptions['pageperso']==1) { echo ' checked'; } ?>>
                            <span class="wp-maintenance-checkmark"></span>
                        </label>
                        
                    </p>
                    <div class="wp-maintenance-setting-row">
                    <?php _e('You can use this shortcode to include Social Networks icons:', 'wp-maintenance'); ?> <input type="text" value="do_shortcode('[wpm_social]');" onclick="select()" style="width:250px;" />
                    </div>

                    <!-- DELETE OPTION IF DEACTIVATED -->
                    <h3><?php _e('Delete custom settings upon plugin deactivation?', 'wp-maintenance'); ?></h3>
                    <p>
                        <label class="wp-maintenance-container"><span class="wp-maintenance-label-text"><?php _e('Yes, all custom settings will be deleted from database upon plugin deactivation', 'wp-maintenance'); ?></span>
                            <input type="checkbox" name="wpoptions[dashboard_delete_db]" value="1" <?php if(isset($wpoptions['dashboard_delete_db']) && $wpoptions['dashboard_delete_db']==1) { echo ' checked'; } ?>>
                            <span class="wp-maintenance-checkmark"></span>
                        </label>
                    </p>

                    <!-- DISPLAY 503 ERROR? -->
                    <h3><?php _e('Display code HTTP Error 503?', 'wp-maintenance'); ?></h3>
                    <p>
                        <label class="wp-maintenance-container"><span class="wp-maintenance-label-text"><?php _e('Yes, inform visitors and search engines that my site is temporarily unavailable.', 'wp-maintenance'); ?></span>
                            <input type="checkbox" name="wpoptions[error_503]" value="1" <?php if(isset($wpoptions['error_503']) && $wpoptions['error_503']==1) { echo ' checked'; } ?>>
                            <span class="wp-maintenance-checkmark"></span>
                        </label>
                    </p>

                    <!-- Remove Google Font -->
                    <h3><?php _e('Remove Google Fonts', 'wp-maintenance'); ?></h3>
                    <p>
                        <label class="wp-maintenance-container"><span class="wp-maintenance-label-text"><?php _e('Yes, remove Google Font option.', 'wp-maintenance'); ?></span>
                            <input type="checkbox" name="wpoptions[remove_googlefonts]" value="1" <?php if(isset($wpoptions['remove_googlefonts']) && $wpoptions['remove_googlefonts']==1) { echo ' checked'; } ?>>
                            <span class="wp-maintenance-checkmark"></span>
                        </label>
                    </p>
                    <p class="submit"><button type="submit" name="footer_submit" id="footer_submit" class="wp-maintenance-button wp-maintenance-button-primary"><?php _e('Save', 'wp-maintenance'); ?></button></p>
                </div>

                <!-- Roles and Capabilities -->
                <div class="wp-maintenance-module-options-block">
                    
                    <div class="wp-maintenance-settings-section-header">
                        <h3 class="wp-maintenance-settings-section-title" id="module-import_export"><?php _e('Roles and Capabilities', 'wp-maintenance'); ?></h3>
                    </div>
                    <h3><?php _e('Allow the site to display these roles', 'wp-maintenance'); ?></h3>
                    <p>
                        <input type="hidden" name="wp_maintenance_limit[administrator]" value="administrator" />                        
                        <?php
                        $roles = wpm_get_roles();
                        foreach($roles as $role=>$name) {
                            $limitCheck = '';
                            if(isset($paramLimit[$role]) && $paramLimit[$role]==$role) { $limitCheck = ' checked'; }
                            if($role !='administrator') {
                            
                    ?>
                        <label class="wp-maintenance-container"><span class="wp-maintenance-label-text"><?php echo esc_html($name); ?></span>
                            <input type="checkbox" class="switch-field" name="wp_maintenance_limit[<?php echo esc_html($role); ?>]" value="<?php echo esc_html($role); ?>"<?php echo esc_html($limitCheck); ?> />
                            <span class="wp-maintenance-checkmark"></span>
                        </label><br />
                        
                    <?php } }//end foreach ?>
                    </p>
                    <p class="submit"><button type="submit" name="footer_submit" id="footer_submit" class="wp-maintenance-button wp-maintenance-button-primary"><?php _e('Save', 'wp-maintenance'); ?></button></p>
                </div>

                <!-- IP addresses autorized -->
                <div class="wp-maintenance-module-options-block">
                    
                    <div class="wp-maintenance-settings-section-header">
                        <h3 class="wp-maintenance-settings-section-title" id="module-import_export"><?php _e('IP autorized', 'wp-maintenance'); ?></h3>
                    </div>
                    <div class="wp-maintenance-setting-row">
                        <label for="wp_maintenance_ipaddresses" class="wp-maintenance-setting-row-title"><?php _e('Allow the site to display these IP addresses. Please, enter one IP address by line', 'wp-maintenance'); ?></label>
                        <?php
                            if(isset($paramIpAddress) && $paramIpAddress!='' ) { 

                                if( WPM_VERSION <= '6.0.9') {

                                    $lienIpAddress = explode("\r\n", $paramIpAddress);
                                    foreach($lienIpAddress as $ipAutorized) {
                                        if($ipAutorized!='') { 
                                            echo '<input type="text" name="wp_maintenance_ipaddresses[]" size="80%" placeholder="'.__('Enter one IP addresses here', 'wp-maintenance').'" class="wp-maintenance-input" value="'.esc_html($ipAutorized).'"><br />';
                                        }
                                    }

                                } else {

                                    foreach($paramIpAddress as $ipAutorized) {
                                        if($ipAutorized!='') { 
                                            echo '<input type="text" name="wp_maintenance_ipaddresses[]" size="80%" placeholder="'.__('Enter one IP addresses here', 'wp-maintenance').'" class="wp-maintenance-input" value="'.esc_html($ipAutorized).'"><br />';
                                        }
                                    }
                                }
                            }
                        ?>
                        <input type="text" name="wp_maintenance_ipaddresses[]" size="80%" placeholder='<?php _e('Enter one IP addresses here', 'wp-maintenance'); ?>' class="wp-maintenance-input" value="">
                    </div>

                    <p class="submit"><button type="submit" name="footer_submit" id="footer_submit" class="wp-maintenance-button wp-maintenance-button-primary"><?php _e('Save', 'wp-maintenance'); ?></button></p>
                </div>

                <!-- ID pages autorized -->
                <div class="wp-maintenance-module-options-block">
                    
                    <div class="wp-maintenance-settings-section-header">
                        <h3 class="wp-maintenance-settings-section-title" id="module-import_export"><?php _e('ID pages autorized', 'wp-maintenance'); ?></h3>
                    </div>
                    <div class="wp-maintenance-setting-row">
                        <label for="wpoptions[id_pages]" class="wp-maintenance-setting-row-title"><?php _e('Allow the site to display these ID pages. Please, enter the ID pages separate with comma', 'wp-maintenance'); ?></label>
                        <input name="wpoptions[id_pages]" size="80%" class="wp-maintenance-input" value="<?php if(isset($wpoptions['id_pages']) && $wpoptions['id_pages']!='' ) { echo esc_html($wpoptions['id_pages']); } ?>" />
                    </div>

                    <p class="submit"><button type="submit" name="footer_submit" id="footer_submit" class="wp-maintenance-button wp-maintenance-button-primary"><?php _e('Save', 'wp-maintenance'); ?></button></p>
                </div>

                <!-- Header Code -->
                <div class="wp-maintenance-module-options-block">
                    
                    <div class="wp-maintenance-settings-section-header">
                        <h3 class="wp-maintenance-settings-section-title" id="module-import_export"><?php _e('Header Code', 'wp-maintenance'); ?></h3>
                    </div>
                    <div class="wp-maintenance-setting-row">
                        <label for="wpoptions[headercode]" class="wp-maintenance-setting-row-title"><?php _e('The following code will add to the <head> tag. Useful if you need to add additional scripts such as CSS or JS', 'wp-maintenance'); ?></label>
                        <textarea id="headercode" name="wpoptions[headercode]" class="wp-maintenance-input" COLS=50 ROWS=2><?php if(isset($wpoptions['headercode']) && $wpoptions['headercode']!='' ) { echo esc_textarea(stripslashes($wpoptions['headercode'])); }  ?></textarea>
                    </div>

                    <p class="submit"><button type="submit" name="footer_submit" id="footer_submit" class="wp-maintenance-button wp-maintenance-button-primary"><?php _e('Save', 'wp-maintenance'); ?></button></p>
                </form>
            </div>
            
            <div class="wp-maintenance-module-options-block">
                <div class="wp-maintenance-settings-section-header">
                    <h3 class="wp-maintenance-settings-section-title" id="module-import_export"><?php _e('Export / Import Settings', 'wp-maintenance'); ?></h3>
                </div>
                <div class="wp-maintenance-setting-row">
                    <label class="wp-maintenance-setting-row-title"><?php _e('Export Settings', 'wp-maintenance'); ?></label>
                    <form method="post">
                        <input type="hidden" name="wpm_action" value="export_settings" />
                        <?php wp_nonce_field( 'go_export_nonce', 'wpm_export_nonce' ); ?>
                        <?php submit_button( __( 'Export', 'wp-maintenance' ), 'wp-maintenance-button wp-maintenance-button-secondary', 'submit', false ); ?>
                    </form>
                </div>
                
                <div class="wp-maintenance-setting-row">
                    <label class="wp-maintenance-setting-row-title"><?php _e('Import the plugin settings from a .json file. This file can be obtained by exporting the settings on another site using the form above', 'wp-maintenance'); ?></label>
                    <form method="post" enctype="multipart/form-data">
                        <input type="hidden" name="wpm_action" value="import_settings" />
                        <input type="file" name="wpm_import_file"/>                            
                        <?php wp_nonce_field( 'go_import_nonce', 'wpm_import_nonce' ); ?><p>
                        <?php submit_button( __( 'Import', 'wp-maintenance' ), 'wp-maintenance-button wp-maintenance-button-secondary', 'submit', false ); ?></p>
                    </form>
                </div>
            </div>

         </div>
    </div>    
    
    <?php echo wpm_footer(); ?>
    
</div>
<script>
    jQuery(document).ready(function($) {
        //wp.codeEditor.initialize($('#headercode'), cm_settings);
        var editorSettings = wp.codeEditor.defaultSettings ? _.clone( wp.codeEditor.defaultSettings ) : {};
        editorSettings.codemirror = _.extend(
            {},
            editorSettings.codemirror,
            {
                indentUnit: 2,
                tabSize: 2,
                mode: 'javascript',
            }
        );
        var editor = wp.codeEditor.initialize( $('#headercode'), editorSettings );
    });
</script>

AnonSec - 2021