private String imgtext(String imgs) { String img = ""; int ps = imgs.IndexOf("<IMG"); if (ps >= 0) { imgs = imgs.Substring(ps); ps = imgs.IndexOf(">"); if (ps >= 0) { img = imgs.Substring(0, ps + 1); ps = img.IndexOf("src="); img = img.Substring(ps + 5); ps = img.IndexOf(" "); if (ps >= 0) { img = img.Substring(0, ps - 1); } } } if (img.Length > 0) if (!img.ToLower().StartsWith("http://")) { JpSite site = new JpSite(); img = "http://" + site.host + img; } return img; }
//静态发布栏目和内容页 protected void btnpub3_Click(object sender, EventArgs e) { try { TPortalClass.JpSite site = new TPortalClass.JpSite(); TPortalClass.JpShtml jpshtml = new TPortalClass.JpShtml(); TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); DataTable dt_col = JpColumns.GetColumnsOnline(); if (dt_col.Rows.Count > 0) { for (int i = 0; i < dt_col.Rows.Count; i++) { if (dt_col.Rows[i]["shtml"].ToString() == "1") //静态发布的栏目 { TPortalClass.JpColumns pubcol = new TPortalClass.JpColumns(dt_col.Rows[i]["cid"].ToString()); pubcol.shtmlpublish(2, int.Parse(txtdays.Value)); } } } Response.Write("<script language=javascript>alert('发布成功!');window.location='pubhtml.aspx';</script>"); } catch { Response.Write("<script language=javascript>alert('发布失败!');window.location='pubhtml.aspx';</script>"); } finally { } }
private void DataPlay() { if (this.Request.QueryString["idea"] != null) { this.fdIdeaFieldName.Value = this.Request.QueryString["idea"].ToString(); //要赋值的意见域 } //this.fdCurrentSysUser.Value = this.Session["hyuid"].ToString(); //this.fdCurrentUserCh.Value = this.Session["hyuname"].ToString(); //this.fdCurrentTime.Value = System.DateTime.Now.ToString(); //string ls_str = "办公室,政策法规处,行政审批处,民族处,宗教一处,宗教二处,慈溪市民宗局,余姚市民宗局,奉化市民宗局,宁海县民宗局,象山县民宗局,海曙区民宗局,江东区民宗局,江北区民宗局,镇海区民宗局,鄞州区民宗局,北仑区民宗局,东钱湖民宗局,大榭民宗局,高新区民宗局"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_str = JpSite.copyright; string[] lv_str = ls_str.Split('#'); DataTable dt = new DataTable(); //增加列 DataColumn col1 = new DataColumn("hy_lgdw", typeof(string)); dt.Columns.Add(col1); //增加行 for (int i = 0; i < lv_str.Length; i++) { DataRow dr = dt.NewRow(); dr["hy_lgdw"] = lv_str[i].ToString(); dt.Rows.Add(dr); } //HyoaClass.Hyoa_publicidea Hyoa_publicidea = new HyoaClass.Hyoa_publicidea(); //DataTable dt = Hyoa_publicidea.Getpublicideas(); if (dt.Rows.Count > 0) { this.fdListCommonIdeas.DataSource = dt; this.fdListCommonIdeas.DataTextField = "hy_lgdw"; this.fdListCommonIdeas.DataValueField = "hy_lgdw"; this.fdListCommonIdeas.DataBind(); this.fdListCommonIdeas.SelectedIndex = 0; } dt.Clear(); //HyoaClass.Hyoa_myidea Hyoa_myidea = new HyoaClass.Hyoa_myidea(); //DataTable dt2 = Hyoa_myidea.Getideasbyuserid(this.Session["hyuid"].ToString()); //if (dt2.Rows.Count > 0) //{ // this.fdListCommonIdeas_Personal.DataSource = dt2; // this.fdListCommonIdeas_Personal.DataTextField = "hy_idea"; // this.fdListCommonIdeas_Personal.DataValueField = "hy_idea"; // this.fdListCommonIdeas_Personal.DataBind(); // this.fdListCommonIdeas_Personal.SelectedIndex = 0; //} //dt2.Clear(); }
protected void Page_Load(object sender, EventArgs e) { //if (!this.IsPostBack) //{ if (Session["uid"].ToString() == "") { this.Response.Redirect("login.aspx?url=" + this.Request.RawUrl.ToString()); } else { TPortalClass.JpUsers JpUsers = new TPortalClass.JpUsers(Session["uid"].ToString()); lbluserinfo.Text = JpUsers.uname; if (JpUsers.deptid != "") { TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); DataTable dt = JpDepts.GetDept(JpUsers.deptid); if (dt.Rows.Count > 0) { lbluserinfo.Text += "(" + dt.Rows[0]["deptname"].ToString() + ")"; } } TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); webname.Text = JpSite.SiteName; weburl.Text = JpSite.host; webcompany.Text = "宁波移信"; dbname.Text = JpSite.dbname; versions.Text = JpSite.version; //读取登录信息 TPortalClass.JpLog JpLog = new TPortalClass.JpLog(); DataTable dt_log = JpLog.Getlogs(); if (dt_log.Rows.Count > 0) { litIP.Text = dt_log.Rows[0]["hy_oppip"].ToString(); } if (dt_log.Rows.Count > 1) { litBackIP.Text = dt_log.Rows[1]["hy_oppip"].ToString(); litBackTime.Text = dt_log.Rows[1]["hy_createtime"].ToString(); } } //} }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); JpSite.SiteName = this.txthy_siteName.Text; JpSite.CompName = this.txthy_compName.Text; JpSite.host = this.txthy_host.Text; JpSite.root = this.txtroot.Text; JpSite.tel = this.txthy_tel.Text; JpSite.fax = this.ddlhtml.SelectedValue; JpSite.adminemail = this.txthy_adminemail.Text; JpSite.bah = this.txthy_bah.Text; JpSite.seo_indextitle = this.txthy_seo_indextitle.Text; JpSite.seo_indexkeyword = this.txthy_seo_indexkeyword.Text; JpSite.seo_indexdescription = this.txthy_seo_indexdescription.Text; JpSite.copyright = this.txthy_copyright.Text; JpSite.homepage = this.txthy_homepage.Text; JpSite.dbname = this.txthy_dbname.Text; JpSite.visitors = System.Int32.Parse(this.txthy_visitors.Text); JpSite.version = this.txthy_version.Text; JpSite.nwyuming = this.txthy_nwyuming.Text; JpSite.wwyuming = this.txthy_wwyuming.Text; JpSite.lan_big5 = this.ddllan_big5.SelectedValue; //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "修改", "修改系统设置记录[id:" + this.txthy_siteName.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpSite.Update(); Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }
public JpRSS(String cname, string xmlDoc) { try { JpSite site = new JpSite(); stream = new FileStream(xmlDoc, FileMode.Create, FileAccess.Write, FileShare.None); writer = new XmlTextWriter(stream, Encoding.UTF8); //writer = new XmlTextWriter(xmlDoc, Encoding.UTF8); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(true); writer.WriteComment("Rss Publish . Author: delphitom. email:[email protected]. "); writer.WriteStartElement("rss"); writer.WriteAttributeString("version", "2.0"); writer.WriteStartElement("channel"); writer.WriteStartElement("title"); writer.WriteString(cname); writer.WriteEndElement(); writer.WriteStartElement("link"); writer.WriteString("http://" + site.host); writer.WriteEndElement(); writer.WriteStartElement("description"); writer.WriteString(site.SiteName + " ��Ϣ���� "); writer.WriteEndElement(); writer.WriteStartElement("copyright"); writer.WriteString("Copyright ������Ϣ��ҵ����˾"); writer.WriteEndElement(); writer.WriteStartElement("language"); writer.WriteString("zh-cn"); writer.WriteEndElement(); //writer.Close(); //stream.Close(); } catch { } }
private void DDLDataBind() { JpSite JpSite = new JpSite(); DataTable dt = JpSite.GetSites(); string[] list = dt.Rows[0]["seo_indexdescription"].ToString().Split('#'); for (int i = 0; i < list.Length; i++) { txthy_way.Items.Insert(i, new ListItem(list[i].ToString())); } }
//发布 protected void btnpubart_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "发布成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; for (int i = 0; i < rptList.Items.Count; i++) { //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (ls_html == "开启") { JpArticle.PubAll("," + id + ",", this.txtpubtime.Value, this.txtendtime.Value); //静态发布时使用 } else { JpArticle.PubAllNoHtml("," + id + ",", this.txtpubtime.Value, this.txtendtime.Value);//非静态发布时使用 } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "发布", "批量发布文章记录", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
//批量转移 protected void btnplzy_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "批量转移成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; string ls_ids = ""; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); //string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (ls_ids == "") { ls_ids = id.ToString(); } else { ls_ids = ls_ids + "," + id.ToString(); } string ls_cids = this.txtcheckcid.Text; string[] lv_cids = ls_cids.Split('+'); for (int j = 0; j < lv_cids.Length; j++) { if (lv_cids[j] != "") { JpArticle.aid = id; JpArticle.cid = lv_cids[j]; JpArticle.UpdatePlzylm(); } } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); if (ls_ids != "") { string ls_pubtime = System.DateTime.Now.ToString(); string ls_endtime = System.DateTime.Now.AddYears(10).ToString(); if (ls_html == "开启") { JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime); } //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "转移", "批量转移文章ID:" + ls_ids, Session["uid"].ToString(), Session["uname"].ToString()); } else { ls_tip = "批量转移失败!请选中复制源文章和选择一个目标栏目。"; } Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
//全部复制 protected void btnallfz_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "全部复制成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; string ls_ids = ""; //根据栏目ID得到该栏目下所有文章 DataTable dt = JpArticle.GetArticlesByCid_fb(this.txtcid.Text); for (int i = 0; i < dt.Rows.Count; i++) { int id = (int)dt.Rows[i]["aid"]; string ls_cids = this.txtcheckcid.Text; string[] lv_cids = ls_cids.Split('+'); for (int j = 0; j < lv_cids.Length; j++) { if (lv_cids[j] != "") { JpArticle.cid = lv_cids[j]; JpArticle.title = dt.Rows[i]["title"].ToString(); JpArticle.subhead = dt.Rows[i]["subhead"].ToString(); JpArticle.ht_content = dt.Rows[i]["ht_content"].ToString(); JpArticle.summary = dt.Rows[i]["summary"].ToString(); JpArticle.author = dt.Rows[i]["author"].ToString(); JpArticle.status = dt.Rows[i]["status"].ToString(); JpArticle.indexdisplaypicpath = dt.Rows[i]["indexdisplaypicpath"].ToString(); JpArticle.seotitle = dt.Rows[i]["seotitle"].ToString(); JpArticle.seokeywords = dt.Rows[i]["seokeywords"].ToString(); JpArticle.seodescription = dt.Rows[i]["seodescription"].ToString(); JpArticle.asort = (int)dt.Rows[i]["asort"]; JpArticle.iftop = dt.Rows[i]["iftop"].ToString(); JpArticle.topendtime = dt.Rows[i]["topendtime"].ToString(); JpArticle.ifindexdisplay = dt.Rows[i]["ifindexdisplay"].ToString(); JpArticle.ifcomment = dt.Rows[i]["ifcomment"].ToString(); JpArticle.source = dt.Rows[i]["source"].ToString(); JpArticle.role_userid = dt.Rows[i]["role_userid"].ToString(); JpArticle.role_username = dt.Rows[i]["role_username"].ToString(); JpArticle.input = dt.Rows[i]["input"].ToString(); JpArticle.GUID = System.Guid.NewGuid().ToString(); JpArticle.map_cid = dt.Rows[i]["map_cid"].ToString(); JpArticle.map_aid = (int)dt.Rows[i]["map_aid"]; JpArticle.targettype = dt.Rows[i]["targettype"].ToString(); JpArticle.endtime = dt.Rows[i]["endtime"].ToString(); JpArticle.pubtime = dt.Rows[i]["pubtime"].ToString(); int ls_newaid = JpArticle.Insert(); if (ls_ids == "") { ls_ids = ls_newaid.ToString(); } else { ls_ids = ls_ids + "," + ls_newaid.ToString(); } } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); if (ls_ids != "") { //静态发布时使用 string ls_pubtime = System.DateTime.Now.ToString(); string ls_endtime = System.DateTime.Now.AddYears(10).ToString(); if (ls_html == "开启") { JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime); } //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "全部复制", "全部复制文章栏目ID:" + this.txtcid.Text, Session["uid"].ToString(), Session["uname"].ToString()); } else { ls_tip = "全部复制失败!请选中复制源栏目和选择目标栏目。"; } Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
//批量复制 protected void btnplfz_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "批量复制成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; string ls_ids = ""; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); if (ls_ids == "") { ls_ids = id.ToString(); } else { ls_ids = ls_ids + "," + id.ToString(); } //string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { TPortalClass.JpArticle article = new TPortalClass.JpArticle(id); string ls_cids = this.txtcheckcid.Text; string[] lv_cids = ls_cids.Split('+'); for (int j = 0; j < lv_cids.Length; j++) { if (lv_cids[j] != "") { JpArticle.cid = lv_cids[j]; JpArticle.title = article.title; JpArticle.subhead = article.subhead; JpArticle.ht_content = article.ht_content; JpArticle.summary = article.summary; JpArticle.author = article.author; JpArticle.status = article.status; JpArticle.indexdisplaypicpath = article.indexdisplaypicpath; JpArticle.seotitle = article.seotitle; JpArticle.seokeywords = article.seokeywords; JpArticle.seodescription = article.seodescription; JpArticle.asort = article.asort; JpArticle.iftop = article.iftop; JpArticle.topendtime = article.topendtime; JpArticle.ifindexdisplay = article.ifindexdisplay; JpArticle.ifcomment = article.ifcomment; JpArticle.source = article.source; JpArticle.role_userid = article.role_userid; JpArticle.role_username = article.role_username; JpArticle.input = article.input; JpArticle.GUID = System.Guid.NewGuid().ToString(); JpArticle.map_cid = article.map_cid; JpArticle.map_aid = article.map_aid; JpArticle.targettype = article.targettype; JpArticle.endtime = article.endtime; JpArticle.pubtime = article.pubtime; int ls_newaid = JpArticle.Insert(); if (ls_ids == "") { ls_ids = ls_newaid.ToString(); } else { ls_ids = ls_ids + "," + ls_newaid.ToString(); } } } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); if (ls_ids != "") { //静态发布时使用 string ls_pubtime = System.DateTime.Now.ToString(); string ls_endtime = System.DateTime.Now.AddYears(10).ToString(); if (ls_html == "开启") { JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime); } //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "复制", "批量复制文章ID:" + ls_ids, Session["uid"].ToString(), Session["uname"].ToString()); } else { ls_tip = "批量复制失败!请选中复制源文章和选择目标栏目。"; } Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
//全部转移 protected void btnallzy_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "批量转移成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; string ls_ids = ""; //根据栏目ID得到该栏目下所有文章 DataTable dt = JpArticle.GetArticlesByCid_fb(this.txtcid.Text); for (int i = 0; i < dt.Rows.Count; i++) { int id = (int)dt.Rows[i]["aid"]; if (ls_ids == "") { ls_ids = id.ToString(); } else { ls_ids = ls_ids + "," + id.ToString(); } string ls_cids = this.txtcheckcid.Text; string[] lv_cids = ls_cids.Split('+'); for (int j = 0; j < lv_cids.Length; j++) { if (lv_cids[j] != "") { JpArticle.aid = id; JpArticle.cid = lv_cids[j]; JpArticle.UpdatePlzylm(); } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); if (ls_ids != "") { string ls_pubtime = System.DateTime.Now.ToString(); string ls_endtime = System.DateTime.Now.AddYears(10).ToString(); if (ls_html == "开启") { JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime); } //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "全部转移", "将栏目ID:" + this.txtcid.Text + "全部转移到栏目ID:" + this.txtcheckcid.Text, Session["uid"].ToString(), Session["uname"].ToString()); } else { ls_tip = "全部转移失败!请选中复制源栏目和选择一个目标栏目。"; } Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
public string GetTelPhoneNumber(string pis_yzm) { string pos_json = ""; string ls_yzm = ConfigurationManager.AppSettings["Yanzm"].ToString(); if (pis_yzm == ls_yzm) { try { JpSite JpSite = new JpSite(); DataTable dt = JpSite.GetSites(); if (dt.Rows.Count > 0) { pos_json = "{\"code\":\"0\",\"telphonenumber\":\"" + dt.Rows[0]["seo_indextitle"].ToString() + "\"}"; } } catch { //系统错误 pos_json = "{\"code\":\"1\"}"; } finally { } } else { //非法调用 pos_json = "{\"code\":\"2\"}"; } return pos_json; }
//���·���ʱͬʱ������ҳ�����õĶ���ҳ public void PubHtml_Config() { //��̬������ҳ�����õ�ҳ�� try { String fname = ""; JpSite site = new JpSite(); JpShtml jpshtml = new JpShtml(); jpshtml.source_path = "http://" + site.host + "/index.aspx"; jpshtml.target_path = site.root + fname; jpshtml.Flush(); JpPubHtml JpPubHtml = new JpPubHtml(); String pages = JpPubHtml.pages; if (pages != "") { String[] lv_pages = pages.Split(','); for (int i = 0; i < lv_pages.Length; i++) { fname = lv_pages[i].Substring(0, lv_pages[i].LastIndexOf(".")) + ".html"; jpshtml.source_path = "http://" + site.host + lv_pages[i]; jpshtml.target_path = site.root + fname; jpshtml.Flush(); } } } catch { } }
//发布 protected void btnFB_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "发布成功!"; //新文档时 TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); JpArticle.cid = this.txtcid.Text; JpArticle.title = this.txttitle.Text; JpArticle.subhead = this.txttitle2.Text; JpArticle.ht_content = this.content1.Value; if (this.txtsummary.Text == "") { JpArticle.summary = JpCommon.OutPicGetStr(this.content1.Value, 150); } else { JpArticle.summary = this.txtsummary.Text; } JpArticle.author = this.Session["uname"].ToString(); JpArticle.status = "发布"; //JpArticle.ifindexdisplay = ""; string lsfilename = FileUpload1.FileName; string lspath = ""; string lsurl = ""; string str_path = ""; if (lsfilename != "") //attsize { //SaveCommon(ls_path, ls_attsize, lsguid); //将附件上传到服务器目录下 lspath = Server.MapPath("~/");//虚拟目录的位置 lsurl = "/upload/indexpic"; //存放的文件夹 Directory.CreateDirectory(lspath + "/" + lsurl); str_path = lspath + "/" + lsurl + "/" + lsfilename; FileUpload1.SaveAs(str_path); JpArticle.indexdisplaypicpath = lsurl + "/" + lsfilename; } else { this.txtpic.Value = JpCommon.GetImg(this.content1.Value); JpArticle.indexdisplaypicpath = this.txtpic.Value; } if (this.txtseotitle.Text == "") { JpArticle.seotitle = this.txttitle.Text; } else { JpArticle.seotitle = this.txtseotitle.Text; } if (this.txtseokeywords.Text == "") { JpArticle.seokeywords = this.txttitle.Text; } else { JpArticle.seokeywords = this.txtseokeywords.Text; } if (this.txtseodescription.Text == "") { JpArticle.seodescription = JpCommon.OutPicGetStr(this.content1.Value, 150); } else { JpArticle.seodescription = this.txtseodescription.Text; } JpArticle.asort = System.Int32.Parse(this.txtasort.Text); JpArticle.iftop = this.ddlsfzd.SelectedValue; JpArticle.topendtime = this.txttopendtime.Value; JpArticle.ifindexdisplay = this.ddlsfsyss.SelectedValue; JpArticle.ifcomment = "0"; JpArticle.source = this.txtsource.Value; JpArticle.role_userid = this.txtrole_userid.Text; JpArticle.role_username = this.txtrole_username.Text; JpArticle.input = this.Session["uid"].ToString(); JpArticle.GUID = this.txtguid.Text; if (ddllb.SelectedValue != "请选择") { JpArticle.map_cid = ddllb.SelectedValue; } else { JpArticle.map_cid = ""; } JpArticle.map_aid = 0; JpArticle.targettype = ""; JpArticle.hits = 0; JpArticle.goodnum = 0; if (radlist.SelectedValue == "否") { JpArticle.sfzwd = radlist.SelectedValue; JpArticle.zwdid = ddlwz.SelectedValue; } else { JpArticle.sfzwd = radlist.SelectedValue; JpArticle.zwdid = ""; } if (this.txtendtime.Text != "") { JpArticle.endtime = this.txtendtime.Text; } else { JpArticle.endtime = System.DateTime.Now.AddYears(10).ToString(); } if (this.txtpubtime.Text != "") { JpArticle.pubtime = this.txtpubtime.Text; } else { JpArticle.pubtime = System.DateTime.Now.ToString(); } if (this.txtop.Value == "add") { //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "审核新增", "审核新增文章记录[guid:" + this.txtguid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpArticle.Insert(); } else { //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "审核修改", "审核修改组织记录[id:" + this.txtguid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpArticle.aid = System.Int32.Parse(this.txtaid.Text); JpArticle.Update(); } //静态发布 TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; if (ls_html == "开启") { DataTable dt = JpArticle.GetArticleByGUID(this.txtguid.Text); if (dt.Rows.Count > 0) { JpArticle.PubAll("," + dt.Rows[0]["aid"].ToString() + ",", this.txtpubtime.Text, this.txtendtime.Text); } } Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }
private void DataPlay() { TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); this.txthy_siteName.Text = JpSite.SiteName; this.txthy_compName.Text = JpSite.CompName; this.txthy_host.Text = JpSite.host; this.txtroot.Text = JpSite.root; this.txthy_tel.Text = JpSite.tel; this.ddlhtml.SelectedValue = JpSite.fax; this.txthy_adminemail.Text = JpSite.adminemail; this.txthy_bah.Text = JpSite.bah; this.txthy_seo_indextitle.Text = JpSite.seo_indextitle; this.txthy_seo_indexkeyword.Text = JpSite.seo_indexkeyword; this.txthy_seo_indexdescription.Text = JpSite.seo_indexdescription; this.txthy_copyright.Text = JpSite.copyright; this.txthy_homepage.Text = JpSite.homepage; this.txthy_dbname.Text = JpSite.dbname; this.txthy_visitors.Text = JpSite.visitors.ToString(); this.txthy_version.Text = JpSite.version; this.ddllan_big5.SelectedValue = JpSite.lan_big5; this.txthy_nwyuming.Text = JpSite.nwyuming; this.txthy_wwyuming.Text = JpSite.wwyuming; }
//撤稿 protected void btnCG_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "撤稿成功!"; //新文档时 TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); if (this.txtop.Value == "add") { //新文档不能撤稿 this.Response.Write("<script>alert('新文档不能进行撤稿');</script>"); return; } else { //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "撤稿", "撤稿文章记录[id:" + this.txtguid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; if (ls_html == "开启") { JpArticle.TakeoutAll("," + this.txtaid.Text + ","); //静态发布时使用 } else { JpArticle.TakeoutAllNoHtml("," + this.txtaid.Text + ","); //非静态发布时使用 } } //变化了栏目ID,返回路径也要变掉 if (this.ddlcolname.SelectedValue != this.txtcid_url.Text) { this.txturl.Value = this.txturl.Value.Replace(this.txtcid_url.Text, this.ddlcolname.SelectedValue); } Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }
/// <summary> /// RSS��̬���� /// </summary> /// <param name="nest"></param> public void RssFlush(bool nest) { if (cid.Length > 3 && nest) { String id = cid.Substring(0, cid.Length - 3); JpColumns col = new JpColumns(id); col.RssFlush(true); } if (this.rss <= 0) return; // ������Ŀ��ҳ JpSite site = new JpSite(); //System.IO.Directory.CreateDirectory(site.root + "/rss/"); try { //JpRSS RSS = new JpRSS(cname, site.root + "/rss/" + this.cid + ".xml"); // ��һ����������ҳ String sql = "SELECT * FROM v_article_url WHERE cid LIKE @cid ORDER BY pubtime DESC";// �������� DAO db = new DAO(); SqlParameter[] sqlparam = { db.MakeInParam("@cid",SqlDbType.VarChar,cid), }; DataTable dt = db.GetDataTable(sql, sqlparam); int rows = 0; if (rss >= dt.Rows.Count) { rows = dt.Rows.Count; } else { rows = rss; } for (int i = 0; i < rows; i++) { int ld_aid = Int32.Parse(dt.Rows[i]["aid"].ToString()); String url = "http://" + site.host + this.tmp_art + "?aid=" + ld_aid; //if (this.shtml.Equals("1")) //url = "http://" + site.host + "/" + site.cidPath(cid) + ld_aid + ".html"; JpArticle art = new JpArticle(ld_aid); //JpRSSItem item = new JpRSSItem(this.cid, art.title, url, art.get("content"), 100); //item.pubDate = art.pubtime; //item.author = "TPortal"; //RSS.additem(item); } //RSS.close(); } catch { } }
/// <summary> /// ��̬������ǰ��Ŀ����ǰ��Ŀ��ҳ������ҳ�� /// </summary> /// <param name="withfiles">withfiles = 0,ֻ������Ŀҳ��withfiles = 1:������Ŀҳ��δ�������£�withfiles = 2������Ŀҳ����������</param> /// <param name="days">����</param> public void shtmlpublish(int withfiles, int days) { DAO db = new DAO(); String sql = null, listTemplate = this.tmp_col, articleTemplate = this.tmp_art; if (listTemplate == "") listTemplate = "NONE"; JpSite site = new JpSite(); if (site.homepage != listTemplate)// ������ҳ������Ŀ¼ { System.IO.Directory.CreateDirectory(site.root + "/" + site.cidPath(cid)); //����� if (site.lan_big5 == "1") { System.IO.Directory.CreateDirectory(site.root + "/big5/" + site.cidPath(cid)); } } if (listTemplate != "NONE") { // ������Ŀ��ҳ String fname = ""; if (site.homepage == listTemplate)// ��ҳ { fname = "/index.html"; } else { fname = "/" + site.cidPath(cid) + "index.html"; } String source_path = "http://" + site.host + "/" + listTemplate + "?cid=" + this.cid; String target_path = site.root + fname; JpShtml jpshtml = new JpShtml(); jpshtml.source_path = source_path; jpshtml.target_path = target_path; jpshtml.Flush(); if (site.lan_big5 == "1") { fname = "/big5" + fname; source_path = "http://" + site.host + "/big5/" + listTemplate + "?cid=" + this.cid; target_path = site.root + fname; jpshtml.source_path = source_path; jpshtml.target_path = target_path; jpshtml.Flush(); } } if (withfiles > 0) { if (days == 0) { // ��һ����������ҳ if (withfiles == 1) sql = "SELECT aid FROM v_article_url WHERE cid = @cid AND ISNULL(shtml_created,0) = 0 ORDER BY asort DESC";// �������� else sql = "SELECT aid FROM v_article_url WHERE cid = @cid ORDER BY asort DESC";// �������� } else { string ls_date = System.DateTime.Now.AddDays(-days).ToString(); // ��һ����������ҳ if (withfiles == 1) { sql = "SELECT aid FROM v_article_url WHERE cid = @cid AND ISNULL(shtml_created,0) = 0 "; sql += " AND modtime > '" + ls_date + "' ORDER BY asort DESC"; // �������� } else { sql = "SELECT aid FROM v_article_url WHERE cid = @cid AND modtime > '" + ls_date + "' ORDER BY asort DESC";// �������� } } SqlParameter[] sqlparam = { db.MakeInParam("@cid",SqlDbType.VarChar,cid) }; DataTable dt = db.GetDataTable(sql, sqlparam); for (int i = 0; i < dt.Rows.Count; i++) { int aid = Int32.Parse(dt.Rows[i]["aid"].ToString()); String fname = "/" + site.cidPath(cid) + (aid) + ".html"; String source_path = "http://" + site.host + articleTemplate + "?aid=" + aid; String target_path = site.root + fname; JpShtml jpshtml = new JpShtml(); jpshtml.source_path = source_path; jpshtml.target_path = target_path; jpshtml.Flush(); if (site.lan_big5 == "1") { fname = "/big5" + fname; source_path = "http://" + site.host + "/big5/" + articleTemplate + "?aid=" + aid; target_path = site.root + fname; jpshtml.source_path = source_path; jpshtml.target_path = target_path; jpshtml.Flush(); } } sql = "UPDATE JpArticle SET shtml_created = 1 WHERE cid =@cid AND status = '����' AND getdate() >= pubtime and getdate() <= endtime"; sqlparam = new SqlParameter[]{ db.MakeInParam("@cid",SqlDbType.VarChar,cid) }; db.Execute(sql, sqlparam); db.Close(); // ��һɾ���������� sql = "SELECT aid FROM JpArticle WHERE cid = @cid AND shtml_created = 1 AND status = '����'"; sqlparam = new SqlParameter[]{ db.MakeInParam("@cid",SqlDbType.VarChar,cid) }; dt = db.GetDataTable(sql, sqlparam); for (int i = 0; i < dt.Rows.Count; i++) { int aid = Int32.Parse(dt.Rows[i]["aid"].ToString()); String fnamedelete = site.root + "/" + site.cidPath(cid) + (aid) + ".html"; if (System.IO.File.Exists(fnamedelete)) System.IO.File.Delete(fnamedelete); } sql = "UPDATE JpArticle SET shtml_created = 0 WHERE cid = @cid AND status = '����'"; sqlparam = new SqlParameter[]{ db.MakeInParam("@cid",SqlDbType.VarChar,cid) }; db.Execute(sql, sqlparam); db.Close(); } db.Close(); }
private void ddllbBind() { JpSite JpSite = new JpSite(); DataTable dt = JpSite.GetSites(); if (txtcid.Text.Substring(0, 3) != "003") {//新闻 string[] list = dt.Rows[0]["nwyuming"].ToString().Split('#'); for (int i = 0; i < list.Length; i++) { ddllb.Items.Insert(i, new ListItem(list[i].ToString(), list[i].ToString())); } ddllb.Items.Insert(0, new ListItem("请选择", "请选择")); } if (txtcid.Text.Substring(0, 3) == "003") {//专栏 string[] list = dt.Rows[0]["wwyuming"].ToString().Split('#'); for (int i = 0; i < list.Length; i++) { ddllb.Items.Insert(i, new ListItem(list[i].ToString(), list[i].ToString())); } ddllb.Items.Insert(0, new ListItem("请选择", "请选择")); } }
// ��̬���� public void shtmlpublish(bool publish, String l_cid, int l_aid) { JpSite site = new JpSite(); // ������Ŀ��ҳ JpColumns col = new JpColumns(l_cid); String sql = "UPDATE JpArticle SET shtml_created = "; if (publish) { // ���·���������������ҳ String fname = "/" + site.cidPath(l_cid) + (l_aid) + ".html"; JpShtml jpshtml = new JpShtml(); jpshtml.source_path = "http://" + site.host + col.tmp_art + "?aid=" + l_aid; jpshtml.target_path = site.root + fname; jpshtml.Flush(); //����� if (site.lan_big5 == "1") { jpshtml.source_path = "http://" + site.host + "/big5" + col.tmp_art + "?aid=" + l_aid; jpshtml.target_path = site.root + "/big5/" + fname; jpshtml.Flush(); } sql += "1"; } else { System.IO.File.Delete(site.root + "/" + site.cidPath(l_cid) + (l_aid) + ".html"); //����� if (site.lan_big5 == "1") { System.IO.File.Delete(site.root + "/big5/" + site.cidPath(l_cid) + (l_aid) + ".html"); } sql += "0"; } sql += " where aid = " + l_aid; DAO db = new DAO(); db.Execute(sql); db.Close(); }