Beispiel #1
0
                } else {
                    $ThreadID = Misc::create_thread(ANNOUNCEMENT_FORUM_ID, $LoggedUser[ID], $Title, $Body);
                    if ($ThreadID < 1) {
                        error(0);
                    }
                }
                $DB->query("\n\t\t\t\t\tINSERT INTO blog\n\t\t\t\t\t\t(UserID, Title, Body, Time, ThreadID, Important)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $LoggedUser['ID'] . "',\n\t\t\t\t\t\t'" . db_string($_POST['title']) . "',\n\t\t\t\t\t\t'" . db_string($_POST['body']) . "',\n\t\t\t\t\t\t'" . sqltime() . "',\n\t\t\t\t\t\t{$ThreadID},\n\t\t\t\t\t\t'" . ($_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("\n\t\t\t\t\t\tINSERT IGNORE INTO users_subscriptions\n\t\t\t\t\t\tVALUES ('{$LoggedUser['ID']}', {$ThreadID})");
                    $Cache->delete_value('subscriptions_user_' . $LoggedUser['ID']);
                }
                NotificationsManager::send_push(NotificationsManager::get_push_enabled_users(), $_POST['title'], $_POST['body'], site_url() . 'index.php', NotificationsManager::BLOG);
                header('Location: blog.php');
                break;
        }
    }
    ?>
		<div class="box thin">
			<div class="head">
				<?php 
    echo empty($_GET['action']) ? 'Create a blog post' : 'Edit blog post';
    ?>
			</div>
			<form class="<?php 
    echo empty($_GET['action']) ? 'create_form' : 'edit_form';
    ?>
" name="blog_post" action="blog.php" method="post">