function draw() { global $display; $cat_newss = array(); $display->add('is_admin', User::have_permit(ADMIN_NEWS)); $display->add('url_home', WEB_DIR); $display->add('time_now', News::displayTime()); $display->add('cat_name', $this->news_cat['name']); $display->add('cat_url', URL::build('news_list', array('news_catid' => $this->news_cat['id'], 'azname' => AZLib::safe_title($this->news_cat['name'])))); $condition = ' status=1 '; $total = DB::count("news", $condition); $limit = ''; //$pagging = AZPagging::paging_list($limit,20,'page_no'); $pagging = AZPagging::paging_list($limit, $total, 20); $re = DB::query('SELECT * FROM news WHERE ' . $condition . ' ORDER BY id DESC' . $limit); if ($re) { while ($news = mysql_fetch_assoc($re)) { $news['title'] = stripslashes($news['title']); $news['brief'] = stripslashes($news['brief']); $news['url'] = Url::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title']))); if ($news['image']) { $news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']); } $news['news_h'] = date('H:i', $news['time_created']); $news['news_d'] = date('d-m-Y', $news['time_created']); $news['admin_link'] = News::admin_link($news); $cat_newss[$news['id']] = $news; } } $display->add('pagging', $pagging); $display->add('cat_newss', $cat_newss); $display->output("NewsPage"); }
function draw() { global $display; $this->beginForm(false, "post", false, Url::build_current()); $item_per_page = 30; $total_row = DB::fetch('SELECT count(*) AS total_row FROM `province` limit 0,1', 'total_row', 0); $paging = ''; $items = array(); if ($total_row) { $limit = ''; $paging = AZPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $sql = "SELECT * FROM province ORDER BY id " . $limit; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $area = array(1 => 'Bắc', 2 => 'Trung', 3 => 'Nam'); $status = array('SHOW' => 'Hiện', 'HIDE' => '<font color=red>Ẩn</font>', 'HOME' => 'HOME'); $row['area'] = $area[$row['area']]; $row['status'] = $status[$row['status']]; $items[$row['id']] = $row; $items[$row['id']] = $row; } } } $display->add('hover', AZLib::mouse_hover('#F7F7F7', true)); $display->add('items', $items); $display->add('paging', $paging); $display->add('total_row', $total_row); $display->output('list'); $this->endForm(); }
function draw() { global $display; $display->add('skin_path', IMAGE_PATH); $txt = ''; $option1 = ''; $sql = "SELECT * FROM `public_survey` WHERE "; $search = Url::get('search'); if ($search != '') { $condition = "title LIKE '%{$search}%' OR question LIKE '%{$search}%'"; } else { $condition = " 1"; } $totalRows = DB::count("public_survey", $condition); $limit = ''; $display->add('pagging', AZPagging::paging_list($limit, $totalRows, 40)); $sql .= $condition . $limit; $block_id = (int) Url::get('block_id', 0); $href = str_replace(WEB_DIR, '', urldecode(Url::get('href'))); $surveys = DB::fetch_all($sql); if ($surveys) { foreach ($surveys as &$survey) { if ($block_id) { $survey["add_to_block"] = $href . ($href != '' ? '&' : '?') . "cmd=add_poll_to_block&poll_id={$survey['id']}&block_id={$block_id}"; } if ($survey['view'] == 1) { $survey["url_view"] = Url::build_current(array("cmd" => "unpublish", "id" => $survey['id'])); $survey["view"] = '<img src="style/images/unexam.gif" title="Ẩn"/>'; $survey["view_str"] = "Hiển thị"; } else { $survey["url_view"] = Url::build_current(array("cmd" => "publish", "id" => $survey['id'])); $survey["view_str"] = "Đang ẩn"; $survey["view"] = '<img src="style/images/exam.gif" title="Cho hiển thị"/>'; } $survey["url_view_survey"] = Url::build('view_survey', array('id' => $survey['id'])); $survey["url_option"] = Url::build('admin_option', array('id_survey' => $survey['id'])); $question = $survey['question'] . '<br><br>'; $total_cout = DB::fetch('SELECT SUM(`count`) AS total_cout FROM `public_survey_opinion` WHERE id_survey=' . $survey['id'], 'total_cout', 0); $options = DB::fetch_all('SELECT * FROM `public_survey_opinion` WHERE id_survey=' . $survey['id']); foreach ($options as $option) { $question .= "+ [ID:{$option['id']}] <b>{$option['option']}</b> <font color=red>({$option['count']}/{$total_cout} lượt chọn)</font><br>"; } $survey["question"] = $question; if ($survey['type'] == 0) { $type_send = "Nhiều lựa chọn"; } else { $type_send = "Một lựa chọn"; } $survey["type_send"] = $type_send; $survey["time"] = date("d/m/Y H:i", $survey["time"]); $survey["time_m"] = date("d/m/Y H:i", $survey["time_m"]); $survey["edit"] = Url::build_current(array('id_survey' => $survey['id'], 'cmd' => 'edit')); $survey["delete"] = Url::build_current(array('id_survey' => $survey['id'], 'cmd' => 'delete')); } } $display->add('surveys', $surveys); $display->add('url_addnew', Url::build('admin_survey', array('cmd' => 'add'))); $display->output('ListSurvey'); }
function draw() { global $display; $display->add('msg', $this->showFormErrorMessages(1)); $display->add("url_admin", Url::build_current()); $status_select = Url::get('status_select', 6); //1:Chưa cập nhật; 2: Đã gửi đơn hàng ; 3: Đã TT; 4: Hủy đơn hàng; 5: Đã duyệt $status_arr = array(6 => "--Tất cả--", 2 => "Đã gửi đơn hàng", 1 => "Chưa cập nhật", 3 => "Đã Thanh toán", 5 => "Đã duyệt", 4 => "Đã hủy"); $display->add("status_option", AZLib::getOption($status_arr, $status_select)); $date_begin = Url::get('date_begin'); $date_end = Url::get('date_end'); $display->add("date_begin", $date_begin); $display->add("date_end", $date_end); $created_time_from = 0; $created_time_to = 0; if ($date_begin) { $date_arr = explode("-", $date_begin); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if ($date_end) { $date_arr = explode("-", $date_end); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } $condition = ""; if ($status_select != 6) { $condition .= "status=" . $status_select; } if ($created_time_from) { $condition .= ($condition != '' ? ' AND ' : '') . ' time_create >=' . $created_time_from; } if ($date_end) { $condition .= ($condition != '' ? ' AND ' : '') . " time_create <={$created_time_to}"; } $total = DB::count("cart", $condition); $limit = ''; $display->add('paging', AZPagging::paging_list($limit, $total, 40, 10, 'page_no', '', true, 'Đơn hàng')); $all_carts = array(); $re = DB::query("SELECT * FROM cart " . ($condition != '' ? 'WHERE ' : '') . $condition . " ORDER BY id DESC {$limit}"); if ($re) { while ($Cart = mysql_fetch_assoc($re)) { $Cart["time_create"] = date('d/m/Y H:i:s', $Cart['time_create']); $Cart["time_change"] = date('d/m/Y H:i:s', $Cart['time_change']); $Cart["url"] = Url::build_current(array('cmd' => 'edit', 'id' => $Cart['id'])); $Cart["status"] = $status_arr[$Cart['status']]; $Cart["delete"] = Url::build_current(array('cmd' => 'delete', 'id' => $Cart['id'])); $Cart["price"] = number_format($Cart['price'], null, null, '.'); $all_carts[$Cart['id']] = $Cart; } } $display->add('all_carts', $all_carts); $display->add('is_admin', User::is_admin()); $this->beginForm(); $display->output('CartAdmin'); $this->endForm(); }
function draw() { $this->beginForm(); global $display; $user_id = intval(Url::get('user_id')); $user_info = DB::select('user', 'id="' . $user_id . '"'); $display->add('created_time_from', Url::get('created_time_from')); $display->add('created_time_to', Url::get('created_time_to')); //search theo ngay thang nam $created_time_from = 0; $created_time_to = 0; if (Url::get('created_time_from')) { $date_arr = explode('-', Url::get('created_time_from')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if (Url::get('created_time_to')) { $date_arr = explode('-', Url::get('created_time_to')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } $search_value = ' 1 '; if ($created_time_from) { $search_value .= ' AND created_time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND created_time <= ' . $created_time_to; } $item_per_page = 50; $sql_count = 'SELECT COUNT(id) AS total_item FROM item WHERE user_id = "' . $user_id . '" AND ' . $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, 'Sản phẩm', 'Trang'); $sql = 'SELECT * FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value . ' ORDER BY modify_time DESC ' . $limit; $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { $row['ebname'] = AZLib::safe_title($row['name']); $row['modify_time'] = date('d/m/y H:i', $row['modify_time']); $row['created_time'] = date('d/m/y H:i', $row['created_time']); $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=delete&id=' . $row['id'] . '&user_id=' . $row['user_id']); $items[$row['id']] = $row; } } } else { $paging = ''; } $display->add('user_info', $user_info); $display->add('total_item', $total); $display->add('items', $items); $display->add('paging', $paging); $display->output('item_list'); $this->endForm(); }
function draw() { global $display; $this->beginForm(); $sql = "SELECT COUNT(*) AS total_row FROM spam_mail"; $total = DB::fetch($sql, 'total_row', 0); $spam_content = DB::select('spam_content', 'status=1'); $pagging = ''; $spam_emails = array(); if ($total) { $limit = ''; $pagging = AZPagging::pagingSE($limit, $total, 50, 10, 'page_no', true); $sql = "SELECT id, email_list, time, time_modify, spam_id, status FROM spam_mail ORDER BY id DESC {$limit}"; $re = DB::query($sql); if ($re) { while ($email = mysql_fetch_assoc($re)) { if ($email['time'] != $email['time_modify']) { $email['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $email['time']); $email['time'] .= "<br /><b>Sửa:</b> " . date('H\\hi d.m.Y', $email['time_modify']); } else { $email['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $email['time']); } if ($spam_content && $spam_content['id'] == $email['spam_id']) { $email['spam_id'] = '<font color="green">Đã spam</font>'; $email['reset'] = AZLib::button(Url::build_current(array('cmd' => 'reset_email', 'id' => $email['id'])), 'icon-reload.gif', 'Spam lại'); } else { $email['spam_id'] = '<font color="orange">Chưa được Spam</font>'; $email['reset'] = ''; } if ($email['status']) { $email['status'] = '<font color="green">Có</font>'; $email['check'] = AZLib::button(Url::build_current(array('cmd' => 'deactive_email', 'id' => $email['id'])), 'admin/delete_button_dis.gif', 'Không cho phép spam'); } else { $email['status'] = '<font color="orange">Không</font>'; $email['check'] = AZLib::button(Url::build_current(array('cmd' => 'active_email', 'id' => $email['id'])), 'admin/check.gif', 'Cho phép spam'); } if ($email['email_list']) { $email['email_list'] = count(explode("\n", $email['email_list'])); } else { $email['email_list'] = 0; } $email['edit_link'] = Url::build_current(array('cmd' => 'edit_email', 'id' => $email['id'])); $email['del_link'] = Url::build_current(array('cmd' => 'delete_email', 'id' => $email['id'])); $spam_emails[$email['id']] = $email; } } } $display->add('check_all', AZLib::button(Url::build_current(array('cmd' => 'active_all_email')), 'admin/check.gif', 'Cho phép spam tất cả các mail')); $display->add('check_none', AZLib::button(Url::build_current(array('cmd' => 'deactive_all_email')), 'admin/delete_button_dis.gif', 'Không phép spam tất cả các mail')); $display->add('items', $spam_emails); $display->add('pagging', $pagging); $display->output('ManageEmail'); $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(); }
function draw() { global $display; $this->beginForm(); $sql = "SELECT COUNT(*) AS total_row FROM spam_content"; $total = DB::fetch($sql, 'total_row', 0); $pagging = ''; $spam_contents = array(); if ($total) { $limit = ''; $pagging = AZPagging::pagingSE($limit, $total, 50, 10, 'page_no', true); $sql = "SELECT id, des, subject, content, time, time_modify, status FROM spam_content ORDER BY id DESC {$limit}"; $re = DB::query($sql); if ($re) { while ($spam = mysql_fetch_assoc($re)) { if ($spam['time'] != $spam['time_modify']) { $spam['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $spam['time']); $spam['time'] .= "<br /><b>Sửa:</b> " . date('H\\hi d.m.Y', $spam['time_modify']); } else { $spam['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $spam['time']); } if ($spam['status'] == 0) { $spam['status'] = '<font color="orange">Chưa kích hoạt</font>'; $spam['check'] = AZLib::button(Url::build_current(array('cmd' => 'active_content', 'id' => $spam['id'])), 'admin/check.gif', 'Kích hoạt'); } elseif ($spam['status'] == 1) { $spam['status'] = '<font color="red"><b>Kích hoạt</b></font>'; $spam['check'] = AZLib::button(Url::build_current(array('cmd' => 'deactive_content', 'id' => $spam['id'])), 'admin/delete_button_dis.gif', 'Bỏ kích hoạt'); } $spam['edit_link'] = Url::build_current(array('cmd' => 'edit_content', 'id' => $spam['id'])); $spam['del_link'] = Url::build_current(array('cmd' => 'delete_content', 'id' => $spam['id'])); $spam['onclick'] = Url::open_popup('spam_preview.php?spam_id=' . $spam['id'], '600', 400, false, false, false, true, false, false, true); $spam_contents[] = $spam; } } } $display->add('items', $spam_contents); $display->add('pagging', $pagging); $display->output('ManageSpam'); $this->endForm(); }
function draw() { global $display; $keyword = Url::get('keyword'); $display->add('keyword', $keyword); $display->add('export_link', Url::build_current(array('cmd' => 'export'))); $where = '1'; if ($keyword != '') { $where .= ' AND email LIKE "%' . $keyword . '%"'; } $total_item = DB::count('news_letter_email', $where); $limit = ''; $item_per_page = 40; $page_no = (int) Url::get('page_no'); $pagging = AZPagging::paging_list($limit, $total_item, $item_per_page, 10); $re = DB::query('SELECT * FROM news_letter_email WHERE ' . $where . ' ORDER BY id ' . $limit); $news_letter_emails = array(); $i = 0; if ($page_no <= 0) { $page_no = 1; } if ($re) { while ($item = mysql_fetch_assoc($re)) { $item['time_add'] = date('H:i', $item['time_add']) . ' ngày ' . date('d/m/Y', $item['time_add']) . '<br />Cách đây ' . AZLib::duration_time($item['time_add']); $item['delete'] = AZLib::buttonDel(Url::build_current(array('cmd' => 'delete', 'id' => $item['id'])), 'style/images/admin/delete.gif', 'Loại bỏ Email này khỏi danh sách!'); $i++; $item['i'] = $i + ($page_no - 1) * $item_per_page; $news_letter_emails[$item['id']] = $item; } } $display->add('pagging', $pagging); $display->add('news_letter_emails', $news_letter_emails); $display->add('count', $total_item); $this->beginForm(); $display->output("NewsLetterAdmin"); $this->endForm(); }
function draw() { global $display; $this->beginForm(); $where = ''; $page = Url::get('page', 1); $e_id = Url::get('e_id', 0); $user_name = Url::get('user_name'); $status = Url::get('status', 0); if ($user_name) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " user_name = '{$user_name}'"; } if ($e_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " id = {$e_id}"; } if ($status == 4) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " status = 0"; } elseif ($status) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " status = {$status}"; } $date_start = Url::get('date_start'); $date_end = Url::get('date_end'); if ($date_start) { $arr = explode('-', $date_start); $where .= ($where != '' ? ' AND ' : 'WHERE ') . " time>=" . mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]); } if ($date_end) { $arr = explode('-', $date_end); $where .= ($where != '' ? ' AND ' : 'WHERE ') . " time<=" . mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]); } $display->add('e_id', $e_id); $display->add('date_start', $date_start); $display->add('date_end', $date_end); $display->add('user_name', $user_name); $display->add('status', $status); $display->add('url', Url::build_all(array('cmd'))); $total = DB::fetch("SELECT COUNT(*) AS total_row FROM event_product {$where}", 'total_row', 0); $display->add('total', $total); $pagging = ''; $items = array(); $sms_rows = array(); $item_ids = ''; if ($total) { //----- Pagging --------------- $limit = ''; $pagging = AZPagging::pagingSE($limit, $total, 50, 10, 'page_no', true, ' SMS'); //----- Pagging --------------- $sql = "SELECT * FROM event_product {$where} ORDER BY id DESC {$limit}"; $re = DB::query($sql); if ($re) { while ($sms_row = mysql_fetch_assoc($re)) { $sms_row['time_c'] = "Tạo: " . date('H\\hi d.m.Y', $sms_row['time_c']) . " bởi {$sms_row['user_c']}"; $sms_row['time_m'] = "Tạo: " . date('H\\hi d.m.Y', $sms_row['time_m']) . " bởi {$sms_row['user_m']}"; if ($sms_row['img_url'] != '' && isset(CGlobal::$img_server[$sms_row['img_server']])) { $sms_row['img'] = "<a href='http://" . CGlobal::$img_server[$sms_row['img_server']] . "/{$sms_row['img_url']}' target='_blank'>Img</a>"; } if ($sms_row['status'] == 4) { $sms_row['status'] = "<font color='#cc0000'>Đã xoá</font> (lúc " . date('H\\hi d.m.Y', $sms_row['time_c']) . " bởi {$sms_row['user_c']})"; } elseif ($sms_row['status'] == 1) { $sms_row['status'] = '<font color="green">OK</font>'; } elseif ($sms_row['status'] == 2) { $sms_row['status'] = '<font color="brown">Disable</font>'; } elseif ($sms_row['status'] == 3) { $sms_row['status'] = '<font color="blue">Finished</font>'; } //$sms_row['note'] = ($sms_row['note']!=''?"<b>{$sms_row['user_m']} (".date("H\h:i d/m/Y",$sms_row['m_time']).")</b>":"")." ".stripslashes($sms_row['note']).'<br /><img style="cursor:pointer" alt="Ghi chú" title="Ghi chú" src="style/images/action_reply.gif" onclick="note_ua_sms(\''.$sms_row['id'].'\',\''.AZLib::remove_4_js($sms_row['note']).'\');" /> '; $sms_row['edit_link'] = "evnent.html?cmd=edit&id={$sms_row['id']}"; $sms_row['del_link'] = "evnent.html?cmd=del&id={$sms_row['id']}"; $sms_rows[$sms_row['id']] = $sms_row; } } } $display->add('is_root', User::is_root()); $display->add('items', $sms_rows); $display->add('pagging', $pagging); $display->output('e_product'); $this->endForm(); }
function draw() { global $display; $this->beginForm(false, "POST", false, Url::build_current()); $search_value = " 1 "; $type_check = Url::get('type_check', 1); $display->add('type_check', $type_check); if ($type_check == 2) { $search_value = ' type=2'; } else { $search_value = ' type>=0'; } $order_by = " ORDER BY time DESC"; //search theo ngay thang nam $display->add('created_time_from', Url::get('created_time_from')); $display->add('created_time_to', Url::get('created_time_to')); $created_time_from = 0; $created_time_to = 0; if (Url::get('created_time_from')) { $date_arr = explode('-', Url::get('created_time_from')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if (Url::get('created_time_to')) { $date_arr = explode('-', Url::get('created_time_to')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if ($created_time_from) { $search_value .= ' AND time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND time <= ' . $created_time_to; } ///// Tim ADMIN if (Url::get('admin_text_value') != '') { $admin_text_value = Url::get('admin_text_value'); $display->add('admin_text_value', $admin_text_value); $str_search = str_replace("'", '"', $admin_text_value); $str_search = str_replace("'", '"', $str_search); $str_search = str_replace(""", '"', $str_search); $search_value .= " AND admin_name LIKE '%" . $str_search . "%'"; } if (Url::get('admin_text_value_open') != '') { $admin_text_value_open = Url::get('admin_text_value_open'); $display->add('admin_text_value_open', $admin_text_value_open); $str_search = str_replace("'", '"', $admin_text_value_open); $str_search = str_replace("'", '"', $str_search); $str_search = str_replace(""", '"', $str_search); $search_value .= " AND unlock_user LIKE '%" . $str_search . "%'"; } $admin_id_search = (int) Url::get('admin_id_search', 0); if ($admin_id_search) { $search_value .= ' AND admin_id=' . $admin_id_search; } if ($admin_id_search == 0) { $admin_id_search = ''; } $display->add('admin_id_search', $admin_id_search); ///// Tim User // search ô textbox tài khoản if (Url::get('text_value') != '') { $text_value = Url::get('text_value'); $display->add('text_value', $text_value); $str_search = str_replace("'", '"', $text_value); $str_search = str_replace("'", '"', $str_search); $str_search = str_replace(""", '"', $str_search); $search_value .= " AND user_lock.user_name LIKE '%" . $str_search . "%'"; } // search ô textbox ID $id_search = (int) Url::get('id_search', 0); if ($id_search) { $search_value .= ' AND user_lock.user_id=' . $id_search; } if ($id_search == 0) { $id_search = ''; } $display->add('id_search', $id_search); $paging = ''; $item_per_page = Url::get('item_per_page', 50); $sql_count = 'SELECT COUNT(id) AS total_item FROM user_lock 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, 'Thành viên', 'Trang'); $sql = 'SELECT user_lock.*, user.block_time, user.invalid_time FROM user_lock INNER JOIN user ON user.id=user_lock.user_id WHERE ' . $search_value . $order_by . $limit; $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { $row['time'] = date('H:i d/m/y', $row['time']); $row['is_block'] = false; if ($row['unlock_time'] > 0) { $row['unlock_time'] = date('H:i d/m/y', $row['unlock_time']); } else { $row['unlock_time'] = ""; } $row['unban_nick'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=unban_nick&id=' . $row['id'] . '&user_id=' . $row['user_id']); if ($row['block_time'] > TIME_NOW) { $row['is_block'] = "khóa theo ngày"; } elseif ($row['block_time'] == -1) { $row['is_block'] = "khóa vĩnh viễn"; } //$row['is_block'] .= $row['is_block']!=""?" & ":""; if ($row['invalid_time'] > TIME_NOW) { $row['is_block'] = "KD theo ngày"; } elseif ($row['invalid_time'] == -1) { $row['is_block'] = "KD vĩnh viễn"; } $items[$row['id']] = $row; } } } $display->add('total_user', $total); $display->add('items', $items); $display->add('paging', $paging); $display->output('ManageUserLock'); $this->endForm(); }
function draw() { global $display; AZLib::getCats(); $this->beginForm(false, 'post', false, Url::build_current()); $created_time_from = 0; $created_time_to = 0; $time_from = ""; $time_to = ""; $phrase_checked = ""; $free_cat_checked = ""; $up_checked = ""; $pagging = ""; $limit = ""; $lock_checked = ''; $select_subcat_checked = ''; $items = array(); $id_search = (int) Url::get("id_search"); $censor = Url::get("censor", 1); $user_name = AZLib::getParam("user_name"); $zone_id = Url::get("zone_id"); $searchByCat = Url::get("searchByCat"); $searchByCatType = Url::get("searchByCatType", 0); $searchBySubCat = Url::get("searchBySubCat"); $searchBySubCatType = Url::get("searchBySubCatType", 0); $sort_type = Url::get("sort_type", 1); $keywords = Url::get("keywords"); $have_img = Url::get("have_img", 0); $lock_item = Url::get("lock"); $phrase_selected = Url::get("phrase"); $free_cat_selected = Url::get("free_cat"); $up = Url::get("up"); $select_subcat = Url::get("select_subcat", ""); $opt_have_img = AZLib::getOption(array(0 => "-Tìm theo ảnh-", 1 => "-Có ảnh-", 2 => "-Không ảnh-"), $have_img); if (isset($_REQUEST["created_time"]) && $_REQUEST["created_time"]) { $time_from = Url::get("created_time"); } if (isset($_REQUEST["created_time_to"]) && $_REQUEST["created_time_to"]) { $time_to = Url::get("created_time_to"); } if ($time_from) { $date_arr = explode("-", $time_from); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if ($time_to) { $date_arr = explode("-", $time_to); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } $search_value = ""; $where = ""; //$order_by = "ORDER BY del_time DESC"; $order_by = ""; $total_item = 0; if ($keywords) { $search_value = ($search_value == "" ? " WHERE " : " AND ") . "id IN (0)"; } if ($sort_type == 1) { $order_by = "ORDER BY id DESC"; } elseif ($sort_type == 2) { $order_by = "ORDER BY modify_time DESC"; } elseif ($sort_type == 3) { $order_by = "ORDER BY item_order ASC"; } if ($free_cat_selected) { $free_cat_checked = "checked"; $catids = implode(",", array_keys(CGlobal::$allCategories)); $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id NOT IN({$catids})"; $order_by = $order_by != "" ? $order_by : "ORDER BY id DESC"; } else { if ($searchBySubCat) { if ($searchBySubCatType) { // Nếu chỉ tìm trong danh mục con của danh mục cấp 2 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "level_2_catid = " . $searchBySubCat; // Lọc những item có trường level_2_catid là danh mục cấp 2 } else { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id = " . $searchBySubCat; // Ngược lại, lấy các bản ghi thuộc chính danh mục cấp 2 } } elseif ($searchByCat) { // Nếu chỉ tìm trong danh mục con của danh mục cấp 1 if ($searchByCatType) { // Lọc những item có trường level_1_catid là danh mục cấp 1 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "level_1_catid = " . $searchByCat; } else { // Ngược lại, lấy các bản ghi thuộc chính danh mục cấp 1 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id = " . $searchByCat; } } } if ($censor != 9) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "status=" . $censor; } if ($user_name != "") { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "user_name ='{$user_name}'"; } if ($select_subcat) { $select_subcat_checked = "checked"; } if ($up) { if ($created_time_from) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "created_time >= " . $created_time_from; } if ($created_time_to) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "created_time <= " . $created_time_to; } $up_checked = "checked"; } else { if ($created_time_from) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "modify_time >= " . $created_time_from; } if ($created_time_to) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "modify_time <= " . $created_time_to; } } if ($have_img == 1) { //có ảnh $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "have_image=1"; } elseif ($have_img == 2) { //ko có ảnh $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "have_image=0"; } if ($id_search) { //ID sản phẩm $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "id={$id_search}"; } if (Url::get("up")) { $order_by = $order_by != "" ? $order_by : "ORDER BY created_time DESC"; } else { $order_by = $order_by != "" ? $order_by : "ORDER BY modify_time DESC"; } $sql = "SELECT * FROM item {$search_value} {$order_by}"; $sql_count = "SELECT count(*) AS total_row FROM item {$search_value}"; $total_item = (int) DB::fetch($sql_count, "total_row"); if ($total_item) { $pagging = AZPagging::pagingSE($limit, $total_item, 50, 10, 'page_no', true, 'Sản phẩm', 'Trang'); $sql .= $limit; } $re = DB::query($sql); if ($re) { $index_temp = 0; while ($item = mysql_fetch_assoc($re)) { //trạng thái sản phẩm: if ($item['status'] == -1) { $item['bgcolor'] = "bgcolor=\"#FF6633\""; } elseif ($index_temp) { $item['bgcolor'] = "bgcolor=\"#EFEFEF\""; } else { $item['bgcolor'] = ""; } $index_temp = 1 - $index_temp; $item['created_time'] = 'Đăng: <b>' . date("d/m/Y H:i", $item['created_time']) . '</b>'; if ($item['del_time'] && $item['del_user'] && $item['status'] == -1) { $item['del_time'] = '<br /><font color=red>Xoá: <b>' . date("d/m/Y H:i", $item['del_time']) . '</font></b> ( <a target="_blank" href="' . WEB_DIR . $item['del_user'] . '"><strong>' . $item['del_user'] . '</strong></a>)'; } else { $item['del_time'] = ''; } if ($item['modify_user_name'] && $item['status'] != -1) { $item['is_modify'] = '<br><font color=gray>Sửa: <b>' . date("d/m/Y H:i", $item['modify_time']) . '</font></b>'; $item['is_modify'] .= ' ( <a target="_blank" href="' . WEB_DIR . $item['modify_user_name'] . '"><strong>' . $item['modify_user_name'] . '</strong></a>)'; } else { $item['is_modify'] = ''; } $item['name'] = AZLib::filter_title($item['name']); $item['description'] = AZLib::remove_4_js(AZLib::plainText($item['description'])); $item['price'] = number_format($item['price'], 0, ',', '.'); $item['price_out'] = number_format($item['price_out'], 0, ',', '.'); $item['currency_option'] = AZLib::getOption(array(1 => "VNĐ", 2 => "\$"), $item['currency_id']); //$item['price'] = "Giá bán: ".AZLib::priceFomart($item['price'],$item['currency_id']); //$item['price_out'] = "<br /><font color='#999999'>Giá TT: ".AZLib::priceFomart($item['price_out'],$item['currency_id']).'</font>'; if ($item['level_1_catid'] > 0) { if (isset(CGlobal::$allCategories[$item['level_1_catid']])) { $item['cat_name'] = '<b>' . CGlobal::$allCategories[$item['level_1_catid']]['name'] . ' (' . $item['level_1_catid'] . ')</b>'; } else { $item['cat_name'] = '<b><font color=red>(' . $item['level_1_catid'] . ')</font></b>'; } if ($item['category_id'] > 0 && $item['category_id'] != $item['level_1_catid'] || $item['cat_name'] == '') { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['cat_name'] .= ' - <i>' . CGlobal::$allCategories[$item['category_id']]['name'] . ' (' . $item['category_id'] . ')</i>'; } else { $item['cat_name'] .= ' - <i><b><font color=red>(' . $item['category_id'] . ')</font></b></i>'; } } } if ($item['img_url']) { $item['image_src'] = 'http://' . CGlobal::$img_server[$item['img_server']] . $item['img_url']; $item['image'] = AZLib::getImageThumb($item['img_url'], 110, 0, 1, $item["img_server"]); } else { $item['image_src'] = ''; $item['image'] = ''; } $item['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . AZLib::safe_title($item['name'])); $item['edit'] = Url::build('post_item', array('cmd' => 'edit', 'id' => $item['id'])); if ($item['status'] == -1) { $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=del_forever&id=' . $item['id']); $item['re_post'] = Url::build_all(array('cmd', 'id'), 'cmd=re_post&id=' . $item['id']); } elseif ($item['status'] == 2) { $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=delete&id=' . $item['id']); $item['show_link'] = Url::build_all(array('cmd', 'id'), 'cmd=show&id=' . $item['id']); } else { $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=delete&id=' . $item['id']); $item['hide_link'] = Url::build_all(array('cmd', 'id'), 'cmd=hide&id=' . $item['id']); } $item['del_cache'] = Url::build_all(array('cmd', 'id'), 'cmd=del_cache&id=' . $item['id']); $items[$item['id']] = $item; } } $display->add('items', $items); $type_arr = array(1 => "-Sản phẩm không ẩn-", 2 => "-Sản phẩm ẩn-"); if (User::have_permit(ADMIN_DEL_ITEM)) { $type_arr[-1] = "-Sản phẩm đã xoá-"; $type_arr[9] = "-Tất cả các sản phẩm (Cả sản phẩm xóa)-"; } $option_censor = AZLib::getOption($type_arr, Url::get('censor', 1)); $display->add('censor', $censor); $display->add('option_censor', $option_censor); $display->add('have_img_option', $opt_have_img); $display->add('lock_checked', $lock_checked); $display->add('user_name', $user_name); $display->add('created_time', $time_from); $display->add('created_time_to', $time_to); $display->add('phrase_checked', $phrase_checked); $display->add('free_cat_checked', $free_cat_checked); $display->add('up_checked', $up_checked); $display->add('select_subcat_checked', $select_subcat_checked); $display->add('id_search', $id_search); $item_cat_search = $this->GetCatTree(); $display->add('list_top_cat_js', AZLib::getOption(AZLib::getTopCats(), 999999999)); $display->add('IS_ADMIN', User::is_admin()); $display->add('page_no', Url::get('page_no')); $display->add('paging', $pagging); $display->add('total_item', $total_item); $display->add('item_cat', AZLib::getOption($this->getOtionCats(), Url::get('id_cats'))); $display->add('category_tree', json_encode($item_cat_search)); $display->add('catSelected', Url::get('searchByCat', 0)); $display->add('catSelectedType', Url::get('searchByCatType', 0)); $display->add('subCatSelected', Url::get('searchBySubCat', 0)); $display->add('subCatSelectedType', Url::get('searchBySubCatType', 0)); $display->add('keywords', $keywords); $display->add('sort_type', $sort_type); $display->output('ManageItem'); $this->endForm(); }
function show_mes_outbox() { $search_text = AZLib::getParam('search_text'); $is_archive = Url::get('is_archive', 0); $table_topics = 'message_topics'; $table_text = 'message_text'; $url_archive = ''; $url_cmd = ''; if ($is_archive) { $table_topics = $table_topics . '_archive'; $table_text = $table_text . '_archive'; $url_cmd = '?cmd=archive'; $url_archive = '&is_archive=1'; } $condition = $table_topics . '.mt_owner_id =' . User::id() . ' AND ' . $table_topics . '.mt_vid_folder = "sent" AND ' . $table_topics . '.mt_newest = 0'; if ($search_text && $search_text != "Account thành viên") { $condition .= " AND mt_to_name LIKE '%{$search_text}%' "; } $str_content = '<form name="message"> <div id="boxFunctions"> Chọn: <a style="cursor:pointer" id="select_all">Tất cả</a>, <a style="cursor:pointer" id="select_read">Đã đọc</a>, <a style="cursor:pointer" id="select_unchecked">Không chọn</a> <div id="boxFunctionRight"> <div id="btn_del_mess" align="center" class="btnAllNewFeedback" onmouseout="this.className=\'btnAllNewFeedback\'" onmouseover="this.className=\'btnAllNewFeedbackHover\'" style="width:40px;"> <div class="btnRightAllFeedback" align="center" style="width:40px"><a title="Xóa tất cả tin nhặn đã chọn" href="javascript:void(0)" onClick="return delMessage(0,\'true\',\'outbox\')">Xoá</a></div> </div> </div> </div> '; $str_content .= '<table cellpadding="3" cellspacing="0" border="0" width="100%">'; $sql_count = 'SELECT COUNT(mt_id) AS total_row FROM ' . $table_topics . ' WHERE ' . $condition; $total_item = DB::fetch($sql_count, 'total_row', 0); $item_per_page = 15; $limit = ''; $divID = 'mess_content'; $url_path = WEB_DIR . 'ajax.php?act=personal&code=show_mes_outbox' . $url_archive . '&search_text=' . $search_text; $paging = AZPagging::AjaxPaging($limit, $total_item, $item_per_page, 5, 'page_mes', '', false, false, $url_path, $divID, true); $sql = 'SELECT ' . $table_text . '.msg_id, ' . $table_text . '.msg_author_name, ' . $table_text . '.msg_date, ' . $table_text . '.msg_post, ' . $table_topics . '.mt_id, ' . $table_topics . '.mt_ref_id, ' . $table_topics . '.mt_title, ' . $table_topics . '.mt_from_id, ' . $table_topics . '.mt_owner_id, ' . $table_topics . '.mt_read, ' . $table_topics . '.mt_owner_name, ' . $table_topics . '.mt_to_name, user.avatar_url, user.img_server FROM ' . $table_text . ', ' . $table_topics . ', user WHERE ' . $table_text . '.msg_id = ' . $table_topics . '.mt_msg_id AND ' . $table_topics . '.mt_from_id = user.id AND ' . $condition . ' ORDER BY ' . $table_text . '.msg_date DESC ' . $limit; //echo $sql; //exit; $result = DB::query($sql); $stt = 0; if ($result) { while ($row = mysql_fetch_assoc($result)) { if ($stt < $item_per_page) { if ($row['mt_ref_id']) { $sourceTitle = DB::select($table_topics, 'mt_id = ' . $row['mt_ref_id']); if ($sourceTitle['mt_title']) { $row['mt_title'] = $sourceTitle['mt_title']; } //else //{ // $sentTitle = DB::select($table_topics,'mt_mgsid = ' . $row['mt_ref_id']); //} $row["mt_id"] = $row['mt_ref_id']; $row['mt_ref_id'] = 0; } if ($row['avatar_url']) { $row['avatar_url'] = AZLib::getImageThumb($row['avatar_url'], 50, 50, 0, $row['img_server']); } else { $row['avatar_url'] = "style/images/50x50.gif"; } //$row['msg_date'] = AZLib::duration_time($row['msg_date']); $msg_date = date('H:i | ', $row['msg_date']); if (date('d.m.y', $row['msg_date']) == date('d.m.y', TIME_NOW)) { $msg_date .= '<font color="green">Hôm nay</font>'; } else { $msg_date .= date('d.m.y', $row['msg_date']); } $row['msg_date'] = $msg_date; $row['msg_post'] = preg_replace("/\n/", "<br />", $row['msg_post']); $row['msg_post'] = strip_tags(AZLib::parseBBCode(AZLib::convert_one_br($row['msg_post'])), '<br />'); if (strlen($row['msg_post']) > 40) { $row['msg_post_short'] = AZLib::word_limit($row['msg_post'], 40, ' ...'); //$row['msg_post_short'] = AZLib::cleanHtml(AZLib::word_limit($row['msg_post'],40,' ...')); } else { $row['msg_post_short'] = $row['msg_post']; //$row['msg_post_short'] = AZLib::cleanHtml($row['msg_post']); } //$str_title = '<a onclick="fn_show_mes_detail('.$row["mt_id"].')" rel="history" href="message.html'.$url_cmd.'#outbox/'.$row["mt_id"].'" id="a_'.$row["mt_id"].'" title="Hiển thị chi tiết" >'.$row["mt_title"].'</a> - <span class="textMestime">'.$row['msg_date'].'</span>'; if ($row['mt_owner_id'] != User::id()) { $strUser = '******' . $row["mt_owner_name"] . '">' . $row["mt_owner_name"] . '</a>'; } else { $strUser = '******' . $row["mt_to_name"] . '">' . $row["mt_to_name"] . '</a>'; } if ($row["mt_read"] == 0 && !$is_archive) { $str_title = '<a onclick="detail_reload_jcache = true;fn_show_mes_detail(' . $row["mt_id"] . ',1,\'outbox\')" rel="history" id="a_' . $row["mt_id"] . '" href="message.html' . $url_cmd . '#outbox/' . $row["mt_id"] . '" title="Hiển thị chi tiết" ><b>' . $row["mt_title"] . '</b></a>'; $read_class = ' unreadMessage'; } else { $str_title = '<a onclick="detail_reload_jcache = true;fn_show_mes_detail(' . $row["mt_id"] . ',1,\'outbox\')" rel="history" id="a_' . $row["mt_id"] . '" href="message.html' . $url_cmd . '#outbox/' . $row["mt_id"] . '" title="Hiển thị chi tiết">' . $row["mt_title"] . '</a>'; $read_class = ''; } $str_content .= '<tr id="' . $row["mt_id"] . '"> <td align="center" class="listMessage' . $read_class . '"><input type="checkbox" class="rowbox' . $read_class . '" id="inbox_' . $row["mt_id"] . '" name="inbox[]" value="' . $row["mt_id"] . '"></td> <td align="center" class="listMessage' . $read_class . '"> <a href="' . $row["msg_author_name"] . '"><img src="' . $row["avatar_url"] . '"/></a> </td> <td valign="top" class="listMessage' . $read_class . '" style="white-space:nowrap; padding-right:15px; vertical-align:middle;"> <div>' . $strUser . '</div> <div class="textMestime">' . $row['msg_date'] . '</div> </td> <td valign="top" class="listMessage clickable' . $read_class . '" style="padding-right:15px;width:65%;" lang="' . $row["mt_id"] . '"> <div style="margin-top:6px;">' . $str_title . '</div> <div style="margin:6px 0;color:#808080">' . $row['msg_post_short'] . '</div> </td> <td align="center" class="listMessage' . $read_class . '" style="padding-right:10px;"> <span><a title="Xóa tin nhắn" onClick="return delMessage(' . $row["mt_id"] . ',\'false\',\'inbox\')" href="javascript:void(0)" style="padding:20px;" class="deleteButton"> </a></span></td> </tr> '; /*$str_content .= '<tr id="'.$row["mt_id"].'"> <td align="center" class="listMessage' . $read_class . '"><input type="checkbox" id="inbox_'.$row["mt_id"].'" name="inbox[]" value="'.$row["mt_id"].'"></td> <td align="center" class="listMessage' . $read_class . '"> <a href="'.$row["mt_to_name"].'"><img src="'.$row["avatar_url"].'" vspace="4" hspace="4"/></a> <div><a href="'.$row["mt_to_name"].'">'.$row["mt_to_name"].'</a></div> </td> <td valign="top" style="width:65%;" class="listMessage' . $read_class . '"> <div>'.$str_title.'</div> <div style="margin-top:6px">'.$row['msg_post_short'].'</div> </td> <td align="center" class="listMessage' . $read_class . '"> <span><a title="Xóa tin nhắn" onClick="delMessage('.$row["mt_id"].',\'false\',\'sent\')" href="javascript:void(0)"> <img src="style/images/icon_delete.gif" width="9" height="9" /></a></span></td> </tr>';*/ } $stt++; } } if ($stt > 0) { $str_content .= '<tr><td></td><td> </td><td colspan="2"><div style="float:right">' . $paging . '</div><div style="clear:right"></div></td></tr>'; } else { $str_content .= '<tr><td></td><td colspan="3"> <center><div class="noMess">Không có Tin nhắn nào trong tin đã gửi</div></center> </td></tr>'; } $str_content .= '</table></form>'; echo $str_content; exit; }
function draw() { global $display; $this->beginForm(false, "POST", false, Url::build_current()); $display->add('msg', $this->showFormErrorMessages(1)); $display->add('url_admin', Url::build_current()); $key_word = Url::get('key_word'); $display->add('key_word', $key_word); $display->add('option_date1', AZLib::getOptionNum(1, 31, (int) Url::get('cmb_date1', 1))); $display->add('option_month1', AZLib::getOptionNum(1, 12, (int) Url::get('cmb_month1', 1))); $display->add('option_year1', AZLib::getOptionNum(2011, date("Y"), (int) Url::get('cmb_year1', 2011))); $display->add('option_date2', AZLib::getOptionNum(1, 31, (int) Url::get('cmb_date2', date('d')))); $display->add('option_month2', AZLib::getOptionNum(1, 12, (int) Url::get('cmb_month2', date('m')))); $display->add('option_year2', AZLib::getOptionNum(2011, date("Y"), (int) Url::get('cmb_year2', date('Y')))); $display->add('url_add', Url::build_current(array('cmd' => 'add'))); if (Url::get('cmb_date1') != '' && Url::get('cmb_month1') != '' && Url::get('cmb_year1') != '') { $from_date = mktime(0, 0, 0, Url::get('cmb_month1'), Url::get('cmb_date1'), Url::get('cmb_year1')); } else { $from_date = 0; } if (Url::get('cmb_date2') != '' && Url::get('cmb_month2') != '' && Url::get('cmb_year2') != '') { $to_date = mktime(23, 59, 59, Url::get('cmb_month2'), Url::get('cmb_date2'), Url::get('cmb_year2')); } else { $to_date = 0; } $condition = ''; $status = Url::get('status', 0); $user_c = Url::get('user_c'); $user_m = Url::get('user_m'); if ($status == 1) { $condition .= ($condition != '' ? ' AND ' : ' ') . ' status=1'; } elseif ($status == 2) { $condition .= ($condition != '' ? ' AND ' : ' ') . ' status=0'; } if ($user_c != '') { $condition .= ($condition != '' ? ' AND ' : ' ') . ' user_c LIKE "%' . $user_c . '%"'; } if ($user_m != '') { $condition .= ($condition != '' ? ' AND ' : ' ') . ' user_m LIKE "%' . $user_m . '%"'; } if ($from_date && $to_date) { $condition .= ($condition != '' ? ' AND ' : ' ') . ' time_c >=' . $from_date . ' AND time_c <= ' . $to_date; } $display->add('user_c', $user_c); $display->add('user_m', $user_m); $display->add('status_option', AZLib::getOption(array(0 => "Tất cả", 1 => "Hiện", 2 => "Ẩn SP"), $status)); if ($key_word) { $key_word_s = ''; $arr = explode(' ', $key_word); if ($arr) { foreach ($arr as $key) { $key = trim($key); if ($key != '') { $key_word_s .= ($key_word_s == '' ? '+' : ' +') . "{$key}"; } } } if ($key_word_s != '') { $condition .= " AND MATCH(title, des) AGAINST ('{$key_word_s}' IN BOOLEAN MODE)"; } //$condition .= ' AND (title LIKE "%'.$key_word.'%" OR des LIKE "%'.$key_word.'%")'; } /*if(Url::get('key_word','str','')) $condition.=($condition!=''?' AND ':' ').' (title LIKE "%'.$key_word.'%" OR des LIKE "%'.$key_word.'%")';*/ $total_item = DB::count('document', $condition); $LIMIT = ''; $paging = AZPagging::paging_list($LIMIT, $total_item, 20, 10, 'page_no', '', true, "Tài liệu", 'Trang'); $display->add('paging', $paging); $condition = ($condition != '' ? 'WHERE' : '') . $condition; $documents = array(); $sql = 'SELECT * FROM document ' . $condition . ' ORDER BY id DESC ' . $LIMIT; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $row['title'] = stripslashes($row['title']); $row['des'] = stripslashes($row['des']); if ($row['status'] == 1) { $row['change'] = AZLib::button(Url::build_current(array('cmd' => 'change', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/unexam.gif', 'Disable'); $row['bgcolor'] = "#FFFFFF"; $row['status'] = 'OK'; } else { $row['change'] = AZLib::button(Url::build_current(array('cmd' => 'change', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/exam.gif', 'Enable'); $row['bgcolor'] = "#FF9900"; $row['status'] = 'Disable'; } $row['time_last'] = $row['time_last'] ? date("H\\hi:s d/m/Y", $row['time_last']) : ''; $row['time_c'] = date("H\\hi:s d/m/Y", $row['time_c']) . " bởi {$row['user_c']}"; $row['time_m'] = date("H\\hi:s d/m/Y", $row['time_m']) . " bởi {$row['user_m']}"; $row['edit'] = AZLib::button(Url::build_current(array('cmd' => 'edit', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/edit.gif', 'Sửa tài liệu'); $row['delete'] = AZLib::buttonDel(Url::build_current(array('cmd' => 'delete', 'id' => $row['id'], "href" => urlencode('?' . $_SERVER['QUERY_STRING']))), 'style/images/delete.gif', 'Sửa tài liệu'); if ($row['url']) { $row['document_detail'] = $row['url']; } else { $row['document_detail'] = WEB_DIR . "download-{$row['id']}/" . AZLib::safe_title($row['title']) . ".html"; $row['url'] = WEB_ROOT . "download-{$row['id']}/" . AZLib::safe_title($row['title']) . ".html"; } $documents[$row['id']] = $row; } } $display->add('documents', $documents); $display->output('DocumentAdmin'); $this->endForm(); }
function draw() { global $display; $status_arr = array('0' => 'Chưa trả lời / phản hồi', '1' => 'Đã phản hồi / phản hồi', '2' => 'Tất cả'); $status = (int) Url::get('status', 0); $display->add('url_admin', Url::build_current()); $display->add('status_option', AZLib::getOption($status_arr, $status)); $item_per_page_arr = array('20' => '20', '50' => '50', '100' => '100', '150' => '150', '200' => '200', '300' => '300', '500' => '500'); $item_per_page = (int) Url::get('row_per_page', 20); $display->add('row_per_page_option', AZLib::getOption($item_per_page_arr, $item_per_page)); $from_date_arr[-1] = '--Từ ngày--'; for ($i = 30; $i >= 0; $i--) { $time_from = mktime(0, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)) - $i * 24 * 3600; $from_date_arr[$time_from] = date('d/m/Y', $time_from); } $to_date_arr[-1] = '--Đến ngày--'; for ($i = 0; $i <= 30; $i++) { $time_to = mktime(23, 59, 59, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)) - $i * 24 * 3600; $to_date_arr[$time_to] = date('d/m/Y', $time_to); } $from_date = Url::get('from_date', -1); $to_date = Url::get('to_date', -1); $display->add('from_date_option', AZLib::getOption($from_date_arr, $from_date)); $display->add('to_date_option', AZLib::getOption($to_date_arr, $to_date)); $sql = ' 1 '; if ($from_date > -1) { $sql .= " AND time>=" . $from_date; } if ($to_date > -1) { $sql .= " AND time<=" . $to_date; } $txt_ykien = Url::get('txt_ykien', ''); if ($txt_ykien != '') { $sql .= " AND content like '%{$txt_ykien}%'"; } $display->add('txt_ykien', $txt_ykien); if ($status != 2) { $sql .= ' AND status=' . $status; } $num_of_row = DB::count('feedback', $sql); $limit = ''; $display->add('pagging', AZPagging::paging_list($limit, $num_of_row, $item_per_page, 10, 'page_no', '', true, 'Liên hệ')); $page_no = (int) Url::get('page_no', 1); if ($page_no <= 0) { $page_no = 1; } $i = 0; $all_feedbacks = array(); $sql = "SELECT * FROM feedback WHERE {$sql} ORDER BY id DESC {$limit}"; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $email = ''; if ($row['name']) { $email = stripslashes($row['name']) . " "; } if ($row['address']) { $email .= "( " . stripslashes($row['address']) . ") "; } $email .= '<a href="mailto:' . $row['email'] . '"><font color=blue>' . $row['email'] . "</font></a>"; $row['email'] = $email; $row['date'] = date("d/m/Y H:i:s", $row['time']); $row['date2'] = AZLib::duration_time($row['time']); $row['url_del'] = AZLib::buttonDel(Url::build_current(array('id' => $row['id'], 'cmd' => 'delete')), 'style/images/delete.gif', 'Xóa ý kiến'); $row['url_reply'] = Url::build_current(array('id' => $row['id'], 'cmd' => 'reply')); if ($row['reply_content']) { $row['reply_content'] = stripslashes($row['reply_content']); } else { $row['reply_content'] = "Chưa có"; } if (!$row['status']) { $row['exam'] = AZLib::button(Url::build_current(array('id' => $row['id'], 'cmd' => 'exam')), 'style/images/exam.gif', 'Duyệt liên hệ'); } else { $row['exam'] = AZLib::button(Url::build_current(array('id' => $row['id'], 'cmd' => 'unexam')), 'style/images/unexam.gif', 'Bỏ duyệt liên hệ'); } if ($i % 2 == 0) { $row['bgcolor'] = '#FFFFFF'; } else { $row['bgcolor'] = '#CCFF99'; } $i++; $row['i'] = ($page_no - 1) * $item_per_page + $i; $all_feedbacks[$row['id']] = $row; } } $display->add('all_feedbacks', $all_feedbacks); $this->beginForm(); $display->output("FeedbackAdmin"); $this->endForm(); }
function draw_from() { //mb_internal_encoding("UTF-8"); //AZLib::getCats(); AZLib::getProvinces(); global $display; $page_no = (int) Url::get('page_no', 1); if ($page_no <= 0) { $page_no = 1; } $admin_item = FALSE; if (User::have_permit(ADMIN_ITEM)) { $admin_item = TRUE; } $item_per_page = 30; $sql = 'SELECT * FROM item WHERE '; $where = ''; $curMainCat = CGlobal::$curMainCat; $curLevel2Cat = CGlobal::$curLevel2Cat; /*if($curLevel2Cat){ $where .=($where!=''?" AND ":"")." level_2_catid = ".$curLevel2Cat['id']; } elseif($curMainCat){ $where .=($where!=''?" AND ":"")." level_1_catid = ".$curMainCat['id']; } $where .= ($where!=''?" AND ":"")." status=1"; $sql .= "$where ORDER BY item_order ASC";*/ if (!CGlobal::$item_condition) { //Ngannv hack code trường hợp khong add module FilterMenu hoặc module Build if (isset($_GET['category_id']) && $_GET['category_id']) { CGlobal::$item_condition = " category_id = " . CGlobal::$curCategory . " "; } } $sql .= CGlobal::$item_condition . " ORDER BY item_order ASC"; $total_row = DB::count("item", CGlobal::$item_condition); if (CGlobal::$allCategories[CGlobal::$curCategory]['parent_id'] && isset(CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']])) { $ebname = CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']]['ebname'] . '-' . CGlobal::$allCategories[CGlobal::$curCategory]['ebname']; } else { $ebname = CGlobal::$allCategories[CGlobal::$curCategory]['ebname']; } ####################################################################################### #Paging $url_new = "?page=list_detail&category_id=" . CGlobal::$curCategory . "&ebname=" . $ebname; $url_addend = ""; $filter_get = Url::get('filter'); $min = Url::get('min'); $max = Url::get('max'); $order = Url::get('order'); if ($filter_get) { foreach ($filter_get as $get_gid => $get_fid) { $url_addend .= ($url_addend != '' ? '&' : '?') . "filter[{$get_gid}]={$get_fid}"; } } if ($min) { $url_addend .= ($url_addend != '' ? '&' : '?') . "min={$min}"; } if ($max) { $url_addend .= ($url_addend != '' ? '&' : '?') . "max={$max}"; } if ($order) { $url_addend .= ($url_addend != '' ? '&' : '?') . "order={$order}"; } $limit = ''; $paging = AZPagging::paging_list($limit, $total_row, $item_per_page, 10, 'page_no', $url_new, TRUE, 'Sản phẩm', 'Trang', $url_addend); //$paging = AZPagging::paging_list($limit,$item_per_page,'page_no',$url_new); $sql .= $limit; #Paging ####################################################################################### $items = array(); $re = DB::query($sql); if ($re) { while ($item = mysql_fetch_assoc($re)) { $items[$item['id']] = $this->processItem($item, $admin_item); } } $display->add('admin_item', $admin_item); $display->add('page', $page_no); $display->add('items', $items); $display->add('paging', $paging); $display->output("ListItem"); }
function draw() { global $display; //$this->beginForm(false,'post',false,Url::build_current()); $this->beginForm(); $name = trim(Url::get('name')); $order_by = Url::get('order_by', 'id'); $order_dir = Url::get('order_dir', 'DESC'); $cond = ' 1 '; if ($name != '') { $cond .= ' AND name LIKE "%' . $name . '%"'; } $item_per_page = 50; $total_row = DB::fetch('SELECT count(*) AS total_row FROM `module` WHERE ' . $cond . ' LIMIT 0,1', 'total_row', 0); $items = array(); $paging = ''; if ($total_row) { $limit = ''; $paging = AZPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $sql = 'SELECT id ,name FROM `module` WHERE ' . $cond . ' ORDER BY ' . $order_by . ' ' . $order_dir . ' ' . $limit; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { if (Url::check('page_id')) { $row['onclick'] = ' onclick="location=\'' . Url::build('edit_page', array('module_id' => $row['id'], 'id' => (int) Url::get('page_id', 0), 'region', 'after', 'replace', 'href')) . '\';" style="cursor:pointer;" title="Click vào đây để cắm Module vào Page"'; } else { $row['onclick'] = ''; } $re2 = DB::query('SELECT page.id,page.name FROM block INNER JOIN page ON page.id=block.page_id WHERE module_id="' . $row['id'] . '"'); if ($re2) { while ($page = mysql_fetch_assoc($re2)) { $row['pages'][$page['id']] = $page; } } else { $row['pages'] = array(); } $items[$row['id']] = $row; } } } if ($order_dir == 'ASC') { $order_dir = 'DESC'; } else { $order_dir = 'ASC'; } $href_id = Url::build_current(array('order_by' => 'id', 'order_dir' => $order_dir)); $href_name = Url::build_current(array('order_by' => 'name', 'order_dir' => $order_dir)); $img_id = ''; $img_name = ''; if ($order_by == 'id') { $img_id = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($order_by == 'name') { $img_name = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } $display->add('img_id', $img_id); $display->add('img_name', $img_name); $display->add('href_id', $href_id); $display->add('href_name', $href_name); $display->add('name', $name); $display->add('paging', $paging); $display->add('items', $items); $display->add('hover', AZLib::mouse_hover('#E2F1DF', true)); $display->output('list'); $this->endForm(); }
function draw() { $this->beginForm(); global $display; $display->add('created_time_from', Url::get('created_time_from')); $display->add('created_time_to', Url::get('created_time_to')); $display->add('sender_user_name', Url::get('sender_user_name')); $display->add('processed', Url::get('processed')); //search theo ngay thang nam $created_time_from = 0; $created_time_to = 0; if (Url::get('created_time_from')) { $date_arr = explode('-', Url::get('created_time_from')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if (Url::get('created_time_to')) { $date_arr = explode('-', Url::get('created_time_to')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } $search_value = ' 1 '; if ($created_time_from) { $search_value .= ' AND time_post >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND time_post <= ' . $created_time_to; } // search ô textbox if (Url::get('sender_user_name') != '') { $search_value .= ' AND b.user_name like "%' . Url::get('sender_user_name') . '%" '; } if (Url::get('processed') == 1) { $search_value .= ' AND b.status = 0'; } $item_per_page = 50; $sql_count = 'SELECT COUNT(*) AS total_item FROM `bad_content` AS b WHERE b.type = 1 AND ' . $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, 'Phản hồi', 'Trang'); $sql = 'SELECT i.name,i.transaction_type,i.category_id, b.id, b.admin_name, b.status, b.type,b.id_item, b.reason,b.user_id,b.user_name, b.note, b.time_post FROM `bad_content` b LEFT JOIN item i ON i.id = b.id_item WHERE b.type = 1 AND ' . $search_value . ' ORDER BY b.status, b.time_post DESC, b.type ASC ' . $limit; $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { $row['content'] = $row['name']; $row['time_post'] = date('d/m/y H:i', $row['time_post']); $row['content_tooltip'] = AZLib::remove_4_js(AZLib::filter_title($row['content'])); $row['content'] = AZLib::word_limit($row['content'], 12, '...'); $row['reason_tooltip'] = AZLib::remove_4_js(AZLib::filter_title($row['reason'])); $row['reason'] = AZLib::word_limit($row['reason'], 12, '...'); $row['note_tooltip'] = AZLib::remove_4_js(AZLib::filter_title($row['note'])); $row['note'] = AZLib::word_limit($row['note'], 12, '...'); $row['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $row['id_item'] . '&ebname=' . AZLib::safe_title($row['name'])); $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id'), 'cmd=delete&id=' . $row['id']); $items[$row['id']] = $row; } } } else { $paging = ''; } $display->add('items', $items); $display->add('paging', $paging); $display->output('list'); $this->endForm(); }
function draw() { global $display; AZLib::getNewsCats(); $display->add('url_add', Url::build_current(array('cmd' => 'add'))); $display->add('msg', $this->showFormErrorMessages(1)); $news_catid = Url::get('news_catid', 0); $status = Url::get('status', 3); $date_begin = Url::get('date_begin'); $date_end = Url::get('date_end'); $keyword = Url::get('searchtext'); $hot = Url::get('hot', 1); for ($i = 1; $i <= 3; $i++) { $display->add('selected_' . $i, ''); } $display->add('selected_' . Url::get('status', 3), 'selected'); for ($i = 1; $i <= 2; $i++) { $display->add('tinnhanh_' . $i, ''); } $display->add('tinnhanh_' . Url::get('tinnhanh', 2), 'selected'); $condition = ' 1 '; if ($news_catid) { $condition .= " AND news_catid ={$news_catid} "; } if ($keyword != '') { $condition .= " AND ((title like '%{$keyword}%') OR (brief like '%{$keyword}%')) "; } $created_time_from = 0; $created_time_to = 0; if ($date_begin) { $date_arr = explode("-", $date_begin); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if ($date_end) { $date_arr = explode("-", $date_end); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if ($created_time_from) { $condition .= ' AND time_created >=' . $created_time_from; } if ($date_end) { $condition .= " AND time_created <={$created_time_to}"; } if ($status != 3) { $condition .= ' and status=' . $status; } if ($hot == 2) { $condition .= ' and hot=' . $hot; } $cat_arr = array(0 => "--Danh mục tin--"); if (CGlobal::$allNewsCategories) { foreach (CGlobal::$allNewsCategories as $news_cat) { $cat_arr[$news_cat['id']] = "[{$news_cat['id']}] " . $news_cat['name'] . ($news_cat['public'] == 0 ? ' (Đã ẩn)' : ''); } } //$news_catid $display->add('news_cat_option', AZLib::getOption($cat_arr, $news_catid)); $display->add('hot_option', AZLib::getOption(array('1' => "Tất cả", 2 => "Tin Hot"), $hot)); $display->add('status_option', AZLib::getOption(array(3 => "Tất cả", 1 => "Hiện", 2 => "Ẩn"), $status)); $display->add('keyword', $keyword); $display->add('date_begin', $date_begin); $display->add('date_end', $date_end); $totalRows = DB::count("news", $condition); $limit = ''; $pagging = AZPagging::pagingSE($limit, $totalRows, 20, 10, 'page_no', "tin"); //$pagging = AZPagging::paging_list($limit,20,'page_no'); $items = array(); $re = DB::query('SELECT * FROM news WHERE ' . $condition . " ORDER BY id DESC " . $limit, __LINE__ . __FILE__, false, false, false, true); if ($re) { while ($item = mysql_fetch_assoc($re)) { $item['admin_link'] = News::admin_link($item); if ($item['image']) { $item['image'] = AZLib::getImageThumb($item['image'], 150, 0, 0, $item['img_server']); } $item['cat'] = "[{$item['news_catid']}] " . @CGlobal::$allNewsCategories[$item['news_catid']]['name']; $item['time_created'] = date('d/m/Y', $item['time_created']); $item['brief'] = stripslashes($item['brief']); $item['title'] = stripslashes($item['title']); $item['url'] = Url::build('news_detail', array('news_catid' => $item['news_catid'], 'news_id' => $item['id'])); $items[$item['id']] = $item; } } $display->add('items', $items); $display->add('pagging', $pagging); $this->beginForm(); $display->output("NewsAdmin"); $this->endForm(); }
function draw() { global $display; if ($this->search_catid) { $keywords = AZLib::getParam('keywords'); if ($keywords != '') { global $display; $page_no = (int) Url::get('page_no', 1); if ($page_no <= 0) { $page_no = 1; } $item_per_page = 30; $sql = 'SELECT * FROM item WHERE '; $where = ''; $curMainCat = CGlobal::$curMainCat; $curLevel2Cat = CGlobal::$curLevel2Cat; $sql .= CGlobal::$item_condition . " ORDER BY item_order ASC"; $total_row = DB::count("item", CGlobal::$item_condition); if (CGlobal::$allCategories[$this->search_catid]['parent_id'] && isset(CGlobal::$allCategories[CGlobal::$allCategories[$this->search_catid]['parent_id']])) { $ebname = CGlobal::$allCategories[CGlobal::$allCategories[$this->search_catid]['parent_id']]['ebname'] . '-' . CGlobal::$allCategories[$this->search_catid]['ebname']; } else { $ebname = CGlobal::$allCategories[$this->search_catid]['ebname']; } ####################################################################################### #Paging $filter_get = Url::get('filter'); $min = Url::get('min'); $max = Url::get('max'); $order = Url::get('order'); $paging = AZPagging::paging_list($limit, $total_row, $item_per_page, 10, 'page_no', '', true, 'Sản phẩm', 'Trang'); $sql .= $limit; #Paging ####################################################################################### $items = array(); $re = DB::query($sql); if ($re) { while ($item = mysql_fetch_assoc($re)) { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['href'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } else { $item['href'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } $item['modify_time'] = date('H:i | d.m.y', $item['modify_time']); $item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']); $item['price_out'] = AZLib::convertCurrency($item['price_out'], $item['currency_id']); $item['currency_id'] = 1; $item['price_num'] = (int) $item['price']; if ($item['price']) { $item['price'] = number_format($item['price'], 0, ',', '.'); } else { $item['price'] = ''; } $item['price_title'] = 'Giá bán'; if ($item['price_out'] > 0) { $item['price_out'] = number_format($item['price_out'], 0, ',', '.') . ($item['currency_id'] == ' ' ? ' ' . CGlobal::$currency[$item['currency_id']] : ''); } else { $item['price_out'] = '0'; } $item['name'] = AZLib::filter_title($item['name']); if ($item['img_url']) { $item['img_thumb_wl'] = AZLib::getImageThumb($item['img_url'], 180, 0, 1, $item['img_server']); } else { $item['img_url'] = ''; } if (!CGlobal::$curLevel2Cat) { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['cat_name'] = CGlobal::$allCategories[$item['category_id']]['name']; } else { $item['cat_name'] = "ID: {$item['category_id']}"; } } $items[$item['id']] = $item; } } $display->add('page', $page_no); $display->add('items', $items); $display->add('paging', $paging); $display->output("sphinx_search"); } else { echo '<div style="padding:20px;color:#f00;font-size:18px;border:1px solid #ccc" align="center"> Bạn chưa nhập vào từ khóa cần tìm kiếm! </div>'; } } else { echo '<div style="padding:20px;color:#f00;font-size:18px;border:1px solid #ccc" align="center"> Bạn chưa chọn danh mục tìm kiếm! </div>'; } }
function draw() { AZLib::getCats(); global $display; $this->beginForm(); $page_arr = array(); $page_arr['home'] = 'Trang chủ'; $page_arr['list_detail'] = 'Danh sách sản phẩm'; $page_arr['profile'] = 'Profile thành viên'; $page_arr['sign_in'] = 'Đăng nhập'; $page_arr['item_detail'] = 'Chi tiết sản phẩm'; $page_arr['online'] = 'Thành viên online'; $page_arr['message'] = 'Tin nhắn cá nhân'; $page_arr['post_item'] = 'Đăng sản phẩm'; $page_arr['personal'] = 'Trang cá nhân'; $page_arr['edit_page'] = 'Cấu hình page'; $page_arr['admin'] = 'Trang quản trị'; $page_arr['user'] = '******'; $page_arr['manage_item'] = 'Quản trị Tin'; $page_arr['manage_image'] = 'Quản trị Ảnh'; $page_arr['manage_comment'] = 'Quản Comment'; $page_arr['manage_comment_user'] = '******'; $page_arr['manage_bad_content'] = 'Quản trị tin xấu'; $page_arr['manage_badword'] = 'Quản trị Từ xấu'; $page_arr['partner'] = 'Quản trị Đối tác, ADV'; $page_arr['send_multi'] = 'Gửi tin nhắn cho tất cả Thành viên'; $page_arr['page'] = 'Quản trị Page'; $page_arr['module'] = 'Quản trị Modules'; $page_arr['shop'] = 'Trang cá nhân'; $page_arr['sph_search '] = 'Tìm kiếm'; $not_permit_view = array('edit_page', 'admin', 'user', 'manage_item', 'manage_comment', 'manage_image', 'manage_comment', 'manage_comment_user', 'manage_bad_content', 'manage_badword', 'partner', 'send_multi', 'page', 'module'); $cond = ''; $item_type = Url::get('item_type'); $item_id = Url::get('item_id'); $o_name = Url::get('o_name'); $o_id = (int) Url::get('o_id'); $where = 'site'; if ($item_type && $item_id && in_array($item_type, array(1, 2, 3))) { $cond = ' AND page="ItemDetail" AND item_id=' . $item_id . ' AND item_type=' . $item_type; if ($item_type == 3) { $where = '<font color=red>Sản phẩm đấu giá</font>'; } elseif ($item_type == 1) { $where = '<font color=red>Giao dịch mua</font>'; } else { $where = '<font color=red>Sản phẩm bán</font>'; } } if ($o_name != '') { $str_search = str_replace("'", '"', $o_name); $str_search = str_replace("'", '"', $str_search); $str_search = str_replace(""", '"', $str_search); $cond .= ' AND session_referer LIKE "%' . $str_search . '%"'; } if ($o_id) { $cond .= ' AND user_id =' . $o_id; } else { $o_id = ''; } $open_id_login = (int) Url::get('open_id_login', 0); if ($open_id_login) { $display->add('open_id_login_check', 'checked="checked"'); $cond .= " AND login_type = 1 "; } else { $display->add('open_id_login_check', ''); } $display->add('o_name', $o_name); $display->add('o_id', $o_id); $total_ss = DB::fetch('SELECT count(*) as total_ss FROM ' . _SESS_TABLE, 'total_ss', 0); $display->add('total_ss', $total_ss); $total = DB::fetch('SELECT count(*) as total FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900) . ' ' . $cond); if ($total) { $total = (int) $total['total']; } else { $total = 0; } $sql = 'SELECT count(total) as total FROM ( SELECT count(user_id) as total FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900) . ' AND user_id !=0 ' . $cond . ' GROUP BY user_id) as t'; $total_mem = DB::fetch($sql, 'total'); $paging = AZPagging::paging($limit, $total_mem, 25, 10, 'page_view'); DB::query('SELECT session_id, session_expires as time, session_ip as ip, user_id, user_name, session_referer, page, category_id, item_type, item_id, open_id FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900) . ' AND user_id>0 ' . $cond . ' GROUP BY user_id ORDER BY time DESC' . $limit); $user_onlines = array(); $i = 1; while ($item = DB::fetch_row()) { //$item['viewing_time'] = AZLib::duration(TIME_NOW-$item['time']); if (date('d', TIME_NOW) != date('d', $item['time'])) { $item['viewing_time'] = date('H:i d/m/y', $item['time']); } else { $item['viewing_time'] = date('H:i', $item['time']); } $item['user_name'] = stripslashes($item['user_name']); $item['title'] = 'Thành viên'; $item['link'] = WEB_DIR . $item['user_name']; if (isset($page_arr[$item['page']]) && (User::is_admin() || !in_array($item['page'], $not_permit_view))) { $detail = ''; if ($item['page'] == 'list_detail' && isset(CGlobal::$allCategories[$item['category_id']])) { $detail = ' - ' . stripslashes(CGlobal::$allCategories[$item['category_id']]['name']); $parent_id = CGlobal::$allCategories[$item['category_id']]['parent_id']; if ($parent_id && isset(CGlobal::$allCategories[$parent_id])) { $detail = ' - ' . stripslashes(CGlobal::$allCategories[$parent_id]['name']) . $detail; } } $item['viewing_page_name'] = $page_arr[$item['page']] . $detail; } elseif ($item['page'] && (User::is_admin() || !in_array($item['page'], $not_permit_view))) { $item['viewing_page_name'] = $item['page']; } else { $item['viewing_page_name'] = 'enbac.com'; } if (!$item['session_referer'] || !User::is_admin() && in_array($item['page'], $not_permit_view)) { $item['viewing_page_url'] = WEB_ROOT; } else { $item['viewing_page_url'] = WEB_ROOT . stripslashes($item['session_referer']); } if (User::is_admin() && $item['ip']) { $ip_arr = explode('::', $item['ip']); $item['ip'] = 'S_IP: <b>' . $ip_arr[0] . '</b>'; $item['ip'] .= ' - C_IP: <b>' . $ip_arr[1] . '</b>'; } else { $item['ip'] = ''; } if (User::is_admin()) { $item['del_s'] = '<a href="' . Url::build_current(array('kick_out' => $item['session_id'])) . '">Kick Out</a>'; } else { $item['del_s'] = ''; } $user_onlines[$i++] = $item; } $display->add('where', $where); $display->add('total', $total); $display->add('total_mem', $total_mem); $display->add('user_onlines', $user_onlines); $display->add('paging', $paging); $total_guest = 0; $paging_guest = ''; $guest_onlines = array(); if (User::is_admin()) { $sql = 'SELECT count(*) as total FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900) . ' AND user_id=0 ' . $cond . ' '; $total_guest = DB::fetch($sql, 'total'); $paging_guest = AZPagging::paging($limit, $total_guest, 25, 10, 'guest_view'); DB::query('SELECT session_id, session_expires as time, session_ip as ip, session_referer, page, category_id, item_type, item_id FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900) . ' AND user_id=0 ' . $cond . ' ORDER BY time DESC' . $limit); $i = 1; while ($item = DB::fetch_row()) { //$item['viewing_time'] = AZLib::duration(TIME_NOW-$item['time']); if (date('d', TIME_NOW) != date('d', $item['time'])) { $item['viewing_time'] = date('H:i d/m/y', $item['time']); } else { $item['viewing_time'] = date('H:i', $item['time']); } $item['user_name'] = '<font color="green">guest</font>'; $item['viewing_page_url'] = WEB_ROOT; $item['link'] = WEB_ROOT; if (isset($page_arr[$item['page']]) && (User::is_admin() || !in_array($item['page'], $not_permit_view))) { $detail = ''; if ($item['page'] == 'list_detail' && isset(CGlobal::$allCategories[$item['category_id']])) { $detail = ' - ' . stripslashes(CGlobal::$allCategories[$item['category_id']]['name']); $parent_id = CGlobal::$allCategories[$item['category_id']]['parent_id']; if ($parent_id && isset(CGlobal::$allCategories[$parent_id])) { $detail = ' - ' . stripslashes(CGlobal::$allCategories[$parent_id]['name']) . $detail; } } $item['viewing_page_name'] = $page_arr[$item['page']] . $detail; } elseif ($item['page'] && (User::is_admin() || !in_array($item['page'], $not_permit_view))) { $item['viewing_page_name'] = $item['page']; } else { $item['viewing_page_name'] = 'enbac.com'; } if (!$item['session_referer'] || !User::is_admin() && in_array($item['page'], $not_permit_view)) { $item['viewing_page_url'] = WEB_ROOT; } else { $item['viewing_page_url'] = WEB_ROOT . stripslashes($item['session_referer']); } if (User::is_admin() && $item['ip']) { $ip_arr = explode('::', $item['ip']); $item['ip'] = 'S_IP: <b>' . $ip_arr[0] . '</b>'; $item['ip'] .= ' - C_IP: <b>' . $ip_arr[1] . '</b>'; } else { $item['ip'] = ''; } if (User::is_admin()) { $item['del_s'] = '<a href="' . Url::build_current(array('kick_out' => $item['session_id'])) . '">Kick Out</a>'; } else { $item['del_s'] = ''; } $guest_onlines[$i++] = $item; } } $display->add('total_guest', $total_guest); $display->add('guest_onlines', $guest_onlines); $display->add('paging_guest', $paging_guest); $display->output('OnlineUser'); $this->endForm(); }
function draw() { global $display; $items = array(); $bcats = array(); $filter_groups = array(); if (Build::$bcatid) { $filter_ids = trim(DB::fetch("SELECT GROUP_CONCAT(filter_ids SEPARATOR ',') AS filter_ids FROM (SELECT filter_ids FROM item WHERE " . CGlobal::$item_condition . " AND filter_ids != '') AS filter", 'filter_ids', '')); $pf_array = array(); if ($filter_ids != '') { $f_array = array_count_values(explode(',', $filter_ids)); foreach ($f_array as $fid => $count) { if (isset(CGlobal::$allFilters[$fid])) { $fgid = CGlobal::$allFilters[$fid]['fgid']; if (isset(CGlobal::$all_gfilters[$fgid])) { $pf_array[$fgid][$fid] = $count; } } } } //Tạo Menu Filter if ($this->filter_groups) { foreach ($this->filter_groups as $fgid => $gfilter) { if (isset($pf_array[$fgid])) { if ($gfilter['filters']) { $group_filter = array(); foreach ($gfilter['filters'] as $fid => $filter) { if (isset($pf_array[$fgid][$fid])) { if (!$group_filter) { $group_filter = array('name' => CGlobal::$all_gfilters[$fgid]['name'], 'filters' => array()); } $link = AZRewrite::formatUrl(Url::build_all(array('min', 'max', 'filter', 'page_no'))); if ($this->filter_get) { foreach ($this->filter_get as $get_gid => $get_fid) { if ($get_gid != $fgid) { $link .= "&filter[{$get_gid}]={$get_fid}"; } } } if (isset($this->filter_get[$fgid]) && $this->filter_get[$fgid] == $filter['id']) { if ($this->min) { $link .= "&min=" . $this->min; } if ($this->max) { $link .= "&max=" . $this->max; } $group_filter['filters'] = array($fid => array('link' => $link, 'name' => $filter['name'], 'count' => $pf_array[$fgid][$fid], 'remove' => 1)); break; } else { $link .= "&filter[{$fgid}]={$filter['id']}"; //$link = str_replace(array('?filter=&','?filter=','&filter='),array('?','',''),$link); if ($this->min) { $link .= "&min=" . $this->min; } if ($this->max) { $link .= "&max=" . $this->max; } } $group_filter['filters'][$fid] = array('link' => $link, 'name' => $filter['name'], 'count' => $pf_array[$fgid][$fid]); } } if ($group_filter) { $filter_groups[$fgid] = $group_filter; } } } } } $display->add('url_filter', Url::build_current(array('mode', 'bcatid' => Build::$bcatid))); $display->add('cat_name', CGlobal::$allCategories[Build::$bcatid]['name']); if (isset(Build::$cats[Build::$bcatid]['next_id']) && Build::$cats[Build::$bcatid]['next_id']) { $display->add('next_url', Url::build_current(array('mode', 'bcatid' => Build::$cats[Build::$bcatid]['next_id']))); } else { $display->add('next_url', Url::build_current()); } $display->add('recomend', str_replace(chr(13) . chr(10), "<br />", CGlobal::$allCategories[Build::$bcatid]['recomend'])); $display->add('filter_groups', $filter_groups); $display->add('filter_price', $this->filter_price); $sql = 'SELECT * FROM item WHERE '; $where = ''; $sql .= CGlobal::$item_condition . " ORDER BY price ASC"; $total_row = DB::count("item", CGlobal::$item_condition); ####################################################################################### #Paging $filter_get = Url::get('filter'); $min = Url::get('min'); $max = Url::get('max'); $order = Url::get('order'); $paging = AZPagging::paging_list($limit, $total_row, 10, 10, 'page_no', '', true, 'Linh kiện', 'Trang'); $sql .= $limit; #Paging ####################################################################################### $re = DB::query($sql); if ($re) { while ($item = mysql_fetch_assoc($re)) { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['href'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } else { $item['href'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } $item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']); if ($item['price']) { $item['price'] = number_format($item['price'], 0, ',', '.') . " VNĐ"; } else { $item['price'] = 'Liên hệ'; } if ($item['list_brief'] == '') { $item['list_brief'] = $item['brief']; } $item['list_brief'] = AZLib::remove_4_js(AZLib::plainText(AZLib::parseBBCode(html_entity_decode($item['list_brief'], ENT_QUOTES, "UTF-8")))); $item['list_brief'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $item['list_brief']); $item['list_brief'] = str_replace(array("'", "\""), array("", " "), $item['list_brief']); $item['list_brief'] = AZLib::word_limit($item['list_brief'], 50, ''); $item['select'] = Url::build_current(array('bcatid' => $item['category_id'], 'mode', 'item_id' => $item['id'])); $items[$item['id']] = $item; } } $display->add('items', $items); $display->add('paging', $paging); } $display->add('bcats', Build::$cats); if (Build::$price) { $display->add('total_price', number_format(Build::$price, 0, ',', '.') . " VNĐ"); } $display->add('bitems', Build::$items); $display->add('bcatid', Build::$bcatid); $display->add('cur_url', $_SERVER['REQUEST_URI']); $display->add("print_link", Url::open_popup(Url::build('build_print'), 1000, 800, false, false, false, false, false, 1, 1)); $build_catids = @CGlobal::$configs['BuildCatIDs']['conf_val']; $display->add('build_catids', $build_catids); $display->add('is_admin', User::is_admin()); $display->add('begin_form', $this->beginForm(false, 'post', false, false, 1)); $display->add('end_form', $this->endForm(1)); $display->output('Build'); }
function get_all_comment() { global $display; $winner = array(); global $user_id_arr, $stt, $item_per_page; $stt = 0; $is_admin_mod = array(); $user_arr = array(); $user_id_arr = array(); $items = array(); $limit = ''; $divID = 'comment_list'; $cmd = 'pagging_comment'; $url_path = WEB_DIR . "ajax.php?act=comment&code=display_feedback&show_all=1&id=" . Item::$id . "&cmd=" . $cmd; $item_per_page = 25; if (Url::get('show_all') || Url::get('cmd') == $cmd) { $display->add('show_all', true); } else { $display->add('show_all', false); } $pagging = AZPagging::fb_pagging($limit, $item_per_page, true, 'fb_page', $url_path, $divID); $sql = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id, have_child,receiver_user_id FROM comment WHERE item_id=" . Item::$item['id'] . " AND parent_id = 0 ORDER BY order_time DESC {$limit}"; $items_all = $this->get_comment($sql); if ($items_all) { $items = $items_all['item']; if ($items_all['id_parent']) { $sql_sub = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id,parent_id,receiver_user_id FROM comment WHERE parent_id IN({$items_all['id_parent']}) AND display =1 ORDER BY order_time DESC"; $subComment_all = $this->get_comment($sql_sub, 1); if ($subComment_all) { $sub_comments = $subComment_all['item']; foreach ($sub_comments as $id => $subs) { if (isset($items[$id])) { $items[$id]['sub_comment'] = $subs; } } } } unset($items_all); unset($subComment_all); } if ($stt <= $item_per_page) { $pagging = AZPagging::fb_pagging($limit, $item_per_page, false, 'fb_page', $url_path, $divID); $display->add('show_fb_page', false); } else { $display->add('show_fb_page', true); } if ($user_id_arr) { $uid = implode(',', $user_id_arr); if ($uid != '') { $re = DB::query("SELECT id, avatar_url, gids, block_time, img_server FROM user WHERE id IN({$uid})"); if ($re) { while ($user = mysql_fetch_assoc($re)) { $user_arr[$user['id']] = $user; } } } } if ($items && $user_arr) { foreach ($items as &$item) { //add by nhatvt $item['content'] = $this->process_description($item['content']); // echo $item['content'];exit; //end if (isset($item['sub_comment']) && $item['sub_comment']) { foreach ($item['sub_comment'] as &$sub_item) { if ($sub_item['sender_user_id']) { if (isset($user_arr[$sub_item['sender_user_id']])) { $sub_item['avatar_url'] = $user_arr[$sub_item['sender_user_id']]['avatar_url']; $sub_item['block_time'] = $user_arr[$sub_item['sender_user_id']]['block_time']; $sub_item['gids'] = $user_arr[$sub_item['sender_user_id']]['gids']; $sub_item['img_server'] = $user_arr[$sub_item['sender_user_id']]['img_server']; } if ($sub_item['avatar_url']) { $sub_item['sender_avatar_url'] = AZLib::getImageThumb($sub_item['avatar_url'], 60, 0, 1, $sub_item['img_server']); if ($sub_item['parent_id'] > 0) { $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="25" class="lazyload"/></a>'; } else { $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="50" class="lazyload"/></a>'; } } else { $sub_item['sender_avatar_url'] = ''; $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="style/images/50x50.gif" width="25" height="25" class="lazyload"/></a>'; } if ($sub_item['block_time'] > TIME_NOW) { $sub_item['is_block'] = 1; } else { $sub_item['is_block'] = 0; } $sub_item['htmlContent'] = $html_content; //set quyen quan tri if ($sub_item['gids']) { $is_admin_mod = CGlobal::$group[User::check_admin($sub_item['gids'])]; } else { $is_admin_mod = array(); } $sub_item['is_admin_mod'] = $is_admin_mod; } } } if ($item['sender_user_id']) { if (isset($user_arr[$item['sender_user_id']])) { $item['avatar_url'] = $user_arr[$item['sender_user_id']]['avatar_url']; $item['block_time'] = $user_arr[$item['sender_user_id']]['block_time']; $item['gids'] = $user_arr[$item['sender_user_id']]['gids']; $item['img_server'] = $user_arr[$item['sender_user_id']]['img_server']; } if ($item['avatar_url']) { $item['sender_avatar_url'] = AZLib::getImageThumb($item['avatar_url'], 60, 0, 1, $item['img_server']); $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="50"/></a>'; } else { $item['sender_avatar_url'] = ''; $html_content = '<a href="' . $item['sender_link'] . '"><img src="style/images/50x50.gif" width="50" height="50" /></a>'; } $item['htmlContent'] = $html_content; if ($item['block_time'] > TIME_NOW) { $item['is_block'] = 1; } else { $item['is_block'] = 0; } //set quyen quan tri if ($item['gids']) { $is_admin_mod = CGlobal::$group[User::check_admin($item['gids'])]; } else { $is_admin_mod = array(); } $item['is_admin_mod'] = $is_admin_mod; } } } if (User::is_login() && Item::$item['user_id'] == User::id()) { $user = User::$current->data; } else { if (isset(Item::$item['user_id'])) { $user = User::getUser(Item::$item['user_id']); } if (!$user) { $user = array('id' => 0, 'user_name' => '', 'create_time' => '', 'blast' => '', 'email' => '', 'show_email' => '', 'skype_id' => '', 'yahoo_id' => ''); } } if (User::is_login()) { if (User::$current->data['mobile_phone'] != '') { $display->add('user_phone', true); $user_phone = User::$current->data['mobile_phone']; } elseif (User::$current->data['home_phone'] != '') { $display->add('user_phone', true); $user_phone = User::$current->data['home_phone']; } else { $display->add('user_phone', false); $user_phone = ''; } $display->add('cur_user_name', User::$current->data['user_name']); $display->add('cur_created_time', User::$current->data['create_time']); $cur_user_name = User::$current->data['user_name']; $cur_created_time = User::$current->data['create_time']; if (User::$current->data['avatar_url'] == '') { $cur_avatar_url = 'style/images/50x50.gif'; } else { $cur_avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 60, 0, 1, User::$current->data['img_server']); } } else { $cur_user_name = ''; $cur_created_time = ''; $user_phone = ''; $cur_avatar_url = 'style/images/50x50.gif'; $display->add('cur_user_name', ''); $display->add('cur_created_time', ''); $display->add('check_user_name', ''); $display->add('user_phone', false); } $guest_name = 'Số điện thoại'; $guest_email = 'Email'; if (isset($_COOKIE['guest_name'])) { if ($_COOKIE['guest_name'] == 'undefined' || $_COOKIE['guest_email'] == 'undefined') { $guest_name = 'Số điện thoại'; $guest_email = 'Email'; } else { $guest_name = $_COOKIE['guest_name']; $guest_email = $_COOKIE['guest_email']; } } $display->add('cur_user_name', $cur_user_name); $display->add('guest_name', $guest_name); $display->add('guest_email', $guest_email); $display->add('check_user_name', $user['user_name']); $display->add('cur_id', (int) User::id()); //$display->add('msg',$this->showFormErrorMessages(1)); $display->add('pagging', $pagging); $display->add('item_comments', $items); $display->add('item_id', Item::$item['id']); $display->add('category_id', Item::$item['category_id']); $display->add('item_name', Item::$item['name']); //rewrite URL $display->add('name_url', AZLib::safe_title(Item::$item['name'])); //End rewrite URL Item::$item['currency_id'] = 1; $display->add('currency_id', CGlobal::$currency[Item::$item['currency_id']]); $display->add('total_feedback', Item::$item['reply_count']); if (strtolower(Url::get('page')) == 'allfeedback' || Url::get('cmd') == $cmd) { echo '<div id="totalReplyCount" style="display:none;">' . Item::$item['reply_count'] . '</div>'; } //echo AZLib::parseBBCode($display->output('AllFeedback',true)); $display->output('AllFeedbackList', false, 'AllFeedback'); }
function draw() { global $display; $this->beginForm(false, "POST", false, Url::build_current()); $key_word = Url::get('key_word'); $condition = " status=1"; $display->add('key_word', $key_word); if ($key_word) { $key_word_s = ''; $arr = explode(' ', $key_word); if ($arr) { foreach ($arr as $key) { $key = trim($key); if ($key != '') { $key_word_s .= ($key_word_s == '' ? '+' : ' +') . "{$key}"; } } } if ($key_word_s != '') { $condition .= " AND MATCH(title, des) AGAINST ('{$key_word_s}' IN BOOLEAN MODE)"; } //$condition .= ' AND (title LIKE "%'.$key_word.'%" OR des LIKE "%'.$key_word.'%")'; } $total_item = DB::count('document', $condition); $limit = ''; $paging = AZPagging::paging_list($limit, $total_item, 10, 10, 'page_no', '', true, 'Tài liệu', 'Trang'); $display->add('paging', $paging); $condition = 'WHERE' . $condition; $documents = array(); $sql = 'SELECT * FROM document ' . $condition . ' ORDER BY id DESC ' . $limit; $re = DB::query($sql); if ($re) { $i = 1; while ($row = mysql_fetch_assoc($re)) { $row['title'] = stripslashes($row['title']); $row['des'] = AZLib::remove_4_js(AZLib::plainText(html_entity_decode($row['des'], ENT_QUOTES, "UTF-8"))); $row['des'] = str_replace(array("'", "\""), array("", " "), $row['des']); $row['des'] = AZLib::word_limit($row['des'], 200, ''); if (++$i % 2) { $row['bgcolor'] = "#FFFFFF"; } else { $row['bgcolor'] = "#D9D9D9"; } $row['time_m'] = $row['time_m'] ? date("d/m/Y", $row['time_m']) : ''; if (User::is_admin()) { $row['change'] = AZLib::button(Url::build_current(array('cmd' => 'change', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/unexam.gif', 'Disable'); $row['edit'] = AZLib::button(Url::build('document', array('cmd' => 'edit', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/edit.gif', 'Sửa tài liệu'); $row['delete'] = AZLib::buttonDel(Url::build_current(array('cmd' => 'delete', 'id' => $row['id'], "href" => urlencode('?' . $_SERVER['QUERY_STRING']))), 'style/images/delete.gif', 'Sửa tài liệu'); } if ($row['url']) { $row['document_detail'] = $row['url']; } else { $row['document_detail'] = WEB_DIR . "download-{$row['id']}/" . AZLib::safe_title($row['title']) . ".html"; } $documents[$row['id']] = $row; } } $display->add('documents', $documents); if (User::is_admin()) { $display->add("is_admin", 1); } $display->output('DocumentList'); $this->endForm(); }
function draw() { $this->beginForm(); global $display; $search_value = ''; $display->add('up_checked', 'checked="checked"'); if (Url::get('root_img')) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' root_id=0 '; $display->add('root_img_checked', 'checked="checked"'); } else { //$search_value.=($search_value!=''?' AND ':' WHERE').' img.root_id>0 '; $display->add('root_img_checked', ''); } if (Url::get('no_item_img')) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' item_id=0 '; $display->add('no_item_img_checked', 'checked="checked"'); } else { //$search_value.=($search_value!=''?' AND ':' WHERE').' root_id>0 '; $display->add('no_item_img_checked', ''); } // search ô textbox if (Url::get('user_name') != '') { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' user_name LIKE "%' . Url::get('user_name') . '%" '; } //search theo ngay thang nam $created_time_from = 0; $created_time_to = 0; $current_time_from = null; $current_time_to = null; if (Url::get('created_time_from')) { $current_time_from = Url::get('created_time_from'); $date_arr = explode('-', $current_time_from); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if (Url::get('created_time_to')) { $current_time_to = Url::get('created_time_to'); $date_arr = explode('-', $current_time_to); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if ($created_time_from) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time <= ' . $created_time_to; } if ($search_value == '') { //create current date $date = Date('d-m-Y'); $current_time_from = $date; $date_arr = explode('-', $current_time_from); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } $current_time_to = $date; $date_arr = explode('-', $current_time_to); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } if ($created_time_from) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time <= ' . $created_time_to; } } $display->add('created_time_from', $current_time_from); $display->add('created_time_to', $current_time_to); $item_per_page = 120; $sql_count = 'SELECT count(*) AS total_img FROM item_image ' . $search_value; $total = DB::fetch($sql_count, 'total_img', 0); $items = array(); if ($total) { $limit = ''; $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true); $sql = 'SELECT id,img_server, img_url,item_id, title, des, time, user_name, user_id, img_server FROM `item_image`'; $sql .= $search_value . ' ORDER BY id ASC ' . $limit; $item_ids = ''; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $row['link_gallery'] = WEB_DIR . AZRewrite::formatUrl('?page=gallery&user_id=' . $row['user_id'] . '&year=' . date('Y', $row['time']) . '&month=' . (int) date('m', $row['time']) . '&day=' . (int) date('d', $row['time'])); if (date('d.m.y', $row['time']) == date('d.m.y', TIME_NOW)) { $row['time'] = date('H:i', $row['time']); } elseif (date('y', $row['time']) == date('y', TIME_NOW)) { $row['time'] = date('d/m H:i', $row['time']); } else { $row['time'] = date('d/m/y H:i', $row['time']); } //if(!eregi('/',$row['img_url'])){ // $row['link_img']='http://'.CGlobal::$img_server[$row['img_server']].'uploaded/items/'.$row['img_url']; //} //else{ $row['link_img'] = 'http://' . CGlobal::$img_server[$row['img_server']] . $row['img_url']; //} if ($row['item_id']) { $item_ids .= ($item_ids ? ',' : '') . $row['item_id']; if (isset($row['name'])) { $row['item_link'] = WEB_DIR . AZRewrite::formatUrl("?page=item_detail&id={$row['item_id']}&ebname=" . AZLib::safe_title($row['name'])); if (date('d.m.y', $row['created_time']) == date('d.m.y', TIME_NOW)) { $row['created_time'] = date('H:i', $row['created_time']); } elseif (date('y', $row['created_time']) == date('y', TIME_NOW)) { $row['created_time'] = date('d/m H:i', $row['created_time']); } else { $row['created_time'] = date('d/m/y H:i', $row['created_time']); } } else { $row['item_link'] = WEB_DIR . AZRewrite::formatUrl("?page=item_detail&id={$row['item_id']}"); $row['created_time'] = ''; } $row['title'] = stripslashes($row['title']); } else { $row['title'] = stripslashes($row['des']); $row['created_time'] = ''; $row['item_link'] = ''; } $row['image_thumb'] = AZLib::getImageThumb($row['img_url'], 110, 0, 1, $row["img_server"]); $row['image_max'] = AZLib::getImageThumbMax($row['img_url'], $row['title'], 1, $row["img_server"]); $row['images_url_root'] = 'http://' . CGlobal::$img_server[$row['img_server']]; $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id'), 'cmd=delete&id=' . $row['id']); $items[$row['id']] = $row; } if ($item_ids) { $all_items = array(); $sql = "SELECT id, name, created_time FROM item WHERE id IN({$item_ids})"; $re = DB::query($sql); if ($re) { while ($item = mysql_fetch_assoc($re)) { $all_items[$item['id']] = $item; } } foreach ($items as &$item_img) { if ($item_img['item_id'] && isset($all_items[$item_img['item_id']])) { $item_img['item_link'] = WEB_DIR . AZRewrite::formatUrl("?page=item_detail&id={$item_img['item_id']}&ebname=" . AZLib::safe_title($all_items[$item_img['item_id']]['name'])); if (date('d.m.y', $all_items[$item_img['item_id']]['created_time']) == date('d.m.y', TIME_NOW)) { $item_img['created_time'] = date('H:i', $all_items[$item_img['item_id']]['created_time']); } elseif (date('y', $all_items[$item_img['item_id']]['created_time']) == date('y', TIME_NOW)) { $item_img['created_time'] = date('d/m H:i', $all_items[$item_img['item_id']]['created_time']); } else { $item_img['created_time'] = date('d/m/y H:i', $all_items[$item_img['item_id']]['created_time']); } } else { $item_img['item_link'] = ''; $item_img['created_time'] = ''; } } } } } else { $paging = ''; } AZLib::my_setcookie("page_img_id", Url::get("page_no") != "" ? intval(Url::get("page_no")) : 1, 60 * 60 * 24 * 365 + TIME_NOW); $display->add("uri", CGlobal::$request_uri); $display->add("images_url_root", 'http://' . CGlobal::$img_server[IMAGE_SERVER_NO]); $display->add('user_name', Url::get('user_name')); $display->add('item_title', Url::get('item_title')); $display->add('items', $items); $display->add('paging', $paging); $display->output('ManageImage'); $this->endForm(); }
function draw() { global $display; $this->beginForm(false, 'post', false, Url::build_current()); $name = trim(Url::get('name')); $order_by = Url::get('order_by', 'id'); $order_dir = Url::get('order_dir', 'DESC'); $cond = ' 1 '; if ($name != '') { $cond .= ' AND name LIKE "%' . $name . '%"'; } $item_per_page = 50; $total_row = DB::fetch('SELECT count(*) AS total_row FROM `page` WHERE ' . $cond . ' LIMIT 0,1', 'total_row', 0); $items = array(); $paging = ''; if ($total_row) { $limit = ''; $paging = AZPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $sql = 'SELECT id ,name,title, description FROM `page` WHERE ' . $cond . ' ORDER BY ' . $order_by . ' ' . $order_dir . ' ' . $limit; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $row['href'] = Url::build('edit_page', array('id' => $row['id'])); $items[$row['id']] = $row; } } } if ($order_dir == 'ASC') { $order_dir = 'DESC'; } else { $order_dir = 'ASC'; } $href_id = Url::build_current(array('order_by' => 'id', 'order_dir' => $order_dir)); $href_name = Url::build_current(array('order_by' => 'name', 'order_dir' => $order_dir)); $href_des = Url::build_current(array('order_by' => 'description', 'order_dir' => $order_dir)); $href_title = Url::build_current(array('order_by' => 'title', 'order_dir' => $order_dir)); $img_id = ''; $img_name = ''; $img_title = ''; $img_des = ''; if ($order_by == 'id') { $img_id = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($order_by == 'name') { $img_name = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($order_by == 'description') { $img_des = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($order_by == 'title') { $img_title = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } $display->add('img_id', $img_id); $display->add('img_name', $img_name); $display->add('img_title', $img_title); $display->add('img_des', $img_des); $display->add('href_id', $href_id); $display->add('href_title', $href_title); $display->add('href_name', $href_name); $display->add('href_des', $href_des); $display->add('name', $name); $display->add('paging', $paging); $display->add('items', $items); $display->add('hover', AZLib::mouse_hover('#E2F1DF', true)); $display->output('list'); $this->endForm(); }
function item_same_category_form() { global $display; AZLib::getProvinces(); AZLib::getCats(); $item_id = (int) Url::get('item_id'); $sql = 'SELECT id, name, list_brief, offer, modify_time, sku, read_count, category_id, currency_id, price, price_out, img_url, img_server FROM item WHERE'; $where = " id!={$item_id}"; if (CGlobal::$curCategory) { $where .= ($where != '' ? " AND " : "") . " category_id = " . CGlobal::$curCategory; } $where .= ($where != '' ? " AND " : "") . " status=1"; if (CGlobal::$curCity) { // $where = " province_id = " . CGlobal::$curCity . ($where != '' ? " AND " : "") . $where;//ngannv comment vì k có trường province id trong bảng item } $sql .= "{$where} ORDER BY item_order ASC"; $divID = 'item_same_cat'; $code = 'item_same_cat'; $url_path = WEB_DIR . "ajax.php?act=item&code=item_same_category&category_id=" . CGlobal::$curCategory . "&item_id={$item_id}"; $limit = ''; $item_per_page = 3; $i = 1; $pagging = AZPagging::AjaxPagingNext($limit, $item_per_page, true, 'p_item_same', $url_path, $divID); $sql .= $limit; $items = array(); $re = DB::query($sql); if ($re) { while ($item = mysql_fetch_assoc($re)) { if ($i <= $item_per_page) { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['href'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } else { $item['href'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } $item['modify_time'] = date('H:i | d.m.y', $item['modify_time']); $item['price_num'] = (int) $item['price']; if ($item['price']) { $item['price'] = number_format($item['price'], 0, ',', '.'); } else { $item['price'] = ''; } $item['price_title'] = 'Giá bán'; if ($item['price_out'] > 0) { $item['price_out'] = number_format($item['price_out'], 0, ',', '.') . ($item['currency_id'] == ' ' ? ' ' . CGlobal::$currency[$item['currency_id']] : ''); } else { $item['price_out'] = '0'; } //$item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']); //$item['price_out'] = AZLib::convertCurrency($item['price_out'], $item['currency_id']); $item['name'] = AZLib::filter_title($item['name']); if ($item['img_url']) { $item['img_thumb_wl'] = AZLib::getImageThumb($item['img_url'], 180, 0, 1, $item['img_server']); } else { $item['img_url'] = ''; } if (!CGlobal::$curLevel2Cat) { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['cat_name'] = CGlobal::$allCategories[$item['category_id']]['name']; } else { $item['cat_name'] = "ID: {$item['category_id']}"; } } $items[$item['id']] = $item; /* $value['price'] = AZLib::convertCurrency($value['price'], $value['currency_id']); $value['currency_id'] = 1; if (isset(CGlobal::$allCategories[$value['category_id']])) { $value['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $value['id'] . '&ebname=' . AZLib::safe_title($value['name']) . '&nice_name=' . CGlobal::$allCategories[$value['category_id']]['nice_name']); } else { $value['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $value['id'] . '&ebname=' . AZLib::safe_title($value['name'])); } $value['item_time'] = date('h:i | d.m', $value['modify_time']); $value['price_name'] = 'Giá bán'; $value['item_type'] = 'Giao dịch bán'; $value['name'] = strip_tags(AZLib::filter_title($value['name'])); if ($value['price'] && $value['price'] > 0) { $value['price'] = number_format($value['price'], 0, ',', '.'); $value['currency_id'] = CGlobal::$currency[$value['currency_id']]; } else { $value['price'] = 'Liên hệ'; $value['currency_id'] = ''; } if ($value['img_url']) { $value['img_url'] = AZLib::getImageThumb($value['img_url'], 80, 80, 0, $value['img_server']); } else { $value['img_url'] = 'style/images/no-images-69x53.jpg'; } $items[$value['id']] = $value; */ } $i++; } } if ($i <= $item_per_page) { $pagging = AZPagging::AjaxPagingNext($limit, $item_per_page, false, 'p_item_same', $url_path, $divID); } $display->add('pagging', $pagging); $display->add('items', $items); $display->add('admin_item', User::have_permit(ADMIN_ITEM)); if ($items) { if (Url::get('code') != $code) { echo '<div id="' . $divID . '">'; } else { echo "<div>"; } $display->output('ItemSameCategory', false, 'ItemSameCategory'); echo "</div>"; } }
function draw() { global $display; $this->beginForm(false, "POST", false, Url::build_current()); //search theo ngay thang nam $display->add('created_time_from', Url::get('created_time_from')); $display->add('created_time_to', Url::get('created_time_to')); $created_time_from = 0; $created_time_to = 0; if (Url::get('created_time_from')) { $date_arr = explode('-', Url::get('created_time_from')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if (Url::get('created_time_to')) { $date_arr = explode('-', Url::get('created_time_to')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } $search_value = 1; $last_log = (int) Url::get('last_log'); if ($last_log) { if ($created_time_from) { $search_value .= ' AND last_login >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND last_login <= ' . $created_time_to; } } else { if ($created_time_from) { $search_value .= ' AND create_time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND create_time <= ' . $created_time_to; } } $display->add('last_log', $last_log); if (Url::get('active') == 1) { $search_value .= ' AND (is_active=1)'; $display->add('active_checked', 'checked'); } else { $display->add('active_checked', ''); } if (Url::get('tracking') == 1) { $search_value .= ' AND (tracking=1)'; $display->add('tracking_checked', 'checked'); } else { $display->add('tracking_checked', ''); } if (Url::get('block') == 1) { $search_value .= ' AND (block_time >= ' . TIME_NOW . ' OR block_time = -1)'; $order_by = ' ORDER BY block_time DESC '; $display->add('block_checked', 'checked'); } else { $order_by = ' ORDER BY id DESC '; //$search_value .= ' AND block_time!=-1 AND block_time <= '.TIME_NOW; $display->add('block_checked', ''); } $od_by = Url::get('order_by'); $od_dir = Url::get('order_dir', 'DESC'); if ($od_by == 'name') { $order_by = ' ORDER BY user_name ' . $od_dir; } elseif ($od_by == 'id') { $order_by = ' ORDER BY id ' . $od_dir; } elseif ($od_by == 'time') { $order_by = ' ORDER BY create_time ' . $od_dir; } elseif ($last_log) { $order_by = ' ORDER BY last_login ' . $od_dir; } if (Url::get('ava')) { $search_value .= ' AND avatar_url != ""'; $display->add('ava_checked', 'checked'); } else { $display->add('ava_checked', ''); } // search ô textbox ID $id_search = (int) Url::get('id_search', 0); if ($id_search) { $search_value .= ' AND id=' . $id_search; } if ($id_search == 0) { $id_search = ''; } $display->add('id_search', $id_search); // search ô textbox tài khoản if (Url::get('text_value') != '') { $text_value = Url::get('text_value'); $display->add('text_value', $text_value); $str_search = str_replace("'", '"', $text_value); $str_search = str_replace("'", '"', $str_search); $str_search = str_replace(""", '"', $str_search); $search_value .= " AND (user_name LIKE '%" . $str_search . "%' OR email LIKE '%" . $str_search . "%')"; } // search so dien thoai if (Url::get('id_phone') != '') { $id_phone = Url::get('id_phone'); $search_value .= " AND (home_phone LIKE '%" . $id_phone . "%' OR mobile_phone LIKE '%" . $id_phone . "%')"; } $display->add('id_phone', Url::get('id_phone')); $item_per_page = Url::get('item_per_page', 50); $sql_count = 'SELECT COUNT(id) AS total_item FROM user WHERE ' . $search_value; $total = DB::fetch($sql_count, 'total_item', 0); $items = array(); $str_id = ''; $uids = ''; if ($total) { $limit = ''; $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Thành viên', 'Trang'); $sql = 'SELECT * FROM user WHERE ' . $search_value . ' ' . $order_by . $limit; $result = DB::query($sql); if ($result) { AZLib::getProvinces(); while ($row = mysql_fetch_assoc($result)) { if ($row['block_time'] > TIME_NOW || $row['block_time'] == -1 || $row['invalid_time'] > 0 || $row['invalid_time'] == -1) { $str_id .= ($str_id == '' ? '' : ',') . $row['id']; } $row['create_time'] = date('d/m/y H:i', $row['create_time']); if ($row['last_login']) { $row['last_login'] = date('d/m/y H:i', $row['last_login']); } else { $row['last_login'] = false; } if ($row['block_time'] > TIME_NOW || $row['block_time'] == -1) { if ($row['block_time'] != -1) { $row['status'] = "<font color=red><b>" . date('H:i d/m/y', $row['block_time']) . '</b></font>'; } else { $row['status'] = '<font color=red><b>Khóa vĩnh viễn</b></font>'; } $row['bgcolor'] = 'bgcolor="#CCCCCC"'; $row['is_block'] = true; $display->add('type_reason', 'Khóa'); } else { $row['status'] = ""; $row['bgcolor'] = ''; $row['is_block'] = false; } if ($row['invalid_time'] > 0 || $row['invalid_time'] == -1) { $row['status'] = $row['invalid_time'] == -1 ? "<font color=red><b>kiểm duyệt vĩnh viễn</b></font>" : "<font color=red><b>" . date('H:i d/m/y', $row['invalid_time']) . '</b></font>'; $row['is_invalid'] = true; $display->add('type_reason', 'Kiểm duyệt'); } else { //$row['status'] = ""; //$row['bgcolor'] = ''; $row['is_invalid'] = false; } if ($row['province_id'] && isset(CGlobal::$provinces[$row['province_id']])) { $row['city'] = CGlobal::$provinces[$row['province_id']]['name']; } else { $row['city'] = ''; } $row['gender'] = ''; if ($row['website'] && strpos($row['website'], 'http://') === false) { $row['website'] = 'http://' . $row['website']; } if ($row['avatar_url']) { $row['avatar_preview'] = AZLib::getImageThumb($row['avatar_url'], 60, 0, 1, $row['img_server']); $row['avatar_src'] = 'http://' . CGlobal::$img_server[$row['img_server']] . $row['avatar_url']; $row['del_avatar'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=del_avatar&id=' . $row['id']); } else { $row['avatar_preview'] = ''; $row['avatar_src'] = ''; $row['del_avatar'] = ''; } $row['unban_nick'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=unban_nick&id=' . $row['id']); if (User::is_root()) { $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=del_user&id=' . $row['id']); } $row['detail'] = Url::build_current(array('cmd' => 'detail', 'id' => $row['id'])); $row['edit'] = Url::build_current(array('cmd' => 'edit', 'id' => $row['id'])); $row['openids'] = array(); $row['del_cache'] = Url::build_all(array('cmd', 'id'), 'cmd=del_cache&id=' . $row['id']); $uids .= ($uids ? ',' : '') . $row['id']; $items[$row['id']] = $row; } } } else { $paging = ''; } if ($uids) { $re = DB::query("SELECT openid_url,user_id FROM openid WHERE user_id IN({$uids})"); if ($re) { while ($oid = mysql_fetch_assoc($re)) { $items[$oid['user_id']]['openids'][] = $oid['openid_url']; } } } //lay ly do khoa nicks hoac kiem duyet nick $arr_reason = array(); if ($str_id) { $where = ''; if (Url::get('block') == 1) { $where = ' AND type IN (0,1) '; } else { if (Url::get('invalid') == 1) { $where = ' AND type = 2 '; } } $sql = 'SELECT user_id, time, note, type,admin_id, admin_name FROM user_lock WHERE user_id IN(' . $str_id . ') ' . $where . ' ORDER BY id ASC'; $result = DB::query($sql); while ($row = mysql_fetch_assoc($result)) { $arr_reason[$row['user_id']] = $row; } } foreach ($items as $value) { if (isset($arr_reason[$value['id']]['user_id']) && $value['id'] == $arr_reason[$value['id']]['user_id']) { $items[$value['id']]['lock_reason'] = AZLib::filter_title($arr_reason[$value['id']]['note']); $items[$value['id']]['lock_type'] = $arr_reason[$value['id']]['type']; $items[$value['id']]['time_lock'] = date("d/m/y H:i", $arr_reason[$value['id']]['time']); $items[$value['id']]['create_time_lock'] = $arr_reason[$value['id']]['time']; $items[$value['id']]['admin_name'] = $arr_reason[$value['id']]['admin_name']; } else { $items[$value['id']]['lock_reason'] = ''; $items[$value['id']]['lock_type'] = ''; $items[$value['id']]['time_lock'] = ''; $items[$value['id']]['create_time_lock'] = 0; $items[$value['id']]['admin_name'] = ''; } } //end lay ly do khoa nick if ($od_dir == 'ASC') { $od_dir = 'DESC'; } else { $od_dir = 'ASC'; } $href_id = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=id&order_dir=' . $od_dir); $href_name = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=name&order_dir=' . $od_dir); $href_up = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=up&order_dir=' . $od_dir); $href_time = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=time&order_dir=' . $od_dir); $img_id = '<img src="style/images/admin/downarrow.png" alt="">'; //default $img_name = ''; $img_up = ''; $img_time = ''; if ($od_by == 'id') { $img_id = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($od_by == 'name') { $img_name = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; $img_id = ''; } if ($od_by == 'up') { $img_up = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; $img_id = ''; } if ($od_by == 'time') { $img_time = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; $img_id = ''; } // neu show cac thanh vien bi khoa, se sap xep theo thoi diem khoa hien tai giam dan if (Url::get('block') == 1) { usort($items, array("ListUserAdminForm", "cmp")); } $display->add('img_id', $img_id); $display->add('img_name', $img_name); $display->add('img_up', $img_up); $display->add('img_time', $img_time); $display->add('href_id', $href_id); $display->add('href_name', $href_name); $display->add('href_up', $href_up); $display->add('href_time', $href_time); $display->add('total_user', $total); $display->add('limit_date', BAN_NICK_DATE); $display->add('items', $items); $display->add('paging', $paging); $display->add('is_root', User::is_root()); $display->output('list'); $this->endForm(); }
function draw() { $this->beginForm(); global $display; $user_id = (int) Url::get('user_id', 0); $user_name = Url::get('user_name', ""); $display->add('created_time_from', Url::get('created_time_from')); $display->add('created_time_to', Url::get('created_time_to')); $display->add('sender_user_name', Url::get('sender_user_name')); $created_time_from = 0; $created_time_to = 0; $item_per_page = 50; $limit = ''; if (Url::get('created_time_from')) { $date_arr = explode('-', Url::get('created_time_from')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if (Url::get('created_time_to')) { $date_arr = explode('-', Url::get('created_time_to')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } $search_value = ''; if ($created_time_from) { $search_value .= ' time_add >= ' . $created_time_from; } if ($created_time_to) { if ($created_time_from) { $and = ' AND '; } else { $and = ' '; } $search_value .= $and; $search_value .= ' time_add <= ' . $created_time_to; } if ($user_id) { if ($search_value) { $and = ' AND '; } else { $and = ' '; } $search_value .= $and; $search_value .= ' user_id = ' . $user_id; } if ($user_name) { if ($search_value) { $and = ' AND '; } else { $and = ' '; } $search_value .= $and; $search_value .= ' user_name = "' . $user_name . '"'; } // search ô textbox if ($search_value) { $sql_count = 'SELECT COUNT(*) AS total_item FROM admin_notice_user WHERE ' . $search_value; } else { $sql_count = 'SELECT COUNT(*) AS total_item FROM admin_notice_user'; } $total = DB::fetch($sql_count, 'total_item', 0); $items = array(); if ($total) { $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Thông báo', 'Trang'); if ($search_value) { $sql = 'SELECT * FROM admin_notice_user WHERE ' . $search_value . ' ORDER BY id DESC ' . $limit; } else { $sql = 'SELECT * FROM admin_notice_user ORDER BY id DESC ' . $limit; } $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { if ($row["admin_add"] && $row["time_add"]) { $row["add"] = "<a target='_blank' href='" . $row["admin_add"] . "'>" . $row["admin_add"] . "</a> thêm lúc " . date("d-m-y H:i", $row["time_add"]); } if ($row["admin_edit"] && $row["time_edit"]) { $row["edit"] = "<a target='_blank' href='" . $row["admin_edit"] . "'>" . $row["admin_edit"] . "</a> sửa lúc " . date("d-m-y H:i", $row["time_edit"]); } $row["expire"] = date("d/m/Y H:i", $row["expire_date"]); if ($row["expire_date"] > TIME_NOW && $row["active"]) { $row["active"] = 1; } else { $row["active"] = 0; } $items[$row['id']] = $row; } } } else { $paging = ''; } $display->add('user_id', $user_id); $display->add('user_name', $user_name); $display->add('items', $items); $display->add('paging', $paging); $display->output('AdminNoticeUser'); $this->endForm(); }
function load_shop_label() { if (!CGlobal::$user_profile) { User::check_get_user(); } if (CGlobal::$user_profile) { $mode_default = 'comment'; if (!CGlobal::$shop_setting) { if (CGlobal::$user_profile['shop_setting']) { CGlobal::$shop_setting = unserialize(stripslashes(CGlobal::$user_profile['shop_setting'])); } if (!CGlobal::$shop_setting) { CGlobal::$shop_setting = array('shop_name' => CGlobal::$user_profile['full_name'] ? CGlobal::$user_profile['full_name'] : CGlobal::$user_profile['user_name'], 'default_mode' => 1, 'default_layout' => 1, 'item_list_mode' => 0, 'adv_banner' => ''); } } if (CGlobal::$shop_setting && !isset(CGlobal::$shop_setting['default_layout'])) { CGlobal::$shop_setting['default_layout'] = 1; } if (Url::get("mode") == "comment" || CGlobal::$shop_setting['default_mode'] == 2) { CGlobal::$website_title = 'Lưu bút - Shop ' . CGlobal::$user_profile['user_name']; } if (!CGlobal::$shop_setting['default_mode']) { if (Url::get('mode') == 'shop' || DB::select('item', 'user_id=' . CGlobal::$user_profile['id'] . ' AND status=1')) { //Nếu có sp, mặc định là vào shop CGlobal::$shop_setting['default_mode'] = 1; $mode_default = 'shop'; } else { //Nếu ko có sản phẩm, mặc định vào lưu bút CGlobal::$shop_setting['default_mode'] = 2; $mode_default = 'comment'; } } else { if (CGlobal::$shop_setting['default_mode'] == 1) { $mode_default = 'shop'; } else { $mode_default = 'comment'; } } } if (CGlobal::$shop_label) { CGlobal::$website_title .= ' | ' . CGlobal::$shop_label['name']; $this->label_id = CGlobal::$shop_label['id']; } else { $this->label_id = (int) Url::get('label_id', 0); if ($this->label_id) { CGlobal::$shop_label = DB::select("label", "id=" . $this->label_id); } if (!CGlobal::$shop_label) { $this->label_id = 0; } } $page_shop_item = (int) Url::get('page_shop_item', 1); $label_id = (int) Url::get("label_id", 0); $list_type = (int) Url::get("list_type", 0); global $display; $display->add('top_level_id', $label_id); $display->add('list_type', $list_type); $display->add('can_edit', User::have_permit(ADMIN_ITEM) || User::id() == CGlobal::$user_profile['id']); $status_check = User::id() == CGlobal::$user_profile['id'] || User::have_permit(ADMIN_ITEM) ? ' status IN(0,1,2,3,4,5)' : ' status =1'; if ($label_id) { $total_item = DB::fetch('SELECT count(*) AS total_row FROM label_item AS L JOIN item AS I ON L.item_id=I.id AND I.' . $status_check . ' AND I.user_id=' . CGlobal::$user_profile['id'] . ' WHERE L.user_id=' . CGlobal::$user_profile['id'] . ' AND L.label_id=' . $label_id, 'total_row', 0); } else { $total_item = DB::fetch('SELECT count(*) AS total_row FROM item WHERE ' . $status_check . ' AND user_id=' . CGlobal::$user_profile['id'], 'total_row', 0); } $pagging = ''; $items = array(); $divID = 'shop_item'; $item_per_page = 0; if ($total_item) { $item_per_page = 9; $limit = ''; $url_path = WEB_DIR . 'ajax.php?act=shop&code=load_shop_label&user_id=' . CGlobal::$user_profile['id'] . '&label_id=' . $label_id . (!$list_type ? '' : '&list_type=' . $list_type); $pagging = AZPagging::AjaxPaging($limit, $total_item, $item_per_page, 5, 'page_shop_item', '', false, false, $url_path, $divID, true); if ($label_id) { $display->add('label_name', CGlobal::$shop_label['name']); $select = 'SELECT I.id, I.name,I.sapo, I.user_name, I.user_id,I.description,I.category_id, I.read_count, I.reply_count, I.currency_id, I.price, I.province_id, I.up_time,I.price_out, I.brief, I.img_url, I.status, I.state, I.img_server FROM label_item AS L JOIN item AS I ON L.item_id=I.id AND I.' . $status_check . ' AND I.user_id=' . CGlobal::$user_profile['id'] . ' WHERE L.user_id=' . CGlobal::$user_profile['id'] . ' AND L.label_id=' . $label_id . ' ORDER BY shop_order, up_time DESC' . $limit; } else { $select = 'SELECT id, name, sapo, user_name, user_id, description, category_id, read_count, reply_count, currency_id, price, brief, img_url, province_id, up_time, price_out, status, state, img_server,sticky FROM item WHERE ' . $status_check . ' AND user_id=' . CGlobal::$user_profile['id'] . ' ORDER BY shop_order, up_time DESC' . $limit; } $re = DB::query($select); if (User::is_login()) { $wids = User::get_wishlist('wish_list_items'); $w_items = array(); if ($wids) { $w_items = explode(',', $wids); } } if ($re) { AZLib::getProvinces(); AZLib::getCats(); $item_ids = ''; while ($item = mysql_fetch_assoc($re)) { $item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']); $item['price_out'] = AZLib::convertCurrency($item['price_out'], $item['currency_id']); $item['currency_id'] = 1; if ($item['img_url']) { $item['image_url'] = AZLib::getImageThumb($item['img_url'], 200, 200, 0, $item['img_server']); } if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . AZLib::safe_title(AZLib::word_limit($item['name'], 12, '')) . '&nice_name=' . CGlobal::$allCategories[$item['category_id']]['nice_name']); } else { $item['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . AZLib::safe_title(AZLib::word_limit($item['name'], 12, ''))); } $tooltip = ''; $tooltip .= 'Xem: ' . $item['read_count'] . ' - Phản hồi: ' . $item['reply_count']; $item['time_label'] = ''; $up_time = date('H:i | ', $item['up_time']); if (date('d.m.y', $item['up_time']) == date('d.m.y', TIME_NOW)) { $up_time .= '<font color="green">Hôm nay</font>'; } else { $up_time .= date('d.m.y', $item['up_time']); } //$item['created_time'] = 'đăng '.AZLib::duration_time($item['up_time']); $item['created_time'] = $up_time; if ($item['price']) { $item['price'] = number_format($item['price'], 0, ',', '.'); $item['currency_id'] = CGlobal::$currency[$item['currency_id']]; } else { $item['price'] = ''; $item['currency_id'] = ''; } $item['price_title'] = 'Giá bán'; if ($item['price_out'] > 0) { $item['price_out'] = number_format($item['price_out'], 0, ',', '.') . ($item['currency_id'] == ' ' ? ' ' . CGlobal::$currency[$item['currency_id']] : ''); } else { $item['price_out'] = '0'; } $item['no_base_source'] = AZLib::remove_4_js(str_replace(array("<br>", "<br />"), '', $item['brief'])); $item['description'] = AZLib::plainText(AZLib::parseBBCode(html_entity_decode($item['description'], ENT_QUOTES, "UTF-8"))); $item['description'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $item['description']); $item['description'] = str_replace(array("'", "\""), array("", " "), $item['description']); $item['description'] = AZLib::word_limit($item['description'], 250, ''); /* if($item['sapo']!=''){ $item['brief'] = $item['sapo']; $item['brief'] = AZLib::subString(AZLib::filter_title($item['brief']),0,255,true); $item['brief'] = AZLib::word_limit($item['brief'],30,''); } else{ $item['brief'] = String::display_sort_title($item['description'],30); } */ $item['brief'] = ''; $item['parent_name'] = ''; if (isset(CGlobal::$allCategories[$item['category_id']]) && CGlobal::$allCategories[$item['category_id']]['parent_id']) { $parent_id = CGlobal::$allCategories[$item['category_id']]['parent_id']; if (isset(CGlobal::$allCategories[$parent_id])) { $item['parent_name'] = CGlobal::$allCategories[$parent_id]['name'] . ' - '; } } if (isset(CGlobal::$allCategories[$item['category_id']]['name'])) { $item['category_name'] = $item['parent_name'] . CGlobal::$allCategories[$item['category_id']]['name']; } else { $item['category'] = ''; $item['category_name'] = ''; } $item['safe_title'] = AZLib::safe_title($item['parent_name'] . $item['category_name']); $item['category_href'] = WEB_DIR . AZRewrite::formatUrl('?page=list_detail&category_id=' . $item['category_id'] . '&ebname=' . $item['safe_title']); $item['name'] = AZLib::subString(AZLib::filter_title($item['name']), 0, 115, true); $item['name'] = AZLib::word_limit($item['name'], 12, ''); $item['user_name'] = $item['user_name']; $item['profile_url'] = WEB_DIR . $item['user_name']; $item['city'] = CGlobal::$provinces[$item['province_id']]['name']; if ($item['img_url']) { $item['img_url'] = AZLib::getImageThumb($item['img_url'], 110, 0, 1, $item['img_server']); } else { $item['img_url'] = 'style/images/no-images-69x53.jpg'; } if (isset($_GET['ebname'])) { $item['up_url'] = Url::build_current(array('action' => 'up', 'id' => $item['id'], 'category_id' => CGlobal::$curCategory, 'type' => Url::get('type'), 'ebname' => $_GET['ebname'])); $item['down_url'] = Url::build_current(array('action' => 'down', 'id' => $item['id'], 'category_id' => CGlobal::$curCategory, 'type' => Url::get('type'), 'ebname' => $_GET['ebname'])); } else { $item['up_url'] = Url::build_current(array('action' => 'up', 'id' => $item['id'], 'category_id' => CGlobal::$curCategory, 'type' => Url::get('type'))); $item['down_url'] = Url::build_current(array('action' => 'down', 'id' => $item['id'], 'category_id' => CGlobal::$curCategory, 'type' => Url::get('type'))); } $item['in_wish_list'] = false; if (User::is_login()) { if (in_array($item['id'], $w_items)) { $item['in_wish_list'] = true; } else { $item['in_wish_list'] = false; } } else { if (isset($_COOKIE['wish_list_item_ids'])) { $arr = explode(',', $_COOKIE['wish_list_item_ids']); foreach ($arr as $k => $v) { if ($v == $item['id']) { $item['in_wish_list'] = true; } } } } if (CGlobal::$user_profile['id'] == User::id()) { $tooltip .= ' - <strong>ID tin: ' . $item['id'] . '</strong>'; } $item['invalid'] = ''; if ($item['status'] == 2) { $tooltip .= '<div style=\\\'color:red\\\'>(Đang kiểm duyệt)</div>'; $item['invalid'] = '<font color="red">(Đang kiểm duyệt)</font>'; } elseif ($item['status'] == 3) { $tooltip .= '<div style=\\\'color:red\\\'>(Tin theo dõi lừa đảo)</div>'; $item['invalid'] = '<font color="red">(Theo dõi lừa đảo)</font>'; } elseif ($item['status'] == 0) { $tooltip .= '<div style=\\\'color:red\\\'>(Đang ẩn)</div>'; $item['invalid'] = '<font color="red">(Đang ẩn)</font>'; } elseif ($item['status'] == 5) { $tooltip .= '<div style=\\\'color:red\\\'>(Đang kiểm duyệt chờ chứng thực)</div>'; $item['invalid'] = '<font color="red">(KD chờ chứng thực)</font>'; } elseif ($item['status'] == 4) { $tooltip .= '<div style=\\\'color:red\\\'>(Tin trùng)</div>'; $item['invalid'] = '<font color="red">(Tin trùng)</font>'; } elseif ($item['state'] == 1) { $tooltip .= '<div style=\\\'color:red\\\'>(Đang khóa)</div>'; $item['invalid'] = '<font color="red">(Đang khóa)</font>'; } $item['tooltip'] = $tooltip; $item['lids'] = ''; $item_ids .= ($item_ids != '' ? ',' : '') . $item['id']; $items[$item['id']] = $item; } } if ($item_ids) { $item_labels = array(); //Label của tất cả sp đang đc hiển thị $re = DB::query("SELECT id, label_id, item_id FROM label_item WHERE item_id IN({$item_ids})"); if ($re) { while ($l_item = mysql_fetch_assoc($re)) { if (isset($items[$l_item['item_id']])) { $items[$l_item['item_id']]['lids'] .= ($items[$l_item['item_id']]['lids'] != '' ? ',' : '') . $l_item['label_id']; } } } } } $display->add('loading_ajax', true); $display->add('is_admin', (int) User::have_permit(ADMIN_ITEM)); $display->add('cur_id', (int) User::id()); $display->add('total_sp', (int) $total_item); $display->add('items', $items); $display->add('paging', $pagging); $display->add('item_per_page', $item_per_page); $display->add('page_num', $page_shop_item); $display->add('shop_user_id', CGlobal::$user_profile['id']); $display->add('shop_user_name', CGlobal::$user_profile['user_name']); $display->output($list_type != 1 ? 'ShopItem' : 'ShopItemListDetail', false, 'Shop'); }