<?php 
// +------------------------------------------------------------------------+
// | @author Deen Doughouz (DoughouzForest)
// | @author_url 1: http://www.wowonder.com
// | @author_url 2: http://codecanyon.net/user/doughouzforest
// | @author_email: wowondersocial@gmail.com   
// +------------------------------------------------------------------------+
// | WoWonder - The Ultimate Social Networking Platform
// | Copyright (c) 2016 WoWonder. All rights reserved.
// +------------------------------------------------------------------------+
if (file_exists('assets/init.php')) {
	require 'assets/init.php';
} else {
	die('Please put this file in the home directory !');
}
$query = "
INSERT INTO `Wo_Config` (`id`, `name`, `value`) VALUES (NULL, 'background_extension', 'jpg');
INSERT INTO `Wo_Config` (`id`, `name`, `value`) VALUES (NULL, 'profile_privacy', '1');
INSERT INTO `Wo_Config` (`id`, `name`, `value`) VALUES (NULL, 'video_upload', '1'), (NULL, 'audio_upload', '1');
ALTER TABLE `Wo_Users` ADD `start_up` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `registered`;
ALTER TABLE `Wo_Users` ADD `start_up_info` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `start_up`;
ALTER TABLE `Wo_Users` ADD `startup_follow` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `start_up_info`, ADD `startup_image` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `startup_follow`;
ALTER TABLE `Wo_Posts` CHANGE `postLink` `postLink` VARCHAR(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
DELETE FROM `Wo_Likes` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_Wonders` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_CommentLikes` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_CommentWonders` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_PinnedPosts` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_Pages_Invites` WHERE `inviter_id` NOT IN (SELECT `user_id` FROM `Wo_Users`) OR `invited_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_Comment_Replies` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_Comment_Replies_Likes` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_Comment_Replies_Wonders` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_Comments` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_Group_Members` WHERE `user_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_Messages` WHERE `from_id` NOT IN (SELECT `user_id` FROM `Wo_Users`) OR `to_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
DELETE FROM `Wo_Notifications` WHERE `notifier_id` NOT IN (SELECT `user_id` FROM `Wo_Users`) OR `recipient_id` NOT IN (SELECT `user_id` FROM `Wo_Users`);
CREATE TABLE `Wo_Terms` (
  `id` int(11) NOT NULL,
  `type` varchar(32) NOT NULL,
  `text` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `Wo_Terms` (`id`, `type`, `text`) VALUES
(1, 'terms_of_use', '<h4>1- Write your Terms Of Use here.</h4>          \nLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod          tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,          quis sdnostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo          consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse          cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non          proident, sunt in culpa qui officia deserunt mollit anim id est laborum.          <br><br>          <h4>2- Random title</h4>          Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod          tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,          quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo          consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse          cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non          proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'),
(2, 'privacy_policy', ' <h4>1- Write your Privacy Policy here.</h4>          Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod          tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,          quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo          consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse          cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non          proident, sunt in culpa qui officia deserunt mollit anim id est laborum.          <br><br>          <h4>2- Random title</h4>          Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod          tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,          quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo          consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse          cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non          proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'),
(3, 'about', '<h4>1- Write about your website here.</h4>          Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod          tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,          quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo          consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse          cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non          proident, sunt in culpa qui officia deserunt mollit anim id est laborum.          <br><br>          <h4>2- Random title</h4>          Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod          tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,          quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo          consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse          cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non          proident, sunt in culpa qui officia deserunt mollit anim id est laborum.');
";
$query = mysqli_multi_query($sqlConnect, $query);
@session_destroy();

if ($query) {
  echo 'The script is successfully updated!';
  exit();
}
?>