当前位置: 首页>>代码示例>>PHP>>正文


PHP action::output_result方法代码示例

本文整理汇总了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;
}
开发者ID:AnthonyReese,项目名称:Refresh,代码行数:47,代码来源:actions.php


注:本文中的action::output_result方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。