Changeset 27391
- Timestamp:
- Feb 16, 2014, 10:40:14 PM (10 years ago)
- Location:
- extensions/see_photos_by_user
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/see_photos_by_user/language/en_UK/plugin.lang.php
r26643 r27391 2 2 $lang['See photos by user'] = 'See photos by user'; 3 3 $lang['select user'] = 'select user'; 4 $lang['sumit']= 'sumit'; 4 $lang['select other user'] = 'select other user'; 5 $lang['sumit'] = 'sumit'; 6 $lang['users in alphabetical order'] = 'users in alphabetical order'; 7 $lang['users by reverse alphabetical order'] = 'users by reverse alphabetical order'; 8 $lang['by increasing number of photos'] = 'by increasing number of photos'; 9 $lang['by decreasing number of photos'] = 'by decreasing number of photos'; 10 $lang['Minimal number photos for show users'] = 'Minimal number photos for show users'; 11 $lang['Maximal number users'] = 'Maximal number users'; 12 $lang['users order'] = 'users order'; 13 5 14 ?> -
extensions/see_photos_by_user/language/fr_FR/plugin.lang.php
r26635 r27391 1 1 <?php 2 2 $lang['See photos by user'] = 'Voir photos par utilisateur'; 3 $lang['select user'] = 'selectionne un utilisateur'; 4 $lang['sumit']= 'Valider'; 3 $lang['select user'] = 'selectionner un utilisateur'; 4 $lang['select other user'] = 'selectionner un autre utilisateur'; 5 $lang['sumit'] = 'Valider'; 6 $lang['users in alphabetical order'] = 'utilisateurs par ordre alphabètique'; 7 $lang['users by reverse alphabetical order'] = 'utilisateurs par ordre inversement alphabètique'; 8 $lang['by increasing number of photos'] = 'par nombre de photos croissant'; 9 $lang['by decreasing number of photos'] = 'par nombre de photos décroissant'; 10 $lang['Minimal number photos for show users'] = 'Mombre minimal de photos pour montrer les utilisateurs'; 11 $lang['Maximal number users'] = 'nombre maximal d\utilisateurs'; 12 $lang['users order'] = 'ordre des utilisateurs'; 5 13 ?> -
extensions/see_photos_by_user/main.inc.php
r26643 r27391 13 13 define('SPBA_DIR' , basename(dirname(__FILE__))); 14 14 define('SPBA_PATH' , PHPWG_PLUGINS_PATH . SPBA_DIR . '/'); 15 load_language('plugin.lang', SPBA_PATH); 15 16 17 add_event_handler('blockmanager_apply' , 'add_link_SPBA'); 16 18 function add_link_SPBA($menu_ref_arr) 17 19 { … … 24 26 array_splice 25 27 ($block->data, $position-1, 0, array 26 (' See_photos_by_user' =>28 ('user-' => 27 29 array 28 30 ( 29 'URL' => make_index_url(array('section' => ' See_photos_by_user')),31 'URL' => make_index_url(array('section' => 'user-')), 30 32 'TITLE' => l10n('See photos by user'), 31 33 'NAME' => l10n('See photos by user') … … 36 38 } 37 39 40 add_event_handler('loc_end_section_init', 'section_init_SPBA'); 38 41 function section_init_SPBA() 39 42 { 40 global $tokens; 41 if (in_array('See_photos_by_user', $tokens)) 42 include(SPBA_PATH . 'pagespba.php'); 43 global $tokens; 44 $testd = explode('user-', $_SERVER['REQUEST_URI']); 45 if (!empty ($testd[1])) 46 {$me = 'user-'.$testd[1];} 47 else 48 {$me = 'user-';} 49 50 if (in_array($me, $tokens)) 51 include(SPBA_PATH . 'pagespba.php'); 43 52 } 44 53 45 add_event_handler('blockmanager_apply' , 'add_link_SPBA');46 add_event_handler('loc_end_section_init', 'section_init_SPBA');47 54 55 add_event_handler('get_admin_plugin_menu_links', 'SPBA_admin_menu'); 56 function SPBA_admin_menu($menu) 57 { 58 array_push( 59 $menu, 60 array( 61 'NAME' => l10n('See photos by user'), 62 'URL' => get_admin_plugin_menu_link(SPBA_PATH . 'admin.php') 63 //'URL' => get_root_url().'admin.php?page=plugin-See_photos_by_user' 64 ) 65 ); 66 67 return $menu; 68 } 48 69 49 70 ?> -
extensions/see_photos_by_user/pagespba.php
r26643 r27391 1 1 <?php 2 3 2 load_language('plugin.lang', SPBA_PATH); 4 3 5 4 global $page, $conf, $user, $template; 6 $page['section'] = 'See_photos_by_author'; 7 5 6 $testd = explode('user-', $_SERVER['REQUEST_URI']); 7 if (!empty ($testd[1])) 8 {$me = 'user-'.$testd[1]; 9 $page['section'] = $me; 10 11 $query = ' 12 SELECT id, username 13 FROM ' . USERS_TABLE . ' 14 WHERE username = \''.$testd[1].'\' 15 ;'; 16 $result = pwg_query($query); 17 $row = pwg_db_fetch_assoc($result); 18 $template->assign( 19 'gestionB', 20 array( 21 'USERUSBU' => $testd[1], 22 )); 23 24 $query = ' 25 SELECT DISTINCT(id) 26 FROM '.IMAGES_TABLE.' 27 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 28 '.get_sql_condition_FandF 29 ( 30 array 31 ( 32 'forbidden_categories' => 'category_id', 33 'visible_categories' => 'category_id', 34 'visible_images' => 'id' 35 ), 36 'WHERE' 37 ).' 38 AND added_by = \''.$row['id'].'\' 39 '.$conf['order_by'].' 40 ;'; 41 $page = array_merge 42 ( 43 $page, 44 array 45 ( 46 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'.$me.'</a>', 47 'items' => array_from_query($query, 'id'), 48 ) 49 ); 50 } 51 else 52 { 53 $me = 'user-'; 54 $page['section'] = $me; 55 } 8 56 //read auteur list 9 57 $groups = array(); 58 10 59 $query = ' 11 select id,username 12 FROM ' . USERS_TABLE . ' 13 WHERE id<>2 14 ORDER BY username ASC;'; 60 SELECT UT.id, UT.username, COUNT(IT.id) AS PBU, IT.id 61 FROM ' . USERS_TABLE . ' as UT 62 INNER JOIN '.IMAGES_TABLE.' AS IT ON IT.added_by = UT.id 63 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON IT.id = ic.image_id 64 '.get_sql_condition_FandF 65 ( 66 array 67 ( 68 'forbidden_categories' => 'category_id', 69 'visible_categories' => 'category_id', 70 'visible_images' => 'id' 71 ), 72 'WHERE' 73 ).' 74 GROUP BY IT.added_by 75 HAVING PBU >'.$conf['see_photos_by_user_nbphotos'].' 76 ORDER BY '.$conf['see_photos_by_user_order'].' 77 LIMIT '.$conf['see_photos_by_user_limit'].';'; 78 15 79 $result = pwg_query($query); 16 80 17 81 while ($row = pwg_db_fetch_assoc($result)) 18 82 { 19 $groups[$row[' id']] = $row['username'];83 $groups[$row['username']] = $row['username'].' ('.$row['PBU'].')'; 20 84 } 21 85 $selected = 0; 22 $options[] = l10n('select user'); 86 if (empty ($testd[1])) 87 {$options[] = l10n('select user');} 88 else 89 {$options[] = l10n('select other user');} 23 90 $options['a'] = '----------------------'; 24 91 … … 36 103 if (isset($_POST['submitchoixauteur'])) 37 104 { 38 $forbidden = get_sql_condition_FandF( 39 array( 'visible_images' => 'id' ), 40 'AND' 41 ); 42 43 $page['section'] = 'See_photos_by_author'; 105 $redirect_url = get_root_url().'index.php?/user-'.($_POST['metalist']); 106 redirect($redirect_url); 107 } 44 108 45 $query = '46 SELECT DISTINCT(id)47 FROM '.IMAGES_TABLE.'48 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id49 WHERE added_by = \''.$_POST['metalist'].'\'50 '.$forbidden.'51 '.$conf['order_by'].'52 ;';53 54 $page = array_merge(55 $page,56 array(57 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'.l10n('See photos by author').'</a>',58 'items' => array_from_query($query, 'id'),59 )60 );61 62 //read auteur list63 $groups = array();64 $query = '65 select id,username66 FROM ' . USERS_TABLE . '67 WHERE id<>268 ORDER BY username ASC;';69 $result = pwg_query($query);70 71 while ($row = pwg_db_fetch_assoc($result))72 {73 $groups[$row['id']] = $row['username'];74 }75 $selected = $_POST['metalist'];76 77 foreach ($groups as $metalist => $metalist2)78 {79 $options[$metalist] = $metalist2;80 }81 $template->assign(82 'gestionA',83 array(84 'OPTIONS' => $options,85 'SELECTED' => $selected86 ));87 }88 109 $template->assign('SPBA2', 'toto'); 89 110 $template->set_filename('SPBA', realpath(SPBA_PATH.'pagespba.tpl')); 90 111 $template->assign_var_from_handle('CONTENT', 'SPBA'); 91 92 112 ?> -
extensions/see_photos_by_user/pagespba.tpl
r26643 r27391 4 4 </form> 5 5 {/if} 6 {if isset ($gestionB)} 7 <h1>{'User'|@translate} {$gestionB.USERUSBU}</h1> 8 {/if}
Note: See TracChangeset
for help on using the changeset viewer.