Don't assume HTTPS when generating file permalinks in the ajax-mode popup window

When a user is viewing a collection (e.g. `/folders/1`) and clicks on the "Share" icon for a specific file, the generated permalinks have a hard-coded `https://` protocol.  If OpenDAM is being served over HTTP instead, these links will not work.

This pull request fixes the bug by checking `$_SERVER['HTTPS']` and using HTTP or HTTPS based on that value.

This is still not an ideal solution: a better solution would also check to see what port the server is listening on, so that the links would be valid in all circumstances.  That adds a lot of extra complexity for an unusual case, so I didn't bother to implement it.

Note: the permalinks provided to a user from within a file view (e.g. `/files/54820/show?folder_id=1`) do NOT have this problem.  I wanted to fix this bug by just calling the same method that is called from the file view, I can't figure out how to do that.  So there is probably a better solution than my patch.