function show_mes_outbox() { $search_text = AZLib::getParam('search_text'); $is_archive = Url::get('is_archive', 0); $table_topics = 'message_topics'; $table_text = 'message_text'; $url_archive = ''; $url_cmd = ''; if ($is_archive) { $table_topics = $table_topics . '_archive'; $table_text = $table_text . '_archive'; $url_cmd = '?cmd=archive'; $url_archive = '&is_archive=1'; } $condition = $table_topics . '.mt_owner_id =' . User::id() . ' AND ' . $table_topics . '.mt_vid_folder = "sent" AND ' . $table_topics . '.mt_newest = 0'; if ($search_text && $search_text != "Account thành viên") { $condition .= " AND mt_to_name LIKE '%{$search_text}%' "; } $str_content = '<form name="message"> <div id="boxFunctions"> Chọn: <a style="cursor:pointer" id="select_all">Tất cả</a>, <a style="cursor:pointer" id="select_read">Đã đọc</a>, <a style="cursor:pointer" id="select_unchecked">Không chọn</a> <div id="boxFunctionRight"> <div id="btn_del_mess" align="center" class="btnAllNewFeedback" onmouseout="this.className=\'btnAllNewFeedback\'" onmouseover="this.className=\'btnAllNewFeedbackHover\'" style="width:40px;"> <div class="btnRightAllFeedback" align="center" style="width:40px"><a title="Xóa tất cả tin nhặn đã chọn" href="javascript:void(0)" onClick="return delMessage(0,\'true\',\'outbox\')">Xoá</a></div> </div> </div> </div> '; $str_content .= '<table cellpadding="3" cellspacing="0" border="0" width="100%">'; $sql_count = 'SELECT COUNT(mt_id) AS total_row FROM ' . $table_topics . ' WHERE ' . $condition; $total_item = DB::fetch($sql_count, 'total_row', 0); $item_per_page = 15; $limit = ''; $divID = 'mess_content'; $url_path = WEB_DIR . 'ajax.php?act=personal&code=show_mes_outbox' . $url_archive . '&search_text=' . $search_text; $paging = AZPagging::AjaxPaging($limit, $total_item, $item_per_page, 5, 'page_mes', '', false, false, $url_path, $divID, true); $sql = 'SELECT ' . $table_text . '.msg_id, ' . $table_text . '.msg_author_name, ' . $table_text . '.msg_date, ' . $table_text . '.msg_post, ' . $table_topics . '.mt_id, ' . $table_topics . '.mt_ref_id, ' . $table_topics . '.mt_title, ' . $table_topics . '.mt_from_id, ' . $table_topics . '.mt_owner_id, ' . $table_topics . '.mt_read, ' . $table_topics . '.mt_owner_name, ' . $table_topics . '.mt_to_name, user.avatar_url, user.img_server FROM ' . $table_text . ', ' . $table_topics . ', user WHERE ' . $table_text . '.msg_id = ' . $table_topics . '.mt_msg_id AND ' . $table_topics . '.mt_from_id = user.id AND ' . $condition . ' ORDER BY ' . $table_text . '.msg_date DESC ' . $limit; //echo $sql; //exit; $result = DB::query($sql); $stt = 0; if ($result) { while ($row = mysql_fetch_assoc($result)) { if ($stt < $item_per_page) { if ($row['mt_ref_id']) { $sourceTitle = DB::select($table_topics, 'mt_id = ' . $row['mt_ref_id']); if ($sourceTitle['mt_title']) { $row['mt_title'] = $sourceTitle['mt_title']; } //else //{ // $sentTitle = DB::select($table_topics,'mt_mgsid = ' . $row['mt_ref_id']); //} $row["mt_id"] = $row['mt_ref_id']; $row['mt_ref_id'] = 0; } if ($row['avatar_url']) { $row['avatar_url'] = AZLib::getImageThumb($row['avatar_url'], 50, 50, 0, $row['img_server']); } else { $row['avatar_url'] = "style/images/50x50.gif"; } //$row['msg_date'] = AZLib::duration_time($row['msg_date']); $msg_date = date('H:i | ', $row['msg_date']); if (date('d.m.y', $row['msg_date']) == date('d.m.y', TIME_NOW)) { $msg_date .= '<font color="green">Hôm nay</font>'; } else { $msg_date .= date('d.m.y', $row['msg_date']); } $row['msg_date'] = $msg_date; $row['msg_post'] = preg_replace("/\n/", "<br />", $row['msg_post']); $row['msg_post'] = strip_tags(AZLib::parseBBCode(AZLib::convert_one_br($row['msg_post'])), '<br />'); if (strlen($row['msg_post']) > 40) { $row['msg_post_short'] = AZLib::word_limit($row['msg_post'], 40, ' ...'); //$row['msg_post_short'] = AZLib::cleanHtml(AZLib::word_limit($row['msg_post'],40,' ...')); } else { $row['msg_post_short'] = $row['msg_post']; //$row['msg_post_short'] = AZLib::cleanHtml($row['msg_post']); } //$str_title = '<a onclick="fn_show_mes_detail('.$row["mt_id"].')" rel="history" href="message.html'.$url_cmd.'#outbox/'.$row["mt_id"].'" id="a_'.$row["mt_id"].'" title="Hiển thị chi tiết" >'.$row["mt_title"].'</a> - <span class="textMestime">'.$row['msg_date'].'</span>'; if ($row['mt_owner_id'] != User::id()) { $strUser = '******' . $row["mt_owner_name"] . '">' . $row["mt_owner_name"] . '</a>'; } else { $strUser = '******' . $row["mt_to_name"] . '">' . $row["mt_to_name"] . '</a>'; } if ($row["mt_read"] == 0 && !$is_archive) { $str_title = '<a onclick="detail_reload_jcache = true;fn_show_mes_detail(' . $row["mt_id"] . ',1,\'outbox\')" rel="history" id="a_' . $row["mt_id"] . '" href="message.html' . $url_cmd . '#outbox/' . $row["mt_id"] . '" title="Hiển thị chi tiết" ><b>' . $row["mt_title"] . '</b></a>'; $read_class = ' unreadMessage'; } else { $str_title = '<a onclick="detail_reload_jcache = true;fn_show_mes_detail(' . $row["mt_id"] . ',1,\'outbox\')" rel="history" id="a_' . $row["mt_id"] . '" href="message.html' . $url_cmd . '#outbox/' . $row["mt_id"] . '" title="Hiển thị chi tiết">' . $row["mt_title"] . '</a>'; $read_class = ''; } $str_content .= '<tr id="' . $row["mt_id"] . '"> <td align="center" class="listMessage' . $read_class . '"><input type="checkbox" class="rowbox' . $read_class . '" id="inbox_' . $row["mt_id"] . '" name="inbox[]" value="' . $row["mt_id"] . '"></td> <td align="center" class="listMessage' . $read_class . '"> <a href="' . $row["msg_author_name"] . '"><img src="' . $row["avatar_url"] . '"/></a> </td> <td valign="top" class="listMessage' . $read_class . '" style="white-space:nowrap; padding-right:15px; vertical-align:middle;"> <div>' . $strUser . '</div> <div class="textMestime">' . $row['msg_date'] . '</div> </td> <td valign="top" class="listMessage clickable' . $read_class . '" style="padding-right:15px;width:65%;" lang="' . $row["mt_id"] . '"> <div style="margin-top:6px;">' . $str_title . '</div> <div style="margin:6px 0;color:#808080">' . $row['msg_post_short'] . '</div> </td> <td align="center" class="listMessage' . $read_class . '" style="padding-right:10px;"> <span><a title="Xóa tin nhắn" onClick="return delMessage(' . $row["mt_id"] . ',\'false\',\'inbox\')" href="javascript:void(0)" style="padding:20px;" class="deleteButton"> </a></span></td> </tr> '; /*$str_content .= '<tr id="'.$row["mt_id"].'"> <td align="center" class="listMessage' . $read_class . '"><input type="checkbox" id="inbox_'.$row["mt_id"].'" name="inbox[]" value="'.$row["mt_id"].'"></td> <td align="center" class="listMessage' . $read_class . '"> <a href="'.$row["mt_to_name"].'"><img src="'.$row["avatar_url"].'" vspace="4" hspace="4"/></a> <div><a href="'.$row["mt_to_name"].'">'.$row["mt_to_name"].'</a></div> </td> <td valign="top" style="width:65%;" class="listMessage' . $read_class . '"> <div>'.$str_title.'</div> <div style="margin-top:6px">'.$row['msg_post_short'].'</div> </td> <td align="center" class="listMessage' . $read_class . '"> <span><a title="Xóa tin nhắn" onClick="delMessage('.$row["mt_id"].',\'false\',\'sent\')" href="javascript:void(0)"> <img src="style/images/icon_delete.gif" width="9" height="9" /></a></span></td> </tr>';*/ } $stt++; } } if ($stt > 0) { $str_content .= '<tr><td></td><td> </td><td colspan="2"><div style="float:right">' . $paging . '</div><div style="clear:right"></div></td></tr>'; } else { $str_content .= '<tr><td></td><td colspan="3"> <center><div class="noMess">Không có Tin nhắn nào trong tin đã gửi</div></center> </td></tr>'; } $str_content .= '</table></form>'; echo $str_content; exit; }
function load_shop_label() { if (!CGlobal::$user_profile) { User::check_get_user(); } if (CGlobal::$user_profile) { $mode_default = 'comment'; if (!CGlobal::$shop_setting) { if (CGlobal::$user_profile['shop_setting']) { CGlobal::$shop_setting = unserialize(stripslashes(CGlobal::$user_profile['shop_setting'])); } if (!CGlobal::$shop_setting) { CGlobal::$shop_setting = array('shop_name' => CGlobal::$user_profile['full_name'] ? CGlobal::$user_profile['full_name'] : CGlobal::$user_profile['user_name'], 'default_mode' => 1, 'default_layout' => 1, 'item_list_mode' => 0, 'adv_banner' => ''); } } if (CGlobal::$shop_setting && !isset(CGlobal::$shop_setting['default_layout'])) { CGlobal::$shop_setting['default_layout'] = 1; } if (Url::get("mode") == "comment" || CGlobal::$shop_setting['default_mode'] == 2) { CGlobal::$website_title = 'Lưu bút - Shop ' . CGlobal::$user_profile['user_name']; } if (!CGlobal::$shop_setting['default_mode']) { if (Url::get('mode') == 'shop' || DB::select('item', 'user_id=' . CGlobal::$user_profile['id'] . ' AND status=1')) { //Nếu có sp, mặc định là vào shop CGlobal::$shop_setting['default_mode'] = 1; $mode_default = 'shop'; } else { //Nếu ko có sản phẩm, mặc định vào lưu bút CGlobal::$shop_setting['default_mode'] = 2; $mode_default = 'comment'; } } else { if (CGlobal::$shop_setting['default_mode'] == 1) { $mode_default = 'shop'; } else { $mode_default = 'comment'; } } } if (CGlobal::$shop_label) { CGlobal::$website_title .= ' | ' . CGlobal::$shop_label['name']; $this->label_id = CGlobal::$shop_label['id']; } else { $this->label_id = (int) Url::get('label_id', 0); if ($this->label_id) { CGlobal::$shop_label = DB::select("label", "id=" . $this->label_id); } if (!CGlobal::$shop_label) { $this->label_id = 0; } } $page_shop_item = (int) Url::get('page_shop_item', 1); $label_id = (int) Url::get("label_id", 0); $list_type = (int) Url::get("list_type", 0); global $display; $display->add('top_level_id', $label_id); $display->add('list_type', $list_type); $display->add('can_edit', User::have_permit(ADMIN_ITEM) || User::id() == CGlobal::$user_profile['id']); $status_check = User::id() == CGlobal::$user_profile['id'] || User::have_permit(ADMIN_ITEM) ? ' status IN(0,1,2,3,4,5)' : ' status =1'; if ($label_id) { $total_item = DB::fetch('SELECT count(*) AS total_row FROM label_item AS L JOIN item AS I ON L.item_id=I.id AND I.' . $status_check . ' AND I.user_id=' . CGlobal::$user_profile['id'] . ' WHERE L.user_id=' . CGlobal::$user_profile['id'] . ' AND L.label_id=' . $label_id, 'total_row', 0); } else { $total_item = DB::fetch('SELECT count(*) AS total_row FROM item WHERE ' . $status_check . ' AND user_id=' . CGlobal::$user_profile['id'], 'total_row', 0); } $pagging = ''; $items = array(); $divID = 'shop_item'; $item_per_page = 0; if ($total_item) { $item_per_page = 9; $limit = ''; $url_path = WEB_DIR . 'ajax.php?act=shop&code=load_shop_label&user_id=' . CGlobal::$user_profile['id'] . '&label_id=' . $label_id . (!$list_type ? '' : '&list_type=' . $list_type); $pagging = AZPagging::AjaxPaging($limit, $total_item, $item_per_page, 5, 'page_shop_item', '', false, false, $url_path, $divID, true); if ($label_id) { $display->add('label_name', CGlobal::$shop_label['name']); $select = 'SELECT I.id, I.name,I.sapo, I.user_name, I.user_id,I.description,I.category_id, I.read_count, I.reply_count, I.currency_id, I.price, I.province_id, I.up_time,I.price_out, I.brief, I.img_url, I.status, I.state, I.img_server FROM label_item AS L JOIN item AS I ON L.item_id=I.id AND I.' . $status_check . ' AND I.user_id=' . CGlobal::$user_profile['id'] . ' WHERE L.user_id=' . CGlobal::$user_profile['id'] . ' AND L.label_id=' . $label_id . ' ORDER BY shop_order, up_time DESC' . $limit; } else { $select = 'SELECT id, name, sapo, user_name, user_id, description, category_id, read_count, reply_count, currency_id, price, brief, img_url, province_id, up_time, price_out, status, state, img_server,sticky FROM item WHERE ' . $status_check . ' AND user_id=' . CGlobal::$user_profile['id'] . ' ORDER BY shop_order, up_time DESC' . $limit; } $re = DB::query($select); if (User::is_login()) { $wids = User::get_wishlist('wish_list_items'); $w_items = array(); if ($wids) { $w_items = explode(',', $wids); } } if ($re) { AZLib::getProvinces(); AZLib::getCats(); $item_ids = ''; while ($item = mysql_fetch_assoc($re)) { $item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']); $item['price_out'] = AZLib::convertCurrency($item['price_out'], $item['currency_id']); $item['currency_id'] = 1; if ($item['img_url']) { $item['image_url'] = AZLib::getImageThumb($item['img_url'], 200, 200, 0, $item['img_server']); } if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . AZLib::safe_title(AZLib::word_limit($item['name'], 12, '')) . '&nice_name=' . CGlobal::$allCategories[$item['category_id']]['nice_name']); } else { $item['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . AZLib::safe_title(AZLib::word_limit($item['name'], 12, ''))); } $tooltip = ''; $tooltip .= 'Xem: ' . $item['read_count'] . ' - Phản hồi: ' . $item['reply_count']; $item['time_label'] = ''; $up_time = date('H:i | ', $item['up_time']); if (date('d.m.y', $item['up_time']) == date('d.m.y', TIME_NOW)) { $up_time .= '<font color="green">Hôm nay</font>'; } else { $up_time .= date('d.m.y', $item['up_time']); } //$item['created_time'] = 'đăng '.AZLib::duration_time($item['up_time']); $item['created_time'] = $up_time; if ($item['price']) { $item['price'] = number_format($item['price'], 0, ',', '.'); $item['currency_id'] = CGlobal::$currency[$item['currency_id']]; } else { $item['price'] = ''; $item['currency_id'] = ''; } $item['price_title'] = 'Giá bán'; if ($item['price_out'] > 0) { $item['price_out'] = number_format($item['price_out'], 0, ',', '.') . ($item['currency_id'] == ' ' ? ' ' . CGlobal::$currency[$item['currency_id']] : ''); } else { $item['price_out'] = '0'; } $item['no_base_source'] = AZLib::remove_4_js(str_replace(array("<br>", "<br />"), '', $item['brief'])); $item['description'] = AZLib::plainText(AZLib::parseBBCode(html_entity_decode($item['description'], ENT_QUOTES, "UTF-8"))); $item['description'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $item['description']); $item['description'] = str_replace(array("'", "\""), array("", " "), $item['description']); $item['description'] = AZLib::word_limit($item['description'], 250, ''); /* if($item['sapo']!=''){ $item['brief'] = $item['sapo']; $item['brief'] = AZLib::subString(AZLib::filter_title($item['brief']),0,255,true); $item['brief'] = AZLib::word_limit($item['brief'],30,''); } else{ $item['brief'] = String::display_sort_title($item['description'],30); } */ $item['brief'] = ''; $item['parent_name'] = ''; if (isset(CGlobal::$allCategories[$item['category_id']]) && CGlobal::$allCategories[$item['category_id']]['parent_id']) { $parent_id = CGlobal::$allCategories[$item['category_id']]['parent_id']; if (isset(CGlobal::$allCategories[$parent_id])) { $item['parent_name'] = CGlobal::$allCategories[$parent_id]['name'] . ' - '; } } if (isset(CGlobal::$allCategories[$item['category_id']]['name'])) { $item['category_name'] = $item['parent_name'] . CGlobal::$allCategories[$item['category_id']]['name']; } else { $item['category'] = ''; $item['category_name'] = ''; } $item['safe_title'] = AZLib::safe_title($item['parent_name'] . $item['category_name']); $item['category_href'] = WEB_DIR . AZRewrite::formatUrl('?page=list_detail&category_id=' . $item['category_id'] . '&ebname=' . $item['safe_title']); $item['name'] = AZLib::subString(AZLib::filter_title($item['name']), 0, 115, true); $item['name'] = AZLib::word_limit($item['name'], 12, ''); $item['user_name'] = $item['user_name']; $item['profile_url'] = WEB_DIR . $item['user_name']; $item['city'] = CGlobal::$provinces[$item['province_id']]['name']; if ($item['img_url']) { $item['img_url'] = AZLib::getImageThumb($item['img_url'], 110, 0, 1, $item['img_server']); } else { $item['img_url'] = 'style/images/no-images-69x53.jpg'; } if (isset($_GET['ebname'])) { $item['up_url'] = Url::build_current(array('action' => 'up', 'id' => $item['id'], 'category_id' => CGlobal::$curCategory, 'type' => Url::get('type'), 'ebname' => $_GET['ebname'])); $item['down_url'] = Url::build_current(array('action' => 'down', 'id' => $item['id'], 'category_id' => CGlobal::$curCategory, 'type' => Url::get('type'), 'ebname' => $_GET['ebname'])); } else { $item['up_url'] = Url::build_current(array('action' => 'up', 'id' => $item['id'], 'category_id' => CGlobal::$curCategory, 'type' => Url::get('type'))); $item['down_url'] = Url::build_current(array('action' => 'down', 'id' => $item['id'], 'category_id' => CGlobal::$curCategory, 'type' => Url::get('type'))); } $item['in_wish_list'] = false; if (User::is_login()) { if (in_array($item['id'], $w_items)) { $item['in_wish_list'] = true; } else { $item['in_wish_list'] = false; } } else { if (isset($_COOKIE['wish_list_item_ids'])) { $arr = explode(',', $_COOKIE['wish_list_item_ids']); foreach ($arr as $k => $v) { if ($v == $item['id']) { $item['in_wish_list'] = true; } } } } if (CGlobal::$user_profile['id'] == User::id()) { $tooltip .= ' - <strong>ID tin: ' . $item['id'] . '</strong>'; } $item['invalid'] = ''; if ($item['status'] == 2) { $tooltip .= '<div style=\\\'color:red\\\'>(Đang kiểm duyệt)</div>'; $item['invalid'] = '<font color="red">(Đang kiểm duyệt)</font>'; } elseif ($item['status'] == 3) { $tooltip .= '<div style=\\\'color:red\\\'>(Tin theo dõi lừa đảo)</div>'; $item['invalid'] = '<font color="red">(Theo dõi lừa đảo)</font>'; } elseif ($item['status'] == 0) { $tooltip .= '<div style=\\\'color:red\\\'>(Đang ẩn)</div>'; $item['invalid'] = '<font color="red">(Đang ẩn)</font>'; } elseif ($item['status'] == 5) { $tooltip .= '<div style=\\\'color:red\\\'>(Đang kiểm duyệt chờ chứng thực)</div>'; $item['invalid'] = '<font color="red">(KD chờ chứng thực)</font>'; } elseif ($item['status'] == 4) { $tooltip .= '<div style=\\\'color:red\\\'>(Tin trùng)</div>'; $item['invalid'] = '<font color="red">(Tin trùng)</font>'; } elseif ($item['state'] == 1) { $tooltip .= '<div style=\\\'color:red\\\'>(Đang khóa)</div>'; $item['invalid'] = '<font color="red">(Đang khóa)</font>'; } $item['tooltip'] = $tooltip; $item['lids'] = ''; $item_ids .= ($item_ids != '' ? ',' : '') . $item['id']; $items[$item['id']] = $item; } } if ($item_ids) { $item_labels = array(); //Label của tất cả sp đang đc hiển thị $re = DB::query("SELECT id, label_id, item_id FROM label_item WHERE item_id IN({$item_ids})"); if ($re) { while ($l_item = mysql_fetch_assoc($re)) { if (isset($items[$l_item['item_id']])) { $items[$l_item['item_id']]['lids'] .= ($items[$l_item['item_id']]['lids'] != '' ? ',' : '') . $l_item['label_id']; } } } } } $display->add('loading_ajax', true); $display->add('is_admin', (int) User::have_permit(ADMIN_ITEM)); $display->add('cur_id', (int) User::id()); $display->add('total_sp', (int) $total_item); $display->add('items', $items); $display->add('paging', $pagging); $display->add('item_per_page', $item_per_page); $display->add('page_num', $page_shop_item); $display->add('shop_user_id', CGlobal::$user_profile['id']); $display->add('shop_user_name', CGlobal::$user_profile['user_name']); $display->output($list_type != 1 ? 'ShopItem' : 'ShopItemListDetail', false, 'Shop'); }