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