SQL performance and reduction of database warnings

Mostly this pull request contains things for improving the performance. In the item table there is now a field called "network". This contains the network value from the contact. This means that filtering is working better in the network tab.

Additionally I removed many "limit 1" expressions in the SQL queries. They are superfluous and they generate massive SQL warnings at the database server (and they distract from more important warnings and errors)

A subquery was splitted into two parts at the deletion of items. That reduced the query time from 80 seconds to less than 1 second.

A subquery for the network tab (when showing content from a contact) was changed into a join - which improved performance massively at my machine.