cleaner way of building $allowed_extensions array

also modified javascript regexp pattern output; removed leading slash, trailing slash, and case-insensitivity flag (because the javascript that makes use of this string breaks if you do it this way)
now properly matches first and last extensions
added svg extension

this is what triggered the re-write of the regex code in the first place. the original code (in controllers/admin.php) generated a regex similar to '/abc|def|ghi/i' which attempts to match the extensions '/abc', 'def', 'ghi/' because it's passed to a RegExp(..) object
for consistency
removed erroneous line

should have removed it in the last commit to this file
force extension checking to match end of filename
Merge pull request #2640 from mattpotts/patch-2

improved regex file extension matching on the client