A deal is salvaged at the UN summit as poorer nations are promised record funding for climate action.