本文整理汇总了PHP中action::output_result方法的典型用法代码示例。如果您正苦于以下问题:PHP action::output_result方法的具体用法?PHP action::output_result怎么用?PHP action::output_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类action
的用法示例。
在下文中一共展示了action::output_result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_comments
/**
* returns a list of comments for a given thread id
*
*/
function get_comments($thread_id, $privileges, $login, $output = '')
{
$action = new action();
$action->set_result(False);
$escaped_threadid = mysql_real_escape_string($thread_id);
$escaped_name = mysql_real_escape_string($login);
$result = @mysql_query(sprintf("(SELECT C.comment_id,C.rand_prop,C.hash_prop,C.text,C.date,C.is_valid,C.already_mod,C.possibly_name,\n\tSUM(V.vote) AS pro_vote, COUNT(V.vote) AS total_vote, \n\tMAX(CAST(SHA1(CONCAT('%s',CAST(V.rand_prop AS CHAR))) AS CHAR)=V.hash_prop) AS my_vote, \n\tMAX(CAST(SHA1(CONCAT('%s',CAST(V.rand_prop AS CHAR))) AS CHAR)=V.hash_prop AND V.vote) AS my_provote\n\tFROM comment C, vote_comment V\n\tWHERE C.thread_id='%s' AND V.comment_id=C.comment_id\n\tGROUP BY C.comment_id,C.rand_prop,C.hash_prop,C.text,C.date,C.is_valid,C.already_mod,C.possibly_name)\n\tUNION\n\t(SELECT C.comment_id,C.rand_prop,C.hash_prop,C.text,C.date,C.is_valid,C.already_mod,C.possibly_name,\n\t0 AS pro_vote, 0 AS total_vote,0 AS my_vote, 0 AS my_provote\n\tFROM comment C\n\tWHERE C.thread_id='%s' AND C.comment_id<>ALL(SELECT comment_id FROM vote_comment))\n\tORDER BY date ASC", $escaped_name, $escaped_name, $escaped_threadid, $escaped_threadid));
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
$is_proprio = check_property($row["rand_prop"], $row["hash_prop"]);
$is_valid = $row["is_valid"];
if ($is_valid || $is_proprio || $privileges > 3) {
$comment = array();
$comment['comment_id'] = $row["comment_id"];
// comment id
$comment['is_proprio'] = check_property($row["rand_prop"], $row["hash_prop"]);
// 1 if the current user has posted the comment, else 0
$comment['is_valid'] = $row["is_valid"];
// 1 if comment has been accepted, else 0
$comment['already_mod'] = $row["already_mod"];
// 1 if comment has already been moderated, else 0
$comment['date'] = $row['date'];
// date the comment was posted
$comment['possibly_name'] = $row['possibly_name'];
// name of the author if available
$comment['text'] = text_display_prepare(trim($row["text"]));
// text of the comment
$comment['my_vote'] = $row['my_vote'];
// 1 if current user has voted for it, else 0
$comment['my_provote'] = $row['my_provote'];
// 1 if current user has voted +1, else 0
$comment['pro_vote'] = $row['pro_vote'];
// total of +1 votes
$comment['total_vote'] = $row['total_vote'];
// total number of votes
$action->data[] = $comment;
$action->set_result(True);
}
}
}
$action->output_result($output);
return $action;
}