function selectkiddies($i = 0, $n = 1, $id = 0) { $arr = array(); $q = dbAll('select name,id,alias from pages where parent="' . $i . '" and id!="' . $id . '" order by ord,name'); if (count($q) < 1) { return $arr; } foreach ($q as $r) { if ($r['id'] != '') { $arr[$r['id']] = str_repeat('» ', $n) . $r['name']; $arr = array_merge($arr, selectkiddies($r['id'], $n + 1, $id)); } } return $arr; }
function selectkiddies($i = 0, $n = 1, $s = 0, $id = 0) { $q = dbAll('select name,id from pages where parent="' . $i . '" and id!="' . $id . '" order by ord,name'); if (count($q) < 1) { return; } foreach ($q as $r) { if ($r['id'] != '') { echo '<option value="' . $r['id'] . '" title="' . htmlspecialchars($r['name']) . '"'; echo $s == $r['id'] ? ' selected="selected">' : '>'; echo str_repeat('» ', $n); $name = $r['name']; if (strlen($name) > 20) { $name = substr($name, 0, 17) . '...'; } echo htmlspecialchars($name) . '</option>'; selectkiddies($r['id'], $n + 1, $s, $id); } } }
case '1': // { redirect echo '<tr><th colspan="2">' . __('What URL would you like to redirect to') . '</th>' . '<td colspan="4"><input name="page_vars[redirect_to]" value="' . htmlspecialchars($page_vars['redirect_to']) . '" class="large"/></td></tr>'; break; // } // } case '4': // { page summaries echo '<tr><th>' . __('pages summarised from') . '</th><td><select name="page_summary_parent">' . '<option value="0">' . __(' -- none -- ') . '</option>'; $r2 = dbRow('select parent_id from page_summaries where page_id="' . $id . '" limit 1'); if (count($r2)) { $page_summary_pageid = $r2['parent_id']; } else { $page_summary_pageid = $id; } $opts = selectkiddies(0, 0, $page_summary_pageid, -1); foreach ($opts as $k => $v) { echo '<option value="' . $k . '"'; if ($k == $page_summary_pageid) { echo ' selected="selected"'; } echo '>' . htmlspecialchars($v) . '</option>'; } echo '</select></td>' . '<td colspan="4">' . __('Where do you want to start summarising your p' . 'ages from? If you want this summary to list excerpts from all the p' . 'ages on your site, then choose "<strong>none</strong>". Otherwise, ' . 'choose the page which <strong>contains</strong> the pages you want ' . 'summarised.') . '</td></tr>'; break; // } // } case '9': // { table of contents echo '<tr><td colspan="6"><div class="tabs">' . '<ul>' . '<li><a href="#table-of-contents-header">' . __('Header') . '</a></li>' . '<li><a href="#table-of-contents-footer">' . __('Footer') . '</a></li>' . '</ul>' . '<div id="table-of-contents-header">' . '<p>' . __('This will appear above the table of contents.') . '</p>' . Page_showBody($page, $page_vars) . '</div>' . '<div id="table-of-contents-footer">' . '<p>' . __('This will appear below the table of contents.') . '</p>'; if (!isset($page_vars['footer'])) {
<?php require_once '../../ww.incs/basics.php'; require_once 'pages.funcs.php'; $selected = isset($_REQUEST['selected']) ? $_REQUEST['selected'] : 0; $id = isset($_REQUEST['other_GET_params']) ? (int) $_REQUEST['other_GET_params'] : -1; echo '<option value="0">-- ' . __('none') . ' --</option>'; selectkiddies(0, 0, $selected, $id);