function getTemplateHierarchyFlat($parent, $depth = 1) { global $db; $arr = array(); $kids = $db->selectObjects('section_template', 'parent=' . $parent); if (!defined('SYS_SORTING')) { include_once BASE . 'subsystems/sorting.php'; } usort($kids, 'exponent_sorting_byRankAscending'); for ($i = 0; $i < count($kids); $i++) { $page = $kids[$i]; $page->depth = $depth; $page->first = $i == 0 ? 1 : 0; $page->last = $i == count($kids) - 1 ? 1 : 0; $arr[] = $page; $arr = array_merge($arr, NavigationModule::getTemplateHierarchyFlat($page->id, $depth + 1)); } return $arr; }
# This file is part of Exponent # # Exponent is free software; you can redistribute # it and/or modify it under the terms of the GNU # General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## if (!defined('EXPONENT')) { exit(''); } if ($user && $user->is_acting_admin == 1) { $page = null; if (isset($_GET['id'])) { $page = $db->selectObject('section_template', 'id=' . intval($_GET['id'])); } if ($page) { exponent_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION); $template = new template('NavigationModule', '_view_template', $loc); $template->assign('template', $page); $template->assign('subs', NavigationModule::getTemplateHierarchyFlat($page->id)); $template->output(); } else { echo SITE_404_HTML; } } else { echo SITE_403_HTML; }