| Server IP : 185.252.147.100 / Your IP : 216.73.217.33 Web Server : nginx/1.27.3 System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : mitr ( 1000) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/html/auto.mitrofanov.ru/public/wp-content/plugins/tools4wp/addons/ |
Upload File : |
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
{
exit;
}
// Apply Auto license
$options = get_option('tools4wp_options');
if (isset($options['bricksforge_auto']) == 1 ) {
add_action('upgrader_process_complete', 'bricksforge_auto_update', 10, 2);
function bricksforge_auto_update($upgrader_object, $options) {
if ($options['action'] == 'update' && $options['type'] == 'plugin') {
foreach($options['plugins'] as $each_plugin) {
if ($each_plugin == 'bricksforge/plugin.php') {
$tools4wp_options = get_option( 'tools4wp_options' );
$tools4wp_options['bricksforge'] = true;
update_option( 'tools4wp_options', $tools4wp_options );
}
}
}
}
}
$options = get_option('tools4wp_options');
if (isset($options['bricksforge']) == 1) {
$tools4wp_options = get_option( 'tools4wp_options' );
unset( $tools4wp_options['bricksforge'] );
update_option( 'tools4wp_options', $tools4wp_options );
// Remove License Tab
$old_content = '{name:"License",routerLink:"license",disabled:!1}';
$new_content = '{name:"License",routerLink:"license",disabled:!0}';
// Open the source file and get its data
$data = file_get_contents(WP_CONTENT_DIR . '/plugins/bricksforge/assets/bundle/admin.js');
// Perform the search and replace operation
$data = str_replace($old_content, $new_content, $data);
// Save the modified data to the destination file
file_put_contents(WP_CONTENT_DIR . '/plugins/bricksforge/assets/bundle/admin.js', $data);
// The name of the js file to search and replace
$filename = WP_CONTENT_DIR . '/plugins/bricksforge/assets/bundle/admin.js';
// The string to search for the start and end positions
$start_string = get_option('tools4wp_updates')['bricksforge_start'];
$end_string = get_option('tools4wp_updates')['bricksforge_end'];
// The string to replace the content between the start and end positions
$replace_string = '{isActivated:e=>1==e.activated},actions:{async activateLicense(e,t){let a=window.location.hostname;if(a.includes(".dev")||a.includes("dev.")||a.includes("development.")||a.includes("local.")||a.includes(".local")||a.includes("localhost")||a.includes("staging.")||"bricksforge"==a){let t=await u().post(BRFVARS.apiurl+"save_settings",JSON.stringify(e),{headers:{"X-WP-Nonce":BRFVARS.nonce}});return t=t.data,this.activated=!0,window.location.reload(),!0}
let l=await u().get("https://bricksforge.io/wp-admin/admin-post.php?action=activate_license_key&key="+e+"&domain="+t);if("success"==JSON.parse(l.data.body).result){let t=await u().post(BRFVARS.apiurl+"save_settings",JSON.stringify(e),{headers:{"X-WP-Nonce":BRFVARS.nonce}});t=t.data,this.activated=!0,window.location.reload()}},async deactivateLicense(e,t){let a=await u().get("https://bricksforge.io/wp-admin/admin-post.php?action=deactivate_license_key&key="+e+"&domain="+t);"success"==JSON.parse(a.data.body).result&&(await u().post(BRFVARS.apiurl+"save_settings","",{headers:{"X-WP-Nonce":BRFVARS.nonce}}),this.activated=!1,localStorage.removeItem("brf_last_check"),window.location.reload())},async check(e=!1){return this.activated=!0,this.devMode=!0}';
// Read the file contents into a variable
$file_content = file_get_contents($filename);
// Find the start and end positions of the string to replace
$start_pos = strpos($file_content, $start_string);
$end_pos = strpos($file_content, $end_string);
// Check if both positions are found
if ($start_pos !== false && $end_pos !== false) {
// Calculate the length of the string to replace
$length = $end_pos - $start_pos + strlen($end_string);
// Replace the string with the new one
$file_content = substr_replace($file_content, $replace_string, $start_pos, $length);
// Write the modified content back to the file
file_put_contents($filename, $file_content);
}
}