Advertisement
geolim4

hoook

Oct 19th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.23 KB | None | 0 0
  1. <?php
  2. /**
  3. * @package phpBB
  4. * @copyright (c) 2012 Geolim4
  5. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  6. */
  7.  
  8. /**
  9.  * @ignore
  10.  */
  11. if (!defined('IN_PHPBB'))
  12. {
  13.     exit;
  14. }
  15.  
  16. /**
  17. * Only register the hook for admins pages, not normal pages.
  18. * acp_users_reports()
  19. * Generate List of (unread)report on the main ACP menu
  20. * @no param
  21. */
  22. function acp_users_reports()
  23. {
  24.     global $template, $db, $user, $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
  25.     if (!defined('MYSESS_REPORTS_TABLE'))
  26.     {
  27.         include($phpbb_root_path . 'includes/functions_my_sessions.' . $phpEx);
  28.     }  
  29.     //$user->add_lang('mods/info_acp_my_sessions');
  30.     $report_count = $report_unread = 0;
  31.    
  32.     $sql = $db->sql_build_query('SELECT', array(
  33.         'SELECT'    => 'report_id, report_read',
  34.         'FROM'      => array(MYSESS_REPORTS_TABLE => ''),
  35.         'WHERE'     => 'report_id > 0',
  36.     ));
  37.     $result = $db->sql_query($sql);
  38.     while ( $reports_row = $db->sql_fetchrow($result) )
  39.     {
  40.         $report_count++;
  41.         if ($reports_row['report_read'] == 0)
  42.         {
  43.             $report_unread++;
  44.         }
  45.        
  46.     }
  47.     $db->sql_freeresult($result);
  48.  
  49.     $template->assign_vars(array(
  50.         'S_REPORT_ACP'      => ( (isset($config['ums_mod_enabled']) && isset($config['ums_report_acp']) ) && $config['ums_mod_enabled'] && $config['ums_report_acp'] )  ? true : false,
  51.         'U_REPORT_LINK'     => append_sid("{$phpbb_admin_path}index.$phpEx", "i=my_sessions&amp;mode=reports"),
  52.         'U_REPORT_UNREAD'   => append_sid("{$phpbb_admin_path}index.$phpEx", "i=my_sessions&amp;mode=reports&amp;sel_sort=su&go_sort=1"),
  53.         'REPORTS_COUNT'     => ($report_count >= 1) ? $user->lang('UMS_REPORT_ACP_COUNT', $report_count) : $user->lang('UMS_REPORT_ACP_COUNTS', $report_count),
  54.         'REPORTS_UNREAD'    => ($report_unread >= 1) ? $user->lang('UMS_REPORT_ACP_UNREAD',  $report_unread) : $user->lang('UMS_REPORT_ACP_UNREADS',  $report_unread),
  55.         'S_REPORTS_COUNT'   => $report_count,
  56.         'S_REPORTS_UNREAD'  => $report_unread,
  57.    
  58.     ));
  59. }
  60.  
  61. if ( !defined('ADMIN_START') || !defined('UMIL_AUTO') )
  62. {
  63.     global $config;
  64.    
  65.     if ( isset($config['ums_mod_enabled']) && $config['ums_mod_enabled'] && isset($config['ums_report_acp']) && $config['ums_report_acp'] )
  66.     {
  67.         // start hook      
  68.         $phpbb_hook->register(array('template', 'display'), 'acp_users_reports');
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement