Changeset 9310 for extensions/AdditionalPages/additional_page.php
- Timestamp:
- Feb 19, 2011, 11:13:22 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AdditionalPages/additional_page.php
r9272 r9310 8 8 $identifier = $page['ap_homepage'] ? $conf['additional_pages']['homepage'] : $tokens[1]; 9 9 10 load_language('plugin.lang.php', AP_PATH);11 12 10 if (function_exists('get_extended_desc')) 13 11 add_event_handler('AP_render_content', 'get_extended_desc'); 14 12 15 // R écupération des données de la page16 $query = 'SELECT id, title , content, users, groups, permalink, standalone13 // Retrieve page data 14 $query = 'SELECT id, title , content, users, groups, level, permalink, standalone 17 15 FROM ' . ADD_PAGES_TABLE . ' 18 16 '; … … 21 19 'WHERE permalink = "'.$identifier.'";'; 22 20 23 $row = mysql_fetch_assoc(pwg_query($query));21 $row = pwg_db_fetch_assoc(pwg_query($query)); 24 22 25 23 if (empty($row)) … … 47 45 ); 48 46 49 // Utilisateurs autorisés 50 if (!empty($row['users'])) 47 if (!is_admin() and !$page['ap_homepage']) 51 48 { 52 $authorized_users = explode(',', $row['users']);53 if (! is_admin() and $conf['additional_pages']['user_perm'] and !in_array($user['status'], $authorized_users))49 // authorized users 50 if (!empty($row['users'])) 54 51 { 55 if ($page['ap_homepage']) return; 56 page_forbidden(l10n('You are not authorized to access the requested page')); 52 $authorized_users = explode(',', $row['users']); 53 if (!is_admin() and $conf['additional_pages']['user_perm'] and !in_array($user['status'], $authorized_users)) 54 { 55 if ($page['ap_homepage']) return; 56 page_forbidden(l10n('You are not authorized to access the requested page')); 57 } 58 } 59 60 // authorized groups 61 if (!empty($row['groups'])) 62 { 63 $q = 'SELECT * 64 FROM ' . USER_GROUP_TABLE . ' 65 WHERE user_id = ' . $user['id'] . ' AND group_id IN (' . $row['groups'] . ');'; 66 $array = mysql_fetch_array(pwg_query($q)); 67 if (!is_admin() and $conf['additional_pages']['group_perm'] and empty($array)) 68 { 69 if ($page['ap_homepage']) return; 70 page_forbidden(l10n('You are not authorized to access the requested page')); 71 } 72 } 73 74 // authorized level 75 if ($user['level'] < $row['level']) 76 { 77 page_forbidden(l10n('You are not authorized to access the requested page')); 57 78 } 58 79 } 59 80 60 // Groupe autorisé 61 if (!empty($row['groups'])) 62 { 63 $q = 'SELECT * 64 FROM ' . USER_GROUP_TABLE . ' 65 WHERE user_id = ' . $user['id'] . ' AND group_id IN (' . $row['groups'] . ');'; 66 $array = mysql_fetch_array(pwg_query($q)); 67 if (!is_admin() and $conf['additional_pages']['group_perm'] and empty($array)) 68 { 69 if ($page['ap_homepage']) return; 70 page_forbidden(l10n('You are not authorized to access the requested page')); 71 } 72 } 73 81 // Display standalone page 74 82 if ($page['additional_page']['standalone']) 75 83 {
Note: See TracChangeset
for help on using the changeset viewer.