Changeset 6613 for extensions/virtualAutoGrant
- Timestamp:
- Jun 27, 2010, 10:37:23 PM (14 years ago)
- Location:
- extensions/virtualAutoGrant
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/virtualAutoGrant/VAG_admin.php
r6610 r6613 9 9 $infos = array(); 10 10 11 // '' => 1,12 // 'set_private_by_API' => 1,13 // 'grant_to_creator' => 1,14 // 'grant_to_webmaster' => 1,15 // 'set_who_can_see' => 1,16 // 'webmaster_set_who_can_see' => 1,17 // 'ignore_who_can_see_on_private' => 1,18 // 'Dir' => VAG_DIR,19 // 'Path' => VAG_PATH,20 // 'Ver' => VAG_VER,21 11 $vag = & $conf['virtual_AutoGrant']; 22 12 … … 25 15 if ( $sub ) { 26 16 $nsp = array_merge($vag, $_POST); 27 if ( $nsp['set_private'] == 1 and $nsp['set_private_by_API'] == 0 ) {28 $nsp['set_private_by_API'] = 1;29 array_push($infos, l10n('New virtual categories from external API will be forced to "private" due to previous choice.'));30 }31 17 if ( $user['id'] != $conf['webmaster_id'] and $nsp['grant_to_webmaster'] != $vag['grant_to_webmaster']) { 32 18 $nsp['grant_to_webmaster'] = $vag['grant_to_webmaster']; … … 45 31 array_push($infos, l10n('Your configuration is saved.')); 46 32 } 47 $vag = $nsp;33 $vag = array_merge($vag, $nsp); 48 34 } 49 35 $template->set_filenames( array('VAG_admin' => dirname(__FILE__).'/template/VAG_admin.tpl') ); -
extensions/virtualAutoGrant/virtual_categories_granted_to_creator.php
r6610 r6613 11 11 add_event_handler('get_admin_plugin_menu_links', 'VAG_set_private'); 12 12 function VAG_set_private($menu) { 13 global $page ;13 global $page, $conf; 14 14 if ( isset($page['page']) and $page['page'] != 'site_manager' ) 15 15 $conf['newcat_default_status'] = 'private'; … … 22 22 add_event_handler('get_admin_plugin_menu_links', 'VAG_set_public'); 23 23 function VAG_set_public($menu) { 24 global $page ;24 global $page, $conf; 25 25 if ( isset($page['page']) and $page['page'] != 'site_manager' ) 26 26 $conf['newcat_default_status'] = 'public'; … … 35 35 function VAG_grant_to_prepare($menu) { 36 36 global $conf, $page, $vag; 37 if ( !isset($page['page']) or $page['page'] == 'site_manager' ) return false; 37 if ( !isset($page['page']) or $page['page'] == 'site_manager' ) return false; # Not Virtual 38 38 list($max_id) = pwg_db_fetch_row(pwg_query('SELECT MAX(id) FROM '.CATEGORIES_TABLE . ';')); 39 39 $vag['lastcat before'] == $max_id; … … 54 54 mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $insert); 55 55 } 56 // To do set level 56 57 } 57 58 } 58 59 } 59 60 60 // API cases : Just do it (even in Admin Photos Add case or other plugins cases)61 // API cases : Just do it 61 62 if ( !function_exists( 'VAG_set_private_by_API' ) ) { 62 63 add_event_handler('invalidate_user_cache', 'VAG_set_private_by_API', 20); … … 64 65 function VAG_set_private_by_API($full) { 65 66 if ( !function_exists( 'ws_categories_add' ) ) return false; // That isn't an API request 66 global $user, $conf, $vag; 67 if ( $_REQUEST['method'] == 'pwg.categories.add' ) { 67 global $user, $conf; 68 $vag = & $conf['virtual_AutoGrant']; 69 if ( isset($_REQUEST['method']) and $_REQUEST['method'] == 'pwg.categories.add' ) { 68 70 list($inserted_id) = pwg_db_fetch_row(pwg_query('SELECT MAX(id) FROM '.CATEGORIES_TABLE 69 71 . ' WHERE name = \'' .pwg_db_real_escape_string($_REQUEST['name']) . '\' AND site_id IS NULL;')); … … 80 82 } 81 83 // "Who can see" management ( only for API, Synchro or old HTTP management on gallery side are ignored ) 82 if ( $_REQUEST['method'] == 'pwg.images.add' and isset($_REQUEST['original_sum'])84 if ( isset($_REQUEST['method']) and $_REQUEST['method'] == 'pwg.images.add' and isset($_REQUEST['original_sum']) 83 85 and $vag['set_who_can_see'] == 1 ) { 84 86 # image to update
Note: See TracChangeset
for help on using the changeset viewer.