1 | <?php |
---|
2 | /* Spread menus */ |
---|
3 | if (!defined('PHPWG_ROOT_PATH') or !defined('SPREADM_DIR')) die('Hacking attempt!'); |
---|
4 | global $conf; |
---|
5 | $default = array( |
---|
6 | 'Dir' => SPREADM_DIR, |
---|
7 | 'Path' => SPREADM_PATH, |
---|
8 | 'Version' => SPREADM_VER, |
---|
9 | 'On_picture' => true, |
---|
10 | 'Exclude' => array('theNBMPage','thePopuphelpPage',), # Excluded pages |
---|
11 | 'On_theme' => array( 'Sylvia', 'clear', 'dark', 'aqua', 'blancmontxl', |
---|
12 | 'GBO_hk-3', 'GBO_hk-3_clear', 'grum-dark-II', 'kardon', 'Pure_clear_blue', |
---|
13 | 'Pure_green_nature', 'Pure_tr_clear_blue', 'sobre', 'VerticalWhite', 'p0w0', 'wipi' ), # Eligible themes (currently assumed by the plugin) |
---|
14 | ); |
---|
15 | if (!isset($conf['Spread menus']) or !is_array($conf['Spread menus'])) $conf['Spread menus'] = $default; |
---|
16 | else $conf['Spread menus'] = array_merge( $default, $conf['Spread menus'] ); |
---|
17 | $conf['Spread menus']['Version'] = SPREADM_VER; |
---|
18 | |
---|
19 | if ( !function_exists( 'spread_menus_on_public_pages' ) ) { |
---|
20 | if ( defined('IN_ADMIN') and IN_ADMIN ) return false; |
---|
21 | add_event_handler('loc_after_page_header', 'spread_menus_on_public_pages', 20); |
---|
22 | |
---|
23 | function spread_menus_on_public_pages() { |
---|
24 | if ( function_exists( 'initialize_menu') ) return false; # The current page has already the menu |
---|
25 | global $template, $page, $conf; |
---|
26 | if ( isset($page['body_id']) and in_array($page['body_id'], $conf['Spread menus']['Exclude']) ) return false; |
---|
27 | if ( isset($page['body_id']) and $page['body_id'] == 'thePicturePage' and !$conf['Spread menus']['On_picture'] ) return false; |
---|
28 | $themeconf = $template->get_template_vars('themeconf'); |
---|
29 | # themes could set $themeconf['spread_menus'] with the .css filename they provide in their css subfolder |
---|
30 | if ( isset($themeconf['spread_menus']) and isset($themeconf['id']) ) $conf['Spread menus']['On_theme'][] = $themeconf['id']; |
---|
31 | if ( !isset($themeconf['id']) or !in_array($themeconf['id'],$conf['Spread menus']['On_theme']) ) return false; |
---|
32 | |
---|
33 | $template->set_filenames(array( |
---|
34 | 'spread_menus_on_public_pages' => dirname(__FILE__) . '/template/spread_menus_on_public_pages.tpl', |
---|
35 | )); |
---|
36 | include_once(PHPWG_ROOT_PATH.'include/menubar.inc.php'); |
---|
37 | $conf['Spread menus']['Path'] = embellish_url($template->get_template_vars('ROOT_URL').SPREADM_PATH); |
---|
38 | $template->assign( array( 'SPREADM' => $conf['Spread menus'] ) ); |
---|
39 | $template->parse('spread_menus_on_public_pages'); |
---|
40 | |
---|
41 | if (is_admin()) |
---|
42 | { |
---|
43 | $template->assign( |
---|
44 | 'U_ADMIN', get_root_url().'admin.php?page=picture_modify' |
---|
45 | .'&cat_id='.(isset($page['category']) ? $page['category']['id'] : '') |
---|
46 | .( isset($page['image_id']) ? '&image_id='.$page['image_id'] : '') |
---|
47 | ); |
---|
48 | } |
---|
49 | |
---|
50 | } |
---|
51 | } |
---|
52 | ?> |
---|