Or adapt the foreach method introduced in ZC 1.5.5:
$results = $db->Execute($sql);
foreach ($results as $result)
{
if (!(defined($result['pageName']) && defined($result['main_page']))) continue;
$retVal[$result['menu_key']][$result['page_key']] = array('name' => constant($result['pageName']),
'file' => constant($result['main_page']),
'params' => $result['page_params']);
}
Otherwise for readability/historical versions would suggest something similar placed after the start of the while and before the assignment:
if (!(defined($result->fields['pageName']) && defined($result->fields['main_page']))) {
$result->MoveNext();
continue;
}
Regarding the modification to the check_page function, would suggest adding a parameter to the list defaulted to skip that additional test as the test/return modifies the type of information that the function returns. Currently it returns if the specific user has been specifically added to access the page requiring a further determination of whether the page should be shown to say super users or not (envision a "window" that is displayed only to non-super users or to specific super users.) Further it almost seems as if the assignment of the super user admin profile should enable all pages against that user as well as during the install/assignment of new such page(s) which is a different issue. In short, the function as currently written returns the condition of the specific user being granted permission rather than the possible "bigger picture" of granting all super users permission regardless of whether one should or should not be granted. It is as if almost that a denial group should be considered for addition like is used in other permission based systems (authorized user/group as well as denied user/group).