Make external shares work with imported self signed certificates

This moves the logic for managing trusted certificates from files_external to core, note that the certs are still stored in the files_external folder for backwards compatibilty, this is transparent for any app using the api.

To test:
- try adding a remote share from a server with a self-signed certificate, this should fail
- import the self-signed cert trough settings->personal
- try adding the remote share again, now it should work

Next step is making a nice gui for trusting the certificate when trying to add an external share from an untrusted cert

cc @schiesbn @PVince81 @simsasaile
Also that function might in future be called in another way in which this would affect all PHP versions.