function maketree($arrs, $keyparam, $outparam) { if (isset($arrs) && is_array($arrs)) { foreach ($arrs as $arr) { echo '<li>'; echo '<a '; if (isset($outparam) && is_array($outparam)) { echo 'ondblclick=\'javascript:$.bringBack({'; for ($i = 0; $i < count($outparam); $i++) { if ($i > 0) { echo ','; } echo $outparam[$i] . ':"' . $arr[$outparam[$i]] . '"'; } echo '})\' title="双击选中" '; } echo '>'; if (isset($keyparam) && is_array($keyparam)) { for ($i = 0; $i < count($keyparam); $i++) { if ($i > 0) { echo '-'; } echo $arr[$keyparam[$i]]; } } echo '</a>'; if (isset($arr['child'])) { echo '<ul>'; maketree($arr['child'], $keyparam, $outparam); echo '</ul>'; } echo '</li>'; } } }
function maketree($level, $curval) { global $forums; foreach ($forums as $id => $f) { if ($f['done']) { continue; } $parent = $f['parent']; if ($parent == $level) { $forums[$id]['l'] = $curval++; foreach ($forums as $cf) { if ($cf['parent'] == $id) { $curval = maketree($id, $curval); break; } } $forums[$id]['r'] = $curval++; $forums[$id]['done'] = true; } } return $curval; }
$sql = "SELECT * FROM " . $NPDS_Prefix . "posts WHERE topic_id='{$topic}' AND forum_id='{$forum}'" . $post_aff . "ORDER BY post_id"; } else { $sql = "SELECT * FROM " . $NPDS_Prefix . "posts WHERE topic_id='{$topic}' AND forum_id='{$forum}'" . $post_aff . "ORDER BY post_id"; } if ($allow_upload_forum) { $visibility = ''; if (!$Mmod) { $visibility = " AND visible = 1"; } $sql2 = "SELECT att_id FROM {$upload_table} WHERE apli='forum_npds' && topic_id = '{$topic}' {$visible}"; $att = sql_num_rows(sql_query($sql2)); if ($att > 0) { include "modules/upload/include_forum/upload.func.forum.php"; } } echo maketree(0, $sql, 0); // if (isset($ancre)) { // echo "<script type=\"text/javascript\"> // //<![CDATA[ // toggleall$toggle->id('block'); // //]]> // </script>"; // } $sql = "UPDATE " . $NPDS_Prefix . "forumtopics SET topic_views = topic_views + 1 WHERE topic_id = '{$topic}'"; sql_query($sql); echo '<br />'; if ($forum_access != 9) { // un anonyme ne peut pas mettre un topic en resolu if (!isset($userdata)) { $userdata[0] = 0; }
$bx = new box("95%", $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_body_font_color, $th_box_body_align); $be = new box("", $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_error_font_color, $th_box_body_align); ?> <!-- content --> <table border=0 align=center cellspacing=0 cellpadding=0 width=100%> <tr><td width=40% valign=top> <?php $bx->box_begin(); $bx->box_title($t->translate("Categories")); $bx->box_body_begin(); $pn[1] = 1; if (!$mode) { $mode = 1; } maketree(0, $pn, 0, $mode, $aid, $add_string); $bx->box_body_end(); $bx->box_end(); ?> </td> </tr> </table> <!-- end content --> <?php require "footer.inc"; @page_close(); ?>