The Polish senate has approved a bill giving politicians substantial influence over the Supreme Court.