It appears to work.
On the last line of the code you posted, I had && $CatPerms['ugvote'][$dbcat] == 0 before && $ratingtype != 1. Not sure if that's a problem or not? Maybe I just have a different version that you? (5.2) Should I leave it in there?