Changeset 9261 for extensions/AdditionalPages/index_menu.php
- Timestamp:
- Feb 17, 2011, 4:27:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AdditionalPages/index_menu.php
r6227 r9261 11 11 if ($menu->get_id() != 'menubar') 12 12 return; 13 $menu->register_block( new RegisteredBlock( 'mbAdditionalPages', 'Additional Pages', ' AP'));13 $menu->register_block( new RegisteredBlock( 'mbAdditionalPages', 'Additional Pages', 'P@t')); 14 14 } 15 15 … … 17 17 { 18 18 global $template, $conf, $user, $lang; 19 20 $ap_conf = explode ("," , $conf['additional_pages']);21 19 22 20 $menu = & $menu_ref_arr[0]; … … 27 25 28 26 load_language('plugin.lang', AP_PATH); 29 30 // Gestion des langues pour le nom du menu31 $languages = explode('/', $ap_conf[0]);32 foreach($languages as $language)33 {34 $array = explode(':', $language);35 if (!isset($array[1])) $menu_langs['default'] = $array[0];36 else $menu_langs[$array[0]] = $array[1];37 }38 27 39 28 $data = array(); 40 29 41 if (is_admin())42 {43 array_push($data, array(44 'URL' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . AP_DIR . '%2Fadmin%2Fadd_page.php',45 'LABEL' => l10n('ap_add_page')));46 $clauses = '';47 }48 else49 {50 $clauses = 'WHERE (lang = "' . $user['language'] . '" OR lang = "ALL")';51 }52 53 30 // Recupération des groupes de l'utilisateur 54 31 $q = 'SELECT group_id FROM ' . USER_GROUP_TABLE . ' WHERE user_id = ' . $user['id'] . ';'; … … 61 38 62 39 // Récupération des pages 63 $q = 'SELECT id , pos , title40 $q = 'SELECT id, pos, title, users, groups, permalink 64 41 FROM ' . ADD_PAGES_TABLE . ' 65 ' . $clauses . ' 66 ORDER BY pos ASC;'; 42 WHERE (lang = "' . $user['language'] . '" OR lang IS NULL) 43 AND pos > 0 44 ORDER BY pos ASC, id ASC 45 ;'; 67 46 $result = pwg_query($q); 68 47 … … 71 50 if ($row['pos'] != '0' or is_admin()) 72 51 { 73 if (strpos($row['title'] , '/user_id=')) 52 $authorized_users = array(); 53 $authorized_groups = array(); 54 if (!empty($row['users'])) 74 55 { 75 $array = explode('/user_id=' , $row['title']); 76 $row['title'] = $array[0]; 77 $authorized_users = explode(',', $array[1]); 56 $authorized_users = explode(',', $row['users']); 78 57 } 79 if ( strpos($row['title'] , '/group_id='))58 if (!empty($row['groups'])) 80 59 { 81 $array = explode('/group_id=' , $row['title']); 82 $row['title'] = $array[0]; 83 $auth = explode(',', $array[1]); 60 $auth = explode(',', $row['groups']); 84 61 $authorized_groups = array_intersect($groups, $auth); 85 62 } 86 if (is_admin() and isset($ap_conf[3]) and $ap_conf[3] == 'on')87 {88 $row['title'] .= '</a> --- <a href=' . PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . AP_DIR . '%2Fadmin%2Fadd_page.php&edit=' . $row['id'] . '>[edit]';89 }90 63 if (is_admin() or ( 91 ( isset($ap_conf[6]) and $ap_conf[6] == 'off' or !isset($authorized_groups) or !empty($authorized_groups)) and92 ( isset($ap_conf[7]) and $ap_conf[7] == 'off' or !isset($authorized_users) or in_array($user['status'], $authorized_users))))64 (!$conf['additional_pages']['group_perm'] or empty($row['groups']) or !empty($authorized_groups)) and 65 (!$conf['additional_pages']['user_perm'] or empty($row['users']) or in_array($user['status'], $authorized_users)))) 93 66 { 94 67 array_push($data, array( 95 'URL' => PHPWG_ROOT_PATH . 'index.php?/additional_page/' . $row['id'],68 'URL' => make_index_url().'/page/'.(isset($row['permalink']) ? $row['permalink'] : $row['id']), 96 69 'LABEL' => $row['title'])); 97 70 } … … 103 76 if (!empty($data)) 104 77 { 105 $block->set_title(isset($menu_langs[$user['language']]) ? $menu_langs[$user['language']] : $menu_langs['default']); 78 $block->set_title( 79 isset($conf['additional_pages']['languages'][$user['language']]) ? 80 $conf['additional_pages']['languages'][$user['language']] : 81 @$conf['additional_pages']['languages']['default'] 82 ); 106 83 $block->template = 'AdditionalPages_menu.tpl'; 107 84 $block->data = $data;
Note: See TracChangeset
for help on using the changeset viewer.