本文整理汇总了PHP中Render::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Render::post方法的具体用法?PHP Render::post怎么用?PHP Render::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Render
的用法示例。
在下文中一共展示了Render::post方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NOW
$privacy = $_POST['privacy'];
if (!is_numeric($id) || $privacy != "pub" && $privacy != "fri" && $privacy != "meo") {
$OP->ser();
}
if ($post == "") {
$OP->ser("Post is Blank", "The post content was left blank. It is not allowed.", "json");
}
$sql = $OP->dbh->prepare("UPDATE `posts` SET `post` = ?, `privacy` = ?, `time` = NOW() WHERE `id` = ? AND `uid` = ?");
$sql->execute(array($post, $privacy, $id, curUser));
if ($sql->rowCount() == 0) {
$OP->ser("No changes was made", "Either you didn't make any changes or you're no the owner of this post");
} else {
$sql = $OP->dbh->prepare("SELECT * FROM `posts` WHERE `id` = ?");
$sql->execute(array($id));
$postsArr = $sql->fetchAll(PDO::FETCH_ASSOC);
$html = Render::post($postsArr);
echo $html;
}
} elseif (isset($_POST['id'])) {
$sql = $OP->dbh->prepare("SELECT `post`, `privacy` FROM `posts` WHERE `id` = ? AND `uid` = ?");
$sql->execute(array($_POST['id'], curUser));
if ($sql->rowCount() == 0) {
$OP->ser();
}
$data = $sql->fetch(PDO::FETCH_ASSOC);
$post = $data['post'];
$pvc = $data['privacy'];
$arr = array();
$arr['textarea'] = "<textarea style='width: 100%;height:100px;'>" . $OP->format($post) . "</textarea>";
$arr['privacy'] = '<select name="privacy">
<option value="pub"' . ($pvc == "pub" ? "selected='selected'" : "") . '>Public</option>
示例2: preg_match
if ($path[0] == "/search") {
preg_match("/\\/search\\/(.*?)/", $matches);
$q = urldecode($matches[0]);
$sql = $OP->dbh->prepare("SELECT * FROM `posts` WHERE `id` > :lid AND `post` LIKE :q AND (\n `uid`=:who OR `uid` IN (\n SELECT `fid` FROM `conn` WHERE `uid`=:who\n ) AND (\n `privacy`='pub' OR (\n `privacy`='fri' AND `uid` IN (\n SELECT `fid` FROM `conn` WHERE `uid`=:who AND `fid` IN (\n SELECT `uid` FROM `conn` WHERE `fid`=:who\n )\n )\n )\n )\n ) ORDER BY `id` DESC LIMIT 10");
$sql->execute(array(":q" => "%{$q}%", ":who" => $who, ":lid" => $id));
} elseif ($_POST['pt'] == "profile") {
$pU = $path[1];
$sql = $OP->dbh->prepare("SELECT * FROM `posts` WHERE `id` > :lid AND `uid`=:fid ORDER BY `id` DESC LIMIT 10");
$sql->execute(array(":fid" => $pU, ":lid" => $id));
} else {
$sql = $OP->dbh->prepare("SELECT * FROM posts WHERE `id` > :lid AND (\n `uid`=:who OR `uid` IN (\n SELECT `fid` FROM `conn` WHERE `uid`=:who\n ) AND (\n `privacy`='pub' OR (\n `privacy`='fri' AND `uid` IN (\n SELECT `fid` FROM `conn` WHERE `uid`=:who AND `fid` IN (\n SELECT `uid` FROM `conn` WHERE `fid`=:who\n )\n )\n )\n )\n ) ORDER BY `id` DESC LIMIT 10");
$sql->execute(array(":who" => $who, ":lid" => $id));
}
if ($sql->rowCount() != 0) {
$postArr = $sql->fetchAll(PDO::FETCH_ASSOC);
$html = $OP->rendFilt(Render::post($postArr));
/* Give a fadein effect on new posts */
$effect = "";
foreach ($postArr as $id => $v) {
$effect .= "\$('#" . $id . ".post').hide().fadeIn(2000);";
}
$k = array_keys($postArr);
?>
if($(".post:first").attr("id") != "<?php
echo $k[0];
?>
"){
p="<?php
echo $html;
?>
";$(".post:first").before(p);
示例3: AND
<?php
require_once "render.php";
if (isset($_POST['user']) && $_POST['user'] != '') {
$sql = $OP->dbh->prepare("SELECT * FROM posts WHERE uid=:id AND (\n \t\tprivacy='pub' OR (\n \t\t\tprivacy='fri' AND uid IN (\n \t\t\t\tSELECT fid FROM conn WHERE uid=:who AND fid IN (\n \t\t\t\t\tSELECT uid FROM conn WHERE fid=:who\n \t\t\t\t)\n \t\t\t)\n \t\t)\n \t) ORDER BY id DESC LIMIT 5");
$sql->execute(array(":id" => $_POST['user'], ":who" => $who));
} elseif (isset($_GET['q']) && $_GET['q'] != "" && $_SERVER['REDIRECT_PAGE'] == "/search") {
$_GET['q'] = urldecode($_GET['q']);
$sql = $OP->dbh->prepare("SELECT * FROM posts WHERE post LIKE :q AND (\n \t\tprivacy='pub' OR (\n \t\t\tprivacy='fri' AND uid IN (\n \t\t\t\tSELECT fid FROM conn WHERE uid=:who AND fid IN (\n \t\t\t\t\tSELECT uid FROM conn WHERE fid=:who\n \t\t\t\t)\n \t\t\t)\n \t\t)\n \t) ORDER BY id DESC LIMIT 10");
$sql->execute(array(":q" => "%" . $_GET['q'] . "%", ":who" => $who));
} elseif (isset($_GET['q']) && $_GET['q'] == "" && $_SERVER['REDIRECT_PAGE'] == "/search") {
$sql = $OP->dbh->prepare("SELECT * FROM posts WHERE privacy='pub' OR (\n \t\tprivacy='fri' AND uid IN (\n \t\t\tSELECT fid FROM conn WHERE uid=:who AND fid IN (\n \t\t\t\tSELECT uid FROM conn WHERE fid=:who\n \t\t\t)\n \t\t)\n \t) ORDER BY id DESC LIMIT 10");
$sql->execute(array(":who" => $who));
} elseif (isset($_GET['id']) && $_GET['id'] != "" && $_SERVER['REDIRECT_PAGE'] == "/view") {
$sql = $OP->dbh->prepare("SELECT * FROM posts WHERE id=:id AND (\n \t\tprivacy='pub' OR (\n \t\t\tprivacy='fri' AND uid IN (\n \t\t\t\tSELECT fid FROM conn WHERE uid=:who AND fid IN (\n \t\t\t\t\tSELECT uid FROM conn WHERE fid=:who\n \t\t\t\t)\n \t\t\t)\n \t\t)\n \t) ORDER BY id DESC LIMIT 1");
$sql->execute(array(":who" => $who, ":id" => $_GET['id']));
} else {
$sql = $OP->dbh->prepare("SELECT * FROM posts WHERE uid=:who OR uid IN (\n \t\tSELECT fid FROM conn WHERE uid=:who\n \t) AND (\n \t\tprivacy='pub' OR (\n \t\t\tprivacy='fri' AND uid IN (\n \t\t\t\tSELECT fid FROM conn WHERE uid=:who AND fid IN (\n \t\t\t\t\tSELECT uid FROM conn WHERE fid=:who\n \t\t\t\t)\n \t\t\t)\n \t\t)\n \t) ORDER BY id DESC LIMIT 10");
$sql->execute(array(":who" => $who));
}
$postArr = $sql->fetchAll(PDO::FETCH_ASSOC);
echo Render::post($postArr);
if ($_SERVER['REDIRECT_PAGE'] != "/view") {
echo "<div class='load_more_posts'><div class='normal'>Load More Posts</div><div class='loader' hide><img src='" . HOST . "/cdn/img/load.gif' height='32' width='32'/><span>Loading More Posts</span></div></div>";
}