Changeset 6619
- Timestamp:
- Jun 29, 2010, 12:06:15 AM (14 years ago)
- Location:
- extensions/virtualAutoGrant
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/virtualAutoGrant/VAG_admin.php
r6613 r6619 42 42 $vag = array_merge( $vag, array( 43 43 'Dir' => VAG_DIR, 44 'Path' => embellish_url($template->get_template_vars('ROOT_URL').VAG_PATH),44 'Path' => VAG_PATH, 45 45 'Ver' => VAG_VER, 46 46 )); -
extensions/virtualAutoGrant/language/en_UK/plugin.lang.php
r6610 r6619 14 14 15 15 $lang['Only the default webmaster can change this option.'] = 'Only the default webmaster can change this option.'; 16 17 $lang['Grant automatically the default webmaster has been reset to its previous value.'] = 'Grant automatically the default webmaster has been reset to its previous value.'; 18 $lang['You are not authorized to change this configuration (Webmaster only).'] = 'You are not authorized to change this configuration (Webmaster only).'; 19 $lang['Your configuration is saved.'] = 'Your configuration is saved.'; 16 20 ?> -
extensions/virtualAutoGrant/language/fr_FR/plugin.lang.php
r6610 r6619 2 2 $lang['On'] = 'Oui, si possible'; 3 3 $lang['Off'] = 'Non, en principe'; 4 $lang['Virtual AutoGrant configuration'] = 'Configuration de Virtual ';4 $lang['Virtual AutoGrant configuration'] = 'Configuration de Virtual AutoGrant'; 5 5 $lang['New virtual categories will be assumed private, access granted to creator and webmaster and/or uploaded pictures will have "Who can see" set to creator privacy level'] 6 6 = 'Les nouvelles catégories virtuelles seront privatives, l\'accès attribué au créateur et au webmaster,<br/> et/ou les images ajoutées auront le "Qui peut voir" au niveau de confidentialité du créateur'; … … 16 16 17 17 $lang['Only the default webmaster can change this option.'] = 'Uniquement le webmaster par défaut peut modifier cette option.'; 18 19 $lang['Grant automatically the default webmaster has been reset to its previous value.'] = 'L\'attribution d\'accès au webmaster a été restauréee à la valeur précédente.'; 20 21 $lang['You are not authorized to change this configuration (Webmaster only).'] = 'Vous n\'êtes pas autorisé à modifier cette configuration (réservé au Webmestre).'; 22 $lang['Your configuration is NOT saved due to above reasons.'] = 'Votre configuration n\'a PAS été enregistré suite aux erreurs ci-dessus.'; 23 $lang['Your configuration is saved.'] = 'Votre configuration a été enregistrée.'; 24 18 25 ?> -
extensions/virtualAutoGrant/template/VAG_admin.tpl
r6610 r6619 7 7 <p> 8 8 9 {'New categories will be assumed private, access granted to creator and webmaster and/or uploaded pictures will have "Who can see" set to creator privacy level'|@translate}9 {'New virtual categories will be assumed private, access granted to creator and webmaster and/or uploaded pictures will have "Who can see" set to creator privacy level'|@translate} 10 10 11 11 </p> -
extensions/virtualAutoGrant/virtual_categories_granted_to_creator.php
r6613 r6619 38 38 list($max_id) = pwg_db_fetch_row(pwg_query('SELECT MAX(id) FROM '.CATEGORIES_TABLE . ';')); 39 39 $vag['lastcat before'] == $max_id; 40 list($max_id) = pwg_db_fetch_row(pwg_query('SELECT MAX(id) FROM '.IMAGES_TABLE . ';')); 41 $vag['lastimg before'] == $max_id; 40 42 add_event_handler('loc_end_admin', 'VAG_grant_to_somebody'); 41 43 return $menu; … … 44 46 function VAG_grant_to_somebody() { 45 47 global $conf, $vag, $user; 46 if ( !isset($vag['lastcat before']) ) return false; 48 if ( empty($vag['lastcat before']) ) $vag['lastcat before'] = 0; 49 if ( empty($vag['lastimg before']) ) $vag['lastimg before'] = 0; 47 50 list($new_id) = pwg_db_fetch_row(pwg_query('SELECT MAX(id) FROM '.CATEGORIES_TABLE 48 51 . ' WHERE id > ' . $vag['lastcat before'] . ' AND site_id IS NULL;')); … … 54 57 mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $insert); 55 58 } 56 // To do set level 59 // Who can see 60 if ( $vag['set_who_can_see'] == 0 ) return false; 61 if ( is_webmaster() and $vag['webmaster_set_who_can_see'] == 1) return false; 62 // New image_ids 63 $img_ids = array_from_query('SELECT id FROM ' . IMAGES_TABLE . ' WHERE id > ' . $vag['lastimg before'] . ';', 'id'); 64 if (count($img_ids) == 0) return false; 65 // New image_ids which are associated to a public category at least 66 if ($vag['ignore_who_can_see_on_private'] == 1) 67 $img_ids = array_from_query('SELECT image_id FROM ' . IMAGE_CATEGORY_TABLE 68 . ' WHERE category_id IN (SELECT id FROM ' . CATEGORIES_TABLE . ' WHERE status = \'public\')' 69 . ' AND image_id IN ('.implode(',', $img_ids).');'); 70 $r = pwg_query('UPDATE '.IMAGES_TABLE.' SET level = ' . $user['level'] . ' WHERE level < '. $user['level'] 71 . ' AND id IN ('.implode(',', $img_ids).');'); 57 72 } 58 73 } … … 116 131 array_push($menu, array( 117 132 'NAME' => 'Virtual AutoGrant', 118 'URL' => get_admin_plugin_menu_link( dirname(__FILE__).'/VAG_admin.php')133 'URL' => get_admin_plugin_menu_link( VAG_PATH .'VAG_admin.php') 119 134 )); 120 135 return $menu;
Note: See TracChangeset
for help on using the changeset viewer.