Clean up orphaned items (fixes #291)

Extends the cleanup function of the items daos to remove any items
whose source field doesn't have a corresponding entry in the sources
table.

The argument is now optional, so if cleanup is called without
arguments, it will only remove orphaned items from the database.
Behaviour of cleanup when called with an argument remains unchanged.
Merge pull request #292 from seanrand/orphaned-items-fix

Clean up orphaned items (fixes #291)