Better setting of URL for new posts. Use correct template too.

Only replace multiple whitespace characters with single space.

Removed dupliate 'restore database' case in action switch
Use :url instead of :title when binding and urlencode $path[1] for url
Escape $connect->password before exec() in dump()

Otherwise, special characters were causing it to fail.