File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -1169,12 +1169,32 @@ public function importData(Request $request)
1169
1169
1170
1170
// Loop through each link in $userData and create a new link for the user
1171
1171
foreach ($ userData ['links ' ] as $ linkData ) {
1172
+
1173
+ $ validatedData = Validator::make ($ linkData , [
1174
+ 'link ' => 'nullable|url ' ,
1175
+ ]);
1176
+
1177
+ if ($ validatedData ->fails ()) {
1178
+ throw new \Exception ('Invalid link ' );
1179
+ }
1180
+
1172
1181
$ newLink = new Link ();
1173
1182
1174
1183
// Copy over the link data from $linkData to $newLink
1175
1184
$ newLink ->button_id = $ linkData ['button_id ' ];
1176
1185
$ newLink ->link = $ linkData ['link ' ];
1177
- $ newLink ->title = $ linkData ['title ' ];
1186
+
1187
+ // Sanitize the title
1188
+ if ($ linkData ['button_id ' ] == 93 ) {
1189
+ $ sanitizedText = strip_tags ($ linkData ['title ' ], '<a><p><strong><i><ul><ol><li><blockquote><h2><h3><h4> ' );
1190
+ $ sanitizedText = preg_replace ("/<a([^>]*)>/i " , "<a $1 rel= \"noopener noreferrer nofollow \"> " , $ sanitizedText );
1191
+ $ sanitizedText = strip_tags_except_allowed_protocols ($ sanitizedText );
1192
+
1193
+ $ newLink ->title = $ sanitizedText ;
1194
+ } else {
1195
+ $ newLink ->title = $ linkData ['title ' ];
1196
+ }
1197
+
1178
1198
$ newLink ->order = $ linkData ['order ' ];
1179
1199
$ newLink ->click_number = 0 ;
1180
1200
$ newLink ->up_link = $ linkData ['up_link ' ];
You can’t perform that action at this time.
0 commit comments