本文整理汇总了PHP中add_post函数的典型用法代码示例。如果您正苦于以下问题:PHP add_post函数的具体用法?PHP add_post怎么用?PHP add_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_post函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_action
function add_action()
{
add_post();
$posts = get_all_posts();
$html = render_template("view/templates/admin.php", array('posts' => $posts));
return new Response($html);
}
示例2: newpost
function newpost()
{
$title = $_POST['post_title'];
$text = $_POST['post_text'];
$category = $_POST['post_category'];
$author = $_SESSION['user_id'];
add_post($title, $text, $category, $author);
}
示例3: add_action
public function add_action()
{
$postModel = new PostModel();
add_post();
$posts = $postModel->get_all_rows();
$html = $this->render_template("view/templates/admin.php", array('posts' => $posts));
return new Response($html);
}
示例4: add_action
function add_action()
{
add_post();
$posts = get_all_posts();
$html = render_template('View/Templates/admin.php', array('posts' => $posts));
return $html;
//require "View/Templates/show.php";
// require "View/Templates/list.php";
}
示例5: admin_action
function admin_action()
{
if (isset($_POST['submit'])) {
add_post();
}
$posts = get_all_posts();
$html = render_template('view/templates/admin.php', array('posts' => $posts));
return $html;
//require "view/templates/admin.php";
}
示例6: preparse_bbcode
$message = preparse_bbcode($message, $errors);
}
if ($message == '') {
$errors[] = $lang_post['No message'];
}
$hide_smilies = isset($_POST['hide_smilies']) ? 1 : 0;
$subscribe = isset($_POST['subscribe']) ? 1 : 0;
$now = time();
($hook = get_hook('po_end_validation')) ? eval($hook) : null;
// Did everything go according to plan?
if (empty($errors) && !isset($_POST['preview'])) {
// If it's a reply
if ($tid) {
$post_info = array('is_guest' => $forum_user['is_guest'], 'poster' => $username, 'poster_id' => $forum_user['id'], 'poster_email' => $forum_user['is_guest'] && $email != '' ? $email : null, 'subject' => $cur_posting['subject'], 'message' => $message, 'hide_smilies' => $hide_smilies, 'posted' => $now, 'subscr_action' => $forum_config['o_subscriptions'] == '1' && $subscribe && !$is_subscribed ? 1 : ($forum_config['o_subscriptions'] == '1' && !$subscribe && $is_subscribed ? 2 : 0), 'topic_id' => $tid, 'forum_id' => $cur_posting['id'], 'update_user' => true, 'update_unread' => true);
($hook = get_hook('po_pre_add_post')) ? eval($hook) : null;
add_post($post_info, $new_pid);
} else {
if ($fid) {
$post_info = array('is_guest' => $forum_user['is_guest'], 'poster' => $username, 'poster_id' => $forum_user['id'], 'poster_email' => $forum_user['is_guest'] && $email != '' ? $email : null, 'subject' => $subject, 'message' => $message, 'hide_smilies' => $hide_smilies, 'posted' => $now, 'subscribe' => $forum_config['o_subscriptions'] == '1' && (isset($_POST['subscribe']) && $_POST['subscribe'] == '1'), 'forum_id' => $fid, 'update_user' => true, 'update_unread' => true);
($hook = get_hook('po_pre_add_topic')) ? eval($hook) : null;
add_topic($post_info, $new_tid, $new_pid);
}
}
($hook = get_hook('po_pre_redirect')) ? eval($hook) : null;
redirect(forum_link($forum_url['post'], $new_pid), $lang_post['Post redirect']);
}
}
// Are we quoting someone?
if ($tid && isset($_GET['qid'])) {
$qid = intval($_GET['qid']);
if ($qid < 1) {
示例7: post
post('/add/post', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$fi = from($_REQUEST, 'fi');
$vid = from($_REQUEST, 'vid');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
$description = from($_REQUEST, 'description');
$user = $_SESSION[config("site.url")]['user'];
if ($proper && !empty($title) && !empty($tag) && !empty($content)) {
if (!empty($url)) {
add_post($title, $tag, $url, $content, $user, $description, $fi, $vid);
} else {
$url = $title;
add_post($title, $tag, $url, $content, $user, $description, $fi, $vid);
}
} else {
$message['error'] = '';
if (empty($title)) {
$message['error'] .= '<li>Title field is required.</li>';
}
if (empty($tag)) {
$message['error'] .= '<li>Tag field is required.</li>';
}
if (empty($content)) {
$message['error'] .= '<li>Content field is required.</li>';
}
if (!$proper) {
$message['error'] .= '<li>CSRF Token not correct.</li>';
}
示例8: add_post
$errors[] = '*You need a description!';
}
if (empty($act)) {
$errors[] = '*You need an act name!';
}
if (empty($characters)) {
$errors[] = '*You need to name the actors!';
}
if (!category_exists('id', $_POST['category'])) {
$errors[] = '*That category does not exists';
}
if (empty($videoname)) {
$errors[] = '*You need to name the video!';
}
if (empty($errors)) {
add_post($title, $act, $characters, $contents, $videoname, $_POST['category']);
$id = mysql_insert_id();
header("Location:index.php?id={$id}");
die;
}
}
session_start();
if (!isset($_SESSION["sess_user"])) {
header("location: ../login.php");
} else {
?>
<!DOCTYPE html>
<html>
<head>
<title>DMS - Add Content</title>
<link rel="stylesheet" type="text/css" href="resources/cms.css">
示例9: error_reporting
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
require_once "includes.php";
if (!isset($_GET["course"]) || $_GET["course"] == "") {
header("Location: /" . SITE_ROOT);
}
$course = get_course_info($_GET["course"]);
if (!is_course_registered($course["id"], $account)) {
header("Location: /" . SITE_ROOT);
}
$title = $course["department"] . $course["number"];
require_once "header_home.php";
if ($account === false) {
header("Location: /" . SITE_ROOT);
}
if (isset($_POST["content"]) && $_POST["content"] != "") {
add_post($account, $course["id"], $_POST["content"]);
}
if (isset($_GET["attend"]) && $_GET["attend"] != "") {
if (is_attending($account, $_GET["attend"])) {
leave_post($account, $_GET["attend"]);
} else {
attend_post($account, $_GET["attend"]);
}
header("Location: /" . SITE_ROOT . "/posts?course=" . $_GET["course"]);
}
if (isset($_GET["finish"]) && $_GET["finish"] != "") {
finish_post($_GET["finish"]);
header("Location: /" . SITE_ROOT . "/posts?course=" . $_GET["course"]);
}
$account_info = get_account_info($account);
?>
示例10: session_start
<?php
session_start();
include_once "server.php";
include_once "functions.php";
$userid = $_SESSION["user_id"];
$body = substr($_POST["body"], 0, 140);
//$userid = 1;
//$body = "hello";
add_post($userid, $body);
$_SESSION['message'] = "Your post has been added!";
header("Location:index.php");
示例11: add_post
return $var;
}
//Отправка сообщения.
function add_post($name, $msg)
{
$name = clearData($name);
$msg = clearData($msg);
if (empty($name)) {
$name = 'Гость';
}
if (!empty($msg)) {
$query = "INSERT INTO msg (username, post)\n\t\t\t\tVALUES ('{$name}','{$msg}')";
if (mysql_query($query)) {
$res = 0;
} else {
$res = 1;
}
}
return $res;
}
$send = add_post($name, $msg);
if ($send != 0) {
echo 'Произошла ошибка, попробуйте ещё раз';
} else {
$last_id = mysql_insert_id();
$query = "SELECT username, post, LEFT(date, 16) AS date FROM msg WHERE id = {$last_id}";
$res = mysql_query($query);
$arr_res = mysql_fetch_assoc($res);
echo json_encode($arr_res);
}
mysql_close();
示例12: post
post('/add/post', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
$description = from($_REQUEST, 'description');
$user = $_SESSION[config("site.url")]['user'];
$draft = from($_REQUEST, 'draft');
$category = from($_REQUEST, 'category');
if ($proper && !empty($title) && !empty($tag) && !empty($content)) {
if (!empty($url)) {
add_post($title, $tag, $url, $content, $user, $description, $draft, $category);
} else {
$url = $title;
add_post($title, $tag, $url, $content, $user, $description, $draft, $category);
}
} else {
$message['error'] = '';
if (empty($title)) {
$message['error'] .= '<li>Title field is required.</li>';
}
if (empty($tag)) {
$message['error'] .= '<li>Tag field is required.</li>';
}
if (empty($content)) {
$message['error'] .= '<li>Content field is required.</li>';
}
if (!$proper) {
$message['error'] .= '<li>CSRF Token not correct.</li>';
}
示例13: get_user_by_email
get_user_by_email($_REQUEST['email']);
break;
case 'get_user_by_id':
get_user_by_id($_REQUEST['id_user']);
break;
case 'change_password':
change_password($_REQUEST['username'], $_REQUEST['password']);
break;
case 'get_markers':
get_markers();
break;
case 'get_markers_by_category':
get_markers_by_category($_REQUEST['id_categoria']);
break;
case 'add_post':
add_post($_REQUEST['id_user'], $_REQUEST['post_title'], $_REQUEST['post_content']);
break;
case 'get_post':
get_post($_REQUEST['id_post']);
break;
case 'get_comments':
get_comments($_REQUEST['id_post']);
break;
case 'comment_post':
comment_post($_REQUEST['id_post'], $_REQUEST['username'], $_REQUEST['id_user'], $_REQUEST['comment']);
break;
case 'qualify':
qualify($_REQUEST['id_usuario'], $_REQUEST['qualification']);
break;
case 'get_average':
get_average();
示例14: array
<?php
include_once 'resources/midd.php';
if (isset($_POST['image'])) {
$errors = array();
$image = trim($_POST['image']);
if (empty($errors)) {
add_post($image);
}
}
session_start();
if (!isset($_SESSION["sess_user"])) {
header("location: ../login.php");
} else {
?>
<!DOCTYPE html>
<html>
<head>
<title>DMS - Add Content</title>
<link rel="stylesheet" type="text/css" href="resources/cms.css">
</head>
<body>
<div id="fullwidth">
<div class="wrapper">
<div id="dmslogo"><img src="images/dmslogo.PNG" /></div>
<div id="navmove">
</div>
<div class="logout">Hello <?php
echo $_SESSION['sess_user'];
?>
示例15: engine_doit
//.........这里部分代码省略.........
require_once("template/TUser.php");
require_once("class/User.php");
global $user;
$tuser = new TUser();
if (!isset($_GET['id_user']) || !isset($_GET['anon_user'])){
$tuser->setUser($user);
$tuser->setWithEmail(true);
} else{
if ($_GET['anon_user']){
$u = new AnonUser(); $u->setId($_GET['id_user']);
} else {
$u = new RegUser(); $u->setId($_GET['id_user']);
}
$tuser->setUser($u);
}
$result['user']=$tuser->getJsonTags();
break;
case 'add_topic':
require_once('controller/add_topic.php');
$result['add_topic']=add_topic();
break;
case 'add_message':
require_once('controller/add_message.php');
$result['add_message']=add_message();
break;
case 'read_message':
require_once('controller/read_message.php');
$result['read_message']=read_message();
break;
case 'add_channel':
require_once('controller/add_channel.php');
$result['add_channel']=add_channel();
break;
case 'add_post':
require_once('controller/add_post.php');
$result['add_post']=add_post();
break;
case 'update_channel':
require_once('controller/update_channel.php');
$result['update_channel']=update_channel();
break;
case 'update_topic':
require_once('controller/update_topic.php');
$result['update_topic']=update_topic();
break;
case 'update_post':
require_once('controller/update_post.php');
$result['update_post']=update_post();
break;
case 'followtopic':
require_once('controller/followtopic.php');
$result['followtopic']=followtopic();
break;
case 'unfollowtopic':
require_once('controller/unfollowtopic.php');
$result['unfollowtopic']=unfollowtopic();
break;
case 'followchannel':
require_once('controller/followchannel.php');
$result['followchannel']=followchannel($_GET['channelid_followchannel']);
break;
case 'followchannels':
require_once('controller/followchannel.php');
$chids=explode(",",$_GET['channelids_followchannels']);
for ($i=0;$i<count($chids);$i++)
$result['followchannels'][$i]=followchannel($chids[$i]);