Example #1
0
 function getCommentSubItem()
 {
     global $display;
     $winner = array();
     global $user_id_arr, $stt, $item_per_page;
     $stt = 0;
     $is_admin_mod = array();
     $user_arr = array();
     $user_id_arr = array();
     $items = array();
     $limit = '';
     $subItemId = Url::get('subItemId');
     $divID = 'comment_list';
     $cmd = 'pagging_comment';
     $url_path = WEB_DIR . "ajax.php?act=comment&code=getCommentSubItem&show_all=1&id={$subItemId}&cmd=" . $cmd;
     $item_per_page = 100;
     $display->add('show_all', true);
     $pagging = ECPagging::fb_pagging($limit, $item_per_page, true, 'fb_page', $url_path, $divID);
     $sql = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id, have_child,receiver_user_id,sub_item_id FROM comment WHERE sub_item_id=" . $subItemId . "  AND parent_id = 0 ORDER BY order_time DESC {$limit}";
     /*Đếm tổng số comment cho SubItem*/
     $select_comment_count = "SELECT comment_count FROM item_sub WHERE id={$subItemId} LIMIT 1";
     $subItemResult = DB::fetch($select_comment_count);
     $comment_count = 0;
     if (isset($subItemResult['comment_count']) && $subItemResult['comment_count'] > 0) {
         $comment_count = $subItemResult['comment_count'];
     }
     $display->add('comment_count', $comment_count);
     /*End comment count*/
     $allItems = $this->get_comment_thoitrang($sql);
     if ($allItems) {
         $items = $allItems['item'];
         if ($allItems['id_parent']) {
             $sql_sub = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id,parent_id,receiver_user_id,sub_item_id FROM comment WHERE parent_id IN({$allItems['id_parent']})  ORDER BY order_time DESC";
             $subComment_all = $this->get_comment_thoitrang($sql_sub, 1);
             if ($subComment_all) {
                 $sub_comments = $subComment_all['item'];
                 foreach ($sub_comments as $id => $subs) {
                     if (isset($items[$id])) {
                         $items[$id]['sub_comment'] = $subs;
                     }
                 }
             }
         }
         unset($allItems);
     }
     if ($stt <= $item_per_page) {
         $pagging = ECPagging::fb_pagging($limit, $item_per_page, false, 'fb_page', $url_path, $divID);
         $display->add('show_fb_page', false);
     } else {
         $display->add('show_fb_page', true);
     }
     if ($user_id_arr) {
         $uid = implode(',', $user_id_arr);
         if ($uid != '') {
             $re = DB::query("SELECT id, avatar_url, gids, block_time, img_server FROM account WHERE id IN({$uid})");
             if ($re) {
                 while ($user = mysql_fetch_assoc($re)) {
                     $user_arr[$user['id']] = $user;
                 }
             }
         }
     }
     if ($items && $user_arr) {
         foreach ($items as &$item) {
             $item['content'] = $this->process_description($item['content']);
             if (isset($item['sub_comment']) && $item['sub_comment']) {
                 foreach ($item['sub_comment'] as &$sub_item) {
                     if ($sub_item['sender_user_id']) {
                         if (isset($user_arr[$sub_item['sender_user_id']])) {
                             $sub_item['avatar_url'] = $user_arr[$sub_item['sender_user_id']]['avatar_url'];
                             $sub_item['block_time'] = $user_arr[$sub_item['sender_user_id']]['block_time'];
                             $sub_item['gids'] = $user_arr[$sub_item['sender_user_id']]['gids'];
                             $sub_item['img_server'] = $user_arr[$sub_item['sender_user_id']]['img_server'];
                         }
                         if ($sub_item['avatar_url']) {
                             $sub_item['sender_avatar_url'] = EClassApi::getImageThumb($sub_item['avatar_url'], 60, 0, 1, $sub_item['img_server']);
                             if ($sub_item['parent_id'] > 0) {
                                 $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="40" class="lazyload"/></a>';
                             } else {
                                 $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="40" class="lazyload"/></a>';
                             }
                         } else {
                             $sub_item['sender_avatar_url'] = 'style/avatar/1.png';
                             $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="style/avatar/1.png" width="40" height="40" class="lazyload"/></a>';
                         }
                         if ($sub_item['block_time'] > TIME_NOW) {
                             $sub_item['is_block'] = 1;
                         } else {
                             $sub_item['is_block'] = 0;
                         }
                         $sub_item['htmlContent'] = $html_content;
                         //set quyen quan tri
                         if ($sub_item['gids']) {
                             $is_admin_mod = CGlobal::$group[User::check_admin($sub_item['gids'])];
                         } else {
                             $is_admin_mod = array();
                         }
                         $sub_item['is_admin_mod'] = $is_admin_mod;
                     }
                 }
             }
             if ($item['sender_user_id']) {
                 if (isset($user_arr[$item['sender_user_id']])) {
                     $item['avatar_url'] = $user_arr[$item['sender_user_id']]['avatar_url'];
                     $item['block_time'] = $user_arr[$item['sender_user_id']]['block_time'];
                     $item['gids'] = $user_arr[$item['sender_user_id']]['gids'];
                     $item['img_server'] = $user_arr[$item['sender_user_id']]['img_server'];
                 }
                 if ($item['avatar_url']) {
                     $item['sender_avatar_url'] = EClassApi::getImageThumb($item['avatar_url'], 60, 0, 1, $item['img_server']);
                     $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="40"/></a>';
                 } else {
                     $item['sender_avatar_url'] = 'style/avatar/1.png';
                     $html_content = '<a href="' . $item['sender_link'] . '"><img src="style/avatar/1.png" width="40" height="40" /></a>';
                 }
                 $item['htmlContent'] = $html_content;
                 if ($item['block_time'] > TIME_NOW) {
                     $item['is_block'] = 1;
                 } else {
                     $item['is_block'] = 0;
                 }
                 //set quyen quan tri
                 if ($item['gids']) {
                     $is_admin_mod = CGlobal::$group[User::check_admin($item['gids'])];
                 } else {
                     $is_admin_mod = array();
                 }
                 $item['is_admin_mod'] = $is_admin_mod;
             }
         }
     }
     $account = null;
     if (User::is_login() && Item::$item['user_id'] == User::id()) {
         $account = User::$current->data;
     } else {
         if (isset(Item::$item['user_id'])) {
             $account = User::getUser(Item::$item['user_id']);
         }
         if (!$account) {
             $account = array('id' => 0, 'user_name' => '', 'create_time' => '', 'blast' => '', 'email' => '', 'show_email' => '', 'skype_id' => '', 'yahoo_id' => '');
         }
     }
     if (User::is_login()) {
         if (User::$current->data['mobile_phone'] != '') {
             $display->add('user_phone', true);
             $user_phone = User::$current->data['mobile_phone'];
         } elseif (User::$current->data['home_phone'] != '') {
             $display->add('user_phone', true);
             $user_phone = User::$current->data['home_phone'];
         } else {
             $display->add('user_phone', false);
             $user_phone = '';
         }
         $display->add('cur_user_name', User::$current->data['user_name']);
         $display->add('cur_created_time', User::$current->data['create_time']);
         $cur_user_name = User::$current->data['user_name'];
         $cur_created_time = User::$current->data['create_time'];
         if (User::$current->data['avatar_url'] == '') {
             $cur_avatar_url = 'style/avatar/1.png';
         } else {
             $cur_avatar_url = EClassApi::getImageThumb(User::$current->data['avatar_url'], 60, 0, 1, User::$current->data['img_server']);
         }
     } else {
         $cur_user_name = '';
         $cur_created_time = '';
         $user_phone = '';
         $cur_avatar_url = 'style/avatar/1.png';
         $display->add('cur_user_name', '');
         $display->add('cur_created_time', '');
         $display->add('check_user_name', '');
         $display->add('user_phone', false);
     }
     $guest_name = 'Số điện thoại';
     $guest_email = 'Email';
     if (isset($_COOKIE['guest_name'])) {
         if ($_COOKIE['guest_name'] == 'undefined' || $_COOKIE['guest_email'] == 'undefined') {
             $guest_name = 'Số điện thoại';
             $guest_email = 'Email';
         } else {
             $guest_name = $_COOKIE['guest_name'];
             $guest_email = $_COOKIE['guest_email'];
         }
     }
     $display->add('cur_user_name', $cur_user_name);
     $display->add('guest_name', $guest_name);
     $display->add('guest_email', $guest_email);
     $display->add('check_user_name', $account['user_name']);
     $display->add('cur_id', (int) User::id());
     $display->add('pagging', $pagging);
     $display->add('item_comments', $items);
     $display->add('item_id', Item::$item['id']);
     $display->add('category_id', Item::$item['category_id']);
     $display->add('item_name', Item::$item['name']);
     //rewrite URL
     $display->add('name_url', EClassApi::safe_title(Item::$item['name']));
     //End rewrite URL
     if (strtolower(Url::get('page')) == 'allfeedback' || Url::get('cmd') == $cmd) {
         echo '<div id="totalReplyCount" style="display:none;">' . @Item::$item['reply_count'] . '</div>';
     }
     $display->output('AllFeedbackList', false, 'AllFeedback');
 }
Example #2
0
 function fn_reset_pas()
 {
     $user_id = EClassApi::getParam('user_id');
     $user = User::getUser($user_id);
     if (!$user_id || !$user || !User::have_permit(user_all_perm) || !User::is_root()) {
         echo "no_perm";
         exit;
     }
     $gid = User::check_admin($user['gids']);
     if ($user_id != User::id() && ($gid == 9 || $gid == 1 && !User::is_root())) {
         //root ko đc đổi pass của root, admin ko đc đổi pass admin
         echo "no_perm";
         exit;
     }
     $checked = EClassApi::getParam('checked');
     //EClassApi::getParam('pas');//Chú ý đối với mật khẩu ko đc dùng qua hàm này vì dữ liệu sẽ bị biến dạng
     $pas = Url::get('pas');
     $user_name = $user['user_name'];
     if ($checked == 'on') {
         $messenger = file_get_contents(CGlobal::$curTemplate['folder'] . 'ForgotPassword/reset_password.html');
         $message = str_replace('[[|user_name|]]', $user_name, $messenger);
         $message = str_replace('[[|password|]]', $pas, $message);
         $subject = 'Khôi phục mật khẩu!';
         $row = DB::fetch('SELECT email FROM account WHERE id="' . $user_id . '"');
         if (System::sendEBEmail($row['email'], $subject, $message)) {
             $id_update = DB::update('account', array('password' => User::encode_password($pas)), "id ={$user_id}");
             if ($id_update) {
                 echo "success";
                 exit;
             }
         } else {
             echo "unsuccess";
             exit;
         }
     } else {
         $id_update = DB::update('account', array('password' => User::encode_password($pas)), 'id ="' . $user_id . '"');
         if ($id_update) {
             echo "success";
             exit;
         }
     }
 }
Example #3
0
    function get_more_comment()
    {
        $parent_id = AZLib::getParam('comment_id');
        $item_user_name = AZLib::getParam('item_user_name');
        $entry_id = AZLib::getParam('entry_id');
        //$cat_id  	= AZLib::getParam('cat_id');
        $guest_email = AZLib::getParam('guest_email');
        $guest_name = AZLib::getParam('guest_name');
        $cur_id = AZLib::getParam('cur_id', 0);
        $item_user_id = AZLib::getParam('user_id');
        $show_guest_email = User::have_permit(ADMIN_ITEM) || User::id() == $item_user_id;
        $sql = 'SELECT `user_entry_comment`.`id`, `time`, `content`, `entry_id`, `sender_email`, `sender_user_name`, `receiver_user_name`,`sender_user_id`, `receiver_user_id`, `parent_id`, `have_child`, user.avatar_url, user.id as user_id, user.gids, user.block_time, user.img_server FROM `user_entry_comment` LEFT JOIN `user` ON user.id=user_entry_comment.sender_user_id
					WHERE `user_entry_comment`.`parent_id` =' . $parent_id . ' AND `user_entry_comment`.`display`=0 ORDER BY time DESC LIMIT 0,100';
        $re = DB::query($sql);
        $i = 0;
        $result = '';
        $str_user_id = '';
        while ($item = mysql_fetch_assoc($re)) {
            $item['index'] = $i;
            $i++;
            if ($item['block_time'] > TIME_NOW) {
                $item['is_block'] = 1;
            } else {
                $item['is_block'] = 0;
            }
            $str_user_id .= ($str_user_id != '' ? ',' : '') . $item['sender_user_id'];
            //set quyen quan tri
            if ($item['gids']) {
                $is_admin_mod = CGlobal::$group[User::check_admin($item['gids'])];
            } else {
                $is_admin_mod = array();
            }
            $item['is_admin_mod'] = $is_admin_mod;
            if (TIME_NOW - $item['time'] < 24 * 3600) {
                $time_left = TIME_NOW - $item['time'];
                $hour = floor($time_left / 3600);
                $day = '';
                $minute = floor($time_left % 3600 / 60) . ' phút';
                $time_left = ($hour ? $hour . ' giờ ' : '') . $minute;
                if ($time_left == 0) {
                    $time_left = 'Vài giây';
                }
                $item['created_time'] = $time_left . ' trước';
            } elseif (date('Y') != date('Y', $item['time'])) {
                $item['created_time'] = date('H:i | d.m.Y', $item['time']);
            } else {
                $item['created_time'] = date('H:i | d.m', $item['time']);
            }
            $item['content'] = AZLib::parseBBCode($item['content']);
            if ($item['sender_user_id']) {
                $item['sender_link'] = Url::build('shop', array('user_name' => $item['sender_user_name']));
            } else {
                $item['sender_link'] = '';
            }
            if (User::have_permit(ADMIN_ITEM)) {
                $item['del_link'] = Url::build_current(array('cmd' => 'del_comment', 'id' => $item['entry_id'], 'cid' => $item['id']));
            } else {
                $item['del_link'] = '';
            }
            $item['URL_badcontent'] = Url::build('item_detail', array('id' => Url::get('id'), 'ctype' => 'comment', 'id_comment' => $item['id']));
            $result .= '<tr id="' . $item['id'] . '"';
            if ($item['user_id'] != $cur_id && $item['sender_user_id'] != 0) {
                $result .= ' onmouseover="show_hide_menu(' . $item['id'] . ')" onmouseout="show_hide_menu(' . $item['id'] . ')" ';
            }
            $result .= '><td width="28" align="right" valign="top"><div style="height:5px"><span></span></div>';
            if ($item['sender_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 = '';
                $result .= '<div class="feedbackAvatarSub" id="avatar_content_' . $item['user_id'] . '"><img src="' . $item['sender_avatar_url'] . '" width="25" height="25" /></div>';
            } else {
                if ($item['avatar_url']) {
                    $item['sender_avatar_url'] = AZLib::getImageThumb($item['avatar_url'], 60, 0, 1, $item['img_server']);
                    if ($item['parent_id'] > 0) {
                        $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="25"/></a>';
                    } else {
                        $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="50"/></a>';
                    }
                } else {
                    $item['sender_avatar_url'] = '';
                    if ($item['parent_id'] > 0) {
                        $html_content = '<a href="' . $item['sender_link'] . '"><img src="style/images/50x50.gif" width="25" height="25" /></a>';
                    } else {
                        $html_content = '<a href="' . $item['sender_link'] . '"><img src="style/images/50x50.gif" width="50" height="50" /></a>';
                    }
                }
                $result .= '<div class="profile_load"  id="u' . $item['user_id'] . '"><div class="feedbackAvatarSub" ';
                $result .= ' id="avatar_content_' . $item['user_id'] . '"><div class="bubbleInfo"><div class="commentAva trigger">' . $html_content . '</div><!-- BEGIN POPUP MENU --><div class="popup" style="text-align: left;"><div class="show_mini_profile_u' . $item['user_id'] . '" style="display:none;"><div class="show_mini_profile_' . $item['user_id'] . '"></div></div><div class="hide_mini_profile_u' . $item['user_id'] . '"><div class="contentPop" style="background-color:#fff"><div style="margin:4px;"><div class="blastTopLeft"><div class="blastTopRight"><div class="blastTopbg"><span></span></div></div></div><div class="blast"><img src="style/images/ajax-loader4.gif" width="62" height="13" /></div><div class="blastBottomLeft"><div class="blastBottomRight"><div class="blastBottombg"><span></span></div></div></div></div></div></div></div><!--END POPUP MENU --></div></div></div>';
            }
            $result .= '</td><td valign="top"><div class="contentFeedback" align="left"><div ';
            if (isset($item['is_admin_mod']['id']) && ($item['is_admin_mod']['id'] == 9 || $item['is_admin_mod']['id'] == 1)) {
                $result .= ' class="topFeedback_admin" ';
            } elseif (isset($item['is_admin_mod']['id']) && ($item['is_admin_mod']['id'] == 2 || $item['is_admin_mod']['id'] == 3)) {
                $result .= ' class="topFeedback_mod" ';
            } elseif ($item['sender_user_name'] == $item_user_name) {
                $result .= ' class="topFeedbackSelf" ';
            } else {
                $result .= ' class="topFeedback"';
            }
            $result .= ' >';
            if ($item['sender_user_id'] == 0) {
                $result .= ' <span class="guest_name">' . $item['sender_user_name'];
                $result .= $show_guest_email ? '<a href="mailto:' . $item['sender_email'] . '" title="Gửi e-mail cho người dùng này!"><img src="style/images/comment_email/email.gif" border="0" width="15" height="11"/></a>' : '';
                $result .= '</span>';
            } else {
                $result .= ' <a ';
                $result .= $item['is_block'] == 1 ? ' title="Đang bị khóa nick" ' : ' ';
                $result .= $item['is_admin_mod'] ? ' title="' . $item['is_admin_mod']['des'] . '" ' : ' ';
                $result .= '  href="' . WEB_DIR . $item['sender_user_name'] . '">';
                $result .= $item['is_block'] == 1 ? ' <s><i> ' : ' ';
                $result .= $item['sender_user_name'];
                $result .= $item['is_block'] == 1 ? ' </i></s> ' : ' ';
                $result .= '</a>';
            }
            $result .= ' <span class="fb_time">' . $item['created_time'] . '</span> ';
            $result .= '<div class="floatRight" style=" height:16px"><div id="show_menu_' . $item['id'] . '" style="display:none">';
            if ($item['user_id'] != $cur_id && $item['sender_user_id'] != 0) {
                $result .= ' <span class="send_pm_fb" onclick="fn_send_pm_fb(' . $item['user_id'] . ',\'' . $item['sender_user_name'] . '\');" id="' . $item['user_id'] . '-' . $item['sender_user_name'] . '" style="margin-left:5px"><a href="javascript: void(0)"> Nhắn tin </a></span>|<span class="send_fb"><a href="' . WEB_DIR . AZRewrite::formatUrl('?page=shop&user_name=' . $item['sender_user_name'] . '&mode=comment') . '"> Lưu bút</a></span> ';
                if ($item != 1 && $item['sender_user_id'] == 0 && $cur_id == $item['receiver_user_id'] || $item['del_link']) {
                    $result .= ' | ';
                }
            }
            if ($item != 1 && $item['sender_user_id'] == 0 && $cur_id == $item['receiver_user_id'] || $item['del_link']) {
                $result .= '<span class="del_comment_aj" onmouseover="this.className=\'del_comment_aj_hover\'" onmouseout="this.className=\'del_comment_aj\'" onclick="fn_click_del_comment_aj(' . $item['id'] . ',' . $entry_id . ')" id="' . $item['id'] . '|' . $entry_id . '">Xoá</span>';
            }
            $result .= '</div></div><div style="clear:both"><span></span></div>';
            $result .= ' </div><div class="detailFeedback" align="left"  style="width:485px; overflow:hidden">' . $item['content'] . '</div> ';
            if ($item['user_id'] != $cur_id) {
                $result .= ' <div id="reply_' . $item['id'] . '" class="btn_fast_reply" onmouseout="if(this.className==\'btn_fast_reply_hover\')this.className=\'btn_fast_reply\'" onmouseover="if(this.className==\'btn_fast_reply\')this.className=\'btn_fast_reply_hover\'" style="float:right"><a href="javascript:void(0);" onclick="show_box_reply(' . $item['id'] . ',' . $item['parent_id'] . ',\'' . $guest_name . '\',\'' . $guest_email . '\',\'' . $item['sender_user_name'] . '\',' . $item['sender_user_id'] . '); return true;"><img src="style/images/spacer.gif" width="48" height="17" /></a></div><div style="clear:right" id="box_reply_' . $item['id'] . '"></div>';
            }
            $result .= '</div></td></tr><tr id="space_' . $item['id'] . '"><td height="1" colspan="2"><div style="height:1px; margin:5px 0; background-color:#fff"><span></span></div></td></tr>';
            $result .= '</tr>';
        }
        echo $result;
        System::halt();
    }
Example #4
0
 function get_all_comment()
 {
     global $display;
     $winner = array();
     global $user_id_arr, $stt, $item_per_page;
     $stt = 0;
     $is_admin_mod = array();
     $user_arr = array();
     $user_id_arr = array();
     $items = array();
     $limit = '';
     $divID = 'comment_list';
     $cmd = 'pagging_comment';
     $url_path = WEB_DIR . "ajax.php?act=comment&code=display_feedback&show_all=1&id=" . Item::$id . "&cmd=" . $cmd;
     $item_per_page = 25;
     if (Url::get('show_all') || Url::get('cmd') == $cmd) {
         $display->add('show_all', true);
     } else {
         $display->add('show_all', false);
     }
     $pagging = AZPagging::fb_pagging($limit, $item_per_page, true, 'fb_page', $url_path, $divID);
     $sql = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id, have_child,receiver_user_id FROM comment WHERE item_id=" . Item::$item['id'] . " AND parent_id = 0 ORDER BY order_time DESC {$limit}";
     $items_all = $this->get_comment($sql);
     if ($items_all) {
         $items = $items_all['item'];
         if ($items_all['id_parent']) {
             $sql_sub = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id,parent_id,receiver_user_id FROM comment WHERE parent_id IN({$items_all['id_parent']}) AND display =1 ORDER BY order_time DESC";
             $subComment_all = $this->get_comment($sql_sub, 1);
             if ($subComment_all) {
                 $sub_comments = $subComment_all['item'];
                 foreach ($sub_comments as $id => $subs) {
                     if (isset($items[$id])) {
                         $items[$id]['sub_comment'] = $subs;
                     }
                 }
             }
         }
         unset($items_all);
         unset($subComment_all);
     }
     if ($stt <= $item_per_page) {
         $pagging = AZPagging::fb_pagging($limit, $item_per_page, false, 'fb_page', $url_path, $divID);
         $display->add('show_fb_page', false);
     } else {
         $display->add('show_fb_page', true);
     }
     if ($user_id_arr) {
         $uid = implode(',', $user_id_arr);
         if ($uid != '') {
             $re = DB::query("SELECT id, avatar_url, gids, block_time, img_server FROM user WHERE id IN({$uid})");
             if ($re) {
                 while ($user = mysql_fetch_assoc($re)) {
                     $user_arr[$user['id']] = $user;
                 }
             }
         }
     }
     if ($items && $user_arr) {
         foreach ($items as &$item) {
             //add by nhatvt
             $item['content'] = $this->process_description($item['content']);
             //                echo $item['content'];exit;
             //end
             if (isset($item['sub_comment']) && $item['sub_comment']) {
                 foreach ($item['sub_comment'] as &$sub_item) {
                     if ($sub_item['sender_user_id']) {
                         if (isset($user_arr[$sub_item['sender_user_id']])) {
                             $sub_item['avatar_url'] = $user_arr[$sub_item['sender_user_id']]['avatar_url'];
                             $sub_item['block_time'] = $user_arr[$sub_item['sender_user_id']]['block_time'];
                             $sub_item['gids'] = $user_arr[$sub_item['sender_user_id']]['gids'];
                             $sub_item['img_server'] = $user_arr[$sub_item['sender_user_id']]['img_server'];
                         }
                         if ($sub_item['avatar_url']) {
                             $sub_item['sender_avatar_url'] = AZLib::getImageThumb($sub_item['avatar_url'], 60, 0, 1, $sub_item['img_server']);
                             if ($sub_item['parent_id'] > 0) {
                                 $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="25" class="lazyload"/></a>';
                             } else {
                                 $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="50" class="lazyload"/></a>';
                             }
                         } else {
                             $sub_item['sender_avatar_url'] = '';
                             $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="style/images/50x50.gif" width="25" height="25" class="lazyload"/></a>';
                         }
                         if ($sub_item['block_time'] > TIME_NOW) {
                             $sub_item['is_block'] = 1;
                         } else {
                             $sub_item['is_block'] = 0;
                         }
                         $sub_item['htmlContent'] = $html_content;
                         //set quyen quan tri
                         if ($sub_item['gids']) {
                             $is_admin_mod = CGlobal::$group[User::check_admin($sub_item['gids'])];
                         } else {
                             $is_admin_mod = array();
                         }
                         $sub_item['is_admin_mod'] = $is_admin_mod;
                     }
                 }
             }
             if ($item['sender_user_id']) {
                 if (isset($user_arr[$item['sender_user_id']])) {
                     $item['avatar_url'] = $user_arr[$item['sender_user_id']]['avatar_url'];
                     $item['block_time'] = $user_arr[$item['sender_user_id']]['block_time'];
                     $item['gids'] = $user_arr[$item['sender_user_id']]['gids'];
                     $item['img_server'] = $user_arr[$item['sender_user_id']]['img_server'];
                 }
                 if ($item['avatar_url']) {
                     $item['sender_avatar_url'] = AZLib::getImageThumb($item['avatar_url'], 60, 0, 1, $item['img_server']);
                     $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="50"/></a>';
                 } else {
                     $item['sender_avatar_url'] = '';
                     $html_content = '<a href="' . $item['sender_link'] . '"><img src="style/images/50x50.gif" width="50" height="50" /></a>';
                 }
                 $item['htmlContent'] = $html_content;
                 if ($item['block_time'] > TIME_NOW) {
                     $item['is_block'] = 1;
                 } else {
                     $item['is_block'] = 0;
                 }
                 //set quyen quan tri
                 if ($item['gids']) {
                     $is_admin_mod = CGlobal::$group[User::check_admin($item['gids'])];
                 } else {
                     $is_admin_mod = array();
                 }
                 $item['is_admin_mod'] = $is_admin_mod;
             }
         }
     }
     if (User::is_login() && Item::$item['user_id'] == User::id()) {
         $user = User::$current->data;
     } else {
         if (isset(Item::$item['user_id'])) {
             $user = User::getUser(Item::$item['user_id']);
         }
         if (!$user) {
             $user = array('id' => 0, 'user_name' => '', 'create_time' => '', 'blast' => '', 'email' => '', 'show_email' => '', 'skype_id' => '', 'yahoo_id' => '');
         }
     }
     if (User::is_login()) {
         if (User::$current->data['mobile_phone'] != '') {
             $display->add('user_phone', true);
             $user_phone = User::$current->data['mobile_phone'];
         } elseif (User::$current->data['home_phone'] != '') {
             $display->add('user_phone', true);
             $user_phone = User::$current->data['home_phone'];
         } else {
             $display->add('user_phone', false);
             $user_phone = '';
         }
         $display->add('cur_user_name', User::$current->data['user_name']);
         $display->add('cur_created_time', User::$current->data['create_time']);
         $cur_user_name = User::$current->data['user_name'];
         $cur_created_time = User::$current->data['create_time'];
         if (User::$current->data['avatar_url'] == '') {
             $cur_avatar_url = 'style/images/50x50.gif';
         } else {
             $cur_avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 60, 0, 1, User::$current->data['img_server']);
         }
     } else {
         $cur_user_name = '';
         $cur_created_time = '';
         $user_phone = '';
         $cur_avatar_url = 'style/images/50x50.gif';
         $display->add('cur_user_name', '');
         $display->add('cur_created_time', '');
         $display->add('check_user_name', '');
         $display->add('user_phone', false);
     }
     $guest_name = 'Số điện thoại';
     $guest_email = 'Email';
     if (isset($_COOKIE['guest_name'])) {
         if ($_COOKIE['guest_name'] == 'undefined' || $_COOKIE['guest_email'] == 'undefined') {
             $guest_name = 'Số điện thoại';
             $guest_email = 'Email';
         } else {
             $guest_name = $_COOKIE['guest_name'];
             $guest_email = $_COOKIE['guest_email'];
         }
     }
     $display->add('cur_user_name', $cur_user_name);
     $display->add('guest_name', $guest_name);
     $display->add('guest_email', $guest_email);
     $display->add('check_user_name', $user['user_name']);
     $display->add('cur_id', (int) User::id());
     //$display->add('msg',$this->showFormErrorMessages(1));
     $display->add('pagging', $pagging);
     $display->add('item_comments', $items);
     $display->add('item_id', Item::$item['id']);
     $display->add('category_id', Item::$item['category_id']);
     $display->add('item_name', Item::$item['name']);
     //rewrite URL
     $display->add('name_url', AZLib::safe_title(Item::$item['name']));
     //End rewrite URL
     Item::$item['currency_id'] = 1;
     $display->add('currency_id', CGlobal::$currency[Item::$item['currency_id']]);
     $display->add('total_feedback', Item::$item['reply_count']);
     if (strtolower(Url::get('page')) == 'allfeedback' || Url::get('cmd') == $cmd) {
         echo '<div id="totalReplyCount" style="display:none;">' . Item::$item['reply_count'] . '</div>';
     }
     //echo AZLib::parseBBCode($display->output('AllFeedback',true));
     $display->output('AllFeedbackList', false, 'AllFeedback');
 }
Example #5
0
    function con_line()
    {
        $user_id = EClassApi::getParam('user_id');
        $guest_id = EClassApi::getParam('guest_id');
        $arr_user_name = User::getUser($user_id);
        $arr_guest_name = User::getUser($guest_id);
        $sql = 'SELECT comment_user.id, time, content, sender_user_name, receiver_user_name,sender_user_id, receiver_user_id,  account.avatar_url,account.gids, account.block_time, account.img_server FROM comment_user LEFT JOIN account ON account.id=comment_user.sender_user_id WHERE (receiver_user_id = "' . $user_id . '" AND sender_user_id = "' . $guest_id . '"	OR receiver_user_id = "' . $guest_id . '" AND sender_user_id = "' . $user_id . '")	ORDER BY time DESC LIMIT 0,50 ';
        // chua phan trang nen limit
        $con_line_data = '
            <div id="list_profile_line" style="margin-top:20px">
                <div style="padding:5px;border-top:#3B5999 solid 2px; background-color:#D8DFEA"><div style="font-family:\'Times New Roman\', Times, serif; font-size:15px; font-weight:bold;width:90%;float:left"> Mạch lưu bút giữa <span style="color:#000cff">' . $arr_user_name["user_name"] . '</span> và ' . $arr_guest_name["user_name"] . ' </div><div style="float:right;" class="back_profile2"><a style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#003366;line-height:20px;" href="javascript: void(0)" onClick="javascript: back_profile();">&laquo; Quay lại</a></div><div style="clear:both"><span></span></div></div>
            <div class="clearfix marginTop12" id="comment_list">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" id="list_comment">';
        $re = DB::query($sql);
        $is_admin_mod = array();
        if ($re) {
            $i = 0;
            while ($value = mysql_fetch_assoc($re)) {
                if ($value['sender_user_id']) {
                    $value['URL_profile_post'] = Url::build('shop', array('user_name' => $value['sender_user_name']));
                } else {
                    $value['URL_profile_post'] = '';
                }
                if ($value['avatar_url']) {
                    $value['sender_avatar_url'] = EClassApi::getImageThumb($value['avatar_url'], 60, 0, 1, $value['img_server']);
                    $html_content = '<a href="' . $value['URL_profile_post'] . '"><img src="' . $value['sender_avatar_url'] . '" width="50"/></a>';
                } else {
                    $html_content = '<a href="' . $value['URL_profile_post'] . '"><img src="style/images/spacer.gif" width="50"/></a>';
                    $value['sender_avatar_url'] = '';
                }
                if ($value['sender_user_id'] == Url::get('user_id')) {
                    $sender_user_name = '<span style="color:#F60">' . $value['sender_user_name'] . "</span>";
                } else {
                    $sender_user_name = $value['sender_user_name'];
                }
                $is_admin_mod = array();
                if ($value['gids'] > 0) {
                    $is_admin_mod = CGlobal::$group[User::check_admin($value['gids'])];
                }
                $color_am = '';
                if (isset($is_admin_mod['id']) && ($is_admin_mod['id'] == 9 || $is_admin_mod['id'] == 1)) {
                    $color_am = 'class="topFeedback_admin"';
                    $sender_user_name = $value['sender_user_name'];
                    $str_title_admin = 'title="' . $is_admin_mod['des'] . '"';
                } elseif ($is_admin_mod && ($is_admin_mod['id'] == 2 || $is_admin_mod['id'] == 3)) {
                    $color_am = 'class="topFeedback_mod"';
                    $sender_user_name = $value['sender_user_name'];
                    $str_title_admin = 'title="' . $is_admin_mod['des'] . '"';
                } else {
                    $color_am = 'class="topFeedback"';
                    $str_title_admin = '';
                }
                if ($value['block_time'] > TIME_NOW) {
                    $str_user_block_start = '<s><i>';
                    $str_user_block_end = '</i></s>';
                    $str_user_block_title = 'title = "Đang bị khóa nick"';
                } else {
                    $str_user_block_start = '';
                    $str_user_block_end = '';
                    $str_user_block_title = '';
                }
                $con_line_data .= '<tr bgcolor="#fff"  id=id="' . $value['id'] . '">	';
                $con_line_data .= '<td width="62" align="center" valign="top">';
                $con_line_data .= '<div style="height:5px"><span></span></div>';
                if ($value['sender_user_id'] == 0) {
                    $con_line_data .= ' <div class="feedbackAvatar" style="background:url(' . $value['sender_avatar_url'] . ') center 50% no-repeat;height:50px" id="avatar_content_' . $value['user_id'] . '">
                                <img src="' . $value['sender_avatar_url'] . '" width="50" />
                        </div>';
                } else {
                    $con_line_data .= ' <div class="feedbackAvatar" onmouseout="this.className=\'feedbackAvatar\'" onmouseover="this.className=\'feedbackAvatar\'" ';
                    if (!$value['sender_avatar_url']) {
                        $con_line_data .= 'style="background:url(style/images/50x50.gif) center 50% no-repeat;"';
                    }
                    $con_line_data .= 'id="avatar_content_' . $value['sender_user_id'] . '">';
                    $con_line_data .= '<div class="commentAva trigger">
                                            ' . $html_content . '
                                           </div>
                                    </div>';
                }
                $con_line_data .= '</div>
                    </td>
                   <td valign="top">
                    <div  align="left" style="margin:2px;color:#999">';
                $con_line_data .= '<div ' . $color_am . ' align="left"><a ' . $str_title_admin . $str_user_block_title . ' href="' . WEB_DIR . $value['sender_user_name'] . '"  style="float:left">' . $str_user_block_start . $sender_user_name . $str_user_block_end . '</a>';
                $con_line_data .= '</div>';
                $con_line_data .= '<div class="floatRight" style=" height:16px">
                         <span style="color:#999;font-size:10px">
                                    ' . EClassApi::duration_time($value['time']);
                if (User::is_admin()) {
                    $con_line_data .= ' - <span class="send_pm_fb" onclick="fn_click_del_con_line_aj(' . $value['id'] . ');" ><a href="javascript:void(0)"  style="font-size:10px"><img src="style/images/icon_delete.gif" width="9" height="9" /></a></span>';
                }
                $con_line_data .= '</div>';
                $con_line_data .= '<div style="clear:both"><span></span></div>';
                $con_line_data .= '<div align="center" id="mess_success_' . $value['id'] . '" style="display:none" class="mess_success"></div>
                     <div class="detailFeedback" align="left"  style="width:480px;  overflow:hidden">
                        ' . EClassApi::parseBBCode($value['content']) . '
                     </div>  ';
                $con_line_data .= '</div>

                    </td>
                </tr>

                <tr id="space_' . $value['id'] . '">
                    <td height="1" colspan="2">

                    <div style=" margin:7px 0 2px 0;height:1px; background-color:#EAEAEA"><span></span></div>

                    </td>
                </tr>  ';
                $i++;
            }
        }
        $con_line_data .= '</table>';
        $con_line_data .= '</div>';
        $con_line_data .= '</div>';
        echo $con_line_data;
        System::halt();
    }