Exemplo n.º 1
0
    private void EditPage()
    {
        Master.Title = "编辑文件";
        int id = int.Parse(Utils.GetRequest("id", "get", 2, @"^[1-9]\d*$", "文件ID错误"));

        BCW.Model.Upfile model = new BCW.BLL.Upfile().GetUpfile(id);
        if (model == null)
        {
            Utils.Error("不存在的记录", "");
        }
        builder.Append(Out.Tab("<div class=\"title\">", ""));
        builder.Append("编辑文件");
        builder.Append(Out.Tab("</div>", ""));
        string strText = "文件地址:/,缩略图地址:/,文件描述:/,用户ID:/,审核状态:/,添加时间:/,,";
        string strName = "Files,PrevFiles,Content,UsID,IsVerify,AddTime,id,act";
        string strType = "text,text,text,num,select,date,hidden,hidden";
        string strValu = "" + model.Files + "'" + model.PrevFiles + "'" + model.Content + "'" + model.UsID + "'" + model.IsVerify + "'" + DT.FormatDate(model.AddTime, 0) + "'" + id + "'editsave";
        string strEmpt = "false,true,true,false,0|已审核|1|未审核,false,false,false";
        string strIdea = "/";
        string strOthe = "确定编辑,albums.aspx,post,1,red";

        builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));
        builder.Append(Out.Tab("<div>", ""));
        builder.Append(" <a href=\"" + Utils.getPage("albums.aspx") + "\">取消</a>");
        builder.Append(Out.Tab("</div>", ""));
        builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr()));
        builder.Append(Out.Tab("<div>", ""));
        builder.Append("<a href=\"" + Utils.getUrl("albums.aspx") + "\">相册管理</a><br />");
        builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"));
        builder.Append(Out.Tab("</div>", "<br />"));
    }
Exemplo n.º 2
0
    private void DelPage()
    {
        string info = Utils.GetRequest("info", "all", 1, "", "");
        int    id   = int.Parse(Utils.GetRequest("id", "all", 2, @"^[0-9]\d*$", "ID错误"));

        if (info != "ok")
        {
            Master.Title = "删除文件";
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("不能恢复!确定删除此文件吗");
            builder.Append(Out.Tab("</div>", "<br />"));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?info=ok&amp;act=del&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + "") + "\">确定删除</a><br />");
            builder.Append("<a href=\"" + Utils.getPage("albums.aspx") + "\">先留着吧..</a>");
            builder.Append(Out.Tab("</div>", ""));
            builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr()));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("<a href=\"" + Utils.getUrl("albums.aspx") + "\">返回上一级</a><br />");
            builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"));
            builder.Append(Out.Tab("</div>", "<br />"));
        }
        else
        {
            BCW.Model.Upfile model = new BCW.BLL.Upfile().GetUpfile(id);
            if (model == null)
            {
                Utils.Error("不存在的记录", "");
            }
            //删除
            new BCW.BLL.Upfile().Delete(id);
            new BCW.BLL.FComment().Delete(model.Types, id);
            //删除文件
            BCW.Files.FileTool.DeleteFile(model.Files);
            if (!string.IsNullOrEmpty(model.PrevFiles))
            {
                BCW.Files.FileTool.DeleteFile(model.PrevFiles);
            }

            //关联帖子回帖减去文件数
            if (model.ReID > 0)
            {
                new BCW.BLL.Reply().UpdateFileNum(model.ReID, -1);
            }
            else if (model.BID > 0)
            {
                new BCW.BLL.Text().UpdateFileNum(model.BID, -1);
                int FileNum = new BCW.BLL.Text().GetFileNum(model.BID);
                if (FileNum == 0)
                {
                    //去掉附件帖标识
                    new BCW.BLL.Text().UpdateTypes(model.BID, 0);
                }
            }

            Utils.Success("删除文件", "删除文件成功..", Utils.getPage("albums.aspx"), "1");
        }
    }
Exemplo n.º 3
0
    private void VerifypagePage()
    {
        Master.Title = "审核本页文件";
        int    page = int.Parse(Utils.GetRequest("page", "get", 1, @"^[1-9]\d*$", "页面ID错误"));
        string info = Utils.GetRequest("info", "get", 1, "", "");

        if (info != "ok")
        {
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("确定审核本页文件吗");
            builder.Append(Out.Tab("</div>", "<br />"));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?act=verifypage&amp;info=ok&amp;page=" + page + "&amp;backurl=" + Utils.getPage(0) + "") + "\">确定审核</a><br />");
            builder.Append("<a href=\"" + Utils.getPage("albums.aspx?ptype=3") + "\">再看看吧..</a>");
            builder.Append(Out.Tab("</div>", "<br />"));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("<a href=\"" + Utils.getPage("albums.aspx?act=verify") + "\">返回上一级</a>");
            builder.Append(Out.Tab("</div>", "<br />"));
        }
        else
        {
            int pageIndex;
            int recordCount;
            int pageSize = Convert.ToInt32(ub.Get("SiteListNo"));

            string strWhere = "";
            pageIndex = page;
            if (pageIndex == 0)
            {
                pageIndex = 1;
            }

            strWhere = "IsVerify=1";

            // 开始读取列表
            IList <BCW.Model.Upfile> listUpfile = new BCW.BLL.Upfile().GetUpfiles(pageIndex, pageSize, strWhere, out recordCount);
            if (listUpfile.Count > 0)
            {
                foreach (BCW.Model.Upfile n in listUpfile)
                {
                    new BCW.BLL.Upfile().UpdateIsVerify(n.ID, 0);
                }
            }

            Utils.Success("审核本页文件", "审核本页文件成功,正在返回..", Utils.getUrl("albums.aspx?ptype=3"), "1");
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// 上传文件
    /// </summary>
    private void SaveFiles(int meid, int leibie, int NodeId, out int kk)
    {
        //允许上传数量
        int maxAddNum = Convert.ToInt32(ub.GetSub("UpAddNum", xmlPath));
        int AddNum    = 0;

        if (maxAddNum > 0)
        {
            //计算今天上传数量
            AddNum = new BCW.BLL.Upfile().GetTodayCount(meid);
        }
        //遍历File表单元素
        System.Web.HttpFileCollection files = System.Web.HttpContext.Current.Request.Files;
        // int j = 1;
        int j = files.Count;
        int k = 0;

        try
        {
            string GetFiles = string.Empty;
            //for (int iFile = 0; iFile < files.Count; iFile++)
            for (int iFile = files.Count - 1; iFile > -1; iFile--)
            {
                //检查文件扩展名字
                System.Web.HttpPostedFile postedFile = files[iFile];
                string fileName, fileExtension;
                fileName = System.IO.Path.GetFileName(postedFile.FileName);
                string UpExt = ub.GetSub("UpaFileExt", xmlPath);
                int    UpLength = Convert.ToInt32(ub.GetSub("UpaMaxFileSize", xmlPath));
                if (fileName != "")
                {
                    fileExtension = System.IO.Path.GetExtension(fileName).ToLower();
                    //检查是否允许上传格式
                    if (UpExt.IndexOf(fileExtension) == -1)
                    {
                        continue;
                    }
                    //非法上传
                    if (fileExtension == ".asp" || fileExtension == ".aspx" || fileExtension == ".jsp" || fileExtension == ".php" || fileExtension == ".asa" || fileExtension == ".cer" || fileExtension == ".cdx" || fileExtension == ".htr" || fileExtension == ".exe")
                    {
                        continue;
                    }
                    if (postedFile.ContentLength > Convert.ToInt32(UpLength * 1024))
                    {
                        continue;
                    }
                    string DirPath     = string.Empty;
                    string prevDirPath = string.Empty;
                    string Path        = "/Files/bbs/" + meid + "/act/";
                    string prevPath    = "/Files/bbs/" + meid + "/prev/";
                    int    IsVerify    = 0;
                    if (FileTool.CreateDirectory(Path, out DirPath))
                    {
                        //上传数量限制
                        if (maxAddNum > 0)
                        {
                            if (maxAddNum <= (AddNum + k))
                            {
                                k = -k;
                                if (k == 0)
                                {
                                    k = -999;
                                }
                                break;
                            }
                        }
                        //生成随机文件名
                        fileName = DT.getDateTimeNum() + iFile + fileExtension;
                        string SavePath = System.Web.HttpContext.Current.Request.MapPath(DirPath) + fileName;
                        postedFile.SaveAs(SavePath);

                        //=============================图片木马检测,包括TXT===========================
                        string vSavePath = SavePath;
                        if (fileExtension == ".txt" || fileExtension == ".gif" || fileExtension == ".jpg" || fileExtension == ".jpeg" || fileExtension == ".png" || fileExtension == ".bmp")
                        {
                            bool IsPass = true;
                            System.IO.StreamReader sr = new System.IO.StreamReader(vSavePath, System.Text.Encoding.Default);
                            string strContent         = sr.ReadToEnd().ToLower();
                            sr.Close();
                            string str = "system.|request|javascript|script |script>|.getfolder|.createfolder|.deletefolder|.createdirectory|.deletedirectory|.saveas|wscript.shell|script.encode|server.|.createobject|execute|activexobject|language=";
                            foreach (string s in str.Split('|'))
                            {
                                if (strContent.IndexOf(s) != -1)
                                {
                                    System.IO.File.Delete(vSavePath);
                                    IsPass = false;
                                    break;
                                }
                            }
                            if (IsPass == false)
                            {
                                continue;
                            }
                        }
                        //=============================图片木马检测,包括TXT===========================

                        //审核要求指示
                        int Verify = Utils.ParseInt(ub.GetSub("UpIsVerify", xmlPath));
                        //缩略图生成
                        if (fileExtension == ".gif" || fileExtension == ".jpg" || fileExtension == ".jpeg" || fileExtension == ".png" || fileExtension == ".bmp")
                        {
                            int ThumbType = Convert.ToInt32(ub.GetSub("UpaThumbType", xmlPath));
                            int width     = Convert.ToInt32(ub.GetSub("UpaWidth", xmlPath));
                            int height    = Convert.ToInt32(ub.GetSub("UpaHeight", xmlPath));
                            if (ThumbType > 0)
                            {
                                try
                                {
                                    bool pbool = false;
                                    if (ThumbType == 1)
                                    {
                                        pbool = true;
                                    }
                                    if (FileTool.CreateDirectory(prevPath, out prevDirPath))
                                    {
                                        string prevSavePath = System.Web.HttpContext.Current.Request.MapPath(prevDirPath) + fileName;
                                        int    IsThumb      = 0;
                                        if (fileExtension == ".gif")
                                        {
                                            if (ThumbType > 0)
                                            {
                                                new BCW.Graph.GifHelper().GetThumbnail(SavePath, prevSavePath, width, height, pbool);
                                            }

                                            IsThumb = Convert.ToInt32(ub.GetSub("UpaIsThumb", xmlPath));
                                            if (IsThumb > 0)
                                            {
                                                if (IsThumb == 1)
                                                {
                                                    new BCW.Graph.GifHelper().SmartWaterMark(SavePath, "", ub.GetSub("UpaWord", xmlPath), ub.GetSub("UpaWordColor", xmlPath), "Arial", 12, Convert.ToInt32(ub.GetSub("UpaPosition", xmlPath)));//文字水印
                                                }
                                                else
                                                {
                                                    new BCW.Graph.GifHelper().WaterMark(SavePath, "", Server.MapPath(ub.GetSub("UpaWord", xmlPath)), Convert.ToInt32(ub.GetSub("UpaPosition", xmlPath)), Convert.ToInt32(ub.GetSub("UpaTran", xmlPath)));//图片水印
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (fileExtension == ".png" || fileExtension == ".jpg" || fileExtension == ".jpeg")
                                            {
                                                if (ThumbType > 0)
                                                {
                                                    new BCW.Graph.ImageHelper().ResizeImage(SavePath, prevSavePath, width, height, pbool);
                                                }
                                                IsThumb = Convert.ToInt32(ub.GetSub("UpaIsThumb", xmlPath));
                                                if (IsThumb > 0)
                                                {
                                                    if (IsThumb == 1)
                                                    {
                                                        new BCW.Graph.ImageHelper().WaterMark(SavePath, "", ub.GetSub("UpaWord", xmlPath), ub.GetSub("UpaWordColor", xmlPath), "Arial", 12, Convert.ToInt32(ub.GetSub("UpaPosition", xmlPath)));//文字水印
                                                    }
                                                    else
                                                    {
                                                        new BCW.Graph.ImageHelper().WaterMark(SavePath, "", Server.MapPath(ub.GetSub("UpaWord", xmlPath)), Convert.ToInt32(ub.GetSub("UpaPosition", xmlPath)), Convert.ToInt32(ub.GetSub("UpaTran", xmlPath)));//图片水印
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                catch { }
                            }
                            //图片审核
                            if (Verify > 0)
                            {
                                IsVerify = 1;
                            }
                        }
                        else
                        {
                            //文件审核
                            if (Verify > 1)
                            {
                                IsVerify = 1;
                            }

                            //自动识别出非图片
                            if (leibie == 1)
                            {
                                leibie = FileTool.GetExtType(fileExtension);
                            }
                        }
                        string Content = Utils.GetRequest("stext" + j + "", "post", 1, "", "");
                        if (!string.IsNullOrEmpty(Content))
                        {
                            Content = Utils.Left(Content, 30);
                        }
                        else
                        {
                            Content = "";
                        }

                        BCW.Model.Upfile model = new BCW.Model.Upfile();
                        model.Types   = leibie; // FileTool.GetExtType(fileExtension);
                        model.NodeId  = NodeId;
                        model.UsID    = meid;
                        model.ForumID = 0;
                        model.BID     = 0;
                        model.ReID    = 0;
                        model.Files   = DirPath + fileName;
                        if (string.IsNullOrEmpty(prevDirPath))
                        {
                            model.PrevFiles = model.Files;
                        }
                        else
                        {
                            model.PrevFiles = prevDirPath + fileName;
                        }

                        model.Content  = Content;
                        model.FileSize = Convert.ToInt64(postedFile.ContentLength);
                        model.FileExt  = fileExtension;
                        model.DownNum  = 0;
                        model.Cent     = 0;
                        model.IsVerify = IsVerify;
                        model.AddTime  = DateTime.Now;
                        new BCW.BLL.Upfile().Add(model);
                        k++;
                    }
                    // j++;
                    j--;
                }
            }
        }
        catch { }
        kk = k;
    }
Exemplo n.º 5
0
    private void CollecloadPage()
    {
        int meid = new BCW.User.Users().GetUsId();

        if (meid == 0)
        {
            Utils.Login();
        }

        int NodeId = int.Parse(Utils.GetRequest("NodeId", "all", 1, @"^[0-9]\d*$", "0"));

        BCW.User.Users.ShowVerifyRole("f", meid);                                         //非验证会员提示
        new BCW.User.Limits().CheckUserLimit(BCW.User.Limits.enumRole.Role_Upfile, meid); //会员上传权限
        int    leibie   = int.Parse(Utils.GetRequest("leibie", "post", 1, @"^[1-4]\d*$", "1"));
        string FileName = Utils.GetRequest("FileName", "post", 2, @"^.+?.(gif|jpg|bmp|jpeg|png)$", "请正确输入图片地址");
        //允许上传数量
        int maxAddNum = Convert.ToInt32(ub.GetSub("UpAddNum", xmlPath));

        if (maxAddNum > 0)
        {
            //计算今天上传数量
            int AddNum = new BCW.BLL.Upfile().GetTodayCount(meid);
            if (maxAddNum <= AddNum)
            {
                Utils.Error("今天上传数量已达" + maxAddNum + "个,不能再上传了", "");
            }
        }
        string DirPath     = string.Empty;
        string prevDirPath = string.Empty;
        string Path        = "/Files/bbs/" + meid + "/act/";
        string prevPath    = "/Files/bbs/" + meid + "/prev/";

        if (FileTool.CreateDirectory(Path, out DirPath))
        {
            string sPath = BCW.Files.FileTool.DownloadFile(Path, 0, FileName);
            if (sPath != FileName)
            {
                //缩略图生成
                string fileExtension = BCW.Files.FileTool.GetFileExt(sPath).ToLower();
                string SavePath      = System.Web.HttpContext.Current.Request.MapPath(sPath);
                //=============================图片木马检测,包括TXT===========================
                string vSavePath = SavePath;

                bool IsPass = true;
                System.IO.StreamReader sr = new System.IO.StreamReader(vSavePath, System.Text.Encoding.Default);
                string strContent         = sr.ReadToEnd().ToLower();
                sr.Close();
                string str = "system.|request|javascript|script |script>|.getfolder|.createfolder|.deletefolder|.createdirectory|.deletedirectory|.saveas|wscript.shell|script.encode|server.|.createobject|execute|activexobject|language=";
                foreach (string s in str.Split('|'))
                {
                    if (strContent.IndexOf(s) != -1)
                    {
                        System.IO.File.Delete(vSavePath);
                        IsPass = false;
                        break;
                    }
                }
                if (IsPass == false)
                {
                    Utils.Error("非法图片..", "");
                }

                //=============================图片木马检测,包括TXT===========================
                string prevSavePath = string.Empty;
                int    ThumbType    = Convert.ToInt32(ub.GetSub("UpaThumbType", xmlPath));
                int    width        = Convert.ToInt32(ub.GetSub("UpaWidth", xmlPath));
                int    height       = Convert.ToInt32(ub.GetSub("UpaHeight", xmlPath));
                if (ThumbType > 0)
                {
                    try
                    {
                        bool pbool = false;
                        if (ThumbType == 1)
                        {
                            pbool = true;
                        }
                        if (FileTool.CreateDirectory(prevPath, out prevDirPath))
                        {
                            prevSavePath = SavePath.Replace("act", "prev");
                            int IsThumb = 0;
                            if (fileExtension == ".gif")
                            {
                                if (ThumbType > 0)
                                {
                                    new BCW.Graph.GifHelper().GetThumbnail(SavePath, prevSavePath, width, height, pbool);
                                }

                                IsThumb = Convert.ToInt32(ub.GetSub("UpaIsThumb", xmlPath));
                                if (IsThumb > 0)
                                {
                                    if (IsThumb == 1)
                                    {
                                        new BCW.Graph.GifHelper().SmartWaterMark(prevSavePath, "", ub.GetSub("UpaWord", xmlPath), ub.GetSub("UpaWordColor", xmlPath), "Arial", 12, Convert.ToInt32(ub.GetSub("UpaPosition", xmlPath)));//文字水印
                                    }
                                    else
                                    {
                                        new BCW.Graph.GifHelper().WaterMark(prevSavePath, "", ub.GetSub("UpaWord", xmlPath), Convert.ToInt32(ub.GetSub("UpaPosition", xmlPath)), Convert.ToInt32(ub.GetSub("UpaPosition", xmlPath)));//图片水印
                                    }
                                }
                            }
                            else
                            {
                                if (ThumbType > 0)
                                {
                                    new BCW.Graph.ImageHelper().ResizeImage(SavePath, prevSavePath, width, height, pbool);
                                }
                                IsThumb = Convert.ToInt32(ub.GetSub("UpaIsThumb", xmlPath));
                                if (IsThumb > 0)
                                {
                                    if (IsThumb == 1)
                                    {
                                        new BCW.Graph.ImageHelper().WaterMark(prevSavePath, "", ub.GetSub("UpaWord", xmlPath), ub.GetSub("UpaWordColor", xmlPath), "Arial", 12, Convert.ToInt32(ub.GetSub("UpaPosition", xmlPath)));//文字水印
                                    }
                                    else
                                    {
                                        new BCW.Graph.ImageHelper().WaterMark(prevSavePath, "", ub.GetSub("UpaWord", xmlPath), Convert.ToInt32(ub.GetSub("UpaPosition", xmlPath)), Convert.ToInt32(ub.GetSub("UpaTran", xmlPath)));//图片水印
                                    }
                                }
                            }
                        }
                    }
                    catch { }
                }
                string Content = Utils.GetRequest("Content", "post", 1, "", "");
                if (!string.IsNullOrEmpty(Content))
                {
                    Content = Utils.Left(Content, 30);
                }
                else
                {
                    Content = "";
                }

                BCW.Model.Upfile model = new BCW.Model.Upfile();
                model.Types   = 1; // FileTool.GetExtType(fileExtension);
                model.NodeId  = NodeId;
                model.UsID    = meid;
                model.ForumID = 0;
                model.BID     = 0;
                model.ReID    = 0;
                model.Files   = sPath;
                if (string.IsNullOrEmpty(prevDirPath))
                {
                    model.PrevFiles = "";
                }
                else
                {
                    model.PrevFiles = sPath.Replace("act", "prev");
                }

                model.Content  = Content;
                model.FileSize = BCW.Files.FileTool.GetFileLength(sPath);
                model.FileExt  = fileExtension;
                model.DownNum  = 0;
                model.Cent     = 0;
                //审核要求指示
                int Verify = Utils.ParseInt(ub.GetSub("UpIsVerify", xmlPath));
                if (Verify > 0)
                {
                    model.IsVerify = 1;
                }

                model.AddTime = DateTime.Now;
                new BCW.BLL.Upfile().Add(model);
                //动态记录
                new BCW.BLL.Action().Add(meid, "在相册上传了[URL=/bbs/albums.aspx?uid=" + meid + "]新的文件[/URL]");
                Utils.Success("地址上传文件", "上传1个文件成功!<br /><a href=\"" + ReplaceWap(Utils.getUrl("addfile.aspx?act=collec&amp;leibie=" + leibie + "")) + "\">&gt;继续上传</a>", ReplaceWap(Utils.getUrl("albums.aspx?uid=" + meid + "&amp;leibie=" + leibie + "")), "2");
            }
            else
            {
                Utils.Error("上传失败,请检查文件是否存在", "");
            }
        }
    }
Exemplo n.º 6
0
    private void ReplyListPage(int leibie)
    {
        int meid = new BCW.User.Users().GetUsId();

        if (meid == 0)
        {
            Utils.Login();
        }

        int id  = int.Parse(Utils.GetRequest("id", "get", 2, @"^[1-9]\d*$", "ID错误"));
        int uid = 0;

        if (leibie == 0)
        {
            uid = new BCW.BLL.Diary().GetUsID(id);
        }
        else
        {
            uid = new BCW.BLL.Upfile().GetUsID(id);
        }

        if (uid == 0)
        {
            Utils.Error("不存在的记录", "");
        }
        string strLeibie = BCW.User.AppCase.CaseAlbums(leibie);

        Master.Title = "" + strLeibie + "评论";
        builder.Append(Out.Tab("<div class=\"title\">查看" + strLeibie + "评论</div>", ""));

        int    pageIndex;
        int    recordCount;
        int    pageSize = Convert.ToInt32(ub.Get("SiteListNo"));
        string strWhere = "";

        string[] pageValUrl = { "act", "leibie", "id", "backurl" };
        pageIndex = Utils.ParseInt(Request.QueryString["page"]);
        if (pageIndex == 0)
        {
            pageIndex = 1;
        }
        //查询条件
        strWhere = "Types=" + leibie + " and DetailId=" + id + "";

        // 开始读取列表
        IList <BCW.Model.FComment> listFComment = new BCW.BLL.FComment().GetFComments(pageIndex, pageSize, strWhere, out recordCount);

        if (listFComment.Count > 0)
        {
            int k = 1;
            foreach (BCW.Model.FComment n in listFComment)
            {
                if (k % 2 == 0)
                {
                    builder.Append(Out.Tab("<div class=\"text\">", "<br />"));
                }
                else
                {
                    if (k == 1)
                    {
                        builder.Append(Out.Tab("<div>", ""));
                    }
                    else
                    {
                        builder.Append(Out.Tab("<div>", "<br />"));
                    }
                }

                builder.AppendFormat("{0}楼.{1}(<a href=\"" + Utils.getUrl("uinfo.aspx?uid={2}&amp;backurl=" + Utils.PostPage(1) + "") + "\">{3}</a>/{4})", recordCount - (((pageIndex - 1) * pageSize) + (k - 1)), Out.SysUBB(n.Content), n.UsID, n.UsName, DT.FormatDate(n.AddTime, 1));
                if (!string.IsNullOrEmpty(n.ReText))
                {
                    builder.Append(Out.Tab("<font color=\"red\">", ""));
                    builder.Append("<br />★主人回复:" + n.ReText + "");
                    builder.Append(Out.Tab("</font>", ""));
                }
                bool flag = false;
                if (leibie == 0)
                {
                    if (new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_Diary, meid))
                    {
                        flag = true;
                    }
                }
                else
                {
                    if (new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_Albums, meid))
                    {
                        flag = true;
                    }
                }
                if (uid.Equals(meid))
                {
                    builder.Append("<a href=\"" + Utils.getUrl("fcomment.aspx?act=reok&amp;leibie=" + leibie + "&amp;detailid=" + n.DetailId + "&amp;id=" + n.ID + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">[回复]</a>");
                }
                if (uid.Equals(meid) || flag == true)
                {
                    builder.Append("<a href=\"" + Utils.getUrl("fcomment.aspx?act=delreply&amp;leibie=" + leibie + "&amp;detailid=" + n.DetailId + "&amp;id=" + n.ID + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">[删除]</a>");
                }
                k++;
                builder.Append(Out.Tab("</div>", ""));
            }
            // 分页
            builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0));
        }
        else
        {
            builder.Append(Out.Div("div", "没有相关记录.."));
        }
        //得到随机短语
        string  ReplyValu = string.Empty;
        DataSet ds        = new BCW.BLL.Submit().GetList("TOP 1 Content", "UsID=" + meid + " and Types=0 ORDER BY NEWID()");

        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            ReplyValu = ds.Tables[0].Rows[0]["Content"].ToString();
        }
        builder.Append(Out.Tab("", "<br />"));
        strText = ",,,,,";
        strName = "Content,id,leibie,backurl,act";
        strType = "stext,hidden,hidden,hidden,hidden";
        strValu = "" + ReplyValu + "'" + id + "'" + leibie + "'" + Utils.PostPage(1) + "'replysave";
        strEmpt = "true,false,false,false,false";
        strIdea = "";
        strOthe = "快速评论,fcomment.aspx,post,3,red";

        builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));
        builder.Append(Out.Tab("<div>", "<br />"));
        builder.Append("<a href=\"" + Utils.getUrl("fcomment.aspx?act=reply&amp;leibie=" + leibie + "&amp;id=" + id + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">&gt;&gt;我要评论</a>");
        builder.Append(Out.Tab("</div>", ""));
        builder.Append(Out.Tab("<div class=\"text\">", "<br />"));
        if (meid == uid)
        {
            builder.Append("我的:");
        }
        else
        {
            builder.Append("主人:");
        }

        builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?uid=" + uid + "") + "\">日记</a>");
        if (leibie != 1)
        {
            builder.Append("-<a href=\"" + Utils.getUrl("albums.aspx?leibie=1&amp;uid=" + uid + "") + "\">相册</a>");
        }
        if (leibie != 2)
        {
            builder.Append("-<a href=\"" + Utils.getUrl("albums.aspx?leibie=2&amp;uid=" + uid + "") + "\">音乐</a>");
        }
        if (leibie != 3)
        {
            builder.Append("-<a href=\"" + Utils.getUrl("albums.aspx?leibie=3&amp;uid=" + uid + "") + "\">视频</a>");
        }
        if (leibie != 4)
        {
            builder.Append("-<a href=\"" + Utils.getUrl("albums.aspx?leibie=4&amp;uid=" + uid + "") + "\">资源</a>");
        }

        builder.Append(Out.Tab("</div>", ""));
        builder.Append(Out.Tab("<div class=\"title\">", Out.Hr()));
        builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">首页</a>-");
        if (leibie == 0)
        {
            builder.Append("<a href=\"" + Utils.getPage("diary.aspx?act=view&amp;id=" + id + "") + "\">上级</a>");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getPage("albums.aspx?act=view&amp;leibie=" + leibie + "&amp;id=" + id + "") + "\">上级</a>");
        }

        builder.Append(Out.Tab("</div>", ""));
    }
Exemplo n.º 7
0
    private void ReOkPage(int leibie)
    {
        int meid = new BCW.User.Users().GetUsId();

        if (meid == 0)
        {
            Utils.Login();
        }

        int detailid = int.Parse(Utils.GetRequest("detailid", "all", 2, @"^[1-9]\d*$", "ID错误"));
        int id       = int.Parse(Utils.GetRequest("id", "all", 2, @"^[1-9]\d*$", "ID错误"));

        if (!new BCW.BLL.FComment().Exists(id, detailid))
        {
            Utils.Error("不存在的记录", "");
        }
        int uid = 0;

        if (leibie == 0)
        {
            uid = new BCW.BLL.Diary().GetUsID(detailid);
        }
        else
        {
            uid = new BCW.BLL.Upfile().GetUsID(detailid);
        }

        bool flag = false;

        if (leibie == 0)
        {
            if (new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_Diary, meid))
            {
                flag = true;
            }
        }
        else
        {
            if (new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_Albums, meid))
            {
                flag = true;
            }
        }

        if (!uid.Equals(meid) && !flag)
        {
            Utils.Error("你的权限不足", "");
        }
        string info = Utils.GetRequest("info", "post", 1, "", "");

        BCW.Model.FComment model = new BCW.BLL.FComment().GetFComment(id);
        if (model == null)
        {
            Utils.Error("不存在的记录", "");
        }

        if (info == "ok")
        {
            string Content = Utils.GetRequest("Content", "post", 3, @"^[\s\S]{1,500}$", "回复内容限1-500字内");
            new BCW.BLL.FComment().UpdateReText(id, Content);
            //内线通知留言者
            if (meid != model.UsID)
            {
                new BCW.BLL.Guest().Add(0, model.UsID, model.UsName, "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + new BCW.BLL.User().GetUsName(meid) + "[/url]回复了你您在TA空间" + BCW.User.AppCase.CaseAlbums(leibie) + "的评论啦,快去[url=/bbs/fcomment.aspx?leibie=" + leibie + "&amp;id=" + detailid + "]看看吧[/url]!");
            }
            Utils.Success("回复留言", "回复留言成功,正在返回..", Utils.getPage("fcomment.aspx?leibie=" + leibie + "&amp;id=" + detailid + ""), "1");
        }
        else
        {
            Master.Title = "回复留言";
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("回复留言");
            builder.Append(Out.Tab("</div>", ""));

            string strText, strName, strType, strValu, strEmpt, strIdea, strOthe;
            strText = "回复内容:/,,,,,,";
            strType = "textarea,hidden,hidden,hidden,hidden,hidden,hidden";
            strName = "Content,id,detailid,leibie,act,info,backurl";
            strValu = "" + model.ReText + "'" + id + "'" + detailid + "'" + leibie + "'reok'ok'" + Utils.getPage(0) + "";
            strEmpt = "true,false,false,false,false,false,false";
            strIdea = "/";
            strOthe = "确定回复|reset,fcomment.aspx,post,1,red|blue";
            builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));
            builder.Append(Out.Tab("<div>", "<br />"));
            builder.Append("<a href=\"" + Utils.getPage("fcomment.aspx?leibie=" + leibie + "&amp;id=" + detailid + "") + "\">&gt;返回上一级</a>");
            builder.Append(Out.Tab("</div>", ""));
        }
    }
Exemplo n.º 8
0
    private void DelReplyPage(int leibie)
    {
        int meid = new BCW.User.Users().GetUsId();

        if (meid == 0)
        {
            Utils.Login();
        }

        int detailid = int.Parse(Utils.GetRequest("detailid", "get", 2, @"^[1-9]\d*$", "ID错误"));
        int id       = int.Parse(Utils.GetRequest("id", "get", 2, @"^[1-9]\d*$", "ID错误"));

        if (!new BCW.BLL.FComment().Exists(id, detailid))
        {
            Utils.Error("不存在的记录", "");
        }
        int uid = 0;

        if (leibie == 0)
        {
            uid = new BCW.BLL.Diary().GetUsID(detailid);
        }
        else
        {
            uid = new BCW.BLL.Upfile().GetUsID(detailid);
        }

        bool flag = false;

        if (leibie == 0)
        {
            if (new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_Diary, meid))
            {
                flag = true;
            }
        }
        else
        {
            if (new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_Albums, meid))
            {
                flag = true;
            }
        }

        if (!uid.Equals(meid) && !flag)
        {
            Utils.Error("你的权限不足", "");
        }
        string info = Utils.GetRequest("info", "get", 1, "", "");

        Master.Title = "删除评论";
        if (info == "")
        {
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("确定删除此评论吗.");
            builder.Append(Out.Tab("</div>", "<br />"));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("<a href=\"" + Utils.getUrl("fcomment.aspx?act=delreply&amp;info=ok&amp;leibie=" + leibie + "&amp;detailid=" + detailid + "&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + "") + "\">确定删除</a><br />");
            builder.Append("<a href=\"" + Utils.getPage("fcomment.aspx?act=replylist&amp;leibie=" + leibie + "&amp;id=" + detailid + "") + "\">先留着吧..</a>");
            builder.Append(Out.Tab("</div>", ""));
        }
        else
        {
            new BCW.BLL.FComment().Delete(id);
            Utils.Success("删除评论", "删除评论成功,正在返回..", Utils.getPage("fcomment.aspx?act=replylist&amp;leibie=" + leibie + "&amp;id=" + detailid + ""), "1");
        }
    }
Exemplo n.º 9
0
    private void ReplySavePage(int leibie)
    {
        int meid = new BCW.User.Users().GetUsId();

        if (meid == 0)
        {
            Utils.Login();
        }

        BCW.User.Users.ShowVerifyRole("m", meid);                                          //非验证会员提示
        new BCW.User.Limits().CheckUserLimit(BCW.User.Limits.enumRole.Role_Comment, meid); //会员本身权限
        int    id       = int.Parse(Utils.GetRequest("id", "post", 2, @"^[1-9]\d*$", "ID错误"));
        string Content  = Utils.GetRequest("Content", "post", 2, @"^[^\^]{1,200}$", "评论限1-200字");
        int    NodeId   = 0;
        string xmlPath  = "/Controls/diary.xml";
        string xmlPath2 = "/Controls/albums.xml";
        int    uid      = 0;

        if (leibie == 0)
        {
            //是否刷屏
            string appName = "LIGHT_DIARY";
            int    Expir   = Convert.ToInt32(ub.GetSub("DiaryExpir", xmlPath));
            BCW.User.Users.IsFresh(appName, Expir);
            NodeId = new BCW.BLL.Diary().GetNodeId(id);
            uid    = new BCW.BLL.Diary().GetUsID(id);
        }
        else
        {
            //是否刷屏
            string appName = "LIGHT_DIARY";
            int    Expir   = Convert.ToInt32(ub.GetSub("AlbumsExpir", xmlPath2));
            BCW.User.Users.IsFresh(appName, Expir);
            NodeId = new BCW.BLL.Upfile().GetNodeId(id);
            uid    = new BCW.BLL.Upfile().GetUsID(id);
        }
        if (NodeId == -1)
        {
            Utils.Error("不存在的记录", "");
        }
        //你是否是对方的黑名单
        if (new BCW.BLL.Friend().Exists(uid, meid, 1))
        {
            Utils.Error("对方已把您加入黑名单", "");
        }
        int IsReview = new BCW.BLL.Upgroup().GetIsReview(NodeId);

        if (IsReview == 1)
        {
            Utils.Error("作者已设置不允许评论此分类", "");
        }

        string strLeibie = BCW.User.AppCase.CaseAlbums(leibie);

        BCW.Model.FComment model = new BCW.Model.FComment();
        model.Types    = leibie;
        model.UsID     = meid;
        model.UsName   = new BCW.BLL.User().GetUsName(meid);
        model.DetailId = id;
        model.Content  = Content;
        model.AddUsIP  = Utils.GetUsIP();
        model.AddTime  = DateTime.Now;
        new BCW.BLL.FComment().Add(model);
        //更新回复数
        if (leibie == 0)
        {
            new BCW.BLL.Diary().UpdateReplyNum(id, 1);
        }

        //内线通知主人
        if (meid != uid)
        {
            new BCW.BLL.Guest().Add(0, uid, new BCW.BLL.User().GetUsName(uid), "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + new BCW.BLL.User().GetUsName(meid) + "[/url]在您的空间" + BCW.User.AppCase.CaseAlbums(leibie) + "[url=/bbs/fcomment.aspx?leibie=" + leibie + "&amp;id=" + id + "]留言啦[/url]!");
        }
        Utils.Success("评论" + strLeibie + "", "发表评论成功,正在返回..", Utils.getPage("fcomment.aspx?act=replylist&amp;leibie=" + leibie + "&amp;id=" + id + ""), "1");
    }
Exemplo n.º 10
0
    private void ReplyPage(int leibie)
    {
        Master.Title = "我要评论";
        int id   = int.Parse(Utils.GetRequest("id", "get", 2, @"^[1-9]\d*$", "ID错误"));
        int copy = int.Parse(Utils.GetRequest("copy", "get", 1, @"^[0-1]$", "0"));
        int ff   = int.Parse(Utils.GetRequest("ff", "get", 1, @"^[0-9]\d*$", "-1"));
        int dd   = int.Parse(Utils.GetRequest("dd", "get", 1, @"^[0-9]\d*$", "0"));
        int meid = new BCW.User.Users().GetUsId();

        if (meid == 0)
        {
            Utils.Login();
        }

        string Title = string.Empty;

        if (leibie == 0)
        {
            Title = new BCW.BLL.Diary().GetTitle(id);
        }
        else
        {
            Title = new BCW.BLL.Upfile().GetTitle(id);
        }

        if (Title == "")
        {
            Utils.Error("不存在的记录", "");
        }
        builder.Append(Out.Tab("<div class=\"title\">", ""));
        if (leibie == 0)
        {
            builder.Append("评论:<a href=\"" + Utils.getUrl("diary.aspx?act=view&amp;id=" + id + "") + "\">" + Title + "</a>");
        }
        else
        {
            builder.Append("评论:<a href=\"" + Utils.getUrl("albums.aspx?act=view&amp;leibie=" + leibie + "&amp;id=" + id + "") + "\">" + Title + "</a>");
        }

        builder.Append(Out.Tab("</div>", ""));

        string reText = string.Empty;

        if (ff >= 0)
        {
            reText += "[F]" + ff + "[/F]";
        }

        if (dd > 0)
        {
            reText += new BCW.BLL.Submit().GetContent(dd, meid);
        }

        if (copy == 1)
        {
            reText += new BCW.BLL.User().GetCopytemp(meid);
        }

        strText = "内容.300字内:/,,,,";
        strName = "Content,id,leibie,backurl,act";
        strType = "textarea,hidden,hidden,hidden,hidden";
        strValu = "" + reText + "'" + id + "'" + leibie + "'" + Utils.getPage(0) + "'replysave";
        strEmpt = "true,false,false,false,false";
        strIdea = "/";
        strOthe = "发表评论,fcomment.aspx,post,1,red";

        builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));
        builder.Append(Out.Tab("<div>", "<br />"));
        builder.Append("插入:<a href=\"" + Utils.getUrl("function.aspx?act=admsub&amp;backurl=" + Utils.PostPage(1) + "") + "\">常用短语</a>.");
        builder.Append("<a href=\"" + Utils.getUrl("function.aspx?act=face&amp;backurl=" + Utils.PostPage(1) + "") + "\">表情</a>");
        builder.Append("<br /><a href=\"" + Utils.getUrl("fcomment.aspx?act=reply&amp;leibie=" + leibie + "&amp;id=" + id + "&amp;ff=" + ff + "&amp;dd=" + dd + "&amp;copy=1") + "\">[粘贴]</a>");
        builder.Append(Out.Tab("</div>", ""));
        builder.Append(Out.Tab("<div class=\"title\">", Out.Hr()));
        if (leibie == 0)
        {
            builder.Append("<a href=\"" + Utils.getPage("diary.aspx?act=view&amp;id=" + id + "") + "\">取消发表</a>");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getPage("albums.aspx?act=view&amp;leibie=" + leibie + "&amp;id=" + id + "") + "\">取消发表</a>");
        }

        builder.Append(Out.Tab("</div>", ""));
    }
Exemplo n.º 11
0
    private void ReloadPage()
    {
        Master.Title = "相册管理";
        int ptype = int.Parse(Utils.GetRequest("ptype", "all", 1, @"^[1-3]$", "1"));
        int uid   = int.Parse(Utils.GetRequest("uid", "all", 1, @"^[1-9]\d*$", "0"));

        builder.Append(Out.Tab("<div class=\"title\">", ""));
        builder.Append("相册管理");
        builder.Append(Out.Tab("</div>", "<br />"));
        builder.Append(Out.Tab("<div class=\"text\">", ""));
        if (uid > 0)
        {
            builder.Append("ID:" + uid + "");
        }

        if (ptype == 1)
        {
            builder.Append("图片|");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?ptype=1&amp;uid=" + uid + "&amp;backurl=" + Utils.getPage(0) + "") + "\">图片</a>|");
        }

        if (ptype == 2)
        {
            builder.Append("其它文件|");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?ptype=2&amp;uid=" + uid + "&amp;backurl=" + Utils.getPage(0) + "") + "\">其它文件</a>|");
        }

        if (ptype == 3)
        {
            builder.Append("未审核");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?ptype=3&amp;uid=" + uid + "&amp;backurl=" + Utils.getPage(0) + "") + "\">未审核</a>");
        }

        builder.Append(Out.Tab("</div>", "<br />"));

        int pageIndex;
        int recordCount;
        int pageSize = 5;

        if (ptype > 1)
        {
            pageSize = Convert.ToInt32(ub.Get("SiteListNo"));
        }

        string strWhere = "";

        string[] pageValUrl = { "act", "uid", "ptype", "backurl" };
        pageIndex = Utils.ParseInt(Request.QueryString["page"]);
        if (pageIndex == 0)
        {
            pageIndex = 1;
        }


        if (ptype == 1)
        {
            strWhere = "Types=1";
        }
        else if (ptype == 2)
        {
            strWhere = "Types>1";
        }
        else if (ptype == 3)
        {
            strWhere = "IsVerify=1";
        }

        if (uid > 0)
        {
            if (strWhere != "")
            {
                strWhere += " and ";
            }

            strWhere += "UsID=" + uid + "";
        }

        // 开始读取列表
        IList <BCW.Model.Upfile> listUpfile = new BCW.BLL.Upfile().GetUpfiles(pageIndex, pageSize, strWhere, out recordCount);

        if (listUpfile.Count > 0)
        {
            int k = 1;
            foreach (BCW.Model.Upfile n in listUpfile)
            {
                if (k % 2 == 0)
                {
                    builder.Append(Out.Tab("<div class=\"text\">", "<br />"));
                }
                else
                {
                    if (k == 1)
                    {
                        builder.Append(Out.Tab("<div>", ""));
                    }
                    else
                    {
                        builder.Append(Out.Tab("<div>", "<br />"));
                    }
                }

                if (n.Types == 1)
                {
                    builder.Append("<img src=\"" + n.PrevFiles + "\" alt=\"load\"/><br />");
                }
                string Content = n.Content;
                if (string.IsNullOrEmpty(Content))
                {
                    Content = "无标题";
                }

                builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?act=edit&amp;id=" + n.ID + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">[管理]&gt;</a>" + ((pageIndex - 1) * pageSize + k) + ".");
                builder.Append("<a href=\"" + Utils.getUrl(n.Files) + "\">" + Content + "(" + n.FileExt + "/" + BCW.Files.FileTool.GetContentLength(n.FileSize) + ")</a>");

                builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?act=del&amp;leibie=" + n.Types + "&amp;id=" + n.ID + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">[删除]</a>");
                k++;
                builder.Append(Out.Tab("</div>", ""));
            }
            // 分页
            builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0));
        }
        else
        {
            builder.Append(Out.Div("div", "没有相关记录.."));
        }
        string strText = "输入用户ID:/,,";
        string strName = "uid,ptype,backurl";
        string strType = "num,hidden,hidden";
        string strValu = "'" + ptype + "'" + Utils.getPage(0) + "";
        string strEmpt = "true,false";
        string strIdea = "/";
        string strOthe = "搜文件,albums.aspx,post,1,red";

        builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));

        builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr()));
        builder.Append(Out.Tab("<div>", ""));
        if (ptype == 3)
        {
            builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?act=verifypage&amp;ptype=" + ptype + "&amp;page=" + pageIndex + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">审核本页文件</a><br />");
        }

        builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?act=delpage&amp;ptype=" + ptype + "&amp;page=" + pageIndex + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">删除本页文件</a><br />");
        builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"));
        builder.Append(Out.Tab("</div>", "<br />"));
    }
Exemplo n.º 12
0
    private void DelpagePage()
    {
        Master.Title = "删除本页文件";
        int    ptype = int.Parse(Utils.GetRequest("ptype", "get", 2, @"^[1-3]\d*$", "类型错误"));
        int    page  = int.Parse(Utils.GetRequest("page", "get", 1, @"^[1-9]\d*$", "页面ID错误"));
        string info  = Utils.GetRequest("info", "get", 1, "", "");

        if (info != "ok")
        {
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("确定删除本页文件吗");
            builder.Append(Out.Tab("</div>", "<br />"));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?act=delpage&amp;info=ok&amp;ptype=" + ptype + "&amp;page=" + page + "&amp;backurl=" + Utils.getPage(0) + "") + "\">确定删除</a><br />");
            builder.Append("<a href=\"" + Utils.getPage("albums.aspx?ptype=" + ptype + "") + "\">再看看吧..</a>");
            builder.Append(Out.Tab("</div>", "<br />"));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?ptype=" + ptype + "") + "\">返回上一级</a>");
            builder.Append(Out.Tab("</div>", "<br />"));
        }
        else
        {
            int pageIndex;
            int recordCount;
            int pageSize = 5;

            string strWhere = "";
            pageIndex = page;
            if (pageIndex == 0)
            {
                pageIndex = 1;
            }

            if (ptype == 1)
            {
                strWhere = "Types=1";
            }
            else
            {
                strWhere = "Types>1";
            }

            // 开始读取列表
            IList <BCW.Model.Upfile> listUpfile = new BCW.BLL.Upfile().GetUpfiles(pageIndex, pageSize, strWhere, out recordCount);
            if (listUpfile.Count > 0)
            {
                foreach (BCW.Model.Upfile n in listUpfile)
                {
                    int id = n.ID;
                    BCW.Model.Upfile model = new BCW.BLL.Upfile().GetUpfile(id);
                    if (model != null)
                    {
                        //删除
                        new BCW.BLL.Upfile().Delete(id);
                        new BCW.BLL.FComment().Delete(model.Types, id);
                        //删除文件
                        BCW.Files.FileTool.DeleteFile(model.Files);
                        if (!string.IsNullOrEmpty(model.PrevFiles))
                        {
                            BCW.Files.FileTool.DeleteFile(model.PrevFiles);
                        }

                        //关联帖子回帖减去文件数
                        if (model.ReID > 0)
                        {
                            new BCW.BLL.Reply().UpdateFileNum(model.ReID, -1);
                        }
                        else if (model.BID > 0)
                        {
                            new BCW.BLL.Text().UpdateFileNum(model.BID, -1);
                            int FileNum = new BCW.BLL.Text().GetFileNum(model.BID);
                            if (FileNum == 0)
                            {
                                //去掉附件帖标识
                                new BCW.BLL.Text().UpdateTypes(model.BID, 0);
                            }
                        }
                    }
                }
            }

            Utils.Success("删除本页文件", "删除本页文件成功,正在返回..", Utils.getUrl("albums.aspx"), "1");
        }
    }
Exemplo n.º 13
0
    private void ReloadPage(int uid, int forumid, int bid, int reid)
    {
        Master.Title = "查看附件";
        builder.Append(Out.Tab("<div class=\"title\">查看附件</div>", ""));
        builder.Append(Out.Tab("<div class=\"text\">", ""));
        int showtype = int.Parse(Utils.GetRequest("showtype", "get", 1, @"^[0-1]$", "0"));

        builder.Append("图片:");
        if (showtype == 0)
        {
            builder.Append("缩略图|");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("filelist.aspx?forumid=" + forumid + "&amp;bid=" + bid + "&amp;uid=" + uid + "&amp;reid=" + reid + "&amp;showtype=0&amp;backurl=" + Utils.getPage(0) + "") + "\">缩略图</a>|");
        }

        if (showtype == 1)
        {
            builder.Append("原图");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("filelist.aspx?forumid=" + forumid + "&amp;bid=" + bid + "&amp;uid=" + uid + "&amp;reid=" + reid + "&amp;showtype=1&amp;backurl=" + Utils.getPage(0) + "") + "\">原图</a>");
        }

        builder.Append(Out.Tab("</div>", Out.Hr()));
        int    pageIndex;
        int    recordCount;
        int    pageSize = 5;
        string strWhere = string.Empty;

        string[] pageValUrl = { "act", "showtype", "uid", "forumid", "bid", "reid", "backurl" };
        pageIndex = Utils.ParseInt(Request.QueryString["page"]);
        if (pageIndex == 0)
        {
            pageIndex = 1;
        }

        //查询条件
        strWhere = "BID=" + bid + " and ReID=" + reid + "";
        // 开始读取列表
        IList <BCW.Model.Upfile> listUpfile = new BCW.BLL.Upfile().GetUpfiles(pageIndex, pageSize, strWhere, out recordCount);

        if (listUpfile.Count > 0)
        {
            int k = 1;
            foreach (BCW.Model.Upfile n in listUpfile)
            {
                if (k % 2 == 0)
                {
                    builder.Append(Out.Tab("<div class=\"text\">", "<br />"));
                }
                else
                {
                    if (k == 1)
                    {
                        builder.Append(Out.Tab("<div>", ""));
                    }
                    else
                    {
                        builder.Append(Out.Tab("<div>", "<br />"));
                    }
                }
                string Content = n.Content;
                if (string.IsNullOrEmpty(Content))
                {
                    Content = "无标题";
                }

                if (n.Types == 1)
                {
                    if (showtype == 0)
                    {
                        builder.Append("<a href=\"" + Utils.getUrl("/showpic.aspx?pic=" + n.Files + "&amp;backurl=" + Utils.PostPage(1) + "") + "\"><img src=\"" + n.PrevFiles + "\" alt=\"load\"/></a><br />" + ((pageIndex - 1) * pageSize + k) + "." + Content + "");
                    }
                    else
                    {
                        builder.Append("<a href=\"" + Utils.getUrl("/showpic.aspx?pic=" + n.Files + "&amp;backurl=" + Utils.PostPage(1) + "") + "\"><img src=\"" + n.Files + "\" alt=\"load\"/></a><br />" + ((pageIndex - 1) * pageSize + k) + "." + Content + "");
                    }
                }
                else
                {
                    builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?act=down&amp;leibie=" + n.Types + "&amp;id=" + n.ID + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">" + ((pageIndex - 1) * pageSize + k) + "" + Content + "(" + BCW.Files.FileTool.GetContentLength(n.FileSize) + ")</a>");
                }

                if (n.UsID == uid)
                {
                    builder.Append("<a href=\"" + Utils.getUrl("albums.aspx?act=edit&amp;leibie=" + n.Types + "&amp;id=" + n.ID + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">[改]</a>");
                }

                if (n.UsID == uid || new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_DelFile, uid, forumid))
                {
                    builder.Append("<a href=\"" + Utils.getUrl("filelist.aspx?act=delfile&amp;forumid=" + forumid + "&amp;bid=" + bid + "&amp;reid=" + reid + "&amp;id=" + n.ID + "&amp;backurl=" + Utils.getPage(0) + "") + "\">[删]</a>");
                }
                k++;
                builder.Append(Out.Tab("</div>", ""));
            }

            // 分页
            builder.Append(BasePage.ForumMultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0));
        }
        else
        {
            builder.Append(Out.Div("div", "没有相关记录.."));
        }
        builder.Append(Out.Tab("<div class=\"title\">", Out.Hr()));
        builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">首页</a>-");
        builder.Append("<a href=\"" + Utils.getPage("forum.aspx?forumid=" + forumid + "") + "\">上级</a>-");

        if (reid > 0)
        {
            builder.Append("<a href=\"" + Utils.getUrl("reply.aspx?act=view&amp;forumid=" + forumid + "&amp;bid=" + bid + "&amp;reid=" + new BCW.BLL.Reply().GetFloor2(reid) + "&amp;backurl=" + Utils.getPage(0) + "") + "\">回帖</a>-");
        }

        builder.Append("<a href=\"" + Utils.getUrl("topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "&amp;backurl=" + Utils.getPage(0) + "") + "\">主题帖</a>");
        builder.Append(Out.Tab("</div>", ""));
    }
Exemplo n.º 14
0
    private void DelFilePage(int uid, int forumid, int bid, int reid)
    {
        Master.Title = "删除附件";
        int id = int.Parse(Utils.GetRequest("id", "all", 2, @"^[1-9]\d*$", "ID错误"));

        BCW.Model.Upfile model = new BCW.BLL.Upfile().GetUpfileMe(id);
        if (model == null || model.BID != bid)
        {
            Utils.Error("不存在的记录", "");
        }
        if (model.UsID != uid && !new BCW.User.Role().IsUserRole(BCW.User.Role.enumRole.Role_DelFile, uid, forumid))
        {
            Utils.Error("你的权限不足", "");
        }
        string info = Utils.GetRequest("info", "all", 1, "", "");

        if (info != "ok")
        {
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("确定删除此附件吗");
            builder.Append(Out.Tab("</div>", ""));
            if (model.UsID != uid)
            {
                strText = "理由:,,,,,,";
                strName = "Why,forumid,bid,reid,id,act,info,backurl";
                strType = "text,hidden,hidden,hidden,hidden,hidden,hidden,hidden";
                strValu = "'" + forumid + "'" + bid + "'" + reid + "'" + id + "'delfile'ok'" + Utils.getPage(0) + "";
                strEmpt = "true,false,false,false,false,false,false,false";
                strIdea = "/";
                strOthe = "确定删除,filelist.aspx,post,1,red";
                builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));

                builder.Append(Out.Tab("<div>", ""));
                builder.Append("<a href=\"" + Utils.getUrl("filelist.aspx?act=file&amp;forumid=" + forumid + "&amp;bid=" + bid + "&amp;reid=" + reid + "&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + "") + "\">取消</a>");
                builder.Append(Out.Tab("</div>", ""));
            }
            else
            {
                builder.Append(Out.Tab("<div>", "<br />"));
                builder.Append("<a href=\"" + Utils.getUrl("filelist.aspx?info=ok&amp;act=delfile&amp;forumid=" + forumid + "&amp;bid=" + bid + "&amp;reid=" + reid + "&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + "") + "\">确定删除</a><br />");
                builder.Append("<a href=\"" + Utils.getUrl("filelist.aspx?act=file&amp;forumid=" + forumid + "&amp;bid=" + bid + "&amp;reid=" + reid + "&amp;backurl=" + Utils.getPage(0) + "") + "\">先留着吧..</a>");
                builder.Append(Out.Tab("</div>", ""));
            }
        }
        else
        {
            new BCW.BLL.Upfile().Delete(id);
            //删除文件
            BCW.Files.FileTool.DeleteFile(model.Files);
            if (!string.IsNullOrEmpty(model.PrevFiles))
            {
                BCW.Files.FileTool.DeleteFile(model.PrevFiles);
            }
            string strRe = string.Empty;
            //减去文件数
            if (reid > 0)
            {
                new BCW.BLL.Reply().UpdateFileNum(reid, -1);
                strRe = "(回复ID:" + reid + ")";
            }
            else
            {
                new BCW.BLL.Text().UpdateFileNum(bid, -1);
                int FileNum = new BCW.BLL.Text().GetFileNum(bid);
                if (FileNum == 0)
                {
                    //去掉附件帖标识
                    new BCW.BLL.Text().UpdateTypes(bid, 0);
                }
            }
            //记录日志
            string Why    = Utils.GetRequest("Why", "post", 3, @"^[^\^]{1,20}$", "理由限20字内,可留空");
            string strLog = string.Empty;
            if (model.UsID != uid)
            {
                strLog = "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + new BCW.BLL.User().GetUsName(model.UsID) + "[/url]的主题[url=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]《" + new BCW.BLL.Text().GetTitle(bid) + "》[/url]" + strRe + "附件被[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + new BCW.BLL.User().GetUsName(uid) + "[/url]删除!";
            }
            else
            {
                strLog = "[url=/bbs/uinfo.aspx?uid=" + model.UsID + "]" + new BCW.BLL.User().GetUsName(model.UsID) + "[/url]自删主题[url=/bbs/topic.aspx?forumid=" + forumid + "&amp;bid=" + bid + "]《" + new BCW.BLL.Text().GetTitle(bid) + "》[/url]的" + strRe + "附件!";
            }

            new BCW.BLL.Forumlog().Add(7, forumid, strLog);
            Utils.Success("删除附件", "删除附件成功,正在返回..", Utils.getUrl("filelist.aspx?act=file&amp;forumid=" + forumid + "&amp;bid=" + bid + "&amp;reid=" + reid + "&amp;backurl=" + Utils.getPage(0) + ""), "1");
        }
    }