function buildtree($src_arr, $parent_id = 0, $tree = array()) { foreach ($src_arr as $idx => $row) { if ($row['parent_id'] == $parent_id) { foreach ($row as $k => $v) { $tree[$row['menuid']][$k] = $v; } unset($src_arr[$idx]); $tree[$row['menuid']]['children'] = buildtree($src_arr, $row['menuid']); } } ksort($tree); return $tree; }
ini_set('html_errors', 0); ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); } include_once 'ressources/class.templates.inc'; include_once 'ressources/class.ldap.inc'; include_once 'ressources/class.users.menus.inc'; include_once 'ressources/class.mysql.inc'; include_once 'ressources/class.active.directory.inc'; include_once "ressources/class.harddrive.inc"; if (isset($_GET["popup"])) { popup(); exit; } if (isset($_GET["buildtree"])) { buildtree(); exit; } if (isset($_GET["browser-infos"])) { brower_infos(); exit; } if (isset($_POST["create-folder"])) { folder_create(); exit; } if (isset($_POST["delete-folder"])) { folder_delete(); exit; } if (isset($_GET["browse-ou"])) {
/** * Build a navigation tree for threaded display. * * @param unknown_type $replyto * @param unknown_type $indent * @return unknown */ function buildtree($replyto = "0", $indent = "0") { global $tree, $mybb, $theme, $mybb, $pid, $tid, $templates, $parser; if ($indent) { $indentsize = 13 * $indent; } else { $indentsize = 0; } ++$indent; if (is_array($tree[$replyto])) { foreach ($tree[$replyto] as $key => $post) { $postdate = my_date($mybb->settings['dateformat'], $post['dateline']); $posttime = my_date($mybb->settings['timeformat'], $post['dateline']); $post['subject'] = htmlspecialchars_uni($parser->parse_badwords($post['subject'])); if (!$post['subject']) { $post['subject'] = "[" . $lang->no_subject . "]"; } $post['profilelink'] = build_profile_link($post['username'], $post['uid']); if ($mybb->input['pid'] == $post['pid']) { eval("\$posts .= \"" . $templates->get("showthread_threaded_bitactive") . "\";"); } else { eval("\$posts .= \"" . $templates->get("showthread_threaded_bit") . "\";"); } if ($tree[$post['pid']]) { $posts .= buildtree($post['pid'], $indent); } } --$indent; } return $posts; }