Empty commit

This commit is contained in:
Git 2012-05-29 08:00:10 +00:00
parent 209fa9ec13
commit d0f12e8e85
4 changed files with 38 additions and 1 deletions

View File

@ -366,6 +366,7 @@ function user_heavy_info($UserID) {
i.SiteOptions,
i.DownloadAlt,
i.LastReadNews,
i.LastReadBlog,
i.RestrictedForums,
i.PermittedForums,
m.FLTokens,

View File

@ -196,6 +196,22 @@
$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) {

View File

@ -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`),

View File

@ -61,8 +61,17 @@
}
}
$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 @@
<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 @@
$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;
?>