📄 list.aspx.cs
字号:
//======================================================
//== (c)2008 aspxcms inc by NeTCMS v1.0 ==
//== Forum:bbs.aspxcms.com ==
//== Website:www.aspxcms.com ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;
using NetCMS.Publish;
using NetCMS.Model;
using System.Text.RegularExpressions;
namespace NetCMS.Web
{
public partial class list : NetCMS.Web.UI.BasePage
{
protected static string dimm = NetCMS.Config.UIConfig.dirDumm;
protected static string TempletDir = NetCMS.Config.UIConfig.dirTemplet;
protected static string SiteRootPath = NetCMS.Common.ServerInfo.GetRootPath();
public static string gInstallDir = "{$InstallDir}";
public static string gTempletDir = "{$TempletDir}";
protected void Page_Load(object sender, EventArgs e)
{
string ClassID = Request.QueryString["id"];
string gPage = Request.QueryString["Page"];
string gChID = Request.QueryString["ChID"];
int ChID = 0;
if (gChID != null && gChID != string.Empty)
{
if (NetCMS.Common.Input.IsInteger(gChID.ToString()))
{
ChID = int.Parse(gChID.ToString());
}
}
int strPage = 1;
if (dimm.Trim() != string.Empty) { dimm = "/" + dimm; }
if (gPage != string.Empty && gPage != null && NetCMS.Common.Input.IsInteger(gPage))
{
strPage = int.Parse(gPage);
}
CommonData.Initialize();
string getContent = string.Empty;
string TmpPath = string.Empty;
string TMPSavePath = string.Empty;
string saveClassPath = string.Empty;
if (ChID != 0)
{
PubCHClassInfo chinfo = CommonData.GetCHClassById(int.Parse(ClassID));
if (chinfo != null)
{
string dirHTML = NetCMS.Common.Public.readCHparamConfig("htmldir", ChID);
dirHTML = dirHTML.Replace("{@dirHTML}", NetCMS.Config.UIConfig.dirHtml);
TMPSavePath = chinfo.SavePath.Trim();
if (TMPSavePath != string.Empty && TMPSavePath != null)
{
if (TMPSavePath.Substring(0, 1) != "/") { TMPSavePath = "\\" + TMPSavePath; }
}
saveClassPath = (dirHTML + TMPSavePath + "\\" + chinfo.FileName.Trim()).Replace("/", @"\\");
TmpPath = SiteRootPath + saveClassPath;
if (chinfo.isDelPoint == 0)
{
getContent = getContentRuslt(ChID,chinfo.Templet, ClassID, strPage, TmpPath, 0);
}
else
{
GetPop(ChID,chinfo.isDelPoint, chinfo.iPoint, chinfo.Gpoint, chinfo.GroupNumber, chinfo.Templet, ClassID, strPage,TmpPath);
}
}
}
else
{
PubClassInfo info = CommonData.GetClassById(ClassID);
if (info != null)
{
TMPSavePath = info.SavePath.Trim();
if (TMPSavePath.Substring(0, 1) != "/") { TMPSavePath = "\\" + TMPSavePath; }
saveClassPath = (TMPSavePath + "\\" + info.SaveClassframe + '\\' + info.ClassSaveRule.Trim()).Replace("/", @"\\");
TmpPath = SiteRootPath + saveClassPath;
if (info.isDelPoint == 0)
{
getContent = getContentRuslt(ChID,info.ClassTemplet, ClassID, strPage, TmpPath, 0);
}
else
{
getContent = GetPop(ChID, info.isDelPoint, info.iPoint, info.Gpoint, info.GroupNumber, info.ClassTemplet, ClassID, strPage, TmpPath);
}
}
}
if (Regex.Match(getContent, @"\</head\>[\s\S]*\<body", RegexOptions.IgnoreCase | RegexOptions.Compiled).Success)
{
getContent = Regex.Replace(getContent, "<body", getjs() + "<body", RegexOptions.IgnoreCase | RegexOptions.Compiled);
}
else
{
getContent = getjs() + getContent;
}
getContent = (getContent.Replace(gInstallDir, NetCMS.Publish.CommonData.getUrl())).Replace(gTempletDir, TempletDir);
Response.Write(getContent);
}
protected string GetPop(int ChID,int isPop, int intgiPoint, int intGpoint, string strGroupNumber, string strClassTemplet, string ClassID,int strPage,string TmpPath)
{
#region 扣点
string getContent = string.Empty;
if (NetCMS.Global.Current.IsTimeout())
{
string Url = NetCMS.Common.Input.URLEncode(Request.Url.ToString());
Response.Redirect(NetCMS.Config.UIConfig.dirUser + "/login.aspx?reurl=1&urls=" + Url + "", true);
}
else
{
string UserNum = NetCMS.Global.Current.UserNum;
string IP = Request.ServerVariables["REMOTE_ADDR"];
int PointType = isPop;
//新闻的参数
int iPoint = intgiPoint;
int Gpoint = intGpoint;
string GroupNumber = strGroupNumber;
int iuserPoint = 0;
int Guserpoint = 0;
string userGroupNumber = string.Empty;
DynamicTrans dyNews = new DynamicTrans();
IDataReader rd = dyNews.getUserInfo(UserNum);
if (rd.Read())
{
iuserPoint = int.Parse(rd["iPoint"].ToString());
Guserpoint = int.Parse(rd["Gpoint"].ToString());
userGroupNumber = rd["UserGroupNumber"].ToString();
}
switch (PointType)
{
case 1:
if (dyNews.getUserNote(UserNum, ClassID, 1))
{
getContent = getContentRuslt(ChID, strClassTemplet, ClassID, strPage, TmpPath, 1);
}
else
{
if (Guserpoint < Gpoint || getGroup(userGroupNumber, GroupNumber) == false)
{
PageError("G币不足,需要G币:" + Gpoint + "<li>或者您所在的组不能浏览</li>", "");
}
else
{
if (dyNews.UpdateHistory(1, ClassID, 0, Gpoint, UserNum, IP) == 1)
{
getContent = getContentRuslt(ChID, strClassTemplet, ClassID, strPage, TmpPath, 1);
}
}
}
break;
case 2:
if (dyNews.getUserNote(UserNum, ClassID, 1))
{
getContent = getContentRuslt(ChID, strClassTemplet, ClassID, strPage, TmpPath, 1);
}
else
{
if (iuserPoint < iPoint || getGroup(userGroupNumber, GroupNumber) == false)
{
PageError("积分不足,需要积分:" + iPoint + "<li>或者您所在的组不能浏览</li>", "");
}
else
{
if (dyNews.UpdateHistory(1, ClassID, iPoint, 0, UserNum, IP) == 1)
{
getContent = getContentRuslt(ChID, strClassTemplet, ClassID, strPage, TmpPath, 1);
}
}
}
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -