Example #1
0
 function description_quick_edit()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     $item_id = (int) Url::get('item_id', 0);
     $row = Item::get_item($item_id);
     if ($row["user_id"] == User::id() && !User::is_block() || User::have_permit(ADMIN_ITEM) || User::have_cat_permit($row["category_id"])) {
         $edit_description = preg_replace('#(<[/]?img.*>)#iU', '', EClassApi::post_db_parse_html($row['description']));
         ${$edit_description} = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", "\$this->embeded('\$1',{$item_id})", $edit_description);
         $edit_description = preg_replace('/<a[\\s]*(.*)[\\s]*href=[\'"](.*)[\'"][\\s]*[^>]*[\\s]*>(.*)<\\/a>/eisU', "\$this->filter_link('\$2','\$3')", $edit_description);
         echo $edit_description;
         exit;
     } else {
         echo "no_perm";
         exit;
     }
 }
Example #2
0
    function fn_del_item()
    {
        $id = (int) Url::get('id', 0);
        if (!User::is_login()) {
            echo "not_login";
            exit;
        }
        if ($id > 0) {
            $item = Item::get_item($id);
            $item_memcache = $item;
            if (!User::have_permit(ADMIN_ITEM) && !User::have_cat_permit($item['category_id'])) {
                if ($item['user_id'] != User::id() || User::is_block()) {
                    echo "not_perm";
                    exit;
                }
            }
            $reason_del = AZLib::getParam("reason_del");
            Item::delete_item($id);
            DB::query("UPDATE user SET total_transaction = total_transaction-1 WHERE id=" . $item["user_id"]);
            if ((User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id'])) && $reason_del) {
                $receiver_user = DB::select('user', 'id = ' . $item["user_id"]);
                $title_pm = 'Thông báo từ EnBac';
                $content_pm = 'Tin đăng \\"' . $item['name'] . '\\" của bạn đã bị xóa với lý do: ' . $reason_del . '
				
				Đề nghị bạn tham khảo [url=http://blog.enbac.com/2008/10/14/quy-che-dang-tin-tren-enbaccom.html]Quy định đăng tin[/url] hoặc [url=http://blog.enbac.com/2008/09/22/huong-dan-cac-chuc-nang-cua-enbac.html]hướng dẫn[/url] trên blog.enbac.com 
				
				Ban quản trị Én bạc.
				
				Vui lòng không trả lời tin nhắn này!';
                if (User::$current->data['signature']) {
                    $content_pm .= '<br /><hr /><br />Mọi thắc mắc vui lòng liên hệ theo số ĐT: 04.39743410 - Số máy lẻ: ' . User::$current->data['signature'];
                }
                AZLib::Send_pm(User::id(), User::user_name(), $receiver_user, $title_pm, $content_pm, true);
                $item_array = array('item_id' => $id, 'user_id' => User::id(), 'user_name' => User::user_name(), 'lock_time' => TIME_NOW, 'type' => 1, 'reason_lock' => $reason_del);
                DB::insert('item_lock', $item_array);
            }
            echo "success";
            exit;
        } else {
            echo "unsuccess";
            exit;
        }
    }
Example #3
0
 function display_feedback()
 {
     global $display;
     $show_all = Url::get('show_all', 0);
     Item::$id = (int) Url::get('id', 0);
     Item::$item = Item::get_item(Item::$id);
     if (Item::$item) {
         if (!isset(Item::$item['display'])) {
             Item::$item['display'] = 1;
             if (isset(Item::$item['id'])) {
                 //Check trạng thái tin và quyền thao tác:
                 if (Item::$item['status'] != 1) {
                     //Tin không được kiểm duyệt
                     //Nếu tin chưa được kiểm duyệt ,chỉ admin hoặc chủ tin được xem!
                     if (Item::$item['status'] == 2) {
                         if (User::id() != Item::$item['user_id'] && !User::have_permit(ADMIN_ITEM) && !User::have_cat_permit(Item::$item['category_id'])) {
                             Item::$item['display'] = 0;
                         }
                     } else {
                         //Nếu tin ở trạng thái xóa
                         if (Item::$item['status'] == -1) {
                             if (!User::have_permit(ADMIN_ITEM)) {
                                 Item::$item['display'] = 0;
                                 //Url::access_denied();
                             }
                         }
                     }
                     //Nếu tin bị ẩn ,chỉ admin được xem!
                     if (Item::$item['status'] == 0) {
                         if (!User::is_admin()) {
                             Item::$item['display'] = 0;
                             //Url::access_denied();
                         }
                     }
                 }
             }
         }
         if (Item::$item['display']) {
             if ($show_all) {
                 $this->get_all_comment();
             } else {
                 $this->get_all_comment();
                 /*Do chưa xử lý dc cache nên tam thời sử dụng như thế này*/
                 /*if (StaticCache::notExistCache('fb_' . Item::$id, im)) {
                                          echo "test";
                                          echo "test";
                                          echo "test";
                                         StaticCache::startCache();
                 
                                         $this->get_all_comment();
                                         StaticCache::endCache();
                 
                                     }*/
             }
         }
     }
 }
Example #4
0
    function invalid_item()
    {
        if (!User::is_login()) {
            echo "not_login";
            exit;
        } else {
            $item_id = (int) Url::get('id');
            $item_type = (int) Url::get('type', 2);
            if ($item_id) {
                $item = Item::get_item($item_id);
                $item_memcache = $item;
            } else {
                $item = array();
            }
            if ($item && (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id']))) {
                $type = 2;
            } elseif (!User::have_permit(ADMIN_ITEM) && User::is_low_mod()) {
                $type = 3;
            }
            if (!User::have_permit(ADMIN_ITEM) && User::is_low_mod() && DB::count('bad_content', 'id_item =' . $item_id . ' AND type = 3 AND user_id = ' . User::id())) {
                echo "dup_invalid";
                exit;
            }
            $reason = EClassApi::getParam('reason');
            if (User::is_low_mod() && !$reason) {
                echo "empty";
                exit;
            }
            $reason = $reason ? $reason : "Tin đang bị kiểm duyệt";
            $arr_data = array('type' => $type, 'id_item' => $item_id, 'user_id' => User::id(), 'user_name' => User::user_name(), 'reason' => $reason, 'time_post' => TIME_NOW);
            if (!User::have_permit(ADMIN_ITEM) && User::is_low_mod() && DB::insert('bad_content', $arr_data)) {
                echo "success_invalid";
                exit;
            }
            if ($item && (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id'])) && DB::insert('bad_content', $arr_data)) {
                EClassApi::getCats();
                $link_help = 'http://help.chonmon.vn/index.php/Trang_%C4%91%E1%BA%A7u';
                /*if (CGlobal::$allCategories[$item['category_id']]['link_help']){
                			$link_help = CGlobal::$allCategories[$item['category_id']]['link_help'];
                		}
                		elseif (isset(CGlobal::$allCategories[$item['category_id']]['parent_id']) && CGlobal::$allCategories[CGlobal::$allCategories[$item['category_id']]['parent_id']]['link_help'])
                		{
                			$link_help = CGlobal::$allCategories[CGlobal::$allCategories[$item['category_id']]['parent_id']]['link_help'];
                		}*/
                switch ($item['level_1_category_id']) {
                    case "30":
                    case "1":
                    case "31":
                    case "107":
                    case "78":
                    case "51":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_Th%E1%BB%9Di_trang_Nam/_N%E1%BB%AF%2C_Teen%2C_M%E1%BA%B9_v%C3%A0_b%C3%A9%2C_Gi%C3%A0y_d%C3%A9p_n%E1%BB%AF%2C_M%E1%BB%B9_ph%E1%BA%A9m_trang_s%E1%BB%A9c';
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-thoi-trang-nam-nu-teen-do-made-in-vnme-va-be-giay-dep-nu-my-pham-trang-suc.html';
                        break;
                    case "451":
                    case "105":
                    case "592":
                    case "447":
                    case "100":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_N%E1%BB%99i_th%E1%BA%A5t_gia_%C4%91%C3%ACnh/_V%C4%83n_ph%C3%B2ng%2C_%C4%90%E1%BB%93_d%C3%B9ng_b%E1%BA%BFp%2C_V%E1%BA%ADt_li%E1%BB%87u_x%C3%A2y_d%E1%BB%B1ng%2C_Ph%C3%B2ng_t%E1%BA%AFm_v%C3%A0_v%E1%BB%87_sinh';
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-noi-that-gia-dinhvan-phong-do-dung-bep-vat-lieu-xay-dung-phong-tam-ve-sinh.html';
                        break;
                    case "83":
                    case "541":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_%C4%90i%E1%BB%87n_tho%E1%BA%A1i%2C_Ch%E1%BB%A3_sim';
                        $link_help = 'http://blog.chonmon.vn/2010/10/07/quy-dinh-kiem-duyet-tin-muc-dien-thoai-cho-sim.html';
                        break;
                    case "104":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_H%C3%A0ng_hi%E1%BB%87u';
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-hang-hieu.html';
                        break;
                    case "331":
                    case "332":
                    case "335":
                    case "337":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_%C3%94_t%C3%B4';
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-muc-o-to.html';
                        break;
                    case "79":
                        //$link_help = 'http://help.chonmon.vn/index.php/Quy_%C4%91%E1%BB%8Bnh_ki%E1%BB%83m_duy%E1%BB%87t_tin_m%E1%BB%A5c_%C4%90i%E1%BB%87n_m%C3%A1y';
                        $link_help = 'http://blog.chonmon.vn/2010/06/07/quy-dinh-kiem-duyet-tin-muc-dien-may-dien-tu-am-thanh-dien-thoai-cho-sim-laptop-va-may-tinh-ky-thuat-so-thiet-bi-vp-va-may-cong-nghiep.html';
                        break;
                    case "103":
                    case "579":
                    case "571":
                        $link_help = 'http://blog.chonmon.vn/2010/06/07/quy-dinh-kiem-duyet-muc-nha-dat.html';
                        break;
                    case "514":
                    case "521":
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-dich-vu-dv-lam-dep-dv-dien-may.html';
                        break;
                    case "109":
                    case "101":
                        $link_help = 'http://blog.chonmon.vn/2010/12/07/quy-dinh-kiem-duyet-tin-muc-tong-hop-di-cho-online.html';
                        break;
                }
                DB::query("DELETE FROM bad_content WHERE type = 3 AND id_item = " . $item_id);
                DB::query("UPDATE item SET status = " . $item_type . " , valid_time=" . TIME_NOW . ', valid_user="******" WHERE id = ' . $item_id);
                if (SORL_FILTER_ON) {
                    $solr = new Solr_Search();
                    $solr->doUpdateItem($item_id);
                }
                if (MEMCACHE_ON) {
                    $item_memcache['status'] = $item_type;
                    $item_memcache['valid_time'] = TIME_NOW;
                    $item_memcache['valid_user'] = User::user_name();
                    eb_memcache::do_put("item:{$item_id}", $item_memcache);
                }
                $receiver_user_id = (int) Url::get('receiver_user_id');
                $receiver_user = DB::select('account', 'id = ' . $receiver_user_id);
                $title_pm = 'Thông báo từ EClass';
                /**Hoặc  [url=http://blog.chonmon.vn/?p=28][b] vào đây [/b][/url] để xem hướng dẫn đăng tin*/
                /*WEB_ROOT.ECRewrite::formatUrl('?page=item_detail&id='.$item_id.'&ebname='.EClassApi::safe_title($item['name'])).']'.$item['name']*/
                $urlItem = Url::build('item_detail', array('id' => $item_id, 'ebname' => EClassApi::safe_title($item['name'])));
                $content_pm = 'Tin [url=' . $urlItem . '][b] ' . $item['name'] . ' [b][/url] của bạn đã bị kiểm duyệt với lý do: ' . $reason . '
				Bạn click [url=' . $link_help . '][b]vào đây[/b][/url] để xem quy định đăng tin!
				Đề nghị bạn hãy sửa lại tin này cho hợp lệ.
				
				Xin cảm ơn bạn.
				
				Vui lòng không trả lời tin nhắn này!';
                if (User::$current->data['signature']) {
                    $content_pm .= '<br /><hr /><br />Mọi thắc mắc vui lòng liên hệ theo số ĐT: 04.39743410 - Số máy lẻ: ' . User::$current->data['signature'];
                }
                $id_mess = EClassApi::Send_pm(User::id(), User::user_name(), $receiver_user, $title_pm, $content_pm, TRUE);
                $from = EClassApi::getParam('from');
                if ($from == 'admin') {
                    echo EClassApi::getParam('receiver_user_id') . '_' . $item_id;
                } else {
                    echo $item_id;
                }
            } else {
                echo "fail";
            }
        }
        exit;
    }
Example #5
0
 function fn_del_item_reason()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     if (!User::have_permit(ADMIN_ITEM) && !User::is_mod()) {
         echo "no_perm";
         exit;
     }
     $id = (int) Url::get('id', 0);
     if ($id) {
         $item = Item::get_item($id);
         $item_memcache = $item;
     } else {
         $item = array();
     }
     if ($item && (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id']))) {
         Item::delete_item($id);
         AZLib::del_reason_mod($id);
         echo $id;
         exit;
     } else {
         echo "no_perm";
         exit;
     }
     echo "unsuccess";
     exit;
 }
Example #6
0
    static function checkItem()
    { //check trạng thái và quyền xem của Item: chỉ đc chạy trong trong hàm khởi tạo lớp của từng Module
        if (!Item::$item || (Item::$item && Item::$item['status'] == -1)) {
            //Ko index đối với SEO
            header("HTTP/1.0 404 Not Found");
            CGlobal::$robotContent = "NOINDEX, FOLLOW";
            CGlobal::$gBContent = "noindex,follow";
        }

        if (Item::$item) {
            Item::$item['display'] = 1;

            //Check trạng thái tin và quyền thao tác:
            if (Item::$item['status'] != 1) { //Tin bị kiểm duyệt
                //Nếu tin bị ẩn || kiểm duyệt || tin ko trung thực || tin chưa được chứng thực trong danh mục yêu cầu chứng thực =>> chỉ admin hoặc chủ tin được xem!
                // theo doi tin ko trung thuc
                if ((in_array(Item::$item['status'], array(0, 2, 3, 5))) && User::id() != Item::$item['user_id'] && !User::have_permit(ADMIN_ITEM) && !User::have_cat_permit(Item::$item['category_id'])) {
                    Item::$item['display'] = 0;
                } elseif (Item::$item['status'] == -1 && !User::have_permit(ADMIN_ITEM)) { //Nếu tin ở trạng thái xóa
                    Item::$item['display'] = 0;
                }
            }

            $user_info = User::getUser(Item::$item['user_id']);
            if (!$user_info && !User::have_permit(ADMIN_ITEM)) { //Nếu thành viên ko tồn tại
                Item::$item['display'] = 0;
            }
        }
    }