コード例 #1
0
ファイル: UserFuncController.cs プロジェクト: baixue001/IPS
        public IActionResult TalkLog_Down()
        {
            DataTable dt = msgbll.SelByWhere(mu.UserID, buser.GetUserByName(RequestEx["reuser"]).UserID, RequestEx["sdate"], RequestEx["edate"]);

            if (dt.Rows.Count < 1)
            {
                return(WriteErr("没有聊天记录,无法导出"));
            }
            StringBuilder sb = new StringBuilder();

            foreach (DataRow dr in dt.Rows)
            {
                sb.Append(dr["UserName"] + dr["CDate"].ToString() + ":\r\n");
                sb.Append(dr["Content"].ToString() + "\r\n");
                sb.Append("---------------------------------------------------------------\r\n");
            }
            string vpath    = "/Temp/ChatHis/";
            string filename = function.GetRandomString(8) + ".txt";

            SafeSC.WriteFile(vpath + filename, sb.ToString());
            //SafeSC.DownFile(vpath + filename);
            SafeSC.DelFile(vpath + filename);
            // Response.End();
            return(View());
        }
コード例 #2
0
        protected void EGV_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string fname   = e.CommandArgument.ToString();
            string logpath = GetLogPath() + fname;

            switch (e.CommandName)
            {
            case "view":
                viewdiv.Visible    = true;
                egvdiv.Visible     = false;
                Curfname_Hid.Value = fname;
                string text = SafeSC.ReadFileStr(logpath);
                if (text.Trim().Length < 30)
                {
                    text = "该日志无记录";
                }
                LogTxt_Li.Text = text.Replace("\r\n", "<br />");    //替换文本换行
                break;

            case "down":
                SafeSC.DownFile(logpath);
                break;

            case "del2":
                SafeSC.DelFile(logpath);
                MyBind();
                break;
            }
        }
コード例 #3
0
ファイル: ContentController.cs プロジェクト: zoomlacms/web049
        public string ContentManage_Del(string ids)
        {
            if (string.IsNullOrEmpty(ids))
            {
                return("未指定需要删除的内容");
            }
            //用户只能删除自己有管理权限的节点下的内容
            string[] nids    = badmin.GetNodeAuthStr("modify").Split(',');
            bool     isSuper = adminMod.IsSuperAdmin();

            foreach (string item in ids.Split(','))
            {
                int id = DataConvert.CLng(item);
                if (id < 1)
                {
                    continue;
                }
                M_CommonData conMod = contentBll.GetCommonData(id);
                //超管或其角色有对应的操作权限
                if (isSuper || nids.FirstOrDefault(p => p.Equals(conMod.NodeID.ToString())) != null)
                {
                    if (!string.IsNullOrEmpty(conMod.HtmlLink))
                    {
                        SafeSC.DelFile(conMod.HtmlLink);
                    }
                    conMod.Status   = (int)ZLEnum.ConStatus.Recycle;
                    conMod.IsCreate = 0;
                    conMod.HtmlLink = "";
                    contentBll.UpdateByID(conMod);
                }
            }
            return(M_APIResult.Success.ToString());
        }
コード例 #4
0
ファイル: ContentController.cs プロジェクト: zoomlacms/web049
        public int ContentManage_Html(int id, string action)
        {
            B_Create     createBll = new B_Create();
            M_CommonData conMod    = contentBll.SelReturnModel(id);

            switch (action)
            {
            case "create":
            {
                conMod.IsCreate = 1;
                contentBll.UpdateByID(conMod);
                createBll.CreateInfo(conMod.GeneralID, conMod.NodeID, conMod.ModelID);
                createBll.CreatePageIndex();
            }
            break;

            case "del":
            {
                if (!string.IsNullOrEmpty(conMod.HtmlLink))
                {
                    conMod.HtmlLink = "";
                    SafeSC.DelFile(conMod.HtmlLink);
                }
                conMod.IsCreate = 0;
                createBll.CreatePageIndex();
                contentBll.UpdateByID(conMod);
            }
            break;
            }
            return(M_APIResult.Success);
        }
コード例 #5
0
        public static string SaveImage(string vpath, Bitmap bmp)
        {
            string ppath = function.VToP(vpath.Replace(" ", ""));
            string dir   = Path.GetDirectoryName(ppath);

            if (!Directory.Exists(dir))
            {
                SafeSC.CreateDir(function.PToV(dir));
            }
            if (File.Exists(ppath))
            {
                SafeSC.DelFile(vpath);
            }
            string ext = Path.GetExtension(vpath).ToLower();

            switch (ext)
            {
            case ".jpg":
                bmp.Save(ppath, ImageFormat.Jpeg);
                break;

            case ".png":
                bmp.Save(ppath, ImageFormat.Png);
                break;

            case ".gif":
                bmp.Save(ppath, ImageFormat.Gif);
                break;

            default:
                bmp.Save(ppath, ImageFormat.Jpeg);
                break;
            }
            return(vpath);
        }
コード例 #6
0
ファイル: VideoHelper.cs プロジェクト: linrb/CMS-Source-code
        //添加水印,fileName视频地址,imgFile水印图片地址,outputFile输出地址
        /// <summary>
        /// 1,图片文件必须在工作目录下,不能带/,如果要同时加多个或加在其他位置,建议直接用Png透明图
        /// 2,水印图片不能大于视频
        /// </summary>
        /// <param name="imgfile">水印图片路径</param>
        /// <param pos="位置">1:左上,2:右上,3:左下,4:右下</param>
        public string WaterMark(string infile, string outfile, string imgfile, int pos = 1)
        {
            //if (imgfile.Contains("\\") || imgfile.Contains("/")) { throw new Exception("水印图片路径错误"); }
            infile  = function.VToP(infile);
            outfile = function.VToP(outfile);
            imgfile = function.VToP(imgfile);
            if (!File.Exists(imgfile))
            {
                throw new Exception(imgfile + ",不存在");
            }
            if (File.Exists(outfile))
            {
                SafeSC.DelFile(function.PToV(outfile));
            }
            string imgname = Path.GetFileName(imgfile);

            File.Copy(imgfile, WorkingPath + imgname, true);//图片必须指定工作路径,否则无法加上,图片也不能传全路径
            //string param = " -i " + infile + " -vf \"movie=" + imgfile + " [watermark]; [in][watermark] overlay=0:0 [out]\" " + outfile;

            string param = "";

            switch (pos)
            {
            case 2:    //右上
                param = " -i {0} -vf \"movie={1} [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]\" {2}";
                break;

            case 3:    //左下
                param = " -i {0} -vf \"movie={1} [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]\" {2}";
                break;

            case 4:    //右下
                param = " -i {0} -vf \"movie={1} [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]\" {2}";
                break;

            default:    //左上
                param = " -i {0} -vf \"movie={1} [watermark]; [in][watermark] overlay=0:0 [out]\" {2}";
                break;
            }
            param = string.Format(param, infile, imgname, outfile);
            //Top left corner
            //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:10 [out]" outputvideo.flv

            //Top right corner
            //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" outputvideo.flv

            //Bottom left corner
            //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]" outputvideo.flv

            //Bottom right corner
            //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" outputvideo.flv

            RunProcess(param, WorkingPath);//第二个参数为物理路径
            return(outfile);
        }
コード例 #7
0
        protected void RPT_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string fname  = e.CommandArgument.ToString();
            string fvpath = VDir + fname;

            switch (e.CommandName)
            {
            case "del":
                SafeSC.DelFile(fvpath);
                break;
            }
            Response.Redirect(Request.RawUrl);
        }
コード例 #8
0
 protected void EGV_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     switch (e.CommandName)
     {
     case "del2":
         int             id       = Convert.ToInt32(e.CommandArgument);
         M_Content_Video videoMod = videoBll.SelReturnModel(id);
         videoBll.Del(id);
         SafeSC.DelFile(videoMod.VPath);
         break;
     }
     MyBind();
 }
コード例 #9
0
ファイル: TemplateController.cs プロジェクト: baixue001/IPS
        public IActionResult CSSManage()
        {
            if (Request.IsAjax())
            {
                M_APIResult ret = new M_APIResult(M_APIResult.Failed);
                B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.system, "tlp");
                try
                {
                    string action = GetParam("action");
                    string vpath  = Request.Form["vpath"];
                    if (string.IsNullOrEmpty(vpath))
                    {
                        throw new Exception("未指定文件");
                    }
                    switch (action)
                    {
                    case "del":
                    {
                        SafeSC.DelFile(CSSBaseDir + vpath);
                        ret.retcode = M_APIResult.Success;
                    }
                    break;

                    case "copy":
                    {
                        string src = function.VToP(CSSBaseDir + vpath);
                        string tar = function.VToP((CSSBaseDir + vpath).Replace(".", "_" + function.GetRandomString(3) + "."));
                        IOHelper.File_Copy(src, tar);
                        ret.retcode = M_APIResult.Success;
                    }
                    break;

                    case "down":
                    {
                    }
                    break;

                    default:
                        ret.retmsg = "[" + action + "]不存在";
                        break;
                    }
                }
                catch (Exception ex) { ret.retmsg = ex.Message; }
                return(Content(ret.ToString()));
            }
            ViewBag.BaseDir = CSSBaseDir;
            return(View());
        }
コード例 #10
0
        protected void BatDel_Btn_Click(object sender, EventArgs e)
        {
            string names = Request.Form["idchk"];

            if (!string.IsNullOrEmpty(names))
            {
                foreach (string name in names.Split(','))
                {
                    SafeSC.DelFile(BaseDir + name);
                }
                function.WriteSuccessMsg("操作成功");
            }
            else
            {
                function.Script(this, "alert('请先选择文档');");
            }
        }
コード例 #11
0
        public void MyBind()
        {
            NodeDPBind();
            if (!string.IsNullOrEmpty(Url))//普通页面,新浪等
            {
                string html = htmlHelper.GetHtmlFromSite(Url);
                Content_T.Text = acBll.GetArticleFromWeb(html, Url);
                Title_T.Text   = Request["Title"] == null?htmlHelper.GetTitle(html) : Request["Title"];

                SourceUrl_T.Text = Request["Source"] == null?GetSource(Url) : Request["Source"];

                Author_T.Text = Request["Author"] == null?badmin.GetAdminLogin().AdminName : Request["Author"];

                Synopsis_T.Text = DateTime.Now.ToString();
            }
            else if (!string.IsNullOrEmpty(Request.Form["cms_json_hid"]))//页面下载,视频下载等
            {
                JObject json = (JObject)JsonConvert.DeserializeObject(Request.Form["cms_json_hid"]);
                switch (json["action"].ToString())
                {
                case "downpage":
                    if (json["url"] == null || string.IsNullOrEmpty(json["url"].ToString()))
                    {
                        return;
                    }
                    string title = json["title"].ToString();
                    title = string.IsNullOrEmpty(title) ? "无标题.mht" : SafeC.RemovePathChar(title + ".mht");
                    string vpath = "/Temp/DownPage/" + title;
                    if (!Directory.Exists(Server.MapPath("/Temp/DownPage/")))
                    {
                        Directory.CreateDirectory(Server.MapPath("/Temp/DownPage/"));
                    }
                    vpath = htmlHelper.DownToMHT(json["url"].ToString(), vpath);
                    SafeSC.DownFile(vpath);
                    SafeSC.DelFile(vpath);
                    Response.End();
                    break;

                case "video":
                    Title_T.Text     = json["title"].ToString();
                    SourceUrl_T.Text = GetSource(json["url"].ToString());
                    Content_T.Text   = json["content"].ToString();
                    break;
                }
            }
        }
コード例 #12
0
        protected void RPT_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "del2":
                string deletepath = @"/Template/" + e.CommandArgument.ToString() + "/";
                SafeSC.DelFile(deletepath);
                break;

            case "set":
                string tempdir = @"/Template/" + e.CommandArgument;
                SiteConfig.SiteOption.TemplateDir = tempdir;
                SiteConfig.SiteOption.CssDir      = tempdir + "/style";
                SiteConfig.Update();
                break;
            }
            MyBind();
        }
コード例 #13
0
ファイル: CloudController.cs プロジェクト: baixue001/IPS
        public int Cloud_Del(string id)
        {
            M_User_Cloud cloudMod = cloudBll.SelReturnModel(id);

            if (cloudMod == null)
            {
                return(-1);
            }
            if (cloudMod.FileType == 1)
            {
                SafeSC.DelFile(cloudMod.VPath + cloudMod.SFileName);
            }
            else
            {
                SafeSC.DelFile(cloudMod.VPath + cloudMod.FileName);
            }
            cloudBll.DelByFile(cloudMod.Guid);
            return(1);
        }
コード例 #14
0
        /// <summary>
        /// 删除数据库记录与文件
        /// </summary>
        public void RealDel(string ids)
        {
            if (string.IsNullOrEmpty(ids))
            {
                return;
            }
            SafeSC.CheckIDSEx(ids);
            DataTable dt = DBCenter.Sel(TbName, "ID IN (" + ids + ")");

            foreach (DataRow dr in dt.Rows)
            {
                try
                {
                    SafeSC.DelFile(DataConvert.CStr(dr["VPath"]));
                }
                catch (Exception ex) { ZLLog.L("logo_icon_del:" + ex.Message); }
            }
            Del(ids);
        }
コード例 #15
0
        protected void EGV_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string name = e.CommandArgument.ToString();

            switch (e.CommandName)
            {
            case "download":
                SafeSC.DownFile(mnBll.vdir + name, name);
                break;

            case "restore":
                mnBll.RestoreByName(name);
                function.WriteSuccessMsg("恢复完成");
                break;

            case "del2":
                SafeSC.DelFile(mnBll.vdir + name);
                function.WriteSuccessMsg("删除完成");
                break;
            }
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (function.isAjax())
            {
                string action = Request.Form["action"];
                string value  = Request.Form["value"];
                string result = "";
                switch (action)
                {
                case "ReName":
                {
                    int    id      = Convert.ToInt32(value.Split('|')[0]);
                    string newname = value.Split('|')[1];
                    fileBll.ReName(id, newname);
                }
                break;

                case "Del":
                {
                    int         id      = Convert.ToInt32(value);
                    M_Plat_File fileMod = fileBll.SelReturnModel(id);
                    if (SafeSC.DelFile(fileMod.VPath + fileMod.SFileName))
                    {
                        fileBll.Del(fileMod.Guid);
                    }
                    else
                    {
                        result = "0";
                    }
                }
                break;
                }
                Response.Write(result); Response.Flush(); Response.End(); return;
            }
            if (!IsPostBack)
            {
                MyBind();
            }
        }
コード例 #17
0
ファイル: ContentController.cs プロジェクト: zoomlacms/web049
        //根据csv或xlsx,将数据导入数据库
        public void ContentManage_Import()
        {
            HttpPostedFileBase file = Request.Files["fileImp"];

            if (file == null)
            {
                function.WriteErrMsg("没有上传数据文件"); return;
            }
            string exName = Path.GetExtension(file.FileName).ToLower();

            if (!exName.Equals(".csv") && !exName.Equals(".xls") && !exName.Equals(".xlsx"))//判断扩展名
            {
                function.WriteErrMsg("上传的文件不是符合扩展名csv,请重新选择!"); return;
            }
            string vpath = SafeSC.SaveFile(ZLHelper.GetUploadDir_System("Content", "Import", "yyyyMMdd"), function.GetRandomString(6) + exName, IOHelper.StreamToBytes(file.InputStream));
            //导入文件到数据集对象
            DataTable dt = null;

            if (exName.Equals(".csv"))
            {
                OfficeHelper office = new OfficeHelper();
                dt = office.OpenCSV(vpath);
            }
            else
            {
                SqlBase excel = SqlBase.CreateHelper("excel");
                excel.ConnectionString = vpath;
                dt = excel.ExecuteTable(new SqlModel()
                {
                    tbName = excel.Table_List().Rows[0]["name"].ToString()
                });
            }
            SafeSC.DelFile(vpath);
            DataSet newDs = Import_CreateTable(dt);

            Import_SaveDB(newDs);//保存到数据库
        }
コード例 #18
0
        protected void downloadData()
        {
            string fileUrl  = "http://update.z01.com/ZL_DataList.txt";//template +
            string saveDir  = "/UploadFiles/TSql/";
            string savePath = saveDir + "ZL_DataList.sql";

            if (File.Exists(Server.MapPath(savePath)))
            {
                SafeSC.DelFile(savePath);
            }
            if (!Directory.Exists(Server.MapPath(saveDir)))
            {
                SafeSC.CreateDir(saveDir);
            }
            httpHelper.DownFile(fileUrl, savePath);
            if (!ExecutionSql(Server.MapPath(savePath), SqlHelper.ConnectionString))
            {
                function.WriteErrMsg("操作失败");
            }
            else
            {
                function.WriteSuccessMsg("初始化成功!", "DatalistProfile.aspx");
            }
        }