Yes, but occupying from who?
Those territories belonged to Jordan and Egypt not to a palestinian state. And both of those countries refused to take the west bank and gaza back...
But the UN are sort of a joke in the middle east. Look how well they are doing in egypt and syria right now.
The UN was between Lebanon and Israel before the second lebanon war. It was their job to stop it. Not only they didn't do a damn thing, but they ran away before the first shot was fired. They were worse than useless. The IDF had to go into lebanon and escort the UN forces out. Not only the UN weren't doing their job , but they couldn't even take care of themselves, they needed to be babysitted by the IDF.
The UN is perceived here as a western reality drama used for PR purposes only. Nobody actually gives a damn about what they write, because they never enforce it. They run away at the first sign of actual trouble.
BTW if it wasn't clear so far i am from Israel. Maybe i should do an AmA
To some of the other here:
Israelis building inside the west bank a.k.a. settlements are disputed within israel itself as well. Eventually they will get torn down and evacuated just like arik sharon did in gaza, it's just a matter of time. For now they are used to get better peace treaty terms, not really nice, but t works.