Sanitize tag list and title when adding/editing a source

I was getting slightly annoyed with having to use trim() and strlen() all over the place, so this cleans up the tag list into a nice, trimmed list when inserting or updating a source in the database.

Snippets like these:

    foreach ($tags as $tag) {
        $tag = trim($tag);
         if (strlen($tag) > 0) {
             ...

would become redundant. (Well, except for tags that have been added to the database before this change, until the source is edited again...)