The UN General Assembly has overwhelmingly voted in favour of a motion allowing the Palestinian flag to be flown in front of UN buildings.