function get_folder_option($pid = 0, $selID = 0, $lv = 0, $folder_id = 0) { global $db, $tpf, $pd_uid; $q = $db->query("select * from {$tpf}folders where userid='{$pd_uid}' and folder_id<>'{$folder_id}' order by folder_order asc,folder_id desc"); while ($rs = $db->fetch_array($q)) { $data[] = $rs; } $db->free($q); unset($rs); if (count($data)) { $html = ''; foreach ($data as $v) { if ($v['parent_id'] == $pid) { $html .= '<option value="' . $v[folder_id] . '"'; $html .= $selID ? ifselected($selID, $v[folder_id]) : ''; $html .= '>' . str_repeat(' ', $lv * 2) . $v[folder_name] . '</option>' . LF; $lv++; $html .= get_folder_option($v['folder_id'], $selID, $lv, $folder_id); $lv--; } } return $html; } else { return ''; } }
<li><select name="pid" style="width:200px"> <option value="0"><?php echo __('root_folder_default'); ?> </option> <?php if ($action == 'add_folder') { ?> <?php echo get_folder_option(0, $folder_id); ?> <?php } else { ?> <?php echo get_folder_option(0, $fd[parent_id], 0, $folder_id); ?> <?php } ?> </select> </li> <li> </li> <li><input type="submit" class="btn" value="<?php echo __('btn_submit'); ?> " /></li> </form> </div> </div> <script type="text/javascript">
" /> <table align="center" width="100%" cellpadding="4" cellspacing="0" border="0" class="td_line"> <tr> <td colspan="2" class="f14"><?php echo __('plugin_code2'); ?> </td> </tr> <tr> <td width="30%"><?php echo __('store_folder'); ?> :</td> <td><select name="folder_id"> <?php echo get_folder_option(0); ?> </select></td> </tr> <tr> <td><?php echo __('bbs_type'); ?> :</td> <td><select name="plugin_type"> <option value="dx2" <?php echo ifselected('dx2', $plugin_type, 'str'); ?> >DiscuzX v2.0 v2.5</option> <option value="pw87" <?php echo ifselected('pw87', $plugin_type, 'str');
echo __('not_include_extension'); ?> :</li> <li><input type="text" name="file_name" value="<?php echo $file['file_name']; ?> " size="30" maxlength="50" /></li> <li><?php echo __('folder_name'); ?> :</li> <li> <select name="folder_id" id="folder_ids" style="width:100px;" onchange="sel_folder_id();"> <option value=0>- 根目录 -</option> <?php echo get_folder_option(0, $file['folder_id']); ?> </select></li> <?php if ($auth[is_fms]) { ?> <li><?php echo __('file_tag'); ?> [<?php echo __('file_tag_tips'); ?> ](<?php echo __('optional'); ?> ):</li>