I don't know where to start looking and I'm hoping you can point me in the right direction.

I am currently developing a desktop application with various customer data stored in a psql-database. I am now looking for a web based service/application on which I want to:
1. Be able to create personal accounts for my customers
2. Export relevant data from my application database and import to the web application (names, address, phone no and so on)
3. Be able to upload pdf's to my customers accounts, mainly invoices, which they in turn can view/download.
4. Give my customers the ability to update their personal information (which will be imported back to the main database).
5. Have separate databases for security reasons. I'll export some data that will be avalible for the web application.
6. Give my customers the possibility to send me messages.
7. Let the customers schedule appointments with me (not yet but maybe in the future)

The desktop application is beeing developed in pascal/lazarus and the database is currently on a Linux box. I don't mind using scripts and cron jobs on the server to do the actual export/import.

So. Am I looking for a CMS? Which one is customizable enough to let me do what I want? Or do I need to create everything from scratch? Or should I be looking for something completely different...?

Any input appreciated! Thank you!