Skip to content

Commit 4208503

Browse files
committed
Bug #13891: fixing security management into website component.
1 parent b32d3f6 commit 4208503

File tree

8 files changed

+107
-36
lines changed

8 files changed

+107
-36
lines changed

webSites/webSites-war/src/main/webapp/webSites/jsp/addPage.jsp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,15 @@ else if (action.equals("verif")) { //vient de addPage
200200
<HEAD>
201201
<script type="text/javascript">
202202
function verifServer(path, name, nameSite, id) {
203-
window.opener.location.replace("verifAjoutPage.jsp?Path="+URLENCODE(path)+"&nomPage="+URLENCODE(name)+"&nameSite="+URLENCODE(nameSite)+"&id="+id);
203+
window.opener.sp.formRequest("verifAjoutPage.jsp")
204+
.withParams({
205+
'Path' : path,
206+
'nomPage' : name,
207+
'nameSite' : nameSite,
208+
'id' : id
209+
})
210+
.byPostMethod()
211+
.submit();
204212
window.close();
205213
}
206214
</script>
@@ -216,6 +224,7 @@ else if (action.equals("addPage")) { //vient de verifAjoutPage
216224
217225
//SERVER OK, AJOUT PAGE
218226
String name = (String) request.getParameter("nomPage"); //vient de verifAjoutPage
227+
String code = "<HTML><HEAD></HEAD><BODY></BODY></HTML>";
219228
/* Creer une nouvelle page sur le serveur */
220229
scc.createFile(path, name, code);
221230
%>
@@ -237,10 +246,4 @@ else if (action.equals("addPage")) { //vient de verifAjoutPage
237246
238247
}
239248
240-
%>
241-
242-
<script type="text/javascript">
243-
function URLENCODE(URL){
244-
return encodeURIComponent(URL);
245-
}
246-
</script>
249+
%>

webSites/webSites-war/src/main/webapp/webSites/jsp/addRep.jsp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,15 @@ else if (action.equals("Add")) {
170170
<head>
171171
<script type="text/javascript">
172172
function verifServer(id, path, name) {
173-
window.opener.location.replace("verif.jsp?Action=addFolder&Id="+id+"&Path="+path+"&name="+name);
173+
window.opener.sp.formRequest("verif.jsp")
174+
.withParams({
175+
'Action' : 'addFolder',
176+
'Id' : id,
177+
'Path' : path,
178+
'name' : name
179+
})
180+
.byPostMethod()
181+
.submit();
174182
window.close();
175183
}
176184
</script>

webSites/webSites-war/src/main/webapp/webSites/jsp/design.jsp

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ function URLENCODE(URL){
108108
return encodeURIComponent(URL);
109109
}
110110
111+
function openWindow(url, name) {
112+
return SP_openWindow(url, name, 700, 200, "directories=0,menubar=0,toolbar=0,alwaysRaised");
113+
}
114+
111115
/**********************************************/
112116
113117
function B_RETOUR_ONCLICK() {
@@ -143,10 +147,14 @@ function folderAdd(id, path) {
143147
window.pageAddWindow.close();
144148
}
145149
146-
url = "addRep.jsp?Id="+id+"&Path="+path+"&Action=View";
147-
windowName = "repAddWindow";
148-
windowParams = "directories=0,menubar=0,toolbar=0,height=200,width=700,alwaysRaised";
149-
repAddWindow = open(url, windowName, windowParams, false);
150+
repAddWindow = openWindow({
151+
url : 'addRep.jsp',
152+
params : {
153+
'Id' : id,
154+
'Path' : path,
155+
'Action' : 'View'
156+
}
157+
}, "repAddWindow");
150158
}
151159
152160
/**********************************************/
@@ -166,10 +174,15 @@ function pageAdd(path, nomsite) {
166174
if (window.pageAddWindow != null) {
167175
window.pageAddWindow.close();
168176
}
169-
url = "addPage.jsp?Action=View&Path="+URLENCODE(path)+"&nameSite="+URLENCODE(nomsite)+"&id=<%=id%>";
170-
windowName = "pageAddWindow";
171-
windowParams = "directories=0,menubar=0,toolbar=0,height=200,width=700,alwaysRaised";
172-
pageAddWindow = open(url, windowName, windowParams, false);
177+
pageAddWindow = openWindow({
178+
url : 'addPage.jsp',
179+
params : {
180+
'id' : '<%=id%>',
181+
'Path' : path,
182+
'Action' : 'View',
183+
'nameSite' : nomsite
184+
}
185+
}, "pageAddWindow");
173186
}
174187
175188
/**********************************************/
@@ -185,10 +198,12 @@ function uploadFile(path) {
185198
if (window.pageAddWindow != null)
186199
window.pageAddWindow.close();
187200
188-
url = "uploadFile.jsp?Path="+URLENCODE(path);
189-
windowName = "uploadFileWindow";
190-
windowParams = "directories=0,menubar=0,toolbar=0,height=200,width=700,alwaysRaised";
191-
uploadFileWindow = open(url, windowName, windowParams, false);
201+
uploadFileWindow = openWindow({
202+
url : 'uploadFile.jsp',
203+
params : {
204+
'Path' : path
205+
}
206+
}, "uploadFileWindow");
192207
}
193208
194209
@@ -206,10 +221,15 @@ function renameFolder(id, path, name) {
206221
if (window.pageAddWindow != null)
207222
window.pageAddWindow.close();
208223
209-
url = "updateRep.jsp?Id="+id+"&Path="+path+"&Action=View&Name="+name;
210-
windowName = "repUpdateWindow";
211-
windowParams = "directories=0,menubar=0,toolbar=0,height=200,width=700,alwaysRaised";
212-
repUpdateWindow = open(url, windowName, windowParams, false);
224+
repUpdateWindow = openWindow({
225+
url : 'updateRep.jsp',
226+
params : {
227+
'Id' : id,
228+
'Path' : path,
229+
'Action' : 'View',
230+
'Name' : name
231+
}
232+
}, "repUpdateWindow");
213233
}
214234
215235
/**********************************************/
@@ -266,10 +286,15 @@ function renamePage(id, path, name) {
266286
if (window.pageAddWindow != null)
267287
window.pageAddWindow.close();
268288
269-
url = "updatePage.jsp?Id="+id+"&Path="+path+"&Action=View&Name="+name;
270-
windowName = "pageUpdateWindow";
271-
windowParams = "directories=0,menubar=0,toolbar=0,height=200,width=700,alwaysRaised";
272-
pageUpdateWindow = open(url, windowName, windowParams, false);
289+
pageUpdateWindow = openWindow({
290+
url : 'updatePage.jsp',
291+
params : {
292+
'Id' : id,
293+
'Path' : path,
294+
'Action' : 'View',
295+
'Name' : name
296+
}
297+
}, "pageUpdateWindow");
273298
274299
}
275300

webSites/webSites-war/src/main/webapp/webSites/jsp/organize.jsp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,18 @@ function topicAdd(fatherId) {
151151
topicAddWindow.close();
152152
153153
path = document.liste.Path.value;
154-
url = "addTopic.jsp?Id="+fatherId+"&Path="+breakSpace(path)+"&Action=View";
155154
windowName = "topicAddWindow";
156155
larg = "670";
157156
haut = "270";
158157
windowParams = "directories=0,menubar=0,toolbar=0,alwaysRaised";
159-
topicAddWindow = SP_openWindow(url, windowName, larg , haut, windowParams);
158+
topicAddWindow = SP_openWindow({
159+
url : 'addTopic.jsp',
160+
params : {
161+
'Id' : fatherId,
162+
'Path' : path,
163+
'Action' : 'View'
164+
}
165+
}, windowName, larg , haut, windowParams);
160166
}
161167
162168
/***************************************************************************/
@@ -167,12 +173,17 @@ function topicUpdate(id) {
167173
168174
document.liste.ChildId.value = id;
169175
path = document.liste.Path.value;
170-
url = "updateTopic.jsp?ChildId="+id+"&Path="+breakSpace(path);
171176
windowName = "topicUpdateWindow";
172177
larg = "670";
173178
haut = "270";
174179
windowParams = "directories=0,menubar=0,toolbar=0, alwaysRaised";
175-
topicUpdateWindow = SP_openWindow(url, windowName, larg , haut, windowParams);
180+
topicUpdateWindow = SP_openWindow({
181+
url : 'updateTopic.jsp',
182+
params : {
183+
'ChildId' : id,
184+
'Path' : path
185+
}
186+
}, windowName, larg , haut, windowParams);
176187
}
177188
178189
/***************************************************************************/

webSites/webSites-war/src/main/webapp/webSites/jsp/updatePage.jsp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,16 @@ function sendData() {
182182
<HEAD>
183183
<script language="Javascript">
184184
function verifServer(id, path, name, newname) {
185-
window.opener.location.replace("verif.jsp?Action=renamePage&Id="+id+"&Path="+path+"&name="+name+"&newName="+newname);
185+
window.opener.sp.formRequest("verif.jsp")
186+
.withParams({
187+
'Action' : 'renamePage',
188+
'Id' : id,
189+
'Path' : path,
190+
'name' : name,
191+
'newName' : newname
192+
})
193+
.byPostMethod()
194+
.submit();
186195
window.close();
187196
}
188197
</script>

webSites/webSites-war/src/main/webapp/webSites/jsp/updateRep.jsp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,16 @@ else if (action.equals("Update")) {
199199
<HEAD>
200200
<script language="Javascript">
201201
function verifServer(id, path, name, newname) {
202-
window.opener.location.replace("verif.jsp?Action=renameFolder&Id="+id+"&Path="+path+"&name="+name+"&newName="+newname);
202+
window.opener.sp.formRequest("verif.jsp")
203+
.withParams({
204+
'Action' : 'renameFolder',
205+
'Id' : id,
206+
'Path' : path,
207+
'name' : name,
208+
'newName' : newname,
209+
})
210+
.byPostMethod()
211+
.submit();
203212
window.close();
204213
}
205214
</script>

webSites/webSites-war/src/main/webapp/webSites/jsp/verif.jsp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<%@ page import="org.silverpeas.core.web.util.viewgenerator.html.frame.Frame" %>
3232
<%@ page import="org.silverpeas.core.web.util.viewgenerator.html.window.Window" %>
3333
<%@ page import="org.silverpeas.core.web.http.HttpRequest" %>
34+
<%@ page import="org.silverpeas.core.web.token.SynchronizerTokenService" %>
3435
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
3536
<%@ taglib uri="http://www.silverpeas.com/tld/viewGenerator" prefix="view"%>
3637
<%
@@ -74,6 +75,8 @@ response.setDateHeader ("Expires",-1); //prevents caching at the proxy server
7475
7576
"<BODY bgcolor=\"white\" topmargin=\"15\" leftmargin=\"20\" onLoad=\"submit_form('"+rep+"')\">"+
7677
"<form name=\"verification\" action=\"design.jsp\" method=\"POST\">"+
78+
"<input type=\"hidden\" name=\"" + SynchronizerTokenService.SESSION_TOKEN_KEY + "\" value=\""+request.getParameter(SynchronizerTokenService.SESSION_TOKEN_KEY)+"\">"+
79+
"<input type=\"hidden\" name=\"" + SynchronizerTokenService.NAVIGATION_TOKEN_KEY + "\" value=\""+request.getParameter(SynchronizerTokenService.NAVIGATION_TOKEN_KEY)+"\">"+
7780
"<input type=\"hidden\" name=\"Action\" value=\""+action+"\">"+
7881
"<input type=\"hidden\" name=\"Id\" value=\""+id+"\">"+
7982
"<input type=\"hidden\" name=\"Path\" value=\""+currentPath+"\">"+

webSites/webSites-war/src/main/webapp/webSites/jsp/verifAjoutPage.jsp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<%@ page import="org.silverpeas.core.web.util.viewgenerator.html.GraphicElementFactory" %>
33
<%@ page import="org.silverpeas.core.web.util.viewgenerator.html.tabs.TabbedPane" %>
44
<%@ page import="org.silverpeas.core.web.util.viewgenerator.html.window.Window" %>
5-
<%@ page import="org.silverpeas.core.web.http.HttpRequest" %><%--
5+
<%@ page import="org.silverpeas.core.web.http.HttpRequest" %>
6+
<%@ page import="org.silverpeas.core.web.token.SynchronizerTokenService" %><%--
67
78
Copyright (C) 2000 - 2022 Silverpeas
89
@@ -67,6 +68,8 @@ response.setDateHeader ("Expires",-1); //prevents caching at the proxy server
6768
6869
"<BODY bgcolor=\"white\" topmargin=\"15\" leftmargin=\"20\" onLoad=\"submit_form('"+rep+"')\">"+
6970
"<form name=\"verification\" action=\"addPage.jsp\" method=\"POST\">"+
71+
"<input type=\"hidden\" name=\"" + SynchronizerTokenService.SESSION_TOKEN_KEY + "\" value=\""+request.getParameter(SynchronizerTokenService.SESSION_TOKEN_KEY)+"\">"+
72+
"<input type=\"hidden\" name=\"" + SynchronizerTokenService.NAVIGATION_TOKEN_KEY + "\" value=\""+request.getParameter(SynchronizerTokenService.NAVIGATION_TOKEN_KEY)+"\">"+
7073
"<input type=\"hidden\" name=\"Action\" value=\""+action+"\">"+
7174
"<input type=\"hidden\" name=\"Path\" value=\""+currentPath+"\">"+
7275
"<input type=\"hidden\" name=\"nomPage\" value=\""+nomPage+"\">"+

0 commit comments

Comments
 (0)