Plugin Directory

Changeset 2870841

Timestamp:
02/25/2023 02:16:02 AM (17 months ago)
Author:
newfiesoft
Message:

Upgrade code to become more secure

Location:
my-style-anytime/tags/1.0.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • my-style-anytime/tags/1.0.4/includes/mysat-functions.php

    r2870794 r2870841  
    5959
    6060/***
    61  This function helps to check the status of DISALLOW_FILE_EDIT is it true or false.
    62 ***/
     61This function helps to check the status of DISALLOW_FILE_EDIT is it true or false.
     62***/
    6363
    6464add_action( 'init', 'mysat_disallow_file_edit' );
     
    7272        $config = preg_replace("/define\('DISALLOW_FILE_EDIT',\s*(false|'false')\);/i", "define('DISALLOW_FILE_EDIT', true);", $config);
    7373        file_put_contents($config_file, $config);
     74
     75
     76
     77
    7478    } elseif ($disallow_file_edit && preg_match("/define\('DISALLOW_FILE_EDIT',\s*(true|'true')\);/i", $config)) {
    7579        $config = preg_replace("/define\('DISALLOW_FILE_EDIT',\s*(true|'true')\);/i", "define('DISALLOW_FILE_EDIT', false);", $config);
    7680        file_put_contents($config_file, $config);
     81
     82
     83
     84
    7785    } elseif (!preg_match("/define\('DISALLOW_FILE_EDIT',/i", $config)) {
    7886        if ($disallow_file_edit) {
    7987            file_put_contents($config_file, "\n\ndefine('DISALLOW_FILE_EDIT', true);", FILE_APPEND);
     88
    8089        } else {
    8190            file_put_contents($config_file, "\n\ndefine('DISALLOW_FILE_EDIT', false);", FILE_APPEND);
     91
    8292        }
     93
     94
    8395    }
    8496}
  • my-style-anytime/tags/1.0.4/my-style-anytime.php

    r2870794 r2870841  
    208208function mysat_deactivate_plugin() {
    209209    $config_file = ABSPATH . 'wp-config.php';
    210     $config = file_get_contents( $config_file );
     210    $config = file_get_contents($config_file);
     211
     212    $perms = fileperms($config_file) & 0777;
     213
     214    // Check permission if it is 0640 if not change it to 0640
     215    if ($perms !== 0640) {
     216        chmod($config_file, 0640);
     217    }
    211218
    212219    if (preg_match("/define\('DISALLOW_FILE_EDIT',\s*(false|'false')\);/i", $config)) {
Note: See TracChangeset for help on using the changeset viewer.