require 'init.php'; require_login(); $video_link = ''; $errors = []; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $video_link = $_POST['video_link']; if ($video_link == '') { $errors[] = "Введіть посилання на відео."; } else { if (!get_video_id_from_youtube_link($video_link)) { $errors[] = "Неможливо розпізнати посилання."; } } if (!$errors) { $post_id = create_post(get_current_user_id(), $video_link); redirect(APP_URL . '/view_post.php?id=' . $post_id); } } ?> <!DOCTYPE html> <head> <meta charset="utf-8"> <title>Tubogram</title> <?php echo js_and_css(); ?> </head> <?php
<?php //get input if (filter_input_array(INPUT_POST)) { $title = filter_input(INPUT_POST, "title"); $content = filter_input(INPUT_POST, "body"); //create a post $post_id = create_post($title, $content); //if the create returns an id redirect to the show method header('Location: /post_show.php?id=' . $post_id . ''); } else { //if the post isn't created redirect back to new header('Location: /post_new.php'); } //this function actually creates a new post function create_post($title, $content) { //establish a database connection include "includes/db_con.inc"; $conn = conDB(); //build an insert query $query = sprintf("INSERT INTO posts (title, body, created, modified) VALUES('%s', '%s', '%s', '%s') ", mysql_real_escape_string($title), mysql_real_escape_string($content), date("Y-m-d H:i:s"), date("Y-m-d H:i:s")); q($query); //select the most recently created post $result = q("SELECT id FROM posts ORDER BY posts.id DESC LIMIT 1"); $post = mysql_fetch_array($result); //return the id of the last post return $post['id']; }
include_once '../../../includes/user.php'; include_once '../../../includes/topic.php'; include_once '../../../includes/thread.php'; include_once '../../../includes/post.php'; include_once '../../../includes/parsedown.php'; include_once '../../../includes/htmlpurifier/HTMLPurifier.auto.php'; session_start(); if (isset($_SESSION['user'])) { if (isset($_POST['create-thread'])) { if (isset($_GET['id'])) { $thread = get_thread_by_id(create_thread($_POST['title'], get_topic_by_id($_GET['id']))); $parsedown = new Parsedown(); $htmlpurifierconfig = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($htmlpurifierconfig); create_post($thread, $_SESSION['user'], $purifier->purify($parsedown->text($_POST['text']))); header("HTTP/1.1 303 See Other"); header("Location: /forum/thread/?id=" . $thread->get_id()); } else { $thread = get_thread_by_id(create_thread($_POST['title'])); $htmlpurifierconfig = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($htmlpurifierconfig); create_post($thread, $_SESSION['user'], $purifier->purify($parsedown->text($_POST['text']))); header("HTTP/1.1 303 See Other"); header("Location: /forum/thread/?id=" . $thread->get_id()); } } else { header("HTTP/1.1 400 Bad Request"); } } else { header("HTTP/1.1 400 Bad Request"); }
} else { $logged_in_user->prefs->update("thread_sorting={$sort_style}"); } $warning = null; if ($content && !$preview) { if (post_str('add_signature', true) == "add_it") { $add_signature = true; } else { $add_signature = false; } check_tokens($logged_in_user->authenticator); if (!akismet_check($logged_in_user, $content)) { $warning = "Your post has been flagged as spam by the Akismet anti-spam system. Please modify your text and try again."; $preview = tra("Preview"); } else { create_post($content, $parent_post_id, $logged_in_user, $forum, $thread, $add_signature); header('Location: forum_thread.php?id=' . $thread->id); } } page_head(tra("Post to thread")); show_forum_header($logged_in_user); switch ($forum->parent_type) { case 0: $category = BoincCategory::lookup_id($forum->category); show_forum_title($category, $forum, $thread); break; case 1: show_team_forum_title($forum, $thread); break; } echo "<p>";
<?php $uid = $_SESSION['uid']; $post_cid = isset($_POST['post_cid']) ? $_POST['post_cid'] : ''; $post_course = course_load($post_cid); $cid = isset($_POST['cid']) ? $_POST['cid'] : ''; $week = isset($_POST['week']) ? $_POST['week'] : ''; $title = isset($_POST['title']) ? $_POST['title'] : ''; $url = isset($_POST['url']) ? $_POST['url'] : ''; $body = isset($_POST['body']) ? $_POST['body'] : ''; $answer = isset($_POST['answer']) ? $_POST['answer'] : ''; if (isset($_POST['submit'])) { create_post($uid, $cid, $week, $title, $url, $body, $answer); if (mysql_affected_rows($link) == 1) { sleep(1); header('location: ' . currentURL() . '?p=post'); print 'Post created. Click <a href="?p=post">here</a> to view created posts'; } else { print 'Post not created'; } } ?> <link rel="stylesheet" type="text/css" href="markitup/skins/markitup/style.css" /> <link rel="stylesheet" type="text/css" href="markitup/sets/html/style.css" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="markitup/jquery.markitup.js"></script> <script type="text/javascript" src="markitup/sets/html/set.js"></script> <script language="javascript"> $(document).ready(function() { $('#body').markItUp(myHtmlSettings); $('#answer').markItUp(myHtmlSettings);
<?php include_once '../../../includes/user.php'; include_once '../../../includes/topic.php'; include_once '../../../includes/thread.php'; include_once '../../../includes/post.php'; include_once '../../../includes/parsedown.php'; include_once '../../../includes/htmlpurifier/HTMLPurifier.auto.php'; session_start(); if (isset($_GET['id']) && isset($_POST['post_id']) && isset($_SESSION['user']) && isset($_POST['reply'])) { $thread_id = $_GET['id']; $post_id = $_POST['post_id']; $user = $_SESSION['user']; $parsedown = new Parsedown(); $reply = $parsedown->text($_POST['reply']); $htmlpurifierconfig = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($htmlpurifierconfig); $reply = $purifier->purify($reply); create_post(get_thread_by_id($thread_id), $user, $reply, get_post_by_id($post_id)); header("HTTP/1.1 303 See Other"); header("Location: /forum/thread/?id=" . $thread_id); } else { header("HTTP/1.1 400 Bad Request"); }
$post_author_id = ''; $post_author_url = ''; $post_excerpt = ''; $post_content = ''; $post_comments = $global_settings['allowcomments']; $post_image = ''; $post_comment_text = ''; $post_comment_option = ''; $post_comment_hidden = 0; if (isset($_POST) && !empty($_POST['title'])) { $admin_action = '?action=editpost&postid=' . $_POST['id']; $image_upload = isset($_FILES) && $_FILES['image']['error'] == 0 ? $_FILES : ''; // If publish button submitted if (isset($_POST['publish']) || isset($_POST['draftnew'])) { $draft = isset($_POST['draftnew']) ? true : false; if (create_post($_POST, $image_upload, $draft)) { $alert_msg = '<div class="success-msg"><p>Your post has been successfully published.<br>You can continue editing or leave safely.</p></div>'; } else { $alert_msg = '<div class="warning-msg"><p>Something went wrong please try again.</p></div>'; } //If save button submitted } else { if (isset($_POST['save']) || isset($_POST['draftsaved']) || isset($_POST['publishdraft'])) { if (isset($_POST['save'])) { $draft = null; } else { if (isset($_POST['draftsaved'])) { $draft = true; } else { if (isset($_POST['publishdraft'])) { $draft = false;
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ create_post($_POST['title'], $_POST['content']);
<?php include "../inc/config.php"; include "class/manager-functions.php"; $new_post_id = create_post(); ?> <meta http-equiv="refresh" content="1;url=<?php echo $tld2; ?> /manage/write.php?id=<?php echo $new_post_id; ?> ">