Update for current Siena

As page add/edit was moved to functions, it needs an update. And PHP 5.4 doesn't like the end() function.