Changeset 9516 for extensions/community/main.inc.php
- Timestamp:
- Mar 4, 2011, 11:26:08 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/community/main.inc.php
r9452 r9516 21 21 22 22 include_once(COMMUNITY_PATH.'include/functions_community.inc.php'); 23 load_language('plugin.lang', COMMUNITY_PATH); 23 24 24 25 /* Plugin admin */ 25 26 add_event_handler('get_admin_plugin_menu_links', 'community_admin_menu'); 26 27 27 function community_admin_menu($menu) 28 28 { 29 global $page; 30 31 $query = ' 32 SELECT 33 COUNT(*) 34 FROM '.COMMUNITY_PENDINGS_TABLE.' 35 WHERE state = \'moderation_pending\' 36 ;'; 37 $result = pwg_query($query); 38 list($page['community_nb_pendings']) = pwg_db_fetch_row($result); 39 40 $name = 'Community'; 41 if ($page['community_nb_pendings'] > 0) 42 { 43 $style = 'background-color:#666;'; 44 $style.= 'color:white;'; 45 $style.= 'padding:1px 5px;'; 46 $style.= '-moz-border-radius:10px;'; 47 $style.= '-webkit-border-radius:10px;'; 48 $style.= '-border-radius:10px;'; 49 $style.= 'margin-left:5px;'; 50 51 $name.= '<span style="'.$style.'">'.$page['community_nb_pendings'].'</span>'; 52 53 if (defined('IN_ADMIN') and IN_ADMIN and $page['page'] == 'intro') 54 { 55 global $template; 56 57 $template->set_prefilter('intro', 'community_pendings_on_intro'); 58 $template->assign( 59 array( 60 'COMMUNITY_PENDINGS' => sprintf( 61 '<a href="%s">'.l10n('%u pending photos').'</a>', 62 get_root_url().'admin.php?page=plugin-community-pendings', 63 $page['community_nb_pendings'] 64 ), 65 ) 66 ); 67 } 68 } 69 29 70 array_push( 30 71 $menu, 31 72 array( 32 'NAME' => 'Community',73 'NAME' => $name, 33 74 'URL' => get_root_url().'admin.php?page=plugin-community' 34 75 ) … … 36 77 37 78 return $menu; 79 } 80 81 function community_pendings_on_intro($content, &$smarty) 82 { 83 $pattern = '#<li>\s*{\$DB_ELEMENTS\}#ms'; 84 $replacement = '<li>{$COMMUNITY_PENDINGS}</li><li>{$DB_ELEMENTS}'; 85 return preg_replace($pattern, $replacement, $content); 38 86 } 39 87 … … 154 202 community_reject_user_pendings($user_id); 155 203 } 156 157 204 ?>
Note: See TracChangeset
for help on using the changeset viewer.