本文整理汇总了PHP中post类的典型用法代码示例。如果您正苦于以下问题:PHP post类的具体用法?PHP post怎么用?PHP post使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了post类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: q_header
function q_header($database, &$array)
{
$dk = 1;
$search = 0;
$orderby = 'ORDER BY post_on DESC';
$limit = ' LIMIT 0, 10 ';
if (!empty($_GET['post_permalink'])) {
$value = addslashes($_GET['post_permalink']);
$dk = array('post_permalink' => $value);
}
if (!empty($_GET['cat_permalink'])) {
$value = addslashes($_GET['cat_permalink']);
$dk = array('cat_permalink' => $value);
}
if (!empty($_GET['author'])) {
$value = addslashes($_GET['author']);
$dk = array('user_name' => $value);
}
if (!empty($_GET['search'])) {
$search = 1;
$value = addslashes($_GET['search']);
$dk = array('post_name' => $value);
}
$post = new post($database);
$post->have_posts($dk, $search, $orderby, $limit);
if (isset($post->r)) {
if (mysqli_num_rows($post->r) > 0) {
while ($m = mysqli_fetch_array($post->r, MYSQLI_ASSOC)) {
$array[] = $m;
}
}
}
// print_r($array);
}
开发者ID:vanquan805,项目名称:newproject,代码行数:34,代码来源:functions.php
示例2: adminNotify
public function adminNotify()
{
if ($this->cookie->check("id_user") and $this->cookie->id_user == 1) {
//no notificamos a administrador de su propio comentario.
return;
}
$id = $this->registry->lastCommentID;
$Comment = new comment();
$comment = $Comment->find($id);
$comment['content'] = utils::nl2br($comment['content']);
if (!defined('GESHI_VERSION')) {
$comment['content'] = $this->comment_source_code_beautifier($comment['content'], 'addTagPRE');
} else {
$comment['content'] = $this->comment_source_code_beautifier($comment['content']);
}
$User = new user();
$user = $User->find(1);
$Post = new post();
$post = $Post->find($comment['ID_post']);
$commentsWaiting = $Comment->countCommentsByPost(null, 'waiting');
$mailStr = "\n\t\t\t<table width=\"100%\">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<small>\n\t\t\t\t\t\t<strong>From IP</strong>: {$comment['IP']}<br />\n\t\t\t\t\t\t<strong>URL</strong>: <a href=\"{$comment['url']}\">{$comment['url']}</a><br />\n\t\t\t\t\t\t<strong>Email</strong>: <a href=\"mailto:{$comment['email']}\">{$comment['email']}</a><br />\n\t\t\t\t\t\t<strong>DateTime</strong>: {$comment['created']}<br />\n\t\t\t\t\t</small>\n\t\t\t\t\t<hr>\n\t\t\t\t\t<strong>Author</strong>: {$comment['author']}<br />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr><td><strong>Content</strong></td></tr>\n\t\t\t<tr><td bgcolor=\"#f7f7f7\">\n\t\t\t\t{$comment['content']}\n\t\t\t\t<hr />\n\t\t\t</td></tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tModerate comment: <a href=\"{$this->registry->path}comments/edit/{$comment['ID']}\">{$this->registry->path}comments/edit/{$comment['ID']}</a><br />\n\t\t\t\t\t\tView entry: <a href=\"{$this->registry->path}{$post['urlfriendly']}\">{$this->registry->path}{$post['urlfriendly']}</a>\n\t\t\t\t\t</p>\n\t\t\n\t\t\t\t\t<p>\n\t\t\t\t\t\tThere are {$commentsWaiting} comments waiting for approbal. <br />\n\t\t\t\t\t\tPlease moderate comments: <a href=\"{$this->registry->path}comments/waiting\">{$this->registry->path}comments</a>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t</table>\n\t\t";
$conf = $this->registry->conf;
$subject = "[{$conf['blog_name']}] Nuevo Comentario en: {$post['title']}";
$this->enviaMail($user['email'], $subject, $mailStr, $user['email']);
}
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:25,代码来源:commentNotify.plugin.php
示例3: getPosts
public function getPosts($status = null, $limitQuery = null)
{
$P = new post();
$posts = array();
if (is_null($status) === true) {
$posts = $P->findAll("ID,id_user,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", 'ID DESC', $limitQuery, null);
} else {
if (is_array($status) === false) {
$posts = $P->findAll("ID,id_user,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", 'ID DESC', $limitQuery, "WHERE status='{$status}'");
} else {
$status_sql = "";
foreach ($status as $st) {
$status_sql .= "status ='{$st}' OR ";
}
$status_sql = substr($status_sql, 0, -3);
$posts = $P->findAll("ID,id_user,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", 'ID DESC', $limitQuery, "WHERE ({$status_sql})");
}
}
$C = new comment();
foreach ($posts as $k => $p) {
$posts[$k]['title'] = htmlspecialchars($posts[$k]['title']);
$posts[$k]['tags'] = $this->getTags($posts[$k]['ID']);
$posts[$k]['comments_count'] = $C->countCommentsByPost($posts[$k]['ID'], "publish");
$U = new user();
if ($posts[$k]['id_user'] < 2) {
$posts[$k]['autor'] = $U->find(1);
} else {
$posts[$k]['autor'] = $U->find($posts[$k]['id_user']);
}
}
return $posts;
}
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:32,代码来源:post.php
示例4: createPost
/**
* Create a post
*/
public static function createPost()
{
if (!Flight::has('currentUser')) {
Flight::redirect('/');
}
$post = new post(['user' => Flight::get('currentUser')->id, 'title' => Flight::request()->data->title, 'content' => Flight::request()->data->content]);
$post->store();
}
开发者ID:happyoniens,项目名称:Blog,代码行数:11,代码来源:postController.php
示例5: getPosts
function getPosts($dbh)
{
$stmt = $dbh->prepare("select * from " . post::$table_name . " ORDER BY id DESC;");
$stmt->execute();
$result = array();
while ($row = $stmt->fetch()) {
$p = new post();
$p->copyFromRow($row);
$result[] = $p;
}
return $result;
}
开发者ID:kelmo2,项目名称:leagueOfLegendsClubSite,代码行数:12,代码来源:post.php
示例6: posts_of_user
public function posts_of_user($orderby = 'ORDER BY post_on DESC', $limit = 0)
{
if ($this->is_admin()) {
$post = new post($this->db);
$post->posts_of_user(array('user_id' => $this->user_id), 0, $orderby, $limit);
if (mysqli_num_rows($post->r) > 0) {
$this->post = $post->r;
return true;
} else {
return false;
}
} else {
return false;
}
}
开发者ID:vanquan805,项目名称:newproject,代码行数:15,代码来源:class.user.php
示例7: rss
public function rss($id = NULL)
{
$this->plugin->call('feed_header');
$post = new post();
$this->view->conf = $this->conf;
$this->view->setLayout("feed");
$posts = $post->findAll("ID,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", "ID DESC", $this->conf['blog_posts_per_page'], "WHERE status = 'publish'");
$temp = array();
foreach ($posts as $a_post) {
$temp[$a_post['ID']] = $a_post;
$temp[$a_post['ID']]['tags'] = $post->getTags($a_post['ID'], 'string');
}
$this->view->posts = $temp;
$this->render("rss");
}
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:15,代码来源:feed_controller.php
示例8: __construct
function __construct()
{
$this->session = session::getInstance();
$this->post = post::getInstance();
$this->get = get::getInstance();
$this->http = http::getInstance();
$this->file = new file();
$this->cookie = new cookie(config('cookie'));
}
开发者ID:jin123456bat,项目名称:home,代码行数:9,代码来源:base.php
示例9: __construct
function __construct()
{
$this->session = session::getInstance();
$this->post = post::getInstance();
$this->get = get::getInstance();
$this->http = http::getInstance();
$this->file = file::getInstance();
$this->cookie = cookie::getInstance();
}
开发者ID:jin123456bat,项目名称:Framework2.0,代码行数:9,代码来源:base.php
示例10: update
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update(PostEditFormRequest $request, $id)
{
//Actualiza un post
$post = post::whereId($id)->firstOrFail();
$post->title = $request->get('title');
$post->content = $request->get('content');
$post->slug = Str::slug($request->get('title'), '-');
$post->save();
$post->categories()->sync($request->get('categories'));
return redirect(action('Admin\\PostsController@edit', $post->id))->with('status', 'The post has been updated!');
}
开发者ID:quantumbla,项目名称:dyt,代码行数:18,代码来源:PostsController.php
示例11: submit
public function submit()
{
$post = $_POST;
$file = $_FILES['file_upload'];
$request = new post($post, $file);
$submission = $request->getPost();
$database = new database();
$query = $database->query();
$image = new image($query, $submission);
// upload image
try {
$upload = $image->upload();
} catch (Exception $e) {
echo 'Message: ' . $e->getMessage();
}
// insert image
if (isset($upload) && $upload == 'success') {
$images = new image($query, $submission);
$image->insert();
}
}
开发者ID:nicolas-thompson,项目名称:scheduler,代码行数:21,代码来源:administration.php
示例12: edit
public function edit($id = NULL)
{
$id = (int) $id;
if (!$id) {
$this->redirect('comments');
}
$this->view->conf = $this->conf;
$Comment = new comment();
$comment = $Comment->find($id);
$comment['content'] = utils::convert2HTML($comment['content']);
$Post = new post();
$post = $Post->findBy('ID', $comment['ID_post']);
$comment['post'] = array('urlfriendly' => $post['urlfriendly'], 'title' => $post['title']);
$this->view->comment = $comment;
$this->view->id = $id;
$statuses = array("publish", "waiting");
$this->view->statuses = $statuses;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST['cancelar'])) {
$this->redirect("comments");
} else {
###########
# Las siguientes dos lineas no deberian estar pero algo anda mal con el ActiveRecord que no deja las variables
# de las consultas que se realizan directamente desde dentro de algun metodo en el model con $this->db->query e interfiere
# con el actualizar por que podria haber campos que no se requieren en la actualizacion.
###########
$comment = new comment();
#######
$comment->find($id);
#######
$comment->prepareFromArray($_POST);
$comment->save();
$this->redirect("comments/edit/{$id}");
}
} else {
$this->view->setLayout("admin");
$this->title_for_layout($this->l10n->__("Editar comentario - Codice CMS"));
$this->render();
}
}
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:40,代码来源:comments_controller.php
示例13: get
/**
* Load post from database. Returns false, if the post doesn't exist
* @param int $post_id
* @return boolean|Gn36\OoPostingApi\post
*/
static function get($post_id)
{
global $db;
$sql = "SELECT * FROM " . POSTS_TABLE . " WHERE post_id=" . intval($post_id);
$result = $db->sql_query($sql);
$post_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$post_data) {
//post does not exist, return false
return false;
}
return post::from_array($post_data);
}
开发者ID:gn36,项目名称:phpbb-oo-posting-api,代码行数:18,代码来源:post.php
示例14: index
public function index($id = NULL, $page = 1)
{
if (is_null($id) or is_numeric($id)) {
$this->redirect($this->conf['blog_siteurl']);
}
$tag = $id;
$post = new post();
$link = new link();
$comment = new comment();
$this->html->useTheme($this->conf['blog_current_theme']);
$info = array();
$info["isAdmin"] = false;
if ($this->cookie->check("logged") and $this->cookie->id_user == 1) {
$info["isAdmin"] = true;
}
$this->themes->info = $info;
$includes['charset'] = $this->html->charsetTag("UTF-8");
$includes['rssFeed'] = $this->html->includeRSS();
if ($page > 1) {
$includes['canonical'] = "<link rel=\"canonical\" href=\"{$this->conf['blog_siteurl']}/tag/" . rawurlencode($post->sql_escape($id)) . "/{$page}\" />";
} else {
$includes['canonical'] = "<link rel=\"canonical\" href=\"{$this->conf['blog_siteurl']}/tag/" . rawurlencode($post->sql_escape($id)) . "\" />";
}
$this->registry->includes = $includes;
$this->plugin->call('index_includes');
$includes = null;
foreach ($this->registry->includes as $include) {
$includes .= $include;
}
$this->themes->includes = $includes;
$this->themes->links = $link->findAll();
$this->themes->single = false;
$total_rows = $post->countPosts(array('status' => 'publish', 'tag' => $tag));
$page = (int) is_null($page) ? 1 : $page;
$limit = $this->conf['blog_posts_per_page'];
$offset = ($page - 1) * $limit;
$limitQuery = $offset . "," . $limit;
$targetpage = $this->path . "tag/{$tag}/";
$this->themes->pagination = $this->pagination->init($total_rows, $page, $limit, $targetpage);
$posts = $post->getPostsByTag($tag, $limitQuery);
foreach ($posts as $k => $p) {
$posts[$k]['title'] = htmlspecialchars($p['title']);
$posts[$k]['tags'] = $post->getTags($p['ID']);
$posts[$k]['comments_count'] = $comment->countCommentsByPost($posts[$k]['ID']);
$user = new user();
if ($posts[$k]['id_user'] < 2) {
$posts[$k]['autor'] = $user->find(1);
} else {
$posts[$k]['autor'] = $user->find($posts[$k]['id_user']);
}
}
$this->registry->posts = $posts;
$this->plugin->call("index_post_content");
$this->themes->posts = $this->registry->posts;
$this->themes->title_for_layout = "{$this->conf['blog_name']} - {$tag}";
$this->render();
}
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:57,代码来源:tag_controller.php
示例15: post
<?php
//number of comments/page
$limit = 10;
//number of pages to display. number - 1. ex: for 5 value should be 4
$page_limit = 6;
//Load required class files. post.class and cache.class
$post = new post();
$cache = new cache();
header("Cache-Control: store, cache");
header("Pragma: cache");
$domain = $cache->select_domain();
$id = $db->real_escape_string($_GET['id']);
if (!is_numeric($id)) {
$id = str_replace("#", "", $id);
}
$id = (int) $id;
$date = date("Ymd");
//Load post_table data and the previous next values in array. 0 previous, 1 next.
$post_data = $post->show($id);
//Check if data exists in array, if so, kinda ignore it.
if ($post_data == "" || is_null($post_data)) {
header('Location: index.php?page=post&s=list');
exit;
}
$prev_next = $post->prev_next($id);
if (!is_dir("{$main_cache_dir}" . "" . "\\cache/{$id}")) {
$cache->create_page_cache("cache/{$id}");
}
$data = $cache->load("cache/" . $id . "/post.cache");
if ($data !== false) {
开发者ID:xfirespeed,项目名称:TyP-Gallery,代码行数:31,代码来源:post_view.php
示例16: ini_set
ini_set('error_log', NULL);
ini_set('max_execution_time', 0);
ini_set('log_errors', 0);
require_once "./config.php";
require_once "./geshi/geshi.php";
require_once "./class/utilities_class.php";
require_once "./class/phpfiglet_class.php";
require_once "./class/mybb_class.php";
require_once "./class/html_class.php";
require_once "./class/cookie_class.php";
require_once "./class/admin_class.php";
require_once "./class/post_class.php";
/*
* Create instance of all available Class object
*/
$post_inst = new post();
$phpFiglet = new phpFiglet();
$inst_post = new mybb_style();
$htmlinst = new html();
$admin = new adminclass();
$util = new utilities();
$cook = new cookie();
/*
* Check if sqlite database file is not existed
* If yes, then redirect to create.php
*/
if (sqlite_file == '' || !file_exists(sqlite_file)) {
$htmlinst->change_location("./create.php");
}
$_SERVER['REMOTE_ADDR'] = $util->get_client_ip($_SERVER);
$phpFiglet->loadFont("./figlet/spliff.flf");
开发者ID:shahril96,项目名称:Old-Skool,代码行数:31,代码来源:index.php
示例17: die
<h5>' . $note['postTitle'];
if ($note['imp'] == 1) {
$content .= '<span class="imp">Imp</span>';
}
$content .= '
</h5>
<span>' . $note['class'] . ' | ' . $note['facultyName'] . ' | ' . $note['subjectName'] . '</span>
</div>
<div class="cleaner"></div>
</div>
</a>';
}
}
}
} else {
$questions = post::all(1, $postTypId);
if (!$questions) {
die($e);
} else {
if ($questions == 'empty') {
$title = 'No Question posted';
$titleBar = 'Questions';
$content = '<center><img src="' . $website . 'assets/img/smile_face.png" /><br /><p style="color:#AAA;font-size:1.5em;">No Questions to Show</p></center>';
} else {
$title = 'Questions';
$titleBar = $title;
$content = '';
foreach ($questions as $note) {
$dateArray = getdate(strtotime($note['postDate']));
$content .= '
<a href="' . generate_link($note['postTitle'], $note['postId']) . '" class="pl-anchor">
开发者ID:amriterry,项目名称:ptn,代码行数:31,代码来源:index.php
示例18: foreach
$this->db1->query("UPDATE users SET active=" . $status . " WHERE iduser=" . $uid . " LIMIT 1");
$txtreturn = $this->lang('admin_txt_msgok');
echo '1: ' . $txtreturn;
return;
}
if ($action == 2) {
$this->db1->query("UPDATE users SET leveladmin=" . $levelnivel . ", is_network_admin=" . $level . " WHERE iduser=" . $uid . " LIMIT 1");
$txtreturn = $this->lang('admin_txt_msgok');
echo '1: ' . $txtreturn;
return;
}
if ($action == 3) {
// look for the ids of albums
$allposts = $this->network->getPostsUser($uid);
foreach ($allposts as $onepost) {
$onepost = new post($onepost->code);
$onepost->deletePost();
unset($onepost);
}
$this->db1->query("DELETE FROM activities WHERE iduser=" . $uid);
$this->db1->query("DELETE FROM chat WHERE id_from=" . $uid . " OR id_to=" . $uid);
/*****************/
$r = $this->db2->fetch_all('SELECT idpost FROM comments WHERE iduser=' . $uid);
foreach ($r as $oneitem) {
$this->db1->query("UPDATE posts SET numcomments=numcomments-1 WHERE idpost=" . $oneitem->idpost);
}
$this->db1->query("DELETE FROM comments WHERE iduser=" . $uid);
/**************/
$r = $this->db2->fetch_all('SELECT idpost FROM likes WHERE iduser=' . $uid);
foreach ($r as $oneitem) {
$this->db1->query("UPDATE posts SET numlikes=numlikes-1 WHERE idpost=" . $oneitem->idpost);
开发者ID:waqasraza123,项目名称:social_network_in_php_frenzy,代码行数:31,代码来源:ajax_admin-details.php
示例19: empty
}
$theactivity = $this->db2->fetch("SELECT idpost, posts.iduser, posts.whendate, username, firstname, lastname, avatar, users.code as ucode FROM posts, users WHERE posts.code='" . $D->codpost . "' AND users.iduser=posts.iduser LIMIT 1");
if (!$theactivity) {
$this->redirect($C->SITE_URL . $D->u->username);
}
$D->nameUser = empty($D->u->firstname) || empty($D->u->lastname) ? $D->u->username : $D->u->firstname . ' ' . $D->u->lastname;
$D->htmlResult = '';
$D->userName = $theactivity->username;
$D->nameUser = empty($theactivity->firstname) || empty($theactivity->lastname) ? $theactivity->username : $theactivity->firstname . ' ' . $theactivity->lastname;
$D->userAvatar = $theactivity->avatar;
$D->isThisUserVerified0 = $this->network->isUserVerified($theactivity->iduser);
$D->a_date = $theactivity->whendate;
$D->codeUser = $theactivity->ucode;
$D->idpost = $theactivity->idpost;
$D->codepost = $D->codpost;
$onePost = new post($D->codepost);
$D->idUser = $onePost->iduser;
$D->typepost = $onePost->typepost;
$D->numlikes = $onePost->numlikes;
$D->numcommentstotal = $onePost->numcomments;
$D->post = stripslashes($onePost->post);
$D->typepost = $onePost->typepost;
$D->valueattach = $onePost->valueattach;
$D->idpostShared = $D->idpost;
$D->isShare = 0;
if ($D->typepost == 'share') {
$infop = explode(':', $D->valueattach);
$D->idpostShared = $infop[0];
$D->isShare = 1;
}
// see if the favorite is for the observer
开发者ID:waqasraza123,项目名称:social_network_in_php_frenzy,代码行数:31,代码来源:posts.php
示例20: date_default_timezone_set
<?php
date_default_timezone_set("Asia/Manila");
$date = date('Y-m-d H:i:s');
if (isset($_POST['btnpost'])) {
include_once "post.php";
$param = array("postTitle" => $_POST["title"], "postDesc" => $_POST["desc"], "userID" => $_SESSION['id'], "topicID" => $_GET['topicid'], "datePosted" => $date, "postStatus" => 1, "postLevel" => $_SESSION['level']);
$query = new post();
$query->create("tblpost", $param);
}
if (isset($_POST['btntopic'])) {
include_once "topic.php";
$param = array("topicTitle" => $_POST["title"], "topicDesc" => $_POST["content"], "dateCreated" => $date, "forumCatID" => $_POST["cbocategory"], "topicStatus" => 1);
$query = new topic();
$query->create("tbltopic", $param);
}
if (isset($_POST['btnreply'])) {
include_once "post.php";
$param = array("replyContent" => $_POST["message"], "postID" => $_GET["postid"], "userID" => $_SESSION["id"], "datePosted" => $date, "replyLevel" => $_SESSION["level"], "replyStatus" => 1);
$query = new post();
$query->add("tblreply", $param);
}
开发者ID:rexghadaffi,项目名称:newPacion,代码行数:22,代码来源:modal_controller.php
注:本文中的post类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论