Add files via upload

This commit is contained in:
Justin 2022-07-21 07:19:06 -04:00 committed by GitHub
commit 7b1edde46c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1237 additions and 0 deletions

View file

@ -0,0 +1,189 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$default_spindle_uqid = safe($_GET['u']);
$split = explode('1', $default_spindle_uqid);
$spindle_uqid = $split[0];
$subspindle_uqid = $split[1];
/* GET SPINDLE INFO */
$spindles_q = mysqli_query($conx, "SELECT name,color,description,tstamp FROM forum_spindles WHERE uqid='$spindle_uqid'");
while($spindles_r = mysqli_fetch_assoc($spindles_q)) {
$spindle_color = $spindles_r['color'];
$spindle_name = $spindles_r['name'];
$spindle_desc = $spindles_r['description'];
$spindle_tstamp = $spindles_r['tstamp'];
$spindle_actstamp = time() - $spindle_tstamp;
$minutes = round($spindle_actstamp / 60);
if($minutes <= 60) {
$spindle_actdot = "#00FF00";
}
elseif($minutes <= 90) {
$spindle_actdot = "#FFA500";
}
elseif($minutes < 120) {
$spindle_actdot = "#FF0000";
}
else {
$spindle_actdot = "#FF0000";
}
}
/* IF IT IS A SUBSPINDLE */
if($subspindle_uqid != '') {
$this_subspindle = true;
/* GET SUBSPINDLE INFO */
$spindles_q = mysqli_query($conx, "SELECT name FROM forum_subspindles WHERE uqid='$subspindle_uqid'");
while($spindles_r = mysqli_fetch_assoc($spindles_q)) {
$subspindle_name = $spindles_r['name'];
if($subspindle_name != '') {
$subspindle_name = "<br><span style=\"font-size: 12px;\">$subspindle_name</span>";
}
}
}
echo "<div class=\"spindle_details\">
<table class=\"spindle_info_cont\">
<tr>
<td class=\"spindle_info\">
<span style=\"color: $spindle_color; font-weight: bold; font-size: 18px;\">$spindle_name</span>";
if($subspindle_name != '') {
echo "<span style=\"color: $spindle_color; font-weight: bold; font-size: 18px;\">$subspindle_name</span>";
}
echo "<br> <span class=\"spindle_desc\">$spindle_desc</span>
</td>
<td class=\"spindle_actcont\">
<i class=\"fa fa-circle\" aria-hidden=\"true\" style=\"font-size: 8px; color: $spindle_actdot;\"></i>
</td>
</tr>
</table>
</div>
<div class=\"spindle_tools\" style=\"background-color: $spindle_color; color: #fff;\">
<table style=\"-webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;width: 100%;border-collapse: collapse; text-align: center; font-size: 12px; font-weight: bold;\">
<tr>
<td onclick=\"expand('spindle_newthread');\" style=\"width: 33.333%;\">
<i class=\"fa fa-pencil-square-o\" aria-hidden=\"true\"></i> post
</td>
<td onclick=\"refreshThreads('$default_spindle_uqid');\" style=\"width: 33.333%;\">
<i class=\"fa fa-refresh\" aria-hidden=\"true\"></i> refresh
</td>
<td style=\"width: 33.333%;\">
<i class=\"fa fa-users\" aria-hidden=\"true\"></i> online
</td>
</tr>
</table>
</div>";
$threads_qnt = mysqli_query($conx, "SELECT * FROM forum_threads WHERE spindle_uqid='$default_spindle_uqid' && draft='no' ORDER BY id DESC");
$thread_count = mysqli_num_rows($threads_qnt);
if($thread_count == 0) {
echo "<div id=\"forum_no_threads\" class=\"spindle_details\">
There aren't any threads here. <i class=\"fa fa-frown-o\" aria-hidden=\"true\"></i>
</div>";
}
$threads_q = mysqli_query($conx, "SELECT * FROM forum_threads WHERE spindle_uqid='$default_spindle_uqid' && draft='no' ORDER BY id DESC LIMIT 10");
while($threads_r = mysqli_fetch_assoc($threads_q)) {
$thread_id = $threads_r['id'];
$thread_uid = $threads_r['uid'];
/* GET USER INFO */
$usr_q = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$thread_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
$thread_username = $usr_r['username'];
}
$usri_qq = mysqli_query($conx, "SELECT * FROM user_theme_colors WHERE uid='$thread_uid' && theme_id='$g_themeid'");
while($usri_rr = mysqli_fetch_assoc($usri_qq)) {
$thread_color = $usri_rr['username_color'];
$thread_tcolor = $usri_rr['text_color'];
}
$thread_name = $threads_r['name'];
$thread_content = $threads_r['content'];
$spindle_desc = $threads_r['description'];
$sspindle_tstamp = $threads_r['tstamp'];
$sspindle_actstamp = time() - $sspindle_tstamp;
$sminutes = round($sspindle_actstamp / 60);
if($sminutes <= 10) {
$sspindle_actdot = "#00FF00";
}
elseif($sminutes <= 20) {
$sspindle_actdot = "#FFA500";
}
elseif($sminutes < 50) {
$sspindle_actdot = "#FF0000";
}
else {
$sspindle_actdot = "#FF0000";
}
/* GET A COUNT OF HOW MANY REPLIES THE THREAD HAS */
$thread_reply_cont = mysqli_num_rows(mysqli_query($conx, "SELECT id FROM forum_replies WHERE thread_id='$thread_id' ORDER BY id"));
$thread_reply_cont = number_format($thread_reply_cont);
/* REPLY COUNT GRAMMAR */
if($thread_reply_cont != '1') {
$thread_reply_grammar = "replies";
}
else {
$thread_reply_grammar = "reply";
}
/* GET A COUNT OF HOW MANY VIEWS THE THREAD HAS */
$thread_view_cont = mysqli_num_rows(mysqli_query($conx, "SELECT id FROM forum_views WHERE thread_id='$thread_id' ORDER BY id"));
$thread_view_cont = number_format($thread_view_cont);
/* VIEW COUNT GRAMMAR */
if($thread_view_cont != '1') {
$thread_view_grammar = "views";
}
else {
$thread_view_grammar = "view";
}
echo "<div class=\"threads_cont\">
<table class=\"spindle_info_cont\">
<tr>
<td class=\"thread_info\">
<span class=\"thread_name\" style=\"color: $thread_color;\" onclick=\"toThread('$thread_id','$thread_name');\">
<i class=\"fa fa-external-link-square\" aria-hidden=\"true\"></i> <span id=\"thd_$thread_id\">$thread_name</span>
</span> <br>
<span style=\"color: $thread_color; font-size: 11px;\">thread has <span style=\"font-weight: bold;\">$thread_reply_cont</span> $thread_reply_grammar and <span style=\"font-weight: bold;\">$thread_view_cont</span> $thread_view_grammar<br>
<span style=\"color: $thread_color; font-size: 11px;\">created by <span style=\"font-weight: bold;\">$thread_username</span>; ";
echo "<span class=\"tago\" style=\"font-size: 10px;\">";
echo timeago($sspindle_tstamp);
echo " ago</span>";
/* forum latest reply */
/* replier UID */
$latest_q = mysqli_query($conx, "SELECT uid,tstamp FROM forum_replies WHERE thread_id='$thread_id' ORDER BY id DESC LIMIT 1");
while($latest_r = mysqli_fetch_assoc($latest_q)) {
$replier_uid = $latest_r['uid'];
$reply_tstamp = $latest_r['tstamp'];
/* replier username */
$latest_qu = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$replier_uid'");
while($latest_ru = mysqli_fetch_assoc($latest_qu)) {
$replier_username = $latest_ru['username'];
}
/* replier colors */
$tusri_qq = mysqli_query($conx, "SELECT * FROM user_theme_colors WHERE uid='$replier_uid' && theme_id='$g_themeid'");
while($tusri_rr = mysqli_fetch_assoc($tusri_qq)) {
$replier_color = $tusri_rr['username_color'];
$replier_tcolor = $tusri_rr['text_color'];
}
echo "<br>
<span style=\"color: $replier_color; font-size: 11px;\">latest post by <span style=\"font-weight: bold;\">$replier_username</span>; ";
echo "<span class=\"tago\" style=\"font-size: 10px;\">";
echo timeago($reply_tstamp);
echo " ago</span>";
}
echo "<br>
</td>
<td class=\"thread_actcont\">
<i onclick=\"expand('thrd_$thread_id')\" class=\"fa fa-scissors\" aria-hidden=\"true\" id=\"thrd_snippet\"></i>
<i class=\"fa fa-circle\" aria-hidden=\"true\" style=\"font-size: 8px; color: $sspindle_actdot;\"></i>
</td>
</tr>
</table></div>
<div id=\"thrd_$thread_id\" class=\"threads_cont\" style=\"display: none;\">
<table class=\"spindle_info_cont\">
<tr>
<td class=\"thread_info\">";
echo nl2br($thread_content);
echo "</td>
</tr>
</table></div>";
}
?>

View file

@ -0,0 +1,16 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$get_thread_id = safe($_GET['i']);
$thrd_q = mysqli_query($conx, "SELECT id,name,content,tstamp FROM forum_threads WHERE id='$get_thread_id' && draft='yes' ORDER BY id DESC");
while($thrd_r = mysqli_fetch_assoc($thrd_q)) {
$thread_title = $thrd_r['name'];
$thread_content = $thrd_r['content'];
echo nl2br($thread_title);
echo "--|~|1|~|MD|~|1|~|--";
echo nl2br($thread_content);
}
?>

View file

@ -0,0 +1,23 @@
<?php
require_once("../inc/conx.php");
if ( isset($_FILES['img']) ) {
$filename = $_FILES['img']['tmp_name'];
$handle = fopen($filename, "r");
$data = fread($handle, filesize($filename));
$required_key = "make ur own";
$POST_DATA = array(
'file' => base64_encode($data),
'key' => urlencode($required_key),
'user' => urlencode($u_uid)
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://upl.justa.us/image.php');
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA);
$response = curl_exec($curl);
echo trim($response);
curl_close ($curl);
}
?>

View file

@ -1 +1,129 @@
<?php
$this_page = "forums";
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
# # # # # # #
# WEBSITE LOCATION #
# # # # # # #
if($u_siteloc != '/forums') {
$loc_desc = "browsin\' forums";
mysqli_query($conx, "UPDATE accounts SET site_locdesc='$loc_desc' WHERE uid='$u_uid'");
mysqli_query($conx, "UPDATE accounts SET site_locurl='/forums' WHERE uid='$u_uid'");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Forums - Misdew</title>
<meta charset="utf-8">
<meta name="description" content="We are a fairly cool social network.">
<meta name="keywords" content="Misdew, MD, Social, Network, Communication, 3DS, DSi, Nintendo">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" value="notranslate">
<meta name="theme-color" content="<?php echo $meta_theme_color; ?>">
<?php
if($css_type == "sheet") {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$g_sheet\">";
}
if($css_type == "raw") {
echo "<style type=\"text/css\">$g_raw</style>";
}
?>
<link rel="icon" type="image/png" href="/img/favicon.png">
<link rel="apple-touch-icon" href="/img/logo.png">
<style type="text/css">
body {
background-color: <?php echo $bgcolor; ?>;
}
#header_tds {
color: <?php echo $tdcolor; ?> !important;
}
/* CONTENT HERE FOR THIS PAGE */
/* MAKE SURE TO ADD TO THEMES */
/* CONTENT HERE FOR THIS PAGE */
.forums_actbar {
color: #fff;
background-color: #954495;
}
</style>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-81238250-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-81238250-2');
</script>
</head>
<body>
<center>
<?php
$back_button = true;
$linebreak = false;
$alerts = false;
require_once("../inc/header.php");
?>
<div id="action_bar" class="forums_actbar">
<table style="width: 100%; text-align: center;">
<tr>
<td id="spindlesTab" onclick="toSpindles();" class="action_bar_tab" style="border-bottom: 1px solid #fff;">
Spindles
</td>
<td id="weavesTab" onclick="toWeaves();" class="action_bar_tab">
Weaves
</td>
<td id="settingsTab" onclick="toSettings();" class="action_bar_tab">
Settings
</td>
</tr>
</table>
</div> <br>
<?php
require_once("../inc/load_alerts.php");
?>
<div id="action_bar_page">
<?php require_once("spindles.php"); ?>
</div>
<?php
require_once("../inc/footer.php");
?>
</center>
<script>
function toSpindles() {
document.getElementById('spindlesTab').innerHTML = "Spindles..";
$.get("spindles.php", function(d) {
document.getElementById('spindlesTab').innerHTML = "Spindles";
document.getElementById("spindlesTab").style.borderBottom = '1px solid #fff';
document.getElementById("weavesTab").style.borderBottom = 'none';
document.getElementById("settingsTab").style.borderBottom = 'none';
$("#action_bar_page").html(d);
});
}
function toWeaves() {
document.getElementById('weavesTab').innerHTML = "Weaves..";
$.get("weaves.php", function(d) {
document.getElementById('weavesTab').innerHTML = "Weaves";
document.getElementById("spindlesTab").style.borderBottom = 'none';
document.getElementById("weavesTab").style.borderBottom = '1px solid #fff';
document.getElementById("settingsTab").style.borderBottom = 'none';
$("#action_bar_page").html(d);
});
}
function toSettings() {
document.getElementById('settingsTab').innerHTML = "Settings..";
$.get("settings.php", function(d) {
document.getElementById('settingsTab').innerHTML = "Settings";
document.getElementById("spindlesTab").style.borderBottom = 'none';
document.getElementById("settingsTab").style.borderBottom = '1px solid #fff';
document.getElementById("weavesTab").style.borderBottom = 'none';
$("#action_bar_page").html(d);
});
}
</script>
</body>
</html>

View file

@ -0,0 +1,115 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$amount = safe($_GET['amntcnt']);
$default_spindle_uqid = safe($_GET['u']);
$threads_q = mysqli_query($conx, "SELECT * FROM forum_threads WHERE spindle_uqid='$default_spindle_uqid' && draft='no' ORDER BY id DESC LIMIT $amount,10");
while($threads_r = mysqli_fetch_assoc($threads_q)) {
$thread_id = $threads_r['id'];
$thread_uid = $threads_r['uid'];
/* GET USER INFO */
$usr_q = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$thread_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
$thread_username = $usr_r['username'];
}
$usri_qq = mysqli_query($conx, "SELECT * FROM user_theme_colors WHERE uid='$thread_uid' && theme_id='$g_themeid'");
while($usri_rr = mysqli_fetch_assoc($usri_qq)) {
$thread_color = $usri_rr['username_color'];
$thread_tcolor = $usri_rr['text_color'];
}
$thread_name = $threads_r['name'];
$thread_content = $threads_r['content'];
$spindle_desc = $threads_r['description'];
$sspindle_tstamp = $threads_r['tstamp'];
$sspindle_actstamp = time() - $sspindle_tstamp;
$sminutes = round($sspindle_actstamp / 60);
if($sminutes <= 60) {
$sspindle_actdot = "#00FF00";
}
elseif($sminutes <= 90) {
$sspindle_actdot = "#FFA500";
}
elseif($sminutes < 120) {
$sspindle_actdot = "#FF0000";
}
else {
$sspindle_actdot = "#FF0000";
}
/* GET A COUNT OF HOW MANY REPLIES THE THREAD HAS */
$thread_reply_cont = mysqli_num_rows(mysqli_query($conx, "SELECT id FROM forum_replies WHERE thread_id='$thread_id' ORDER BY id"));
$thread_reply_cont = number_format($thread_reply_cont);
/* REPLY COUNT GRAMMAR */
if($thread_reply_cont != '1') {
$thread_reply_grammar = "replies";
}
else {
$thread_reply_grammar = "reply";
}
/* GET A COUNT OF HOW MANY VIEWS THE THREAD HAS */
$thread_view_cont = mysqli_num_rows(mysqli_query($conx, "SELECT id FROM forum_views WHERE thread_id='$thread_id' ORDER BY id"));
$thread_view_cont = number_format($thread_view_cont);
/* VIEW COUNT GRAMMAR */
if($thread_view_cont != '1') {
$thread_view_grammar = "views";
}
else {
$thread_view_grammar = "view";
}
echo "<div class=\"threads_cont\">
<table class=\"spindle_info_cont\">
<tr>
<td class=\"thread_info\">
<span class=\"thread_name\" style=\"color: $thread_color;\" onclick=\"toThread('$thread_id','$thread_name');\">
<i class=\"fa fa-external-link-square\" aria-hidden=\"true\"></i> <span id=\"thd_$thread_id\">$thread_name</span>
</span> <br>
<span style=\"color: $thread_color; font-size: 11px;\">thread has <span style=\"font-weight: bold;\">$thread_reply_cont</span> $thread_reply_grammar and <span style=\"font-weight: bold;\">$thread_view_cont</span> $thread_view_grammar<br>
<span style=\"color: $thread_color; font-size: 11px;\">created by <span style=\"font-weight: bold;\">$thread_username</span>; ";
echo "<span class=\"tago\" style=\"font-size: 10px;\">";
echo timeago($sspindle_tstamp);
echo " ago</span>";
/* forum latest reply */
/* replier UID */
$latest_q = mysqli_query($conx, "SELECT uid,tstamp FROM forum_replies WHERE thread_id='$thread_id' ORDER BY id DESC LIMIT 1");
while($latest_r = mysqli_fetch_assoc($latest_q)) {
$replier_uid = $latest_r['uid'];
$reply_tstamp = $latest_r['tstamp'];
/* replier username */
$latest_qu = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$replier_uid'");
while($latest_ru = mysqli_fetch_assoc($latest_qu)) {
$replier_username = $latest_ru['username'];
}
/* replier colors */
$tusri_qq = mysqli_query($conx, "SELECT * FROM user_theme_colors WHERE uid='$replier_uid' && theme_id='$g_themeid'");
while($tusri_rr = mysqli_fetch_assoc($tusri_qq)) {
$replier_color = $tusri_rr['username_color'];
$replier_tcolor = $tusri_rr['text_color'];
}
echo "<br>
<span style=\"color: $replier_color; font-size: 11px;\">latest post by <span style=\"font-weight: bold;\">$replier_username</span>; ";
echo "<span class=\"tago\" style=\"font-size: 10px;\">";
echo timeago($reply_tstamp);
echo " ago</span>";
}
echo "<br>
</td>
<td class=\"thread_actcont\">
<i onclick=\"expand('thrd_$thread_id')\" class=\"fa fa-scissors\" aria-hidden=\"true\" id=\"thrd_snippet\"></i>
<i class=\"fa fa-circle\" aria-hidden=\"true\" style=\"font-size: 8px; color: $sspindle_actdot;\"></i>
</td>
</tr>
</table></div>
<div id=\"thrd_$thread_id\" class=\"threads_cont\" style=\"display: none;\">
<table class=\"spindle_info_cont\">
<tr>
<td class=\"thread_info\">";
echo nl2br($thread_content);
echo "</td>
</tr>
</table></div>";
}
?>

View file

@ -0,0 +1,29 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$f_type = safe($_POST['type']);
$f_uqid = safe($_POST['uqid']);
$f_title = safe($_POST['title']);
$f_content = safe($_POST['content']);
$split = explode('1', $f_uqid);
$spindle_uqid = $split[0];
$subspindle_uqid = $split[1];
if($f_title != '') {
if($f_type == 'save') {
$draft = "yes";
}
elseif($f_type == 'post') {
$draft = "no";
}
else {
exit();
}
mysqli_query($conx, "INSERT INTO forum_threads (draft,spindle_uqid,name,uid,content,tstamp) VALUES ('$draft','$f_uqid','$f_title','$u_uid','$f_content','$tstamp')");
if($f_type == 'post') {
mysqli_query($conx, "UPDATE forum_spindles SET tstamp='$tstamp' WHERE uqid='$spindle_uqid'");
}
}
?>

View file

@ -0,0 +1,24 @@
<select id="restore_drft" style="width: 100%;" onchange="restoreDraft();">
<option>Select a Draft</option>
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$default_spindle_uqid = safe($_GET['u']);
$split = explode('1', $default_spindle_uqid);
$spindle_uqid = $split[0];
$subspindle_uqid = $split[1];
$thrd_q = mysqli_query($conx, "SELECT id,name,content,tstamp FROM forum_threads WHERE uid='$u_uid' && spindle_uqid='$default_spindle_uqid' && draft='yes' ORDER BY id DESC");
while($thrd_r = mysqli_fetch_assoc($thrd_q)) {
$vthread_id = $thrd_r['id'];
$vthread_title = $thrd_r['name'];
$vthread_content = $thrd_r['content'];
$vthread_tstamp = $thrd_r['tstamp'];
echo "<option value=\"$vthread_id\">$vthread_title (";
echo timeago($vthread_tstamp);
echo " ago)</option>";
}
?>
</select>

View file

@ -0,0 +1,109 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
?>
<style>
/* CONTENT HERE FOR THIS PAGE */
/* MAKE SURE TO ADD TO THEMES */
/* CONTENT HERE FOR THIS PAGE */
.spindle_cont {
width: 90%;
max-width: 450px;
padding: 8px;
background-color: #fff;
font-family: 'Dosis', sans-serif;
text-align: left;
border-bottom: 1px dotted #ccc;
}
.spindle_name {
font-weight: bold;
font-size: 18px;
}
.spindle_subname {
font-weight: bold;
font-size: 12px;
}
.spindle_desc {
color: #808080;
font-size: 13px;
}
.spindle_info_cont {
border-collapse: collapse;
width: 100%;
}
.spindle_info {
padding: 0;
margin: 0;
width: 50%;
text-align: left;
}
.spindle_actcont {
padding: 0;
margin: 0;
width: 50%;
text-align: right;
}
</style>
<?php
$spindles_q = mysqli_query($conx, "SELECT * FROM forum_spindles ORDER BY id ASC");
while($spindles_r = mysqli_fetch_assoc($spindles_q)) {
$spindle_uqid = $spindles_r['uqid'];
$spindle_name = $spindles_r['name'];
$spindle_desc = $spindles_r['description'];
$spindle_tstamp = $spindles_r['tstamp'];
$spindle_color = $spindles_r['color'];
$spindle_actstamp = time() - $spindle_tstamp;
$minutes = round($spindle_actstamp / 60);
if($minutes <= 60) {
$spindle_actdot = "#00FF00";
}
elseif($minutes <= 90) {
$spindle_actdot = "#FFA500";
}
elseif($minutes < 120) {
$spindle_actdot = "#FF0000";
}
else {
$spindle_actdot = "#FF0000";
}
echo "<div class=\"spindle_cont\">
<table class=\"spindle_info_cont\">
<tr>
<td class=\"spindle_info\">
<span class=\"spindle_name\" style=\"color: $spindle_color;\" onclick=\"toThreads('$spindle_uqid','$spindle_name');\">
<i class=\"fa fa-external-link-square\" aria-hidden=\"true\"></i> <span id=\"$spindle_uqid\">$spindle_name</span>
</span>
</td>
<td class=\"spindle_actcont\">
<i class=\"fa fa-circle\" aria-hidden=\"true\" style=\"font-size: 8px; color: $spindle_actdot;\"></i>
</td>
</tr>
</table>
<span class=\"spindle_desc\">
$spindle_desc
</span> <br>";
$subspindles_q = mysqli_query($conx, "SELECT * FROM forum_subspindles WHERE spindle_uqid='$spindle_uqid' ORDER BY id ASC");
while($subspindles_r = mysqli_fetch_assoc($subspindles_q)) {
$s_spindle_uqid = $subspindles_r['spindle_uqid'];
$subspindle_uqid = $subspindles_r['uqid'];
$subspindle_name = $subspindles_r['name'];
$coolsplit = "1";
echo "<span class=\"spindle_subname\" style=\"color: $spindle_color;\" onclick=\"toThreads('$s_spindle_uqid$coolsplit$subspindle_uqid','$subspindle_name');\">
<i class=\"fa fa-external-link-square\" aria-hidden=\"true\"></i> <span id=\"$s_spindle_uqid$coolsplit$subspindle_uqid\">$subspindle_name</span>
</span> <br>";
}
echo "</div>";
}
?>
<script>
function toThreads(name,loading_name) {
document.getElementById(name).innerHTML = loading_name + "..";
var uqid = name;
$.get("threads.php?u=" + uqid, function(d) {
$("#action_bar_page").html(d);
});
}
</script>

View file

@ -0,0 +1,61 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$get_thread_id = safe($_GET['i']);
$threads_q = mysqli_query($conx, "SELECT id,spindle_uqid,content FROM forum_threads WHERE id='$get_thread_id'");
$thread_exist = mysqli_num_rows($threads_q);
$threads_r = mysqli_fetch_assoc($threads_q);
$thread_id = $threads_r['id'];
$thread_spindle_uqid = $threads_r['spindle_uqid'];
$thread_content = $threads_r['content'];
if($thread_exist == '0') {
exit();
}
echo "<span id=\"refresh\" onclick=\"refresh('$thread_id');\">refresh</span> <br><br>";
?>
<style>
/* CONTENT HERE FOR THIS PAGE */
/* MAKE SURE TO ADD TO THEMES */
/* CONTENT HERE FOR THIS PAGE */
.threads_cont {
width: 90%;
max-width: 450px;
padding: 8px;
background-color: #fff;
font-family: 'Dosis', sans-serif;
text-align: left;
}
</style>
<?php
$thread_q = mysqli_query($conx, "SELECT * FROM forum_threads WHERE id='$thread_id'");
$thread_r = mysqli_fetch_assoc($thread_q);
$thread_name = $thread_r['name'];
$thread_uid = $thread_r['uid'];
$usr_q = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$thread_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
$thread_username = $usr_r['username'];
$usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$thread_uid' && theme_id='$g_themeid'");
while($usri_r = mysqli_fetch_assoc($usri_q)) {
$username_color = $usri_r['username_color'];
$thread_tcolor = $usri_r['text_color'];
echo "<div class=\"threads_cont\">hi</div>";
}
}
?>
<script>
function toThreads(uqid) {
document.getElementById('goback').innerHTML = "go back..";
$.get("threads.php?u=" + uqid, function(d) {
$("#action_bar_page").html(d);
});
}
function refresh(id) {
document.getElementById('refresh').innerHTML = "refresh..";
$.get("thread.php?i=" + id, function(d) {
$("#action_bar_page").html(d);
});
}
</script>

View file

@ -0,0 +1,6 @@
<?php
require_once("../inc/conx.php");
$spindle_uqid = safe($_GET['u']);
$cntq = mysqli_query($conx, "SELECT id FROM forum_threads WHERE spindle_uqid='$spindle_uqid' && draft='no'");
echo mysqli_num_rows($cntq);
?>

View file

@ -0,0 +1,537 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$default_spindle_uqid = safe($_GET['u']);
$split = explode('1', $default_spindle_uqid);
$spindle_uqid = $split[0];
$subspindle_uqid = $split[1];
/* GET SPINDLE INFO */
$spindles_q = mysqli_query($conx, "SELECT name,color,description,tstamp FROM forum_spindles WHERE uqid='$spindle_uqid'");
while($spindles_r = mysqli_fetch_assoc($spindles_q)) {
$spindle_color = $spindles_r['color'];
$spindle_name = $spindles_r['name'];
$spindle_desc = $spindles_r['description'];
$spindle_tstamp = $spindles_r['tstamp'];
$spindle_actstamp = time() - $spindle_tstamp;
$minutes = round($spindle_actstamp / 60);
if($minutes <= 60) {
$spindle_actdot = "#00FF00";
}
elseif($minutes <= 90) {
$spindle_actdot = "#FFA500";
}
elseif($minutes < 120) {
$spindle_actdot = "#FF0000";
}
else {
$spindle_actdot = "#FF0000";
}
}
/* IF IT IS A SUBSPINDLE */
if($subspindle_uqid != '') {
$this_subspindle = true;
/* GET SUBSPINDLE INFO */
$spindles_q = mysqli_query($conx, "SELECT name FROM forum_subspindles WHERE uqid='$subspindle_uqid'");
while($spindles_r = mysqli_fetch_assoc($spindles_q)) {
$subspindle_name = $spindles_r['name'];
if($subspindle_name != '') {
$subspindle_name = "<br><span style=\"font-size: 12px;\">$subspindle_name</span>";
}
}
}
?>
<style>
/* CONTENT HERE FOR THIS PAGE */
/* MAKE SURE TO ADD TO THEMES */
/* CONTENT HERE FOR THIS PAGE */
.threads_cont {
width: 90%;
max-width: 450px;
padding: 8px;
background-color: #fff;
font-family: 'Dosis', sans-serif;
text-align: left;
border-bottom: 1px dotted #ccc;
}
.spindle_details {
width: 90%;
max-width: 450px;
padding: 8px;
background-color: #fff;
font-family: 'Dosis', sans-serif;
text-align: left;
}
.spindle_tools {
width: 90%;
max-width: 450px;
padding: 8px;
background-color: #fff;
font-family: 'Dosis', sans-serif;
text-align: left;
}
.thread_name {
font-weight: bold;
font-size: 15px;
}
.spindle_subname {
font-weight: bold;
font-size: 12px;
}
.spindle_desc {
color: #808080;
font-size: 13px;
text-align: center;
}
.spindle_info_cont {
border-collapse: collapse;
width: 100%;
}
.spindle_info {
padding: 0;
margin: 0;
width: 100%;
text-align: center;
}
.spindle_actcont {
padding: 0;
margin: 0;
width: 50%;
text-align: right;
}
.thread_info {
padding: 0;
margin: 0;
width: 100%;
text-align: left;
}
.thread_actcont {
padding: 0;
margin: 0;
width: 50%;
text-align: right;
}
#forum_no_threads {
color: #808080;
}
#thrd_snippet {
color: #808080;
font-size: 12px;
}
#threads_loadmore {
font-family: 'Dosis', sans-serif;
outline: none;
width: 90%;
max-width: 450px;
padding: 8px;
color: #fff;
text-align: center;
}
.thread_post_cont {
font-size: 17px;
width: 80%;
max-width: 400px;
padding: 8px;
background-color: #fff;
font-family: 'Dosis', sans-serif;
text-align: left;
}
.thread_post_input {
font-family: 'Dosis', sans-serif;
padding: 5px;
width: 95%;
font-size: 18px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: none;
background-color: #fff;
color: #000;
}
.thread_post_input::-webkit-input-placeholder {
color: #808080;
}
.thread_post_input:-moz-placeholder {
color: #808080;
opacity: 1;
}
.thread_post_input::-moz-placeholder {
color: #808080;
opacity: 1;
}
.thread_post_input:-ms-input-placeholder {
color: #808080;
}
.thread_content_tools {
text-align: center;
font-family: 'Dosis', sans-serif;
background-color: #fff;
width: 95%;
max-width: 500px;
padding: 8px;
padding-bottom: 0px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
word-break: break-all;
color: #000;
font-size: 18px;
font-weight: normal;
}
#thread_content_input {
text-align: left;
font-family: 'Dosis', sans-serif;
background-color: #fff;
width: 95%;
max-width: 500px;
padding: 8px;
padding-top: 0px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
outline: none;
word-break: break-all;
color: #000;
font-size: 18px;
font-weight: normal;
}
#thread_content_input[placeholder]:empty:before {
content: attr(placeholder);
color: #808080;
font-weight: normal;
font-size: 18px;
}
#threadpost_upd {
text-align: center;
font-family: 'Dosis', sans-serif;
width: 80%;
max-width: 400px;
padding: 3px;
padding-left: 8px;
padding-right: 8px;
background-color: #fff;
color: #808080;
font-size: 13px;
border-bottom: 1px dotted #ccc;
}
</style>
<div id="spindle_newthread" style="display: none;">
<div id="threadpost_upd">
no changes detected
</div>
<div class="thread_post_cont">
<span style="font-weight: bold; color: <?php echo $spindle_color; ?>;">Title</span> <br>
<span style="font-size: 13px; font-weight: normal; color: #808080;">
You can use a maximum of 50 characters for your title.
</span> <br>
<input id="thread_title_input" class="thread_post_input" placeholder="Enter Title" maxlength="50">
<span style="font-weight: bold; color: <?php echo $spindle_color; ?>;">Content</span> <br>
<span style="font-size: 13px; font-weight: normal; color: #808080;">
Be sure that you are within the appropriate Spindle before posting. <br>
You can restore previously saved drafts <span onclick="loadRestore('<?php echo $default_spindle_uqid; ?>');" style="text-decoration: underline;">here.</span>
<span id="drafts_load" style="display: none;"></span>
</span> <br>
<div class="thread_content_tools">
<center>
<table style="width: 100%;text-align: center; font-size: 13px; font-weight: bold;">
<tr>
<td onclick="insertBold();" style="color: #fff; padding: 5px; border-radius: 15px; color: <?php echo $spindle_color; ?>;">
<i class="fa fa-bold" aria-hidden="true"></i>
</td>
<td onclick="insertItalic();" style="color: #fff; padding: 5px; border-radius: 15px; color: <?php echo $spindle_color; ?>;">
<i class="fa fa-italic" aria-hidden="true"></i>
</td>
<td onclick="insertUnderline();" style="color: #fff; padding: 5px; border-radius: 15px; color: <?php echo $spindle_color; ?>;">
<i class="fa fa-underline" aria-hidden="true"></i>
</td>
<td onclick="insertStrikethrough();" style="color: #fff; padding: 5px; border-radius: 15px; color: <?php echo $spindle_color; ?>;">
<i class="fa fa-strikethrough" aria-hidden="true"></i>
</td>
<td onclick="selectFile();" id="fPath" style="color: #fff; padding: 5px; border-radius: 15px; color: <?php echo $spindle_color; ?>;">
<i class="fa fa-picture-o" aria-hidden="true"></i>
<form id="imgUpl" action="img_upload.php" enctype="multipart/form-data" method="post">
<input id="fBrowse" name="img" type="file" style="display: none;">
</form>
</td>
<td onclick="insertYouTube();" style="color: #fff; padding: 5px; border-radius: 15px; color: <?php echo $spindle_color; ?>;">
<i class="fa fa-youtube" aria-hidden="true"></i>
</td>
<td onclick="insertLeftAlign();" style="color: #fff; padding: 5px; border-radius: 15px; color: <?php echo $spindle_color; ?>;">
<i class="fa fa-align-left" aria-hidden="true"></i>
</td>
<td onclick="insertCenterAlign();" style="color: #fff; padding: 5px; border-radius: 15px; color: <?php echo $spindle_color; ?>;">
<i class="fa fa-align-center" aria-hidden="true"></i>
</td>
<td onclick="insertRightAlign();" style="color: #fff; padding: 5px; border-radius: 15px; color: <?php echo $spindle_color; ?>;">
<i class="fa fa-align-right" aria-hidden="true"></i>
</td>
</tr>
</table>
</center>
</div>
<div id="thread_content_input" placeholder="Enter Content" contenteditable=""></div>
<table style="width: 100%;text-align: center; font-size: 12px; font-weight: bold;">
<tr>
<td onclick="pushThread('save','<?php echo $default_spindle_uqid; ?>')" style="color: #fff; padding: 5px; border-radius: 15px; width: 33.33%; background-color: <?php echo $spindle_color; ?>;">
<i class="fa fa-floppy-o" aria-hidden="true"></i> save draft
</td>
<td onclick="pushThread('post','<?php echo $default_spindle_uqid; ?>')" style="color: #fff; padding: 5px; border-radius: 15px; width: 33.33%; background-color: <?php echo $spindle_color; ?>;">
<i class="fa fa-pencil-square-o" aria-hidden="true"></i> post
</td>
<td onclick="expand('spindle_newthread');" style="color: #fff; padding: 5px; border-radius: 15px; width: 33.33%; background-color: <?php echo $spindle_color; ?>;">
<i class="fa fa-times-circle-o" aria-hidden="true"></i> close
</td>
</tr>
</table>
</div>
<br>
</div>
<?php
echo "<div id=\"ld_threads\">";
require_once("actual_threads.php");
echo "</div>";
if($thread_count > 10) {
echo "<div id=\"more_div\" onclick=\"loadThreads('$spindle_color');\">";
echo "<div id=\"threads_loadmore\" style=\"background-color: $spindle_color;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></div>";
echo "</div>";
}
?>
<input id="amount" type="hidden" value="10">
<script>
function loadRestore(uqid) {
$.get("saved_drafts.php?u=" + uqid, function(d) {
$("#drafts_load").html(d);
});
expandIt('drafts_load');
}
function pushThread(type,uqid) {
var title = document.getElementById("thread_title_input").value;
var content = $('#thread_content_input').html();
var content = htmlToText(content);
if(type == 'save') {
document.getElementById('threadpost_upd').innerHTML = "saving draft..";
}
if(type == 'post') {
document.getElementById('threadpost_upd').innerHTML = "posting thread..";
}
$.ajax({
url: 'push_thread.php',
type: 'POST',
data: { type: type, uqid: uqid, title: title, content: content },
success: function(data){
if(data == '') {
if(type == 'post') {
expand('spindle_newthread');
document.getElementById("thread_content_input").innerHTML = '';
document.getElementById("thread_title_input").value = '';
refreshThreads(uqid);
}
if(type == 'save') {
document.getElementById('threadpost_upd').innerHTML = "saved draft";
$.get("saved_drafts.php?u=" + uqid, function(d) {
$("#drafts_load").html(d);
});
document.getElementById("thread_content_input").innerHTML = '';
document.getElementById("thread_title_input").value = '';
}
}
},
error: function(data) {
alert('error');
}
});
}
function selectFile() {
document.getElementById('fBrowse').click();
document.getElementById('fPath').value = document.getElementById('fBrowse').value;
}
var form = document.forms.namedItem("imgUpl");
form.addEventListener('change', function(ev) {
var oOutput = document.querySelector("div"),
oData = new FormData(form);
var oReq = new XMLHttpRequest();
document.getElementById('threadpost_upd').innerHTML = "uploading image..";
oReq.open("POST", "img_upload.php", true);
oReq.onload = function(oEvent) {
if(oReq.status == 200) {
var img_url = oReq.responseText;
if(img_url != '') {
var atoinp = "[img]" + img_url + "[/img]";
document.getElementById('threadpost_upd').innerHTML = "image uploaded";
document.getElementById("thread_content_input").innerHTML = document.getElementById("thread_content_input").innerHTML + atoinp;
}
form.reset();
}
};
oReq.send(oData);
ev.preventDefault();
}, false);
function restoreDraft() {
var thread_id = $("#restore_drft").val();
var forum_content_input = document.getElementById("thread_content_input");
var forum_title_input = document.getElementById("thread_title_input");
if(confirm('Are you sure? Any text entered in the fields below will be erased and replaced. This cannot be undone.')) {
var restore_draft = new XMLHttpRequest();
restore_draft.open("GET", "draft_restore.php?i=" + thread_id, true);
restore_draft.onreadystatechange = function(){
if(restore_draft.readyState == 4)
if(restore_draft.status == 200) {
var draft_restored = restore_draft.responseText;
var information = draft_restored.split('--|~|1|~|MD|~|1|~|--');
var forum_title_restore = information[0];
var forum_content_restore = information[1];
forum_title_input.value = forum_title_restore;
forum_content_input.innerHTML = forum_content_restore;
}
else {
alert("error");
}
};
restore_draft.send();
return false;
forum_content_input.innerHTML = 'null';
forum_title_input.value = 'null';
alert("Title:\n" + draft.title + "\nContent:\n" + draft.content);
}
}
function expandIt(id) {
var e = document.getElementById(id);
if(e.style.display == '')
e.style.display = 'none';
else
e.style.display = '';
}
function insertBold() {
document.getElementById("thread_content_input").innerHTML = document.getElementById("thread_content_input").innerHTML + "[b][/b]";
}
function insertItalic() {
document.getElementById("thread_content_input").innerHTML = document.getElementById("thread_content_input").innerHTML + "[i][/i]";
}
function insertUnderline() {
document.getElementById("thread_content_input").innerHTML = document.getElementById("thread_content_input").innerHTML + "[u][/u]";
}
function insertStrikethrough() {
document.getElementById("thread_content_input").innerHTML = document.getElementById("thread_content_input").innerHTML + "[s][/s]";
}
function insertYouTube() {
document.getElementById("thread_content_input").innerHTML = document.getElementById("thread_content_input").innerHTML + "[yt][/yt]";
}
function insertLeftAlign() {
document.getElementById("thread_content_input").innerHTML = document.getElementById("thread_content_input").innerHTML + "[left][/left]";
}
function insertCenterAlign() {
document.getElementById("thread_content_input").innerHTML = document.getElementById("thread_content_input").innerHTML + "[center][/center]";
}
function insertRightAlign() {
document.getElementById("thread_content_input").innerHTML = document.getElementById("thread_content_input").innerHTML + "[right][/right]";
}
function refreshThreads(uqid) {
$.get("actual_threads.php?u=" + uqid, function(d) {
$("#ld_threads").html(d);
});
document.getElementById("amount").value = Number(10);
document.getElementById("more_div").innerHTML = '<div id=\"threads_loadmore\" style=\"background-color: <?php echo $spindle_color; ?>;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></div>';
}
function loadThreads(spindle_color) {
document.getElementById("more_div").innerHTML = '<div id=\"threads_loadmore\" style=\"background-color: ' + spindle_color + ';\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></div>';
var amount = document.getElementById("amount").value;
var content = document.getElementById("ld_threads");
$.ajax({
type: 'get',
url: 'more_threads.php?u=<?php echo $default_spindle_uqid; ?>',
data: {
amntcnt:amount
},
success: function(more_content) {
content.innerHTML = content.innerHTML+more_content;
document.getElementById("amount").value = Number(amount)+10;
}
});
var getcount = new XMLHttpRequest();
getcount.open("GET", "thread_count.php?u=<?php echo $default_spindle_uqid; ?>", true);
getcount.onreadystatechange = function(){
if(getcount.readyState == 4)
if(getcount.status == 200) {
document.getElementById("more_div").innerHTML = '<div id=\"threads_loadmore\" style=\"background-color: ' + spindle_color + ';\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></div>';
var numCont = getcount.responseText;
if(numCont <= Number(amount) + 10) {
document.getElementById("more_div").innerHTML = "";
}
}
else{
alert("error");
document.getElementById("more_div").innerHTML = '<div id=\"threads_loadmore\" style=\"background-color: ' + spindle_color + ';\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></div>';
}
};
getcount.send();
return false;
}
function toThread(id,loading_name) {
document.getElementById("thd_" + id).innerHTML = loading_name + "..";
$.get("thread.php?i=" + id, function(d) {
$("#action_bar_page").html(d);
});
}
/**
* Returns the style for a node.
*
* @param n The node to check.
* @param p The property to retrieve (usually 'display').
* @link http://www.quirksmode.org/dom/getstyles.html
*/
function getNodeStyle( n, p ) {
return n.currentStyle ?
n.currentStyle[p] :
document.defaultView.getComputedStyle(n, null).getPropertyValue(p);
}
//IF THE NODE IS NOT ACTUALLY IN THE DOM then this won't take into account <div style="display: inline;">text</div>
//however for simple things like `contenteditable` this is sufficient, however for arbitrary html this will not work
function isNodeBlock(node) {
if (node.nodeType == document.TEXT_NODE) {return false;}
var d = getNodeStyle( node, 'display' );//this is irrelevant if the node isn't currently in the current DOM.
if (d.match( /^block/ ) || d.match( /list/ ) || d.match( /row/ ) ||
node.tagName == 'BR' || node.tagName == 'HR' ||
node.tagName == 'DIV' // div,p,... add as needed to support non-DOM nodes
) {
return true;
}
return false;
}
/**
* Converts HTML to text, preserving semantic newlines for block-level
* elements.
*
* @param node - The HTML node to perform text extraction.
*/
function htmlToText( htmlOrNode, isNode ) {
var node = htmlOrNode;
if (!isNode) {node = jQuery("<span>"+htmlOrNode+"</span>")[0];}
//TODO: inject "unsafe" HTML into current DOM while guaranteeing that it won't
// change the visible DOM so that `isNodeBlock` will work reliably
var result = '';
if( node.nodeType == document.TEXT_NODE ) {
// Replace repeated spaces, newlines, and tabs with a single space.
result = node.nodeValue.replace( /\s+/g, ' ' );
} else {
for( var i = 0, j = node.childNodes.length; i < j; i++ ) {
result += htmlToText( node.childNodes[i], true );
if (i < j-1) {
if (isNodeBlock(node.childNodes[i])) {
result += '\n';
} else if (isNodeBlock(node.childNodes[i+1]) &&
node.childNodes[i+1].tagName != 'BR' &&
node.childNodes[i+1].tagName != 'HR') {
result += '\n';
}
}
}
}
return result;
}
</script>

View file