Locking the Z axis of a quaternion camera rotation

You can also use one of my previous solutions if spherical coordinates suits your fancy