% ' 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) %> <% 'controllo sicurezza -------------- if Session("WEBGODLogin") <> "W3C_VALIDATOR" then If session("strutture")<> 1 Then response.Redirect "/backoffice/noentry.asp" end if end if '---------------------------------- 'Prevent your website from cross website attacks --------- refererUrl = Cstr(Request.ServerVariables("HTTP_REFERER")) serverName = Cstr(Request.ServerVariables("SERVER_NAME")) refererName = mid(refererUrl,8,len(serverName)) if refererName <> serverName then response.Redirect "/backoffice/noentry.asp" response.end end if '--------------------------------------------------------- %> <% percorso = " " & DICLanguage(142) %> <% ManuId = Trim(replace(Request("CatId"),"'","''")) lingua = split(Application("DISP_LINGUE_BACKOFFICE"),",") if request("lastpage") <> "" then Session("lastpage") = request("lastpage") else Session("lastpage") = Request.ServerVariables("HTTP_REFERER") end if 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 'Imposta la funzione da utilizzare If Request("Update") <> "" Then strfunction = "Update" Elseif Request("Delete") <> "" Then strfunction = "Deletewait" Elseif Request("Deleteok") <> "" Then strfunction = "Delete" Elseif Request("Add") <> "" Then strfunction = "addmanu" Elseif Request("Back") <> "" then response.redirect Session("lastpage") End If Function DeleteManu (ManuID) Set RSdel = Server.CreateObject("ADODB.Recordset") sql = "DELETE FROM " & application("prefix") & "strutture WHERE Id = " & ManuID & aggiunta_sql SET RSdel = conn.execute(sql) SET RSdel = nothing End Function Function UpdateManu (ManuID) Dim strSQL, rs If Request("title_" & Session("Language")) = "" Then UpdateManu = -1 Else Set objRS2 = Server.CreateObject("ADODB.Recordset") sql = "select * FROM " & application("prefix") & "strutture WHERE Id = " & ManuID & aggiunta_sql objRS2.open sql, conn, adOpenStatic, adLockOptimistic If objRS2.EOF AND objRS2.BOF then UpdateManu = -10 else if Session("supervisor") = true then if request("proprietario") <> "" then rs_proprietario = request("proprietario") else rs_proprietario = 1 end if else rs_proprietario = Session("ID_UTENTE") end if 'ASSEGNAZIONE OFFICE_ID if rs_proprietario <> 0 then sql = "Select struttura from " & application("prefix") & "utenti where id=" & rs_proprietario SET RS2 = conn.execute(sql) rs_office_id = rs2("struttura") rs2.close set rs2 = nothing else rs_office_id = 0 end if if rs_office_id = "" then rs_office_id = 0 end if if request("parentid") <> "" then rs_parentid = request("parentid") else rs_parentid = 0 end if if request("docid") <> "" then rs_docid = request("docid") else rs_docid = 0 end if If lcase(Request("childs")) = "on" Then rs_childs = 1 else rs_childs = 0 End If if request("modello") <> "" then rs_modello = request("modello") else rs_modello = 1 end if rs_modificato = strDataOra If lcase(Request("visibile")) = "on" Then rs_visibile = 1 else rs_visibile = 0 End If rs_indirizzo = "'" & FixMySQL(request("indirizzo")) & "'" rs_telefono = "'" & FixMySQL(request("telefono")) & "'" rs_fax = "'" & FixMySQL(request("fax")) & "'" rs_cellulare = "'" & FixMySQL(request("cellulare")) & "'" rs_email= "'" & FixMySQL(request("email")) & "'" rs_mail_referente = "'" & FixMySQL(request("mail_referente")) & "'" rs_nome_referente = "'" & FixMySQL(request("nome_referente")) & "'" upddescrizioni = "" for j=LBound(lingua) to UBound(lingua) upddescrizioni = upddescrizioni & "title_" & lingua(j) & "='" & FixMySQL((Request("title_" & lingua(j)))) & "'," upddescrizioni = upddescrizioni & "tagtitle_" & lingua(j) & "='" & FixMySQL((Request("tagtitle_" & lingua(j)))) & "'," upddescrizioni = upddescrizioni & "descrizione_" & lingua(j) & "='" & FixMySQL((Request("descrizione_" & lingua(j)))) & "'," upddescrizioni = upddescrizioni & "keywords_" & lingua(j) & "='" & FixMySQL((Request("keywords_" & lingua(j)))) & "'," contenuto = null if len (Request("content_" & lingua(j))) > 0 then contenuto = FixMySQL((Request("content_" & lingua(j)))) else contenuto = Request("content_" & lingua(j) & "_alt") if len(contenuto) > 0 then Set Tidy = Server.CreateObject("TidyCOM.TidyObject.2") Tidy.Options.Item("output-xhtml") = "yes" Tidy.Options.Item("xhtml-version") = "1.1" Tidy.Options.Item("show-body-only") = "yes" contenuto = Tidy.TidyMemToMem(contenuto) set Tidy = nothing end if end if upddescrizioni = upddescrizioni & "content_" & lingua(j) & "='" & FixMySQL(contenuto)) & "'," next rs_lastuserid = "'" & Session("WEBGODLogin") & "'" rs_lastlogin = strDataOra rs_lastIP = "'" & Request.ServerVariables("REMOTE_ADDR") & "'" strSQL = "UPDATE " & application("prefix") & "strutture set " & upddescrizioni & "proprietario=" & rs_proprietario & ",parentid=" & rs_parentid & ",docid=" & rs_docid & ",childs=" & rs_childs & ",modello=" & rs_modello & ",modificato=" & rs_modificato & ",indirizzo=" & rs_indirizzo & ",telefono=" & rs_telefono & ",fax=" & rs_fax & ",cellulare=" & rs_cellulare & ",visibile=" & rs_visibile & ",lastuserid=" & rs_lastuserid & ",lastlogin=" & rs_lastlogin & ",lastip=" & rs_lastip & ",email=" & rs_email & ",mail_referente=" & rs_mail_referente & ",nome_referente=" & rs_nome_referente & ",office_id=" & rs_office_id & " where id=" & ManuID & aggiunta_sql set rs = Conn.execute(strSQL) set rs = nothing STRUTTURA_PARENTID = ManuID do while STRUTTURA_PARENTID > 0 Set rs_cartella = Server.CreateObject("ADODB.Recordset") sql = "select * FROM " & application("prefix") & "strutture WHERE id = " & STRUTTURA_PARENTID rs_cartella.open sql, conn, adOpenStatic, adLockOptimistic STRUTTURA_PARENTID = rs_cartella("parentid") if cint(rs_cartella("parentid")) > 0 then PERCORSO_COMPLETO = rs_cartella("parentid") & "/" & PERCORSO_COMPLETO end if rs_cartella.close set rs_cartella = nothing loop Set objFSO = Server.CreateObject("Scripting.FileSystemObject") if PERCORSO_COMPLETO <> "" then strRootPath = "../files/" & PERCORSO_COMPLETO & ManuID else strRootPath = "../files/" & ManuID end if cartella= server.MapPath(strRootPath) If Not objFSO.FolderExists(cartella) then objFSO.CreateFolder(cartella) End If Set objFSO = nothing end if objRS2.close set objrs2 = nothing End If End Function Function AddManu (ManuID) If Request("title_" & Session("Language")) = "" Then AddManu = -1 Else Set objRS2 = Server.CreateObject("ADODB.Recordset") sql = "select * FROM " & application("prefix") & "strutture WHERE title_" & Session("Language") & " = '" & FixMySQL(request("Title_" & Session("Language"))) & "'" & aggiunta_sql objRS2.open sql, conn, adOpenStatic, adLockOptimistic If objRS2.EOF AND objRS2.BOF then if request("proprietario") <> "" then rs_proprietario = request("proprietario") else rs_proprietario = 1 end if if Session("supervisor") = true then if request("proprietario") <> "" then rs_proprietario = request("proprietario") else rs_proprietario = 1 end if else rs_proprietario = Session("ID_UTENTE") end if 'ASSEGNAZIONE OFFICE_ID if rs_proprietario <> 0 then sql = "Select struttura from " & application("prefix") & "utenti where id=" & rs_proprietario SET RS2 = conn.execute(sql) rs_office_id = rs2("struttura") rs2.close set rs2 = nothing else rs_office_id = 0 end if if rs_office_id = "" then rs_office_id = 0 end if if request("docid") <> "" then rs_docid = request("docid") else rs_docid = 0 end if If lcase(Request("childs")) = "on" Then rs_childs = 1 else rs_childs = 0 End If if request("modello") <> "" then rs_modello = request("modello") else rs_modello = 1 end if rs_modificato = strDataOra If lcase(Request("visibile")) = "on" Then rs_visibile = 1 else rs_visibile = 0 End If rs_indirizzo = "'" & FixMySQL(request("indirizzo")) & "'" rs_telefono = "'" & FixMySQL(request("telefono")) & "'" rs_fax = "'" & FixMySQL(request("fax")) & "'" rs_cellulare = "'" & FixMySQL(request("cellulare")) & "'" rs_email= "'" & FixMySQL(request("email")) & "'" rs_mail_referente = "'" & FixMySQL(request("mail_referente")) & "'" rs_nome_referente = "'" & FixMySQL(request("nome_referente")) & "'" descrizioni = "" testodescrizioni = "" for j=LBound(lingua) to UBound(lingua) descrizioni = descrizioni & "title_" & lingua(j) & "," descrizioni = descrizioni & "tagtitle_" & lingua(j) & "," descrizioni = descrizioni & "descrizione_" & lingua(j) & "," descrizioni = descrizioni & "keywords_" & lingua(j) & "," descrizioni = descrizioni & "content_" & lingua(j) & "," testodescrizioni = testodescrizioni & "'" & FixMySQL((Request("title_" & lingua(j)))) & "'," testodescrizioni = testodescrizioni & "'" & FixMySQL((Request("tagtitle_" & lingua(j)))) & "'," testodescrizioni = testodescrizioni & "'" & FixMySQL((Request("descrizione_" & lingua(j)))) & "'," testodescrizioni = testodescrizioni & "'" & FixMySQL((Request("keywords_" & lingua(j)))) & "'," contenuto = null if len (Request("content_" & lingua(j))) > 0 then contenuto = FixMySQL((Request("content_" & lingua(j)))) else contenuto = Request("content_" & lingua(j) & "_alt") if len(contenuto) > 0 then Set Tidy = Server.CreateObject("TidyCOM.TidyObject.2") Tidy.Options.Item("output-xhtml") = "yes" Tidy.Options.Item("xhtml-version") = "1.1" Tidy.Options.Item("show-body-only") = "yes" contenuto = Tidy.TidyMemToMem(contenuto) set Tidy = nothing end if end if testodescrizioni = testodescrizioni & "'" & FixMySQL(contenuto)) & "'," next rs_lastuserid = "'" & Session("WEBGODLogin") & "'" rs_lastlogin = strDataOra rs_lastIP = "'" & Request.ServerVariables("REMOTE_ADDR") & "'" strSQL = "INSERT INTO " & application("prefix") & "strutture (proprietario,parentid,docid,childs,modello,modificato,indirizzo,telefono,fax,cellulare,visibile," & descrizioni & "lastuserid,lastlogin,lastip,email,mail_referente,nome_referente,office_id) VALUES (" & rs_proprietario & "," & rs_parentid & "," & rs_docid & "," & rs_childs & "," & rs_modello & "," & rs_modificato & "," & rs_indirizzo & "," & rs_telefono & "," & rs_fax & "," & rs_cellulare & "," & rs_visibile & "," & testodescrizioni & rs_lastuserid & "," & rs_lastlogin & "," & rs_lastip & "," & rs_email & "," & rs_mail_referente & "," & rs_nome_referente & "," & rs_office_id & ")" 'response.write strSQL set rs = Conn.execute(strSQL) set rs = nothing 'CREA CARTELLA UTENTE Set rs_cartella = Server.CreateObject("ADODB.Recordset") sql = "select * FROM " & application("prefix") & "strutture WHERE lastlogin = " & rs_lastlogin & " and lastuserid = " & rs_lastuserid rs_cartella.open sql, conn, adOpenStatic, adLockOptimistic ID_UTENTE = rs_cartella("id") rs_cartella.close set rs_cartella = nothing STRUTTURA_PARENTID = rs_struttura do while STRUTTURA_PARENTID > 0 Set rs_cartella = Server.CreateObject("ADODB.Recordset") sql = "select * FROM " & application("prefix") & "strutture WHERE id = " & STRUTTURA_PARENTID rs_cartella.open sql, conn, adOpenStatic, adLockOptimistic STRUTTURA_PARENTID = rs_cartella("parentid") if cint(rs_cartella("parentid")) > 0 then PERCORSO_COMPLETO = rs_cartella("parentid") & "/" & PERCORSO_COMPLETO end if rs_cartella.close set rs_cartella = nothing loop 'response.write PERCORSO_COMPLETO Set objFSO = Server.CreateObject("Scripting.FileSystemObject") if PERCORSO_COMPLETO <> "" then strRootPath = "../files/" & PERCORSO_COMPLETO & ManuID else strRootPath = "../files/" & ManuID end if 'response.write " STRROOTPATH=" & strRootpath cartella= server.MapPath(strRootPath) 'response.write " cartella = " & cartella If Not objFSO.FolderExists(cartella) then objFSO.CreateFolder(cartella) End If Set objFSO = nothing else addmanu = -10 end if objrs2.close Set objRS2 = nothing end if End Function %>
<%=replace(DICLanguage(311),"[TESTO]","'" & Request("title_" & Session("Language"))) & "'")%><%=DICLanguage(0)%> <%=DICLanguage(312)%>
<%=DICLanguage(143)%>
<%=DICLanguage(7)%>
" & DICLanguage(11) & DICLanguage(0) & " " & DICLanguage(2) & "" & DICLanguage(0) & "
" If rescode = -10 Then strError = "" & DICLanguage(12) & DICLanguage(0) & "
" & DICLanguage(2) & "" & DICLanguage(0) & "
" %><%=replace(DICLanguage(146),"[UFFICIO]","'" & Request("title_" & Session("Language")) & "'")%><%=DICLanguage(0)%>
<%=DICLanguage(7)%>
" & DICLanguage(15) & DICLanguage(0) & "
" & DICLanguage(2) & "" & DICLanguage(0) & "
" If rescode = -1 Then strError = "" & DICLanguage(12) & DICLanguage(0) & " " & DICLanguage(2) & "" & DICLanguage(0) & "
" %><%=replace(DICLanguage(148),"[UFFICIO]","'" & Request("title_" & Session("Language")) & "'")%><%=DICLanguage(0)%>
<% If Request.Form("addmore")<>"" Then %> <% Else %><%=DICLanguage(7)%>
<%=DICLanguage(4)%> &submnu=<%=request("submnu")%>" title="<%=DICLanguage(10)%>"><%=DICLanguage(5)%><%=DICLanguage(0)%>
" onclick="history.back()" onkeypress="history.back()"><%=DICLanguage(2)%><%=DICLanguage(0)%>