Upload latest files.

This commit is contained in:
flash 2021-05-05 15:31:51 +00:00
parent 4cab95baf5
commit 0a428332bd
10 changed files with 543 additions and 18 deletions

View File

@ -1,11 +1,20 @@
<?php
function topics_in_category(int $category): array {
function topics_in_category(int $category, int $variation = 0): array {
global $pdo;
if($category < 1)
return [];
$getTopics = $pdo->prepare('SELECT *, UNIX_TIMESTAMP(`topic_created`) AS `topic_created`, UNIX_TIMESTAMP(`topic_bumped`) AS `topic_bumped`, UNIX_TIMESTAMP(`topic_locked`) AS `topic_locked`, UNIX_TIMESTAMP(`topic_resolved`) AS `topic_resolved`, UNIX_TIMESTAMP(`topic_confirmed`) AS `topic_confirmed` FROM `fmf_topics` WHERE `cat_id` = :category AND `topic_bumped` IS NOT NULL ORDER BY `topic_bumped` DESC');
$query = 'SELECT *, UNIX_TIMESTAMP(`topic_created`) AS `topic_created`, UNIX_TIMESTAMP(`topic_bumped`) AS `topic_bumped`, UNIX_TIMESTAMP(`topic_locked`) AS `topic_locked`, UNIX_TIMESTAMP(`topic_resolved`) AS `topic_resolved`, UNIX_TIMESTAMP(`topic_confirmed`) AS `topic_confirmed`'
. ' FROM `fmf_topics` WHERE `cat_id` = :category AND `topic_bumped` IS NOT NULL'
. ' ORDER BY ';
if($variation === 1)
$query .= 'IF(`topic_confirmed` IS NULL, 0, IF(`topic_resolved` IS NULL, -1, 1)), ';
$query .= '`topic_bumped` DESC';
$getTopics = $pdo->prepare($query);
$getTopics->bindValue('category', $category);
$topics = $getTopics->execute() ? $getTopics->fetchAll(PDO::FETCH_ASSOC) : false;

View File

@ -2,6 +2,7 @@
include_once '_utils.php';
define('FMF_UF_SCROLLBEYOND', 1);
define('FMF_UF_NEWSTYLE', 2);
function get_user_id(string $username, string $email): int {
global $pdo;
@ -181,6 +182,18 @@ function destroy_session(string $token): void {
$delete->execute();
}
function destroy_user_sessions(int $userId): void {
global $pdo;
$delete = $pdo->prepare('DELETE FROM `fmf_sessions` WHERE `user_id` = :user');
$delete->bindValue('user', $userId);
$delete->execute();
}
function destroy_current_user_sessions(): void {
destroy_user_sessions(current_user_id());
}
function current_user_id(): int {
return session_active() ? $GLOBALS['fmf_user_id'] : 0;
}

View File

@ -1,4 +1,11 @@
<?php if(isset($_GET['_new'])): ?>
</div>
<?php endif; ?>
<div class="footer">
<?php if(isset($_GET['_new'])): ?>
<div class="footer-text">&copy; flashwave 2010-2020 - powered by Chie</div>
<script src="//flash.moe/assets/2020v2.js" charset="utf-8" type="text/javascript"></script>
<?php else: ?>
Powered by Chie<br/>
&copy; <a href="https://flash.moe">Flashwave</a> 2019-<?=date('Y');?>
<?php
@ -9,7 +16,22 @@ if(!empty($extendedFooter)) {
<?php
}
?>
<?php endif; ?>
</div>
</div>
<script type="text/javascript">
var _paq = window._paq || [];
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
_paq.push(['setTrackerUrl', '//uiharu.railgun.sh/mtm']);
_paq.push(['setSiteId', 'w4PqjBGmOL5l']);
var g = document.createElement('script');
g.type = 'text/javascript'; g.async = true;
g.defer = true; g.src = '//uiharu.railgun.sh/mtm.js';
document.head.appendChild(g);
})();
</script>
</body>
</html>

View File

@ -1,5 +1,8 @@
<?php
include_once '_user.php';
if(user_has_flag(current_user_id(), FMF_UF_NEWSTYLE))
$_GET['_new'] = true;
?>
<!doctype html>
<html>
@ -7,25 +10,41 @@ include_once '_user.php';
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title><?=$title ?? 'flash.moe message board';?></title>
<?php if(isset($_GET['_new'])): ?>
<link href="//flash.moe/assets/2020v2.css" type="text/css" rel="stylesheet"/>
<link href="//flash.moe/assets/sprite.css" type="text/css" rel="stylesheet"/>
<link href="//flash.moe/css/electrolize/style.css" type="text/css" rel="stylesheet"/>
<link href="/style2.css" type="text/css" rel="stylesheet"/>
<?php else: ?>
<link href="/style.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript">
var _paq = window._paq || [];
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
_paq.push(['setTrackerUrl', '//uiharu.railgun.sh/mtm']);
_paq.push(['setSiteId', 'w4PqjBGmOL5l']);
var g = document.createElement('script');
g.type = 'text/javascript'; g.async = true;
g.defer = true; g.src = '//uiharu.railgun.sh/mtm.js';
document.head.appendChild(g);
})();
</script>
<?php endif; ?>
</head>
<body>
<?php if(!isset($_GET['_new'])): ?>
<div class="wrapper<?php if(user_has_flag(current_user_id(), FMF_UF_SCROLLBEYOND)) { echo ' scrollbeyond'; }?>">
<?php endif; ?>
<div class="header">
<?php if(isset($_GET['_new'])): ?>
<div class="header-background">
<img src="//flash.moe/assets/headers/mkt-044.jpg" alt="//flash.moe/assets/headers/mkt-044.jpg"/>
</div>
<div class="header-foreground">
<a class="header-logo" href="/">
<div class="header-flash">flash.moe&nbsp;</div>
<div class="header-wave">message board</div>
</a>
<div class="header-menu">
<a href="/">Home</a>
<?php if(session_active()) { ?>
<a href="/settings">Settings</a>
<a href="/logout/<?=logout_token();?>">Log out</a>
<?php } else { ?>
<a href="/login">Log in</a>
<a href="/register">Register</a>
<?php } ?>
</div>
</div>
<?php else: ?>
<h1>flash.moe message board</h1>
<div class="header-wrap">
<div class="header-nav">
@ -45,4 +64,19 @@ include_once '_user.php';
</form>
<?php } ?>
</div>
<?php endif; ?>
</div>
<?php if(isset($_GET['_new'])): ?>
<div class="container">
<div class="wrapper<?php if(user_has_flag(current_user_id(), FMF_UF_SCROLLBEYOND)) { echo ' scrollbeyond'; }?>">
<?php if(empty($hideSearch)) { ?>
<form method="get" action="/search" class="header-search">
<input type="search" name="q"/>
<input type="submit" value="Search"/>
</form>
<?php } ?>
<?php endif; ?>
<div class="forum-shutdown">
This message board will be taken offline in May 2021. Registration and posting have already been disabled.<br/>
<a href="https://flashii.net/forum/topic.php?t=688">Musewave support has moved to a forum topic on Flashii.net.</a>
</div>

View File

@ -75,7 +75,7 @@ if(count($categories) > 0) {
}
if($categoryInfo['cat_type'] == 0) {
$topics = topics_in_category($categoryInfo['cat_id']);
$topics = topics_in_category($categoryInfo['cat_id'], $categoryInfo['cat_variation']);
?>
<a href="/category/<?=$categoryInfo['cat_id'];?>/create" class="createtopicbtn">Create Topic</a>
<div class="topics">

View File

@ -1,6 +1,8 @@
<?php
require_once '../startup.php';
die_ex('Posting has been disabled.', 200);
include_once '_category.php';
include_once '_user.php';
include_once '_topics.php';

View File

@ -1,6 +1,8 @@
<?php
require_once '../startup.php';
die_ex('Registration has been disabled. Thank you for your interest.', 200);
include_once '_user.php';
if(session_active()) {

View File

@ -10,6 +10,7 @@ if(!session_active()) {
$options = [
FMF_UF_SCROLLBEYOND => 'Scroll beyond end of the page.',
FMF_UF_NEWSTYLE => 'Preview new style.',
];
$timeZones = DateTimeZone::listIdentifiers();
@ -154,7 +155,7 @@ include FMF_LAYOUT . '/header.php';
<div class="setting-head"><h3>Date/time format</h3></div>
<div class="setting-value">
<input type="text" name="date_format_custom" value="<?=$userInfo['user_date_format'];?>"/><br/>
<a href="https://www.php.net/manual/en/function.date.php" style="font-size: .9em;" target="_blank" rel="noopener">Using PHP date() format</a>
<a href="https://www.php.net/manual/en/datetime.format.php#refsect1-datetime.format-parameters" style="font-size: .9em;" target="_blank" rel="noopener">Using PHP DateTimeInterface::format() format</a>
</div>
</div>

View File

@ -474,3 +474,11 @@ option {
margin: 2px 0;
padding: 4px;
}
.forum-shutdown {
background-color: #37221a;
padding: 5px 7px;
font-weight: bold;
color: #D9AA9D;
border: 1px solid #000;
}

434
public/style2.css Normal file
View File

@ -0,0 +1,434 @@
h1 {
color: #9DAAD9;
font-weight: bold;
font-size: 22px;
text-decoration: none;
}
h2 {
font-weight: bold;
font-size: 22px;
text-decoration: none;
line-height: 120%;
}
h3 {
font-size: 1.3em;
font-weight: bold;
line-height: 120%;
}
h4 {
margin: 0;
font-size: 1.1em;
font-weight: bold;
}
p {
font-size: 1.1em;
}
h3 > a {
display: inline-block;
padding: 2px 5px;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="submit"],
input[type="reset"],
input[type="button"] {
color: #9daad9;
font-family: Tahoma, Geneva, 'Dejavu Sans', Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: 400;
padding: 2px;
border: 1px solid #9daad9;
background-color: #191E33;
}
input[type="button"],
input[type="reset"],
input[type="submit"] {
cursor: pointer;
padding: 2px 4px;
}
input[type="submit"] {
font-weight: 700;
}
textarea {
background-color: #191E33;
color: #9DAAD9;
font-family: Tahoma, Geneva, 'Dejavu Sans', Arial, Helvetica, sans-serif;
font-weight: normal;
border: 1px solid #A9B8C2;
padding: 2px;
font-size: 12px;
}
select {
color: #9DAAD9;
background-color: #191E33;
font-family: Tahoma, Geneva, 'Dejavu Sans', Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
border: 1px solid #A9B8C2;
padding: 1px;
}
option {
padding: 0 1em 0 0;
}
.wrapper {
margin: 0 auto;
width: 100%;
max-width: 1000px;
}
.wrapper.scrollbeyond {
padding-bottom: 100vh;
}
.wrapper a {
color: #567194;
text-decoration: none;
transition: color .1s;
}
.wrapper a:active {
color: #4C5A8E;
text-decoration: none;
}
.wrapper a:hover {
color: #FFFFFF;
text-decoration: underline;
}
.forum-category,
.topics {
border: 1px solid #000;
background-color: #191e33;
color: #cecece;
margin: 4px 0;
}
.forum-category-title,
.topics-header {
font-weight: 700;
display: flex;
align-items: center;
}
.forum-category-title-info,
.topics-header-info {
flex: 1 1 auto;
padding: 4px 5px;
}
.forum-category-board,
.topics-item {
border-top: 1px solid #000;
background-color: #1a2237;
display: flex;
align-items: center;
min-height: 40px;
}
.forum-category-board-indicator,
.topics-item-indicator,
.topics-item-indicator-closed,
.topics-item-indicator-locked {
width: 20px;
height: 20px;
line-height: 20px;
border: 1px solid #000;
flex: 0 0 auto;
margin: 5px;
background-color: #1a2237;
}
.topics-item-indicator-closed {
background-color: #0c0;
margin-left: 0;
}
.topics-item-indicator-locked {
background-color: #c00;
margin-left: 0;
}
.forum-category-board-indicator.unread,
.topics-item-indicator.unread {
background-color: #4D556A;
}
.topics-item-indicator,
.topics-item-indicator-closed,
.topics-item-indicator-locked {
width: 16px;
height: 16px;
line-height: 16px;
}
.forum-category-board-info,
.topics-item-info {
flex: 1 1 auto;
}
.forum-category-count,
.topics-item-count {
width: 60px;
text-align: center;
padding: 4px 5px;
}
.forum-category-latest,
.topics-item-author,
.topics-item-created,
.topics-item-latest {
width: 120px;
text-align: center;
}
.topics-item-created time,
.forum-category-latest time,
.topics-item-latest time {
font-size: .9em;
line-height: 1.2em;
display: inline-block;
}
.forum-category-latest-header,
.topics-item-latest-header {
padding: 4px 5px;
}
.forum-category-board-desc {
font-size: .9em;
line-height: 1.2em;
}
.topics-item-status {
display: inline-block;
margin-right: 4px;
}
.auth-form {
max-width: 300px;
margin: 5px auto;
}
.auth-header {
padding: 5px 0;
}
.auth-field {
margin: 5px 0;
display: block;
}
.auth-field-value input {
width: 100%;
}
.auth-buttons {
text-align: center;
padding: 5px;
}
.auth-message {
text-align: center;
}
.auth-message-error {
color: #f00;
}
.forum-title {
padding: 2px 5px;
}
.posting-header {
display: flex;
padding: 4px 0;
}
.posting-title {
flex: 1 1 auto;
}
.posting-submit {
margin-left: 4px;
}
.posting-text {
display: block;
width: 100%;
min-width: 100%;
max-width: 100%;
min-height: 500px;
}
.posting-message {
padding: 0 3px;
}
.posting-message-error {
color: #f00;
}
.createtopicbtn,
.topic-btns a {
display: inline-block;
color: #fff !important;
text-decoration: none !important;
font-size: 12px;
font-weight: 400;
padding: 5px 10px;
background-color: #393939;
background-image: linear-gradient(0deg, #1118 0%, #2228 50%, #3338 50%, #5558 100%);
border-radius: 5px;
overflow: hidden;
cursor: pointer;
filter: drop-shadow(0 1px 5px #000);
margin: 5px 0;
margin-right: 10px;
}
.search-form {
display: flex;
}
.search-input {
flex: 1 1 auto;
}
.search-submit {
margin-left: 4px;
}
.post {
display: flex;
border: 1px solid #000;
background-color: #191e33;
color: #cecece;
margin: 2px 0;
}
.post-details {
flex: 0 0 auto;
width: 120px;
display: flex;
flex-direction: column;
align-items: center;
border: 0 solid #000;
border-right-width: 1px;
}
.post-permalink-wrap {
text-align: center;
font-size: .9em;
line-height: 1.4em;
}
.post-username {
font-size: 1.2em;
line-height: 1.5em;
}
.post-details * {
margin: 1px 0;
}
/*@media(max-width: 600px) {*/
.post {
flex-direction: column;
}
.post-details {
border-right-width: 0;
border-bottom-width: 1px;
width: 100%;
flex-direction: row;
}
.post-avatar {
width: 40px;
height: 40px;
order: 1;
margin: 5px;
}
.post-username {
order: 2;
padding: 10px;
}
.post-permalink-wrap {
order: 3;
flex: 1 1 auto;
text-align: right !important;
}
.post-permalink {
padding: 10px;
}
/*}*/
.post-text {
flex: 1 1 auto;
background-color: #1a2237;
min-height: 160px;
padding: 2px 5px;
display: flex;
flex-direction: column;
}
.post-text-inner {
flex: 1 1 auto;
padding: 3px 0;
word-wrap: normal;
word-break: break-word;
}
.post-footer {
display: flex;
flex: 0 0 auto;
font-size: .9em;
}
.post-edited {
flex: 1 1 auto;
font-style: italic;
}
.post-options {
flex: 0 0 auto;
}
.post-options a {
margin: 0 5px;
}
.post-deleted .post-text {
min-height: 0;
}
.setting {
margin: 10px 0;
}
.setting-head h3 {
line-height: 1.5em;
}
.setting-value input[type="text"],
.setting-value input[type="password"],
.setting-value input[type="email"],
.setting-value select {
min-width: 400px;
margin: 1px 0;
}
.settings-message {
padding: 0 3px;
}
.settings-message-error {
color: #f00;
}
.settings-option {
margin: 2px 0;
padding: 0 4px;
display: block;
}
.event {
display: block;
border: 1px solid #000;
background-color: #191e33;
color: #cecece;
margin: 2px 0;
}
.event-msg {
margin: 4px;
display: flex;
}
.event-msg img {
vertical-align: bottom;
}
.event-msg time {
font-size: .9em;
margin: 0 4px;
}
.event-msg-text {
flex: 1 1 auto;
margin: 0 4px;
}
.notice {
display: block;
border: 1px solid #000;
background-color: #1a2237;
color: #cecece;
margin: 2px 0;
padding: 4px;
}
.header-search {
}