Exemple #1
0
function find_comments($comments, $parent_id, $lvl = 0)
{
    for ($i = 0; $i < count($comments); $i++) {
        $comment = $comments[$i];
        if ($comment['parent_id'] == $parent_id) {
            show_comment($comment, $lvl);
            find_comments($comments, $comment['id'], $lvl + 1);
            //    echo '</div>'; //the comment div stays open until there are no more children
        }
    }
}
<?php

#####################################################################
#
#   File          : FRONT-END : COMMENT FORM
#   Project       : Game Magazine Project
#   Author        : Béo Sagittarius
#   Created       : 07/01/2015
#
#####################################################################
// Show comment from Database
$result = show_comment($nid);
if (($count = mysqli_num_rows($result)) > 0) {
    ?>
        <div class='single-middle'>
            <h3><?php 
    echo $count;
    ?>
 Comment</h3>
        <?php 
    while (list($author, $comment, $user_id, $date) = mysqli_fetch_array($result, MYSQLI_NUM)) {
        ?>
            <div class='media'>
                <div class='media-left'>
                <?php 
        $rs = get_user_by_id_list($user_id);
        if (mysqli_num_rows($rs) > 0) {
            $user = mysqli_fetch_array($rs, MYSQLI_ASSOC);
            ?>
                    <img class='media-object' style="width: 90px; height: 90px; "src='images/avatar/<?php 
            echo $user['avatar'];
                                    $array[$id]['post_name'] .= " (" . $array[$id]['post_email'] . ", " . $array[$id]['post_ip'] . ")";
                                } else {
                                    $array[$id]['post_email'] = "";
                                }
                            }
                        }
                    }
                }
                if (!empty($admins)) {
                    $in = array_keys($admins);
                    $in = array_unique($in);
                    $in = implode(",", $in);
                    $query = "SELECT `userid` AS admin_id, `username` AS admin_login, `full_name` AS admin_name FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `userid` IN (" . $in . ")";
                    $result = $db->sql_query($query);
                    while (list($admin_id, $admin_login, $admin_name) = $db->sql_fetchrow($result)) {
                        $admin_name = !empty($admin_name) ? $admin_name : $admin_login;
                        if (isset($admins[$admin_id])) {
                            foreach ($admins[$admin_id] as $id) {
                                $array[$id]['admin_reply'] = $lang_module['comment_admin_note'] . " <a href=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=authors&amp;id=" . $admin_id . "\">" . $admin_name . "</a>: " . $array[$id]['admin_reply'];
                            }
                        }
                    }
                }
                $generate_page = nv_generate_page($base_url, $all_page, $per_page, $page, true, true, 'nv_urldecode_ajax', 'list_comments');
            }
            $contents = show_comment($array, $generate_page);
            die($contents);
        }
    }
    die($lang_module['comment_error7']);
}
Exemple #4
0
    echo '<p>If you submitted this bug, please check your email.</p>' . '<p><strong>If you do not have a confirmation message</strong>, <a href="resend-request-email.php?' . 'handle=' . urlencode($bug['bughandle']) . '">click here to re-send</a>.  MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to <a href="mailto:' . PEAR_DEV_EMAIL . '">' . PEAR_DEV_EMAIL . '</a> to request the confirmation link.  All bugs/comments/patches associated with this
        email address will be deleted
                within 48 hours if the account request is not confirmed!</p>';
    response_footer();
    exit;
}
$previous = $current = array();
// Delete comment
if ($edit === 1 && isset($auth_user) && $auth_user && $auth_user->registered) {
    $addon = '';
    if (isset($_GET['hide_comment']) && auth_check('pear.dev')) {
        hide_comment($id, (int) $_GET['hide_comment']);
        $addon = '&thanks=1';
    }
    if (isset($_GET['show_comment']) && auth_check('pear.bug.admin')) {
        show_comment($id, (int) $_GET['show_comment']);
        $addon = '&thanks=1';
    }
    if (isset($_GET['delete_comment']) && auth_check('pear.bug.admin')) {
        delete_comment($id, (int) $_GET['delete_comment']);
        $addon = '&thanks=1';
    }
    if ($addon !== '') {
        localRedirect("bug.php?id={$id}&edit=1{$addon}");
        exit;
    }
}
// handle any updates, displaying errors if there were any
$errors = array();
if (isset($_POST['addpatch'])) {
    //handle patch upload
Exemple #5
0
function show_article($cms, $article, $single = true, $allow_edit = false)
{
    if ($single) {
        echo '<h2>' . $article['title'] . '</h2>' . br();
    } else {
        echo anchor($cms['module_path'] . '/blog/index/' . $article['article_url'], '<h2>' . $article['title'] . '</h2>');
    }
    echo '(' . $article['author'] . ', ' . $article['date'] . ')';
    echo '<p>' . $article['content'] . '</p>';
    foreach ($article['photos'] as $photo) {
        echo '<a class="photo_' . $article['id'] . '" href="' . base_url() . 'assets/uploads/files/' . $photo['url'] . '">';
        echo '<img class="photo_thumbnail" src="' . base_url() . 'assets/uploads/files/' . $photo['url'] . '" />';
        echo '</a>';
    }
    echo '<script type="text/javascript">
	$(".photo_' . $article['id'] . '").colorbox({rel:"photo_' . $article['id'] . '", transition:"none", width:"75%", height:"75%", slideshow:true});
	</script>';
    if (!$single) {
        echo br();
        echo anchor($cms['module_path'] . '/blog/index/' . $article['article_url'], 'read more', array("class" => "btn btn-primary"));
        echo '&nbsp;';
    }
    if ($allow_edit) {
        echo anchor($cms['module_path'] . '/blog/article/edit/' . $article['id'], 'edit', array("class" => "btn"));
    }
    echo '<hr />';
    if ($single) {
        show_comment($cms, $article);
    }
}
Exemple #6
0
function show_comment($file_id)
{
    global $db, $tpf, $pg, $start_num, $perpage;
    $q = $db->query("select c.*,u.username from {$tpf}comments c,{$tpf}users u where file_id='{$file_id}' and is_checked=1 and c.userid=u.userid order by cmt_id asc limit {$start_num},{$perpage}");
    $cmts = array();
    while ($rs = $db->fetch_array($q)) {
        $rs['content'] = str_replace("\r\n", "<br>", $rs['content']);
        $rs['in_time'] = custom_time("Y-m-d H:i:s", $rs['in_time']);
        $rs['a_space'] = urr("space", "username="******"comment", "file_id={$file_id}"));
include PHPDISK_ROOT . "./includes/header.inc.php";
switch ($action) {
    case 'cmt':
        form_auth(gpc('formhash', 'P', ''), formhash());
        $content = trim(gpc('content', 'P', ''));
        $file_id = (int) gpc('file_id', 'P', 0);
        if (checklength($content, 2, 600)) {
            $error = true;
            $sysmsg[] = __('cmt_content_error');
        }
        if (!$error) {
            $ins = array('userid' => $pd_uid, 'file_id' => $file_id, 'content' => replace_js($content), 'in_time' => $timestamp, 'ip' => $onlineip, 'is_checked' => $settings['check_comment'] ? 0 : 1);
            $db->query("insert into {$tpf}comments set " . $db->sql_array($ins) . ";");
            $sysmsg[] = __('cmt_success');
Exemple #7
0
function show_comment($comment, $style_prefix = "comment")
{
    $html = '<div class="' . $style_prefix . '_form">';
    foreach ($comment as $c) {
        $html .= '<div class="' . $style_prefix . '_list_con">';
        $html .= '<div>';
        $uname = $c['uname'] == '' ? '匿名评论' : $c['uname'];
        $html .= '<div class="l"><b id="uname' . $c['comment_id'] . '">' . $uname . '</b> &nbsp;' . $c['ip_addr'] . ' ' . helper::utf8_substr($c['ip'], 0, strrpos($c['ip'], '.')) . '.* &nbsp; ' . date('Y-m-d H:i:s', $c['date_add']) . '</div>';
        $html .= '</div>';
        $html .= '<div class="' . $style_prefix . '_list_con_bot"><a href="javascript:void(0);" onclick="ready_reply(' . $c['comment_id'] . ');">回复(<span id="recomment' . $c['comment_id'] . '">' . $c['son'] . '</span>)&nbsp;&nbsp;<a href="javascript:void(0);" onclick="cgood(' . $c['comment_id'] . ');">顶(<span id="good' . $c['comment_id'] . '">' . $c['good'] . '</span>)</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="cbad(' . $c['comment_id'] . ');">踩(<span id="bad' . $c['comment_id'] . '">' . $c['bad'] . '</span>)</a>&nbsp;&nbsp;</div>';
        if ($c['reply'] != '') {
            $reply = '<br /><font color=red>管理员回复:{' . $c['reply'] . '}</font>';
        } else {
            $reply = '';
        }
        $html .= '<div>' . (!empty($c['is_check']) ? $c['content'] . $reply : '<font color="red">*******该留言已被屏蔽</font>') . '</div>';
        $html .= '<div id="replay_frame_' . $c['comment_id'] . '"></div>';
        if (isset($c['sons']) && count($c['sons']) > 0) {
            $html .= show_comment($c['sons']);
        }
        $html .= '</div>';
    }
    $html .= '<script type="text/javascript">
        function ready_reply(comment_id){
            try{
            $("#comment_pid").val(comment_id);
            $("#replay_frame_"+comment_id).append($("#comment_reply_box"));
            $("#comment_reply_box").css({"display":""});
            $("#comment_reply").focus();
            }catch(e){alert(e.message)}
        }
        function cgood(comment_id){
            var good=C.cookie.get(\'good\'+comment_id);
            if(good == null) good =0;
            if(typeof(comment_id) =="undefined") return false;
            var comment_id = parseInt(comment_id);
            if(!good){
            $.post("' . SITE_PATH . 'plugins/gov.comment/comment.php?m=cgood",{comment_id:comment_id},function(data){
                var res = eval("("+data+")");
                $("#good"+comment_id).html(res);
                C.cookie.set(\'good\'+comment_id,comment_id)
            });
            }else{
                alert(\'不好意思,您已经表态啦~~~\');
            }
        }
        function cbad(comment_id){
        var cbad=C.cookie.get(\'good\'+comment_id);
        if(cbad == null) cbad =0;
            if(typeof(comment_id) =="undefined") return false;
            var comment_id = parseInt(comment_id);
            if(!cbad){
            $.post("' . SITE_PATH . 'plugins/gov.comment/comment.php?m=cbad",{comment_id:comment_id},function(data){
                var res = eval("("+data+")");
                $("#bad"+comment_id).html(res);
                C.cookie.set(\'good\'+comment_id);

            });
            }else{
                alert(\'不好意思,您已经表态啦~~~\');
            }
        }
        /*
        function recomment (comment_id,nick) {
            $("#parent_id").val(comment_id);
            $("#comment_id").val(comment_id);
            $("#comment").val("回复["+nick+"]:");
            $("#comment").focus();

        }*/
    </script>';
    $html .= '</div>';
    return $html;
}
Exemple #8
0
        } else {
            ?>
                    <div class="col-md-8 col-sm-7 no-padding">
                    <?php 
        }
        ?>
                        <?php 
        get_template_part('content', get_post_format());
        ?>
                    <div class="comment-area">
                    <h2>comments (<?php 
        echo wp_count_comments($post->ID)->approved;
        ?>
)</h2>
                        <?php 
        show_comment();
        ?>
                    <?php 
        custom_comment_form();
        ?>
                    </div>


             </div>
                <div class="col-md-1 col-sm-1"></div>
                <?php 
        get_sidebar('blog');
        ?>
            </div><!-- container /- -->
        </div>
        <?php