Exemplo n.º 1
0
DupUtil::log($msg);
DupUtil::log("--------------------------------------");
DupUtil::log("KEEP PLUGINS ACTIVE");
DupUtil::log("--------------------------------------");
$msg = isset($_POST['plugins']) && count($_POST['plugins'] > 0) ? print_r($_POST['plugins'], true) : 'No plugins selected for activation';
DupUtil::log($msg);
//UPDATE SETTINGS
$serial_plugin_list = isset($_POST['plugins']) && count($_POST['plugins'] > 0) ? @serialize($_POST['plugins']) : '';
mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$_POST['blogname']}' WHERE option_name = 'blogname' ");
mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$_POST['url_new']}'  WHERE option_name = 'home' ");
mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$_POST['siteurl']}'  WHERE option_name = 'siteurl' ");
mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$serial_plugin_list}'  WHERE option_name = 'active_plugins' ");
DupUtil::log("--------------------------------------");
DupUtil::log("GLOBAL DB-REPLACE");
DupUtil::log("--------------------------------------");
array_push($GLOBALS['REPLACE_LIST'], array('search' => $_POST['url_old'], 'replace' => $_POST['url_new']), array('search' => $_POST['path_old'], 'replace' => $_POST['path_new']), array('search' => rtrim(DupUtil::unset_safe_path($_POST['path_old']), '\\'), 'replace' => rtrim($_POST['path_new'], '/')));
@mysqli_autocommit($dbh, false);
$report = DupDBTextSwap::load($dbh, $GLOBALS['REPLACE_LIST'], $_POST['tables'], $GLOBALS['TABLES_SKIP_COLS']);
@mysqli_commit($dbh);
@mysqli_autocommit($dbh, true);
//BUILD JSON RESPONSE
$JSON = array();
$JSON['step1'] = json_decode(urldecode($_POST['json']));
$JSON['step2'] = $report;
$JSON['step2']['warn_all'] = 0;
$JSON['step2']['warnlist'] = array();
DupDBTextSwap::log_stats($report);
DupDBTextSwap::log_errors($report);
//Reset the postguid data
if ($_POST['postguid']) {
    mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}posts` SET guid = REPLACE(guid, '{$_POST['url_new']}', '{$_POST['url_old']}')");
$log .= "[~] scan only text columns\n";
$log .= "[^] no searchable columns\n";
$log .= "--------------------------------------";
DUPX_Log::Info($log);

$url_old_json = str_replace('"', "", json_encode($_POST['url_old']));
$url_new_json = str_replace('"', "", json_encode($_POST['url_new']));
$path_old_json = str_replace('"', "", json_encode($_POST['path_old']));
$path_new_json = str_replace('"', "", json_encode($_POST['path_new']));

array_push($GLOBALS['REPLACE_LIST'], 
		array('search' => $_POST['url_old'],  'replace' => $_POST['url_new']), 
		array('search' => $url_old_json,	  'replace' => $url_new_json), 
		array('search' => $_POST['path_old'], 'replace' => $_POST['path_new']), 
		array('search' => $path_old_json,	  'replace' => $path_new_json), 		
		array('search' => rtrim(DupUtil::unset_safe_path($_POST['path_old']), '\\'), 'replace' => rtrim($_POST['path_new'], '/'))
);

@mysqli_autocommit($dbh, false);
$report = DUPX_Serializer::load($dbh, $GLOBALS['REPLACE_LIST'], $_POST['tables'], $GLOBALS['TABLES_SKIP_COLS'], $_POST['fullsearch']);
@mysqli_commit($dbh);
@mysqli_autocommit($dbh, true);


//BUILD JSON RESPONSE
$JSON = array();
$JSON['step1'] = json_decode(urldecode($_POST['json']));
$JSON['step2'] = $report;
$JSON['step2']['warn_all'] = 0;
$JSON['step2']['warnlist'] = array();