% @ Language=VBScript %>
<% Option Explicit %>
<%
'****************************************************************************************
'** Copyright Notice
'**
'** Web Wiz Forums(TM)
'** http://www.webwizforums.com
'**
'** Copyright (C)2001-2010 Web Wiz(TM). All Rights Reserved.
'**
'** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS UNDER LICENSE FROM 'WEB WIZ'.
'**
'** IF YOU DO NOT AGREE TO THE LICENSE AGREEMENT THEN 'WEB WIZ' IS UNWILLING TO LICENSE
'** THE SOFTWARE TO YOU, AND YOU SHOULD DESTROY ALL COPIES YOU HOLD OF 'WEB WIZ' SOFTWARE
'** AND DERIVATIVE WORKS IMMEDIATELY.
'**
'** If you have not received a copy of the license with this work then a copy of the latest
'** license contract can be found at:-
'**
'** http://www.webwiz.co.uk/license
'**
'** For more information about this software and for licensing information please contact
'** 'Web Wiz' at the address and website below:-
'**
'** Web Wiz, Unit 10E, Dawkins Road Industrial Estate, Poole, Dorset, BH15 4JD, England
'** http://www.webwiz.co.uk
'**
'** Removal or modification of this copyright notice will violate the license contract.
'**
'****************************************************************************************
'*************************** SOFTWARE AND CODE MODIFICATIONS ****************************
'**
'** MODIFICATION OF THE FREE EDITIONS OF THIS SOFTWARE IS A VIOLATION OF THE LICENSE
'** AGREEMENT AND IS STRICTLY PROHIBITED
'**
'** If you wish to modify any part of this software a license must be purchased
'**
'****************************************************************************************
'Set the response buffer to true as we maybe redirecting
Response.Buffer = True
'Make sure this page is not cached
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 2
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "No-Store"
'Dimension variables
Dim sarryEvents 'Holds the event recordset in an array
Dim saryBirthdays 'Holds the birthdays recordset in an array
Dim strSubject 'Holds the event subject
Dim strMessage 'Holds the event message
Dim strMonth 'Holds the month name
Dim intMonth 'Holds the integer value for the month
Dim intYear 'Holds the year
Dim intFistDayOfMonth 'Holds the first day of the month as an interger
Dim intWeekLoop 'Week Loop counter
Dim intDayLoopCounter 'Day loop counter
Dim intDay 'Holds the day
Dim intMaxNoMonthDays 'Holds total number of days for the month
Dim dtmNow 'Holds the present date according to any server off-set
Dim intView 'Holds the type of view (1=monh, 2=week, 3=year)
Dim dtmDbStartDate 'Holds the database search start date
Dim dtmDbEndDate 'Holds the database search end date
Dim intDbArrayLoop 'Database array loop counter
Dim intNoOfBirthdays 'Holds the number of birthdays
Dim intAge 'Holds the age for birthdays
Dim strMemBirthdays 'Holds the members birthdays
Dim strUserName 'Holds the username of the member with a birthday
Dim lngUserProfile 'Holds the user profile number
Dim blnShowBirthdays 'Holds if birthdays are hidden or not
Dim strPageRedirect 'Holds the page redirect details
Dim intWeek
'Test querystrings for any SQL Injection keywords
Call SqlInjectionTest(Request.QueryString())
'If the calendar system is disabled send the user away
If blnCalendar = False OR (blnACode AND NOT strInstallID = "Adware") Then
'Clean up
Call closeDatabase()
'Send to default page
Response.Redirect("default.asp" & strQsSID1)
End If
'If this is a year view redirect to the year calendar view page
If Request.QueryString("V") = "3" Then
strPageRedirect = "calendar_year.asp?Y=" & Request.QueryString("Y")
If Request.QueryString("DB") <> "" Then strPageRedirect = strPageRedirect & "&DB=" & Request.QueryString("DB")
Response.Redirect(strPageRedirect & strQsSID3)
'Else if week view
ElseIf Request.QueryString("V") = "2" Then
If isNumeric(Request.QueryString("W")) Then intWeek = IntC(Request.QueryString("W")) Else intWeek = 1
strPageRedirect = "calendar_week.asp?M=" & Request.QueryString("M") & "&Y=" & Request.QueryString("Y") & "&W=" & intWeek
If Request.QueryString("DB") <> "" Then strPageRedirect = strPageRedirect & "&DB=" & Request.QueryString("DB")
Response.Redirect(strPageRedirect & strQsSID3)
End If
'Intilise variables
dtmNow = getNowDate()
blnShowBirthdays = CBool(showBirthdays())
intDay = 0
'Read in the year to view
If IntC(Request.QueryString("Y")) => 1900 AND IntC(Request.QueryString("Y")) =< IntC(Year(dtmNow)+20) Then
intYear = CInt(Request.QueryString("Y"))
'Else use this year as the month to view
Else
Response.Redirect("calendar.asp?M=" & IntC(Request.QueryString("M")) & "&Y=" & Year(dtmNow) & strQsSID3)
End If
'Read in the month to view
If IntC(Request.QueryString("M")) => 1 AND IntC(Request.QueryString("M")) =< 12 Then
intMonth = IntC(Request.QueryString("M"))
'Else use this month as the month to view
Else
Response.Redirect("calendar.asp?M=" & Month(dtmNow) & "&Y=" & IntC(Request.QueryString("Y")) & strQsSID3)
End If
'Get the first day of the month (use internation ISO date fomat (yyyy-mm-dd) for server compatibility)
intFistDayOfMonth = WeekDay(intYear & "-" & intMonth & "-01")
'Get the number of days in the month
intMaxNoMonthDays = getMonthDayNo(intMonth, intYear)
'Get the month in name format
strMonth = getMonthName(intMonth)
'Calculate the db serach start date
If intMonth = 1 Then
dtmDbStartDate = internationalDateTime(intYear-1 & "-12-1")
Else
dtmDbStartDate = internationalDateTime(intYear & "-" & intMonth-1 & "-1")
End If
'Calculate the db serach end date
If intMonth = 12 Then
dtmDbEndDate = internationalDateTime(intYear+1 & "-01-" & getMonthDayNo(1, intYear+1))
Else
dtmDbEndDate = internationalDateTime(intYear & "-" & intMonth+1 & "-" & getMonthDayNo(intMonth+1, intYear))
End If
'SQL Server doesn't like ISO dates with '-' in them, so remove the '-' part
If strDatabaseType = "SQLServer" Then
dtmDbStartDate = Replace(dtmDbStartDate, "-", "", 1, -1, 1)
dtmDbEndDate = Replace(dtmDbEndDate, "-", "", 1, -1, 1)
End If
'Place the date in SQL safe # or '
If strDatabaseType = "Access" Then
dtmDbStartDate = "#" & dtmDbStartDate & "#"
dtmDbEndDate = "#" & dtmDbEndDate & "#"
Else
dtmDbStartDate = "'" & dtmDbStartDate & "'"
dtmDbEndDate = "'" & dtmDbEndDate & "'"
End If
'Call the sub procedure to get the events from the database
Call getEvents()
'SQL Query Array Look Up table
'0 = Topic_ID
'1 = Subject
'2 = Hide
'3 = Event_date
'4 = Message
'Call sub to get birthdays from the database
If blnDisplayBirthdays AND blnShowBirthdays Then Call getBirthdays(intMonth, 0)
'SQL Query Array Look Up table
'0 = Author_ID
'1 = Username
'2 = DOB
Dim lngTotalRecordsPages
lngTotalRecordsPages = 12
Dim intRecordPositionPageNum
Dim intPageLinkLoopCounter
'Clean up
Call closeDatabase()
'If active users is enabled update the active users application array
If blnActiveUsers Then
'Call active users function
saryActiveUsers = activeUsers(strTxtViewing & " " & strTxtCalendar, strMonth & " " & intYear, "calendar.asp?Y=" & intYear & "&M=" & intMonth, 0)
End If
'Set bread crumb trail
strBreadCrumbTrail = strBreadCrumbTrail & strNavSpacer & "" & strTxtCalendar & "" & strNavSpacer & strMonth & " " & intYear
'Status bar tools
strStatusBarTools = strStatusBarTools & " "
%>
<% = strTxtCalendar & ": " & strMonth & " " & intYear %> |
| <% = strQsSID2 %>"><< <% = strTxtPrevious %> <% = strQsSID2 %>"><% = strTxtNext %> >> |
| <% = strMonth & " " & intYear %> | |||||||
| > > > > | <%
'Display ledger info
'Loop through the 7 days of the week
For intDayLoopCounter = 1 TO 7
'Increment the day by 1
If intDay > 0 Then intDay = intDay + 1
'See if this is the first day of the month
If intFistDayOfMonth = intDayLoopCounter AND intDay = 0 Then intDay = 1
'Write the table cell
Response.Write(vbCrLf & " 1 AND intDay <= intMaxNoMonthDays Then
'If today place a red border around the day
If intMonth = Month(dtmNow) AND intDay = Day(dtmNow) AND intYear = Year(dtmNow) Then
Response.Write(" class=""calTodayCell""")
Else
Response.Write(" class=""calDateCell""")
End If
'Else the day is not a date in this month
Else
Response.Write(" class=""calEmptyDateCell""")
End If
Response.Write(" style=""padding:0px"">")
Response.Write(" ")
'If this is a day in the month display day number
If intDay => 1 AND intDay <= intMaxNoMonthDays Then Response.Write("" & intDay & "")
'Display the day
Select Case intDayLoopCounter
Case 1
Response.Write(strTxtSun)
Case 2
Response.Write(strTxtMon)
Case 3
Response.Write(strTxtTue)
Case 4
Response.Write(strTxtWed)
Case 5
Response.Write(strTxtThu)
Case 6
Response.Write(strTxtFri)
Case 7
Response.Write(strTxtSat)
End Select
Response.Write(" ")
Response.Write("")
'See if we have an event to display
If isArray(saryBirthdays) AND intDay => 1 AND intDay <= intMaxNoMonthDays Then
'Initlise the loop array
intDbArrayLoop = 0
intNoOfBirthdays = 0
intAge = 0
strMemBirthdays = ""
'Loop through the events array
Do While intDbArrayLoop <= Ubound(saryBirthdays,2)
'If bitrhday is found for this date display it
If intMonth = Month(saryBirthdays(2,intDbArrayLoop)) AND intDay = Day(saryBirthdays(2,intDbArrayLoop)) Then
'If we have been around once before then place a comma between the entries
If intAge <> 0 Then strMemBirthdays = strMemBirthdays & ", "
'Calculate the age (use months / 12 as counting years is not accurate) (use FIX to get the whole number)
intAge = Fix(DateDiff("m", saryBirthdays(2,intDbArrayLoop), intYear & "-" & intMonth & "-" & intDay)/12)
'Place the bitrhdays into a string to show as as title for the link
strMemBirthdays = strMemBirthdays & saryBirthdays(1,intDbArrayLoop) & "(" & intAge & ")"
'Initilise variables for the first birthday, it only 1 birthday found we display this data
strUserName = saryBirthdays(1,intDbArrayLoop)
lngUserProfile = saryBirthdays(0,intDbArrayLoop)
'Increment the number of birthdays
intNoOfBirthdays = intNoOfBirthdays + 1
End If
'Move to next array position
intDbArrayLoop = intDbArrayLoop + 1
Loop
'Write the HTML for the date
'If 1 birthday display the user birthday
If intNoOfBirthdays = 1 Then
Response.Write(" ")
Next
%>if birthdays are displayed If intNoOfBirthdays > 0 Then Response.Write(" ") 'Write the HTML for the event Response.Write(" ") End If 'Move to next array position intDbArrayLoop = intDbArrayLoop + 1 Loop End If Response.Write(" |
||||||
| <% = strQsSID2 %>"><< <% = strTxtPrevious %> <% = strQsSID2 %>"><% = strTxtNext %> >> |
| <% 'Call the sub procedure to write the calendar If intMonth = 1 Then Call displayMonth(12, intYear-1, 1) Else Call displayMonth(intMonth-1, intYear, 1) End If %> | <% 'Call the sub procedure to write the calendar If intMonth = 12 Then Call displayMonth(1, intYear+1, 1) Else Call displayMonth(intMonth+1, intYear, 1) End If %> |