本文整理汇总了PHP中Comments::vote_comment方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::vote_comment方法的具体用法?PHP Comments::vote_comment怎么用?PHP Comments::vote_comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::vote_comment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: urlencode
if ($threadId) {
// If the samely titled comment already
// exists, go straight to it.
$url = 'tiki-view_forum_thread.php?comments_parentId=' . urlencode($threadId) . '&forumId=' . urlencode($_REQUEST["forumId"]);
header('location: ' . $url);
exit;
}
}
if ($tiki_p_admin_forum == 'y' || $tiki_p_forum_vote == 'y') {
// Process a vote here
if (isset($_REQUEST['comments_vote']) && isset($_REQUEST['comments_threadId'])) {
check_ticket('view-forum');
$comments_show = 'y';
if ($tikilib->register_user_vote($user, 'comment' . $_REQUEST['comments_threadId'], $_REQUEST['comments_vote'], range(1, 5))) {
$commentslib->vote_comment($_REQUEST['comments_threadId'], $user, $_REQUEST['comments_vote']);
}
$_REQUEST['comments_threadId'] = 0;
$smarty->assign('comments_threadId', 0);
}
}
if ($user) {
$userinfo = $userlib->get_user_info($user);
$smarty->assign_by_ref('userinfo', $userinfo);
}
if (isset($_REQUEST['comments_remove']) && isset($_REQUEST['comments_threadId'])) {
if ($tiki_p_admin_forum == 'y'
|| ($commentslib->user_can_edit_post($user, $_REQUEST['comments_threadId']) && $tiki_p_forum_post_topic == 'y')
) {
示例2: tra
$smarty->display("error.tpl");
die;
}
// $end_time = microtime(true);
// print "TIME2 in comments.php: ".($end_time - $start_time)."\n";
if ($tiki_p_vote_comments == 'y' && (!isset($forum_mode) || $forum_mode == 'n') || $tiki_p_forum_vote == 'y' && isset($forum_mode) && $forum_mode == 'y') {
// Process a vote here
if (isset($_REQUEST["comments_vote"]) && isset($_REQUEST["comments_threadId"])) {
if (!$user && !isset($_COOKIE['PHPSESSID'])) {
$smarty->assign_by_ref('msg', tra('Cookies must be allowed to vote'));
$smarty->display("error.tpl");
die;
}
$comments_show = 'y';
if (!$tikilib->user_has_voted($user, 'comment' . $_REQUEST["comments_threadId"])) {
$commentslib->vote_comment($_REQUEST["comments_threadId"], $user, $_REQUEST["comments_vote"]);
$tikilib->register_user_vote($user, 'comment' . $_REQUEST["comments_threadId"]);
}
$_REQUEST["comments_threadId"] = 0;
$smarty->assign('comments_threadId', 0);
}
}
if ($tiki_p_remove_comments == 'y' && (!isset($forum_mode) || $forum_mode == 'n') || isset($forum_mode) && $forum_mode == 'y' && $tiki_p_admin_forum == 'y') {
if (isset($_REQUEST["comments_remove"]) && isset($_REQUEST["comments_threadId"])) {
$area = 'delcomment';
if ($prefs['feature_ticketlib2'] != 'y' or isset($_POST['daconfirm']) and isset($_SESSION["ticket_{$area}"])) {
key_check($area);
$comments_show = 'y';
$commentslib->remove_comment($_REQUEST["comments_threadId"]);
$_REQUEST["comments_threadId"] = 0;
$smarty->assign('comments_threadId', 0);
示例3: smarty_function_rating
function smarty_function_rating($params, $smarty)
{
global $prefs, $ratinglib;
require_once 'lib/rating/ratinglib.php';
if (!isset($params['type'], $params['id'])) {
return tra('No object information provided for rating.');
}
$type = $params['type'];
$id = $params['id'];
if (isset($params['changemandated']) && $params['changemandated'] == 'y') {
$changemandated = true;
// needed to fix multiple submission problem in comments
} else {
$changemandated = false;
}
if (isset($_REQUEST['rating_value'][$type][$id], $_REQUEST['rating_prev'][$type][$id])) {
$value = $_REQUEST['rating_value'][$type][$id];
$prev = $_REQUEST['rating_prev'][$type][$id];
if ((!$changemandated || $value != $prev) && $ratinglib->record_vote($type, $id, $value)) {
// Handle type-specific actions
if ($type == 'comment') {
global $user;
require_once 'lib/comments/commentslib.php';
if ($user) {
$commentslib = new Comments();
$commentslib->vote_comment($id, $user, $value);
}
} elseif ($type == 'article') {
global $artlib, $user;
require_once 'lib/articles/artlib.php';
if ($user) {
$artlib->vote_comment($id, $user, $value);
}
}
if ($prefs['feature_score'] == 'y' && $id) {
global $tikilib;
if ($type == 'comment') {
$forum_id = $commentslib->get_comment_forum_id($id);
$forum_info = $commentslib->get_forum($forum_id);
$thread_info = $commentslib->get_comment($id, null, $forum_info);
$item_user = $thread_info['userName'];
} elseif ($type == 'article') {
require_once 'lib/articles/artlib.php';
$artlib = new ArtLib();
$res = $artlib->get_article($id);
$item_user = $res['author'];
}
if ($value == '1') {
$tikilib->score_event($item_user, 'item_is_rated', "{$user}:{$type}:{$id}");
} elseif ($value == '2') {
$tikilib->score_event($item_user, 'item_is_unrated', "{$user}:{$type}:{$id}");
}
}
} elseif ($value != $prev) {
return tra('An error occurred.');
}
}
$vote = $ratinglib->get_vote($type, $id);
$options = $ratinglib->get_options($type, $id);
if ($prefs['rating_smileys'] == 'y') {
$smiles = $ratinglib->get_options_smiles($type, $id);
$smarty->assign('rating_smiles', $smiles);
}
$smarty->assign('rating_type', $type);
$smarty->assign('rating_id', $id);
$smarty->assign('rating_options', $options);
$smarty->assign('current_rating', $vote);
return $smarty->fetch('rating.tpl');
}