Small fixes: attachment page & get_category_parents() 

- Now the attachment page shouldn't print errors anymore
- The ```rtrim()``` function need to be replaced with ```substr()``` or
something like ```preg_replace(\' . preg_quote( $after . $delimiter .
$before, '/' ) . '\z\', '', $parents);``` (I recommend the one in my
commit, because the ```preg_quote()``` function don't escape everything
per default.
The reason why we should replace the current solution is, that
```rtrim()``` removes the last string more than once time. For example:
```rtrim('>>>1>>>', '>')``` outputs the following: ```>>>1```. This can
result into conflicts, if you're using a tag (for example:
```<li></li>```) as ```$before``` and ```$after```. So the ```rtrim()```
also removes the ```>``` from the ```</a>``` tag of the ```$parents```
variable. This results in html structure problems.