コード例 #1
0
ファイル: AZLib.php プロジェクト: duynhan07/elink
 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
             if (!User::have_permit(ADMIN_ITEM)) {
                 Item::$item['display'] = 0;
             }
         }
     }
 }
コード例 #2
0
ファイル: EClassApi.php プロジェクト: hqd276/bigs
    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;
            }
        }
    }