r1898 + implement tag tree editor
[racktables] / inc / navigation.php
1 <?php
2 /*
3 *
4 * This file implements generic navigation for RackTables.
5 *
6 */
7
8 $page = array();
9 $tab = array();
10 $trigger = array();
11 $ophandler = array();
12 $tabhandler = array();
13
14 $page['index']['title'] = 'Main page';
15 $page['index']['handler'] = 'renderIndex';
16
17 $page['rackspace']['title'] = 'Rackspace';
18 $page['rackspace']['parent'] = 'index';
19 $tab['rackspace']['default'] = 'Browse';
20 $tab['rackspace']['history'] = 'History';
21 $tab['rackspace']['firstrow'] = 'Click me!';
22 $trigger['rackspace']['firstrow'] = 'trigger_emptyRackspace';
23 $tabhandler['rackspace']['default'] = 'renderRackspace';
24 $tabhandler['rackspace']['history'] = 'renderRackspaceHistory';
25 $tabhandler['rackspace']['firstrow'] = 'renderFirstRowForm';
26 $tabextraclass['rackspace']['firstrow'] = 'attn';
27
28 $page['objects']['title'] = 'Objects';
29 $page['objects']['parent'] = 'index';
30 $tab['objects']['default'] = 'View';
31 $tab['objects']['newobj'] = 'Add an object';
32 $tab['objects']['newmulti'] = 'Add multiple objects';
33 $tabhandler['objects']['default'] = 'renderObjectSpace';
34 $tabhandler['objects']['newobj'] = 'renderNewObjectForm';
35 $tabhandler['objects']['newmulti'] = 'renderAddMultipleObjectsForm';
36
37 $page['row']['title_handler'] = 'dynamic_title_row';
38 $page['row']['bypass'] = 'row_id';
39 $page['row']['bypass_type'] = 'uint';
40 $page['row']['parent'] = 'rackspace';
41 $tab['row']['default'] = 'View';
42 $tab['row']['newrack'] = 'Add new rack';
43 $tab['row']['tagroller'] = 'Tag roller';
44 $tabhandler['row']['default'] = 'renderRow';
45 $tabhandler['row']['newrack'] = 'renderNewRackForm';
46 $tabhandler['row']['tagroller'] = 'renderTagRollerForRow';
47
48 $page['rack']['title_handler'] = 'dynamic_title_rack';
49 $page['rack']['bypass'] = 'rack_id';
50 $page['rack']['bypass_type'] = 'uint';
51 $page['rack']['parent'] = 'row';
52 $page['rack']['tagloader'] = 'loadRackTags';
53 $page['rack']['autotagloader'] = 'loadRackAutoTags';
54 $tab['rack']['default'] = 'View';
55 $tab['rack']['edit'] = 'Properties';
56 $tab['rack']['design'] = 'Design';
57 $tab['rack']['problems'] = 'Problems';
58 $tab['rack']['tags'] = 'Tags';
59 $tabhandler['rack']['default'] = 'renderRackPage';
60 $tabhandler['rack']['edit'] = 'renderEditRackForm';
61 $tabhandler['rack']['design'] = 'renderRackDesign';
62 $tabhandler['rack']['problems'] = 'renderRackProblems';
63 $tabhandler['rack']['tags'] = 'renderRackTags';
64 $trigger['rack']['tags'] = 'trigger_tags';
65 $ophandler['rack']['tags']['save'] = 'saveRackTags';
66
67 $page['objgroup']['title_handler'] = 'dynamic_title_objgroup';
68 $page['objgroup']['handler'] = 'renderObjectGroup';
69 $page['objgroup']['bypass'] = 'group_id';
70 $page['objgroup']['bypass_type'] = 'uint0';
71 $page['objgroup']['parent'] = 'objects';
72
73 $page['object']['title_handler'] = 'dynamic_title_object';
74 $page['object']['bypass'] = 'object_id';
75 $page['object']['bypass_type'] = 'uint';
76 $page['object']['parent'] = 'objgroup';
77 $page['object']['tagloader'] = 'loadRackObjectTags';
78 $page['object']['autotagloader'] = 'loadRackObjectAutoTags';
79 $tab['object']['default'] = 'View';
80 $tab['object']['edit'] = 'Properties';
81 $tab['object']['rackspace'] = 'Rackspace';
82 $tab['object']['ports'] = 'Ports';
83 $tab['object']['network'] = 'IPv4';
84 $tab['object']['portfwrd'] = 'NATv4';
85 $tab['object']['switchvlans'] = 'Live VLANs';
86 $tab['object']['snmpportfinder'] = 'SNMP port finder';
87 $tab['object']['slb'] = '[SLB]';
88 $tab['object']['lvsconfig'] = 'LVS configuration';
89 $tab['object']['autoports'] = 'AutoPorts';
90 $tab['object']['tags'] = 'Tags';
91 $tabhandler['object']['default'] = 'renderRackObject';
92 $tabhandler['object']['edit'] = 'renderEditObjectForm';
93 $tabhandler['object']['rackspace'] = 'renderRackSpaceForObject';
94 $tabhandler['object']['ports'] = 'renderPortsForObject';
95 $tabhandler['object']['network'] = 'renderNetworkForObject';
96 $tabhandler['object']['portfwrd'] = 'renderNATv4ForObject';
97 $tabhandler['object']['switchvlans'] = 'renderVLANMembership';
98 $tabhandler['object']['snmpportfinder'] = 'renderSNMPPortFinder';
99 $tabhandler['object']['lvsconfig'] = 'renderLVSConfig';
100 $tabhandler['object']['autoports'] = 'renderAutoPortsForm';
101 $tabhandler['object']['tags'] = 'renderObjectTags';
102 $tabextraclass['object']['snmpportfinder'] = 'attn';
103 $tabextraclass['object']['autoports'] = 'attn';
104 $trigger['object']['network'] = 'trigger_ipv4';
105 $trigger['object']['portfwrd'] = 'trigger_natv4';
106 $trigger['object']['switchvlans'] = 'trigger_switchvlans';
107 $trigger['object']['snmpportfinder'] = 'trigger_snmpportfinder';
108 $trigger['object']['slb'] = 'trigger_natv4';
109 $trigger['object']['lvsconfig'] = 'trigger_lvsconfig';
110 $trigger['object']['autoports'] = 'trigger_autoports';
111 $trigger['object']['tags'] = 'trigger_tags';
112 $ophandler['object']['ports']['addPort'] = 'addPortForObject';
113 $ophandler['object']['ports']['delPort'] = 'delPortFromObject';
114 $ophandler['object']['ports']['editPort'] = 'editPortForObject';
115 $ophandler['object']['ports']['linkPort'] = 'linkPortForObject';
116 $ophandler['object']['ports']['unlinkPort'] = 'unlinkPortForObject';
117 $ophandler['object']['ports']['addMultiPorts'] = 'addMultiPorts';
118 $ophandler['object']['ports']['useup'] = 'useupPort';
119 $ophandler['object']['network']['editAddressFromObject'] = 'editAddressFromObject';
120 $ophandler['object']['network']['addAddrFObj'] = 'addAddressToObject';
121 $ophandler['object']['network']['delAddrFObj'] = 'delAddressFromObject';
122 $ophandler['object']['edit']['del'] = 'resetAttrValue';
123 $ophandler['object']['edit']['upd'] = 'updateAttrValues';
124 $ophandler['object']['portfwrd']['forwardPorts'] = 'addPortForwarding';
125 $ophandler['object']['portfwrd']['delPortForwarding'] = 'delPortForwarding';
126 $ophandler['object']['portfwrd']['updPortForwarding'] = 'updPortForwarding';
127 $ophandler['object']['autoports']['generate'] = 'generateAutoPorts';
128 $ophandler['object']['tags']['save'] = 'saveObjectTags';
129
130 $page['ipv4space']['title'] = 'IPv4 space';
131 $page['ipv4space']['parent'] = 'index';
132 $tab['ipv4space']['default'] = 'Browse';
133 $tab['ipv4space']['newrange'] = 'Manage';
134 $tabhandler['ipv4space']['default'] = 'renderAddressspace';
135 $tabhandler['ipv4space']['newrange'] = 'renderAddNewRange';
136 $ophandler['ipv4space']['newrange']['addRange'] = 'addNewrange';
137 $ophandler['ipv4space']['newrange']['delRange'] = 'delRange';
138
139 $page['iprange']['title_handler'] = 'dynamic_title_iprange';
140 $page['iprange']['parent'] = 'ipv4space';
141 $page['iprange']['bypass'] = 'id';
142 $page['iprange']['bypass_type'] = 'uint';
143 $page['iprange']['autotagloader'] = 'loadIPv4PrefixAutoTags';
144 $page['iprange']['tagloader'] = 'loadIPv4PrefixTags';
145 $tab['iprange']['default'] = 'Browse';
146 $tab['iprange']['properties'] = 'Properties';
147 $tab['iprange']['liveptr'] = 'Live PTR';
148 $tab['iprange']['tags'] = 'Tags';
149 $tabhandler['iprange']['default'] = 'renderIPRange';
150 $tabhandler['iprange']['properties'] = 'renderIPRangeProperties';
151 $tabhandler['iprange']['liveptr'] = 'renderLivePTR';
152 $tabhandler['iprange']['tags'] = 'renderIPv4PrefixTags';
153 $trigger['iprange']['tags'] = 'trigger_tags';
154 $ophandler['iprange']['properties']['editRange'] = 'editRange';
155 $ophandler['iprange']['liveptr']['import'] = 'importPTRData';
156 $ophandler['iprange']['tags']['save'] = 'saveIPv4PrefixTags';
157
158 $page['ipaddress']['title_handler'] = 'dynamic_title_ipaddress';
159 $page['ipaddress']['parent'] = 'iprange';
160 $page['ipaddress']['bypass'] = 'ip';
161 $page['ipaddress']['autotagloader'] = 'loadIPv4AddressAutoTags';
162 $tab['ipaddress']['default'] = 'Browse';
163 $tab['ipaddress']['properties'] = 'Properties';
164 $tab['ipaddress']['assignment'] = 'Allocation';
165 $tab['ipaddress']['editrslist'] = '[SLB real servers]';
166 $tabhandler['ipaddress']['default'] = 'renderIPAddress';
167 $tabhandler['ipaddress']['properties'] = 'renderIPAddressProperties';
168 $tabhandler['ipaddress']['assignment'] = 'renderIPAddressAssignment';
169 $ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
170 $ophandler['ipaddress']['assignment']['delIpAssignment'] = 'delIpAssignment';
171 $ophandler['ipaddress']['assignment']['editBondForAddress'] = 'editIpAssignment';
172 $ophandler['ipaddress']['assignment']['bindObjectToIp'] = 'addIpAssignment';
173
174 $page['ipv4slb']['title'] = 'IPv4 SLB';
175 $page['ipv4slb']['parent'] = 'index';
176 $page['ipv4slb']['handler'] = 'renderIPv4SLB';
177
178 $page['vservices']['title'] = 'Virtual services';
179 $page['vservices']['parent'] = 'ipv4slb';
180 $tab['vservices']['default'] = 'View';
181 $tab['vservices']['edit'] = 'Edit';
182 $tabhandler['vservices']['default'] = 'renderVSList';
183 $tabhandler['vservices']['edit'] = 'renderVSListEditForm';
184 $ophandler['vservices']['edit']['add'] = 'addVService';
185 $ophandler['vservices']['edit']['del'] = 'deleteVService';
186 $ophandler['vservices']['edit']['upd'] = 'updateVService';
187
188 $page['vservice']['title_handler'] = 'dynamic_title_vservice';
189 $page['vservice']['parent'] = 'vservices';
190 $page['vservice']['bypass'] = 'id';
191 $page['vservice']['bypass_type'] = 'uint';
192 $page['vservice']['tagloader'] = 'loadIPv4VSTags';
193 $page['vservice']['autotagloader'] = 'loadIPv4VSAutoTags';
194 $tab['vservice']['default'] = 'View';
195 $tab['vservice']['edit'] = '[Edit]';
196 $tab['vservice']['editlblist'] = '[Load balancers]';
197 $tab['vservice']['tags'] = 'Tags';
198 $tabhandler['vservice']['default'] = 'renderVirtualService';
199 $tabhandler['vservice']['tags'] = 'renderIPv4VSTags';
200 $ophandler['vservice']['tags']['save'] = 'saveIPv4VSTags';
201 $trigger['vservice']['tags'] = 'trigger_tags';
202
203 $page['rspools']['title'] = 'RS pools';
204 $page['rspools']['parent'] = 'ipv4slb';
205 $tab['rspools']['default'] = 'View';
206 $tab['rspools']['edit'] = 'Edit';
207 $tabhandler['rspools']['default'] = 'renderRSPoolList';
208 $tabhandler['rspools']['edit'] = 'editRSPools';
209 $ophandler['rspools']['edit']['add'] = 'addRSPool';
210 $ophandler['rspools']['edit']['del'] = 'deleteRSPool';
211 $ophandler['rspools']['edit']['upd'] = 'updateRSPool';
212
213 $page['rspool']['title_handler'] = 'dynamic_title_rspool';
214 $page['rspool']['parent'] = 'rspools';
215 $page['rspool']['bypass'] = 'pool_id';
216 $page['rspool']['bypass_type'] = 'uint';
217 $page['rspool']['tagloader'] = 'loadIPv4RSPoolTags';
218 $page['rspool']['autotagloader'] = 'loadIPv4RSPoolAutoTags';
219 $tab['rspool']['default'] = 'View';
220 $tab['rspool']['edit'] = '[Edit]';
221 $tab['rspool']['editlblist'] = 'Load Balancers';
222 $tab['rspool']['editrslist'] = 'RS list';
223 $tab['rspool']['rsinservice'] = 'RS in service';
224 $tab['rspool']['tags'] = 'Tags';
225 $trigger['rspool']['rsinservice'] = 'trigger_poolrscount';
226 $trigger['rspool']['tags'] = 'trigger_tags';
227 $tabhandler['rspool']['default'] = 'renderRSPool';
228 $tabhandler['rspool']['editrslist'] = 'renderRSPoolServerForm';
229 $tabhandler['rspool']['editlblist'] = 'renderRSPoolLBForm';
230 $tabhandler['rspool']['rsinservice'] = 'renderRSPoolRSInServiceForm';
231 $tabhandler['rspool']['tags'] = 'renderIPv4RSPoolTags';
232 $ophandler['rspool']['editrslist']['addRS'] = 'addRealServer';
233 $ophandler['rspool']['editrslist']['delRS'] = 'deleteRealServer';
234 $ophandler['rspool']['editrslist']['updRS'] = 'updateRealServer';
235 $ophandler['rspool']['editrslist']['addMany'] = 'addRealServers';
236 $ophandler['rspool']['editlblist']['addLB'] = 'addLoadBalancer';
237 $ophandler['rspool']['editlblist']['delLB'] = 'deleteLoadBalancer';
238 $ophandler['rspool']['editlblist']['updLB'] = 'updateLoadBalancer';
239 $ophandler['rspool']['rsinservice']['upd'] = 'updateRSInService';
240 $ophandler['rspool']['tags']['save'] = 'saveIPv4RSPoolTags';
241
242 $page['rservers']['title'] = 'Real servers';
243 $page['rservers']['parent'] = 'ipv4slb';
244 $page['rservers']['handler'] = 'renderRealServerList';
245
246 $page['lbs']['title'] = 'Load balancers';
247 $page['lbs']['parent'] = 'ipv4slb';
248 $page['lbs']['handler'] = 'renderLBList';
249
250 $page['search']['title_handler'] = 'dynamic_title_search';
251 $page['search']['handler'] = 'renderSearchResults';
252 $page['search']['parent'] = 'index';
253 $page['search']['bypass'] = 'q';
254
255 $page['config']['title'] = 'Configuration';
256 $page['config']['handler'] = 'renderConfigMainpage';
257 $page['config']['parent'] = 'index';
258
259 $page['accounts']['title'] = 'Accounts';
260 $page['accounts']['parent'] = 'config';
261 $tab['accounts']['default'] = 'View';
262 $tab['accounts']['edit'] = 'Change';
263 $tabhandler['accounts']['default'] = 'renderAccounts';
264 $tabhandler['accounts']['edit'] = 'renderAccountsEditForm';
265 $ophandler['accounts']['edit']['updateAccount'] = 'updateUserAccount';
266 $ophandler['accounts']['edit']['createAccount'] = 'createUserAccount';
267 $ophandler['accounts']['edit']['disableAccount'] = 'disableUserAccount';
268 $ophandler['accounts']['edit']['enableAccount'] = 'enableUserAccount';
269
270 $page['perms']['title'] = 'Permissions';
271 $page['perms']['parent'] = 'config';
272 $tab['perms']['default'] = 'View';
273 $tab['perms']['edit'] = 'Change';
274 $tabhandler['perms']['default'] = 'renderPermissions';
275 $tabhandler['perms']['edit'] = 'renderPermissionsEditForm';
276 $ophandler['perms']['edit']['revoke'] = 'revokePermission';
277 $ophandler['perms']['edit']['grant'] = 'grantPermission';
278
279 $page['portmap']['title'] = 'Port compatibility map';
280 $page['portmap']['parent'] = 'config';
281 $tab['portmap']['default'] = 'View';
282 $tab['portmap']['edit'] = 'Change';
283 $tabhandler['portmap']['default'] = 'renderPortMapViewer';
284 $tabhandler['portmap']['edit'] = 'renderPortMapEditor';
285 $ophandler['portmap']['edit']['save'] = 'savePortMap';
286
287 $page['attrs']['title'] = 'Attributes';
288 $page['attrs']['parent'] = 'config';
289 $tab['attrs']['default'] = 'View';
290 $tab['attrs']['editattrs'] = 'Edit attributes';
291 $tab['attrs']['editmap'] = 'Edit map';
292 $tabhandler['attrs']['default'] = 'renderAttributes';
293 $tabhandler['attrs']['editattrs'] = 'renderEditAttributesForm';
294 $tabhandler['attrs']['editmap'] = 'renderEditAttrMapForm';
295 $ophandler['attrs']['editattrs']['add'] = 'createAttribute';
296 $ophandler['attrs']['editattrs']['upd'] = 'changeAttribute';
297 $ophandler['attrs']['editattrs']['del'] = 'deleteAttribute';
298 $ophandler['attrs']['editmap']['add'] = 'supplementAttrMap';
299 $ophandler['attrs']['editmap']['del'] = 'reduceAttrMap';
300
301 $page['dict']['title'] = 'Dictionary';
302 $page['dict']['parent'] = 'config';
303 $tab['dict']['default'] = 'View';
304 $tab['dict']['edit'] = 'Edit words';
305 $tab['dict']['chapters'] = 'Manage chapters';
306 $tabhandler['dict']['default'] = 'renderDictionary';
307 $tabhandler['dict']['edit'] = 'renderDictionaryEditor';
308 $tabhandler['dict']['chapters'] = 'renderChaptersEditor';
309 $ophandler['dict']['edit']['del'] = 'reduceDictionary';
310 $ophandler['dict']['edit']['upd'] = 'updateDictionary';
311 $ophandler['dict']['edit']['add'] = 'supplementDictionary';
312 $ophandler['dict']['chapters']['del'] = 'delChapter';
313 $ophandler['dict']['chapters']['upd'] = 'updateChapter';
314 $ophandler['dict']['chapters']['add'] = 'addChapter';
315
316 $page['ui']['title'] = 'User interface';
317 $page['ui']['parent'] = 'config';
318 $tab['ui']['default'] = 'View';
319 $tab['ui']['edit'] = 'Change';
320 $tab['ui']['reset'] = 'Reset';
321 $tabhandler['ui']['default'] = 'renderUIConfig';
322 $tabhandler['ui']['edit'] = 'renderUIConfigEditForm';
323 $tabhandler['ui']['reset'] = 'renderUIResetForm';
324 $ophandler['ui']['edit']['upd'] = 'updateUI';
325 $ophandler['ui']['reset']['go'] = 'resetUIConfig';
326
327 $page['tagtree']['title'] = 'Tag tree';
328 $page['tagtree']['parent'] = 'config';
329 $tab['tagtree']['default'] = 'View';
330 $tab['tagtree']['edit'] = 'Edit';
331 $tabhandler['tagtree']['default'] = 'renderTagTree';
332 $tabhandler['tagtree']['edit'] = 'renderTagTreeEditor';
333 $ophandler['tagtree']['edit']['destroyTag'] = 'destroyTag';
334 $ophandler['tagtree']['edit']['createTag'] = 'createTag';
335 $ophandler['tagtree']['edit']['updateTag'] = 'updateTag';
336
337 $page['reports']['title'] = 'Reports';
338 $page['reports']['parent'] = 'index';
339 $page['reports']['handler'] = 'renderReportSummary';
340
341 // This function returns array if page numbers leading to the target page
342 // plus page number of target page itself. The first element is the target
343 // page number and the last element is the index page number.
344 function getPath ($targetno)
345 {
346 global $page;
347 $path = array();
348 // Recursion breaks at first parentless page.
349 if (!isset ($page[$targetno]['parent']))
350 $path = array ($targetno);
351 else
352 {
353 $path = getPath ($page[$targetno]['parent']);
354 $path[] = $targetno;
355 }
356 return $path;
357 }
358
359 function showPathAndSearch ($pageno)
360 {
361 global $root, $page;
362 // Path.
363 echo "<td class=activemenuitem width='99%'>" . getConfigVar ('enterprise');
364 $path = getPath ($pageno);
365 foreach ($path as $no)
366 {
367 $title['params'] = array();
368 if (isset ($page[$no]['title']))
369 $title['name'] = $page[$no]['title'];
370 elseif (isset ($page[$no]['title_handler']))
371 $title = $page[$no]['title_handler']($no);
372 else
373 $title['name'] = '[N/A]';
374 echo ": <a href='${root}?page=${no}";
375 foreach ($title['params'] as $param_name => $param_value)
376 echo "&${param_name}=${param_value}";
377 echo "'>" . $title['name'] . "</a>";
378 }
379 echo "</td>";
380 // Search form.
381 echo "<td><table border=0 cellpadding=0 cellspacing=0><tr><td>Search:</td>";
382 echo "<form name=search method=get action='${root}'><td>";
383 echo '<input type=hidden name=page value=search>';
384 // This input will be the first, if we don't add ports or addresses.
385 echo "<input type=text name=q size=20 tabindex=1000></td></form></tr></table></td>";
386 }
387
388 function getTitle ($pageno, $tabno)
389 {
390 global $page;
391 if (isset ($page[$pageno]['title']))
392 return $page[$pageno]['title'];
393 elseif (isset ($page[$pageno]['title_handler']))
394 {
395 $tmp = $page[$pageno]['title_handler']($pageno);
396 return $tmp['name'];
397 }
398 else
399 return getConfigVar ('enterprise');
400 }
401
402 function showTabs ($pageno, $tabno)
403 {
404 global $tab, $root, $page, $remote_username, $trigger, $tabextraclass;
405 if (!isset ($tab[$pageno]['default']))
406 return;
407 echo "<td><div class=greynavbar><ul id=foldertab style='margin-bottom: 0px; padding-top: 10px;'>";
408 foreach ($tab[$pageno] as $tabidx => $tabtitle)
409 {
410 // Hide forbidden tabs.
411 if (authorized ($remote_username, $pageno, $tabidx) == FALSE)
412 continue;
413 // Dynamic tabs should only be shown in certain cases (trigger exists and returns true).
414 if
415 (
416 isset ($trigger[$pageno][$tabidx]) &&
417 $trigger[$pageno][$tabidx] () != TRUE
418 )
419 continue;
420 $class = ($tabidx == $tabno) ? 'current' : 'std';
421 $extra = (isset ($tabextraclass[$pageno][$tabidx])) ? $tabextraclass[$pageno][$tabidx] : '';
422 echo "<li><a class=${class}{$extra}";
423 echo " href='${root}?page=${pageno}&tab=${tabidx}";
424 if (isset ($page[$pageno]['bypass']) and isset ($_REQUEST[$page[$pageno]['bypass']]))
425 {
426 $bpname = $page[$pageno]['bypass'];
427 $bpval = $_REQUEST[$bpname];
428 echo "&${bpname}=${bpval}";
429 }
430 echo "'>${tabtitle}</a></li>\n";
431 }
432 echo "</ul></div></td>\n";
433 }
434
435 // This function returns pages, which are direct children of the requested
436 // page and are accessible by the current user.
437 function getDirectChildPages ($pageno)
438 {
439 global $page, $remote_username;
440 $children = array();
441 foreach ($page as $cpageno => $cpage)
442 if
443 (
444 isset ($cpage['parent']) and
445 $cpage['parent'] == $pageno and
446 authorized ($remote_username, $cpageno, 'default') == TRUE
447 )
448 $children[$cpageno] = $cpage;
449 return $children;
450 }
451
452 function getAllChildPages ($parent)
453 {
454 global $page;
455 // Array pointer is global, so if we don't create local copies of
456 // the global array, we can't advance any more after nested call
457 // of getAllChildPages returns.
458 $mypage = $page;
459 $mykids = array();
460 foreach ($mypage as $ctitle => $cpage)
461 if (isset ($cpage['parent']) and $cpage['parent'] == $parent)
462 $mykids[] = array ('title' => $ctitle, 'kids' => getAllChildPages ($ctitle));
463 return $mykids;
464 }
465
466 ?>