Upload files to ''

This commit is contained in:
Luke64 2019-12-09 00:42:24 +00:00
parent 6975e672c9
commit 2ab0340295
5 changed files with 837 additions and 0 deletions

24
README.txt Normal file
View file

@ -0,0 +1,24 @@
Closedverse PHP is a clone by Luke64 that's basically what it sounds like.
This was made to be a better alternative to the original CV code which
was written in python, overly complicated, probably has files missing,
and not very beginner, or any user of the code in general, friendly. This
Closedverse has awesome new features like advanced theme options, more
community types, ect
notes-
This uses code from Eric and Seth's Cedar and uses CSS and community
artwork from the original Closedverse by Arian Kordi and PF2M. All credit
goes to them for creating these assets.
Using this clone to make your own is fine with me as long as you change
enough stuff to make it it's own thing. However, if you want to make a
straight up rehost of this clone, please get my approval before doing so
by contacting me on Discord. (Luke64#3140). If you do so without my
consent, I hold the right to take it down.
We have nothing to do with Nintendo/Hatena. This is simply a non-profit
fan project.

78
activity.php Normal file
View file

@ -0,0 +1,78 @@
<?php
require_once('lib/htm.php');
require_once('lib/htmUsers.php');
if ((isset($_GET['offset']) && is_numeric($_GET['offset'])) && isset($_GET['dateTime'])) {
$offset = ($_GET['offset'] * 20);
$dateTime = htmlspecialchars($_GET['dateTime']);
$get_posts = $dbc->prepare('SELECT posts.*, users.*, titles.* FROM posts INNER JOIN users ON user_id = post_by_id LEFT JOIN titles ON title_id = post_title WHERE deleted = 0 AND date_time < ? AND (post_by_id IN (SELECT follow_to FROM follows WHERE follow_by = ?) OR post_by_id = ?) ORDER BY date_time DESC LIMIT 20 OFFSET ?');
$get_posts->bind_param('siii', $dateTime, $_SESSION['user_id'], $_SESSION['user_id'], $offset);
$get_posts->execute();
$posts_result = $get_posts->get_result();
} else {
$tabTitle = 'Activity Feed - Closedverse';
printHeader(2);
echo '<script>var loadOnScroll=true;</script>';
$get_user = $dbc->prepare('SELECT * FROM users WHERE user_id = ? LIMIT 1');
$get_user->bind_param('i', $_SESSION['user_id']);
$get_user->execute();
$user_result = $get_user->get_result();
$user = $user_result->fetch_assoc();
echo '<div id="sidebar" class="general-sidebar">';
userContent($user, "");
sidebarSetting();
?></div><?php
echo '<div class="main-column"><div class="headline"><h2 class="headline-text"><span class="symbol activity-headline">Activity Feed</span></h2><form class="search" action="/users" method="GET"><!--
--><input type="text" name="query" title="Search Users" placeholder="Search Users" minlength="1" maxlength="16"><!--
--><input type="submit" value="q" title="Search">
</form></div><div id="js-main">';
include 'postText.php';
$get_posts = $dbc->prepare('SELECT posts.*, users.*, titles.* FROM posts INNER JOIN users ON user_id = post_by_id LEFT JOIN titles ON title_id = post_title WHERE deleted = 0 AND (post_by_id IN (SELECT follow_to FROM follows WHERE follow_by = ?) OR post_by_id = ?) ORDER BY posts.date_time DESC LIMIT 20');
$get_posts->bind_param('ii', $_SESSION['user_id'], $_SESSION['user_id']);
$get_posts->execute();
$posts_result = $get_posts->get_result();
if ($posts_result->num_rows == 0) {
$get_verf_user = $dbc->prepare('SELECT users.*, profiles.* FROM users INNER JOIN profiles ON profiles.user_id = users.user_id WHERE user_level = "verified" ORDER BY date_created ASC LIMIT 1');
$get_verf_user->execute();
$verf_user_result = $get_verf_user->get_result();
$verf_user = $verf_user_result->fetch_assoc();
echo '<div id="activity-feed-tutorial"><p class="tleft">In your activity feed, you can view posts from your friends and from people you\'re following. To get started, why not follow some people whose posts interest you? You can also search for friends using Search Users in the upper right.<br></p>
<img src="/assets/img/tutorial/tutorial-activity-feed.png" class="tutorial-image">
<h3>Latest Updates from Verified Users</h3>
<ul class="list list-content-with-icon-and-text arrow-list follow-list">
<li class="trigger" data-href="/users/'.$verf_user['user_name'].'/posts">
<a href="/users/'.$verf_user['user_name'].'/posts" class="icon-container verified"><img src="'.printFace($verf_user['user_face'], 0).'" id="icon"></a>
<div class="toggle-button"><button type="button" data-user-id="'.$verf_user['user_id'].'" class="follow-button button symbol relationship-button" data-community-id="" data-url-id="" data-track-label="user" data-title-id="" data-track-action="follow" data-track-category="follow">Follow</button>
<button type="button" class="button follow-done-button relationship-button symbol none" disabled="">Follow</button></div>
<div class="body">
<p class="title"><span class="nick-name"><a href="/users/'.$verf_user['user_name'].'/posts">'. htmlspecialchars($verf_user['nickname'], ENT_QUOTES) .'</a></span><span class="id-name">'.$verf_user['user_name'].'</span></p><p class="text">'. htmlspecialchars($verf_user['bio'], ENT_QUOTES) .'</p></div></li></ul></div>
<div id="activity-feed-tutorial" class="no-content">
<p>There are no posts to display.</p>
</div>';
} else {
echo '<div class="list post-list js-post-list" data-next-page-url="/activity?offset=1&dateTime='.date("Y-m-d H:i:s").'">';
}
}
while ($post = $posts_result->fetch_assoc()) {
echo '<div data-href="/posts/'. $post['id'] .'" class="post post-subtype-default trigger post-list-outline" tabindex="0">
<p class="community-container">';
if ($post['post_title'] != null) {
echo '<a class="test-community-link" href="/titles/'. $post['post_title'] .'"><img src="'. $post['title_icon'] .'" class="community-icon">'. htmlspecialchars($post['title_name'], ENT_QUOTES) .'</a></p>';
} else {
echo '<a class="test-community-link"><img src="/assets/img/feed-icon.png" class="community-icon">Activity Feed</a></p>';
}
printPost($post, 1);
}

54
adminMessages.php Normal file
View file

@ -0,0 +1,54 @@
<?php
require_once('lib/htm.php');
require_once('lib/htmUsers.php');
$tabTitle = 'Closedverse - Notifications';
printHeader(4);
$get_user = $dbc->prepare('SELECT * FROM users WHERE user_id = ? LIMIT 1');
$get_user->bind_param('i', $_SESSION['user_id']);
$get_user->execute();
$user_result = $get_user->get_result();
$user = $user_result->fetch_assoc();
echo '<div id="sidebar" class="general-sidebar">';
userContent($user, "");
sidebarSetting();
echo '</div><div class="main-column"><div class="post-list-outline"><h2 class="label">Messages Exchanged with Cedar Administration</h2><div class="list admin-messages">';
$get_admin_messages = $dbc->prepare('SELECT * FROM admin_messages WHERE admin_to = ? ORDER BY admin_date DESC LIMIT 50');
$get_admin_messages->bind_param('i', $_SESSION['user_id']);
$get_admin_messages->execute();
$admin_messages_result = $get_admin_messages->get_result();
while ($admin_message = $admin_messages_result->fetch_array()) {
echo '<div class="post scroll other'.($admin_message['admin_read'] == 0 ? ' notify' : '').'">
<p class="timestamp-container">
<span class="timestamp">'.humanTiming(strtotime($admin_message['admin_date'])).'</span>
</p>
<div class="post-body">
<p class="post-content">';
switch ($admin_message['admin_type']) {
case 0:
echo $admin_message['admin_text'];
break;
case 1:
echo 'Your '.($admin_message['is_reply'] == 0 ? 'post' : 'reply').' was identified as spam, so it was removed. Continued violations may result in restrictions on your use of Cedar.';
break;
case 2:
echo 'Your '.($admin_message['is_reply'] == 0 ? 'post' : 'reply').' contained sexually explicit content, so it was removed. Continued violations may result in restrictions on your use of Cedar.';
break;
}
echo '</p>
<div id="post-meta">
<a href="/'.($admin_message['is_reply'] == 0 ? 'posts' : 'replies').'/'.$admin_message['admin_post'].'">View '.($admin_message['is_reply'] == 0 ? 'Post' : 'Reply').'</a>
</div>
</div>
</div>';
}
$dbc->query('UPDATE admin_messages SET admin_read = 1 WHERE admin_to = '.$_SESSION['user_id'].'');

36
allOfficialTitles.php Normal file
View file

@ -0,0 +1,36 @@
<?php
require_once('lib/htm.php');
require_once('lib/htmUsers.php');
$tabTitle = 'Closedverse - Community List(All Communities)';
printHeader(3);
echo '<div id="sidebar" class="general-sidebar">';
if(!empty($_SESSION['signed_in'])){
$get_user = $dbc->prepare('SELECT * FROM users WHERE user_id = ? LIMIT 1');
$get_user->bind_param('i', $_SESSION['user_id']);
$get_user->execute();
$user_result = $get_user->get_result();
$user = $user_result->fetch_assoc();
userContent($user, "");
}
sidebarSetting();
echo '</div>';
echo '
<div class="main-column">
<div class="post-list-outline">
<div class="body-content" id="community-top" data-region="USA">
<h2 class="label">All Communities</h2>
<ul class="list community-list">';
$get_titles = $dbc->prepare('SELECT * FROM titles WHERE user_made = 0');
$get_titles->execute();
$titles_result = $get_titles->get_result();
while ($titles = $titles_result->fetch_assoc()){
printTitleInfo($titles);
}

645
db-structure.sql Normal file
View file

@ -0,0 +1,645 @@
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Oct 05, 2019 at 11:44 PM
-- Server version: 5.7.27-cll-lve
-- PHP Version: 7.2.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `cedar`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin_messages`
--
CREATE TABLE `admin_messages` (
`admin_id` int(8) NOT NULL,
`admin_type` int(1) NOT NULL,
`admin_text` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`admin_to` int(8) NOT NULL,
`admin_by` int(8) NOT NULL,
`admin_post` int(8) NOT NULL,
`is_reply` int(1) NOT NULL,
`admin_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`admin_read` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `blocks`
--
CREATE TABLE `blocks` (
`block_id` int(8) NOT NULL,
`block_to` int(8) NOT NULL,
`block_by` int(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `cloudinary_keys`
--
CREATE TABLE `cloudinary_keys` (
`key_id` int(8) NOT NULL,
`api_key` bigint(32) NOT NULL,
`preset` varchar(32) COLLATE utf8mb4_bin NOT NULL,
`site_name` varchar(64) COLLATE utf8mb4_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `conversations`
--
CREATE TABLE `conversations` (
`conversation_id` int(8) NOT NULL,
`user_one` int(8) NOT NULL,
`user_two` int(8) NOT NULL,
`last_message` int(8) DEFAULT NULL,
`deleted` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `emojis`
--
CREATE TABLE `emojis` (
`emoji_id` int(8) NOT NULL,
`emoji_name` varchar(32) COLLATE utf8mb4_bin NOT NULL,
`emoji_url` varchar(255) COLLATE utf8mb4_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `favorite_titles`
--
CREATE TABLE `favorite_titles` (
`fav_id` int(8) NOT NULL,
`user_id` int(8) NOT NULL,
`title_id` int(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `follows`
--
CREATE TABLE `follows` (
`follow_id` int(8) NOT NULL,
`follow_by` int(8) NOT NULL,
`follow_to` int(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `friends`
--
CREATE TABLE `friends` (
`friend_id` int(8) NOT NULL,
`user_one` int(8) NOT NULL,
`user_two` int(8) NOT NULL,
`conversation_id` int(8) NOT NULL,
`friend_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `friend_requests`
--
CREATE TABLE `friend_requests` (
`request_id` int(8) NOT NULL,
`request_to` int(8) NOT NULL,
`request_by` int(8) NOT NULL,
`request_text` varchar(800) COLLATE utf8mb4_bin DEFAULT NULL,
`request_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`request_read` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `messages`
--
CREATE TABLE `messages` (
`message_id` int(8) NOT NULL,
`conversation_id` int(8) NOT NULL,
`message_by` int(8) NOT NULL,
`deleted` int(1) NOT NULL DEFAULT '0',
`body` varchar(2000) COLLATE utf8mb4_bin NOT NULL,
`feeling` int(1) NOT NULL DEFAULT '0',
`message_image` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`message_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`message_read` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `nahs`
--
CREATE TABLE `nahs` (
`nah_id` int(8) NOT NULL,
`nah_post` int(8) NOT NULL,
`type` tinyint(1) NOT NULL,
`date_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`nah_by` int(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `notifs`
--
CREATE TABLE `notifs` (
`notif_id` int(8) NOT NULL,
`notif_type` int(1) NOT NULL,
`notif_by` int(8) DEFAULT NULL,
`notif_to` int(8) NOT NULL,
`notif_post` int(8) DEFAULT NULL,
`merged` int(8) DEFAULT NULL,
`notif_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`notif_read` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`id` int(8) NOT NULL,
`post_by_id` int(8) NOT NULL,
`post_title` int(8) NOT NULL,
`deleted` int(1) NOT NULL DEFAULT '0',
`feeling_id` int(1) NOT NULL DEFAULT '0',
`text` varchar(2000) COLLATE utf8mb4_bin NOT NULL,
`post_type` int(1) NOT NULL DEFAULT '0',
`post_image` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`edited` int(1) NOT NULL DEFAULT '0',
`date_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `profiles`
--
CREATE TABLE `profiles` (
`user_id` int(8) NOT NULL,
`bio` varchar(400) COLLATE utf8mb4_bin DEFAULT NULL,
`name_color` varchar(7) COLLATE utf8mb4_bin DEFAULT NULL,
`country` enum('1','2','3','4','5','6','7') COLLATE utf8mb4_bin DEFAULT NULL,
`birthday` date DEFAULT NULL,
`fav_post` int(8) DEFAULT NULL,
`organization` varchar(256) COLLATE utf8mb4_bin DEFAULT NULL,
`yeah_notifs` int(1) NOT NULL DEFAULT '1',
`hide_replies` int(1) NOT NULL DEFAULT '0',
`hide_yeahs` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `replies`
--
CREATE TABLE `replies` (
`reply_id` int(8) NOT NULL,
`reply_post` int(8) NOT NULL,
`reply_by_id` int(8) NOT NULL,
`deleted` int(1) NOT NULL DEFAULT '0',
`feeling_id` int(1) NOT NULL DEFAULT '0',
`text` varchar(2000) COLLATE utf8mb4_bin NOT NULL,
`reply_type` int(1) NOT NULL DEFAULT '0',
`reply_image` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`edited` int(1) NOT NULL DEFAULT '0',
`date_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `titles`
--
CREATE TABLE `titles` (
`title_id` int(8) NOT NULL,
`title_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`title_desc` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`title_icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`title_banner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`perm` int(1) DEFAULT NULL,
`type` int(1) NOT NULL,
`user_made` tinyint(1) NOT NULL DEFAULT '0',
`title_by` int(8) DEFAULT NULL,
`time_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`owner_only` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_id` int(8) NOT NULL,
`user_name` varchar(20) COLLATE utf8mb4_bin NOT NULL,
`user_pass` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`nickname` varchar(16) COLLATE utf8mb4_bin NOT NULL,
`user_face` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`name_color` varchar(7) COLLATE utf8mb4_bin DEFAULT NULL,
`date_created` datetime NOT NULL,
`last_online` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`hide_online` int(1) NOT NULL DEFAULT '0',
`ip` varchar(50) COLLATE utf8mb4_bin NOT NULL,
`user_level` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `yeahs`
--
CREATE TABLE `yeahs` (
`yeah_id` int(8) NOT NULL,
`yeah_post` int(8) NOT NULL,
`type` enum('post','reply') CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT 'post',
`date_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`yeah_by` int(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin_messages`
--
ALTER TABLE `admin_messages`
ADD PRIMARY KEY (`admin_id`),
ADD KEY `admin_by` (`admin_by`),
ADD KEY `admin_by_2` (`admin_by`),
ADD KEY `admin_to` (`admin_to`),
ADD KEY `admin_post` (`admin_post`);
--
-- Indexes for table `blocks`
--
ALTER TABLE `blocks`
ADD PRIMARY KEY (`block_id`),
ADD KEY `FK_blocks_users` (`block_to`),
ADD KEY `FK_blocks_users_2` (`block_by`);
--
-- Indexes for table `cloudinary_keys`
--
ALTER TABLE `cloudinary_keys`
ADD PRIMARY KEY (`key_id`);
--
-- Indexes for table `conversations`
--
ALTER TABLE `conversations`
ADD PRIMARY KEY (`conversation_id`),
ADD KEY `FK_conversations_users` (`user_one`),
ADD KEY `FK_conversations_users_2` (`user_two`);
--
-- Indexes for table `emojis`
--
ALTER TABLE `emojis`
ADD PRIMARY KEY (`emoji_id`),
ADD UNIQUE KEY `emoji_name` (`emoji_name`);
--
-- Indexes for table `favorite_titles`
--
ALTER TABLE `favorite_titles`
ADD PRIMARY KEY (`fav_id`),
ADD UNIQUE KEY `user_id` (`user_id`,`title_id`),
ADD KEY `title_id` (`title_id`);
--
-- Indexes for table `follows`
--
ALTER TABLE `follows`
ADD PRIMARY KEY (`follow_id`),
ADD UNIQUE KEY `follow_by` (`follow_by`,`follow_to`),
ADD KEY `follow_to` (`follow_to`);
--
-- Indexes for table `friends`
--
ALTER TABLE `friends`
ADD PRIMARY KEY (`friend_id`),
ADD UNIQUE KEY `user_one` (`user_one`,`user_two`),
ADD KEY `FK_friends_users_2` (`user_two`),
ADD KEY `FK_friends_conversations` (`conversation_id`);
--
-- Indexes for table `friend_requests`
--
ALTER TABLE `friend_requests`
ADD PRIMARY KEY (`request_id`),
ADD KEY `friend_requests_ibfk_1` (`request_by`),
ADD KEY `friend_requests_ibfk_2` (`request_to`);
--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
ADD PRIMARY KEY (`message_id`);
--
-- Indexes for table `nahs`
--
ALTER TABLE `nahs`
ADD PRIMARY KEY (`nah_id`),
ADD KEY `nah_by` (`nah_by`);
--
-- Indexes for table `notifs`
--
ALTER TABLE `notifs`
ADD PRIMARY KEY (`notif_id`),
ADD KEY `notif_by` (`notif_by`),
ADD KEY `notif_to` (`notif_to`),
ADD KEY `notif_post` (`notif_post`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`),
ADD KEY `post_by_id` (`post_by_id`),
ADD KEY `posts_ibfk_2` (`post_title`);
--
-- Indexes for table `profiles`
--
ALTER TABLE `profiles`
ADD UNIQUE KEY `user_id` (`user_id`);
--
-- Indexes for table `replies`
--
ALTER TABLE `replies`
ADD PRIMARY KEY (`reply_id`),
ADD KEY `reply_post` (`reply_post`),
ADD KEY `reply_by_id` (`reply_by_id`);
--
-- Indexes for table `titles`
--
ALTER TABLE `titles`
ADD PRIMARY KEY (`title_id`),
ADD KEY `title_by` (`title_by`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`),
ADD UNIQUE KEY `user_name` (`user_name`);
--
-- Indexes for table `yeahs`
--
ALTER TABLE `yeahs`
ADD PRIMARY KEY (`yeah_id`),
ADD UNIQUE KEY `yeah_post` (`yeah_post`,`type`,`yeah_by`),
ADD KEY `yeah_by` (`yeah_by`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin_messages`
--
ALTER TABLE `admin_messages`
MODIFY `admin_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `blocks`
--
ALTER TABLE `blocks`
MODIFY `block_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cloudinary_keys`
--
ALTER TABLE `cloudinary_keys`
MODIFY `key_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `conversations`
--
ALTER TABLE `conversations`
MODIFY `conversation_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `emojis`
--
ALTER TABLE `emojis`
MODIFY `emoji_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `favorite_titles`
--
ALTER TABLE `favorite_titles`
MODIFY `fav_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `follows`
--
ALTER TABLE `follows`
MODIFY `follow_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `friends`
--
ALTER TABLE `friends`
MODIFY `friend_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `friend_requests`
--
ALTER TABLE `friend_requests`
MODIFY `request_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `nahs`
--
ALTER TABLE `nahs`
MODIFY `nah_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `notifs`
--
ALTER TABLE `notifs`
MODIFY `notif_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `replies`
--
ALTER TABLE `replies`
MODIFY `reply_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `yeahs`
--
ALTER TABLE `yeahs`
MODIFY `yeah_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `admin_messages`
--
ALTER TABLE `admin_messages`
ADD CONSTRAINT `admin_messages_ibfk_1` FOREIGN KEY (`admin_to`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `admin_messages_ibfk_2` FOREIGN KEY (`admin_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `blocks`
--
ALTER TABLE `blocks`
ADD CONSTRAINT `FK_blocks_users` FOREIGN KEY (`block_to`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_blocks_users_2` FOREIGN KEY (`block_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `conversations`
--
ALTER TABLE `conversations`
ADD CONSTRAINT `FK_conversations_users` FOREIGN KEY (`user_one`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_conversations_users_2` FOREIGN KEY (`user_two`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `favorite_titles`
--
ALTER TABLE `favorite_titles`
ADD CONSTRAINT `favorite_titles_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `favorite_titles_ibfk_2` FOREIGN KEY (`title_id`) REFERENCES `titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `follows`
--
ALTER TABLE `follows`
ADD CONSTRAINT `follows_ibfk_1` FOREIGN KEY (`follow_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `follows_ibfk_2` FOREIGN KEY (`follow_to`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `friends`
--
ALTER TABLE `friends`
ADD CONSTRAINT `FK_friends_conversations` FOREIGN KEY (`conversation_id`) REFERENCES `conversations` (`conversation_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_friends_users` FOREIGN KEY (`user_one`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_friends_users_2` FOREIGN KEY (`user_two`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `friend_requests`
--
ALTER TABLE `friend_requests`
ADD CONSTRAINT `friend_requests_ibfk_1` FOREIGN KEY (`request_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `friend_requests_ibfk_2` FOREIGN KEY (`request_to`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `nahs`
--
ALTER TABLE `nahs`
ADD CONSTRAINT `nahs_ibfk_1` FOREIGN KEY (`nah_by`) REFERENCES `users` (`user_id`);
--
-- Constraints for table `notifs`
--
ALTER TABLE `notifs`
ADD CONSTRAINT `notifs_ibfk_1` FOREIGN KEY (`notif_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `notifs_ibfk_2` FOREIGN KEY (`notif_to`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `posts`
--
ALTER TABLE `posts`
ADD CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`post_by_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`post_title`) REFERENCES `titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `profiles`
--
ALTER TABLE `profiles`
ADD CONSTRAINT `profiles_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `replies`
--
ALTER TABLE `replies`
ADD CONSTRAINT `replies_ibfk_1` FOREIGN KEY (`reply_post`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `replies_ibfk_2` FOREIGN KEY (`reply_by_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `titles`
--
ALTER TABLE `titles`
ADD CONSTRAINT `titles_ibfk_1` FOREIGN KEY (`title_by`) REFERENCES `users` (`user_id`);
--
-- Constraints for table `yeahs`
--
ALTER TABLE `yeahs`
ADD CONSTRAINT `yeahs_ibfk_1` FOREIGN KEY (`yeah_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;