pyrocms/pyrocms — pull request #2302 by Solinx (2013-01-26 22:31:50+00:00)
Title: Fix: Default page type when adding a new page

Currently the page creation page fails to load if no page type is specified.

This is an issue because users can get redirected to the creation page without such a page type being specified.

One occasion where this happens is when they try to edit a page that does not exist (line 350):

// Got page?
if ( ! $page or empty($page))
{
// Maybe you would like to create one?
$this->session->set_flashdata('error', lang('pages:page_not_found_error'));
redirect('admin/pages/create');
}

The proposed fix in case of missing page_type input simply selects the first row from the page_type table - avoiding the assumption that no one will delete the default page_type.