<% ' Fruibile - L'elemento CMS Open Source che mancava ' Copyright (C) 2002-2006 Roberto Scano ' ' Licensed under the terms of the GNU Lesser General Public License: ' http://www.opensource.org/licenses/lgpl-license.php ' ' For further information visit: ' http://www.fruibile.it/ ' ' File Author: ' Roberto Scano (mail@robertoscano.info) %> <% Session.CodePage = 65001 %> <% 'Imposta documento come XHTML, se supportato dal browser If InStr(1, Request.ServerVariables("HTTP_ACCEPT").Item, "application/xhtml+xml") > 0 Or InStr(1, Request.ServerVariables("HTTP_USER_AGENT").Item, "W3C_Validator") > 0 then Response.ContentType = "application/xhtml+xml" Session("content") = "application/xhtml+xml" Else Response.ContentType = "text/html" Session("content") = "text/html" End If content = Session("content") Response.charset="UTF-8" If request("cat") = "" then strCat = Session("ArgoID") else strCat = request("cat") end if if len(session("LANGUAGE")) < 1 then ' TheLanguages= split (Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"),",") ' if UBound(TheLanguages) >= 0 then ' select case left(ucase(TheLanguages(0)),2) ' case "IT" ' Session("LANGUAGE") = "it" ' case "FR" ' Session("LANGUAGE") = "fr" ' case "ES" ' Session("LANGUAGE") = "es" ' case "DE" ' Session("LANGUAGE") = "de" ' case else ' Session("LANGUAGE") = "en" ' end select ' else session("LANGUAGE")= lcase(Application("LANGUAGE")) ' end if end if 'DA SISTEMARE qscreator = "Roberto Scano - All Rights Reserved." Dim ConnStr, Password Password = "" 'Password del database. Connstr = Application("DBWEB_PATH") CMS_DB = Application("fruibile_database") GMT = int(Application("localtimezoneoffset")) - int(Application("servertimezoneoffset")) Application("GMT") = GMT if left(application("localtimezoneoffset"),1) = "-" then setoffset = zeropad(right(application("localtimezoneoffset"),len(application("localtimezoneoffset"))-1),2) setoffset = "-" & setoffset & ":00" elseif left(application("localtimezoneoffset"),1) = "+" then setoffset = zeropad(right(application("localtimezoneoffset"),len(application("localtimezoneoffset"))-1),2) setoffset = "+" & setoffset & ":00" else setoffset = "00:00" end if Application("offset") = setoffset DataOra = DateAdd("h",Application("GMT"),now) If CMS_DB = "SQL" then strDataOra = "'" & year(DataOra) & "/" & month(DataOra) & "/" & day(DataOra) & "'" elseif CMS_DB = "MYSQL" then strDataOra = "'" & year(DataOra) & "/" & month(DataOra) & "/" & day(DataOra) & " " & timevalue(DataOra) & "'" Else strDataOra = "#" & year(DataOra) & "/" & month(DataOra) & "/" & day(DataOra) & " " & timevalue(DataOra) & "#" End If If NOT IsObject(conn) Then Dim conn Set conn = Server.CreateObject("ADODB.Connection") 'On Error Resume Next conn.open ConnStr '------------------------------------------------------- 'Se il sito funziona in modo corretto consigliamo di 'commentare il contenuto di Opzione 1 e di rimuovere il 'commento dalla opzione 2 '------------------------------------------------------- If conn.errors.count > 0 then for counter = 0 to conn.errors.count-1 If int(conn.errors(counter).number) <> 0 Then ' Opzione 1 response.write "
" & vbcrlf response.write "

Errore: " & " -> " & conn.errors(counter).number & "

" & vbcrlf response.write "

Descrizione: " & " -> " & conn.errors(counter).description & "

" & vbcrlf response.write "
" & vbcrlf Response.End End If next conn.errors.Clear End If 'Se le righe qui sopra vengono lasciate commentate, tutti gli errori vengono bypassati fino a raggiungere una riga simile 'alla successiva. 'On Error Goto 0 End If if len(request("LANG")) > 1 then Set lng = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM " & application("prefix") & "configurazione_lingue where codice='" & request("lang") & "'" lng.open sql, conn, adOpenStatic, adLockOptimistic if lng.EOF AND lng.BOF Then Session("LANGUAGE") = lcase(Application("LANGUAGE")) else Session("language") = lcase(lng("codice")) end if lng.close set lng = nothing end if if len(session("LANGUAGE")) > 0 then Set lng = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM " & application("prefix") & "configurazione_lingue where codice='" & Session("language") & "'" SET lng = conn.execute(sql) session.lcid = lng("lcidstring") Session("langdir") = lng("langdir") Session("backofficelanguage") = Session("language") Session("encoding") = lng("charset") response.Charset= Session("encoding") if int(lng("visibile")) = 0 then Session("language") = Application("language") end if set lng = nothing else Set lng = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM " & application("prefix") & "configurazione_lingue where codice='" & Application("language") & "'" SET lng = conn.execute(sql) session.lcid = lng("lcidstring") Session("langdir") = lng("langdir") Session("backofficelanguage") = Session("language") Session("encoding") = lng("charset") response.Charset= Session("encoding") if int(lng("visibile")) = 0 then Session("language") = Application("language") end if set lng = nothing end if Set xs = Server.CreateObject("ADODB.Recordset") sql = "SELECT * FROM " & application("prefix") & "configurazione where elemento='xstandard_Autoinstall' or elemento='xstandard_Version'" SET xs = conn.execute(sql) do until xs.eof if xs("elemento") = "xstandard_Autoinstall" then Session("xstandard_Autoinstall") = xs("valore") end if if xs("elemento") = "xstandard_Version" then Session("xstandard_Version") = xs("valore") end if xs.movenext Loop set xs = nothing '======================================================================== ' Definizione standard delle costanti del Database (da adovbs.inc) ' Rimuovere se si include il file adovbs.inc '---- CursorTypeEnum Values ---- Const adOpenForwardOnly = 0 Const adOpenKeyset = 1 Const adOpenDynamic = 2 Const adOpenStatic = 3 '---- LockTypeEnum Values ---- Const adLockReadOnly = 1 Const adLockPessimistic = 2 Const adLockOptimistic = 3 Const adLockBatchOptimistic = 4 '---- CursorLocationEnum Values ---- Const adUseServer = 2 Const adUseClient = 3 '======================================================================== ' Caricamento stringhe 'CARICAMENTO BACKOFFICE_XX.XML dim DICLanguage (450) Set objDoc = Server.CreateObject("MSXML2.DOMDocument.4.0") objDoc.async = False descpath = Server.mapPath("\files\xml\backoffice_" & Session("backofficelanguage") & ".xml") set fs=Server.CreateObject("Scripting.FileSystemObject") if fs.FileExists(descpath)=true then else descpath = Server.mapPath("\files\xml\backoffice_" & Application("language") & ".xml") end if set fs=nothing If Not objDoc.load(descpath) Then Response.write "

ERRORE
codice: " & _ objDOC.parseError.errorCode & _ "
Linea/Col: " & _ objDOC.parseError.line & "/" & _ objDOC.parseError.linepos & "

" else For Each objNode In objDoc.selectNodes("/strings/row") ID_LANG = objNode.selectSingleNode("ref").Text 'ID_STRINGA = objNode.selectSingleNode("content[lang('it')]").Text ID_STRINGA = objNode.selectSingleNode("content").Text Set objRE = New RegExp objRE.Global = True ' Add lang attribute as per Appendix C Compatibility recommendation objRE.Pattern = "(xml:(lang=""[\S]*""))" ID_STRINGA = objRE.Replace(ID_STRINGA, "$1 $2") ' Add space for self-closing elements as per Appendix C Compatibility recommendation objRE.Pattern = "([^\s]+)(/>)" ID_STRINGA = objRE.Replace(ID_STRINGA, "$1 $2") ' Release memory Set objRE = Nothing DICLanguage(ID_LANG) = ID_STRINGA Next End If Set objDoc = Nothing Set objNode = Nothing 'CARICAMENTO BACKOFFICE_MNU_XX.XML dim MNULanguage (450) Set objDoc = Server.CreateObject("MSXML2.DOMDocument.4.0") objDoc.async = False descpath = Server.mapPath("\files\xml\backoffice_mnu_" & Session("backofficelanguage") & ".xml") set fs=Server.CreateObject("Scripting.FileSystemObject") if fs.FileExists(descpath)=true then else descpath = Server.mapPath("\files\xml\backoffice_mnu_" & Application("language") & ".xml") end if set fs=nothing If Not objDoc.load(descpath) Then Response.write "

ERRORE
codice: " & _ objDOC.parseError.errorCode & _ "
Linea/Col: " & _ objDOC.parseError.line & "/" & _ objDOC.parseError.linepos & "

" else For Each objNode In objDoc.selectNodes("/strings/row") ID_LANG = objNode.selectSingleNode("ref").Text 'ID_STRINGA = objNode.selectSingleNode("content[lang('it')]").Text ID_STRINGA = objNode.selectSingleNode("content").Text Set objRE = New RegExp objRE.Global = True ' Add lang attribute as per Appendix C Compatibility recommendation objRE.Pattern = "(xml:(lang=""[\S]*""))" ID_STRINGA = objRE.Replace(ID_STRINGA, "$1 $2") ' Add space for self-closing elements as per Appendix C Compatibility recommendation objRE.Pattern = "([^\s]+)(/>)" ID_STRINGA = objRE.Replace(ID_STRINGA, "$1 $2") ' Release memory Set objRE = Nothing MNULanguage(ID_LANG) = ID_STRINGA Next End If Set objDoc = Nothing Set objNode = Nothing '======================================================================== 'Funzioni Base '======================================================================== function getFormObject () if Request.ServerVariables("REQUEST_METHOD") = "GET" then set getFormObject=Request.QueryString else set getFormObject=Request.Form end if end function Function LAC(stringa) If len(stringa) > 0 Then If InStr(1, Request.ServerVariables("HTTP_ACCEPT").Item, "application/xhtml+xml") > 0 then LAC = " xml:lang=""" & stringa & """" Else LAC = " xml:lang=""" & stringa & """ lang=""" & stringa & """" End if end If End function Function FixUTF(str) If len(str) > 0 then str = Trim(replace(str,"“","""")) str = Trim(replace(str,"”","""")) str = Trim(replace(str,"–","-")) str = TRim(replace(str,"’","'")) str = TRim(replace(str,"`","'")) str = Trim(replace(str,"…","...")) end if FixUTF = str end function Function FixMySQL(str) if str <> "" then FixMySQL = replace(str,"'","''") If CMS_DB = "MYSQL" Then FixMYSQL = Trim(replace(FixMYSQL,"\","\\")) End if else FixMYSQL = str end if end function Function MYSQLDate(str) MYSQLDate = year(str) & "/" & month(str) & "/" & day(str) end function function stripQuotes(strWords) stripQuotes = replace(strWords, "'", "''") end function Function FixString(str,direction) if len(str) > 0 then If direction="f" then ' filtra str = Trim(replace(str,"'","''")) str = TRim(replace(str,"’","''")) str = TRim(replace(str,"`","''")) str = Trim(replace(str,"–","-")) str = Trim(replace(str,"“","""")) str = Trim(replace(str,"”","""")) str = Trim(replace(str,"…","...")) Else ' defiltra str = Trim(replace(str,"…","...")) str = Trim(replace(str,"''","'")) 'str = Trim(replace(str,"""",""")) str = Trim(replace(str,"€","€")) 'str = Trim(replace(str,"&","&")) str = Trim(replace(str,"–","-")) str = Trim(replace(str,"“","""")) str = Trim(replace(str,"”","""")) 'A 'str = Trim(replace(str,"à","à")) 'str = Trim(replace(str,"á","á")) 'str = Trim(replace(str,"â","â")) 'str = Trim(replace(str,"ã","ã")) 'str = Trim(replace(str,"ä","ä")) 'str = Trim(replace(str,"å","å")) 'str = Trim(replace(str,"À","À")) 'str = Trim(replace(str,"Á","Á")) 'str = Trim(replace(str,"Â","Â")) 'str = Trim(replace(str,"Ã","Ã")) 'str = Trim(replace(str,"Ä","Ä")) 'str = Trim(replace(str,"Å","Å")) 'E 'str = Trim(replace(str,"è","è")) 'str = Trim(replace(str,"é","é")) 'str = Trim(replace(str,"ê","ê")) 'str = Trim(replace(str,"ë","ë")) 'str = Trim(replace(str,"È","È")) 'str = Trim(replace(str,"É","É")) 'str = Trim(replace(str,"Ê","Ê")) 'str = Trim(replace(str,"Ë","Ë")) 'I 'str = Trim(replace(str,"ì","ì")) 'str = Trim(replace(str,"í","í")) 'str = Trim(replace(str,"î","î")) 'str = Trim(replace(str,"ï","ï")) 'str = Trim(replace(str,"Ì","Ì")) 'str = Trim(replace(str,"Í","Í")) 'str = Trim(replace(str,"Î","Î")) 'str = Trim(replace(str,"Ï","Ï")) 'AE 'str = Trim(replace(str,"æ","æ")) 'str = Trim(replace(str,"Æ","Æ")) 'O 'str = Trim(replace(str,"ò","ò")) 'str = Trim(replace(str,"ó","ó")) 'str = Trim(replace(str,"ô","ô")) 'str = Trim(replace(str,"õ","õ")) 'str = Trim(replace(str,"ö","ö")) 'str = Trim(replace(str,"ø","ø")) 'str = Trim(replace(str,"Ò","Ò")) 'str = Trim(replace(str,"Ó","Ó")) 'str = Trim(replace(str,"Ô","Ô")) 'str = Trim(replace(str,"Õ","Õ")) 'str = Trim(replace(str,"Ö","Ö")) 'str = Trim(replace(str,"Ø","Ø")) 'U 'str = Trim(replace(str,"ù","ù")) 'str = Trim(replace(str,"ú","ú")) 'str = Trim(replace(str,"û","û")) 'str = Trim(replace(str,"ü","ü")) 'str = Trim(replace(str,"Ù","Ù")) 'str = Trim(replace(str,"Ú","Ú")) 'str = Trim(replace(str,"Û","Û")) 'str = Trim(replace(str,"Ü","Ü")) 'N 'str = Trim(replace(str,"ñ","ñ")) 'str = Trim(replace(str,"Ñ","Ñ")) 'ALTRI str = Trim(replace(str,"©","©")) str = Trim(replace(str,"®","®")) str = Trim(replace(str,"™","™")) str = Trim(replace(str,"»","’")) str = Trim(replace(str,"«","‘")) str = Trim(replace(str,"ç","ç")) str = Trim(replace(str,"Ç","Ç")) str = Trim(replace(str,"Ð","Ð")) 'str = Trim(replace(str,"°","®")) 'str = Trim(replace(str,"ª","®")) 'str = Replace(str,"
",chr(13) & chr(10)) End If end if FixString = str End function 'Function Xstandard_script(editor,campo) ' 'xstandard_script = "if (document.getElementById('" & editor & "')) {" & vbcrlf 'xstandard_script = xstandard_script & " document.getElementById('" & editor & "').EscapeUNICODE = true;" & vbcrlf 'xstandard_script = xstandard_script & " document.getElementById('" & campo & "').value = document.getElementById('" & editor & "').value;" & vbcrlf 'xstandard_script = xstandard_script & " } else {" & vbcrlf 'xstandard_script = xstandard_script & " document.getElementById('" & campo & "').value = document.getElementById('" & editor & "_alt').value;" & vbcrlf 'xstandard_script = xstandard_script & " }" & vbcrlf 'end function Sub XStandard(editor,campo,lingua, contenuto,tipoeditor) UserAgentUsed = request.ServerVariables("HTTP_USER_AGENT") if instr(UserAgentUsed, "WebTV") or instr(UserAgentUsed, "Windows CE") or instr(UserAgentUsed, "NetFront") or instr(UserAgentUsed, "Palm OS") or instr(UserAgentUsed, "Blazer") or instr(UserAgentUsed, "Elaine") or instr(UserAgentUsed, "WAP") or instr(UserAgentUsed, "AvantGo") or instr(UserAgentUsed, "Plucker") or instr(UserAgentUsed, "DoCoMo") or instr(UserAgentUsed, "U.P.Browser") or instr(UserAgentUsed, "Xiino") or instr(UserAgentUsed, "BlackBerry") or instr(UserAgentUsed, "Symbian") or instr(UserAgentUsed, "Nokia") then%> <%if len(contenuto) > 1 then%> ucase(Session("backofficelanguage")) then%> <%=lac(lingua)%><%end if%> name="<%=campo%>_alt" rows="10" cols="80"><%=Server.HTMLEncode(contenuto)%> <%else%> ucase(Session("backofficelanguage")) then%> <%=lac(lingua)%><%end if%> name="<%=campo%>_alt" rows="10" cols="80"> <%end if%> <%else %> "no" then If InStr(1, Request.ServerVariables("HTTP_USER_AGENT").Item, "Windows 98") > 0 Then%> codebase="<%=application("WEB_PATH")%>/backoffice/xs/XStandardAnsi.cab#Version=<%=session("xstandard_version")%>" <%Else%> codebase="<%=application("WEB_PATH")%>/backoffice/xs/xstandard.cab#Version=<%=session("xstandard_version")%>"<%End If%><%end if%>> " /> <%if len(contenuto) > 1 then%> " /><%else%> <%end if%> <%if int(tipoeditor) = 1 then 'CODICE STANDARD PER XSTANDARD Set xs = Server.CreateObject("ADODB.Recordset") sql = "SELECT * FROM " & application("prefix") & "configurazione where gruppo='XST' and valore <> '' order by sottogruppo, ordine" SET xs = conn.execute(sql) If xs.EOF AND xs.BOF Then else do until xs.eof if xs("elemento") = "xstandard_lang" then%> " /> /files/xml/xs/localization-<%=Session("backofficelanguage")%>.xml" /> <%elseif xs("elemento") = "xstandard_lang" then%> " /> <%else%> " value="<%=xs("valore")%>" /><%end if%><%xs.movenext Loop end if set xs = nothing %> <%if len(contenuto) > 1 then%> ucase(Session("backofficelanguage")) then%> <%=lac(lingua)%><%end if%> name="<%=campo%>_alt" rows="10" cols="80"><%=Server.HTMLEncode(contenuto)%> <%else%> ucase(Session("backofficelanguage")) then%> <%=lac(lingua)%><%end if%> name="<%=campo%>_alt" rows="10" cols="80"> <%end if%> <%elseif int(tipoeditor) = 2 then 'CODICE PER EDITOR SOLO CODICE %> <% Set xs = Server.CreateObject("ADODB.Recordset") sql = "SELECT * FROM " & application("prefix") & "configurazione where elemento = 'xstandard_License' or elemento='xstandard_css'" SET xs = conn.execute(sql) If xs.EOF AND xs.BOF Then else do until xs.eof%> " value="<%=replace(replace(replace(xs("valore"),"",Session("OfficePath")),"",Session("USER_ID")),"&", "&")%>" /><%xs.movenext Loop end if %> <%else 'CODICE PER EDITOR SOLO CODICE %> <% Set xs = Server.CreateObject("ADODB.Recordset") sql = "SELECT * FROM " & application("prefix") & "configurazione where elemento = 'xstandard_License'" SET xs = conn.execute(sql) license = xs("valore") set xs = nothing %> <%end if%> <% end if End Sub Sub Generacampo(elemento,titolo,valore, opzioni,tipocampo) %> <% select case int(tipocampo)%> <%case 0 ' INPUT%> <%case 1 ' TEXTAREA%> <%case 2 ' RADIO%> <%=titolo%>: checked="checked"<%end if%> />    checked="checked"<%end if%> />    checked="checked"<%end if%> /> <%case 3 ' SELECTBOX%> <%end select%> <%end sub if Session("supervisor") = true then aggiunta_sql = "" aggiunta_where_sql = "" else aggiunta_sql = " and office_id=" & Session("Office_ID") aggiunta_where_sql = " where office_id=" & Session("Office_ID") end if Dim strCat If request("cat") = "" then if session("supervisor") = true then strCat = 0 else strCat = Session("ArgoID") end if else strCat = request("cat") end if Function IIf(a,b,c) if a then IIf = b else IIf = c end if End Function Function getParentID(intCatID) sql = "SELECT parentid FROM " & application("prefix") & "documenti WHERE id=" & intCatID & " and argomento=1 and visibile_" & Session("Language") & "=1" & aggiunta_sql & " order by title_" & Session("Language") Set objRS = conn.execute(sql) if not objRS.eof then getParentID = objRS("parentid") else if session("supervisor") = true then getParentID = 0 else getParentID = Session("ArgoID") end if end if Set objRS = nothing End Function Function GetCategoryList(intCatID) Dim strHTML, intParentID if cInt(intCatID) = 0 then if session("supervisor") = true then intParentID = 0 else intParentID = cint(session("ArgoID")) end if else intParentID = cInt(intCatID) end if if intparentid = 0 then sql = "Select * from " & application("prefix") & "documenti where visibile_" & Session("Language")& "=1 " & aggiunta_sql & " and argomento=2 order by posizione" Set MapRS = conn.execute(sql) if not MapRS.eof and not Maprs.bof then while not MapRS.eof sql = "SELECT * FROM " & application("prefix") & "documenti WHERE areaid=" & maprs("id") & " and parentid=" & intParentID & " and argomento=1" & aggiunta_sql & " order by posizione" Set objRS = conn.execute(sql) strHTML = strHTML & "

" & fixstring(MapRS("title_" & Session("Language")),"d") & "

" & vbcrlf strHTML = STRHTML & "" & vbcrlf MapRS.movenext Wend end if MapRS.close set MapRS = nothing else sql = "SELECT * FROM " & application("prefix") & "documenti WHERE parentid=" & intParentID & " and argomento=1" & aggiunta_sql & " order by posizione" Set objRS = conn.execute(sql) strHTML = "" & vbcrlf end if do while not objRS.eof if objRS("id") <> 0 then if int(objRS("visibile_" & Session("Language"))) = 1 then strHTML = strHTML & "
  • " & FixString(objrs("title_" & Session("Language")),"d") & " |
  • " & vbcrlf else strHTML = strHTML & "
  • * " & FixString(objrs("title_" & Session("Language")),"d") & " |
  • " & vbcrlf end if end if objRS.movenext loop set objRS = nothing strHTML = strHTML & "" & vbcrlf if intParentID <> 0 then strHTML = strHTML & "

    " & DICLanguage(261) & "

    " & vbcrlf end if end if GetCategoryList = strHTML End Function Class Category Public id, parentid, category End Class Function getParent(intID) strSQL = "SELECT * FROM " & application("prefix") & "documenti WHERE id = " & intID & " and argomento=1 and visibile_" & Session("Language")& "=1" & aggiunta_sql Set objRS1 = conn.execute(strSQL) Set objTemp = new Category If objRS1.EOF AND objRS1.BOF then objTemp.id = 0 objTemp.parentid = 0 objTemp.category = 0 set getParent = objTemp else Set objTemp = new Category objTemp.id = objRS1("id") objTemp.parentid = objRS1("parentid") objTemp.category =FixString(objRS1("title_" & Session("Language")),"d") end if set getParent = objTemp objRS1.close set objRS1 = nothing End Function Function constructCategory(objCategory) strParent = objCategory.parentid strCategory = objCategory.category do while strParent <> 0 strCategory = getParent(strParent).category & "\" & strCategory strParent = getParent(strParent).parentid loop constructCategory = strCategory End Function Function getCategoryName(intCatID) if cInt(intCatID) = 0 then if session("supervisor") = true then intParentID = 0 else intParentID = Session("ArgoID") end if else intParentID = cInt(intCatID) end if sql = "SELECT * FROM " & application("prefix") & "documenti WHERE id=" & intCatID & " and argomento=1" & aggiunta_sql & " order by posizione" Set objRS = conn.execute(sql) if objRS.eof and objrs.bof then getCategoryName = "\" else Set objTemp = new Category objTemp.id = objRS("id") objTemp.parentid = objRS("parentid") if int(objRS("visibile_" & Session("Language"))) = 1 then objTemp.category = FixString(objRS("title_" & Session("Language")),"d") else objTemp.category = "* " & FixString(objRS("title_" & Session("Language")),"d") end if strCategory = constructCategory(objTemp) Set objRS = nothing getCategoryName = strCategory end if End Function Function GetDocumentList(intCatID) Dim strHTML if cInt(intCatID) = 0 then if session("supervisor") = true then intParentID = 0 else intParentID = Session("ArgoID") end if else intParentID = cInt(intCatID) end if if CMS_DB = "MYSQL" Then strSQL = "SELECT Count(*) AS records FROM " & application("prefix") & "documenti WHERE catid=" & cInt(intCatID) & " and argomento=0" & aggiunta_sql & " order by posizione" Set objRS3 = Conn.execute(strSQL) intrecords = cint(objRS3("records")) objRS3.close set objrs3 = nothing 'intPageSize = int(maxitems) 'intStart = currentPage*intPageSize 'intStart = intStart-intPageSize 'intPages = int(intRecords/intPageSize) +1 SQL = "SELECT * FROM " & application("prefix") & "documenti WHERE catid=" & cInt(intCatID) & " and argomento=0" & aggiunta_sql & " order by posizione" & " LIMIT " & intStart & ", " & intPageSize else strSQL = "SELECT * FROM " & application("prefix") & "documenti WHERE catid=" & cInt(intCatID) & " and argomento=0" & aggiunta_sql & " order by posizione" end if Set objRS2 = Server.CreateObject("ADODB.RecordSet") 'Paginazione ----------------------------------------------- 'NUMERO MASSIMO DI RECORD PER PAGINA maxitems = cint(Application("maxitems")) 'RECUPERA NUMERO PAGINA ATTUALE If Not IsEmpty(Request("sp")) then currentPage = Request("sp") End If 'IN CASO DI PROBLEMI ASSEGNA LA PAGINA 1 if currentPage = "" OR not isNumeric(currentPage) then currentPage = int(1) else currentPage = int(currentPage) end if if request("st") <> "" and request("fn") <> "" then ordinamento = request("fn") & " " & request("st") else ordinamento = "posizione" end if if CMS_DB = "MYSQL" Then intPageSize = int(maxitems) intStart = currentPage*intPageSize intStart = intStart-intPageSize intPages = int(intRecords/intPageSize)' +1 sql = "SELECT * FROM " & application("prefix") & "documenti WHERE catid=" & cInt(intCatID) & " and argomento=0" & aggiunta_sql & " order by " & ordinamento & " LIMIT " & intStart & ", " & intPageSize else sql = "SELECT * FROM " & application("prefix") & "documenti WHERE catid=" & cInt(intCatID) & " and argomento=0" & aggiunta_sql & " order by " & ordinamento end if If CMS_DB = "SQL" or CMS_DB = "MYSQL" Then objrs2.CursorLocation = adUseClient End If objRS2.open sql, conn, adOpenStatic, adLockOptimistic 'Nessun documento trovato If objRS2.EOF AND objRS2.BOF then strHTML = strHTML & "

    " & replace(DICLanguage(263),"[ARGOMENTO]", "" & getCategoryName(cInt(intCatID)) & "") & ".

    " strHTML = strHTML & "" & vbcrlf & "
    " & vbcrlf objRS2.Close set objRS2 = nothing GetDocumentList = strHTML exit function End If if CMS_DB = "ACCESS" or CMS_DB = "SQL" then objrs2.Pagesize= MaxItems objrs2.AbsolutePage = CurrentPage intPages = objRS2.PageCount intrecords = objrs2.recordcount end if if intpages = 0 then intpages = 1 if CMS_DB = "MYSQL" then intpages = intpages -1 end if strHTML = "
    " strHTML = strHTML & "

    " & IIf(intrecords > 1, replace(replace(DICLanguage(264),"[ARGOMENTO]", "" & getCategoryName(cInt(intCatID)) & ""),"[N]", intrecords), replace(DICLanguage(265),"[ARGOMENTO]" , "" & getCategoryName(cInt(intCatID)) & "")) & ".

    " & vbcrlf if Session("translator") = true then else strHTML = strHTML & "

    " & DICLanguage(97) & "

    " & vbcrlf end if 'TABELLA CONTENENTE I DOCUMENTI --------------------- strHTML = strHTML & "" & vbcrlf strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf rowCount = 0 strHTML = strHTML & " " & vbcrlf while not objrs2.eof AND NumRows < maxitems 'Do until objRs2.EOF strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf strHTML = strHTML & " " & vbcrlf objRS2.movenext NumRows = NumRows + 1 Wend strHTML = strHTML & " " & vbcrlf strHTML = strHTML & "
    " & DICLanguage(120) & "" & DICLanguage(32) & "" & DICLanguage(124) & "
    " if objRS2("visibile_" & Session("Language")) = 1 then strHTML = strHTML & "V " else strHTML = strHTML & "X " end if 'strHTML = strHTML & " strHTML = strHTML & "[" & objRS2("posizione") & "] " & fixstring(objRS2("title_" & Session("Language")),"d") & "" if objrs2("modificato") <> 0 then strHTML = strHTML & "" & formatdatetime(objRS2("Modificato"),2) & " - " & formatdatetime(objRS2("Modificato"),3) end if strHTML = strHTML & "
    " & vbcrlf if intrecords > maxitems then strHTML = strHTML & "
    " & vbcrlf for ia=1 to intPages if cint(ia)=cint(currentPage) then strHTML = strHTML & "" & ia & "" & " | " else strHTML = strHTML & "" else strHTML = strHTML & replace(replace(DICLanguage(115),"[N]", ia),"[TOT]",intpages) & """>" end if strHTML = strHTML & ia strHTML = strHTML & "" strHTML = strHTML & " | " end if next strHTML = strHTML & "
    " & vbcrlf end if 'strHTML = strHTML & "

    " & DICLanguage(128) & " 

    " & vbcrlf strHTML = strHTML & "

    " strHTML = strHTML & "" strHTML = strHTML & "" strHTML = strHTML & "

    " & vbcrlf strHTML = strHTML & "
    " & vbcrlf objrs2.close set objRS2 = nothing GetDocumentList = strHTML End Function 'DATA IN FORMATO ISO Function return_RFC822_Date(myDate, offset) Dim myDay, myDays, myMonth, myYear Dim myHours, myMonths, mySeconds myDate = CDate(myDate) myDay = WeekdayName(Weekday(myDate),true) myDays = Day(myDate) myMonth = MonthName(Month(myDate), true) myYear = Year(myDate) myHours = zeroPad(Hour(myDate), 2) myMinutes = zeroPad(Minute(myDate), 2) mySeconds = zeroPad(Second(myDate), 2) return_RFC822_Date = myDay&", "& _ myDays&" "& _ myMonth&" "& _ myYear&" "& _ myHours&":"& _ myMinutes&":"& _ mySeconds&" "& _ offset End Function Function zeroPad(m, t) zeroPad = String(t-Len(m),"0")&m End Function Function GetW3DTF(dtmDate,offset) Dim strDate strDate = DatePart("yyyy", dtmDate) & "-" & zeropad(DatePart("m", dtmDate),2) & "-" & zeropad(DatePart("d", dtmDate),2) & "T" &_ zeropad(DatePart("h", dtmDate),2) & ":" & zeropad(DatePart("n", dtmDate),2) & ":" & zeropad(DatePart("s", dtmDate),2) & offset GetW3DTF = strDate End Function ENCKEY = cstr(Application("ENCKEY")) Function Encrypt(Stringa) Encrypt = Binary2StringaHex(EncryptStringa(Stringa, ENCKEY)) End Function Function Decrypt(Stringa) Decrypt = Trim(EncryptStringa(StringaHex2Binary(Stringa), ENCKEY)) End Function Function EncryptStringa(Stringa, Chiave) lChiave = 0 For p = 1 to Len(Chiave) lChiave = lChiave + Asc(Mid(Chiave,p,1)) Next Rnd (-1 * lChiave) Buffer = "" For p = 1 To Len(Stringa) c = Asc(Mid(Stringa, p, 1)) - 32 c1 = (c Xor (Int(Rnd() * 64))) + 32 Buffer = Buffer & Chr(c1) Next EncryptStringa = Buffer End Function Function Binary2StringaHex(Stringa) Buffer = "" For k = 1 To Len(Stringa) Buffer = Buffer + HexValue(Asc(Mid(Stringa, k, 1)), 2) Next Binary2StringaHex = Buffer End Function Function HexValue(valore, Cifre) HexValue = Right(String(Cifre, "0") + Hex(valore), Cifre) End Function Function StringaHex2Binary(Stringa) Buffer = "" For k = 1 To Len(Stringa) Step 2 HexVal = "&H" + Mid(Stringa, k, 2) Buffer = Buffer + Chr(cint(HexVal)) Next StringaHex2Binary = Buffer End Function %>