hajime/public/yuuno_index.php

156 lines
8.7 KiB
PHP
Raw Permalink Normal View History

2023-08-11 22:16:32 +00:00
<?php
print desHeader('Flashii', ['meta' => ['<script type="text/javascript">/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */var disqus_shortname = \'flashii\';/* * * DON\'T EDIT BELOW THIS LINE * * */(function () {var s = document.createElement(\'script\'); s.async = true;s.type = \'text/javascript\';s.src = \'//\' + disqus_shortname + \'.disqus.com/count.js\';(document.getElementsByTagName(\'HEAD\')[0] || document.getElementsByTagName(\'BODY\')[0]).appendChild(s);}());</script>']]);
?>
<h1 class="stylised" style="text-align: center; margin: 7px 0;">&quot;Obligatory reminder that Flashwave and Flashii are two different entities&quot;</h1>
<div class="content homepage">
<div class="content-right content-column">
<?php if($flashii->loggedIn()) { ?>
<div class="head">Hi, <?=$_SESSION['user'];?>!</div>
<img src="/a/<?=$_SESSION['uid'];?>" class="default-avatar-setting homepage-menu-avatar" />
<ul>
<li><a href="/settings/profile" class="underline">Edit profile</a></li>
<li><a href="/settings/avatar" class="underline">Change avatar</a></li>
<li><a href="/settings/sessions" class="underline">View active sessions</a></li>
</ul>
<div class="clear"></div>
<?php if($flashii->checkRank($fwSettings['sitemodRanks'])) { ?>
<div class="head">Manage</div>
<ul>
<li><a class="underline" href="/manage">Go to the management panel</a></li>
</ul>
<?php } ?>
<?php } else { ?>
<div class="head">Welcome!</div>
Welcome to Flashii! This is a site for a bunch of friends to hang out, nothing special. Anyone is pretty much welcome to register so why not have a go?
<a class="button registerbutton" href="/register">Register!</a>
<a class="button loginbutton" href="/login">Login</a>
<?php } ?>
<div class="head">Stats</div>
<?php
$getUsers = $database->query("SELECT * FROM `flashii_users` WHERE `userrole`!='0' ORDER BY `id`");
$countUsers = $getUsers->num_rows;
$getNewestUser = @end($getUsers->fetch_all(MYSQLI_ASSOC));
$getChatUsers = $database->query("SELECT * FROM `flashii_chat_online_users`")->num_rows;
$lastUserRegister = date_diff(date_create(date('Y-m-d',$getNewestUser['join_date'])), date_create(date('Y-m-d')))->format('%a');
?>
We have <b><?=$countUsers;?> <?=($countUsers == '1' ? 'user' : 'users');?></b>,
<b><a href="/u/<?=$getNewestUser['id'];?>" class="default"><?=$getNewestUser['username'];?></a></b> is the newest user,
it has been <b><?=$lastUserRegister;?> <?=($lastUserRegister == '1' ? 'day' : 'days');?></b> since the last user registered and
there are <b><?=$getChatUsers;?> <?=($getChatUsers == '1' ? 'user' : 'users');?></b> in chat right now.
<?php
if($flashii->loggedIn()) {
$getBirthdays = $database->query("SELECT * FROM `flashii_users` WHERE `userrole` != '0' ORDER BY `id`");
$getBirthdays = $getBirthdays->fetch_all(MYSQLI_ASSOC);
$birthdayCount = 0;
$birthdays = array();
foreach($getBirthdays as $userData) {
if(!empty($userData['birthdate'])) {
if(date('m-d') == substr(date('Y-m-d', $userData['birthdate']), 5, 5) || (date('y')%4 <> 0 && substr(date('Y-m-d', $userData['birthdate']), 5, 5) == '02-29' && date('m-d') == '02-28')) {
++$birthdayCount;
$birthdays[$birthdayCount] = array();
$birthdays[$birthdayCount]['id'] = $birthdayCount;
$birthdays[$birthdayCount]['uid'] = $userData['id'];
$birthdays[$birthdayCount]['uname'] = $userData['username'];
}
}
}
if($birthdayCount) {
print '<div class="head">Birthdays</div>';
print 'Congratulations to ';
foreach($birthdays as $userData) {
print '<b><a href="/u/';
print $userData['uid'];
print '" class="default" target="_blank">';
print $userData['uname'];
print '</a></b>';
if($userData['id'] + 1 === count($birthdays))
print ' and ';
elseif($userData['id'] === count($birthdays))
print '!';
else
print ', ';
}
}
$getOnlineUsers = $database->query("SELECT DISTINCT `uid` FROM `flashii_sessions` WHERE `time` > '". (time() - 3600) ."' AND `uid` != '212';")->fetch_all(MYSQLI_ASSOC);
$getOnlineCount = count($getOnlineUsers);
if($getOnlineCount) {
print '<div class="head">Online users</div>';
print 'These users were active on the site in the last hour:<br />';
foreach($getOnlineUsers as $okCountThisFuckingShit => $userData) {
$userData = $flashii->getUserdata($userData['uid']);
print '<b><a href="/u/';
print $userData['id'];
print '" class="default" target="_blank">';
print $userData['username'];
print '</a></b>';
if($okCountThisFuckingShit + 2 === $getOnlineCount)
print ' and ';
elseif($okCountThisFuckingShit + 1 === $getOnlineCount)
print '.';
else
print ', ';
}
}
}
?>
</div>
<div class="content-left content-column">
<div class="head">News <a href="/news.xml" class="fa fa-rss news-rss default"></a></div>
<?php
$getNews = $database->query("SELECT * FROM `flashii_news` ORDER BY `id` DESC LIMIT 3");
$getNews = $getNews->fetch_all(MYSQLI_ASSOC);
foreach($getNews as $newsPost) {
print '<a href="/news/'.$newsPost['id'].'" class="news-head" id="'.$newsPost['id'].'">'.$newsPost['title'].'</a>';
print '<div class="news-body">';
print '<a href="/u/';
print $newsPost['uid'];
print '" class="default">';
print '<div class="news-poster">';
print '<img src="/a/';
print $newsPost['uid'];
print '" alt="';
print $flashii->getUserdata($newsPost['uid'])['username'];
print '" class="default-avatar-setting" />';
print '<h1 style="';
print $flashii->getRankdata($flashii->getUserdata($newsPost['uid'])['userrole'])['style'];
print 'text-shadow:0px 0px 7px #888;padding:0px 0px 10px;">';
print $flashii->getUserdata($newsPost['uid'])['username'];
print '</h1>';
print '</div>';
print '</a>';
print '<div class="markdown">';
print $mdparser->text($newsPost['content']);
print '</div>';
print '</div>';
print '<div class="clear"></div>';
print '<div class="news-post-time">Posted on ';
print date($fwSettings['dateFormat'], $newsPost['date']);
print isset($_GET['id']) ? null : ' <a class="default" href="/news/'.$newsPost['id'].'#disqus_thread">View comments</a>';
print '</div>';
}
?>
</div>
<div class="clear"></div>
</div>
<script type="text/javascript" src="/assets/js/ybabstat.js"></script>
<?php
print desFooter();