<?php
// ======================================================================== //
//                                                                          //
//   KooBI- Webportalsystem                                                 //
//   SCRiPTMAFiA 2005 - THE DiRTY HANDS ON YOUR SCRiPTS                     //
//                                                                          //
//   ====================================================================   //
//                                                                          //   
//   dream4 | webservices - Am Michelsgrund 7 - 69469 Weinheim - Germany    //    
//   tel. +49(0) 6201 - 980442 / fax. +49(0) 6201 - 64809                   //
//                                                                          //
// ======================================================================== //
$smilies = listsmilies();
if(COMMENTSMILEYS == 1) {
	$tmpl->assign('smilie', 1);
	$tmpl->assign('listemos', $smilies);
}

if (COMMENTSBBCODE == 1) {
	$tmpl->assign('bbcodes', 1);
}

$tmpl->assign('listfonts',  fontdropdown());
$tmpl->assign('sizedropdown',  sizedropdown());
$tmpl->assign('colordropdown',  colordropdown());
$tmpl->assign('max_post_length', $MAXCOMMLENGTH );


$boxtype = "pagecomments";		
$comments_array = array();
$numcomm = $sql->numrows();

while( $row = $sql->fetchrow() ){
	
	$text = $row->comment;
	if(COMMENTSMILEYS == 1) {
		
		$text = kcodes_comments($text);
		$pos = strpos (strtolower($row->comment), "[php]");
		$pos_2 = strpos (strtolower($row->comment), "[code]");
		$pos_3 = strpos (strtolower($row->comment), "<?");
		$pos_4 = strpos (strtolower($row->comment), "<?php");
		
		if ( $pos === false && $pos_2 === false && $pos_3 === false && $pos_4 === false) {
			$text = dosmilies($text);
			$wordwrap = 1;
		} else {
			$wordwrap = -1;
		}
		
	} else {
		$text = kcodes_comments($text);
	}
	
	
	
	$text = badwordreplace($text);
	//"index.php?p=user&amp;id=" . $row->autor
	$a_check = new dbc("SELECT user_regdate, status FROM ".PREFIX."_user WHERE uid='".$row->autor."'");
	$a_check_row = $a_check->fetchrow();
	
	if($a_check_row->status == 1){
		$userlink = "index.php?p=user&amp;id=$row->autor&amp;area=$area";
	} else {
		$userlink = "";
	}
	
	unset($a_check_row);

	array_push($comments_array, array(
	'title'	=> kstripslashes(kspecialchars($row->title)),
	'time' => mygmt($row->ctime) ,
	'text'	=> $text,
	'wordwrap' => $wordwrap,
	'user'	=> fetchusername($row->autor),
	'userlink'	=> $userlink
	)
	);
	
}
?>
