function draw() { //xoa 1 id if (Url::get("act") == "del" && Url::get('id')) { DB::query('DELETE FROM ban_ip WHERE id=' . Url::get('id')); Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'act', 'id'))); } global $display; //list $this->beginForm(); $items = array(); $sql = "SELECT * FROM ban_ip Order by id desc"; $result = DB::query($sql); while ($row = mysql_fetch_assoc($result)) { $row['create_time'] = date('d/m - h:i', $row['create_time']); $items[$row['id']] = $row; $arr_mem_cache[$row['ip']] = $row; } // cho mang vao memcache AZMemcache::do_put('list_ban_ip', $arr_mem_cache); $display->add('items', $items); $display->add('items_json', json_encode($items)); $display->output('ManageBanIp'); $this->endForm(); }
function ManageSupport($row) { Module::Module($row); if (User::is_admin() || User::have_permit(support_all_perm)) { CGlobal::$website_title = 'Quản lý thư góp ý của khách hàng'; switch (Url::get('cmd')) { case 'delete': DB::query('DELETE FROM support WHERE id=' . EClassApi::getParam('id')); Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id'))); break; case "edit": /*case "add": require_once 'forms/edit.php'; $this->add_form(new EditBadWordForm()); break;*/ /*case "add": require_once 'forms/edit.php'; $this->add_form(new EditBadWordForm()); break;*/ default: require_once 'forms/list.php'; $this->add_form(new ManageSupportForm()); break; } } else { Url::access_denied(); } }
function ManageUserLock($row) { CGlobal::$website_title = 'Quản lý thành viên bị khóa'; Module::Module($row); if (User::have_permit(ADMIN_USER)) { switch (Url::get('cmd')) { case 'unban_nick': $id = (int) Url::get('id', 0); $user_id = (int) Url::get('user_id', 0); if ($id) { DB::update('user', array('block_time' => 0), 'id="' . $user_id . '"'); DB::update('user_lock', array('unlock_time' => TIME_NOW, 'unlock_user' => User::user_name()), 'id = ' . $id); User::getUser($id, 0, 1); } Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'))); break; default: require_once 'forms/ManageUserLock.php'; $this->add_form(new ListUserLockForm()); break; } } else { Url::access_denied(); } }
function draw() { $this->beginForm(); global $display; $item_per_page = 20; $sql_count = 'SELECT COUNT(*) AS total_item FROM support'; $total = DB::fetch($sql_count, 'total_item', 0); $items = array(); if ($total) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Tin', 'Trang'); $sql = 'SELECT * FROM support ORDER BY 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['created']) { $row['created'] = date("d/m/Y", $row['created']); } $items[$row['id']] = $row; } } } else { $paging = ''; } $display->add('items', $items); $display->add('contents', Url::get('contents')); $display->add('paging', $paging); $display->output('list'); $this->endForm(); }
function draw() { $this->beginForm(); global $display; $user_id = intval(Url::get('user_id')); $user_info = DB::select('account', '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 = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Giao dịch', 'Trang'); $sql = 'SELECT id,name,created_time,up_time,up_count,user_id,user_name,status FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value . ' ORDER BY up_time DESC ' . $limit; $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { $row['ebname'] = EClassApi::safe_title($row['name']); $row['up_time'] = date('d/m/y H:i', $row['up_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 on_submit() { $ids = isset($_POST['chk_id']) ? $_POST['chk_id'] : array(); if (count($ids) > 0) { $all_id = ''; for ($i = 0; $i < count($ids); $i++) { $all_id .= $ids[$i] . ','; } $all_id = substr($all_id, 0, -1); AdminNotice::delNoticeUser($all_id); Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id'))); } }
function draw() { global $display; $survey_config = @CGlobal::$configs['survey_config']['conf_val']; if ($survey_config != '') { $survey_config = unserialize(stripslashes($survey_config)); } else { $survey_config = array(); } $id_survey = @(int) $survey_config[Module::$block_id]; $admin = ''; if (User::is_admin()) { $admin = '<a href="' . Url::build('admin_survey', array('href' => urlencode(Url::build_all()), 'block_id' => Module::$block_id)) . '"><img src="style/images/nav_right_arrow.gif" border="0" title="Chọn thăm dò ý kiến" /></a>'; $display->add('is_admin', 1); } $public_survey = DB::select("public_survey", "id={$id_survey}"); if ($public_survey) { if ($public_survey['view'] == 1) { $display->add('show_survey', 1); $display->add('title', stripslashes($public_survey['title'])); $display->add('question', stripslashes($public_survey['question'])); $display->add('id', $public_survey['id']); $opts = array(); $re = DB::query('SELECT * FROM public_survey_opinion WHERE `id_survey`=' . $public_survey['id']); $i = 0; if ($re) { while ($opt = mysql_fetch_assoc($re)) { $i++; if ($public_survey['type'] == 1) { $opt['control'] = '<input name="survey_id[]" type="radio" value="' . $opt['id'] . '" id="survey_id_' . $opt['id'] . '">'; } else { $opt['control'] = '<input name="survey_id[]" type="checkbox" value="' . $opt['id'] . '" id="survey_id_' . $opt['id'] . '">'; } $opts[$opt['id']] = $opt; } } $display->add('opts', $opts); $url_detail = Url::build('view_survey', array('id' => $public_survey['id'])); $display->add('onclick_rate', Url::open_popup($url_detail . "&ids='+survey_list('survey_id[]')+'", 600, 100 + 50 * $i, false, false, false, false, false, 1, false, false, false)); $display->add('onclick_view', Url::open_popup($url_detail, 600, 100 + 50 * $i, false, false, false, false, false, 1, false, false, false)); } $display->add('edit', AZLib::button(Url::build('admin_survey', array('cmd' => 'edit', 'id_survey' => $public_survey['id'])), 'style/images/edit.gif', "Sửa Thăm dò ý kiến")); $display->add('delete', AZLib::buttonDel(Url::build_current(array('cmd' => 'remove_survey', 'id_survey' => $public_survey['id'], 'block_id' => Module::$block_id)), 'style/images/delete.gif', "Bỏ chọn dò ý kiến")); } $display->add('admin', $admin); $display->output('PublicSurvey'); }
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 ManageBadContent($row) { echo 'a'; Module::Module($row); if (User::is_admin()) { CGlobal::$website_title = 'Quản lý thông báo nội dung xấu'; switch (Url::get('cmd')) { case 'delete': DB::query('DELETE FROM bad_content WHERE id="' . Url::get('id') . '"'); Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id'))); break; default: require_once 'forms/ManageBadContent.php'; $this->add_form(new ManageBadContentForm()); break; } } else { Url::access_denied(); } }
static function admin_link($row) { $str = ''; if (User::have_permit(ADMIN_NEWS)) { $href = urlencode(Url::build_all()); $str = '<br />'; $str .= '<a href="' . Url::build('news_admin', array('cmd' => 'add')) . '"><b>Thêm tin</b></a> | '; $str .= '<a href="' . Url::build('news_admin', array('id' => $row['id'], 'cmd' => 'edit', 'href' => $href)) . '"><b>Sửa tin</b></a> | '; if (!$row['status']) { $str .= '<a href="' . Url::build('news_admin', array('id' => $row['id'], 'cmd' => 'pub', 'act' => 'Publish', 'href' => $href)) . '" )"><b>Hiển thị tin</b></a> | '; } else { $str .= '<a href="' . Url::build('news_admin', array('id' => $row['id'], 'cmd' => 'pub', 'act' => 'UnPublish', 'href' => $href)) . '" )"><b>Ẩn tin</b></a> | '; } $str .= '<a href="' . Url::build('news_admin', array('id' => $row['id'], 'cmd' => 'delete', 'href' => $href)) . '" onclick="return confirm(\'Bạn có chắc chắn xóa không?\')"><b>Xóa tin</b></a> '; $str .= '<br />[ <b>Thêm:</b> <a href="' . Url::build('profile', array('username' => $row['username'])) . '"><b>' . $row['username'] . '</b></a> - ' . date('d/m/Y H:i', $row['time_created']) . ' || '; $str .= '<b>Sửa:</b> <a href="' . Url::build('profile', array('username' => $row['user_modify'])) . '"><b>' . $row['user_modify'] . '</b></a> - ' . date('d/m/Y H:i', $row['time_modify']) . ' ]'; if ($row['admin_comment'] != '') { $str .= '<br /><b><font color="red">Ghi chú: </font></b><font color="red">' . $row['admin_comment'] . '</font></b>'; } // Hien thi comment cua Bien tap } return $str; }
function BadWord($row) { Module::Module($row); if (User::is_admin()) { CGlobal::$website_title = 'Quản lý từ xấu'; switch (Url::get('cmd')) { case 'delete': DB::query('DELETE FROM bad_words WHERE id=' . AZLib::getParam('id')); Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id'))); break; case "edit": case "add": require_once 'forms/edit.php'; $this->add_form(new EditBadWordForm()); break; default: require_once 'forms/list.php'; $this->add_form(new BadWordForm()); break; } } else { Url::access_denied(); } }
} } else { if (isset($_GET['login_as']) || isset($_GET['login_as_id'])) { if (User::is_admin()) { $user_id = (int) Url::get('login_as_id', 0); $user = array(); if ($user_id) { $user = User::getUser($user_id); } else { $user_name = Url::get('login_as'); if ($user_name != '') { $user = User::getByUserName($user_name); } } if ($user) { if (User::is_root() || !$user['gids'] || $user['gids'] && !preg_match("/([\\D])9([\\D])/i", "|{$user['gids']}|")) { User::LogIn($user); } } } Url::redirect_url(Url::build_all(array('login_as', 'login_as_id'))); } } } //Title mac dinh cho website CGlobal::$website_title = "Big School"; CGlobal::$keywords = 'Big School, Study, Học hành, Giáo viên, Học sinh, Thi cử'; CGlobal::$meta_desc = 'Big School'; register_shutdown_function(array("DB", "close")); register_shutdown_function(array("EClassApi", "ftp_image_close")); $display = new EBDisplay();
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; $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 = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } 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 = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } $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('invalid') == 1) { $search_value .= ' AND (invalid_time > 0 OR invalid_time = -1)'; $order_by = ' ORDER BY invalid_time DESC '; $display->add('invalid_checked', 'checked'); } else { //$search_value .= ' AND invalid_time = 0'; $order_by = ' ORDER BY id DESC '; $display->add('invalid_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 { //$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 = trim(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); $s_user = User::getByUserName($str_search, true); if ($s_user) { $search_value .= " AND id='{$s_user['id']}' "; } else { $search_value .= " AND 0 "; } } $cid = 0; if (Url::get('cid') != 0) { $cid = trim(Url::get('cid')); $search_value .= ' AND (CONCAT(",", class_id, ",") LIKE "%,' . $cid . ',%") '; } $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 account WHERE ' . $search_value; $total = DB::fetch($sql_count, 'total_item', 0); $items = array(); $str_id = ''; $uids = ''; if ($total) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Thành viên', 'Trang'); $sql = 'SELECT * FROM account WHERE ' . $search_value . ' ' . $order_by . $limit; $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { $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; } $row['gender'] = ''; $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' => '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 acc_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'] = EClassApi::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_account', $total); $display->add('limit_date', BAN_NICK_DATE); $display->add('items', $items); $display->add('cid', $cid); //System::debug($items); $display->add('paging', $paging); $display->add('is_root', User::is_root()); $display->output('list'); $this->endForm(); }
function UserAdmin($row) { define('BAN_NICK_DATE', 7); CGlobal::$website_title = 'Quản lý thành viên'; Module::Module($row); if (User::have_permit(ADMIN_USER)) { switch (Url::get('cmd')) { case 'lockdie': //Khoá vĩnh viễn $id = (int) Url::get('id', 0); if ($id) { $user = User::getUser($id); if ($user) { DB::update('user', array('block_time' => -1), 'id=' . $id); DB::insert('user_lock', array('time' => TIME_NOW, 'user_id' => $id, 'user_name' => $user['user_name'], 'type' => 3, 'admin_id' => User::id(), 'admin_name' => User::user_name())); User::getUser($id, 0, 1); } } Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'))); break; case 'delete': Item::delete_item(Url::get('id')); Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), "cmd=item_list")); break; case 'del_cache': $id = (int) Url::get('id', 0); if ($id) { User::getUser($id, 0, 1); } Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'))); break; case 'del_avatar': $user = DB::select('user', (int) Url::get('id')); if ($user) { if ($user['avatar_url']) { AZLib::ftp_image_delete_file($user['avatar_url'], $user['img_server']); DB::update('user', array('avatar_url' => '', 'img_server' => 0), 'id=' . $user['id']); User::getUser($user['id'], 0, 1); } } Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'))); break; case 'item_list': require_once 'forms/item_list.php'; $this->add_form(new ItemListForm()); break; case 'user_log': require_once 'forms/user_log.php'; $this->add_form(new UserLogForm()); break; case 'detail': require_once 'forms/UserDetail.php'; $this->add_form(new UserDetailForm()); break; case 'add': require_once 'forms/UserAdd.php'; $this->add_form(new UserAddForm()); break; case 'edit': require_once 'forms/UserEdit.php'; $this->add_form(new UserEditForm()); break; default: require_once 'forms/UserAdmin.php'; $this->add_form(new ListUserAdminForm()); break; } } else { Url::access_denied(); } }
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 ManageItem($row) { if (User::have_permit(array(ADMIN_ITEM, ADMIN_DEL_ITEM))) { Module::Module($row); $cmd = Url::get('cmd'); switch ($cmd) { case 'delete': $id = (int) Url::get('id', 0); if ($id) { $item = Item::get_item($id); Item::delete_item($id); } Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item'))); break; case 'del_cache': $id = (int) Url::get('id', 0); if ($id) { Item::get_item($id, 1); } Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item'))); break; case 'del_forever': if (User::have_permit(ADMIN_DEL_ITEM)) { $id = (int) Url::get('id', 0); if ($id) { Item::delete_item_physical($id); } } Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item'))); break; case 'show': case 're_post': $id = (int) Url::get('id', 0); if ($id) { if (MEMCACHE_ON) { $item_memcache = Item::get_item($id); $item_memcache['status'] = 1; $item_memcache['modify_user_name'] = User::user_name(); $item_memcache['modify_time'] = TIME_NOW; AZMemcache::do_put("item:{$id}", $item_memcache); } DB::update('item', array('status' => 1, 'modify_user_name' => User::user_name(), 'modify_time' => TIME_NOW), 'id=' . $id); } Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item'))); break; case 'hide': $id = (int) Url::get('id', 0); if ($id) { if (MEMCACHE_ON) { $item_memcache = Item::get_item($id); $item_memcache['status'] = 2; $item_memcache['modify_user_name'] = User::user_name(); $item_memcache['modify_time'] = TIME_NOW; AZMemcache::do_put("item:{$id}", $item_memcache); } DB::update('item', array('status' => 2, 'modify_user_name' => User::user_name(), 'modify_time' => TIME_NOW), 'id=' . $id); } Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item'))); break; default: require_once 'forms/ManageItem.php'; $this->add_form(new ManageItemForm()); break; } } else { Url::redirect('sign_in'); } }
function draw() { global $display; AZLib::get_config(); /*if (CGlobal::$curZone) { $zone_id = CGlobal::$curZone['id']; } else { $zone_id = 0; }*/ $zid = (int) Url::get("zone_id", 0); $display->add('cur_page', AZNet::$page['name']); $display->add('ADMIN_LOGO', User::have_permit(ADMIN_LOGO)); $in_detail_page = AZNet::$page['name'] == 'item_detail'; $topcats = array(); $pcats = array(); $stt = 0; $stt2 = 0; foreach (CGlobal::$subCategories as $top_id => $sub_cats) { if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) { $topcat = CGlobal::$allCategories[$top_id]; if ($topcat['status'] == "HOME") { $topcat['name'] = $topcat['brief_name']; if (count($sub_cats) > 7) { $stt2++; } $topcat['left'] = "-" . (($stt2 - 1) * 30 + 10) . "px"; $topcat['url'] = WEB_DIR . "c{$topcat['id']}/{$topcat['ebname']}"; $topcat['selected'] = (int) (CGlobal::$curMainCat && CGlobal::$curMainCat['id'] == $topcat['id']); $topcat['selected2'] = 0; if ($topcat['selected']) { if ($sub_cats) { $topcat['class'] = "hm_item_list_sub"; } else { $topcat['class'] = "hm_item_seleted"; } } else { $topcat['class'] = "hm_item"; } if ($sub_cats) { $topcat['subs'] = array(); $num_sub = 0; foreach ($sub_cats as $sid => $subcat) { if ($subcat['status'] != "HIDE") { $subcat['url'] = WEB_DIR . "c{$subcat['id']}/{$topcat['ebname']}-{$subcat['ebname']}"; //$subcat['name'] = $subcat['brief_name']; if (CGlobal::$curLevel2Cat && CGlobal::$curLevel2Cat['id'] == $subcat['id']) { $topcat['selected2'] = 1; $topcat['class'] = "hm_item_seleted"; $subcat['class'] = "class='sub_seleted'"; } $topcat['subs'][$sid] = $subcat; $num_sub++; } } if ($topcat['selected'] && !$topcat['selected2']) { $max_per_col = ceil($num_sub / 5); if ($max_per_col <= 0) { $max_per_col = 1; } $display->add('max_per_col', $max_per_col); $display->add('subcat_items', $topcat['subs']); } } $topcats[$top_id] = $topcat; // if($stt++ >= 6) //break; } } } $display->add('topcats', $topcats); $display->add('web_dir', WEB_DIR); $display->add('DATA_PATH', DATA_PATH); //Load Logo //$test_time = mktime(0,0,0,11,26,2010); AZLib::getWebsiteLogo(); if (CGlobal::$websiteLogo !== FALSE && isset(CGlobal::$websiteLogo['current']['expired']) && CGlobal::$websiteLogo['current']['expired'] && CGlobal::$websiteLogo['current']['expired'] < TIME_NOW) { // Nếu Logo đang sử dụng đã hết hạn, lấy Logo còn hạn hoặc lấy Logo mặc định AZLib::getWebsiteLogo(1); } $display->add('logo', CGlobal::$websiteLogo['current']); $display->add('logos', CGlobal::$websiteLogo['logos']); //Top menu if (!isset($_SESSION['is_load_page_first'])) { $_SESSION['is_load_page_first'] = 0; } $display->add('url_root', WEB_ROOT); if (!User::is_login()) { $num_mess = 0; } else { $num_mess = User::$current->data['total_pm'] > 0 ? User::$current->data['total_pm'] : 0; } if (User::id()) { $display->add('user_id', User::id()); $user_name = User::$current->data['user_name']; $display->add('user_name', $user_name); } $referer_login_url = ''; $yahoo_open_id_href = ''; $google_open_id_href = ''; if (isset($_SESSION['openid_url']) && $_SESSION['user_id'] != 0) { $display->add('show_openid', FALSE); } elseif (!User::is_az_team()) { AZLib::check_uri(); $referer_login_url = base64_encode(CGlobal::$query_string); $yahoo_open_id_href = OID_URL . 'index.html?openid_identifier=http://me.yahoo.com/&long_redirect=' . base64_encode(CGlobal::$query_string); $google_open_id_href = OID_URL . 'index.html?openid_identifier=https://www.google.com/users/o8/id&long_redirect=' . base64_encode(CGlobal::$query_string); $display->add('show_openid', TRUE); } $display->add('OID_URL', $yahoo_open_id_href); $display->add('OID_URL_GOG', $google_open_id_href); $display->add('referer_login_url', $referer_login_url); $display->add('google_open_id_href', $google_open_id_href); $display->add('yahoo_open_id_href', $yahoo_open_id_href); $display->add('openid_on', OPENID_ON); $display->add('num_mess', $num_mess); $display->add('is_login', (int) User::is_login()); $display->add('is_admin', (int) User::is_az_team()); $display->add('is_admin_item', (int) User::have_permit(ADMIN_ITEM)); $display->add('is_root', User::is_root()); //End Top menu $display->add('category_id', CGlobal::$curCategory); $display->add('keywords', AZLib::cleanHtml(Url::get('keywords', ''))); $display->add('not_error_page', (int) (AZNet::$page['name'] != 'error')); $display->add('is_load_page_first', $_SESSION['is_load_page_first']); // Tỷ giá AZLib::get_config(); //$exchange = CGlobal::$configs['exchange']['conf_val']; //$display->add('exchange', number_format($exchange, 0, ',', '.')); // End Tỷ giá if ($_SESSION['is_load_page_first'] == 1) { $_SESSION['is_load_page_first'] = 0; } //End of top menu $curMainCat = CGlobal::$curMainCat; $curLevel2Cat = CGlobal::$curLevel2Cat; //Cat menu $sub_menu = FALSE; $sub_menu = $curMainCat && isset(CGlobal::$allCategories[$curMainCat['id']]) && isset(CGlobal::$subCategories[$curMainCat['id']]); $display->add('CURENT_TOP_CATID', (int) @$curMainCat['id']); $display->add('CURENT_LEVEL2_CATID', (int) @$curLevel2Cat['id']); $display->add('CURENT_CITY_ID', CGlobal::$curCity); $display->add('cur_page', Url::get('page')); $display->add('sub_menu', $sub_menu); $display->add('block_id', Module::$block_id); // System::debug($display->get_template_vars()); //End Cat menu if (User::is_root()) { $display->add("DEBUG", DEBUG); $display->add("show_bug_url", AZRewrite::formatUrl(Url::build_all(array(), "ebug=" . (int) (!DEBUG)))); } ################################################################################################################ #Event config $event_on = @CGlobal::$configs['event_on']['conf_val']; $submit = Url::get('submit', ''); if (User::is_admin()) { if ($submit == 'Cập nhật') { $display->add('msg', $this->showFormErrorMessages(1)); } $status_arr = array(0 => 'Tắt', 1 => 'Bật'); $display->add('status_option', AZLib::getOption($status_arr, $event_on)); } $display->add('event', $event_on); $display->add("data_path", DATA_PATH); #Event config ################################################################################################################ ################################################################################################################ #Search $search_catid = (int) Url::get('search_catid'); $search_cat_arr = array(-1 => '--Tất cả danh mục--'); foreach (CGlobal::$subCategories as $top_id => $sub_cats) { if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) { $topcat = CGlobal::$allCategories[$top_id]; if ($topcat['status'] != "HIDE") { $search_cat_arr[$top_id] = $topcat['name']; if ($sub_cats) { foreach ($sub_cats as $sid => $subcat) { if ($subcat['status'] != "HIDE") { $search_cat_arr[$sid] = "-----" . $subcat['name']; } } } } } } $display->add('search_cat_option', AZLib::getOption($search_cat_arr, $search_catid)); #Search ################################################################################################################ /* System::debug($topcats);*/ $cat_newss = array(); $news_cat_id = Url::get('news_catid', 'id', 0); AZLib::getNewsCats(); $display->add('news_cat_id', $news_cat_id); if (CGlobal::$allNewsCategories) { foreach (CGlobal::$allNewsCategories as $news_cat) { if ($news_cat['public']) { $news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name']))); $cat_newss[$news_cat['id']] = $news_cat; } } } $display->add('cat_newss', $cat_newss); $display->output("Header"); // $display->output("header_old"); }
function AdminGrantPerm($row) { Module::Module($row); $cmd = Url::get('cmd'); if (User::is_admin() && User::have_permit('admin_perm')) { switch (Url::get('cmd')) { case 'del_group': $id = (int) Url::get('id', 0); if ($id) { DB::query('DELETE FROM user_groups WHERE id=' . $id); } User::get_system_groups(1); Url::redirect_url(Url::build_all(array('cmd', 'del_group', 'id'))); break; /*case 'delete': $id=(int)Url::get('id',0); if($id) { DB::query('UPDATE account SET gids="0" WHERE id='.$id); User::getUser($id,1,true); } Url::redirect_url(Url::build_all(array('cmd','group_id','id'))); break;*/ /*case 'delete': $id=(int)Url::get('id',0); if($id) { DB::query('UPDATE account SET gids="0" WHERE id='.$id); User::getUser($id,1,true); } Url::redirect_url(Url::build_all(array('cmd','group_id','id'))); break;*/ case 'remove': $group_id = (int) Url::get('group_id', 0); $id = (int) Url::get('id', 0); if (User::is_root() || $group_id != 9) { if ($id) { $user = User::getUser($id); if ($user && $user != '0') { $gids = ''; $groups = User::get_groups($user['gids']); if ($groups) { foreach ($groups as $gid => $group) { if ($group_id != $gid) { $gids .= ($gids ? '|' : '') . $gid; } } } if ($gids == '') { $gids = '0'; } DB::query('UPDATE account SET gids="' . $gids . '" WHERE id=' . $id); } DB::query('DELETE FROM user_permit WHERE type = 1 AND ref_id = ' . $id . ' AND alias = "assign_supplier"'); User::getUser($id, 1, true); } } Url::redirect_url(Url::build_all(array('cmd', 'group_id', 'id'))); break; case 'remove_permit': $pid = Url::get('pid'); $group_id = (int) Url::get('group_id', 0); $groups = User::get_system_groups(); if ($pid != '' && $group_id && isset($groups[$group_id])) { $permit = DB::select('user_permit', 'type=0 AND ref_id=' . $group_id); if ($permit) { $pids = ''; $pid_arr = explode('|', $permit['pids']); if ($pid_arr) { foreach ($pid_arr as $id) { if ($id && $id != $pid) { $pids .= ($pids ? '|' : '') . $id; } } } $permit = array('id' => $permit['id'], 'type' => 0, 'ref_id' => $group_id, 'pids' => $pids); DB::insert('user_permit', $permit, true); } } Url::redirect_current(); break; case 'add_group': case 'edit_group': require_once 'forms/EditGroup.php'; $this->add_form(new EditGroupForm()); break; case 'scan_perm': if (User::is_root()) { require_once 'forms/ScanPermission.php'; $this->add_form(new ScanPermissionForm()); } Url::redirect_current(); break; default: require_once 'forms/ListAdmin.php'; $this->add_form(new ListAdminForm()); break; } } else { Url::access_denied(); } }
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 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; $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 get_gallery_entry() { if (User::is_login()) { global $display; if ((User::have_permit(ADMIN_ITEM) || User::is_mod()) && (int) Url::get('user_id', 0) && (int) Url::get('user_id', 0) != User::id()) { $user_id = (int) Url::get('user_id', 0); $display->add('user_id', $user_id); } else { $user_id = User::id(); } $search_value = ' user_id=' . $user_id . ' AND root_id=0 '; //search theo ngay thang nam //$year=(int)Url::get('year',date('Y')); $year = (int) Url::get('year', -1); //$mon= (int)Url::get('month',(int)date('m')); $mon = (int) Url::get('month', -1); $day = (int) Url::get('day', -1); if ($year == 0) { $year = -1; } if ($mon == 0) { $mon = -1; } if ($day == 0) { $day = -1; } $created_time_from = 0; $created_time_to = 0; if ($year != -1) { if ($mon != -1) { if ($day != -1) { $created_time_from = mktime(0, 0, 0, $mon, $day, $year); $created_time_to = mktime(23, 59, 59, $mon, $day, $year); } else { $max_day = 31; if (in_array($mon, array(4, 6, 9, 11))) { $max_day = 30; } elseif ($mon == 2) { $year % 4 ? $max_day = 28 : ($max_day = 29); } $created_time_from = mktime(0, 0, 0, $mon, 1, $year); $created_time_to = mktime(23, 59, 59, $mon, $max_day, $year); } } else { $created_time_from = mktime(0, 0, 0, 1, 1, $year); $created_time_to = mktime(23, 59, 59, 12, 31, $year); } } $y_arr = array(-1 => '-Lọc theo Năm-'); for ($i = 2008; $i <= date('Y'); $i++) { $y_arr[$i] = "---Năm {$i}-"; } $m_arr = array(-1 => '-Lọc theo Tháng-'); for ($i = 1; $i <= 12; $i++) { $m_arr[$i] = "---Tháng {$i}-"; } $d_arr = array(0 => '-Lọc theo Ngày-'); for ($i = 1; $i <= 31; $i++) { $d_arr[$i] = "---Ngày {$i}-"; } $display->add('option_year', AZLib::getOption($y_arr, $year)); $display->add('option_month', AZLib::getOption($m_arr, $mon)); $display->add('option_day', AZLib::getOption($d_arr, $day)); if ($created_time_from) { $search_value .= ' AND time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND time <= ' . $created_time_to; } $keywords = AZLib::trimSpace(AZLib::getParam('keywords')); $display->add('keywords', $keywords); if ($keywords) { $search_value .= ' AND des LIKE "%' . $keywords . '%" '; } $item_per_page = 20; $sql_count = 'SELECT count(*) AS total_img FROM item_image WHERE ' . $search_value; $total = DB::fetch($sql_count, 'total_img', 0); $paging = ''; $items = array(); $gallery_url = WEB_DIR . 'ajax.php' . Url::build_all(array('page_no')); if ($total) { $limit = ''; $paging = AjaxGalleryPaging($limit, $total, $item_per_page, 5, $gallery_url, 'gallery_content'); $sql = 'SELECT id, des, item_id, title, img_server, img_url, time FROM `item_image` WHERE ' . $search_value . ' ORDER BY id DESC ' . $limit; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $row['image_url'] = $row['img_url']; $row['img_url'] = AZLib::getImageThumb($row['img_url'], 100, 100, 0, $row['img_server']); $items[$row['id']] = $row; } } } $display->add('items', $items); $display->add('total', $total); $display->add('paging', $paging); $display->output('gallery_ajax_entry', false, 'Personal'); System::halt(); } else { echo "Bạn chưa đăng nhập hoặc đã thoát khỏi hệ thống - Hãy đăng nhập lại!"; } }
function draw() { $keywords = AZLib::getParam('keywords'); if ($this->search_catid && $keywords != '') { global $display; $filter_groups = array(); $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 = ''; if (isset($this->filter_get[$fgid]) && $this->filter_get[$fgid] == $filter['id']) { $link_name = Url::build_all(array('filter', 'max', 'min')); foreach ($this->filter_get as $get_gid => $get_fid) { if ($get_gid != $fgid) { $link_name .= "&filter[{$get_gid}]={$get_fid}"; } } if ($this->min) { $link_name .= "&min=" . $this->min; } if ($this->max) { $link_name .= "&max=" . $this->max; } $group_filter['filters'] = array($fid => array('link' => $link_name, 'name' => $filter['name'], 'count' => $pf_array[$fgid][$fid], 'remove' => 1)); break; } else { $link = Url::build_all(array('filter', 'max', 'min')); if ($this->filter_get) { foreach ($this->filter_get as $get_gid => $get_fid) { if ($get_gid != $fgid) { $link .= "&filter[{$get_gid}]={$get_fid}"; } } } $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', WEB_DIR . "c" . $this->search_catid . "/" . Url::get('ebname')); $display->add('filter_groups', $filter_groups); $display->add('filter_price', $this->filter_price); $display->output("FilterMenuSearch"); } }
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; $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(); }
static function check_cookie_login($user_id, $password) { $user_data = DB::fetch('SELECT id, user_name, password, block_time, gids FROM account WHERE id=' . (int)$user_id, false, false, __LINE__ . __FILE__); if ($user_data && $user_data['password'] == $password) { if ($user_data['block_time'] > TIME_NOW) { //Nếu User bị khóa chưa hết hạn! self::LogOut(); } else { //TuanNK sửa check quyền đăng nhập, nếu thuộc nhóm quản trị ==>> không cho đăng nhập tự động $in_group_admin = false; if ($user_data['gids'] && $user_data['gids'] != '0') { //$in_group_admin=(preg_match("/(".$user_data['gids'].")/is","2") || preg_match("/(".$user_data['gids'].")/is","1")); $in_group_admin = (preg_match("/(" . $user_data['gids'] . ")/is", "3") || preg_match("/(" . $user_data['gids'] . ")/is", "2") || preg_match("/(" . $user_data['gids'] . ")/is", "1") || preg_match("/(" . $user_data['gids'] . ")/is", "9")); } if (!$in_group_admin) { User::Login($user_data); Url::redirect_url(Url::build_all()); } else { EClassApi::my_setcookie('suma_id', "", TIME_NOW - 3600); EClassApi::my_setcookie('password', "", TIME_NOW - 3600); } } } else { self::LogOut(); } }
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 ListAdmin($row) { Module::Module($row); if (User::is_admin()) { switch (Url::get('cmd')) { case 'delete': $id = (int) Url::get('id', 0); if ($id) { DB::query('UPDATE user SET gids="0" WHERE id=' . $id); User::getUser($id, 1, true); } Url::redirect_url(Url::build_all(array('cmd', 'group_id', 'id'))); break; case 'remove': $id = (int) Url::get('id', 0); $group_id = (int) Url::get('group_id', 0); if ($id) { if ($id != 1 || $group_id != 9) { $user = User::getUser($id); if ($user && $user != '0') { $gids = ''; $groups = User::get_groups($user['gids']); if ($groups) { foreach ($groups as $gid => $group) { if ($group_id != $gid) { $gids .= ($gids ? '|' : '') . $gid; } } } if ($gids == '') { $gids = '0'; } DB::query('UPDATE user SET gids="' . $gids . '" WHERE id=' . $id); } User::getUser($id, 0, 1); } } Url::redirect_url(Url::build_all(array('cmd', 'group_id', 'id'))); break; case 'remove_permit': $pid = (int) Url::get('pid', 0); $group_id = (int) Url::get('group_id', 0); if ($pid && $group_id && isset(CGlobal::$group[$group_id])) { $permit = DB::select('user_permit', 'type=0 AND ref_id=' . $group_id); if ($permit) { $pids = ''; $pid_arr = explode('|', $permit['pids']); if ($pid_arr) { foreach ($pid_arr as $id) { if ($id && $id != $pid) { $pids .= ($pids ? '|' : '') . $id; } } } $permit = array('id' => $permit['id'], 'type' => 0, 'ref_id' => $group_id, 'pids' => $pids, 'cids' => ''); DB::insert('user_permit', $permit, true); } } Url::redirect_current(); break; default: require_once 'forms/ListAdmin.php'; $this->add_form(new ListAdminForm()); break; } } else { Url::access_denied(); } }
static function paging_unlimit(&$limit = false, $itemperpage, $page_name = 'page_no', $url_path = '') { $currentpage = (int) Url::get($page_name); if ($currentpage <= 0) { $currentpage = 1; } elseif ($currentpage > 200) { $currentpage = 200; } if ($currentpage <= 6) { $totalpage = 11; } else { $totalpage = $currentpage + 4 < 200 ? $currentpage + 4 : 200; } $limit = ' LIMIT ' . ($currentpage - 1) * $itemperpage . ',' . $itemperpage; if ($currentpage > 3) { $startpage = $currentpage - 3; if ($totalpage - $startpage < 7) { $startpage = $totalpage - 7 + 1; } } else { $startpage = 1; } if ($startpage < 1) { $startpage = 1; } if ($url_path == '') { $url_path = Url::build_all(array($page_name)); } //Link den trang truoc if ($currentpage > 1) { $paging_str = '<div class="paging_bg floatLeft" onmouseout="this.className=\'paging_bg floatLeft\'" onmouseover="this.className=\'paging_bg_hover floatLeft\'"> <div class="paging_pre"> <a href=\'' . $url_path . ($currentpage > 2 ? '&' . $page_name . '=' . ($currentpage - 1) : '') . '\'>« Trước</a> </div> </div>'; } else { $paging_str = '<div class="paging_bg_dis floatLeft "> <div class="paging_pre_dis"> « Trước </div> </div>'; } //Danh sach cac trang $i = 1; while ($i <= 4) { if ($startpage > $i) { if ($i < 4) { $paging_str .= '<div class="floatLeft paging_bg" onmouseover="javascript:this.className=\'floatLeft paging_bg_hover\'" onmouseout="javascript:this.className=\'floatLeft paging_bg\'"> <div class="paging_node"> <a href="' . $url_path . ($i > 1 ? '&' . $page_name . '=' . $i : '') . '">' . $i . '</a> </div> </div>'; } else { $paging_str .= '<div class="floatLeft paging_bg"> <div class="paging_node_dot"> ... </div> </div>'; } } $i++; } for ($i = $startpage; $i <= $startpage + 6 && $i <= $totalpage; $i++) { if ($i == $currentpage) { $paging_str .= '<div class="floatLeft paging_bg_hover paging_bg_current"> <div class="paging_node"> <a href="' . $url_path . ($i > 1 ? '&' . $page_name . '=' . $i : '') . '">' . $i . '</a> </div> </div>'; } else { $paging_str .= '<div class="floatLeft paging_bg" onmouseover="javascript:this.className=\'floatLeft paging_bg_hover\'" onmouseout="javascript:this.className=\'floatLeft paging_bg\'"> <div class="paging_node"> <a href="' . $url_path . ($i > 1 ? '&' . $page_name . '=' . $i : '') . '">' . $i . '</a> </div> </div>'; } } $j = 8; while ($j <= 10) { if ($i <= $j && $i <= 10) { $paging_str .= '<div class="floatLeft paging_bg" onmouseover="javascript:this.className=\'floatLeft paging_bg_hover\'" onmouseout="javascript:this.className=\'floatLeft paging_bg\'"> <div class="paging_node"> <a href="' . $url_path . '&' . $page_name . '=' . $j . '">' . $j . '</a> </div> </div>'; if ($i < 10) { $i++; } } $j++; } if ($i > 201) { $paging_str .= '<div class="floatLeft paging_bg" onmouseover="javascript:this.className=\'floatLeft paging_bg_hover\'" onmouseout="javascript:this.className=\'floatLeft paging_bg\'"> <div class="paging_node"> <a href="' . $url_path . '&' . $page_name . '=200">200</a> </div> </div>'; } elseif ($i < 201) { $paging_str .= '<div class="floatLeft paging_bg"> <div class="paging_node_dot"> ... </div> </div>'; } //Trang sau if ($currentpage < 200) { $paging_str .= '<div class="paging_bg floatLeft " onmouseout="this.className=\'paging_bg floatLeft \'" onmouseover="this.className=\'paging_bg_hover floatLeft \'"> <div class="paging_next"> <a href=\'' . $url_path . '&' . $page_name . '=' . ($currentpage + 1) . '\'>Sau »</a> </div> </div>'; } else { $paging_str .= '<div class="paging_bg_dis floatLeft "> <div class="paging_next_dis"> Sau » </div> </div>'; } $paging_str = AZRewrite::formatUrl($paging_str); return $paging_str; }