Changeset 17925
- Timestamp:
- Sep 15, 2012, 2:39:38 PM (12 years ago)
- Location:
- extensions/linked_pages
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/linked_pages/include/functions.inc.php
r17882 r17925 23 23 function linked_pages_loc_end_index() 24 24 { 25 global $page, $user, $template ;25 global $page, $user, $template, $conf; 26 26 27 28 27 if ( isset($page['section']) and $page['section']=='categories' and isset($page['category']) ) 29 28 { 29 $where_clauses = array('category_id = '.$page['category']['id']); 30 31 if (!is_admin()) 32 { 33 if ($conf['AP']['language_perm']) 34 { 35 $where_clauses[] = '(ap.lang = NULL OR ap.lang = "'.$user['language'].'")'; 36 } 37 if ($conf['AP']['level_perm']) 38 { 39 $where_clauses[] = 'ap.level <= '.$user['level']; 40 } 41 if ($conf['AP']['user_perm']) 42 { 43 $where_clauses[] = 'ap.users LIKE "%'.$user['status'].'%"'; 44 } 45 if ($conf['AP']['group_perm']) 46 { 47 $query = ' 48 SELECT group_id 49 FROM '.USER_GROUP_TABLE.' 50 WHERE user_id = '.$user['id'].' 51 ;'; 52 $user_groups = array_from_query($query, 'group_id'); 53 } 54 } 55 30 56 $query = ' 31 57 SELECT … … 34 60 ap.title, 35 61 ap.standalone, 36 ap.permalink 62 ap.permalink, 63 ap.groups 37 64 FROM '.LINKEDPAGES_TABLE.' AS lp 38 65 INNER JOIN '.ADD_PAGES_TABLE.' AS ap 39 66 ON lp.page_id = ap.id 40 WHERE category_id = '.$page['category']['id'].' 67 WHERE 68 '.implode("\n AND ", $where_clauses).' 41 69 ORDER BY lp.pos 42 70 ;'; … … 50 78 while ($row = pwg_db_fetch_assoc($result)) 51 79 { 52 if ( isset($row['lang']) and $row['lang'] != $user['language'] ) return; 80 if ( !is_admin() and $conf['AP']['group_perm'] and !empty($row['groups']) ) 81 { 82 $authorized = false; 83 foreach (explode(',',$row['groups']) as $group_id) 84 { 85 if (in_array($group_id, $user_groups)) 86 { 87 $authorized = true; 88 break; 89 } 90 } 91 if (!$authorized) continue; 92 } 93 94 53 95 $row['U_PAGE'] = make_index_url(array('section'=>'page')).'/'.(isset($row['permalink']) ? $row['permalink'] : $row['page_id']); 54 96 $row['TITLE'] = trigger_event('AP_render_title', $row['title']); … … 62 104 else if ( isset($page['section']) and $page['section']=='additional_page' and isset($page['additional_page']) ) 63 105 { 106 $where_clauses = array('page_id = '.$page['additional_page']['id']); 107 108 if (!is_admin()) 109 { 110 $where_clauses[] = 'lp.category_id NOT IN('.$user['forbidden_categories'].')'; 111 } 112 64 113 $query = ' 65 114 SELECT … … 70 119 INNER JOIN '.CATEGORIES_TABLE.' AS cat 71 120 ON lp.category_id = cat.id 72 WHERE page_id = '.$page['additional_page']['id'].' 121 WHERE 122 '.implode("\n AND ", $where_clauses).' 73 123 ORDER BY lp.pos 74 124 ;'; -
extensions/linked_pages/main.inc.php
r17888 r17925 16 16 // | Define plugin constants | 17 17 // +-----------------------------------------------------------------------+ 18 define('LINKEDPAGES_PATH' , PHPWG_PLUGINS_PATH . 'linked_pages/'); 18 defined('LINKEDPAGES_ID') or define('LINKEDPAGES_ID', basename(dirname(__FILE__))); 19 define('LINKEDPAGES_PATH' , PHPWG_PLUGINS_PATH . LINKEDPAGES_ID . '/'); 19 20 define('LINKEDPAGES_TABLE', $prefixeTable . 'linked_pages'); 20 define('LINKEDPAGES_ADMIN', get_root_url() . 'admin.php?page=plugin- linked_pages');21 define('LINKEDPAGES_ADMIN', get_root_url() . 'admin.php?page=plugin-' . LINKEDPAGES_ID); 21 22 define('LINKEDPAGES_VERSION', '1.0.0'); 22 23 … … 51 52 52 53 if ( 53 $pwg_loaded_plugins[ 'linked_pages']['version'] == 'auto' or54 version_compare($pwg_loaded_plugins[ 'linked_pages']['version'], LINKEDPAGES_VERSION, '<')54 $pwg_loaded_plugins[LINKEDPAGES_ID]['version'] == 'auto' or 55 version_compare($pwg_loaded_plugins[LINKEDPAGES_ID]['version'], LINKEDPAGES_VERSION, '<') 55 56 ) 56 57 { … … 58 59 linked_pages_install(); 59 60 60 if ($pwg_loaded_plugins[ 'linked_pages']['version'] != 'auto')61 if ($pwg_loaded_plugins[LINKEDPAGES_ID]['version'] != 'auto') 61 62 { 62 63 $query = ' 63 64 UPDATE '. PLUGINS_TABLE .' 64 65 SET version = "'. LINKEDPAGES_VERSION .'" 65 WHERE id = " linked_pages"';66 WHERE id = "'. LINKEDPAGES_ID .'"'; 66 67 pwg_query($query); 67 68 68 $pwg_loaded_plugins[ 'linked_pages']['version'] = LINKEDPAGES_VERSION;69 $pwg_loaded_plugins[LINKEDPAGES_ID]['version'] = LINKEDPAGES_VERSION; 69 70 70 71 if (defined('IN_ADMIN')) 71 72 { 72 $_SESSION['page_infos'][] = ' Skeletonupdated to version '. LINKEDPAGES_VERSION;73 $_SESSION['page_infos'][] = 'Linked Pages updated to version '. LINKEDPAGES_VERSION; 73 74 } 74 75 } -
extensions/linked_pages/maintain.inc.php
r17882 r17925 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 include_once(PHPWG_PLUGINS_PATH . 'linked_pages/include/install.inc.php'); 4 defined('LINKEDPAGES_ID') or define('LINKEDPAGES_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . LINKEDPAGES_ID '/include/install.inc.php'); 5 6 6 7
Note: See TracChangeset
for help on using the changeset viewer.