Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Resource/Js/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ function getRootPath() {
//判断url是否在iframe打开
if (window.frames.length == parent.frames.length) {
//alert('不在iframe中' + window.document.location.href);
window.location.replace(getRootPath() + '/Views/Default?url=' + encodeURIComponent(window.document.location.href));
var currentUrl = window.document.location.href;
if (currentUrl.startsWith(getRootPath())) {
window.location.replace(getRootPath() + '/Views/Default?url=' + encodeURIComponent(currentUrl));
}
//window.location.replace(getRootPath() + '/Views/Default?url=' + window.document.location.href);
}

Expand Down
2 changes: 1 addition & 1 deletion Resource/fullcalendar/examples/google-calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// THIS KEY WON'T WORK IN PRODUCTION!!!
// To make your own Google API key, follow the directions here:
// http://fullcalendar.io/docs/google_calendar/
googleCalendarApiKey: 'AIzaSyDcnW6WejpTOCffshGDDb4neIrXVUA1EAE',
googleCalendarApiKey: process.env.GOOGLE_CALENDAR_API_KEY || '',

// US Holidays
events: 'en.usa#holiday@group.v.calendar.google.com',
Expand Down
4 changes: 3 additions & 1 deletion Scripts/WebForms/SmartNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ if ((typeof(window.__smartNav) == "undefined") || (window.__smartNav == null))
var fdurlb = fdurl.split("?")[0];
if (document.location.href.indexOf(fdurlb) < 0)
{
document.location.href=fdurl;
// Sanitize the URL before redirecting
var sanitizedUrl = new URL(fdurl, window.location.origin).href;
document.location.href = sanitizedUrl;
return;
}
sn._savedOnLoad = window.onload;
Expand Down
4 changes: 2 additions & 2 deletions Views/Default.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<i class="layui-icon layui-icon-notice"></i>
<!-- 如果有新消息,则显示小圆点 -->
<%--<span class="layui-badge-dot"></span>--%>
<span id="spanNotice"><%= Notice %></span>
<span id="spanNotice"><%= HttpUtility.HtmlEncode(Notice) %></span>
</a>
</li>
<li style="left:12px;" class="layui-nav-item layui-hide-xs" lay-tips="配色方案" lay-unselect>
Expand Down Expand Up @@ -172,4 +172,4 @@
<script src='<%: ResolveUrl("~/Views/Js/Default.js?ver="+ DateTime.Now.ToFileTime()+"")%>'></script>
</form>
</body>
</html>
</html>
6 changes: 4 additions & 2 deletions Views/Default.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ protected void Page_Load(object sender, EventArgs e)
}

//在线状态
string _sql2 = "select * from UserState where Invalid=0 and Del=0 and UID=" + UID;
DataTable _dt2 = MsSQLDbHelper.Query(_sql2).Tables[0];
string _sql2 = "select * from UserState where Invalid=0 and Del=0 and UID=@UID";
SqlParameter[] _sp2 = { new SqlParameter("@UID", SqlDbType.Int) };
_sp2[0].Value = UID.toInt();
DataTable _dt2 = MsSQLDbHelper.Query(_sql2, _sp2).Tables[0];

if (_dt2 != null && _dt2.Rows.Count > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion Views/Forms/Forms.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected void Page_Load(object sender, EventArgs e)
string ShortTableName = MicroPublic.GetFriendlyUrlParm(1);
string ModuleID = MicroPublic.GetFriendlyUrlParm(2);
txtMID.Value = ModuleID;
divScript.InnerHtml = MicroForm.GetLayCheckBoxTpl(ShortTableName, ModuleID);
divScript.InnerHtml = HttpUtility.HtmlEncode(MicroForm.GetLayCheckBoxTpl(ShortTableName, ModuleID));

//检查是否已经登录和页面唯一识别是否一致(ShortTableName)
MicroAuth.CheckAuth(ModuleID, ShortTableName);
Expand Down
12 changes: 11 additions & 1 deletion Views/Forms/HR/Js/LeaveForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@

var parms = { "Val": uid, "TypeID": holidayTypeID, "Date": encodeURI(overtimeDate), "TypeName": holidayTypeName };
$.getJSON('/Views/Forms/HR/GetLeaveTips.ashx', parms, function (data) {
$('#divShowLeave').html(data.Tips);
$('#divShowLeave').html(escapeHtml(data.Tips)); // Escape HTML special characters
$('#hidAvailableNumber').val(data.Days);

leaveDays = $('#selLeaveDays').val();
Expand Down Expand Up @@ -497,4 +497,14 @@

});

// Function to escape HTML special characters
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}

});
2 changes: 1 addition & 1 deletion Views/Forms/HR/OnDutyFormList.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void Page_Load(object sender, EventArgs e)


var getFormAttr = MicroForm.GetFormAttr(ShortTableName, FormID);
spanTitle.InnerHtml = getFormAttr.FormName + getFormAttr.Description; //表单名称和描述
spanTitle.InnerHtml = HttpUtility.HtmlEncode(getFormAttr.FormName + getFormAttr.Description); //表单名称和描述
spanWorkFlow.Visible = MicroAuth.CheckPermit(ModuleID, "3"); //是否显示修改流程
string Note = getFormAttr.Note;
if (!string.IsNullOrEmpty(Note))
Expand Down
12 changes: 8 additions & 4 deletions Views/Forms/HR/OvertimeFormList.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ protected void Page_Load(object sender, EventArgs e)


var getFormAttr = MicroForm.GetFormAttr(ShortTableName, FormID);
spanTitle.InnerHtml = getFormAttr.FormName + getFormAttr.Description; //表单名称和描述
spanTitle.InnerHtml = HttpUtility.HtmlEncode(getFormAttr.FormName + getFormAttr.Description); //表单名称和描述
spanWorkFlow.Visible = MicroAuth.CheckPermit(ModuleID, "3"); //是否显示修改流程
string Note = getFormAttr.Note;
if (!string.IsNullOrEmpty(Note))
{
divNote.Visible = true;
spanNote.InnerHtml = Note;
spanNote.InnerHtml = HttpUtility.HtmlEncode(Note);
}

string FormsID = MicroPublic.GetFriendlyUrlParm(4);
Expand Down Expand Up @@ -152,9 +152,13 @@ protected void Page_Load(object sender, EventArgs e)

//判断草稿箱是否有记录,若有记录要先处理掉才能进行新增操作
string UID = MicroUserHelper.MicroUserInfo.GetUserInfo("UID");
string _sql = "select * from HROvertime where Invalid=0 and Del=0 and StateCode>=-4 and StateCode<=-1 and UID=" + UID.toInt() + " and OvertimeTypeID=(select OvertimeTypeID from HROvertimeType where Invalid=0 and Del=0 and FormID=@FormID)";
SqlParameter[] _sp = { new SqlParameter("@FormID", SqlDbType.Int) };
string _sql = "select * from HROvertime where Invalid=0 and Del=0 and StateCode>=-4 and StateCode<=-1 and UID=@UID and OvertimeTypeID=(select OvertimeTypeID from HROvertimeType where Invalid=0 and Del=0 and FormID=@FormID)";
SqlParameter[] _sp = {
new SqlParameter("@FormID", SqlDbType.Int),
new SqlParameter("@UID", SqlDbType.Int)
};
_sp[0].Value = FormID.toInt();
_sp[1].Value = UID.toInt();

DataTable _dt = MsSQLDbHelper.Query(_sql, _sp).Tables[0];

Expand Down
2 changes: 1 addition & 1 deletion Views/Forms/MicroFormList.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected void Page_Load(object sender, EventArgs e)

if (_dt != null && _dt.Rows.Count > 0)
{
string QueryBaseDescription = _dt.Rows[0]["QueryBaseDescription"].toStringTrim();
string QueryBaseDescription = HttpUtility.HtmlEncode(_dt.Rows[0]["QueryBaseDescription"].toStringTrim());
if (!string.IsNullOrEmpty(QueryBaseDescription))
{
iconDescription.Visible = true;
Expand Down
2 changes: 1 addition & 1 deletion Views/Forms/SysFormList.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected void Page_Load(object sender, EventArgs e)
var GetTableAttr = MicroDTHelper.MicroDataTable.GetTableAttr(MicroPublic.GetTableName(ShortTableName));
txtPrimaryKeyName.Value = "data." + GetTableAttr.PrimaryKeyName;

divScript.InnerHtml = MicroForm.GetLayCheckBoxTpl(ShortTableName, ModuleID); //例FormAppType
divScript.InnerHtml = HttpUtility.HtmlEncode(MicroForm.GetLayCheckBoxTpl(ShortTableName, ModuleID)); //例FormAppType

MicroAuth.CheckBrowse(ModuleID);

Expand Down
Loading