ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/okanime.top/code/ajax/ |
<?php global $CORE,$DB,$func,$ob_user; $manga_id = $CORE->input['manga_id'] ?? 0; $chap_id = $CORE->input['chap_id'] ?? 0; $type_chap = $CORE->input['type_chap'] ?? 0; $type_sort = $CORE->input['type_sort']??'lasted'; $order_by = 'a.time_post DESC,a.like_num DESC'; if($type_sort=='hoted'){ $order_by = 'a.like_num DESC,a.time_post DESC'; } //$where = " AND a.truyen_id='$manga_id' AND a.parent_id=0 AND a.comment_status='active' "; $where = " AND a.truyen_id='$manga_id' AND a.comment_status='active' "; if($chap_id>0){ if($type_chap==1) { $where .= " AND a.chuong_id='$chap_id' "; } } $pageNum = isset($_GET['comment_page_num']) ? intval($_GET['comment_page_num']) : 1; $pageSize = 30; $from = (($pageNum * $pageSize) - $pageSize); $t = $DB->fetch_row($DB->query("SELECT count(*) as total FROM tb_comment a WHERE 1 ".$where)); $total = $t['total']; $totalPage = ceil($total / $pageSize); $q_comment = $DB->query("SELECT a.*,b.guest_level_name,b.guest_point,b.guest_level,b.guest_next_level FROM tb_comment a LEFT JOIN tb_guest b ON a.user_id_post=b.user_id WHERE 1 ".$where." ORDER BY $order_by LIMIT $from,$pageSize"); while($r_comment=$DB->fetch_row($q_comment)){ $arr_all_comment[] = $r_comment; } function show_comment($arr_all_comment,$parent){ global $func,$ob_user; foreach($arr_all_comment as $key=>$r_comment){ $txt_reply_to = ''; if($parent==0){ $css_item = 'clearfix'; }else{ $css_item = 'child'; $txt_reply_to = '<span class="mention-user"><i class="fa fa-mail-forward"></i> '.$r_comment['user_id_reply_name'].'</span> '; } if($r_comment['parent_id']==$parent){ $comment_id = $r_comment['comment_id']; $date_comment = date('d/m/Y h:i:s A',$r_comment['time_post']); $date_comment2 = date('Y-m-d H:i:s',($r_comment['time_post']-(12*60*60))); $time_comment = $func->time_ago($r_comment['time_post']); $txt_delete = ''; if($r_comment['user_id_post']==intval($ob_user->user_id)){ $txt_delete = '<li><span onclick="deleteComment('.$comment_id.')"><i class="fas fa-trash-alt"></i> Delete</span></li>'; } //$arr_level = get_level_guest($r_comment['user_id_post']); $arr_level['guest_level_name'] = $r_comment['guest_level_name']; $guest_point = $r_comment['guest_point']; $guest_level = $r_comment['guest_level']; $guest_next_level = $r_comment['guest_next_level']; $point_next_level_have = $guest_point - $guest_level; $point_next_level_need = $guest_next_level - $guest_level; $arr_level['percent'] = 0; if($point_next_level_need>0){ $arr_level['percent'] = round(($point_next_level_have/$point_next_level_need)*100,0); } $txt_vip_icon =''; if($r_comment['is_vip']=='active'){ $txt_vip_icon = '<span class="text-warning"><i class="fas fa-crown"></i></span>'; } $txt_level_user = ''; if(!empty($arr_level['guest_level_name'])) { $txt_level_user = '<span class="member"><span class="member-level-text">' . $arr_level['guest_level_name'] . '</span><span class="progress-bar" style="width:' . $arr_level['percent'] . '%"></span></span>'; } echo '<div class="item '.$css_item.'" id="comment_'.$comment_id.'"> <figure class="avatar"> <img src="'.$r_comment['user_id_img'].'" alt="'.$r_comment['user_id_post_name'].'" class="lazy"> </figure> <div class="summary"> <span class="icon-comment-arrow"><i class="fas fa-angle-left"></i></span> <div class="info"> <div class="comment-header"> <span class="authorname name-5">'.$r_comment['user_id_post_name'].' '.$txt_vip_icon.'</span> '.$txt_level_user.' </div> <div class="comment-content">'.$txt_reply_to.html_entity_decode($r_comment['comment_content']).'</div> </div> <ul class="comment-footer"> <li><span onclick="replyComment('.$comment_id.')"><i class="fa fa-comment"></i> Reply</span> </li> <li> <span class="vote-up" onclick="voteComment('.$comment_id.', 1)"> <i class="fa fa-thumbs-up"></i> <span class="vote-up-count"> '.$r_comment['like_num'].'</span> </span> </li> <li> <span class="vote-down" onclick="voteComment('.$comment_id.', 2)"> <i class="fa fa-thumbs-down"></i> <span class="vote-down-count"> '.$r_comment['dislike_num'].'</span> </span> </li> <li class="comment-more-wrap"> <span class="more-action" onclick="openCommentAction('.$comment_id.')"> <i class="fas fa-ellipsis-h"></i> </span> <ul class="comment-more hidden" id="comment_more_'.$comment_id.'"> <li> <span onclick="reportComment('.$comment_id.')"><i class="far fa-flag"></i> Report</span> '.$txt_delete.' </li> </ul> </li> <li> <abbr title="'.$date_comment.'"> <i class="far fa-clock"></i> '.$time_comment.'</abbr> </li> </ul> <div id="comment_form_'.$comment_id.'"></div> <div id="input_form_'.$comment_id.'"></div> </div> </div> '; // Xóa chuyên mục đã lặp unset($arr_all_comment[$key]); // Tiếp tục đệ quy để tìm chuyên mục con của chuyên mục đang lặp show_comment($arr_all_comment, $r_comment['comment_id']); } } } if(isset($arr_all_comment)) { echo '<div class="comment-list">'; show_comment($arr_all_comment, 0); echo '</div>'; } $nav = ''; /*for($i=1;$i<=$totalPage;$i++){ $tmp_from = (($i * $pageSize) - $pageSize); $tmp_next_size = $tmp_from+$pageSize; $active = ''; if($i==$pageNum){ $active = 'active'; } $nav .= '<li class="'.$active.'"><a href="javascript:void(0);" onclick="load_list_comment('.$i.',\''.$type_sort.'\','.$type_chap.',\'tab_comment_id\')">'.$i.'</a></li>'; } $arr['nav'] = $nav;*/ if(isset($arr_all_comment)) { if ($totalPage > 6) { if ($pageNum == 1) { $nav .= '<li class="active"><span class="current">1</span></li>'; } else { $nav .= '<li><a href="javascript:void(0);" class="page-link" onclick="load_list_comment(1,\'' . $type_sort . '\',' . $type_chap . ',\'tab_comment_id\');">1</a></li>'; } if ($pageNum == 1) { for ($i = 2; $i <= 3; $i++) { if ($i >= $totalPage) { continue; } if ($i == $pageNum) { $nav .= '<li class="active"><span class="current">' . $i . '</span></li>'; } else { $nav .= '<li><a href="javascript:void(0);" class="page-link" onclick="load_list_comment(' . $i . ',\'' . $type_sort . '\',' . $type_chap . ',\'tab_comment_id\');">' . $i . '</a></li>'; } } $nav .= '<li>...</li>'; } if ($pageNum > 1 and $pageNum < $totalPage - 3) { if ($pageNum > 4) { $nav .= '<li>...</li>'; } for ($i = $pageNum - 2; $i <= $pageNum + 2; $i++) { if ($i < 2 or $i >= $totalPage) { continue; } if ($i == $pageNum) { $nav .= '<li class="active"><span class="current">' . $i . '</span></li>'; } else { $nav .= '<li><a href="javascript:void(0);" class="page-link" onclick="load_list_comment(' . $i . ',\'' . $type_sort . '\',' . $type_chap . ',\'tab_comment_id\');">' . $i . '</a></li>'; } } $nav .= '<li>...</li>'; } if ($pageNum >= $totalPage - 3 and $pageNum < $totalPage) { $nav .= '<li>...</li>'; for ($i = $pageNum - 2; $i <= $pageNum + 2; $i++) { if ($i < 0 or $i >= $totalPage) { continue; } if ($i == $pageNum) { $nav .= '<li class="active"><span class="current">' . $i . '</span></li>'; } else { $nav .= '<li><a href="javascript:void(0);" class="page-link" onclick="load_list_comment(' . $i . ',\'' . $type_sort . '\',' . $type_chap . ',\'tab_comment_id\');">' . $i . '</a></li>'; } } } if ($totalPage == $pageNum) { $nav .= '<li>...</li>'; for ($i = $totalPage - 3; $i <= $totalPage - 1; $i++) { if ($i >= $totalPage) { continue; } if ($i == $pageNum) { $nav .= '<li class="active"><span class="current">' . $i . '</span></li>'; } else { $nav .= '<li><a href="javascript:void(0);" class="page-link" onclick="load_list_comment(' . $i . ',\'' . $type_sort . '\',' . $type_chap . ',\'tab_comment_id\');">' . $i . '</a></li>'; } } $nav .= '<li class="active"><span class="current">' . $totalPage . '</span></li>'; } else { $nav .= '<li><a href="javascript:void(0);" class="page-link" onclick="load_list_comment(' . $totalPage . ',\'' . $type_sort . '\',' . $type_chap . ',\'tab_comment_id\');">' . $totalPage . '</a></li>'; } } if ($totalPage > 1 and $totalPage <= 6) { for ($i = 1; $i <= $totalPage; $i++) { if ($i == $pageNum) { $nav .= '<li class="active"><span class="current">' . $i . '</span></li>'; } else { $nav .= '<li><a href="javascript:void(0);" class="page-link" onclick="load_list_comment(' . $i . ',\'' . $type_sort . '\',' . $type_chap . ',\'tab_comment_id\');">' . $i . '</a></li>'; } } } echo '<div class="pagination_comment-outter commentpager"><div class="chapters_pagination"><ul>' . $nav . '</ul></div></div>'; } /*$arr['nav'] = $nav; echo json_encode($arr);*/ exit(); ?>