Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
08fe66906c | |||
66300ccd71 | |||
f542656bc9 | |||
0ef97c4889 |
9 changed files with 82 additions and 135 deletions
|
@ -4,8 +4,6 @@ require(__DIR__ . "/../libs/page.php");
|
||||||
require(__DIR__ . "/../libs/form.php");
|
require(__DIR__ . "/../libs/form.php");
|
||||||
require(__DIR__ . "/../libs/comment.php");
|
require(__DIR__ . "/../libs/comment.php");
|
||||||
|
|
||||||
$ref = 1732684297;
|
|
||||||
|
|
||||||
page_header();
|
page_header();
|
||||||
comments("comment", $_GET['id']);
|
comments("comment", $_GET['id']);
|
||||||
page_footer();
|
page_footer();
|
||||||
|
|
|
@ -202,6 +202,10 @@ iframe {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header a.leave {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.clickie {
|
.clickie {
|
||||||
width: min-content;
|
width: min-content;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
|
|
|
@ -4,26 +4,17 @@ require(__DIR__ . "/../libs/form.php");
|
||||||
require(__DIR__ . "/../libs/comment.php");
|
require(__DIR__ . "/../libs/comment.php");
|
||||||
|
|
||||||
page_header();
|
page_header();
|
||||||
if (!is_null($username)) {
|
if (!($_GET['page'] > 0) && is_null($username)) { ?>
|
||||||
//comments("root","root");
|
|
||||||
}
|
|
||||||
if (!($_GET['page'] > 0)) { ?>
|
|
||||||
<div class="banner"><img class="banner-background" src="/img/newlogo.svg">
|
<div class="banner"><img class="banner-background" src="/img/newlogo.svg">
|
||||||
<div class="banner-content">
|
<div class="banner-content">
|
||||||
<h1>BiglyChat</h1>
|
<h1>BiglyChat</h1>
|
||||||
<pre>BiglyChat is a social environment with active developers who respond to community feedback.</pre>
|
<pre>BiglyChat is a social environment for the cool creative projects on Dervland.</pre>
|
||||||
<pre>It features a <a class='link' href='/stats.php'>custom algorithm</a>, <a class='link' href='https://gw.dervland.net/'>cool web games</a>, and much more.</pre>
|
|
||||||
<pre>Anyone can <a class='link' href='/register.php'>join our community</a> and become a part of BiglyChat.</pre>
|
|
||||||
<h2>Community</h2>
|
|
||||||
|
|
||||||
<a class="form-button" href="/tou.php">Terms of Use</a>
|
<a class="form-button" href="/tou.php">Terms of Use</a>
|
||||||
<a class="form-button" href="https://dervland.net/">More Projects</a>
|
<a class="form-button" href="https://dervland.net/">Dervland</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
//if (is_null($username)) {
|
|
||||||
comments("root", "root");
|
comments("root", "root");
|
||||||
//}
|
|
||||||
page_footer();
|
page_footer();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -50,28 +50,13 @@ function get_handler()
|
||||||
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
||||||
}
|
}
|
||||||
get_handler();
|
get_handler();
|
||||||
//todo: rewrite
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h2>Following</h2>
|
<h2>Following</h2>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
foreach ($following as $user) {
|
foreach ($following as $user) {
|
||||||
$usern = $user['username']; ?>
|
user_block($user['username'], false, false);
|
||||||
<div class='comment'>
|
|
||||||
<div class="avatar">
|
|
||||||
<img src="/pfp/<?php echo $usern ?>.png" class="avatar-img">
|
|
||||||
<div>
|
|
||||||
<div><b>
|
|
||||||
<a class="link" href="/user.php?id=<?php echo $usern ?>">
|
|
||||||
<?php echo $usern ?>
|
|
||||||
</a>
|
|
||||||
</b>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -79,23 +64,7 @@ get_handler();
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
foreach ($followers as $user) {
|
foreach ($followers as $user) {
|
||||||
$usern = $user['target']; ?>
|
user_block($user['target'], false, false);
|
||||||
<div class='comment'>
|
|
||||||
<div class="avatar">
|
|
||||||
<img src="/pfp/<?php echo $usern ?>.png" class="avatar-img">
|
|
||||||
<div>
|
|
||||||
<div><b>
|
|
||||||
<a class="link" href="/user.php?id=<?php echo $usern ?>">
|
|
||||||
<?php echo $usern ?>
|
|
||||||
</a>
|
|
||||||
</b>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
page_footer();
|
page_footer();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -44,6 +44,12 @@ function post_handler()
|
||||||
$stmt = $db->prepare("INSERT INTO main.auth (username, password) VALUES (?, ?)");
|
$stmt = $db->prepare("INSERT INTO main.auth (username, password) VALUES (?, ?)");
|
||||||
$stmt->execute([$user,$hashed]);
|
$stmt->execute([$user,$hashed]);
|
||||||
|
|
||||||
|
$token = bin2hex(random_bytes(32));
|
||||||
|
$stmt = $db->prepare("INSERT INTO main.token (username, token) VALUES (?, ?)");
|
||||||
|
$stmt->execute([$user,$token]);
|
||||||
|
|
||||||
|
setcookie("token", $token, time() + 3600 * 24);
|
||||||
|
|
||||||
header("Location: /");
|
header("Location: /");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,22 +27,9 @@ function get_handler()
|
||||||
$api = file_get_contents($node_backend . "/top?ref=" . $_GET['username']);
|
$api = file_get_contents($node_backend . "/top?ref=" . $_GET['username']);
|
||||||
$pr = json_decode($api);
|
$pr = json_decode($api);
|
||||||
|
|
||||||
foreach ($pr as $usern => $rr) { ?>
|
foreach ($pr as $usern => $rr) {
|
||||||
<div class='comment'>
|
user_block($usern, $rr, "Popularity");
|
||||||
<div class="avatar">
|
}
|
||||||
<img src="/pfp/<?php echo $usern ?>.png" class="avatar-img">
|
|
||||||
<div>
|
|
||||||
<div><b>
|
|
||||||
<a class="link" href="/user.php?id=<?php echo $usern ?>">
|
|
||||||
<?php echo $usern ?>
|
|
||||||
</a>
|
|
||||||
</b>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div><b>Power</b>: <?php echo $rr ?></div>
|
|
||||||
</div>
|
|
||||||
<?php }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_handler();
|
get_handler();
|
||||||
|
|
|
@ -32,18 +32,7 @@ function comments($typer, $idr, $disable = false)
|
||||||
$qss['page'] = $page - 1;
|
$qss['page'] = $page - 1;
|
||||||
$qs_prev = http_build_query($qss);
|
$qs_prev = http_build_query($qss);
|
||||||
$qss['page'] = $page;
|
$qss['page'] = $page;
|
||||||
|
|
||||||
$qss['mode'] = 'all';
|
|
||||||
$qs_1 = http_build_query($qss);
|
|
||||||
|
|
||||||
$qss['mode'] = 'followers';
|
|
||||||
$qs_2 = http_build_query($qss);
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div>
|
|
||||||
<a class="form-button" href="?<?php echo $qs_1 ?>">Everyone</a>
|
|
||||||
<a class="form-button" href="?<?php echo $qs_2 ?>">Following</a>
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<?php if ($page > 0) { ?>
|
<?php if ($page > 0) { ?>
|
||||||
<a class="form-button" href="?<?php echo $qs_prev ?>">Previous</a>
|
<a class="form-button" href="?<?php echo $qs_prev ?>">Previous</a>
|
||||||
|
|
|
@ -2,40 +2,24 @@
|
||||||
function markdown($text)
|
function markdown($text)
|
||||||
{
|
{
|
||||||
$search = array(
|
$search = array(
|
||||||
'~(https://[^.]+\.dervland\.net/[^\s<]+\.(png|jpg|jpeg|gif))~i',
|
'~(https://[^.]+\.dervland\.net/[^\s<]+\.(png|jpg|jpeg|gif))~i',
|
||||||
'~(https://[^.]+\.dervland\.net/[^\s<]+\.(mp3|wav))~i',
|
'~(https://[^.]+\.dervland\.net/[^\s<]+\.(mp3|wav))~i',
|
||||||
'~(https://[^.]+\.dervland\.net/[^\s<]+\.(webm|mp4))~i',
|
'~(https://[^.]+\.dervland\.net/[^\s<]+\.(webm|mp4))~i',
|
||||||
//'~(https://studio\.penguinmod\.com/[^\s<?#]*[#]([^\s<]*))~i',
|
//'~(https://studio\.penguinmod\.com/[^\s<?#]*[#]([^\s<]*))~i',
|
||||||
//'~(https://studio\.penguinmod\.com/[^\s<?#]*[?#]?([^\s<#]*)[#]?([^\s<]*))~i',
|
//'~(https://studio\.penguinmod\.com/[^\s<?#]*[?#]?([^\s<#]*)[#]?([^\s<]*))~i',
|
||||||
'~(?:\s|^)(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i',
|
'~(?:\s|^)(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i',
|
||||||
'~(?:@)([^\s]+)(?:\s|$)~i',
|
'~(?:@)([^\s]+)(?:\s|$)~i',
|
||||||
'~(\[b\])(.*?)(\[\/b\])~i',
|
);
|
||||||
'~(\[i\])(.*?)(\[\/i\])~i',
|
|
||||||
'~(\[u\])(.*?)(\[\/u\])~i',
|
|
||||||
'~(\[ul\])(.*?)(\[\/ul\])~i',
|
|
||||||
'~(\[li\])(.*?)(\[\/li\])~i',
|
|
||||||
'~(\[h\])(.*?)(\[\/h\])~i',
|
|
||||||
'~(\[url=)(.*?)(\])(.*?)(\[\/url\])~i',
|
|
||||||
'~(\[url\])(.*?)(\[\/url\])~i'
|
|
||||||
);
|
|
||||||
|
|
||||||
$replace = array(
|
$replace = array(
|
||||||
'<a class="link" href="$1" target="_blank"><div>$1</div><img src="$1" class="img"></a>',
|
'<a class="link" href="$1" target="_blank"><div>$1</div><img src="$1" class="img"></a>',
|
||||||
'<a class="link" href="$1" target="_blank"><div>$1</div><audio controls src="$1"></a>',
|
'<a class="link" href="$1" target="_blank"><div>$1</div><audio controls src="$1"></a>',
|
||||||
'<a class="link" href="$1" target="_blank"><div>$1</div><video controls class="img"><source src="$1"/></video></a>',
|
'<a class="link" href="$1" target="_blank"><div>$1</div><video controls class="img"><source src="$1"/></video></a>',
|
||||||
//'https://studio.penguinmod.com/?#$2',
|
//'https://studio.penguinmod.com/?#$2',
|
||||||
//'<a class="link" href="$1" target="_blank"><div>$1</div><iframe src="https://studio.penguinmod.com/embed?$2#$3"></iframe></a>',
|
//'<a class="link" href="$1" target="_blank"><div>$1</div><iframe src="https://studio.penguinmod.com/embed?$2#$3"></iframe></a>',
|
||||||
'<a class="link" href="$0" target="_blank">$0</a>',
|
'<a class="link" href="$0" target="_blank">$0</a>',
|
||||||
'<a class="link" href="/user.php?id=$1" target="_blank">@$1</a>',
|
'<a class="link" href="/user.php?id=$1" target="_blank">@$1</a>',
|
||||||
'<strong>$2</strong>',
|
);
|
||||||
'<em>$2</em>',
|
|
||||||
'<u>$2</u>',
|
|
||||||
'<ul>$2</ul>',
|
|
||||||
'<li>$2</li>',
|
|
||||||
'<h2>$2</h2>',
|
|
||||||
'<a class="link" href="$2" target="_blank">$4</a>',
|
|
||||||
'<a class="link" href="$2" target="_blank">$2</a>'
|
|
||||||
);
|
|
||||||
|
|
||||||
$text = preg_replace($search, $replace, $text);
|
$text = preg_replace($search, $replace, $text);
|
||||||
|
|
||||||
|
|
|
@ -7,39 +7,58 @@ function page_header()
|
||||||
global $username;
|
global $username;
|
||||||
$stmt = $db->prepare("SELECT * FROM comment WHERE targetType = ? AND targetId = ? ORDER BY date DESC");
|
$stmt = $db->prepare("SELECT * FROM comment WHERE targetType = ? AND targetId = ? ORDER BY date DESC");
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
"notification",
|
"notification",
|
||||||
$username,
|
$username,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$posts2 = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
$posts2 = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
||||||
$edge = count($posts2);
|
$edge = count($posts2);
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>BiglyChat</title>
|
<title>BiglyChat</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1">
|
||||||
<link rel="icon" href="/img/bgc.svg">
|
<link rel="icon" href="/img/bgc.svg">
|
||||||
<link rel="stylesheet" href="/css/main.css">
|
<link rel="stylesheet" href="/css/main.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<a href="/"><img class="header-img header-link" src="/img/bgc.svg">BiglyChat</a>
|
<a href="/index.php"><img class="header-img header-link" src="/img/bgc.svg">BiglyChat</a>
|
||||||
<?php if (isset($username)) { ?>
|
<?php if (isset($username)) { ?>
|
||||||
<a href="/user.php?id=<?php echo $username ?>"><img class="header-img header-link" src="/pfp/<?php echo $username ?>.png">Wall</a>
|
<a href="/index.php?mode=followers"><img class="header-img header-link" src="/img/bgc.svg">Feed</a>
|
||||||
<a href="/notif.php"> <img class="header-img header-link" src="/img/mail.svg"><span>Mail<sub> <?php echo $edge?></sub></span></a>
|
<a href="/user.php?id=<?php echo $username ?>"><img class="header-img header-link" src="/pfp/<?php echo $username ?>.png">Wall</a>
|
||||||
<a href="/stats.php?username=<?php echo $username ?>"><img class="header-img header-link" src="/img/home.svg">Users</a>
|
<a href="/stats.php?username=<?php echo $username ?>"><img class="header-img header-link" src="/img/home.svg">Users</a>
|
||||||
<a href="/logout.php"><img class="header-img header-link" src="/img/logout.svg">Leave</a>
|
<a href="/notif.php"> <img class="header-img header-link" src="/img/mail.svg"><span>Mail<sub> <?php echo $edge?></sub></span></a>
|
||||||
<?php } else { ?>
|
<a href="/logout.php" class='leave'><img class="header-img header-link" src="/img/logout.svg">Leave</a>
|
||||||
<a href="/login.php"><img class="header-img header-link" src="/img/home.svg">Join</a>
|
<?php } else { ?>
|
||||||
<a href="/stats.php"><img class="header-img header-link" src="/img/home.svg">Users</a>
|
<a href="/login.php"><img class="header-img header-link" src="/img/home.svg">Join</a>
|
||||||
<?php }
|
<a href="/stats.php"><img class="header-img header-link" src="/img/home.svg">Users</a>
|
||||||
?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<?php }
|
<?php
|
||||||
|
}
|
||||||
function page_footer()
|
function page_footer()
|
||||||
{ ?>
|
{
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<?php }
|
|
||||||
?>
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php }
|
||||||
|
function user_block($usern, $meta, $tag)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<div class='comment'>
|
||||||
|
<div class="avatar">
|
||||||
|
<img src="/pfp/<?php echo $usern ?>.png" class="avatar-img">
|
||||||
|
<div>
|
||||||
|
<b>
|
||||||
|
<a class="link" href="/user.php?id=<?php echo $usern ?>">
|
||||||
|
<?php echo $usern ?>
|
||||||
|
</a>
|
||||||
|
</b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php echo (is_null($meta) || !$meta) ? '' : "<b>$tag</b>: $meta"; ?>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
?>
|
||||||
|
|
Loading…
Reference in a new issue