function module_comment() { global $global, $smarty; if ($global['id']) { $obj = new comment(); $obj->set_where('com_channel_id = ' . get_id('channel', 'cha_code', $global['channel'])); $obj->set_where('com_page_id = ' . $global['id']); $obj->set_page_size(5); $obj->set_page_num($global['page']); $sheet = $obj->get_sheet(); set_link($obj->get_page_sum()); $smarty->assign('comment', $sheet); } }
function module_comment_edit() { global $global, $smarty; $obj = new comment(); $obj->set_where('com_id = ' . $global['id']); $one = $obj->get_one(); $one['channel'] = ''; $one['title'] = ''; $obj = new channel(); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { if ($list[$i]['cha_id'] == $one['com_channel_id']) { $one['channel'] = $list[$i]['cha_code']; $original = $list[$i]['cha_code']; if ($list[$i]['cha_original'] != 0) { for ($j = 0; $j < count($list); $j++) { if ($list[$i]['cha_original'] == $list[$j]['cha_id']) { $original = $list[$j]['cha_code']; } } } if ($original == 'goods') { $table = 'goods'; } else { $table = 'article'; } $one['title'] = get_data($table, $one['com_page_id'], substr($table, 0, 3) . '_title'); } } $smarty->assign('comment', $one); }
function reply_comment() { global $smarty, $lang; $com_id = post('com_id'); $com_reply = post('com_reply'); $obj = new comment(); $obj->set_value('com_reply', $com_reply); $obj->set_where("com_id = {$com_id}"); $obj->edit(); $smarty->assign('info_text', '回复评论成功'); $smarty->assign('link_text', $lang['return_list']); $smarty->assign('link_href', url(array('channel' => 'service', 'mod' => 'comment_sheet'))); }
<?php require 'components/get_listview_referrer.php'; require 'subclasses/comment.php'; $dbh_comment = new comment(); $dbh_comment->set_where("id='" . quote_smart($id) . "'"); if ($result = $dbh_comment->make_query()->result) { $data = $result->fetch_assoc(); extract($data); $data = explode('-', $date); if (count($data) == 3) { $date_year = $data[0]; $date_month = $data[1]; $date_day = $data[2]; } }