function smarty_function_commnet($params, &$smarty1) { global $smarty; global $db; global $cfg; $tbl_commnet = $cfg['tbl_commnet']; $tbl_article = $cfg['tbl_article']; $tbl_columns = $cfg['tbl_columns']; if (empty($params["article_id"])) { return; } $object_id = intval($params["article_id"]); if (!allow_comment($object_id)) { return; } }
if (isset($_POST['postflag']) && $_POST['postflag'] == '1') { //add new comment if (!empty($_GET['object_id'])) { $article_id = intval($_GET['object_id']); } else { if (!empty($_POST['object_id'])) { $article_id = intval($_POST['object_id']); } else { alert("参数错误"); exit; } } $sql = "select id,catalog,heading,content from {$tbl_article} where id = {$article_id}"; $article = $db->GetRow($sql); $catalog_id = $article['catalog']; $allow_comment = allow_comment($catalog_id); if (!$allow_comment) { alert("该栏目不允许评论"); exit; } if (!isset($_POST['content']) || strlen($_POST['content']) <= 1) { msg("请输入评论内容!"); goback(); exit; } if ($allow_comment == 1) { $data['status'] = 1; } else { $data['status'] = 0; } $data['username'] = $_POST['username'];