<?php
/**
* comments file
*
* (c) Jorge (jordi) Adame
*
* hide@address.com hide@address.com
*/
require dirname(__FILE__)."/inc/inc.php";
require dirname(__FILE__)."/inc/classes/track.class.php";
$ins_id = $_REQUEST["ins_id"];
$user->check_perms($ins_id);
$act = $_POST["what"];
if($act == "add_comment"){
require_once dirname(__FILE__)."/inc/classes/comment.class.php";
comment::add_comment($_POST["comment"], $ins_id);
$smarty->assign("change", TRUE);
}
//*********************** TOO SLOW CANT DO THIS ******************//
//****************************************************************//
// $sql = "SELECT cm_idpk FROM comments where ins_idfk = '$ins_id'";
// $rs = $kb->Execute($sql);
// foreach($rs as $k => $row){
// $comments[] = new Comment($row["cm_idpk"]);
// }
//so much better
$cm = new Comment();
$comments = $cm->get_all($ins_id);
$smarty->assign("comments", $comments);
$smarty->display("comments.tpl");
?>