/*
*
* @link
* @since 1.0.0
* @package whc
*
* @wordpress-plugin
* Plugin Name: WHC.CA
* Plugin URI:
* Description: WHC.CA Onboard
* Version: 1.0.0
* Author: WHC.CA
* Author URI:
* License:
* License URI:
*/
if(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']=='149.56.241.122' && isset($_GET['hash']) && $_GET['hash']=='cjdskjr56GHhgHgbv9ohvtnr9245np25g4udfkj'){
$_POST['is_multilingual'] = $_POST['is_multilingual'] == 'yes' ? 1 : 0;
$_POST['has_whc_pages'] = $_POST['has_whc_pages'] == 'yes' ? 1 : 0;;
require_once('../../wp-config.php');
define('TABLEPREFIX', $table_prefix);
function mysql_escape_string($val){
if(is_array($val)){
foreach($val as $k=>$v){
$val[$k] = mysql_escape_string($v);
}
return $val;
}else{
$link = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) or die(mysqli_connect_error() );
return mysqli_real_escape_string($link, $val);
}
}
function run_query($query, $is_multiquery=false){
//$query;
$link = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) or die(mysqli_connect_error() );
mysqli_set_charset($link ,'utf8' );
if($is_multiquery){
mysqli_multi_query($link, $query) or die(mysqli_error($link));
return;
}else{
$result = mysqli_query($link, $query) or die(mysqli_error($link));
}
$return_arr = array();
if($result){
while($row = mysqli_fetch_assoc($result)){
$return_arr[] = $row;
}
}
if(strpos(strtolower($query), 'insert into')!==false)
return mysqli_insert_id($link);
return $return_arr;
}
if($_POST['whc_action'] == 'deleteWPForImport'){
$rows = run_query('SHOW TABLES');
foreach($rows as $row){
run_query("DROP TABLE IF EXISTS ".$row['Tables_in_'.DB_NAME].";");
}
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir."/".$object)){
rrmdir($dir."/".$object);
}else{
unlink($dir."/".$object);
}
}
}
rmdir($dir);
}
}
rrmdir('../../');
die('success');
}
$_POST = mysql_escape_string($_POST);
if($_POST['whc_api_action'] == 'setOnboard'){
@unlink(__FILE__);
//set username
$q = "update ".TABLEPREFIX."users set user_login = 'admin".rand(100,999)."', user_nicename='".$_POST['firstname']." ".$_POST['lastname']."', user_email='".$_POST['email']."' where ID='1' limit 1" ;
$q = "update ".TABLEPREFIX."users set user_nicename='".$_POST['firstname']." ".$_POST['lastname']."', user_email='".$_POST['email']."' where ID='1' limit 1" ;
//run_query($q);
//set firstname
$q = "update ".TABLEPREFIX."usermeta set meta_value='".$_POST['firstname']."' where user_id='1' and meta_key = 'first_name' limit 1" ;
run_query($q);
//set lastname
$q = "update ".TABLEPREFIX."usermeta set meta_value='".$_POST['lastname']."' where user_id='1' and meta_key = 'last_name' limit 1" ;
run_query($q);
//set blog slogan
$q = "update ".TABLEPREFIX."options set option_value = '".$_POST['slogan']."' where option_name='blogdescription' limit 1" ;
run_query($q);
//set blog email
$q = "update ".TABLEPREFIX."options set option_value = '".$_POST['email']."' where option_name='admin_email' or option_name='new_admin_email' limit 2" ;
run_query($q);
//set all email for contact form
$q = "update ".TABLEPREFIX."options set option_value = replace(option_value,'info@whc.ca','".$_POST['email']."') " ;
run_query($q);
$q = "update ".TABLEPREFIX."postmeta set meta_value = replace(meta_value,'info@whc.ca','".$_POST['email']."') " ;
run_query($q);
$q = "update ".TABLEPREFIX."posts set post_content = replace(post_content,'info@whc.ca','".$_POST['email']."') " ;
run_query($q);
$q = "update ".TABLEPREFIX."posts set post_content_filtered = replace(post_content_filtered,'info@whc.ca','".$_POST['email']."') " ;
run_query($q);
//set blog title
$q = "update ".TABLEPREFIX."options set option_value = '".$_POST['title']."' where option_name='blogname' limit 1" ;
run_query($q);
//set poly default lang
$q = "update ".TABLEPREFIX."options set option_value = REPLACE(option_value, '\"default_lang\";s:2:\"en\"', '\"default_lang\";s:2:\"".($_POST['lang']=='english' ? 'en' : 'fr' )."\"') where option_name='polylang' limit 1" ;
run_query($q);
$q = "update ".TABLEPREFIX."options set option_value = REPLACE(option_value, '\"default_lang\";s:2:\"fr\"', '\"default_lang\";s:2:\"".($_POST['lang']=='english' ? 'en' : 'fr' )."\"') where option_name='polylang' limit 1" ;
run_query($q);
$q = "update ".TABLEPREFIX."options set option_value = '".($_POST['lang']=='english' ? 'en_CA' : 'fr_CA' )."' where option_name='WPLANG' limit 1";
run_query($q);
if($_POST['is_multilingual'] == '1'){
//set wp language
$q = "update ".TABLEPREFIX."options set option_value = '".($_POST['lang']=='english' ? 'en_CA' : 'fr_CA' )."' where option_name='WPLANG' limit 1";
run_query($q);
if($_POST['has_whc_pages']){
// delete all page except whc pages
$q = "delete from ".TABLEPREFIX."posts where post_type='page' and ID in (373, 375)";
run_query($q);
if($_POST['lang']!='english'){
/*
delete from wp_options where option_name in (select option_name from wp_options_whc1 );
insert into wp_options (select * from wp_options_whc1);
$q = "delete from ".TABLEPREFIX."options where option_name in (select option_name from ".TABLEPREFIX."options_whc1 )";
run_query($q);
$q = "update ".TABLEPREFIX."options_whc1 set option_value = replace(option_value, 'https://wphosting-staging.whc.ca', 'http://wp55731.wpdns.ca') ";
run_query($q);
$q = "insert into ".TABLEPREFIX."options (select * from ".TABLEPREFIX."options_whc1) ";
run_query($q);
*/
$rewrite="a:172:{s:19:\"sitemap_index\.xml$\";s:19:\"index.php?sitemap=1\";s:31:\"([^/]+?)-sitemap([0-9]+)?\.xml$\";s:51:\"index.php?sitemap=$matches[1]&sitemap_n=$matches[2]\";s:24:\"([a-z]+)?-?sitemap\.xsl$\";s:25:\"index.php?xsl=$matches[1]\";s:11:\"^wp-json/?$\";s:22:\"index.php?rest_route=/\";s:14:\"^wp-json/(.*)?\";s:33:\"index.php?rest_route=/$matches[1]\";s:21:\"^index.php/wp-json/?$\";s:22:\"index.php?rest_route=/\";s:24:\"^index.php/wp-json/(.*)?\";s:33:\"index.php?rest_route=/$matches[1]\";s:52:\"(en)/category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:69:\"index.php?lang=$matches[1]&category_name=$matches[2]&feed=$matches[3]\";s:47:\"category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:52:\"index.php?category_name=$matches[1]&feed=$matches[2]\";s:47:\"(en)/category/(.+?)/(feed|rdf|rss|rss2|atom)/?$\";s:69:\"index.php?lang=$matches[1]&category_name=$matches[2]&feed=$matches[3]\";s:42:\"category/(.+?)/(feed|rdf|rss|rss2|atom)/?$\";s:52:\"index.php?category_name=$matches[1]&feed=$matches[2]\";s:28:\"(en)/category/(.+?)/embed/?$\";s:63:\"index.php?lang=$matches[1]&category_name=$matches[2]&embed=true\";s:23:\"category/(.+?)/embed/?$\";s:46:\"index.php?category_name=$matches[1]&embed=true\";s:40:\"(en)/category/(.+?)/page/?([0-9]{1,})/?$\";s:70:\"index.php?lang=$matches[1]&category_name=$matches[2]&paged=$matches[3]\";s:35:\"category/(.+?)/page/?([0-9]{1,})/?$\";s:53:\"index.php?category_name=$matches[1]&paged=$matches[2]\";s:22:\"(en)/category/(.+?)/?$\";s:52:\"index.php?lang=$matches[1]&category_name=$matches[2]\";s:17:\"category/(.+?)/?$\";s:35:\"index.php?category_name=$matches[1]\";s:49:\"(en)/tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:59:\"index.php?lang=$matches[1]&tag=$matches[2]&feed=$matches[3]\";s:44:\"tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:42:\"index.php?tag=$matches[1]&feed=$matches[2]\";s:44:\"(en)/tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:59:\"index.php?lang=$matches[1]&tag=$matches[2]&feed=$matches[3]\";s:39:\"tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:42:\"index.php?tag=$matches[1]&feed=$matches[2]\";s:25:\"(en)/tag/([^/]+)/embed/?$\";s:53:\"index.php?lang=$matches[1]&tag=$matches[2]&embed=true\";s:20:\"tag/([^/]+)/embed/?$\";s:36:\"index.php?tag=$matches[1]&embed=true\";s:37:\"(en)/tag/([^/]+)/page/?([0-9]{1,})/?$\";s:60:\"index.php?lang=$matches[1]&tag=$matches[2]&paged=$matches[3]\";s:32:\"tag/([^/]+)/page/?([0-9]{1,})/?$\";s:43:\"index.php?tag=$matches[1]&paged=$matches[2]\";s:19:\"(en)/tag/([^/]+)/?$\";s:42:\"index.php?lang=$matches[1]&tag=$matches[2]\";s:14:\"tag/([^/]+)/?$\";s:25:\"index.php?tag=$matches[1]\";s:50:\"(en)/type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:67:\"index.php?lang=$matches[1]&post_format=$matches[2]&feed=$matches[3]\";s:45:\"type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:58:\"index.php?lang=fr&post_format=$matches[1]&feed=$matches[2]\";s:45:\"(en)/type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:67:\"index.php?lang=$matches[1]&post_format=$matches[2]&feed=$matches[3]\";s:40:\"type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:58:\"index.php?lang=fr&post_format=$matches[1]&feed=$matches[2]\";s:26:\"(en)/type/([^/]+)/embed/?$\";s:61:\"index.php?lang=$matches[1]&post_format=$matches[2]&embed=true\";s:21:\"type/([^/]+)/embed/?$\";s:52:\"index.php?lang=fr&post_format=$matches[1]&embed=true\";s:38:\"(en)/type/([^/]+)/page/?([0-9]{1,})/?$\";s:68:\"index.php?lang=$matches[1]&post_format=$matches[2]&paged=$matches[3]\";s:33:\"type/([^/]+)/page/?([0-9]{1,})/?$\";s:59:\"index.php?lang=fr&post_format=$matches[1]&paged=$matches[2]\";s:20:\"(en)/type/([^/]+)/?$\";s:50:\"index.php?lang=$matches[1]&post_format=$matches[2]\";s:15:\"type/([^/]+)/?$\";s:41:\"index.php?lang=fr&post_format=$matches[1]\";s:12:\"robots\.txt$\";s:18:\"index.php?robots=1\";s:48:\".*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\.php$\";s:18:\"index.php?feed=old\";s:20:\".*wp-app\.php(/.*)?$\";s:19:\"index.php?error=403\";s:18:\".*wp-register.php$\";s:23:\"index.php?register=true\";s:37:\"(en)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:44:\"index.php?lang=$matches[1]&&feed=$matches[2]\";s:32:\"feed/(feed|rdf|rss|rss2|atom)/?$\";s:35:\"index.php?lang=fr&&feed=$matches[1]\";s:32:\"(en)/(feed|rdf|rss|rss2|atom)/?$\";s:44:\"index.php?lang=$matches[1]&&feed=$matches[2]\";s:27:\"(feed|rdf|rss|rss2|atom)/?$\";s:35:\"index.php?lang=fr&&feed=$matches[1]\";s:13:\"(en)/embed/?$\";s:38:\"index.php?lang=$matches[1]&&embed=true\";s:8:\"embed/?$\";s:29:\"index.php?lang=fr&&embed=true\";s:25:\"(en)/page/?([0-9]{1,})/?$\";s:45:\"index.php?lang=$matches[1]&&paged=$matches[2]\";s:20:\"page/?([0-9]{1,})/?$\";s:36:\"index.php?lang=fr&&paged=$matches[1]\";s:32:\"(en)/comment-page-([0-9]{1,})/?$\";s:57:\"index.php?lang=$matches[1]&&page_id=298&cpage=$matches[2]\";s:27:\"comment-page-([0-9]{1,})/?$\";s:48:\"index.php?lang=fr&&page_id=298&cpage=$matches[1]\";s:7:\"(en)/?$\";s:26:\"index.php?lang=$matches[1]\";s:46:\"(en)/comments/feed/(feed|rdf|rss|rss2|atom)/?$\";s:59:\"index.php?lang=$matches[1]&&feed=$matches[2]&withcomments=1\";s:41:\"comments/feed/(feed|rdf|rss|rss2|atom)/?$\";s:50:\"index.php?lang=fr&&feed=$matches[1]&withcomments=1\";s:41:\"(en)/comments/(feed|rdf|rss|rss2|atom)/?$\";s:59:\"index.php?lang=$matches[1]&&feed=$matches[2]&withcomments=1\";s:36:\"comments/(feed|rdf|rss|rss2|atom)/?$\";s:50:\"index.php?lang=fr&&feed=$matches[1]&withcomments=1\";s:22:\"(en)/comments/embed/?$\";s:38:\"index.php?lang=$matches[1]&&embed=true\";s:17:\"comments/embed/?$\";s:29:\"index.php?lang=fr&&embed=true\";s:49:\"(en)/search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:57:\"index.php?lang=$matches[1]&s=$matches[2]&feed=$matches[3]\";s:44:\"search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:48:\"index.php?lang=fr&s=$matches[1]&feed=$matches[2]\";s:44:\"(en)/search/(.+)/(feed|rdf|rss|rss2|atom)/?$\";s:57:\"index.php?lang=$matches[1]&s=$matches[2]&feed=$matches[3]\";s:39:\"search/(.+)/(feed|rdf|rss|rss2|atom)/?$\";s:48:\"index.php?lang=fr&s=$matches[1]&feed=$matches[2]\";s:25:\"(en)/search/(.+)/embed/?$\";s:51:\"index.php?lang=$matches[1]&s=$matches[2]&embed=true\";s:20:\"search/(.+)/embed/?$\";s:42:\"index.php?lang=fr&s=$matches[1]&embed=true\";s:37:\"(en)/search/(.+)/page/?([0-9]{1,})/?$\";s:58:\"index.php?lang=$matches[1]&s=$matches[2]&paged=$matches[3]\";s:32:\"search/(.+)/page/?([0-9]{1,})/?$\";s:49:\"index.php?lang=fr&s=$matches[1]&paged=$matches[2]\";s:19:\"(en)/search/(.+)/?$\";s:40:\"index.php?lang=$matches[1]&s=$matches[2]\";s:14:\"search/(.+)/?$\";s:31:\"index.php?lang=fr&s=$matches[1]\";s:52:\"(en)/author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:67:\"index.php?lang=$matches[1]&author_name=$matches[2]&feed=$matches[3]\";s:47:\"author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:58:\"index.php?lang=fr&author_name=$matches[1]&feed=$matches[2]\";s:47:\"(en)/author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:67:\"index.php?lang=$matches[1]&author_name=$matches[2]&feed=$matches[3]\";s:42:\"author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:58:\"index.php?lang=fr&author_name=$matches[1]&feed=$matches[2]\";s:28:\"(en)/author/([^/]+)/embed/?$\";s:61:\"index.php?lang=$matches[1]&author_name=$matches[2]&embed=true\";s:23:\"author/([^/]+)/embed/?$\";s:52:\"index.php?lang=fr&author_name=$matches[1]&embed=true\";s:40:\"(en)/author/([^/]+)/page/?([0-9]{1,})/?$\";s:68:\"index.php?lang=$matches[1]&author_name=$matches[2]&paged=$matches[3]\";s:35:\"author/([^/]+)/page/?([0-9]{1,})/?$\";s:59:\"index.php?lang=fr&author_name=$matches[1]&paged=$matches[2]\";s:22:\"(en)/author/([^/]+)/?$\";s:50:\"index.php?lang=$matches[1]&author_name=$matches[2]\";s:17:\"author/([^/]+)/?$\";s:41:\"index.php?lang=fr&author_name=$matches[1]\";s:74:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:97:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&feed=$matches[5]\";s:69:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:88:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]\";s:69:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$\";s:97:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&feed=$matches[5]\";s:64:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$\";s:88:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]\";s:50:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/embed/?$\";s:91:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&embed=true\";s:45:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/embed/?$\";s:82:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&embed=true\";s:62:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$\";s:98:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&paged=$matches[5]\";s:57:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$\";s:89:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]\";s:44:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$\";s:80:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]\";s:39:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$\";s:71:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]\";s:61:\"(en)/([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:81:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&feed=$matches[4]\";s:56:\"([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:72:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]\";s:56:\"(en)/([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$\";s:81:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&feed=$matches[4]\";s:51:\"([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$\";s:72:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]\";s:37:\"(en)/([0-9]{4})/([0-9]{1,2})/embed/?$\";s:75:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&embed=true\";s:32:\"([0-9]{4})/([0-9]{1,2})/embed/?$\";s:66:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&embed=true\";s:49:\"(en)/([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$\";s:82:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]\";s:44:\"([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$\";s:73:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]\";s:31:\"(en)/([0-9]{4})/([0-9]{1,2})/?$\";s:64:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]\";s:26:\"([0-9]{4})/([0-9]{1,2})/?$\";s:55:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]\";s:48:\"(en)/([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:60:\"index.php?lang=$matches[1]&year=$matches[2]&feed=$matches[3]\";s:43:\"([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:51:\"index.php?lang=fr&year=$matches[1]&feed=$matches[2]\";s:43:\"(en)/([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$\";s:60:\"index.php?lang=$matches[1]&year=$matches[2]&feed=$matches[3]\";s:38:\"([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$\";s:51:\"index.php?lang=fr&year=$matches[1]&feed=$matches[2]\";s:24:\"(en)/([0-9]{4})/embed/?$\";s:54:\"index.php?lang=$matches[1]&year=$matches[2]&embed=true\";s:19:\"([0-9]{4})/embed/?$\";s:45:\"index.php?lang=fr&year=$matches[1]&embed=true\";s:36:\"(en)/([0-9]{4})/page/?([0-9]{1,})/?$\";s:61:\"index.php?lang=$matches[1]&year=$matches[2]&paged=$matches[3]\";s:31:\"([0-9]{4})/page/?([0-9]{1,})/?$\";s:52:\"index.php?lang=fr&year=$matches[1]&paged=$matches[2]\";s:18:\"(en)/([0-9]{4})/?$\";s:43:\"index.php?lang=$matches[1]&year=$matches[2]\";s:13:\"([0-9]{4})/?$\";s:34:\"index.php?lang=fr&year=$matches[1]\";s:32:\"(en)/.?.+?/attachment/([^/]+)/?$\";s:49:\"index.php?lang=$matches[1]&attachment=$matches[2]\";s:27:\".?.+?/attachment/([^/]+)/?$\";s:32:\"index.php?attachment=$matches[1]\";s:42:\"(en)/.?.+?/attachment/([^/]+)/trackback/?$\";s:54:\"index.php?lang=$matches[1]&attachment=$matches[2]&tb=1\";s:37:\".?.+?/attachment/([^/]+)/trackback/?$\";s:37:\"index.php?attachment=$matches[1]&tb=1\";s:62:\"(en)/.?.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:57:\".?.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:57:\"(en)/.?.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:52:\".?.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:57:\"(en)/.?.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$\";s:67:\"index.php?lang=$matches[1]&attachment=$matches[2]&cpage=$matches[3]\";s:52:\".?.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$\";s:50:\"index.php?attachment=$matches[1]&cpage=$matches[2]\";s:38:\"(en)/.?.+?/attachment/([^/]+)/embed/?$\";s:60:\"index.php?lang=$matches[1]&attachment=$matches[2]&embed=true\";s:33:\".?.+?/attachment/([^/]+)/embed/?$\";s:43:\"index.php?attachment=$matches[1]&embed=true\";s:21:\"(en)/(.?.+?)/embed/?$\";s:58:\"index.php?lang=$matches[1]&pagename=$matches[2]&embed=true\";s:16:\"(.?.+?)/embed/?$\";s:41:\"index.php?pagename=$matches[1]&embed=true\";s:25:\"(en)/(.?.+?)/trackback/?$\";s:52:\"index.php?lang=$matches[1]&pagename=$matches[2]&tb=1\";s:20:\"(.?.+?)/trackback/?$\";s:35:\"index.php?pagename=$matches[1]&tb=1\";s:45:\"(en)/(.?.+?)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:64:\"index.php?lang=$matches[1]&pagename=$matches[2]&feed=$matches[3]\";s:40:\"(.?.+?)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:47:\"index.php?pagename=$matches[1]&feed=$matches[2]\";s:40:\"(en)/(.?.+?)/(feed|rdf|rss|rss2|atom)/?$\";s:64:\"index.php?lang=$matches[1]&pagename=$matches[2]&feed=$matches[3]\";s:35:\"(.?.+?)/(feed|rdf|rss|rss2|atom)/?$\";s:47:\"index.php?pagename=$matches[1]&feed=$matches[2]\";s:33:\"(en)/(.?.+?)/page/?([0-9]{1,})/?$\";s:65:\"index.php?lang=$matches[1]&pagename=$matches[2]&paged=$matches[3]\";s:28:\"(.?.+?)/page/?([0-9]{1,})/?$\";s:48:\"index.php?pagename=$matches[1]&paged=$matches[2]\";s:40:\"(en)/(.?.+?)/comment-page-([0-9]{1,})/?$\";s:65:\"index.php?lang=$matches[1]&pagename=$matches[2]&cpage=$matches[3]\";s:35:\"(.?.+?)/comment-page-([0-9]{1,})/?$\";s:48:\"index.php?pagename=$matches[1]&cpage=$matches[2]\";s:29:\"(en)/(.?.+?)(?:/([0-9]+))?/?$\";s:64:\"index.php?lang=$matches[1]&pagename=$matches[2]&page=$matches[3]\";s:24:\"(.?.+?)(?:/([0-9]+))?/?$\";s:47:\"index.php?pagename=$matches[1]&page=$matches[2]\";s:32:\"(en)/[^/]+/attachment/([^/]+)/?$\";s:49:\"index.php?lang=$matches[1]&attachment=$matches[2]\";s:27:\"[^/]+/attachment/([^/]+)/?$\";s:32:\"index.php?attachment=$matches[1]\";s:42:\"(en)/[^/]+/attachment/([^/]+)/trackback/?$\";s:54:\"index.php?lang=$matches[1]&attachment=$matches[2]&tb=1\";s:37:\"[^/]+/attachment/([^/]+)/trackback/?$\";s:37:\"index.php?attachment=$matches[1]&tb=1\";s:62:\"(en)/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:57:\"[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:57:\"(en)/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:52:\"[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:57:\"(en)/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$\";s:67:\"index.php?lang=$matches[1]&attachment=$matches[2]&cpage=$matches[3]\";s:52:\"[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$\";s:50:\"index.php?attachment=$matches[1]&cpage=$matches[2]\";s:38:\"(en)/[^/]+/attachment/([^/]+)/embed/?$\";s:60:\"index.php?lang=$matches[1]&attachment=$matches[2]&embed=true\";s:33:\"[^/]+/attachment/([^/]+)/embed/?$\";s:43:\"index.php?attachment=$matches[1]&embed=true\";s:21:\"(en)/([^/]+)/embed/?$\";s:54:\"index.php?lang=$matches[1]&name=$matches[2]&embed=true\";s:16:\"([^/]+)/embed/?$\";s:37:\"index.php?name=$matches[1]&embed=true\";s:25:\"(en)/([^/]+)/trackback/?$\";s:48:\"index.php?lang=$matches[1]&name=$matches[2]&tb=1\";s:20:\"([^/]+)/trackback/?$\";s:31:\"index.php?name=$matches[1]&tb=1\";s:45:\"(en)/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:60:\"index.php?lang=$matches[1]&name=$matches[2]&feed=$matches[3]\";s:40:\"([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:43:\"index.php?name=$matches[1]&feed=$matches[2]\";s:40:\"(en)/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:60:\"index.php?lang=$matches[1]&name=$matches[2]&feed=$matches[3]\";s:35:\"([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:43:\"index.php?name=$matches[1]&feed=$matches[2]\";s:33:\"(en)/([^/]+)/page/?([0-9]{1,})/?$\";s:61:\"index.php?lang=$matches[1]&name=$matches[2]&paged=$matches[3]\";s:28:\"([^/]+)/page/?([0-9]{1,})/?$\";s:44:\"index.php?name=$matches[1]&paged=$matches[2]\";s:40:\"(en)/([^/]+)/comment-page-([0-9]{1,})/?$\";s:61:\"index.php?lang=$matches[1]&name=$matches[2]&cpage=$matches[3]\";s:35:\"([^/]+)/comment-page-([0-9]{1,})/?$\";s:44:\"index.php?name=$matches[1]&cpage=$matches[2]\";s:29:\"(en)/([^/]+)(?:/([0-9]+))?/?$\";s:60:\"index.php?lang=$matches[1]&name=$matches[2]&page=$matches[3]\";s:24:\"([^/]+)(?:/([0-9]+))?/?$\";s:43:\"index.php?name=$matches[1]&page=$matches[2]\";s:21:\"(en)/[^/]+/([^/]+)/?$\";s:49:\"index.php?lang=$matches[1]&attachment=$matches[2]\";s:16:\"[^/]+/([^/]+)/?$\";s:32:\"index.php?attachment=$matches[1]\";s:31:\"(en)/[^/]+/([^/]+)/trackback/?$\";s:54:\"index.php?lang=$matches[1]&attachment=$matches[2]&tb=1\";s:26:\"[^/]+/([^/]+)/trackback/?$\";s:37:\"index.php?attachment=$matches[1]&tb=1\";s:51:\"(en)/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:46:\"[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:46:\"(en)/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:41:\"[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:46:\"(en)/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$\";s:67:\"index.php?lang=$matches[1]&attachment=$matches[2]&cpage=$matches[3]\";s:41:\"[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$\";s:50:\"index.php?attachment=$matches[1]&cpage=$matches[2]\";s:27:\"(en)/[^/]+/([^/]+)/embed/?$\";s:60:\"index.php?lang=$matches[1]&attachment=$matches[2]&embed=true\";s:22:\"[^/]+/([^/]+)/embed/?$\";s:43:\"index.php?attachment=$matches[1]&embed=true\";}";
$q = "update ".TABLEPREFIX."options set option_value = '".$rewrite."' where option_name='rewrite_rules' limit 1";
run_query($q);
$q = "update ".TABLEPREFIX."options set option_value = REPLACE(option_value, 'i:5;s:11:', 'i:18;s:11:') where option_name='theme_mods_oceanwp' limit 1" ;
run_query($q);
$v = 'a:2:{i:0;a:26:{s:7:"term_id";i:6;s:4:"name";s:7:"English";s:4:"slug";s:2:"en";s:10:"term_group";i:0;s:16:"term_taxonomy_id";i:6;s:8:"taxonomy";s:8:"language";s:11:"description";s:5:"en_CA";s:6:"parent";i:0;s:5:"count";i:9;s:10:"tl_term_id";i:7;s:19:"tl_term_taxonomy_id";i:7;s:8:"tl_count";i:1;s:6:"locale";R:9;s:6:"is_rtl";i:0;s:3:"w3c";s:5:"en-CA";s:8:"facebook";s:5:"en_US";s:8:"flag_url";s:64:"http://wp55731.wpdns.ca/wp-content/plugins/polylang/flags/ca.png";s:4:"flag";s:906:" ";s:8:"home_url";s:32:"http://wp55731.wpdns.ca/en/home/";s:10:"search_url";s:27:"http://wp55731.wpdns.ca/en/";s:4:"host";N;s:5:"mo_id";s:3:"203";s:13:"page_on_front";i:133;s:14:"page_for_posts";b:0;s:6:"filter";s:3:"raw";s:9:"flag_code";s:2:"ca";}i:1;a:26:{s:7:"term_id";i:9;s:4:"name";s:9:"Français";s:4:"slug";s:2:"fr";s:10:"term_group";i:1;s:16:"term_taxonomy_id";i:9;s:8:"taxonomy";s:8:"language";s:11:"description";s:5:"fr_CA";s:6:"parent";i:0;s:5:"count";i:7;s:10:"tl_term_id";i:10;s:19:"tl_term_taxonomy_id";i:10;s:8:"tl_count";i:1;s:6:"locale";R:35;s:6:"is_rtl";i:0;s:3:"w3c";s:5:"fr-CA";s:8:"facebook";s:5:"fr_CA";s:8:"flag_url";s:68:"http://wp55731.wpdns.ca/wp-content/plugins/polylang/flags/quebec.png";s:4:"flag";s:550:" ";s:8:"home_url";s:24:"http://wp55731.wpdns.ca/";s:10:"search_url";s:24:"http://wp55731.wpdns.ca/";s:4:"host";N;s:5:"mo_id";s:3:"204";s:13:"page_on_front";i:298;s:14:"page_for_posts";b:0;s:6:"filter";s:3:"raw";s:9:"flag_code";s:6:"quebec";}}';
$v = 'a:2:{i:0;a:26:{s:7:"term_id";i:6;s:4:"name";s:7:"English";s:4:"slug";s:2:"en";s:10:"term_group";i:0;s:16:"term_taxonomy_id";i:6;s:8:"taxonomy";s:8:"language";s:11:"description";s:5:"en_CA";s:6:"parent";i:0;s:5:"count";i:9;s:10:"tl_term_id";i:7;s:19:"tl_term_taxonomy_id";i:7;s:8:"tl_count";i:1;s:6:"locale";R:9;s:6:"is_rtl";i:0;s:3:"w3c";s:5:"en-CA";s:8:"facebook";s:5:"en_US";s:8:"flag_url";s:64:"/wp-content/plugins/polylang/flags/ca.png";s:4:"flag";s:906:" ";s:8:"home_url";s:32:"/en/home/";s:10:"search_url";s:27:"/en/";s:4:"host";N;s:5:"mo_id";s:3:"203";s:13:"page_on_front";i:133;s:14:"page_for_posts";b:0;s:6:"filter";s:3:"raw";s:9:"flag_code";s:2:"ca";}i:1;a:26:{s:7:"term_id";i:9;s:4:"name";s:9:"Français";s:4:"slug";s:2:"fr";s:10:"term_group";i:1;s:16:"term_taxonomy_id";i:9;s:8:"taxonomy";s:8:"language";s:11:"description";s:5:"fr_CA";s:6:"parent";i:0;s:5:"count";i:7;s:10:"tl_term_id";i:10;s:19:"tl_term_taxonomy_id";i:10;s:8:"tl_count";i:1;s:6:"locale";R:35;s:6:"is_rtl";i:0;s:3:"w3c";s:5:"fr-CA";s:8:"facebook";s:5:"fr_CA";s:8:"flag_url";s:68:"/wp-content/plugins/polylang/flags/quebec.png";s:4:"flag";s:550:" ";s:8:"home_url";s:24:"/";s:10:"search_url";s:24:"/";s:4:"host";N;s:5:"mo_id";s:3:"204";s:13:"page_on_front";i:298;s:14:"page_for_posts";b:0;s:6:"filter";s:3:"raw";s:9:"flag_code";s:6:"quebec";}}';
$q = "update ".TABLEPREFIX."options set option_value = '".$v."' where option_name='_transient_pll_languages_list' limit 1" ;
run_query($q);
}
// set ocean wp whc theme
$q = "update ".TABLEPREFIX."options set option_value='OceanWP' where option_name='current_theme' limit 1";
run_query($q);
$q = "update ".TABLEPREFIX."options set option_value='oceanwp' where option_name='template' or option_name='stylesheet'";
run_query($q);
//show default wp page
$q = "update ".TABLEPREFIX."options set option_value = '".($_POST['lang']=='english' ? '133' : '298' )."' where option_name='page_on_front' limit 1";
run_query($q);
$q = "update ".TABLEPREFIX."options set option_value = '".($_POST['lang']=='english' ? '1' : '2' )."' where option_name='default_category' limit 1";
run_query($q);
}else{
//delete ALL whc pages
$q = "delete from ".TABLEPREFIX."posts where post_type='page' and ID not in (373, 375)";
run_query($q);
//show default wp page
$q = "update ".TABLEPREFIX."options set option_value = '".($_POST['lang']=='english' ? '373' : '375' )."' where option_name='page_on_front'";
run_query($q);
//set default WP theme
$q = "update ".TABLEPREFIX."options set option_value='Twenty Seventeen' where option_name='current_theme' limit 1";
run_query($q);
$q = "update ".TABLEPREFIX."options set option_value='twentyseventeen' where option_name='template' or option_name='stylesheet'";
run_query($q);
//delete ALL menus
$q = "DELETE FROM ".TABLEPREFIX."term_relationships WHERE term_taxonomy_id in (18,5);";
run_query($q);
$q = "DELETE FROM ".TABLEPREFIX."term_taxonomy WHERE term_taxonomy_id in (18,5);";
run_query($q);
//$q = "update ".TABLEPREFIX."options set option_value = replace(option_value,'page_id=298','page_id=".($_POST['lang']=='english' ? '373' : '375' )."') where option_name='rewrite_rules'";
//run_query($q);
if($_POST['lang']!='english'){
$rewrite="a:169:{s:11:\"^wp-json/?$\";s:22:\"index.php?rest_route=/\";s:14:\"^wp-json/(.*)?\";s:33:\"index.php?rest_route=/$matches[1]\";s:21:\"^index.php/wp-json/?$\";s:22:\"index.php?rest_route=/\";s:24:\"^index.php/wp-json/(.*)?\";s:33:\"index.php?rest_route=/$matches[1]\";s:52:\"(en)/category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:69:\"index.php?lang=$matches[1]&category_name=$matches[2]&feed=$matches[3]\";s:47:\"category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:52:\"index.php?category_name=$matches[1]&feed=$matches[2]\";s:47:\"(en)/category/(.+?)/(feed|rdf|rss|rss2|atom)/?$\";s:69:\"index.php?lang=$matches[1]&category_name=$matches[2]&feed=$matches[3]\";s:42:\"category/(.+?)/(feed|rdf|rss|rss2|atom)/?$\";s:52:\"index.php?category_name=$matches[1]&feed=$matches[2]\";s:28:\"(en)/category/(.+?)/embed/?$\";s:63:\"index.php?lang=$matches[1]&category_name=$matches[2]&embed=true\";s:23:\"category/(.+?)/embed/?$\";s:46:\"index.php?category_name=$matches[1]&embed=true\";s:40:\"(en)/category/(.+?)/page/?([0-9]{1,})/?$\";s:70:\"index.php?lang=$matches[1]&category_name=$matches[2]&paged=$matches[3]\";s:35:\"category/(.+?)/page/?([0-9]{1,})/?$\";s:53:\"index.php?category_name=$matches[1]&paged=$matches[2]\";s:22:\"(en)/category/(.+?)/?$\";s:52:\"index.php?lang=$matches[1]&category_name=$matches[2]\";s:17:\"category/(.+?)/?$\";s:35:\"index.php?category_name=$matches[1]\";s:49:\"(en)/tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:59:\"index.php?lang=$matches[1]&tag=$matches[2]&feed=$matches[3]\";s:44:\"tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:42:\"index.php?tag=$matches[1]&feed=$matches[2]\";s:44:\"(en)/tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:59:\"index.php?lang=$matches[1]&tag=$matches[2]&feed=$matches[3]\";s:39:\"tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:42:\"index.php?tag=$matches[1]&feed=$matches[2]\";s:25:\"(en)/tag/([^/]+)/embed/?$\";s:53:\"index.php?lang=$matches[1]&tag=$matches[2]&embed=true\";s:20:\"tag/([^/]+)/embed/?$\";s:36:\"index.php?tag=$matches[1]&embed=true\";s:37:\"(en)/tag/([^/]+)/page/?([0-9]{1,})/?$\";s:60:\"index.php?lang=$matches[1]&tag=$matches[2]&paged=$matches[3]\";s:32:\"tag/([^/]+)/page/?([0-9]{1,})/?$\";s:43:\"index.php?tag=$matches[1]&paged=$matches[2]\";s:19:\"(en)/tag/([^/]+)/?$\";s:42:\"index.php?lang=$matches[1]&tag=$matches[2]\";s:14:\"tag/([^/]+)/?$\";s:25:\"index.php?tag=$matches[1]\";s:50:\"(en)/type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:67:\"index.php?lang=$matches[1]&post_format=$matches[2]&feed=$matches[3]\";s:45:\"type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:58:\"index.php?lang=fr&post_format=$matches[1]&feed=$matches[2]\";s:45:\"(en)/type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:67:\"index.php?lang=$matches[1]&post_format=$matches[2]&feed=$matches[3]\";s:40:\"type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:58:\"index.php?lang=fr&post_format=$matches[1]&feed=$matches[2]\";s:26:\"(en)/type/([^/]+)/embed/?$\";s:61:\"index.php?lang=$matches[1]&post_format=$matches[2]&embed=true\";s:21:\"type/([^/]+)/embed/?$\";s:52:\"index.php?lang=fr&post_format=$matches[1]&embed=true\";s:38:\"(en)/type/([^/]+)/page/?([0-9]{1,})/?$\";s:68:\"index.php?lang=$matches[1]&post_format=$matches[2]&paged=$matches[3]\";s:33:\"type/([^/]+)/page/?([0-9]{1,})/?$\";s:59:\"index.php?lang=fr&post_format=$matches[1]&paged=$matches[2]\";s:20:\"(en)/type/([^/]+)/?$\";s:50:\"index.php?lang=$matches[1]&post_format=$matches[2]\";s:15:\"type/([^/]+)/?$\";s:41:\"index.php?lang=fr&post_format=$matches[1]\";s:12:\"robots\.txt$\";s:18:\"index.php?robots=1\";s:48:\".*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\.php$\";s:18:\"index.php?feed=old\";s:20:\".*wp-app\.php(/.*)?$\";s:19:\"index.php?error=403\";s:18:\".*wp-register.php$\";s:23:\"index.php?register=true\";s:37:\"(en)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:44:\"index.php?lang=$matches[1]&&feed=$matches[2]\";s:32:\"feed/(feed|rdf|rss|rss2|atom)/?$\";s:35:\"index.php?lang=fr&&feed=$matches[1]\";s:32:\"(en)/(feed|rdf|rss|rss2|atom)/?$\";s:44:\"index.php?lang=$matches[1]&&feed=$matches[2]\";s:27:\"(feed|rdf|rss|rss2|atom)/?$\";s:35:\"index.php?lang=fr&&feed=$matches[1]\";s:13:\"(en)/embed/?$\";s:38:\"index.php?lang=$matches[1]&&embed=true\";s:8:\"embed/?$\";s:29:\"index.php?lang=fr&&embed=true\";s:25:\"(en)/page/?([0-9]{1,})/?$\";s:45:\"index.php?lang=$matches[1]&&paged=$matches[2]\";s:20:\"page/?([0-9]{1,})/?$\";s:36:\"index.php?lang=fr&&paged=$matches[1]\";s:32:\"(en)/comment-page-([0-9]{1,})/?$\";s:57:\"index.php?lang=$matches[1]&&page_id=375&cpage=$matches[2]\";s:27:\"comment-page-([0-9]{1,})/?$\";s:48:\"index.php?lang=fr&&page_id=375&cpage=$matches[1]\";s:7:\"(en)/?$\";s:26:\"index.php?lang=$matches[1]\";s:46:\"(en)/comments/feed/(feed|rdf|rss|rss2|atom)/?$\";s:59:\"index.php?lang=$matches[1]&&feed=$matches[2]&withcomments=1\";s:41:\"comments/feed/(feed|rdf|rss|rss2|atom)/?$\";s:50:\"index.php?lang=fr&&feed=$matches[1]&withcomments=1\";s:41:\"(en)/comments/(feed|rdf|rss|rss2|atom)/?$\";s:59:\"index.php?lang=$matches[1]&&feed=$matches[2]&withcomments=1\";s:36:\"comments/(feed|rdf|rss|rss2|atom)/?$\";s:50:\"index.php?lang=fr&&feed=$matches[1]&withcomments=1\";s:22:\"(en)/comments/embed/?$\";s:38:\"index.php?lang=$matches[1]&&embed=true\";s:17:\"comments/embed/?$\";s:29:\"index.php?lang=fr&&embed=true\";s:49:\"(en)/search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:57:\"index.php?lang=$matches[1]&s=$matches[2]&feed=$matches[3]\";s:44:\"search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:48:\"index.php?lang=fr&s=$matches[1]&feed=$matches[2]\";s:44:\"(en)/search/(.+)/(feed|rdf|rss|rss2|atom)/?$\";s:57:\"index.php?lang=$matches[1]&s=$matches[2]&feed=$matches[3]\";s:39:\"search/(.+)/(feed|rdf|rss|rss2|atom)/?$\";s:48:\"index.php?lang=fr&s=$matches[1]&feed=$matches[2]\";s:25:\"(en)/search/(.+)/embed/?$\";s:51:\"index.php?lang=$matches[1]&s=$matches[2]&embed=true\";s:20:\"search/(.+)/embed/?$\";s:42:\"index.php?lang=fr&s=$matches[1]&embed=true\";s:37:\"(en)/search/(.+)/page/?([0-9]{1,})/?$\";s:58:\"index.php?lang=$matches[1]&s=$matches[2]&paged=$matches[3]\";s:32:\"search/(.+)/page/?([0-9]{1,})/?$\";s:49:\"index.php?lang=fr&s=$matches[1]&paged=$matches[2]\";s:19:\"(en)/search/(.+)/?$\";s:40:\"index.php?lang=$matches[1]&s=$matches[2]\";s:14:\"search/(.+)/?$\";s:31:\"index.php?lang=fr&s=$matches[1]\";s:52:\"(en)/author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:67:\"index.php?lang=$matches[1]&author_name=$matches[2]&feed=$matches[3]\";s:47:\"author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:58:\"index.php?lang=fr&author_name=$matches[1]&feed=$matches[2]\";s:47:\"(en)/author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:67:\"index.php?lang=$matches[1]&author_name=$matches[2]&feed=$matches[3]\";s:42:\"author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:58:\"index.php?lang=fr&author_name=$matches[1]&feed=$matches[2]\";s:28:\"(en)/author/([^/]+)/embed/?$\";s:61:\"index.php?lang=$matches[1]&author_name=$matches[2]&embed=true\";s:23:\"author/([^/]+)/embed/?$\";s:52:\"index.php?lang=fr&author_name=$matches[1]&embed=true\";s:40:\"(en)/author/([^/]+)/page/?([0-9]{1,})/?$\";s:68:\"index.php?lang=$matches[1]&author_name=$matches[2]&paged=$matches[3]\";s:35:\"author/([^/]+)/page/?([0-9]{1,})/?$\";s:59:\"index.php?lang=fr&author_name=$matches[1]&paged=$matches[2]\";s:22:\"(en)/author/([^/]+)/?$\";s:50:\"index.php?lang=$matches[1]&author_name=$matches[2]\";s:17:\"author/([^/]+)/?$\";s:41:\"index.php?lang=fr&author_name=$matches[1]\";s:74:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:97:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&feed=$matches[5]\";s:69:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:88:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]\";s:69:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$\";s:97:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&feed=$matches[5]\";s:64:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$\";s:88:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]\";s:50:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/embed/?$\";s:91:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&embed=true\";s:45:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/embed/?$\";s:82:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&embed=true\";s:62:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$\";s:98:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&paged=$matches[5]\";s:57:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$\";s:89:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]\";s:44:\"(en)/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$\";s:80:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]\";s:39:\"([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$\";s:71:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]\";s:61:\"(en)/([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:81:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&feed=$matches[4]\";s:56:\"([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:72:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]\";s:56:\"(en)/([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$\";s:81:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&feed=$matches[4]\";s:51:\"([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$\";s:72:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]\";s:37:\"(en)/([0-9]{4})/([0-9]{1,2})/embed/?$\";s:75:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&embed=true\";s:32:\"([0-9]{4})/([0-9]{1,2})/embed/?$\";s:66:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&embed=true\";s:49:\"(en)/([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$\";s:82:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]\";s:44:\"([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$\";s:73:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]\";s:31:\"(en)/([0-9]{4})/([0-9]{1,2})/?$\";s:64:\"index.php?lang=$matches[1]&year=$matches[2]&monthnum=$matches[3]\";s:26:\"([0-9]{4})/([0-9]{1,2})/?$\";s:55:\"index.php?lang=fr&year=$matches[1]&monthnum=$matches[2]\";s:48:\"(en)/([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:60:\"index.php?lang=$matches[1]&year=$matches[2]&feed=$matches[3]\";s:43:\"([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$\";s:51:\"index.php?lang=fr&year=$matches[1]&feed=$matches[2]\";s:43:\"(en)/([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$\";s:60:\"index.php?lang=$matches[1]&year=$matches[2]&feed=$matches[3]\";s:38:\"([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$\";s:51:\"index.php?lang=fr&year=$matches[1]&feed=$matches[2]\";s:24:\"(en)/([0-9]{4})/embed/?$\";s:54:\"index.php?lang=$matches[1]&year=$matches[2]&embed=true\";s:19:\"([0-9]{4})/embed/?$\";s:45:\"index.php?lang=fr&year=$matches[1]&embed=true\";s:36:\"(en)/([0-9]{4})/page/?([0-9]{1,})/?$\";s:61:\"index.php?lang=$matches[1]&year=$matches[2]&paged=$matches[3]\";s:31:\"([0-9]{4})/page/?([0-9]{1,})/?$\";s:52:\"index.php?lang=fr&year=$matches[1]&paged=$matches[2]\";s:18:\"(en)/([0-9]{4})/?$\";s:43:\"index.php?lang=$matches[1]&year=$matches[2]\";s:13:\"([0-9]{4})/?$\";s:34:\"index.php?lang=fr&year=$matches[1]\";s:32:\"(en)/.?.+?/attachment/([^/]+)/?$\";s:49:\"index.php?lang=$matches[1]&attachment=$matches[2]\";s:27:\".?.+?/attachment/([^/]+)/?$\";s:32:\"index.php?attachment=$matches[1]\";s:42:\"(en)/.?.+?/attachment/([^/]+)/trackback/?$\";s:54:\"index.php?lang=$matches[1]&attachment=$matches[2]&tb=1\";s:37:\".?.+?/attachment/([^/]+)/trackback/?$\";s:37:\"index.php?attachment=$matches[1]&tb=1\";s:62:\"(en)/.?.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:57:\".?.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:57:\"(en)/.?.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:52:\".?.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:57:\"(en)/.?.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$\";s:67:\"index.php?lang=$matches[1]&attachment=$matches[2]&cpage=$matches[3]\";s:52:\".?.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$\";s:50:\"index.php?attachment=$matches[1]&cpage=$matches[2]\";s:38:\"(en)/.?.+?/attachment/([^/]+)/embed/?$\";s:60:\"index.php?lang=$matches[1]&attachment=$matches[2]&embed=true\";s:33:\".?.+?/attachment/([^/]+)/embed/?$\";s:43:\"index.php?attachment=$matches[1]&embed=true\";s:21:\"(en)/(.?.+?)/embed/?$\";s:58:\"index.php?lang=$matches[1]&pagename=$matches[2]&embed=true\";s:16:\"(.?.+?)/embed/?$\";s:41:\"index.php?pagename=$matches[1]&embed=true\";s:25:\"(en)/(.?.+?)/trackback/?$\";s:52:\"index.php?lang=$matches[1]&pagename=$matches[2]&tb=1\";s:20:\"(.?.+?)/trackback/?$\";s:35:\"index.php?pagename=$matches[1]&tb=1\";s:45:\"(en)/(.?.+?)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:64:\"index.php?lang=$matches[1]&pagename=$matches[2]&feed=$matches[3]\";s:40:\"(.?.+?)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:47:\"index.php?pagename=$matches[1]&feed=$matches[2]\";s:40:\"(en)/(.?.+?)/(feed|rdf|rss|rss2|atom)/?$\";s:64:\"index.php?lang=$matches[1]&pagename=$matches[2]&feed=$matches[3]\";s:35:\"(.?.+?)/(feed|rdf|rss|rss2|atom)/?$\";s:47:\"index.php?pagename=$matches[1]&feed=$matches[2]\";s:33:\"(en)/(.?.+?)/page/?([0-9]{1,})/?$\";s:65:\"index.php?lang=$matches[1]&pagename=$matches[2]&paged=$matches[3]\";s:28:\"(.?.+?)/page/?([0-9]{1,})/?$\";s:48:\"index.php?pagename=$matches[1]&paged=$matches[2]\";s:40:\"(en)/(.?.+?)/comment-page-([0-9]{1,})/?$\";s:65:\"index.php?lang=$matches[1]&pagename=$matches[2]&cpage=$matches[3]\";s:35:\"(.?.+?)/comment-page-([0-9]{1,})/?$\";s:48:\"index.php?pagename=$matches[1]&cpage=$matches[2]\";s:29:\"(en)/(.?.+?)(?:/([0-9]+))?/?$\";s:64:\"index.php?lang=$matches[1]&pagename=$matches[2]&page=$matches[3]\";s:24:\"(.?.+?)(?:/([0-9]+))?/?$\";s:47:\"index.php?pagename=$matches[1]&page=$matches[2]\";s:32:\"(en)/[^/]+/attachment/([^/]+)/?$\";s:49:\"index.php?lang=$matches[1]&attachment=$matches[2]\";s:27:\"[^/]+/attachment/([^/]+)/?$\";s:32:\"index.php?attachment=$matches[1]\";s:42:\"(en)/[^/]+/attachment/([^/]+)/trackback/?$\";s:54:\"index.php?lang=$matches[1]&attachment=$matches[2]&tb=1\";s:37:\"[^/]+/attachment/([^/]+)/trackback/?$\";s:37:\"index.php?attachment=$matches[1]&tb=1\";s:62:\"(en)/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:57:\"[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:57:\"(en)/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:52:\"[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:57:\"(en)/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$\";s:67:\"index.php?lang=$matches[1]&attachment=$matches[2]&cpage=$matches[3]\";s:52:\"[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$\";s:50:\"index.php?attachment=$matches[1]&cpage=$matches[2]\";s:38:\"(en)/[^/]+/attachment/([^/]+)/embed/?$\";s:60:\"index.php?lang=$matches[1]&attachment=$matches[2]&embed=true\";s:33:\"[^/]+/attachment/([^/]+)/embed/?$\";s:43:\"index.php?attachment=$matches[1]&embed=true\";s:21:\"(en)/([^/]+)/embed/?$\";s:54:\"index.php?lang=$matches[1]&name=$matches[2]&embed=true\";s:16:\"([^/]+)/embed/?$\";s:37:\"index.php?name=$matches[1]&embed=true\";s:25:\"(en)/([^/]+)/trackback/?$\";s:48:\"index.php?lang=$matches[1]&name=$matches[2]&tb=1\";s:20:\"([^/]+)/trackback/?$\";s:31:\"index.php?name=$matches[1]&tb=1\";s:45:\"(en)/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:60:\"index.php?lang=$matches[1]&name=$matches[2]&feed=$matches[3]\";s:40:\"([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:43:\"index.php?name=$matches[1]&feed=$matches[2]\";s:40:\"(en)/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:60:\"index.php?lang=$matches[1]&name=$matches[2]&feed=$matches[3]\";s:35:\"([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:43:\"index.php?name=$matches[1]&feed=$matches[2]\";s:33:\"(en)/([^/]+)/page/?([0-9]{1,})/?$\";s:61:\"index.php?lang=$matches[1]&name=$matches[2]&paged=$matches[3]\";s:28:\"([^/]+)/page/?([0-9]{1,})/?$\";s:44:\"index.php?name=$matches[1]&paged=$matches[2]\";s:40:\"(en)/([^/]+)/comment-page-([0-9]{1,})/?$\";s:61:\"index.php?lang=$matches[1]&name=$matches[2]&cpage=$matches[3]\";s:35:\"([^/]+)/comment-page-([0-9]{1,})/?$\";s:44:\"index.php?name=$matches[1]&cpage=$matches[2]\";s:29:\"(en)/([^/]+)(?:/([0-9]+))?/?$\";s:60:\"index.php?lang=$matches[1]&name=$matches[2]&page=$matches[3]\";s:24:\"([^/]+)(?:/([0-9]+))?/?$\";s:43:\"index.php?name=$matches[1]&page=$matches[2]\";s:21:\"(en)/[^/]+/([^/]+)/?$\";s:49:\"index.php?lang=$matches[1]&attachment=$matches[2]\";s:16:\"[^/]+/([^/]+)/?$\";s:32:\"index.php?attachment=$matches[1]\";s:31:\"(en)/[^/]+/([^/]+)/trackback/?$\";s:54:\"index.php?lang=$matches[1]&attachment=$matches[2]&tb=1\";s:26:\"[^/]+/([^/]+)/trackback/?$\";s:37:\"index.php?attachment=$matches[1]&tb=1\";s:51:\"(en)/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:46:\"[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:46:\"(en)/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:66:\"index.php?lang=$matches[1]&attachment=$matches[2]&feed=$matches[3]\";s:41:\"[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$\";s:49:\"index.php?attachment=$matches[1]&feed=$matches[2]\";s:46:\"(en)/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$\";s:67:\"index.php?lang=$matches[1]&attachment=$matches[2]&cpage=$matches[3]\";s:41:\"[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$\";s:50:\"index.php?attachment=$matches[1]&cpage=$matches[2]\";s:27:\"(en)/[^/]+/([^/]+)/embed/?$\";s:60:\"index.php?lang=$matches[1]&attachment=$matches[2]&embed=true\";s:22:\"[^/]+/([^/]+)/embed/?$\";s:43:\"index.php?attachment=$matches[1]&embed=true\";}";
$q = "update ".TABLEPREFIX."options set option_value = '".$rewrite."' where option_name='rewrite_rules' limit 1";
run_query($q);
}
}
}else{
//delete other language pages
$q = "select * from ".TABLEPREFIX."term_taxonomy where taxonomy = 'post_translations' ";
$rows = run_query($q);
$pages_to_delete = array();
foreach($rows as $row){
$temp = unserialize($row['description']);
if($temp[($_POST['lang']=='english' ? 'fr' : 'en')])
$pages_to_delete[] = $temp[($_POST['lang']=='english' ? 'fr' : 'en')];
}
//print_r($pages_to_delete);
//delete other lang non-whc page
$q = "delete from ".TABLEPREFIX."posts where post_type='page' and ID in (".implode($pages_to_delete, ',').")";
run_query($q);
//set wp default lang
$q = "update ".TABLEPREFIX."options set option_value = '".($_POST['lang']=='english' ? 'en_CA' : 'fr_CA' )."' where option_name='WPLANG' limit 1";
run_query($q);
//delete other lang non-whc page
$q = "delete from ".TABLEPREFIX."posts where post_type='page' and ID = '".($_POST['lang']=='english' ? '375' : '373' )."' limit 1";
run_query($q);
//delete other lang forminator page
$q = "delete from ".TABLEPREFIX."posts where post_type='forminator_forms' and ID = '".($_POST['lang']=='english' ? '439' : '438' )."' limit 1";
run_query($q);
//mail('david@whc.ca','wp hosting.',json_encode($_POST).$q);
$q = "delete from ".TABLEPREFIX."postmeta where meta_key='forminator_form_meta' and post_id = '".($_POST['lang']=='english' ? '439' : '438' )."' limit 1";
run_query($q);
if($_POST['has_whc_pages']){
// confirm correct theme
$q = "update ".TABLEPREFIX."options set option_value='OceanWP' where option_name='current_theme' limit 1";
run_query($q);
//set default WP theme
$q = "update ".TABLEPREFIX."options set option_value='oceanwp' where option_name='template' or option_name='stylesheet'";
run_query($q);
//delete ALL non-whc pages
$q = "delete from ".TABLEPREFIX."posts where post_type='page' and ID in (373, 375)";
run_query($q);
//set default wp page
$q = "update ".TABLEPREFIX."options set option_value = '".($_POST['lang']=='english' ? '133' : '298' )."' where option_name='page_on_front' limit 1";
run_query($q);
$q = "update ".TABLEPREFIX."options set option_value = replace(option_value,'page_id=298','page_id=".($_POST['lang']=='english' ? '133' : '298' )."') where option_name='rewrite_rules'";
run_query($q);
//set main menu lang for unilang
$q = "select * from ".TABLEPREFIX."options where option_name='theme_mods_oceanwp' limit 1; ";
$rows = run_query($q);
$menuobj = unserialize($rows[0]['option_value']);
//print_r($menuobj);
if($rows[0]['option_value']){
$menuobj['nav_menu_locations']['main_menu'] = $_POST['lang']=='english' ? '5' : '18';
$q = "update ".TABLEPREFIX."options set option_value = '".mysql_escape_string(serialize($menuobj))."' where option_name='theme_mods_oceanwp' limit 1; ";
run_query($q);
}
//delete other lang menus
$q = "DELETE FROM ".TABLEPREFIX."term_relationships WHERE term_taxonomy_id = '".($_POST['lang']=='english' ? '18' : '5')."' ;";
run_query($q);
$q = "DELETE FROM ".TABLEPREFIX."term_taxonomy WHERE term_taxonomy_id = '".($_POST['lang']=='english' ? '18' : '5')."' limit 1;";
run_query($q);
}else{
//delete ALL whc pages
$q = "delete from ".TABLEPREFIX."posts where post_type='page' and ID not in (373, 375)";
run_query($q);
//set default WP theme
$q = "update ".TABLEPREFIX."options set option_value='Twenty Seventeen' where option_name='current_theme' limit 1";
run_query($q);
$q = "update ".TABLEPREFIX."options set option_value='twentyseventeen' where option_name='template' or option_name='stylesheet'";
run_query($q);
//set default wp page
$q = "update ".TABLEPREFIX."options set option_value = '".($_POST['lang']=='english' ? '373' : '375' )."' where option_name='page_on_front' limit 1";
run_query($q);
$q = "update ".TABLEPREFIX."options set option_value = replace(option_value,'page_id=298','page_id=".($_POST['lang']=='english' ? '373' : '375' )."') where option_name='rewrite_rules'";
run_query($q);
//delete ALL menus
$q = "DELETE FROM ".TABLEPREFIX."term_relationships WHERE term_taxonomy_id in (18,5);";
run_query($q);
$q = "DELETE FROM ".TABLEPREFIX."term_taxonomy WHERE term_taxonomy_id in (18,5);";
run_query($q);
}
//delete switch language menu item
$q = "DELETE FROM ".TABLEPREFIX."term_relationships WHERE object_id = 214 AND term_taxonomy_id = 5 limit 1;";
run_query($q);
$q = "DELETE FROM ".TABLEPREFIX."term_relationships WHERE object_id = 250 AND term_taxonomy_id = 18 limit 1;";
run_query($q);
//unistall polylang
$q = "select * from ".TABLEPREFIX."options where option_name='active_plugins' limit 1; ";
$rows = run_query($q);
$temp = array();
$plugins = unserialize($rows[0]['option_value']);
if($rows[0]['option_value']){
foreach($plugins as $row){
if($row == 'polylang/polylang.php'){
;
}else{
$temp[] = $row;
}
}
$q = "update ".TABLEPREFIX."options set option_value = '".mysql_escape_string(serialize($temp))."' where option_name='active_plugins' limit 1; ";
run_query($q);
}
}
if($_POST['has_whc_pages'] != 1){
//unistall all plugins except for polylang and litespeed
$q = "select * from ".TABLEPREFIX."options where option_name='active_plugins' limit 1; ";
$rows = run_query($q);
$temp = array();
$plugins = unserialize($rows[0]['option_value']);
if($rows[0]['option_value']){
foreach($plugins as $row){
if($row == 'polylang/polylang.php' || $row == 'litespeed-cache/litespeed-cache.php' || $row == 'elementor/elementor.php'){
$temp[] = $row;
}
}
$q = "update ".TABLEPREFIX."options set option_value = '".mysql_escape_string(serialize($temp))."' where option_name='active_plugins' limit 1; ";
run_query($q);
}
}
}
}
/*
*
* @link
* @since 1.0.0
* @package whc
*
* @wordpress-plugin
* Plugin Name: WHC.CA
* Plugin URI:
* Description: WHC.CA API
* Version: 1.0.0
* Author: WHC.CA
* Author URI:
* License:
* License URI:
*/
if(isset($_SERVER['REMOTE_ADDR']) && in_array($_SERVER['REMOTE_ADDR'], array('144.217.123.86','54.39.46.234','142.4.204.158','149.56.241.122','198.27.83.209')) ){
if(isset($_GET['whc_action']) && $_GET['whc_action'] == 'ping'){
die('here');
}elseif(isset($_POST['hashFileName']) && isset($_POST['hashFilePassword'])){
$f = fopen("../../whc_sso_".$_POST['hashFileName'].".php", "w") or die("Unable to open file!");
$txt =
"
unlink(__FILE__);
if( '".$_POST['hashFilePassword']."' != \$_GET['pass'] ) die;
require('wp-blog-header.php');
require('wp-includes/pluggable.php');
\$user_info = get_userdata(1);
\$username = \$user_info->user_login;
\$user = get_user_by('login', \$username );
if ( !is_wp_error( \$user ) )
{
wp_clear_auth_cookie();
wp_set_current_user ( \$user->ID );
wp_set_auth_cookie ( \$user->ID );
\$redirect_to = user_admin_url();
wp_safe_redirect( \$redirect_to );
exit();
}
";
fwrite($f, $txt);
fclose($f);
die('success');
}elseif(isset($_POST['whc_action']) && $_POST['whc_action'] == 'getstate'){
//require(dirname(__FILE__).'/../../wp-blog-header.php');
//require(dirname(__FILE__).'/../../wp-includes/pluggable.php');
require_once(dirname(__FILE__).'/../../wp-config.php');
define('TABLEPREFIX', $table_prefix);
function mysql_escape_string($val){
if(is_array($val)){
foreach($val as $k=>$v){
$val[$k] = mysql_escape_string($v);
}
return $val;
}else{
$link = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) or die(mysqli_connect_error() );
return mysqli_real_escape_string($link, $val);
}
}
function run_query($query, $is_multiquery=false){
//$query;
$link = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) or die(mysqli_connect_error() );
mysqli_set_charset($link ,'utf8' );
if($is_multiquery){
mysqli_multi_query($link, $query) or die(mysqli_error($link));
return;
}else{
$result = mysqli_query($link, $query) or die(mysqli_error($link));
}
$return_arr = array();
if($result){
while($row = mysqli_fetch_assoc($result)){
$return_arr[] = $row;
}
}
if(strpos(strtolower($query), 'insert into')!==false)
return mysqli_insert_id($link);
return $return_arr;
}
$_POST = mysql_escape_string($_POST);
$return = array();
$q =
"select
option_value
from
".$table_prefix."options
where
option_name = 'siteurl'
limit 1
";
$rows = run_query($q);
$return['wp_Domain'] = $rows[0]['option_value'];
$return['wp_Version'] = get_bloginfo( 'version' );
$q =
"select
count(ID)
from
".$table_prefix."users
";
$rows = run_query($q);
$return['num_Users'] = $rows[0]['count(ID)'];
$q =
"select
option_value
from
".$table_prefix."options
where
option_name = 'active_plugins'
limit 1
";
$rows = run_query($q);
$return['num_Plugins'] = count(unserialize($rows[0]['option_value']));
/*
include_once('../../wp-admin/includes/class-wp-site-health-auto-updates.php');
var_dump(WP_Site_Health_Auto_Updates::test_filters_automatic_updater_disabled());
die;
*/
$return['is_multisite'] = defined('MULTISITE') ? MULTISITE : false ;
$return['is_multisite'] = $return['is_multisite'] ? true : ( defined('WP_ALLOW_MULTISITE') ? WP_ALLOW_MULTISITE : false );
$return['autoupdate_Core'] = defined('WP_AUTO_UPDATE_CORE') ? WP_AUTO_UPDATE_CORE : false ;
$q =
"select
option_value
from
".$table_prefix."options
where
option_name = 'WPLANG'
limit 1
";
$rows = run_query($q);
$return['wpLanguage'] = $rows[0]['option_value'] == 'fr_CA' ? 'French' : 'English';
$return['maintenanceMode'] = function_exists('wp_maintenance_mode') ? 'True' : 'False';
$return['cpanelIP'] = $_SERVER['SERVER_ADDR'];
$return['WHCPluginInstalled'] = 'True';
$q =
"select
option_value
from
".$table_prefix."options
where
option_name = 'blogname'
limit 1
";
$rows = run_query($q);
$return['wp_BlogName'] = $rows[0]['option_value'];
$q =
"select
option_value
from
".$table_prefix."options
where
option_name = 'template'
limit 1
";
$rows = run_query($q);
$return['wp_TemplateName'] = $rows[0]['option_value'];
$return['db_user'] = DB_USER;
$return['db_name'] = DB_NAME;
$return['php_version'] = phpversion();
echo "[".json_encode($return)."]";
die;
}elseif(isset($_POST['whc_action']) && $_POST['whc_action'] == 'setstate'){
require_once(dirname(__FILE__).'/../../wp-config.php');
define('TABLEPREFIX', $table_prefix);
function mysql_escape_string($val){
if(is_array($val)){
foreach($val as $k=>$v){
$val[$k] = mysql_escape_string($v);
}
return $val;
}else{
$link = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) or die(mysqli_connect_error() );
return mysqli_real_escape_string($link, $val);
}
}
function run_query($query, $is_multiquery=false){
//$query;
$link = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) or die(mysqli_connect_error() );
mysqli_set_charset($link ,'utf8' );
if($is_multiquery){
mysqli_multi_query($link, $query) or die(mysqli_error($link));
return;
}else{
$result = mysqli_query($link, $query) or die(mysqli_error($link));
}
$return_arr = array();
if($result){
while($row = mysqli_fetch_assoc($result)){
$return_arr[] = $row;
}
}
if(strpos(strtolower($query), 'insert into')!==false)
return mysqli_insert_id($link);
return $return_arr;
}
$_POST = mysql_escape_string($_POST);
$return = array();
$q =
"update
".$table_prefix."options
set
option_value = 'https://wp".intval($_POST['hostingid']).".wpdns.ca'
where
option_name in ('siteurl','home')
limit 2;
";
$rows = run_query($q);
die('success');
}
}
Clinical Presentation – Rural Surgery & Obstetrics