function draw() { $this->beginForm(); if (Url::get('cmd') == 'edit' && ($row = DB::select('bad_words', 'id=' . intval(AZLib::getParam('id'))))) { $contents = $row['contents']; $reason = $row['reason']; $exact = $row['exact']; if ($row['is_phone'] == 1) { $contents = BadWord::filter_badword_show($contents); } $is_phone = $row['is_phone']; } else { $contents = ''; $exact = ''; $is_phone = ''; $reason = ''; } global $display; $display->add('msg', $this->showFormErrorMessages()); $display->add('contents', $contents); $display->add('reason', $reason); $display->add('exact', $exact); $display->add('is_phone', $is_phone); $display->add('cmd', Url::get('cmd')); $display->output('edit'); $this->endForm(); }
function draw() { $this->beginForm(); global $display; $str_badword = stripslashes(Url::get("bad_word")); $show_bw = array(); if (Url::get("submit") == "Kiểm tra" && $str_badword) { $show_bw = array(); $show_bw = AZLib::checkBadWord($str_badword, true, false, true); $display->add('show_bw', $show_bw); } $display->add('bad_word', $str_badword); $search_value = ' contents <>"" '; if (Url::get('contents')) { $search_value .= ' AND contents like "%' . Url::get('contents') . '%" OR reason like "%' . Url::get('contents') . '%" '; } $item_per_page = 100; $sql_count = 'SELECT COUNT(*) AS total_item FROM bad_words WHERE ' . $search_value; $total = DB::fetch($sql_count, 'total_item', 0); $items = array(); if ($total) { $limit = ''; $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Tin', 'Trang'); $sql = 'SELECT * FROM bad_words WHERE ' . $search_value . ' ORDER BY exact DESC, id DESC ' . $limit; $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'contents'), 'cmd=delete&id=' . $row['id']); if ($row['is_phone'] == 1) { $row['contents'] = BadWord::filter_badword_show($row['contents']); } $items[$row['id']] = $row; } } } else { $paging = ''; } $display->add('items', $items); $display->add('url_add', WEB_DIR . AZRewrite::formatUrl('?page=manage_badword&cmd=add')); $display->add('contents', Url::get('contents')); $display->add('paging', $paging); $display->output('list'); $this->endForm(); }