<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% 'LOOK INTO START_ROW AND END_ROW, MIGHT NEED ADJUSTMENT FOR NEXT_DTTM 'set objFSO = createobject("Scripting.FileSystemObject") ' 'FileArkPath=Server.MapPath("/logArk-queries.txt") ' located in the same directory ' 'if objFSO.FileExists(FileArkPath) then ' ' set objFile = objFSO.GetFile(FileArkPath) ' ' if objFile.Size > 10000000 then ' ' sSourceFile = FileArkPath ' ' LogSaveDtTm = Now ' ' sDestinationFile = Server.MapPath("/logArk-queries-" & Year(LogSaveDtTm) & Month(LogSaveDtTm) & Day(LogSaveDtTm) & "-" & Hour(LogSaveDtTm) & ".txt") ' ' objFSO.MoveFile sSourceFile, sDestinationFile ' ' Set objFile = objFSO.CreateTextFile(FileArkPath) ' ' objFile.Close ' ' end if ' 'end if ' 'Set objFSO = Nothing title="Forum" dim count_page dim ForumGroups, MaxMessageDtTm, FClk, FClkG, UpperBound, MessagesFound Set ForumGroups = New Ark_Data Set MaxMessageDtTm = New Ark_Data Set FClk = New Ark_Data Set FClkG = New Ark_Data MessagesFound = false dim forum_fields, conn_fclk, rs_fclk dim message_group, message_title, messenger, message_time, min_messenger, min_message_time, max_messenger, max_message_time, message_count, category, message_status dim GetMessagesCommand dim SearchUserCondition dim CellColour dim group_count, clk_count dim end_new_topics dim ShowReasoning, UserStart UserStart = "" dim start_dttm, exstart_dttm, ReqMsgOlderDtTm, ReqMsgNewerDtTm, TopMessageDtTm, BtmMessageDtTm TopMessageDtTm = "" BtmMessageDtTm = "" dim row, display_rows, start_range_row, total_range_rows, start_row, end_row dim next_nav_row dim dsply_minus_one dim NavBegin, NavEnd dim set_time, min_time dim rand_mnt_min, rand_mnt_dec, rand_mnt_rnd, rand_mnt dim CrrntDtTm CrrntDtTm = Now Randomize rand_mnt_min = 12 rand_mnt_dec = Rnd()*8 rand_mnt_rnd = Round(rand_mnt_dec) rand_mnt = rand_mnt_min + rand_mnt_rnd dim delete_clk_cond NavBegin = "2003/12/12 1:19:47" 'NavBegin = "2007/12/18 9:22:17" Set MaxMessageDtTm = Ark_DBAccess.DBSelect("jah_forum","MAX(message_time) AS MaxTime","category = 'Reasoning' OR category = 'Header' OR category = 'Header1'","") if MaxMessageDtTm.DataExists then NavEnd = DateAdd("n",1,MaxMessageDtTm.GetFirstItem("MaxTime")) else NavEnd = Now end if 'NavEnd = "2008/9/21 22:51:16" delete_clk_cond = "record_id = ANY (SELECT record_id FROM jahlog WHERE delete_messages = 'true') AND message_time < " & Ark_DBAccess.SQLDate(DateAdd("n",rand_mnt,CrrntDtTm)) & " AND status = 'cloaked'" call Ark_DBAccess.DBUpdate("jah_forum","status='deleted'",delete_clk_cond) prev_dttm= "" next_dttm="" prev_active = true next_active = true if request.QueryString("prev_dttm") <> "" then prev_dttm = convertback_time(request.QueryString("prev_dttm")) ReqMsgOlderDtTm = prev_dttm elseif request.QueryString("next_dttm") <> "" then next_dttm = convertback_time(request.QueryString("next_dttm")) ReqMsgNewerDtTm = next_dttm elseif request.Form("ex1") <> "" then exstart_dttm = convertback_time(request.Form("ex1")) ReqMsgOlderDtTm = DateAdd("d", 1, exstart_dttm) ReqMsgOlderDtTm = Year(ReqMsgOlderDtTm) & "/" & Month(ReqMsgOlderDtTm) & "/" & Day(ReqMsgOlderDtTm) elseif request.Form("ex2") <> "" then exstart_dttm = convertback_time(request.Form("ex2")) ReqMsgOlderDtTm = DateAdd("d", 1, exstart_dttm) ReqMsgOlderDtTm = Year(ReqMsgOlderDtTm) & "/" & Month(ReqMsgOlderDtTm) & "/" & Day(ReqMsgOlderDtTm) elseif request.QueryString("start_dttm") <> "" then start_dttm = convertback_time(request.QueryString("start_dttm")) ReqMsgOlderDtTm = DateAdd("d", 1, start_dttm) ReqMsgOlderDtTm = Year(ReqMsgOlderDtTm) & "/" & Month(ReqMsgOlderDtTm) & "/" & Day(ReqMsgOlderDtTm) else ReqMsgOlderDtTm = NavEnd next_active = false end if if request.form("word_search") <> "" then word_search = trim(request.form("word_search")) end if if request.QueryString("word_search") <> "" then word_search = Trim(request.QueryString("word_search")) end if if request.QueryString("search_user") <> "" then search_user = request.QueryString("search_user") end if if request.form("search_user") <> "" then search_user = Trim(request.form("search_user")) end if if search_user <> "" then if InStr(search_user, "%") > 0 then SearchUserCondition = "messenger LIKE '"&search_user & "'" else SearchUserCondition = "messenger = '"&search_user & "'" end if end if if request.Form("SearchWhat") <> "" then SearchWhat = request.Form("SearchWhat") end if if request.Form("SearchType") <> "" then SearchType = request.Form("SearchType") end if if request.QueryString("SearchWhat") <> "" then SearchWhat = request.QueryString("SearchWhat") end if if request.QueryString("SearchType") <> "" then SearchType = request.QueryString("SearchType") end if search_change = Replace(word_search, "'", "~^") search_change = Replace(search_change, "'", "~^^") word_array = split(search_change, " ") word_bound = Ubound(word_array) word_len = word_bound + 1 row = -1 start_row = 0 start_range_row = 0 display_rows=70 end_row = display_rows total_range_rows = display_rows + 7 next_nav_row = 13*display_rows dsply_minus_one = display_rows - 1 GetMessagesCommand = "" clk_condition = "" call GetForumMessages() if MaxMessageDtTm.DataExists then NavEnd = MaxMessageDtTm.GetFirstItem("MaxTime") end if if NOT ForumGroups.DataExists then 'if data doesn't exist, try again with current date/time ReqMsgOlderDtTm = NavEnd next_dttm = "" prev_dttm = "" call GetForumMessages() end if call SetTopBtmMessageDtTm () if TopMessageDtTm = "" or BtmMessageDtTm = "" then ReqMsgOlderDtTm = NavEnd next_dttm = "" prev_dttm = "" call GetForumMessages() end if call SetTopBtmMessageDtTm () if ForumGroups.DataExists then if DateDiff("s",BtmMessageDtTm,NavBegin) >= 0 then prev_active = false end if if DateDiff("s",TopMessageDtTm,NavEnd) <= 0 then next_active = false start_row = 0 end if if(IsDate(TopMessageDtTm)) then TopMessageDtTm = convert_time(TopMessageDtTm) end if if(IsDate(BtmMessageDtTm)) then BtmMessageDtTm = convert_time(BtmMessageDtTm) end if end if count_page="JAH-RasTafarI Forum|message-ctgry.cfm"%> JAH - <%=title%> >

Jah Children Shop
<%if log_access = "adm" then%> <%elseif NOT id_exists then%> <%end if%>
Post a new Topic
Delete Category
Sign-in if you already have a Sign-in Name and Password
OR
Sign up for Online Reasoning
If "From User" is blank, it will search all users
If "Search Words" is blank, it will search all posts from that user
checked<%end if%>> All checked<%elseif request.Form("SearchType") = "" then%> checked<%end if%>> As Phrase
checked<%end if%>> Title checked<%elseif request.Form("SearchWhat") = "" then%> checked<%end if%>> Messages
Search Words
From User (optional)
<%if not id_exists then%> generate new code
<%else%> <%end if%>
<%if not id_exists then%>
not case sensitive <%end if%>
<% if ForumGroups.DataExists and MessagesFound then call nav_pages("ex1") if word_search <> "" or search_user <> "" then %>
<% Response.Write("Search Results for") if word_search <> "" then if SearchWhat = "Title" then Response.Write(" titles containing ") else Response.Write(" messages containing ") end if if SearchType = "Phrase" then 'All Phrase if InStr(word_search," ") then Response.Write(" the phrase """) Response.Write(word_search) Response.Write("""") else Response.Write(" the word " & word_search & "") end if else Response.Write(" the word") if InStr(word_search," ") then Response.Write("s (") Response.Write(Replace(word_search," ",", ")) Response.Write(")") else Response.Write(" ") Response.Write(word_search & "") end if end if else Response.Write(" messages") end if if search_user <> "" then Response.Write(" written by " & search_user & "") end if %>
<%=id%>">Cancel Search
<%end if%>
Time Zone: <%if log_time_zone <> "" then%><%=time_zone_array(1)%><%else%>EST (New York, Toronto)<%end if%> 
<% '********************************************************************* '********************************************************************* '********************************************************************* ' Loop through the array holding the result set and display the data For faPos= 0 to UpperBound category = ForumGroups.GetItem("category", faPos) ShowReasoning = true if log_access = "adm" then if request.QueryString("UserStart") <> "" then if ForumGroups.GetItem("start_msngr", faPos) <> request.QueryString("UserStart") then ShowReasoning = false end if end if end if if ShowReasoning and (NOT next_active or (next_active and category <> "Header" and category <> "Header1")) then if(faPos >= start_row and faPos <= end_row) then message_group = ForumGroups.GetItem("message_group", faPos) message_title = ForumGroups.GetItem("message_title", faPos) max_messenger = ForumGroups.GetItem("recent_msngr", faPos) max_message_time = ForumGroups.GetItem("recent_time", faPos) min_messenger = ForumGroups.GetItem("start_msngr", faPos) min_message_time = ForumGroups.GetItem("start_time", faPos) message_count = ForumGroups.GetItem("total_messages", faPos) message_status = ForumGroups.GetItem("status", faPos) set_time = convert_time(max_message_time) min_time = convert_time(min_message_time) PosCount = PosCount + 1 if category = "Reasoning" then CellColour = "FFFFC6" if InStr(message_status, "cloaked") and (log_access = "adm" or log_access = "I_mem") then CellColour = "#FFDD66" elseif InStr(message_status, "deleted") and (log_access = "adm" or log_access = "I_mem") then CellColour = "#DA3D4D" end if elseif category = "Header" then CellColour = "#ffffaa" elseif category = "Header1" then CellColour = "#E0F2AC" end if %> <% end if end if Next %>
Subject Messages Most Recent Post Started
&word_search=<%=server.URLEncode(word_search)%><%end if%><%if SearchType <> "" then%>&SearchType=<%=SearchType%><%end if%><%if SearchWhat <> "" then%>&SearchWhat=<%=SearchWhat%><%end if%><%if search_user <> "" then%>&search_user=<%=search_user%><%end if%><%if message_group = 2776 then%>&start_row=1<%end if%>"> <% if message_title <> "" then message_title = Replace(message_title, "~^^", """") message_title = Replace(message_title, "~^", "'") %><%=message_title%><%else%>No Subject<%end if%> <%=message_count%> <% max_messenger = Replace(max_messenger, "~^", "'")%><%=max_messenger%>
<%if Day(set_time) = Day(current_time) AND Month(set_time) = Month(current_time) AND Year(set_time) = Year(current_time) then%>Today<%else%><%=FormatDateTime(set_time, 2)%><%end if response.Write(" ")%> <%=FormatDateTime(set_time, 3)%>
<%min_messenger = Replace(min_messenger, "~^", "'")%><%=min_messenger%>
<%if Day(min_time) = Day(current_time) AND Month(min_time) = Month(current_time) AND Year(min_time) = Year(current_time) then%>Today<%else%><%=FormatDateTime(min_time, 2)%><%end if%>
<%=FormatDateTime(min_time, 3)%>

<% call nav_pages("ex2") end if %>
<% '************************************************************************************** '************************** FUNCTIONS ***************************** '************************************************************************************** sub GetForumMessages() RefineMsgCondition = "" GetMessagesCommand = "" SearchMsgCondition = "" StatusCondition = "" if cloaked = true then StatusCondition = " AND status <> 'deleted' AND (status <> 'cloaked' OR (status = 'cloaked' AND record_id = ANY(select record_id FROM cloak WHERE cloak_id = " & cloakID & ")))" RefineMsgCondition = RefineMsgCondition & "status <> 'deleted'" RefineMsgCondition = RefineMsgCondition & " AND (status <> 'cloaked'" RefineMsgCondition = RefineMsgCondition & " OR (status = 'cloaked'" RefineMsgCondition = RefineMsgCondition & " AND record_id = ANY(select record_id FROM cloak WHERE cloak_id = " & cloakID & ")" RefineMsgCondition = RefineMsgCondition & " )" RefineMsgCondition = RefineMsgCondition & " )" RefineMsgCondition = RefineMsgCondition & " AND (category = 'Reasoning' OR category = 'Header' OR category = 'Header1')" elseif log_access = "adm" or log_access = "I_mem" then RefineMsgCondition = RefineMsgCondition & "(category = 'Reasoning' OR category = 'Header' OR category = 'Header1')" else StatusCondition = " AND status <> 'deleted' AND status <> 'cloaked'" RefineMsgCondition = RefineMsgCondition & "status <> 'deleted'" RefineMsgCondition = RefineMsgCondition & " AND status <> 'cloaked'" RefineMsgCondition = RefineMsgCondition & " AND (category = 'Reasoning' OR category = 'Header' OR category = 'Header1')" end if if word_search <> "" then SearchMsgCondition = SearchMsgCondition & "(SELECT message_group FROM jah_forum WHERE " if SearchWhat = "Title" then if SearchType = "Phrase" then '***************** word search phrase ******************** SearchMsgCondition = SearchMsgCondition & "message_title LIKE '%"&search_change&"%'" if search_user <> "" then SearchMsgCondition = SearchMsgCondition & " AND " & SearchUserCondition end if elseif SearchType = "All" then for i = 0 to word_bound if i <> 0 then SearchMsgCondition = SearchMsgCondition & " AND " end if SearchMsgCondition = SearchMsgCondition & "message_title LIKE '%"&word_array(i)&"%'" next if search_user <> "" then SearchMsgCondition = SearchMsgCondition & " AND " & SearchUserCondition end if end if SearchMsgCondition = SearchMsgCondition & " AND " & RefineMsgCondition elseif SearchWhat = "Messages" then if SearchType = "Phrase" then SearchMsgCondition = SearchMsgCondition & "message LIKE '%"&search_change&"%'" if search_user <> "" then SearchMsgCondition = SearchMsgCondition & " AND " & SearchUserCondition end if elseif SearchType = "All" then '***************** word search split ******************** if search_user <> "" then SearchMsgCondition = SearchMsgCondition & SearchUserCondition & " AND " end if SearchMsgCondition = SearchMsgCondition & "(" for i = 0 to word_bound if i <> 0 then SearchMsgCondition = SearchMsgCondition & " AND " end if SearchMsgCondition = SearchMsgCondition & "message LIKE '%"&word_array(i)&"%'" next SearchMsgCondition = SearchMsgCondition & ")" end if SearchMsgCondition = SearchMsgCondition & " AND " & RefineMsgCondition '************************************************************************* end if SearchMsgCondition = SearchMsgCondition & " GROUP BY message_group) srch" elseif search_user <> "" then SearchMsgCondition = SearchMsgCondition & "(SELECT message_group FROM jah_forum WHERE " SearchMsgCondition = SearchMsgCondition & SearchUserCondition & " AND " & RefineMsgCondition SearchMsgCondition = SearchMsgCondition & " GROUP BY message_group) srch" end if GetMessagesCommand = GetMessagesCommand & "SELECT forum.messenger AS recent_msngr, forum2.messenger AS start_msngr, main.max_time AS recent_time, main.min_time AS start_time, forum2.message_group AS message_group, forum2.category AS category, forum2.status AS status, forum2.message_title AS message_title, main.total_messages AS total_messages" GetMessagesCommand = GetMessagesCommand & " FROM jah_forum forum, jah_forum forum2," GetMessagesCommand = GetMessagesCommand & " (SELECT mt.max_time AS max_time, MIN(jf.message_time) AS min_time, mt.max_id AS max_msg_id, MIN(message_id) AS min_msg_id, COUNT(jf.message_id) AS total_messages" GetMessagesCommand = GetMessagesCommand & " FROM jah_forum jf," if SearchMsgCondition <> "" then GetMessagesCommand = GetMessagesCommand & " (select MAX(mxt.message_time) AS max_time, MAX(mxt.message_id) AS max_id, mxt.message_group, mxt.category " GetMessagesCommand = GetMessagesCommand & " FROM jah_forum mxt, " & SearchMsgCondition else GetMessagesCommand = GetMessagesCommand & " (select MAX(message_time) AS max_time, MAX(message_id) AS max_id, message_group, category " GetMessagesCommand = GetMessagesCommand & " FROM jah_forum" end if if next_dttm = "" then if SearchMsgCondition <> "" then GetMessagesCommand = GetMessagesCommand & " WHERE " & RefineMsgCondition & " AND mxt.message_group = srch.message_group" GetMessagesCommand = GetMessagesCommand & " GROUP BY mxt.message_group) mt" else GetMessagesCommand = GetMessagesCommand & " WHERE " & RefineMsgCondition GetMessagesCommand = GetMessagesCommand & " GROUP BY message_group) mt" end if GetMessagesCommand = GetMessagesCommand & " WHERE (mt.max_time < " & Ark_DBAccess.SQLDate(ReqMsgOlderDtTm) & " OR mt.category = 'Header' OR mt.category = 'Header1')" GetMessagesCommand = GetMessagesCommand & " AND mt.message_group = jf.message_group" & StatusCondition GetMessagesCommand = GetMessagesCommand & " GROUP BY jf.message_group" GetMessagesCommand = GetMessagesCommand & " ORDER BY mt.category, mt.max_time desc" GetMessagesCommand = GetMessagesCommand & " LIMIT 0, 77) main" GetMessagesCommand = GetMessagesCommand & " where forum.message_id = main.max_msg_id" GetMessagesCommand = GetMessagesCommand & " and forum2.message_id = main.min_msg_id" GetMessagesCommand = GetMessagesCommand & " ORDER BY forum2.category, main.max_time desc;" else if SearchMsgCondition <> "" then GetMessagesCommand = GetMessagesCommand & " WHERE " & RefineMsgCondition & " AND mxt.message_group = srch.message_group" GetMessagesCommand = GetMessagesCommand & " GROUP BY mxt.message_group) mt" else GetMessagesCommand = GetMessagesCommand & " WHERE " & RefineMsgCondition GetMessagesCommand = GetMessagesCommand & " GROUP BY message_group) mt" end if GetMessagesCommand = GetMessagesCommand & " WHERE (mt.max_time > " & Ark_DBAccess.SQLDate(ReqMsgNewerDtTm) & " OR mt.category = 'Header' OR mt.category = 'Header1')" GetMessagesCommand = GetMessagesCommand & " AND mt.message_group = jf.message_group" & StatusCondition GetMessagesCommand = GetMessagesCommand & " GROUP BY jf.message_group" GetMessagesCommand = GetMessagesCommand & " ORDER BY mt.category, mt.max_time" GetMessagesCommand = GetMessagesCommand & " LIMIT 0, 77) main" GetMessagesCommand = GetMessagesCommand & " where forum.message_id = main.max_msg_id" GetMessagesCommand = GetMessagesCommand & " and forum2.message_id = main.min_msg_id" GetMessagesCommand = GetMessagesCommand & " ORDER BY forum2.category, main.max_time desc;" END IF Set ForumGroups = Ark_DBAccess.DBCommand(GetMessagesCommand) Set MaxMessageDtTm = Ark_DBAccess.DBSelect("jah_forum","MAX(message_time) AS MaxTime",RefineMsgCondition,"") end sub function FormatNavDate(NavDtTm) FormatNavDate = Year(NavDtTm) & "/" & Month(NavDtTm) & "/" & Day(NavDtTm) & " " & Hour(NavDtTm) & ":" & Minute(NavDtTm) & ":" & Second(NavDtTm) end function sub SetTopBtmMessageDtTm () if ForumGroups.DataExists then MessagesFound = true category = ForumGroups.GetFirstItem("category") UpperBound = ForumGroups.UpperBound total_groups = ForumGroups.TotalRows PosCount = -1 start_row = 0 BtmMessageDtTm = ForumGroups.GetLastItem("recent_time") For faPos= 0 to UpperBound category = ForumGroups.GetItem("category", faPos) Pos_message_time = ForumGroups.GetItem("recent_time", faPos) if category = "Header" OR category = "Header1" then if next_active then start_row = start_row + 1 else if TopMessageDtTm = "" or Pos_message_time > TopMessageDtTm then TopMessageDtTm = Pos_message_time end if end if else if TopMessageDtTm = "" or Pos_message_time > TopMessageDtTm then TopMessageDtTm = Pos_message_time end if Exit For end if Next end_row = ForumGroups.UpperBound end if end sub sub nav_pages(output) dim font_size dim row_number dim row_division dim SearchURL SearchURL = "" if word_search <> "" then SearchURL = SearchURL & "&word_search=" & word_search end if if search_user <> "" then SearchURL = SearchURL & "&search_user=" & search_user end if if SearchType <> "" then SearchURL = SearchURL & "&SearchType=" & SearchType end if if SearchWhat <> "" then SearchURL = SearchURL & "&SearchWhat=" & SearchWhat end if Response.Write(chr(10)&"
"&chr(10)) if word_search <> "" then Response.Write(" "" then Response.Write(" "" then Response.Write(" "" then Response.Write(""&chr(10)) Response.Write("Click Calendar on right or Choose Date Below: "&chr(10)) Response.Write("
"&chr(10)) font_size = "large" 'if exstart_dttm <> "" then 'Response.Write("" & convert_time(exstart_dttm) & "
" & chr(10)) 'elseif start_dttm <> "" then 'Response.Write("" & convert_time(DateAdd("d", -1, start_dttm)) & "
" & chr(10)) 'end if if log_access = "adm" then if request.QueryString("UserStart") <> "" then UserStart = "&UserStart=" & request.QueryString("UserStart") end if end if response.write("
") response.write("") for fyear=2003 to Year(CrrntDtTm) TopYear = Year(TopMessageDtTm) BtmYear = Year(BtmMessageDtTm) uyear = fyear + 1 if fyear = TopYear then response.write("") else select_dttm = DateAdd("d",-1, uyear & "/01/01") select_dttm = Year(select_dttm) & "/" & Month(select_dttm) & "/" & Day(select_dttm) bgcolor = "" if fyear >= BtmYear and fyear < TopYear then bgcolor = " style='background-color:#FFFFC6;'" end if response.write("" & fyear & "") end if next response.write("
" & fyear & "
") if TopMessageDtTm <> "" then TopYear = Year(TopMessageDtTm) TopMonth = Month(TopMessageDtTm) BtmYear = Year(BtmMessageDtTm) BtmMonth = Month(BtmMessageDtTm) response.write("") for fmonth= 1 to 12 fyear = Year(TopMessageDtTm) uyear = fyear umonth = fmonth if TopMonth = umonth then if(start_dttm <> "") then response.write("") else select_dttm = DateAdd("M",1, fyear & "/" & fmonth & "/01") select_dttm = DateAdd("d",-1, select_dttm) select_dttm = Year(select_dttm) & "/" & Month(select_dttm) & "/" & Day(select_dttm) response.write("") end if else select_dttm = DateAdd("M",1, fyear & "/" & fmonth & "/01") select_dttm = DateAdd("d",-1, select_dttm) select_dttm = Year(select_dttm) & "/" & Month(select_dttm) & "/" & Day(select_dttm) bgcolor = "" if (BtmYear = TopYear and fmonth <= TopMonth and fmonth >= BtmMonth ) or (BtmYear <> TopYear and (fmonth >= BtmMonth or fmonth <= TopMonth)) then bgcolor = " style='background-color:#FFFFC6;'" end if response.write("" & MonthName(fmonth) & "") end if next response.write("
" & MonthName(fmonth) & "" & MonthName(fmonth) & "
") if next_active then response.write("
") else response.write(" ") end if end if end sub %>