Exemple #1
0
 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();
 }
Exemple #2
0
 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();
 }
Exemple #3
0
 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();
 }
Exemple #4
0
 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();
 }
Exemple #5
0
 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();
 }
Exemple #6
0
 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();
 }
Exemple #7
0
 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();
 }
Exemple #8
0
 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("&#39;", '"', $str_search);
         $str_search = str_replace("&quot;", '"', $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("&#39;", '"', $str_search);
         $str_search = str_replace("&quot;", '"', $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("&#39;", '"', $str_search);
         $str_search = str_replace("&quot;", '"', $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();
 }
Exemple #9
0
 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();
 }
Exemple #10
0
 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();
 }
Exemple #11
0
 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("&#39;", '"', $str_search);
         $str_search = str_replace("&quot;", '"', $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();
 }
Exemple #12
0
 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();
 }
Exemple #13
0
 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();
 }
Exemple #14
0
 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();
 }
Exemple #15
0
 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();
 }