本文整理汇总了PHP中comments::add方法的典型用法代码示例。如果您正苦于以下问题:PHP comments::add方法的具体用法?PHP comments::add怎么用?PHP comments::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comments
的用法示例。
在下文中一共展示了comments::add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
if (isset($this->args[0]) && $this->args[0] != "index") {
system::setParam("page", "layout");
$cacheID = $this->args[0] . "|ARTICLE";
$this->smarty->setCacheID($cacheID);
if (isset($_POST["contentID"]) && $_POST["contentID"]) {
comments::add(intval($_POST["contentID"]));
}
$this->smarty->assign("isFav", blog::isFavorite($this->args[0]));
if (!$this->smarty->isCached()) {
$sqlData = blog::getOnePost($this->args[0], "article")->fetch();
if ($sqlData) {
$this->smarty->assign("comments", comments::get(intval($sqlData["contentID"])));
$this->smarty->assign("post", $sqlData);
}
}
} else {
$offset = 1;
system::setParam("page", "list");
if (isset($this->get["offset"])) {
$offset = intval($this->get["offset"]);
}
$cacheID = "ARTICLES|artoffset_{$offset}";
$this->smarty->setCacheID($cacheID);
if (!$this->smarty->isCached()) {
$allCount = $this->db->query("SELECT COUNT(*) as cnt FROM `content` WHERE `type`='article'")->fetch();
$this->smarty->assign("posts", news::getPosts(core::pagination($allCount["cnt"], $offset), "article")->fetchAll());
}
}
}
示例2: edit_form
/**
* Метод редактирования комментария
* @param int $id ID комментария
* @return null
*/
protected function edit_form($id)
{
$id = (int) $id;
lang::o()->get('comments');
$poster = db::o()->p($id)->query('SELECT poster_id, text FROM comments WHERE id=? LIMIT 1');
$poster = db::o()->fetch_assoc($poster);
if (!$poster) {
return;
}
if ($poster['poster_id'] == users::o()->v('id')) {
users::o()->check_perms('edit_comm');
} else {
users::o()->check_perms('edit_comm', 2);
}
$name = "comment_" . $id;
tpl::o()->assign("text", $poster['text']);
tpl::o()->assign("id", $id);
tpl::o()->assign("name", $name);
$this->comments->add("", $name, $id);
}
示例3: runJob
//.........这里部分代码省略.........
require_once 'systemStatus.class.php';
$ssObj = new systemStatus($this->db);
$ssObj->setProperties($props['items'][0]);
break;
case 'syncAnnouncements':
require_once 'apiCloud.class.php';
$apiObj = new apiCloud($this->db, $this->apiKey);
$resp = $apiObj->syncAnnouncements($this->cloudid);
if ($resp[result] !== false) {
$itemlist = $resp[items];
require_once 'systemStatus.class.php';
$ssObj = new systemStatus($this->db);
$ssObj->resetAnnouncements();
if (count($itemlist) > 0) {
foreach ($itemlist as $data) {
$ssObj->insertState('announcement', html_entity_decode($data['announce']));
}
}
}
break;
case 'syncNewswire':
/* deprecated
require_once ('apiCloud.class.php');
$apiObj=new apiCloud($this->db,$this->apiKey);
$resp=$apiObj->syncNewswire($this->cloudid,$this->timeStrToUnixModB($job->lastItemTime));
$itemlist=$resp[items];
echo 'count: '.count($itemlist).'<br />';
if (count($itemlist)>0) {
require_once('newswire.class.php');
$nwObj=new newswire($this->db);
$lastItemTime=date('Y-m-d H:i:s',(time()-(6*30*24*3600))); // set to six months earlier
foreach ($itemlist as $data) {
$wire=$nwObj->serialize($data[title],$data[caption],$data[blogtitle],$data[webpage],$data[date],$data[blogid]);
$id=$nwObj->add($wire);
if ($data[date]>$lastItemTime)
$lastItemTime=$data[date];
if ($id===false)
echo 'skip '.$data[title].'<br />';
else
echo 'adding '.$data[title].' id->'.$id.'<br />';
}
$this->db->update("cronJobs","lastItemTime='$lastItemTime'","id=$job->id");
}
*/
break;
case 'syncLog':
require_once 'apiCloud.class.php';
$apiObj = new apiCloud($this->db, $this->apiKey);
// request server ask for log
$resp = $apiObj->requestSyncLog($this->cloudid, URL_HOME, $this->timeStrToUnixModB($job->lastStart));
// get result of log sync
$logResult = $resp[items][0][log];
require_once PATH_CORE . "/classes/log.class.php";
$logObj = new log($this->db);
// process results from sync operation
$result = $logObj->receive($logResult);
echo $result;
break;
case 'syncContent':
// bring content from NewsCloud for this cloud to the remote site
require_once 'apiCloud.class.php';
$apiObj = new apiCloud($this->db, $this->apiKey);
$resp = $apiObj->syncContent($this->cloudid, $this->timeStrToUnixModB($job->lastItemTime));
$itemlist = $resp[items];
if (count($itemlist) > 0) {
require_once 'content.class.php';
示例4: _activityshow
public function _activityshow()
{
$Comments = new comments();
$Comments->add($_SESSION["USERID"], $_POST['activityrecive'], $_SESSION["ACTIVITYID"]);
$re = $Comments->show($_SESSION["ACTIVITYID"], $_POST['groupactivity']);
$i = $_POST['groupactivity'];
foreach ($re as $r) {
$commentshow .= "<div id='comment-" . $r->CommentsId . "' style='display:none'>\n\t\t\t\t<div id='comment_recive'>\n\t\t\t\t<div id='user_picture'><img src='/upload/avatar_small/" . $r->UserId . "_small.jpg' style='float:left'>\n\t\t\t\t</div>\n\t\t\t\t<div id='comment_text'>\n\t\t\t\t" . htmlspecialchars($r->CommentText) . "\n\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t</div>";
$i++;
$commentshow .= "<script>\$('#comment-" . $r->CommentsId . "').show('slow')</script>";
}
$commentshow .= "<script>\$('#groupactivity').val(" . $i . ");</script>";
echo $commentshow;
}
示例5: addCommentQueue
public static function addCommentQueue($contentID, $comments)
{
if (empty($comments)) {
return false;
}
foreach ($comments as $key => $value) {
if (!$comments[$key]) {
continue;
}
comments::add($contentID, $value);
}
return true;
}
示例6: define
}
break;
case 'readStory':
define("INIT_SESSION", true);
include_once 'initialize.php';
switch ($cmd) {
case 'addComment':
if (isset($_GET['siteContentId']) and isset($_GET['comments'])) {
$comments = $_GET['comments'];
$siteContentId = $_GET['siteContentId'];
if ($comments != '') {
require_once PATH_CORE . 'classes/comments.class.php';
$comObj = new comments($db);
$comInfo = $comObj->serialize(0, 0, $siteContentId, 0, $comments, 0, $db->ui->userid, $db->ui->memberName, '', 0);
// $db->ui->uid
$siteCommentId = $comObj->add($comInfo);
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($db);
$logItem = $logObj->serialize(0, $db->ui->userid, 'comment', $siteContentId);
$logItem->itemid2 = $siteCommentId;
// djm: hack for now so I have it
$inLog = $logObj->add($logItem);
$code = 'Your comment has been posted!';
} else {
$error = true;
$errorMsg = 'Please enter a valid comment.';
}
} else {
$error = true;
$errorMsg = 'There was a problem posting your comment.';
}
示例7: users
$usersClass = new users();
$item['user'] = $usersClass->get($item['user_id']);
abr('item', $item);
$commentsClass = new comments();
#举报评论
if (check_login_bool() && isset($_GET['report']) && is_numeric($_GET['report'])) {
$s = $commentsClass->report($_GET['report']);
if ($s === true) {
refresh('/' . $languageURL . 'items/comments/' . $itemID, $langArray['complete_report_comment'], 'complete');
} else {
addErrorMessage($s, '', 'error');
}
}
#添加评论
if (check_login_bool() && isset($_POST['add'])) {
$s = $commentsClass->add();
if ($s === true) {
refresh('/' . $languageURL . 'items/comments/' . $itemID, $langArray['complete_add_comment'], 'complete');
} else {
addErrorMessage($langArray['error_item_comment'], '', 'error');
}
} elseif (isset($_POST['add_reply'])) {
if (!isset($_POST['comment_id'])) {
$_POST['comment_id'] = 0;
}
$s = $commentsClass->add($_POST['comment_id']);
if ($s === true) {
refresh('/' . $languageURL . 'items/comments/' . $itemID, $langArray['complete_add_reply'], 'complete');
} else {
addErrorMessage($langArray['error_item_comment'], '', 'error');
}