Project

General

Profile

« Previous | Next » 

Revision 1289

Added by kweitzel over 14 years ago

Branch 2.8.1 merged back into Trunk

View differences:

include.php
22 22
    02110-1301, USA.
23 23

  
24 24
    ***********************************************
25
    ** Version 4.9: see README for documentation **
25
    ** Version 4.8: see README for documentation **
26 26
    ***********************************************
27 27
*/
28 28

  
29
define('SM2_ROOT',        -1000);
30
define('SM2_CURR',        -2000);
31
define('SM2_ALLMENU',        -1);
32
define('SM2_START',        1000);
33
define('SM2_MAX',          2000);
34
define('SM2_ALL',        0x0001); // bit 0 (group 1) (Note: also used for max level!)
35
define('SM2_TRIM',       0x0002); // bit 1 (group 1)
36
define('SM2_CRUMB',      0x0004); // bit 2 (group 1)
37
define('SM2_SIBLING',    0x0008); // bit 3 (group 1)
38
define('SM2_NUMCLASS',   0x0010); // bit 4
39
define('SM2_ALLINFO',    0x0020); // bit 5
40
define('SM2_NOCACHE',    0x0040); // bit 6
41
define('SM2_PRETTY',     0x0080); // bit 7
42
define('SM2_ESCAPE',     0x0100); // bit 8
43
define('SM2_NOESCAPE',        0); // NOOP, unnecessary with WB 2.6.7+
44
define('SM2_BUFFER',     0x0200); // bit 9
45
define('SM2_CURRTREE',   0x0400); // bit 10
46
define('SM2_SHOWHIDDEN', 0x0800); // bit 11
29
define('SM2_ROOT',       -1000);
30
define('SM2_CURR',       -2000);
31
define('SM2_ALLMENU',       -1);
32
define('SM2_START',       1000);
33
define('SM2_MAX',         2000);
34
define('SM2_ALL',       0x0001); // bit 0 (group 1) (Note: also used for max level!)
35
define('SM2_TRIM',      0x0002); // bit 1 (group 1)
36
define('SM2_CRUMB',     0x0004); // bit 2 (group 1)
37
define('SM2_SIBLING',   0x0008); // bit 3 (group 1)
38
define('SM2_NUMCLASS',  0x0010); // bit 4
39
define('SM2_ALLINFO',   0x0020); // bit 5
40
define('SM2_NOCACHE',   0x0040); // bit 6
41
define('SM2_PRETTY',    0x0080); // bit 7
42
define('SM2_ESCAPE',    0x0100); // bit 8
43
define('SM2_NOESCAPE',       0); // NOOP, unnecessary with WB 2.6.7+
44
define('SM2_BUFFER',    0x0200); // bit 9
45
define('SM2_CURRTREE',  0x0400); // bit 10
47 46

  
48 47
define('_SM2_GROUP_1',  0x000F); // exactly one flag from group 1 is required
49 48

  
......
271 270
                $rgTests[$n] = $this->ifTest($rgMatches[1], $rgMatches[2], $rgMatches[3]);
272 271
            }
273 272
            else {
274
                error_log("show_menu2 error: conditional expression is invalid!");
273
                @error_logs("show_menu2 error: conditional expression is invalid!");
275 274
                $rgTests[$n] = false;
276 275
            }
277 276
        }
......
403 402
    }
404 403
};
405 404

  
405
function error_logs($error_str)
406
{
407
                $log_error = true;
408
                if ( ! function_exists('error_log') )
409
                        $log_error = false;
410

  
411
                $log_file = @ini_get('error_log');
412
                if ( !empty($log_file) && ('syslog' != $log_file) && !@is_writable($log_file) )
413
                        $log_error = false;
414

  
415
                if ( $log_error )
416
                        @error_log($error_str, 0);
417
}
418

  
406 419
function show_menu2(
407 420
    $aMenu          = 0,
408 421
    $aStart         = SM2_ROOT,
......
430 443
    else {
431 444
        $flags = SM2_TRIM;
432 445
        $aOptions = array();
433
        error_log('show_menu2 error: $aOptions is invalid. No flags supplied!');
446
        @error_logs('show_menu2 error: $aOptions is invalid. No flags supplied!');
434 447
    }
435 448
    
436
    // ensure we have our group 1 flag, we don't check for the "exactly 1" part, but 
449
    // ensure we have our group 1 flag, we don't check for the "exactly 1" part, but
437 450
    // we do ensure that they provide at least one.
438 451
    if (0 == ($flags & _SM2_GROUP_1)) {
439
        error_log('show_menu2 error: $aOptions is invalid. No flags from group 1 supplied!');
452
        @error_logs('show_menu2 error: $aOptions is invalid. No flags from group 1 supplied!');
440 453
        $flags |= SM2_TRIM; // default to TRIM
441 454
    }
442 455
    
......
486 499
    // the database. If this variable exists, then we have already retrieved all
487 500
    // of the information and processed it, so we don't need to do it again.
488 501
    if (($flags & SM2_NOCACHE) != 0
489
        || !array_key_exists('show_menu2_data', $GLOBALS) 
502
        || !array_key_exists('show_menu2_data', $GLOBALS)
490 503
        || !array_key_exists($aMenu, $GLOBALS['show_menu2_data'])) 
491 504
    {
492 505
        global $database;
493 506

  
494 507
        // create an array of all parents of the current page. As the page_trail
495 508
        // doesn't include the theoretical root element 0, we add it ourselves.
496
        $rgCurrParents = split(',', '0,'.$wb->page['page_trail']);
509
        $rgCurrParents = explode(",", '0,'.$wb->page['page_trail']);
497 510
        array_pop($rgCurrParents); // remove the current page
498 511
        $rgParent = array();
499 512

  
......
575 588
                if ($page['page_id'] == $CURR_PAGE_ID) {
576 589
                    $page['sm2_is_curr'] = true;
577 590
                    $page['sm2_on_curr_path'] = true;
578
                    if ($flags & SM2_SHOWHIDDEN) { 
579
                        // show hidden pages if active and SHOWHIDDEN flag supplied
580
                        unset($page['sm2_hide']); 
581
                    }
591
                    unset($page['sm2_hide']); // don't hide the current page
582 592
                }
583 593

  
584 594
                // mark parents of the current page as such
585 595
                if (in_array($page['page_id'], $rgCurrParents)) {
586 596
                    $page['sm2_is_parent'] = true;
587 597
                    $page['sm2_on_curr_path'] = true;
588
                    if ($flags & SM2_SHOWHIDDEN) {
589
                        // show hidden pages if active and SHOWHIDDEN flag supplied
590
                        unset($page['sm2_hide']); 
591
                    }
598
                    unset($page['sm2_hide']); // don't hide a parent page                
592 599
                }
593 600
                
594 601
                // add the entry to the array                

Also available in: Unified diff