Compare commits
No commits in common. "master" and "v0.1.1" have entirely different histories.
12 changed files with 135 additions and 102 deletions
|
@ -4,6 +4,8 @@ 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,10 +202,6 @@ 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,17 +4,25 @@ require(__DIR__ . "/../libs/form.php");
|
||||||
require(__DIR__ . "/../libs/comment.php");
|
require(__DIR__ . "/../libs/comment.php");
|
||||||
|
|
||||||
page_header();
|
page_header();
|
||||||
if (!($_GET['page'] > 0) && is_null($username)) { ?>
|
if (!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 for the cool creative projects on Dervland.</pre>
|
<pre>BiglyChat is a social environment with active developers who respond to community feedback.</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>
|
||||||
|
<pre><i>BiglyChat is currently on version <a href='<?php echo htmlspecialchars(exec("git remote get-url origin"))?>' class='link'><?php echo exec("git describe --exact-match --tags") ?></b></a>.</i></pre>
|
||||||
<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/">Dervland</a>
|
<a class="form-button" href="https://dervland.net/">More Projects</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
//if (is_null($username)) {
|
||||||
comments("root", "root");
|
comments("root", "root");
|
||||||
|
//}
|
||||||
page_footer();
|
page_footer();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -50,13 +50,28 @@ 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) {
|
||||||
user_block($user['username'], false, false);
|
$usern = $user['username']; ?>
|
||||||
|
<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
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -64,7 +79,23 @@ get_handler();
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
foreach ($followers as $user) {
|
foreach ($followers as $user) {
|
||||||
user_block($user['target'], false, false);
|
$usern = $user['target']; ?>
|
||||||
|
<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();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -6,16 +6,6 @@ require(__DIR__ . "/../libs/comment.php");
|
||||||
|
|
||||||
$ref = 1732684297;
|
$ref = 1732684297;
|
||||||
|
|
||||||
$stmt = $db->prepare("DELETE FROM main.read WHERE username = ?");
|
|
||||||
$stmt->execute([$username]);
|
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT * FROM comment WHERE targetType = ? AND targetId = ? ORDER BY date");
|
|
||||||
$stmt->execute(["notification",$username]);
|
|
||||||
$counter = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
|
||||||
|
|
||||||
$stmt = $db->prepare("INSERT INTO main.read (username, msgs) VALUES (?, ?)");
|
|
||||||
$stmt->execute([$username, count($counter)]);
|
|
||||||
|
|
||||||
page_header();
|
page_header();
|
||||||
comments("notification", $username, true);
|
comments("notification", $username, true);
|
||||||
page_footer();
|
page_footer();
|
||||||
|
|
|
@ -44,12 +44,6 @@ 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,9 +27,22 @@ 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) { ?>
|
||||||
user_block($usern, $rr, "Popularity");
|
<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><b>Power</b>: <?php echo $rr ?></div>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
}
|
}
|
||||||
|
|
||||||
get_handler();
|
get_handler();
|
||||||
|
|
|
@ -32,7 +32,18 @@ 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>
|
||||||
|
|
|
@ -9,6 +9,14 @@ function markdown($text)
|
||||||
//'~(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(
|
||||||
|
@ -19,6 +27,14 @@ function markdown($text)
|
||||||
//'<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);
|
||||||
|
|
|
@ -12,15 +12,7 @@ function page_header()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$posts2 = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
$posts2 = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
||||||
|
$edge = count($posts2);
|
||||||
$stmt = $db->prepare("SELECT * FROM main.read WHERE username = ?");
|
|
||||||
$stmt->execute([
|
|
||||||
$username
|
|
||||||
]);
|
|
||||||
|
|
||||||
$counter = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
|
||||||
|
|
||||||
$edge = count($posts2) - $counter[0]['msgs'];
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
@ -32,41 +24,22 @@ function page_header()
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<a href="/index.php"><img class="header-img header-link" src="/img/bgc.svg">BiglyChat</a>
|
<a href="/"><img class="header-img header-link" src="/img/bgc.svg">BiglyChat</a>
|
||||||
<?php if (isset($username)) { ?>
|
<?php if (isset($username)) { ?>
|
||||||
<a href="/index.php?mode=followers"><img class="header-img header-link" src="/img/bgc.svg">Feed</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="/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="/notif.php"> <img class="header-img header-link" src="/img/mail.svg"><span>Mail<sub> <?php echo $edge?></sub></span></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="/logout.php" class='leave'><img class="header-img header-link" src="/img/logout.svg">Leave</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>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<a href="/login.php"><img class="header-img header-link" src="/img/home.svg">Join</a>
|
<a href="/login.php"><img class="header-img header-link" src="/img/home.svg">Join</a>
|
||||||
<a href="/stats.php"><img class="header-img header-link" src="/img/home.svg">Users</a>
|
<a href="/stats.php"><img class="header-img header-link" src="/img/home.svg">Users</a>
|
||||||
<?php } ?>
|
<?php }
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
function page_footer()
|
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
function page_footer()
|
||||||
|
{ ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<?php }
|
<?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 }
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -4,7 +4,7 @@ require(__DIR__ . "/../libs/test_secret.php");
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$sql = file_get_contents(__DIR__ .'/../scripts/init.sql', true);
|
$sql = file_get_contents('../scripts/init.sql', true);
|
||||||
|
|
||||||
$db->exec($sql);
|
$db->exec($sql);
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,4 @@ CREATE TABLE IF NOT EXISTS main.user (username TEXT, bio TEXT);
|
||||||
CREATE TABLE IF NOT EXISTS main.role (username TEXT, role TEXT);
|
CREATE TABLE IF NOT EXISTS main.role (username TEXT, role TEXT);
|
||||||
CREATE TABLE IF NOT EXISTS main.follow (username TEXT, target TEXT);
|
CREATE TABLE IF NOT EXISTS main.follow (username TEXT, target TEXT);
|
||||||
CREATE TABLE IF NOT EXISTS main.ban (username TEXT, reason TEXT);
|
CREATE TABLE IF NOT EXISTS main.ban (username TEXT, reason TEXT);
|
||||||
CREATE TABLE IF NOT EXISTS main.read (username TEXT, msgs REAL);
|
|
||||||
CREATE TABLE IF NOT EXISTS main.comment (username TEXT, targetType TEXT, targetId TEXT, date REAL, content TEXT, id TEXT);
|
CREATE TABLE IF NOT EXISTS main.comment (username TEXT, targetType TEXT, targetId TEXT, date REAL, content TEXT, id TEXT);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue