summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGit <git@what.cd>2012-05-29 08:00:10 +0000
committerGit <git@what.cd>2012-05-29 08:00:10 +0000
commitd0f12e8e85cf2f275366c2efb93e7f6d5913eadc (patch)
tree04c79c733f1dd3b5cb38c36919e8a48adf228d9b
parent209fa9ec13c59499bb0e3882a54604b7edeb287a (diff)
downloadGazelle-d0f12e8e85cf2f275366c2efb93e7f6d5913eadc.zip
Gazelle-d0f12e8e85cf2f275366c2efb93e7f6d5913eadc.tar.gz
Gazelle-d0f12e8e85cf2f275366c2efb93e7f6d5913eadc.tar.bz2
Empty commit
-rw-r--r--classes/script_start.php1
-rw-r--r--design/privateheader.php16
-rw-r--r--gazelle.sql2
-rw-r--r--sections/blog/index.php20
4 files changed, 38 insertions, 1 deletions
diff --git a/classes/script_start.php b/classes/script_start.php
index 3c59631..c7dbf12 100644
--- a/classes/script_start.php
+++ b/classes/script_start.php
@@ -366,6 +366,7 @@ function user_heavy_info($UserID) {
i.SiteOptions,
i.DownloadAlt,
i.LastReadNews,
+ i.LastReadBlog,
i.RestrictedForums,
i.PermittedForums,
m.FLTokens,
diff --git a/design/privateheader.php b/design/privateheader.php
index a847e84..ce71338 100644
--- a/design/privateheader.php
+++ b/design/privateheader.php
@@ -196,6 +196,22 @@ if ($MyNews < $CurrentNews) {
$Alerts[] = '<a href="index.php">'.'New Announcement!'.'</a>';
}
+// Blog
+$MyBlog = $LoggedUser['LastReadBlog'];
+$CurrentBlog = $Cache->get_value('blog_latest_id');
+if ($CurrentBlog === false) {
+ $DB->query("SELECT ID FROM blog WHERE Important = 1 ORDER BY Time DESC LIMIT 1");
+ if ($DB->record_count() == 1) {
+ list($CurrentBlog) = $DB->next_record();
+ } else {
+ $CurrentBlog = -1;
+ }
+ $Cache->cache_value('blog_latest_id', $CurrentBlog, 0);
+}
+if ($MyBlog < $CurrentBlog) {
+ $Alerts[] = '<a href="blog.php">'.'New Blog Post!'.'</a>';
+}
+
//Staff PM
$NewStaffPMs = $Cache->get_value('staff_pm_new_'.$LoggedUser['ID']);
if ($NewStaffPMs === false) {
diff --git a/gazelle.sql b/gazelle.sql
index 88a83b2..35ac893 100644
--- a/gazelle.sql
+++ b/gazelle.sql
@@ -89,6 +89,7 @@ CREATE TABLE `blog` (
`Body` text COLLATE utf8_bin NOT NULL,
`Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ThreadID` int(10) unsigned DEFAULT NULL,
+ `Important` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`),
KEY `UserID` (`UserID`),
KEY `Time` (`Time`)
@@ -1226,6 +1227,7 @@ CREATE TABLE `users_info` (
`DisableRequests` enum('0','1') NOT NULL DEFAULT '0',
`PermittedForums` varchar(150) NOT NULL DEFAULT '',
`UnseededAlerts` enum('0','1') NOT NULL DEFAULT '0',
+ `LastReadBlog` int(10) NOT NULL DEFAULT '0',
UNIQUE KEY `UserID` (`UserID`),
KEY `SupportFor` (`SupportFor`),
KEY `DisableInvites` (`DisableInvites`),
diff --git a/sections/blog/index.php b/sections/blog/index.php
index a3962db..2951493 100644
--- a/sections/blog/index.php
+++ b/sections/blog/index.php
@@ -61,8 +61,17 @@ if(check_perms('admin_manage_blog')) {
}
}
- $DB->query("INSERT INTO blog (UserID, Title, Body, Time, ThreadID) VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', '".sqltime()."', ".$ThreadID.")");
+ $DB->query("INSERT INTO blog (UserID, Title, Body, Time, ThreadID, Important)
+ VALUES ('".$LoggedUser['ID']."',
+ '".db_string($_POST['title'])."',
+ '".db_string($_POST['body'])."',
+ '".sqltime()."',
+ ".$ThreadID.",
+ '".(($_POST['important']=='1')?'1':'0')."')");
$Cache->delete_value('blog');
+ if ($_POST['important']=='1') {
+ $Cache->delete_value('blog_latest_id');
+ }
if(isset($_POST['subscribe'])) {
$DB->query("INSERT IGNORE INTO users_subscriptions VALUES ('$LoggedUser[ID]', $ThreadID)");
$Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']);
@@ -89,6 +98,7 @@ if(check_perms('admin_manage_blog')) {
<input type="text" name="title" size="95" <? if(!empty($Title)) { echo 'value="'.display_str($Title).'"'; } ?> /><br />
<h3>Body</h3>
<textarea name="body" cols="95" rows="15"><? if(!empty($Body)) { echo display_str($Body); } ?></textarea> <br />
+ <input type="checkbox" value='1' name="important" id="important" <?=$Important?'checked':''?> /><label for="important">Important</label><br />
<h3>Thread ID</h3>
<input type="text" name="thread" size="8"<? if(!empty($ThreadID)) { echo 'value="'.display_str($ThreadID).'"'; } ?> />
(Leave blank to create thread automatically)
@@ -122,6 +132,14 @@ if (!$Blog = $Cache->get_value('blog')) {
$Cache->cache_value('Blog',$Blog,1209600);
}
+if ($LoggedUser['LastReadBlog'] < $Blog[0][0]) {
+ $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']);
+ $Cache->update_row(false, array('LastReadBlog' => $Blog[0][0]));
+ $Cache->commit_transaction(0);
+ $DB->query("UPDATE users_info SET LastReadBlog = '".$Blog[0][0]."' WHERE UserID = ".$LoggedUser['ID']);
+ $LoggedUser['LastReadBlog'] = $Blog[0][0];
+}
+
foreach ($Blog as $BlogItem) {
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $BlogItem;
?>