54
54
use Pydio \Core \PluginFramework \Plugin ;
55
55
use Pydio \Core \PluginFramework \PluginsService ;
56
56
use Pydio \Core \Services \ConfService ;
57
+ use Pydio \Core \Utils \Vars \StringHelper ;
57
58
use Zend \Diactoros \Response \JsonResponse ;
58
59
59
60
defined ('AJXP_EXEC ' ) or die ( 'Access not allowed ' );
@@ -1226,19 +1227,20 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
1226
1227
$ crtValue = InputFilter::sanitize ($ crtValue , InputFilter::SANITIZE_HTML_STRICT );
1227
1228
}
1228
1229
if ($ regexp != null && (!count ($ allUsers ) || (!empty ($ crtValue ) && !array_key_exists (strtolower ($ crtValue ), $ allUsers ))) && ConfService::getContextConf ($ ctx , "USER_CREATE_USERS " , "conf " ) && !$ existingOnly ) {
1229
- $ users .= "<li class='complete_user_entry_temp' data-temporary='true' data-label=' $ crtValue' ><span class='user_entry_label'>$ crtValue ( " .$ mess ["448 " ].")</span></li> " ;
1230
+ $ users .= "<li class='complete_user_entry_temp' data-temporary='true' data-label= \"" .StringHelper:: xmlEntities ( $ crtValue). "\" ><span class='user_entry_label'> " .StringHelper:: xmlEntities ( $ crtValue. " ( " .$ mess ["448 " ]) .")</span></li> " ;
1230
1231
} else if ($ existingOnly && !empty ($ crtValue )) {
1231
- $ users .= "<li class='complete_user_entry_temp' data-temporary='true' data-label=' $ crtValue' data-entry_id=' $ crtValue' ><span class='user_entry_label'>$ crtValue</span></li> " ;
1232
+ $ users .= "<li class='complete_user_entry_temp' data-temporary='true' data-label= \"" .StringHelper:: xmlEntities ( $ crtValue). "\" data-entry_id= \"" .StringHelper:: xmlEntities ( $ crtValue). "\" ><span class='user_entry_label'> " .StringHelper:: xmlEntities ( $ crtValue). " </span></li> " ;
1232
1233
}
1233
1234
$ mess = LocaleService::getMessages ();
1234
1235
if (!$ usersOnly && (empty ($ regexp ) || preg_match ($ pregexp , $ mess ["447 " ]))) {
1235
- $ users .= "<li class='complete_group_entry' data-group='AJXP_GRP_/' data-label= \"" .$ mess ["447 " ]."\"><span class='user_entry_label'> " .$ mess ["447 " ]."</span></li> " ;
1236
+ $ users .= "<li class='complete_group_entry' data-group='AJXP_GRP_/' data-label= \"" .StringHelper:: xmlEntities ( $ mess ["447 " ]) ."\"><span class='user_entry_label'> " .StringHelper:: xmlEntities ( $ mess ["447 " ]) ."</span></li> " ;
1236
1237
}
1237
1238
$ indexGroup = 0 ;
1238
1239
if (!$ usersOnly && isset ($ allGroups ) && is_array ($ allGroups )) {
1239
1240
foreach ($ allGroups as $ groupId => $ groupLabel ) {
1240
1241
if ($ regexp == null || preg_match ($ pregexp , $ groupLabel )) {
1241
- $ users .= "<li class='complete_group_entry' data-group=' $ groupId' data-label= \"$ groupLabel \" data-entry_id=' $ groupId'><span class='user_entry_label'> " .$ groupLabel ."</span></li> " ;
1242
+ $ groupLabel = StringHelper::xmlEntities ($ groupLabel );
1243
+ $ users .= "<li class='complete_group_entry' data-group=' $ groupId' data-label= \"" .$ groupLabel ."\" data-entry_id=' $ groupId'><span class='user_entry_label'> " .$ groupLabel ."</span></li> " ;
1242
1244
$ indexGroup ++;
1243
1245
}
1244
1246
if ($ indexGroup == $ limit ) break ;
@@ -1248,7 +1250,8 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
1248
1250
$ teams = $ this ->listUserTeams ($ ctx ->getUser ());
1249
1251
foreach ($ teams as $ tId => $ tData ) {
1250
1252
if ($ regexp == null || preg_match ($ pregexp , $ tData ["LABEL " ])){
1251
- $ users .= "<li class='complete_group_entry' data-group='/AJXP_TEAM/ $ tId' data-label= \"[team] " .$ tData ["LABEL " ]."\"><span class='user_entry_label'>[team] " .$ tData ["LABEL " ]."</span></li> " ;
1253
+ $ teamLabel = StringHelper::xmlEntities ($ tData ["LABEL " ]);
1254
+ $ users .= "<li class='complete_group_entry' data-group='/AJXP_TEAM/ $ tId' data-label= \"[team] " .$ teamLabel ."\"><span class='user_entry_label'>[team] " .$ teamLabel ."</span></li> " ;
1252
1255
}
1253
1256
}
1254
1257
}
@@ -1263,7 +1266,9 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
1263
1266
$ userDisplay = $ userLabel ;
1264
1267
}
1265
1268
$ userIsExternal = $ userObject ->hasParent () ? "true " :"false " ;
1266
- $ users .= "<li class='complete_user_entry' data-external= \"$ userIsExternal \" data-label= \"$ userLabel \" data-avatar=' $ userAvatar' data-entry_id=' $ userId'><span class='user_entry_label'> " .$ userDisplay ."</span></li> " ;
1269
+ $ userLabel = StringHelper::xmlEntities ($ userLabel );
1270
+ $ userDisplay = StringHelper::xmlEntities ($ userDisplay );
1271
+ $ users .= "<li class='complete_user_entry' data-external= \"$ userIsExternal \" data-label= \"" .$ userLabel ."\" data-avatar=' $ userAvatar' data-entry_id=' $ userId'><span class='user_entry_label'> " .$ userDisplay ."</span></li> " ;
1267
1272
$ index ++;
1268
1273
}
1269
1274
if ($ index == $ limit ) break ;
0 commit comments