Twisted longitudinal index theorem for foliations