<?php
  
ECHO "<span id='comment_like_id".$list['ID']."'>";

IF (ISSET($user) && GET('comment_like') && DB::GET_COLUMN("SELECT COUNT(*) FROM `FORUM_THEM_COMMENTS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `COMMENT_ID` = '".INTVAL(GET('comment_like'))."' LIMIT 1") == 0){
  
  DB::GET_ADD("INSERT INTO `FORUM_THEM_COMMENTS_LIKES` (`USER_ID`, `TIME`, `COMMENT_ID`) VALUES ('".$user['ID']."', '".TIME()."', '".INTVAL(GET('comment_like'))."')");

}

IF (ISSET($user) && GET('comment_like_no') && DB::GET_COLUMN("SELECT COUNT(*) FROM `FORUM_THEM_COMMENTS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `COMMENT_ID` = '".INTVAL(GET('comment_like_no'))."' LIMIT 1") == 1){
  
  DB::GET_SET("DELETE FROM `FORUM_THEM_COMMENTS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `COMMENT_ID` = '".INTVAL(GET('comment_like_no'))."' LIMIT 1");

}

$count_like = DB::GET_COLUMN("SELECT COUNT(*) FROM `FORUM_THEM_COMMENTS_LIKES` WHERE `COMMENT_ID` = '".$list['ID']."'");

$like = DB::GET_COLUMN("SELECT COUNT(*) FROM `FORUM_THEM_COMMENTS_LIKES` WHERE `COMMENT_ID` = '".$list['ID']."' AND `USER_ID` = '".$user['ID']."' LIMIT 1");

IF ($like == 0){
  
  ?><a class="comment-like" onclick="request('comment_like<?=$list['ID']?>', '/modules/?path=forum&section=show&id=<?=$fthem['ID']?>&comment_like=<?=$list['ID']?>&page=<?=$page?>', '#comment_like_id<?=$list['ID']?>')" load="none"><?=ICONS('heart-o', 18, 'fa-fw')?> <?=$count_like?></a><?
  
}ELSE{
  
  ?><a class="comment-like" style="color: #F5574C;" onclick="request('comment_like<?=$list['ID']?>', '/modules/?path=forum&section=show&id=<?=$fthem['ID']?>&comment_like_no=<?=$list['ID']?>&page=<?=$page?>', '#comment_like_id<?=$list['ID']?>')" load="none"><?=ICONS('heart', 18, 'fa-fw')?> <?=$count_like?></a><?
  
}

ECHO "</span>";
  
?>