query("UPDATE blog SET ThreadID=NULL WHERE ID=".$_GET['id']); $Cache->delete_value('blog'); $Cache->delete_value('feed_blog'); } header('Location: blog.php'); break; case 'takeeditblog': authorize(); if(is_number($_POST['blogid']) && is_number($_POST['thread'])){ $DB->query("UPDATE blog SET Title='".db_string($_POST['title'])."', Body='".db_string($_POST['body'])."', ThreadID=".$_POST['thread']." WHERE ID='".db_string($_POST['blogid'])."'"); $Cache->delete_value('blog'); $Cache->delete_value('feed_blog'); } header('Location: blog.php'); break; case 'editblog': if(is_number($_GET['id'])){ $BlogID = $_GET['id']; $DB->query("SELECT Title, Body, ThreadID FROM blog WHERE ID=$BlogID"); list($Title, $Body, $ThreadID) = $DB->next_record(); } break; case 'deleteblog': if(is_number($_GET['id'])){ authorize(); $DB->query("DELETE FROM blog WHERE ID='".db_string($_GET['id'])."'"); $Cache->delete_value('blog'); $Cache->delete_value('feed_blog'); } header('Location: blog.php'); break; case 'takenewblog': authorize(); $Title = db_string($_POST['title']); $Body = db_string($_POST['body']); $ThreadID = $_POST['thread']; if($ThreadID && is_number($ThreadID)) { $DB->query("SELECT ForumID FROM forums_topics WHERE ID=".$ThreadID); if($DB->record_count() < 1) { error("No such thread exists!"); header('Location: blog.php'); } } else { $ThreadID = create_thread(ANNOUNCEMENT_FORUM_ID, $LoggedUser[ID], $Title, $Body); if($ThreadID < 1) { error(0); } } $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']); } header('Location: blog.php'); break; } } ?>

Title

/>

Body


/>

Thread ID

/> (Leave blank to create thread automatically)

tabindex="2" />

get_value('blog')) { $DB->query("SELECT b.ID, um.Username, 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 ($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; ?>
- posted by - [Edit] [Delete]
full_format($Body)?>

Discuss this post here [Dead]