Revision 971
Added by Matthias over 16 years ago
| include.php | ||
|---|---|---|
| 22 | 22 |
02110-1301, USA. |
| 23 | 23 |
|
| 24 | 24 |
*********************************************** |
| 25 |
** Version 4.7: see README for documentation **
|
|
| 25 |
** Version 4.8: see README for documentation **
|
|
| 26 | 26 |
*********************************************** |
| 27 | 27 |
*/ |
| 28 | 28 |
|
| ... | ... | |
| 529 | 529 |
$sql = "SELECT $fields FROM ".TABLE_PREFIX. |
| 530 | 530 |
"pages WHERE $wb->extra_where_sql $menuLimitSql ". |
| 531 | 531 |
'ORDER BY level ASC, position ASC'; |
| 532 |
$sql = str_replace('hidden', 'IGNOREME', $sql); // we want the hidden pages
|
|
| 532 | 533 |
$oRowset = $database->query($sql); |
| 533 | 534 |
if (is_object($oRowset) && $oRowset->numRows() > 0) {
|
| 534 | 535 |
// create an in memory array of the database data based on the item's parent. |
| ... | ... | |
| 536 | 537 |
while ($page = $oRowset->fetchRow()) {
|
| 537 | 538 |
// ignore all pages that the current user is not permitted to view |
| 538 | 539 |
if(version_compare(WB_VERSION, '2.7', '>=')) { // WB >= 2.7
|
| 539 |
// 1. all pages with no active sections (unless it is the top page) are ignored
|
|
| 540 |
if (!$wb->page_is_active($page) && $page['link'] != $wb->default_link && !INTRO_PAGE) {
|
|
| 541 |
continue;
|
|
| 540 |
// 1. hidden pages aren't shown unless they are on the current page
|
|
| 541 |
if ($page['visibility'] == 'hidden') {
|
|
| 542 |
$page['sm2_hide'] = true;
|
|
| 542 | 543 |
} |
| 543 |
// 2. all pages not visible to this user (unless always visible to registered users) are ignored |
|
| 544 |
if (!$wb->page_is_visible($page) && $page['visibility'] != 'registered') {
|
|
| 544 |
|
|
| 545 |
// 2. all pages with no active sections (unless it is the top page) are ignored |
|
| 546 |
else if (!$wb->page_is_active($page) && $page['link'] != $wb->default_link && !INTRO_PAGE) {
|
|
| 545 | 547 |
continue; |
| 546 | 548 |
} |
| 549 |
|
|
| 550 |
// 3. all pages not visible to this user (unless always visible to registered users) are ignored |
|
| 551 |
else if (!$wb->page_is_visible($page) && $page['visibility'] != 'registered') {
|
|
| 552 |
continue; |
|
| 553 |
} |
|
| 547 | 554 |
} |
| 548 | 555 |
else { // WB < 2.7
|
| 549 | 556 |
// We can't do this in SQL as the viewing_groups column contains multiple |
| ... | ... | |
| 567 | 574 |
if ($page['page_id'] == $CURR_PAGE_ID) {
|
| 568 | 575 |
$page['sm2_is_curr'] = true; |
| 569 | 576 |
$page['sm2_on_curr_path'] = true; |
| 577 |
unset($page['sm2_hide']); // don't hide the current page |
|
| 570 | 578 |
} |
| 571 | 579 |
|
| 572 | 580 |
// mark parents of the current page as such |
| 573 | 581 |
if (in_array($page['page_id'], $rgCurrParents)) {
|
| 574 | 582 |
$page['sm2_is_parent'] = true; |
| 575 | 583 |
$page['sm2_on_curr_path'] = true; |
| 584 |
unset($page['sm2_hide']); // don't hide a parent page |
|
| 576 | 585 |
} |
| 577 | 586 |
|
| 578 | 587 |
// add the entry to the array |
Also available in: Unified diff
Update show_menu2 to version 4.8 (ticket #712)