mirror of
https://github.com/BillyOutlast/Gazelle-Porn.git
synced 2026-02-04 02:51:19 +01:00
disable blog and staff blog and use the forums
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
.vs/
|
||||
.vscode/
|
||||
.idea/
|
||||
.vagrant/
|
||||
.well-known/
|
||||
logs/
|
||||
|
||||
@@ -102,6 +102,7 @@ $CONFIG['BLOCK_OPERA_MINI'] = false; //Set to true to block Opera Mini proxy
|
||||
$CONFIG['SYSTEM_USER_ID'] = 0; // ID for user to create "system" threads under (e.g. Edit Requests)
|
||||
$CONFIG['TRASH_FORUM_ID'] = 0; // ID of forum to send threads to when trash button is pressed
|
||||
$CONFIG['EDITING_FORUM_ID'] = 0; // ID of forum to send editing requests to
|
||||
$CONFIG['INDEX_FORUM_IDS'] = []; // IDs of forums to display on the index page
|
||||
$CONFIG['ANNOUNCEMENT_FORUM_ID'] = 0;
|
||||
$CONFIG['NEWS_FORUM_ID'] = 0;
|
||||
$CONFIG['DONOR_FORUM'] = 0;
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
View::show_header(t('server.index.blog_note'), 'bbcode', 'PageBlogHome');
|
||||
?>
|
||||
<div class="LayoutBody">
|
||||
<div class="BodyHeader">
|
||||
<div class="BodyHeader-nav">
|
||||
<?= t('server.index.blog_note') ?>
|
||||
</div>
|
||||
<div class="BodyNavLinks">
|
||||
<? if (check_perms('admin_manage_blog')) { ?>
|
||||
<a href="blog.php?action=neweditblog"><?= t('server.blog.create_a_blog_post') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
if (!$Blog = $Cache->get_value('blog')) {
|
||||
$DB->prepared_query("
|
||||
SELECT
|
||||
b.ID,
|
||||
um.Username,
|
||||
b.UserID,
|
||||
b.Title,
|
||||
b.Body,
|
||||
b.Time,
|
||||
b.ThreadID
|
||||
FROM blog AS b
|
||||
LEFT JOIN users_main AS um ON b.UserID = um.ID
|
||||
ORDER BY Time DESC
|
||||
LIMIT 20");
|
||||
$Blog = $DB->to_array();
|
||||
$Cache->cache_value('blog', $Blog, 1209600);
|
||||
}
|
||||
|
||||
if (count($Blog) > 0 && G::$LoggedUser['LastReadBlog'] < $Blog[0][0]) {
|
||||
$Cache->begin_transaction('user_info_heavy_' . G::$LoggedUser['ID']);
|
||||
$Cache->update_row(false, array('LastReadBlog' => $Blog[0][0]));
|
||||
$Cache->commit_transaction(0);
|
||||
$DB->prepared_query("
|
||||
UPDATE users_info
|
||||
SET LastReadBlog = ?
|
||||
WHERE UserID = ?", $Blog[0][0], G::$LoggedUser['ID']);
|
||||
G::$LoggedUser['LastReadBlog'] = $Blog[0][0];
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="LayoutBody PostList PostListBlog">
|
||||
<?
|
||||
foreach ($Blog as $BlogItem) {
|
||||
list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $BlogItem;
|
||||
?>
|
||||
<div class="Post" id="blog<?= $BlogID ?>">
|
||||
<div class="Post-header">
|
||||
<div class="Post-headerLeft">
|
||||
<span class="Post-headerTitle"><?= $Title ?></span>
|
||||
- <?= time_diff($BlogTime); ?>
|
||||
</div>
|
||||
<div class="Post-headerActions">
|
||||
<?php if ($ThreadID) { ?>
|
||||
<a href="forums.php?action=viewthread&threadid=<?= $ThreadID ?>"><?= t('server.index.discuss') ?></a>
|
||||
<? } ?>
|
||||
<? if (check_perms('admin_manage_blog')) { ?>
|
||||
- <a href="blog.php?action=neweditblog&id=<?= $BlogID ?>" class="brackets"><?= t('server.common.edit') ?></a>
|
||||
- <a href="blog.php?action=deleteblog&id=<?= $BlogID ?>&auth=<?= G::$LoggedUser['AuthKey'] ?>" class="brackets"><?= t('server.common.delete') ?></a>
|
||||
- <a href="blog.php?action=deadthread&id=<?= $BlogID ?>&auth=<?= G::$LoggedUser['AuthKey'] ?>" class="brackets"><?= t('server.blog.remove_link') ?></a>
|
||||
<? } else { ?>
|
||||
-
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Post-body Box-body HtmlText PostArticle">
|
||||
<?= Text::full_format($Body) ?>
|
||||
</div>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
authorize();
|
||||
|
||||
if (!isset($_GET['id'])) {
|
||||
error('Please provide an ID for a blog post to remove the thread link from.');
|
||||
}
|
||||
|
||||
$ID = intval($_GET['id']);
|
||||
G::$DB->prepared_query('UPDATE blog SET ThreadID = NULL WHERE ID = ? ', $ID);
|
||||
|
||||
if (G::$DB->affected_rows() > 0) {
|
||||
$Cache->delete_value('blog');
|
||||
$Cache->delete_value('feed_blog');
|
||||
}
|
||||
|
||||
header('Location: blog.php');
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
authorize();
|
||||
|
||||
if (empty($_GET['id'])) {
|
||||
error('You must provide an ID of a blog to delete');
|
||||
}
|
||||
|
||||
$BlogID = intval($_GET['id']);
|
||||
if ($BlogID > 0) {
|
||||
$DB->prepared_query("DELETE FROM blog WHERE ID = ?", $BlogID);
|
||||
$Cache->delete_value('blog');
|
||||
$Cache->delete_value('feed_blog');
|
||||
}
|
||||
header('Location: blog.php');
|
||||
@@ -1,32 +0,0 @@
|
||||
<?
|
||||
enforce_login();
|
||||
|
||||
|
||||
if (!empty($_REQUEST['action'])) {
|
||||
if (!check_perms('admin_manage_blog')) {
|
||||
error(403);
|
||||
}
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'deadthread':
|
||||
require(CONFIG['SERVER_ROOT'] . '/sections/blog/dead_thread.php');
|
||||
break;
|
||||
case 'takeeditblog':
|
||||
require(CONFIG['SERVER_ROOT'] . '/sections/blog/take_edit_blog.php');
|
||||
break;
|
||||
case 'deleteblog':
|
||||
require(CONFIG['SERVER_ROOT'] . '/sections/blog/delete_blog.php');
|
||||
break;
|
||||
case 'takenewblog':
|
||||
require(CONFIG['SERVER_ROOT'] . '/sections/blog/take_new_blog.php');
|
||||
break;
|
||||
case 'neweditblog':
|
||||
require(CONFIG['SERVER_ROOT'] . '/sections/blog/new_edit_blog.php');
|
||||
break;
|
||||
// Fall through as we just need to include blog_page
|
||||
case 'editblog':
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
require(CONFIG['SERVER_ROOT'] . '/sections/blog/browse.php');
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
<?
|
||||
if (!check_perms('admin_manage_blog')) {
|
||||
error(403);
|
||||
}
|
||||
View::show_header(t('server.blog.create_a_blog_post'), 'bbcode', 'PageBlogHome');
|
||||
$IsNew = empty($_GET['id']);
|
||||
?>
|
||||
<div class="LayoutBody">
|
||||
<div class="BodyHeader">
|
||||
<div class="BodyHeader-nav">
|
||||
<?= t('server.index.blog_note') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
$BlogID = 0;
|
||||
$Title = '';
|
||||
$Body = '';
|
||||
$ThreadID = null;
|
||||
if (!$IsNew) {
|
||||
$BlogID = intval($_GET['id']);
|
||||
$DB->prepared_query("
|
||||
SELECT Title, Body, ThreadID
|
||||
FROM blog
|
||||
WHERE ID = ?", $BlogID);
|
||||
list($Title, $Body, $ThreadID) = $DB->fetch_record(0, 1);
|
||||
$ThreadID = $ThreadID ?? 0;
|
||||
}
|
||||
?>
|
||||
|
||||
<form class="Form BlogCreate <?= $IsNew ? 'create_form' : 'edit_form' ?>" name="blog_post" action="blog.php" method="post">
|
||||
<input type="hidden" name="action" value="<?= $IsNew ? 'takenewblog' : 'takeeditblog' ?>" />
|
||||
<input type="hidden" name="auth" value="<?= G::$LoggedUser['AuthKey'] ?>" />
|
||||
<? if (!$IsNew) { ?>
|
||||
<input type="hidden" name="blogid" value="<?= $BlogID; ?>" />
|
||||
<? } ?>
|
||||
<div class="Form-rowList" variant="header" id="blog_create_edit_box">
|
||||
<div class="Form-rowHeader">
|
||||
<div class="Form-title">
|
||||
<?= $IsNew ? t('server.blog.create_a_blog_post') : t('server.blog.edit_blog_post') ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Form-row">
|
||||
<div class="Form-label"><?= t('server.blog.title') ?></div>
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" name="title" size="95" <?= !empty($Title) ? ' value="' . display_str($Title) . '"' : ''; ?> />
|
||||
</div>
|
||||
</div>
|
||||
<div class="Form-row">
|
||||
<div class="Form-label"><?= t('server.blog.body') ?></div>
|
||||
<div class="Form-items">
|
||||
<?php new TEXTAREA_PREVIEW('body', 'blog_content', display_str($Body), 60, 8, true, true, false); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Form-row">
|
||||
<div class="Form-label"><?= t('server.blog.thread_id') ?></div>
|
||||
<div class="Form-inputs">
|
||||
<input class="Input is-small" type="text" name="thread" size="8" <?= $ThreadID !== null ? ' value="' . display_str($ThreadID) . '"' : ''; ?> /><?= t('server.blog.thread_id_note') ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Form-row">
|
||||
<div>
|
||||
<input type="checkbox" value="1" name="important" id="important" checked="checked" /><label for="important"><?= t('server.blog.important') ?></label>
|
||||
</div>
|
||||
<div>
|
||||
<input id="subscribebox" type="checkbox" name="subscribe" <?= !empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''; ?> tabindex="2" />
|
||||
<label for="subscribebox"><?= t('server.common.subscribe') ?></label>
|
||||
</div>
|
||||
<input class="Button" type="submit" value="<?= $IsNew ? t('server.blog.create_a_blog_post') : t('server.blog.edit_blog_post'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
View::show_footer();
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
authorize();
|
||||
|
||||
if (empty($_POST['blogid']) || empty($_POST['body']) || empty($_POST['title'])) {
|
||||
error('You must provide a blog id, title, and body when editing a blog entry.');
|
||||
}
|
||||
|
||||
$BlogID = intval($_POST['blogid']);
|
||||
$ThreadID = !isset($_POST['thread']) || $_POST['thread'] === '' ? '' : max(0, intval($_POST['thread']));
|
||||
|
||||
if ($ThreadID > 0) {
|
||||
$DB->prepared_query("
|
||||
SELECT ForumID
|
||||
FROM forums_topics
|
||||
WHERE ID = ?", $ThreadID);
|
||||
if (!$DB->has_results()) {
|
||||
error('No such thread exists!');
|
||||
}
|
||||
} elseif ($ThreadID === '') {
|
||||
$ThreadID = Misc::create_thread(CONFIG['ANNOUNCEMENT_FORUM_ID'], G::$LoggedUser['ID'], $_POST['title'], $_POST['body']);
|
||||
if ($ThreadID < 1) {
|
||||
error(0);
|
||||
}
|
||||
} else {
|
||||
$ThreadID = null;
|
||||
}
|
||||
|
||||
$Important = isset($_POST['important']) ? '1' : '0';
|
||||
|
||||
if ($BlogID > 0) {
|
||||
$DB->prepared_query("
|
||||
UPDATE blog
|
||||
SET
|
||||
Title = ?,
|
||||
Body = ?,
|
||||
ThreadID = ?,
|
||||
Important = ?
|
||||
WHERE ID = ?", $_POST['title'], $_POST['body'], $ThreadID, $Important, $BlogID);
|
||||
$Cache->delete_value('blog');
|
||||
$Cache->delete_value('feed_blog');
|
||||
if ($Important == '1') {
|
||||
$Cache->delete_value('blog_latest_id');
|
||||
}
|
||||
if (isset($_POST['subscribe']) && $ThreadID !== null && $ThreadID > 0) {
|
||||
$DB->prepared_query("
|
||||
INSERT IGNORE INTO users_subscriptions
|
||||
VALUES (?, ?)", G::$LoggedUser['ID'], $ThreadID);
|
||||
$Cache->delete_value('subscriptions_user_' . G::$LoggedUser['ID']);
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: blog.php');
|
||||
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
authorize();
|
||||
|
||||
if (empty($_POST['title']) || empty($_POST['body'])) {
|
||||
error('You must have a title and body for the blog post.');
|
||||
}
|
||||
|
||||
$ThreadID = !isset($_POST['thread']) || $_POST['thread'] === '' ? '' : max(0, intval($_POST['thread']));
|
||||
if ($ThreadID > 0) {
|
||||
$DB->prepared_query("
|
||||
SELECT ForumID
|
||||
FROM forums_topics
|
||||
WHERE ID = ?", $ThreadID);
|
||||
if (!$DB->has_results()) {
|
||||
error('No such thread exists!');
|
||||
}
|
||||
} elseif ($ThreadID === '') {
|
||||
$ThreadID = Misc::create_thread(CONFIG['ANNOUNCEMENT_FORUM_ID'], G::$LoggedUser['ID'], $_POST['title'], $_POST['body']);
|
||||
if ($ThreadID < 1) {
|
||||
error(0);
|
||||
}
|
||||
} else {
|
||||
$ThreadID = null;
|
||||
}
|
||||
|
||||
$Important = isset($_POST['important']) ? '1' : '0';
|
||||
$DB->prepared_query("
|
||||
INSERT INTO blog
|
||||
(UserID, Title, Body, Time, ThreadID, Important)
|
||||
VALUES
|
||||
(?, ?, ?, ?, ?, ?)", G::$LoggedUser['ID'], $_POST['title'], $_POST['body'], sqltime(), $ThreadID, $Important);
|
||||
|
||||
$Cache->delete_value('blog');
|
||||
if ($Important == '1') {
|
||||
$Cache->delete_value('blog_latest_id');
|
||||
}
|
||||
if (isset($_POST['subscribe']) && $ThreadID !== null && $ThreadID > 0) {
|
||||
$DB->prepared_query("
|
||||
INSERT IGNORE INTO users_subscriptions
|
||||
VALUES (?, ?)", G::$LoggedUser['ID'], $ThreadID);
|
||||
$Cache->delete_value('subscriptions_user_' . G::$LoggedUser['ID']);
|
||||
}
|
||||
NotificationsManager::send_push(NotificationsManager::get_push_enabled_users(), $_POST['title'], $_POST['body'], site_url() . 'index.php', NotificationsManager::BLOG);
|
||||
|
||||
header('Location: blog.php');
|
||||
@@ -146,6 +146,7 @@ $Cache->update_row($ForumID, $UpdateArrayForums);
|
||||
$Cache->commit_transaction();
|
||||
|
||||
$Cache->delete_value("forums_$ForumID");
|
||||
$Cache->delete_value("forums_index_$ForumID");
|
||||
|
||||
Subscriptions::flush_subscriptions('forums', $TopicID);
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ if (isset($_POST['delete'])) {
|
||||
LastPostTime = '$NewLastAddedTime'
|
||||
WHERE ID = '$ForumID'");
|
||||
$Cache->delete_value("forums_$ForumID");
|
||||
$Cache->delete_value("forums_index_$ForumID");
|
||||
|
||||
$Cache->delete_value("thread_$TopicID");
|
||||
|
||||
@@ -204,6 +205,7 @@ if (isset($_POST['delete'])) {
|
||||
// if a thread title, etc. is changed, this cache key must be cleared so the thread listing
|
||||
// properly shows the new thread title.
|
||||
$Cache->delete_value("forums_$ForumID");
|
||||
$Cache->delete_value("forums_index_$ForumID");
|
||||
|
||||
if ($ForumID != $OldForumID) { // If we're moving a thread, change the forum stats
|
||||
$Cache->delete_value("forums_$OldForumID");
|
||||
|
||||
@@ -186,6 +186,7 @@ if ($Forum = $Cache->get_value("forums_$ForumID")) {
|
||||
$Cache->delete_value('forums_list');
|
||||
}
|
||||
|
||||
$Cache->delete_value("forums_index_$ForumID");
|
||||
$Cache->begin_transaction("thread_$TopicID" . '_catalogue_0');
|
||||
$Post = array(
|
||||
'ID' => $PostID,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
include(CONFIG['SERVER_ROOT'] . '/classes/torrenttable.class.php');
|
||||
require(CONFIG['SERVER_ROOT'] . '/classes/top10_movies.class.php');
|
||||
require(CONFIG['SERVER_ROOT'] . '/classes/forums.class.php');
|
||||
Text::$TOC = true;
|
||||
|
||||
$NewsCount = 3;
|
||||
@@ -207,100 +208,54 @@ View::show_header(t('server.index.index'), 'comments', 'PageHome');
|
||||
</div>
|
||||
<? } ?>
|
||||
|
||||
<!-- Staff Blog -->
|
||||
<? if (check_perms('users_mod')) { ?>
|
||||
<div class="SidebarItemStaffBlog SidebarItem Box">
|
||||
|
||||
<? if(is_array(CONFIG['INDEX_FORUM_IDS'])) {
|
||||
|
||||
foreach (CONFIG['INDEX_FORUM_IDS'] as $ForumId) {
|
||||
|
||||
if(Forums::check_forumperm($ForumId)) {
|
||||
$ForumsInfo = Forums::get_forum_info($ForumId);
|
||||
?>
|
||||
|
||||
<div class="SidebarItemStaffBlog SidebarItem Box">
|
||||
<div class="SidebarItem-header Box-header">
|
||||
<a href="staffblog.php"><?= t('server.index.staff_note') ?></a>
|
||||
<a href="forums.php?action=viewforum&forumid=<?= $ForumId ?>"><?= $ForumsInfo['Name'] ?></a>
|
||||
</div>
|
||||
|
||||
<?
|
||||
if (($Blog = $Cache->get_value('staff_blog')) === false) {
|
||||
$Forum = $Cache->get_value("forums_index_$ForumId");
|
||||
if (!isset($Forum) || !is_array($Forum)) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
b.ID,
|
||||
um.Username,
|
||||
b.Title,
|
||||
b.Body,
|
||||
b.Time,
|
||||
b.ThreadID
|
||||
FROM staff_blog AS b
|
||||
LEFT JOIN users_main AS um ON b.UserID = um.ID
|
||||
ORDER BY Time DESC");
|
||||
$Blog = $DB->to_array(false, MYSQLI_NUM);
|
||||
$Cache->cache_value('staff_blog', $Blog, 1209600);
|
||||
}
|
||||
if (($SBlogReadTime = $Cache->get_value('staff_blog_read_' . $LoggedUser['ID'])) === false) {
|
||||
$DB->query("
|
||||
SELECT Time
|
||||
FROM staff_blog_visits
|
||||
WHERE UserID = " . $LoggedUser['ID']);
|
||||
if (list($SBlogReadTime) = $DB->next_record()) {
|
||||
$SBlogReadTime = strtotime($SBlogReadTime);
|
||||
} else {
|
||||
$SBlogReadTime = 0;
|
||||
}
|
||||
$Cache->cache_value('staff_blog_read_' . $LoggedUser['ID'], $SBlogReadTime, 1209600);
|
||||
SELECT
|
||||
ID,
|
||||
Title,
|
||||
CreatedTime
|
||||
FROM forums_topics
|
||||
WHERE ForumID = '$ForumId'
|
||||
ORDER BY CreatedTime DESC
|
||||
LIMIT 5"); // Can be cached until someone makes a new post
|
||||
$Forum = $DB->to_array();
|
||||
$Cache->cache_value("forums_index_$ForumId", $Forum);
|
||||
}
|
||||
?>
|
||||
<ul class="SidebarItem-body Box-body SidebarList is-ordered">
|
||||
<?
|
||||
$End = min(count($Blog), 5);
|
||||
$End = min(count($Forum), 5);
|
||||
for ($i = 0; $i < $End; $i++) {
|
||||
list($BlogID, $Author, $Title, $Body, $BlogTime) = $Blog[$i];
|
||||
$BlogTime = strtotime($BlogTime);
|
||||
list($TopicID, $Title) = $Forum[$i];
|
||||
?>
|
||||
<li class="SidebarList-item">
|
||||
<?= $SBlogReadTime < $BlogTime ? '<strong>' : '' ?>
|
||||
<a href="staffblog.php#blog<?= $BlogID ?>"><?= $Title ?></a>
|
||||
<?= $SBlogReadTime < $BlogTime ? '</strong>' : '' ?>
|
||||
<strong>
|
||||
<a href="forums.php?action=viewthread&threadid=<?= $TopicID ?>"><?= $Title ?></a>
|
||||
</strong>
|
||||
</li>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<? } ?>
|
||||
<div class="SidbarItemBlog SidebarItem Box">
|
||||
<div class="SidebarItem-header Box-header">
|
||||
<a href="blog.php"><?= t('server.index.blog_note') ?></a>
|
||||
</div>
|
||||
<?
|
||||
if (($Blog = $Cache->get_value('blog')) === false) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
b.ID,
|
||||
um.Username,
|
||||
b.UserID,
|
||||
b.Title,
|
||||
b.Body,
|
||||
b.Time,
|
||||
b.ThreadID
|
||||
FROM blog AS b
|
||||
LEFT JOIN users_main AS um ON b.UserID = um.ID
|
||||
ORDER BY Time DESC
|
||||
LIMIT 20");
|
||||
$Blog = $DB->to_array();
|
||||
$Cache->cache_value('blog', $Blog, 1209600);
|
||||
}
|
||||
?>
|
||||
<ul class="SidebarItem-body Box-body SidebarList is-ordered">
|
||||
<?
|
||||
if (count($Blog) < 5) {
|
||||
$Limit = count($Blog);
|
||||
} else {
|
||||
$Limit = 5;
|
||||
}
|
||||
for ($i = 0; $i < $Limit; $i++) {
|
||||
list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
|
||||
?>
|
||||
<li class="SidebarList-item">
|
||||
<a href="blog.php#blog<?= $BlogID ?>"><?= $Title ?></a>
|
||||
</li>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php }}} ?>
|
||||
|
||||
<!-- Site History -->
|
||||
<?
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
<?
|
||||
View::show_header(t('server.blog.staff_blog'), 'bbcode', 'PageStaffBlogHome');
|
||||
|
||||
enforce_login();
|
||||
|
||||
if (!check_perms('users_mod')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
$DB->query("
|
||||
INSERT INTO staff_blog_visits
|
||||
(UserID, Time)
|
||||
VALUES
|
||||
(" . $LoggedUser['ID'] . ", NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Time = NOW()");
|
||||
$Cache->delete_value('staff_blog_read_' . $LoggedUser['ID']);
|
||||
|
||||
|
||||
if (check_perms('admin_manage_blog')) {
|
||||
if (!empty($_REQUEST['action'])) {
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'takeeditblog':
|
||||
authorize();
|
||||
if (empty($_POST['title'])) {
|
||||
error(t('server.blog.please_enter_a_title'));
|
||||
}
|
||||
if (is_number($_POST['blogid'])) {
|
||||
$DB->query("
|
||||
UPDATE staff_blog
|
||||
SET Title = '" . db_string($_POST['title']) . "',
|
||||
Body = '" . db_string($_POST['body']) . "'
|
||||
WHERE ID = '" . db_string($_POST['blogid']) . "'");
|
||||
$Cache->delete_value('staff_blog');
|
||||
$Cache->delete_value('staff_feed_blog');
|
||||
}
|
||||
header('Location: staffblog.php');
|
||||
break;
|
||||
case 'editblog':
|
||||
if (is_number($_GET['id'])) {
|
||||
$BlogID = $_GET['id'];
|
||||
$DB->query("
|
||||
SELECT Title, Body, ThreadID
|
||||
FROM staff_blog
|
||||
WHERE ID = $BlogID");
|
||||
list($Title, $Body, $ThreadID) = $DB->next_record();
|
||||
}
|
||||
break;
|
||||
case 'deleteblog':
|
||||
if (is_number($_GET['id'])) {
|
||||
authorize();
|
||||
$DB->query("
|
||||
DELETE FROM staff_blog
|
||||
WHERE ID = '" . db_string($_GET['id']) . "'");
|
||||
$Cache->delete_value('staff_blog');
|
||||
$Cache->delete_value('staff_feed_blog');
|
||||
}
|
||||
header('Location: staffblog.php');
|
||||
break;
|
||||
|
||||
case 'takenewblog':
|
||||
authorize();
|
||||
$ThreadID = Misc::create_thread(CONFIG['STAFF_BLOG_FORUM'], G::$LoggedUser['ID'], $_POST['title'], $_POST['body']);
|
||||
if ($ThreadID < 1) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
if (empty($_POST['title'])) {
|
||||
error(t('server.blog.please_enter_a_title'));
|
||||
}
|
||||
$Title = db_string($_POST['title']);
|
||||
$Body = db_string($_POST['body']);
|
||||
|
||||
$DB->query("
|
||||
INSERT INTO staff_blog
|
||||
(UserID, Title, Body, Time, ThreadID)
|
||||
VALUES
|
||||
('$LoggedUser[ID]', '" . db_string($_POST['title']) . "', '" . db_string($_POST['body']) . "', NOW(), $ThreadID)");
|
||||
$Cache->delete_value('staff_blog');
|
||||
$Cache->delete_value('staff_blog_latest_time');
|
||||
|
||||
send_irc("PRIVMSG " . CONFIG['ADMIN_CHAN'] . " :!mod New staff blog: " . $_POST['title'] . " - " . site_url() . "/staffblog.php#blog" . $DB->inserted_id());
|
||||
header('Location: staffblog.php');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="LayoutBody">
|
||||
<div class="BodyHeader">
|
||||
<div class="BodyHeader-nav">
|
||||
<?= t('server.blog.staff_blog') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="<?= ((empty($_GET['action'])) ? 'create_form' : 'edit_form') ?>" id="blog_post" name="blog_post" action="staffblog.php" method="post">
|
||||
<input type="hidden" name="action" value="<?= ((empty($_GET['action'])) ? 'takenewblog' : 'takeeditblog') ?>" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
<? if (!empty($_GET['action']) && $_GET['action'] == 'editblog') { ?>
|
||||
<input type="hidden" name="blogid" value="<?= $BlogID; ?>" />
|
||||
<?
|
||||
} ?>
|
||||
<div id="postform" variant="header" class="Form-rowList pad">
|
||||
<div class="Form-rowHeader">
|
||||
<?= ((empty($_GET['action'])) ? t('server.blog.create_staff_blog_post') : t('server.blog.edit_staff_blog_post')) ?>
|
||||
</div>
|
||||
|
||||
<div class="Form-row">
|
||||
<div class="Form-label"><?= t('server.blog.title') ?></div>
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" name="title" size="95" <? if (!empty($Title)) {
|
||||
echo ' value="' . display_str($Title) . '"';
|
||||
} ?> />
|
||||
</div>
|
||||
</div>
|
||||
<div class="Form-row">
|
||||
<div class="Form-label"><?= t('server.blog.body') ?></div>
|
||||
<div class="Form-items">
|
||||
<?php new TEXTAREA_PREVIEW('body', 'quickpost', display_str($Body), 60, 8, true, true, false); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Form-row">
|
||||
<input class="Button" type="submit" value="<?= ((!isset($_GET['action'])) ? t('server.blog.create_a_blog_post') : t('server.blog.edit_blog_post')) ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?
|
||||
if (($Blog = $Cache->get_value('staff_blog')) === false) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
b.ID,
|
||||
um.Username,
|
||||
b.Title,
|
||||
b.Body,
|
||||
b.Time,
|
||||
b.ThreadID
|
||||
FROM staff_blog AS b
|
||||
LEFT JOIN users_main AS um ON b.UserID = um.ID
|
||||
ORDER BY Time DESC");
|
||||
$Blog = $DB->to_array(false, MYSQLI_NUM);
|
||||
$Cache->cache_value('staff_blog', $Blog, 1209600);
|
||||
}
|
||||
?>
|
||||
<div class="PostList PostListStaffBlog LayoutBody">
|
||||
<?
|
||||
foreach ($Blog as $BlogItem) {
|
||||
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $BlogItem;
|
||||
$BlogTime = strtotime($BlogTime);
|
||||
?>
|
||||
<div class="Post" id="blog<?= $BlogID ?>">
|
||||
<div class="Post-header">
|
||||
<div class="Post-headerLeft">
|
||||
<span class="Post-headerTitle"><?= $Title ?></span>
|
||||
- <?= time_diff($BlogTime); ?>
|
||||
</div>
|
||||
<div class="Post-headerActions">
|
||||
<a href="forums.php?action=viewthread&threadid=<?= $ThreadID ?>"><?= t('server.index.discuss') ?></a>
|
||||
<? if (check_perms('admin_manage_blog')) { ?>
|
||||
- <a href="staffblog.php?action=editblog&id=<?= $BlogID ?>" class="brackets"><?= t('server.common.edit') ?></a>
|
||||
- <a href="staffblog.php?action=deleteblog&id=<?= $BlogID ?>&auth=<?= $LoggedUser['AuthKey'] ?>" onclick="return confirm('<?= t('server.blog.do_you_want_to_delete_this') ?>');" class="brackets"><?= t('server.common.delete') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="PostArticle Post-body Box-body HtmlText">
|
||||
<?= Text::full_format($Body) ?>
|
||||
</div>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
Reference in New Issue
Block a user