Compare commits

..

No commits in common. "master" and "v0.1.0" have entirely different histories.

9 changed files with 134 additions and 81 deletions

View file

@ -4,6 +4,8 @@ require(__DIR__ . "/../libs/page.php");
require(__DIR__ . "/../libs/form.php");
require(__DIR__ . "/../libs/comment.php");
$ref = 1732684297;
page_header();
comments("comment", $_GET['id']);
page_footer();

View file

@ -202,10 +202,6 @@ iframe {
justify-content: center;
}
.header a.leave {
margin-left: auto;
}
.clickie {
width: min-content;
margin-top: 40px;

View file

@ -4,17 +4,26 @@ require(__DIR__ . "/../libs/form.php");
require(__DIR__ . "/../libs/comment.php");
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-content">
<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>
<h2>Community</h2>
<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>
<?php
}
//if (is_null($username)) {
comments("root", "root");
//}
page_footer();
?>

View file

@ -50,13 +50,28 @@ function get_handler()
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
}
get_handler();
//todo: rewrite
?>
<h2>Following</h2>
<?php
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
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();
?>

View file

@ -44,12 +44,6 @@ function post_handler()
$stmt = $db->prepare("INSERT INTO main.auth (username, password) VALUES (?, ?)");
$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: /");
die();
}

View file

@ -27,9 +27,22 @@ function get_handler()
$api = file_get_contents($node_backend . "/top?ref=" . $_GET['username']);
$pr = json_decode($api);
foreach ($pr as $usern => $rr) {
user_block($usern, $rr, "Popularity");
}
foreach ($pr as $usern => $rr) { ?>
<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();

View file

@ -32,7 +32,18 @@ function comments($typer, $idr, $disable = false)
$qss['page'] = $page - 1;
$qs_prev = http_build_query($qss);
$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>
<?php if ($page > 0) { ?>
<a class="form-button" href="?<?php echo $qs_prev ?>">Previous</a>

View file

@ -9,6 +9,14 @@ function markdown($text)
//'~(https://studio\.penguinmod\.com/[^\s<?#]*[?#]?([^\s<#]*)[#]?([^\s<]*))~i',
'~(?:\s|^)(?:(https?)://([^\s<]+)|(www\.[^\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(
@ -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="$0" target="_blank">$0</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);

View file

@ -24,41 +24,22 @@ function page_header()
</head>
<body>
<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)) { ?>
<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="/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="/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 { ?>
<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>
<?php } ?>
</div>
<?php
}
function page_footer()
{
<?php }
?>
</div>
<?php }
function page_footer()
{ ?>
</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 }
?>