本文整理汇总了PHP中AZLib::parseBBCode方法的典型用法代码示例。如果您正苦于以下问题:PHP AZLib::parseBBCode方法的具体用法?PHP AZLib::parseBBCode怎么用?PHP AZLib::parseBBCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AZLib
的用法示例。
在下文中一共展示了AZLib::parseBBCode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw
function draw()
{
global $display;
$item_ids = '';
$item_news = array();
$configs = @CGlobal::$configs['ItemNew']['conf_val'];
if ($configs) {
$configs = unserialize(stripslashes($configs));
$title_new = $configs['title'];
$item_ids = $configs['item_ids'];
} else {
$title_new = "SẢN PHẨM MỚI";
$item_ids = '';
}
if ($item_ids) {
$re = DB::query("SELECT * FROM item WHERE id IN({$item_ids}) AND status = 1 ORDER BY find_in_set(id,'{$item_ids}')");
if ($re) {
while ($product = mysql_fetch_assoc($re)) {
if ($product['img_url']) {
$product['image'] = AZLib::getImageThumb($product['img_url'], 160, 150, 0, $product['img_server']);
} else {
$product['image'] = "";
//"style/images/no-images-35x35.gif";
}
if (isset(CGlobal::$allCategories[$product['category_id']])) {
$product['url'] = WEB_DIR . CGlobal::$allCategories[$product['category_id']]['nice_name'] . "/p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
} else {
$product['url'] = WEB_DIR . "p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
}
$product['name'] = stripslashes($product['name']);
if ($product['list_brief'] == '') {
$product['list_brief'] = $product['brief'];
}
$product['list_brief'] = AZLib::remove_4_js(AZLib::plainText(AZLib::parseBBCode(html_entity_decode($product['list_brief'], ENT_QUOTES, "UTF-8"))));
$product['list_brief'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $product['list_brief']);
$product['list_brief'] = str_replace(array("'", "\""), array("", " "), $product['list_brief']);
$product['list_brief'] = AZLib::word_limit($product['list_brief'], 50, '');
$product['list_brief'] = '<b>' . str_replace(array("'", "\""), array("", " "), $product['name']) . '</b><br />' . $product['list_brief'];
$product['price_num'] = $product['price'];
$product['price'] = AZLib::getPrice($product['price'], $product['currency_id']);
$item_news[$product['id']] = $product;
}
}
}
if (User::is_admin()) {
$display->add("is_admin", 1);
$display->add("msg", $this->showFormErrorMessages(1));
$display->add('begin_form', $this->beginForm(true, 'post', false, false, 1));
$display->add('end_form', $this->endForm(true));
}
$display->add('title_new', $title_new);
$display->add('item_ids', $item_ids);
$display->add('item_news', $item_news);
$display->output("ItemNew");
}
示例2: Send_pm
static function Send_pm($sender_id, $sender_name, $receiver_user, $title, $content, $once_way = false, $ref_id = 0)
{
$num_send = 0;
$new_row_msg = array('msg_date' => TIME_NOW, 'msg_post' => htmlspecialchars_decode($content), 'msg_author_id' => $sender_id, 'msg_author_name' => $sender_name, 'msg_ip_address' => AZLib::ip());
// ***** CHÚ Ý *****
// Newest = 0 - Mới nhất, = 1 - Cũ hơn (Do lỗi tạo giá trị mặc định trường này là 0, nên quy ước hơi bị ngược, để đỡ mất công chạy lệnh update database
// ***** CHÚ Ý *****
$msg_id = DB::insert('message_text', $new_row_msg);
$inbox_ref_id = 0;
if ($ref_id) {
$msgText = DB::select('message_topics', 'mt_id = ' . $ref_id . ' AND mt_owner_id = ' . $sender_id);
if ($msgText['mt_msg_id']) {
// Kiểm tra xem người nhận còn tin nhắn gốc hay không
$mtTopic = DB::select('message_topics', 'mt_msg_id = ' . $msgText['mt_msg_id'] . ' AND mt_id <> ' . $ref_id . ' AND mt_owner_id = ' . $receiver_user['id'] . ' AND mt_from_id <> ' . $receiver_user['id']);
// Nế còn tin nhắn gốc
if ($mtTopic['mt_id']) {
// Gán tin nhắn sắp gửi là tin nhắn mới nhất
// Lấy id tin nhắn gốc của người gửi làm ref_id cho tin nhắn sắp gửi
$inbox_ref_id = $mtTopic['mt_id'];
}
}
}
// Đặt cờ tin nhắn mới nhất (inbox) của các tin trong luồng của người nhận = 0
if ($inbox_ref_id) {
DB::query('UPDATE message_topics SET mt_newest = 1 WHERE mt_newest = 0 AND mt_vid_folder = \'inbox\' AND (mt_ref_id = ' . $inbox_ref_id . ' OR mt_id = ' . $inbox_ref_id . ') AND mt_owner_id = ' . $receiver_user["id"]);
}
// Đặt cờ tin nhắn mới nhất (sent) của các tin trong luồng của người gửi = 0
if ($ref_id) {
DB::query('UPDATE message_topics SET mt_newest = 1 WHERE mt_newest = 0 AND mt_vid_folder = \'sent\' AND (mt_ref_id = ' . $ref_id . ' OR mt_id = ' . $ref_id . ') AND mt_owner_id = ' . $sender_id);
}
$new_row_msg = array('mt_msg_id' => $msg_id, 'mt_date' => TIME_NOW, 'mt_title' => $title, 'mt_ref_id' => $inbox_ref_id, 'mt_newest' => 0, 'mt_to_name' => $receiver_user["user_name"], 'mt_read' => 0);
$arrID = array($sender_id, $sender_name, $receiver_user["id"], $receiver_user["user_name"]);
// Tạo tiêu đề tin nhắn mới
$msg_id_inbox = AZLib::InserMessage($new_row_msg, $arrID, $status = 'inbox');
if ($msg_id_inbox) {
$num_send++;
//insert vao bang feed
$feed_sql = "(4,{$receiver_user['id']},{$msg_id_inbox},{$new_row_msg['mt_date']},{$sender_id},0)";
$feed_sql = "INSERT INTO feed (`type`,`user_id`,`ref_id`,`time`,`act_user_id`,`item_id`) VALUES " . $feed_sql;
DB::query($feed_sql);
}
if ($once_way == false) {
$new_row_msg['mt_read'] = 1;
$new_row_msg['mt_ref_id'] = $ref_id;
$msg_id_sent = AZLib::InserMessage($new_row_msg, $arrID, $status = 'sent');
$num_send++;
} else {
$msg_id_sent = true;
}
// Nếu tin được tạo mới là tin nhắn trả lời
//if($inbox_ref_id)
//{
// Đặt cờ đã có tin nhắn trả lời cho tin nhắn gốc trong cả "inbox" và "sent"
//DB::query(' UPDATE message_topics SET mt_has_reply = 1 WHERE mt_id = ' . $ref_id . ' AND mt_vid_folder = \'inbox\'');
// DB::query(' UPDATE message_topics SET mt_has_reply = 1 WHERE mt_id = ' . $inbox_ref_id);
//}
if ($msg_id_inbox && $msg_id_sent) {
$count_pm = true;
// Đối với tin trả lời, chỉ đếm những tin trả lời mới cho tin thuộc các luồng tin khác nhau
if ($ref_id) {
// Kiểm tra xem trong luồng tin hiện tại có tin trả lời nào chưa đọc hay không
$re = DB::query('SELECT COUNT(*) AS unreadCount FROM message_topics
WHERE mt_ref_id = ' . $ref_id . '
AND mt_vid_folder = \'inbox\' AND mt_owner_id = ' . $receiver_user["id"] . '
AND mt_read = 0');
if ($re) {
$row = mysql_fetch_assoc($re);
// Nếu có thì không tính thêm tin này vào tổng pm
if ($row['unreadCount'] > 1) {
$count_pm = false;
}
}
}
if ($count_pm) {
DB::query('UPDATE user SET total_pm = total_pm + 1 WHERE id=' . $receiver_user["id"]);
}
User::getUser($receiver_user["id"], 0, 1);
DB::query("UPDATE message_text SET msg_sent_to_count = {$num_send} WHERE msg_id = {$msg_id}");
if ($receiver_user['email'] && $receiver_user['email_alert']) {
$link = WEB_ROOT . Url::build('message');
$content = trim(addslashes(AZLib::parseBBCode($title . ' - ' . $content, true)));
AZLib::addCronJob('pm', $content, $receiver_user['id'], User::user_name(), '', 0, '', $link);
}
return true;
} else {
return false;
}
}
示例3: transaction
function transaction()
{
// viet luu but
header("Content-type: application/xml");
if (!User::is_login()) {
echo "<comments><content>no_login</content></comments>";
exit;
} else {
if (User::is_block()) {
echo "<comments><content>no_perm</content></comments>";
exit;
}
if (AZLib::isBlackList(User::$current->data['id'], AZLib::getParam('user_id'))) {
echo "<comments><content>blacklist</content></comments>";
exit;
}
if (AZLib::checkBadWord(AZLib::getParam('content'))) {
echo "<comments><content>bad_word</content></comments>";
exit;
}
$user_id = AZLib::getParam('user_id');
if (!($user = User::getUser($user_id))) {
echo "<comments><content>no_perm</content></comments>";
exit;
}
$content = preg_replace("/\n/", "<br />", Url::get('content'));
$content = str_replace('<br /><br />', ' ', $content);
$comment_content = $content;
$id = DB::insert('comment_user', array('content' => $comment_content, 'time' => TIME_NOW, 'post_ip' => AZLib::ip(), 'sender_user_id' => User::id(), 'sender_user_name' => User::user_name(), 'receiver_user_id' => $user['id'], 'receiver_user_name' => $user['user_name'], 'is_read' => 0));
if ($id) {
DB::query('UPDATE user set total_comment_user=total_comment_user+1 WHERE id=' . $user['id']);
// so luu but
User::getUser($user['id'], 0, 1);
if ($user['email'] && $user['email_alert'] && $user['id'] != User::id()) {
//Add to cron job:
$link = WEB_ROOT . AZRewrite::formatUrl('?page=shop&user_name=' . $user['user_name'] . '&mode=comment');
AZLib::addCronJob('user_comment', AZLib::parseBBCode($comment_content, true), $user['id'], User::user_name(), '', 0, '', $link);
}
}
$time = $up_time = date('H:i | ');
$xml = "<comments><content><![CDATA[" . AZLib::parseBBCode($comment_content) . "]]></content><post_time>{$time}</post_time></comments>";
echo $xml;
System::halt();
}
}
示例4: action_reply_entry_comment
function action_reply_entry_comment()
{
$act_ = Url::get('act_');
$comment_id = (int) Url::get('re_c_entry_id', 0);
$content = '';
$json = "";
if (!User::is_login()) {
$json = '({"msg":"no_login"})';
echo $json;
exit;
}
if (User::is_block() || !$comment_id || $act_ != 'skip' && $act_ != 'reply') {
$json = '({"msg":"no_perm"})';
echo $json;
exit;
}
$comment_row = DB::select('user_entry_comment', "id={$comment_id}");
if (!$comment_row || $comment_row && $comment_row['replied_user_id'] != User::id()) {
$json = '({"msg":"no_perm"})';
echo $json;
exit;
}
if ($comment_row['parent_id'] == 0 || $comment_row['receiver_user_id'] == User::id() || $comment_row['sender_user_id'] == User::id() || $act_ == 'reply' && $comment_row['replied_status'] == 1) {
//Không được trả lời cho chính mình! hoặc trả lời phản hồi đã đc trả lời rồi!
$json = '({"msg":"success"})';
echo $json;
exit;
}
$entry_id = $comment_row['entry_id'];
$entry = DB::select('user_entry', "id={$entry_id}");
if (!$entry || $entry && $entry['status'] == 0) {
$json = '({"msg":"no_perm"})';
echo $json;
exit;
}
$json = '({"msg":"success"';
if ($act_ == 'reply') {
$content = trim(AZLib::getParam('content'));
if (!$content) {
$json = '({"msg":"short_content"})';
echo $json;
exit;
}
if (AZLib::checkBadWord($content)) {
$json = '({"msg":"bad_word"})';
echo $json;
exit;
}
$content = preg_replace("/\n/", "<br />", $content);
$content = str_replace('<br /><br />', ' ', $content);
$parent_id = $comment_row['parent_id'];
if ($comment_row['sender_user_id']) {
$content = '@<a href="' . WEB_DIR . $comment_row['sender_user_name'] . '" class="fast_reply_link" title="' . $comment_row['sender_user_name'] . '">' . $comment_row['sender_user_name'] . '</a>: ' . $content;
} else {
$content = '<font color="#999">@<span style="text-decoration:underline">' . $comment_row['sender_user_name'] . '</span> </font>: ' . $content;
}
$comment = array('time' => time(), 'post_ip' => AZLib::ip(), 'content' => $content, 'entry_id' => $entry['id'], 'order_time' => time(), 'parent_id' => $parent_id, 'receiver_user_id' => $entry['user_id'], 'receiver_user_name' => $entry['user_name'], 'display' => 1, 'status' => 1);
$comment['sender_user_id'] = User::id();
$comment['sender_user_name'] = User::user_name();
if ($comment_row['sender_user_id']) {
$comment['replied_user_id'] = $comment_row['sender_user_id'];
$comment['replied_user_name'] = $comment_row['sender_user_name'];
}
$id = DB::insert('user_entry_comment', $comment);
if ($id) {
$re = DB::query("SELECT id FROM user_entry_comment WHERE parent_id = {$parent_id} AND display = 1 ORDER BY id DESC LIMIT 3,1");
if ($re) {
if ($row = mysql_fetch_assoc($re)) {
if ($row) {
DB::query("UPDATE user_entry_comment SET display = 0 WHERE parent_id = {$parent_id} AND display = 1 AND id<={$row['id']}");
}
}
}
if ($comment_id == $parent_id) {
DB::query("UPDATE user_entry_comment SET replied_status = 1,have_child = have_child + 1, order_time = " . time() . " WHERE id = {$comment_id}");
} else {
DB::query("UPDATE user_entry_comment SET have_child = have_child + 1, order_time = " . time() . " WHERE id = {$parent_id}");
DB::query("UPDATE user_entry_comment SET replied_status = 1 WHERE id = {$comment_id}");
}
//Cập nhật đã đọc - trả lời cho feed
DB::query("UPDATE feed SET status=1 WHERE ref_id = {$comment_id} AND type=6");
}
//Cập nhật cron job
$user_item = User::getUser($entry['user_id']);
if ($user_item['email'] && $user_item['email_alert'] && $user_item['id'] != User::id()) {
$link = WEB_ROOT . '?page=user_entry&user_name=' . $entry['user_name'] . '&cmd_entry=view&entry_id=' . $entry['id'] . '&ebname=' . AZLib::safe_title($entry['title']);
$link = AZRewrite::formatUrl($link);
$title = "<a href='{$link}' target='_blank' style='text-decoration:none;color:#003399;'><font color='#003399'>{$entry['title']}</font></a>";
AZLib::addCronJob('entry_comment', AZLib::parseBBCode($content, true), $user_item['id'], User::user_name(), '', $entry['id'], $title, $link);
}
} else {
if ($comment_row['replied_status'] == 0) {
DB::query("UPDATE user_entry_comment SET replied_status = 1 WHERE id = {$comment_id}");
}
//Cập nhật đã đọc - trả lời cho feed
DB::query("UPDATE feed SET status=1 WHERE ref_id = {$comment_id} AND type=6");
}
$json .= "})";
echo $json;
exit;
//.........这里部分代码省略.........
示例5: show_mes_outbox
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 = '<a href="' . $row["mt_owner_name"] . '">' . $row["mt_owner_name"] . '</a>';
} else {
$strUser = '<a href="' . $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>';
//.........这里部分代码省略.........
示例6: draw
//.........这里部分代码省略.........
$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');
}
示例7: processItem
function processItem($item, $admin_item)
{
if (isset(CGlobal::$allCategories[$item['category_id']])) {
$item['href'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
} else {
$item['href'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
}
$item['modify_time'] = date('H:i | d.m.y', $item['modify_time']);
$item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']);
$item['price_out'] = AZLib::convertCurrency($item['price_out'], $item['currency_id']);
$item['currency_id'] = 1;
$item['price_num'] = (int) $item['price'];
if ($item['price']) {
$item['price'] = number_format($item['price'], 0, ',', '.');
} else {
$item['price'] = '';
}
$item['price_title'] = 'Giá bán';
if ($item['price_out'] > 0) {
$item['price_out'] = number_format($item['price_out'], 0, ',', '.') . ($item['currency_id'] == ' ' ? ' ' . CGlobal::$currency[$item['currency_id']] : '');
} else {
$item['price_out'] = '0';
}
//$item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']);
//$item['price_out'] = AZLib::convertCurrency($item['price_out'], $item['currency_id']);
if ($admin_item) {
$item['description'] = AZLib::remove_4_js(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'], 200, '');
}
$item['name'] = AZLib::filter_title($item['name']);
if ($item['img_url']) {
$item['img_thumb_wl'] = AZLib::getImageThumb($item['img_url'], 180, 0, 1, $item['img_server']);
} else {
$item['img_url'] = '';
}
if (!CGlobal::$curLevel2Cat) {
if (isset(CGlobal::$allCategories[$item['category_id']])) {
$item['cat_name'] = CGlobal::$allCategories[$item['category_id']]['name'];
} else {
$item['cat_name'] = "ID: {$item['category_id']}";
}
}
return $item;
}
示例8: get_comment
function get_comment($sql, $sub = 0)
{
global $user_id_arr, $stt, $item_per_page;
$re = DB::query($sql);
$items = array();
$id_parent = '';
while ($item = mysql_fetch_assoc($re)) {
if ($sub == 0) {
$stt++;
}
if ($sub || $sub == 0 && $stt <= $item_per_page) {
//$item['created_time'] = AZLib::duration_time($item['time']);
$item['created_time'] = date('H:i | d.m.Y', $item['time']);
if ($item['sender_user_id']) {
$item['sender_link'] = Url::build('shop', array('user_name' => $item['sender_user_name']));
} else {
$item['sender_link'] = '';
}
if ($item['sender_user_id']) {
$item['user_id'] = $item['sender_user_id'];
if (!in_array($item['sender_user_id'], $user_id_arr)) {
$user_id_arr[$item['sender_user_id']] = $item['sender_user_id'];
}
} else {
$item['user_id'] = 0;
if ($item['id'] % 3 == 0) {
$item['sender_avatar_url'] = 'style/images/avatar_01.gif';
} elseif ($item['id'] % 3 == 1) {
$item['sender_avatar_url'] = 'style/images/avatar_02.gif';
} else {
$item['sender_avatar_url'] = 'style/images/avatar_03.gif';
}
$html_content = '';
$item['is_block'] = 0;
$item['is_admin_mod'] = array();
}
$item['content'] = AZLib::parseBBCode($item['content']);
$item['URL_badcontent'] = Url::build('item_detail', array('id' => Url::get('id'), 'ctype' => 'comment', 'id_comment' => $item['id']));
if ($sub) {
$items['item'][$item['parent_id']][$item['id']] = $item;
} else {
if ($item['have_child'] > 0) {
$id_parent .= ($id_parent ? ',' : '') . $item['id'];
}
$items['item'][$item['id']] = $item;
}
$items['id_parent'] = $id_parent;
}
}
return $items;
}
示例9: load_shop_label
//.........这里部分代码省略.........
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'];