Email on Birthday 1.0.1b

Here my mods and history gets moved when validated and released to the phpbb.com MODDB

Re: Email on Birthday 1.0.1b

Postby lefty » Thu Apr 15, 2010 7:54 pm

danke gleichfalls :thumbsup:
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby FRvNR » Thu Jun 03, 2010 10:14 am

Hallo lefty,

mal eine Frage zu diesem Mod. Besteht die Möglichkeit den Mod dahingehend zu erweitern
das nicht nur eine Mail verschickt wird sondern auch ein entsprechender Eintrag im Forum
gemacht wird. Wir haben die Box "Geburtstagsgrüße und sonstige Glückwünsche" und es
wäre Klasse wenn der Mod hier automatisch einen Eintrag machen würde für das
Geburtstagskind :birthdayparty:
Oder wäre der Mod "Upcoming Birthday" hierfür besser geeignet. Ist übrigens auch eingebaut :thumbsup:

Gruß
Ralf
„Die Menschen müssen lernen wieder zu sehen, was sie anschauen.
Sie müssen ihr Pferd fühlen, um es begreifen zu können.“

Tom Dorrance, 1910 - 2003
FRvNR
Forum Member
 
Posts: 14
Joined: Sun Oct 25, 2009 6:07 pm
Location: Geldern / Germany

Re: Email on Birthday 1.0.1b

Postby lefty » Thu Jun 03, 2010 9:11 pm

Hallo Ralf,
Ich glaube dass waere eher ein neuer Mod.

ist schon einige monate her seit ich so richtig code geschrieben habe und ich glaube nicht dass sich dies in naher zukunft aendert. :newcry2:
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby Bine1860 » Fri Jun 04, 2010 10:16 am

Geht der Mod auch unter der neuesten Version 3.0.7
Can someone confirm, that this mod works under 3.0.7 too

muss was beachtet werden

Bitte / pleaseee
Bine1860
Newbie/Neuling
 
Posts: 3
Joined: Fri Jun 04, 2010 10:13 am

Re: Email on Birthday 1.0.1b

Postby FRvNR » Fri Jun 04, 2010 3:09 pm

lefty wrote:Hallo Ralf,
Ich glaube dass waere eher ein neuer Mod.

ist schon einige monate her seit ich so richtig code geschrieben habe und ich glaube nicht dass sich dies in naher zukunft aendert. :newcry2:

Hm das hört sich ja leider nicht so gut an, naja, nicht so schlimm war ja nur eine Idee

Bine1860 wrote:Geht der Mod auch unter der neuesten Version 3.0.7
Can someone confirm, that this mod works under 3.0.7 too
muss was beachtet werden
Bitte / pleaseee

Also bei mir läuft er unter phpBB 3.0.7-PL1 ohne Probleme und wenn Du die
Install genau befolgst dürfte es auch keins geben.

Gruß
Ralf
„Die Menschen müssen lernen wieder zu sehen, was sie anschauen.
Sie müssen ihr Pferd fühlen, um es begreifen zu können.“

Tom Dorrance, 1910 - 2003
FRvNR
Forum Member
 
Posts: 14
Joined: Sun Oct 25, 2009 6:07 pm
Location: Geldern / Germany

Re: Email on Birthday 1.0.1b

Postby lefty » Fri Jun 04, 2010 10:41 pm

ralf, wenn ich wieder zeit habe und das noch nicht geschrieben wurde bis dahin, schau ich mirs an ;)

bine, sollte ohne probleme auf 3.0.7 zu installieren sein.
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby FRvNR » Wed Aug 04, 2010 5:00 pm

lefty wrote:ralf, wenn ich wieder zeit habe und das noch nicht geschrieben wurde bis dahin, schau ich mirs an ;)

Hätte ich es doch fast vergessen, es gibt schon so einen MOD

Post Bot Mod - New Version 1.0.2

Deutsche-Version bei Chalong and Friends

Gruß
Ralf
„Die Menschen müssen lernen wieder zu sehen, was sie anschauen.
Sie müssen ihr Pferd fühlen, um es begreifen zu können.“

Tom Dorrance, 1910 - 2003
FRvNR
Forum Member
 
Posts: 14
Joined: Sun Oct 25, 2009 6:07 pm
Location: Geldern / Germany

Re: Email on Birthday 1.0.1b

Postby lefty » Wed Aug 04, 2010 8:45 pm

sieht doch recht super aus :) danke fuers sharen :thumbsup:
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby Bine1860 » Fri Aug 06, 2010 7:34 am

Hallooo an alle
dieser Mod ist bei uns auch installiert und funktioniert auch
ABER

im ADMIN log steht immer ein normaler user, der die email verschickt hat. :-?
Image

Das ist doch seltsam, sollte doch eigentlich die Boardemail drin stehen oder zumindest ein admin?
Welche Absenderemailadresse steht denn dann in der eigentlichem email?

php 3.0.7-PL1
style rainbow pearl (basierend auf subsilver)


Bitte Hilfe - Danke
Bine1860
Newbie/Neuling
 
Posts: 3
Joined: Fri Jun 04, 2010 10:13 am

Re: Email on Birthday 1.0.1b

Postby lefty » Fri Aug 06, 2010 8:36 pm

Hallo Bine, das ist normal.

Der Name der dort steht ist lediglich der benutzer der die index.php besucht hat und das email on birthday script hat laufen lassen.
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby selmankara » Tue Sep 14, 2010 5:23 pm

Hi lefty,

in the ACP, the birthday e-mail sending operation is shown, this is good. But the problem is; The shown username -that makes email sending- is a normal user. Not an administrator. How can i fix this? I dont want to see a username of a normal user there. I want to see an administrator's name. Is it possible?

Thank you.
selmankara
Newbie/Neuling
 
Posts: 2
Joined: Tue Sep 14, 2010 5:12 pm

Re: Email on Birthday 1.0.1b

Postby lefty » Tue Sep 14, 2010 7:36 pm

hi, this is normaly behaviour. the mod registers who triggered the script to send the emails which could be a guest user, regular user etc.
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby selmankara » Tue Sep 14, 2010 9:09 pm

How can i change this? In ACP? in phpmyadmin? or in core codes? Whatever you say, i can make...
selmankara
Newbie/Neuling
 
Posts: 2
Joined: Tue Sep 14, 2010 5:12 pm

Re: Email on Birthday 1.0.1b

Postby lefty » Tue Sep 14, 2010 10:41 pm

the only thing i can think of is to temporarily change the $user->data['user_id'] to an admin ID when logging and afterwards put it back to the user's regular id but i really don't see your problem to be honest as it simply just shows you that the script ran and who activated it.
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby itsallaboutmusic » Wed Dec 15, 2010 7:16 am

Ok earlier in the board another had an issue with the placement of the code for the index.php, said he fixed it but did not say how. Below is my index.php and no email is being sent. All file edits I have checked,


I have three sections in the index.php where this code may go. I put it at the first occurrence but I think it's wrong.

Code: Select all
      if (trim($row['user_email']) && $config['birthday_emails'])
      {
         $bd_list_ary[] = array(
            'method'   => $row['user_notify_type'],
            'email'      => $row['user_email'],
            'jabber'   => $row['user_jabber'],
            'name'      => $row['username'],
            'lang'      => $row['user_lang']
         );
      }
   }
   $db->sql_freeresult($result);

   $check_time_bdemail = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));

   if ( sizeof($bd_list_ary) && ($user->data['user_timezone'] == $config['board_timezone'] && $user->data['user_dst'] == $config['board_dst']) && ($config['birthday_run'] != $check_time_bdemail) && $config['birthday_emails'] )
   {
      set_config('birthday_run', $check_time_bdemail);
      
      include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
      $messenger = new messenger();

      foreach ($bd_list_ary as $pos => $addr)
      {
         $messenger->template('birthday_email', $addr['lang']);
         
         $messenger->to($addr['email'], $addr['name']);
         $messenger->im($addr['jabber'], $addr['name']);
         // if you want to receive copies of the birthday emails, just uncomment below line
         //$messenger->cc('your@email.com', 'your_name');
         
         $messenger->assign_vars(array(
            'USERNAME'      => htmlspecialchars_decode($addr['name'])
         ));
         $messenger->send($addr['method']);
         
         $bd_list_log_ary[] = $addr['name'];
      }
      add_log('admin', 'LOG_BIRTHDAY_EMAIL_SENT', implode(', ', $bd_list_log_ary));            
      unset($bd_list_ary);
      unset($bd_list_log_ary);
      
      $messenger->save_queue();
      unset($messenger);
   }




Please advise, for this mod is a good one and I look forward to using it. I am PBPBB3 3.08.


Thanks Lefty...







My Index.php with your code.

Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: index.php 9614 2009-06-18 11:04:54Z nickvergessen $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// IBPro Game Support
$autocom = request_var('autocom', '');
$act = request_var('act', '');
$do = request_var('do','');

if (strtolower($act) == 'arcade' && strtolower($do) == 'newscore')
{
   require($phpbb_root_path . 'includes/arcade/scoretype/ibpro.'.$phpEx);
}

if (strtolower($autocom) == 'arcade')
{
   require($phpbb_root_path . 'includes/arcade/scoretype/ibprov3.'.$phpEx);
}
//IBPro Game Support
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

display_forums('', $config['load_moderators']);

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts   = $config['num_posts'];
$total_topics   = $config['num_topics'];
$total_users   = $config['num_users'];

$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';

// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
   $sql = 'SELECT group_id, group_name, group_colour, group_type
      FROM ' . GROUPS_TABLE . '
      WHERE group_legend = 1
      ORDER BY group_name ASC';
}
else
{
   $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
      FROM ' . GROUPS_TABLE . ' g
      LEFT JOIN ' . USER_GROUP_TABLE . ' ug
         ON (
            g.group_id = ug.group_id
            AND ug.user_id = ' . $user->data['user_id'] . '
            AND ug.user_pending = 0
         )
      WHERE g.group_legend = 1
         AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
      ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
   $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
   $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];

   if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
   {
      $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
   }
   else
   {
      $legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
   }
      if (trim($row['user_email']) && $config['birthday_emails'])
      {
         $bd_list_ary[] = array(
            'method'   => $row['user_notify_type'],
            'email'      => $row['user_email'],
            'jabber'   => $row['user_jabber'],
            'name'      => $row['username'],
            'lang'      => $row['user_lang']
         );
      }
   }
   $db->sql_freeresult($result);

   $check_time_bdemail = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));

   if ( sizeof($bd_list_ary) && ($user->data['user_timezone'] == $config['board_timezone'] && $user->data['user_dst'] == $config['board_dst']) && ($config['birthday_run'] != $check_time_bdemail) && $config['birthday_emails'] )
   {
      set_config('birthday_run', $check_time_bdemail);
      
      include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
      $messenger = new messenger();

      foreach ($bd_list_ary as $pos => $addr)
      {
         $messenger->template('birthday_email', $addr['lang']);
         
         $messenger->to($addr['email'], $addr['name']);
         $messenger->im($addr['jabber'], $addr['name']);
         // if you want to receive copies of the birthday emails, just uncomment below line
         //$messenger->cc('your@email.com', 'your_name');
         
         $messenger->assign_vars(array(
            'USERNAME'      => htmlspecialchars_decode($addr['name'])
         ));
         $messenger->send($addr['method']);
         
         $bd_list_log_ary[] = $addr['name'];
      }
      add_log('admin', 'LOG_BIRTHDAY_EMAIL_SENT', implode(', ', $bd_list_log_ary));            
      unset($bd_list_ary);
      unset($bd_list_log_ary);
      
      $messenger->save_queue();
      unset($messenger);
   }


$legend = implode(', ', $legend);

// Generate birthday list if required ...
$birthday_list = '';

$bd_list_ary = $bd_list_log_ary = array();


if ($config['load_birthdays'] && $config['allow_birthdays'])
{
   $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
   $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday, u.user_email, u.user_lang,u.user_notify_type, u.user_jabber
      FROM ' . USERS_TABLE . ' u
      LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
      WHERE (b.ban_id IS NULL
         OR b.ban_exclude = 1)
         AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
         AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
   $result = $db->sql_query($sql);

   while ($row = $db->sql_fetchrow($result))
   {
      $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      if ($age = (int) substr($row['user_birthday'], -4))
      {
         $birthday_list .= ' (' . ($now['year'] - $age) . ')';
      }
   }
   $db->sql_freeresult($result);
}

if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
   if(!function_exists('get_upcbirthdays'))
   {   
      include($phpbb_root_path . 'includes/functions_upcbirthdays.' . $phpEx);
   }
   get_upcbirthdays();
}

/**
* Ultimate Points
*/
if ( isset($config['points_name']) )
{   
   // Add points lang
   $user->add_lang('mods/points');

   // Generate the bank statistics
   $sql_array = array(
      'SELECT'    => 'SUM(holding) AS total_holding, count(user_id) AS total_users',
      'FROM'      => array(
         POINTS_BANK_TABLE => 'b',
      ),
      'WHERE'      => 'id > 0',
   );
   $sql = $db->sql_build_query('SELECT', $sql_array);
   $result = $db->sql_query($sql);
   $b_row = $db->sql_fetchrow($result);
   $bankholdings = ( $b_row['total_holding'] ) ? $b_row['total_holding'] : 0;
   $bankusers = $b_row['total_users'];

   // Create most rich users - cash and bank
   $limit = $points_values['number_show_top_points'];
   $sql_array = array(
      'SELECT'    => 'u.user_id, u.username, u.user_colour, u.user_points, b.holding',

      'FROM'      => array(
         USERS_TABLE  => 'u',
      ),
      'LEFT_JOIN' => array(
         array(
            'FROM'  => array(POINTS_BANK_TABLE => 'b'),
            'ON'    => 'u.user_id = b.user_id'
         )
      ),
   );
   $sql = $db->sql_build_query('SELECT', $sql_array);
   $result = $db->sql_query($sql);

   // Create a new array for the users
   $rich_users = array();

   // Create sorting array
   $rich_users_sort = array();

   // Loop all users array to escape the 0 points users
   while( $row = $db->sql_fetchrow($result))
   {
      if ( $row['user_points'] > 0 || $row['holding'] > 0 ) //let away beggars
      {
         $total_points = $row['user_points'] + $row['holding'];
         $index = $row['user_id'];
         $rich_users[$index] = array('total_points' => $total_points, 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'user_id' => $index);
         $rich_users_sort[$index] = $total_points;
      }
   }

   $db->sql_freeresult($result);

   // Sort by points desc
   arsort( $rich_users_sort);

   // Extract the user ids
   $rich_users_sort  = array_keys($rich_users_sort);

   // Create new sorted rich users array
   $rich_users_sorted = array();

   // Check, if number of users in array is below the set limit
   $new_limit = sizeof($rich_users) < $limit ? sizeof($rich_users) : $limit;

   for($i = 0; $i < $new_limit; $i++)
   {
      $rich_users_sorted[] = $rich_users[$rich_users_sort[$i]];
   }

   // Send to template
   foreach($rich_users_sorted as $var)
   {
      $template->assign_block_vars('rich_user', array(
         'USERNAME'         => get_username_string('full', $var['user_id'], $var['username'], $var['user_colour']),
         'SUM_POINTS'      => number_format_points($var['total_points']),
         'SUM_POINTS_NAME'   => $config['points_name'],
      ));
   }

   //Generate the points statistics
   $sql_array = array(
      'SELECT'    => 'SUM(user_points) AS total_points',
      'FROM'      => array(
         USERS_TABLE => 'u',
      ),
      'WHERE'      => 'user_points > 0',
   );
   $sql = $db->sql_build_query('SELECT', $sql_array);
   $result = $db->sql_query($sql);
   $b_row = $db->sql_fetchrow($result);
   $totalpoints = ( $b_row['total_points'] ) ? $b_row['total_points'] : 0;
   $lottery_time = $user->format_date(($points_values['lottery_last_draw_time'] + $points_values['lottery_draw_period']), false, true);

   // Run Lottery
   if ( $points_values['lottery_draw_period'] != 0 && $points_values['lottery_last_draw_time'] + $points_values['lottery_draw_period'] - time() < 0 )
   {
      if (!function_exists('run_lottery'))
      {
         include($phpbb_root_path . 'includes/points/functions_points.' . $phpEx);
      }
      if (!function_exists('send_pm'))
      {
         include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
      }
      run_lottery();
   }

   $template->assign_vars(array(
      'TOTAL_BANK_USER'         => sprintf($user->lang['POINTS_BUPOINTS_TOTAL'], $bankusers, $points_values['bank_name']),
      'TOTAL_BANK_POINTS'         => sprintf($user->lang['POINTS_BPOINTS_TOTAL'], number_format_points($bankholdings), $config['points_name'], $points_values['bank_name']),
      'TOTAL_POINTS_USER'         => sprintf($user->lang['POINTS_TOTAL'], number_format_points($totalpoints), $config['points_name']),
      'LOTTERY_TIME'            => sprintf($user->lang['POINTS_LOTTERY_TIME'], $lottery_time),
      'S_DISPLAY_LOTTERY'         => ($points_config['display_lottery_stats']) ? true : false,
      'S_DISPLAY_POINTS_STATS'   => ($points_config['stats_enable']) ? true : false,
      'S_DISPLAY_INDEX'         => ($points_values['number_show_top_points'] > 0) ? true : false,
   ));
}


include($phpbb_root_path . 'includes/functions_milestones.' . $phpEx);
$user->add_lang('mods/milestone_congratulations');

   // BEGIN Welcome Mod
//--Welcome_Mod--get the hour number-->
$date = $user->format_date(time(), 'H');

if ($user->data['is_registered'])
{
    $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
}
else
{
    $u_user_name = $user->lang['WELCOME_GUEST'];
}   

switch (true)
{
        case ($date < 1):
            // if the hour is 11am-12am (18-23)
            $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
        break;
     
         case ($date < 4):
            // if the hour is 1-3 am
            $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
        break;
       
        case ($date < 8):
            // if the hour is 4-7 am
            $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
        break;
       
        case ($date < 12):
            // if the hour is 8-11 am
            $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
        break;
       
        case ($date < 18):
            // if the hour is 12-5pm
            $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
        break;
       
        case ($date < 24):
            // if the hour is 6pm-11pm
            $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
        break;
}

// how long a member for
$member_for = '';
if ($user->data['is_registered'] && !$user->data['is_bot'])
{
    $member_length = time() - $user->data['user_regdate'];
    $years = $months = $days = 0;
    $member_for = '';
    if ($member_length)
    {   
        if ($member_length >= 31536000)
        {
            $years = floor($member_length / 31536000);
            $member_length = $member_length - ($years * 31536000);
            $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
        }
        $months = floor($member_length / 2628000);
        if ($months)
        {
            $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
            $member_length = $member_length - ($months * 2628000);
            $member_for .= $months;
        }
        $days = floor($member_length / 86400);
        if ($days)
        {
            $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
            $member_for .= $days;
        }       
    }
}
//END Welcome Mod

// Assign index specific vars
$template->assign_vars(array(

   'MILESTONE_INFO'   => milestone_info(),
   'MILESTONE_MESSAGE'   => milestone_message(),
   'MILESTONE_HISTORY'   => milestone_history(),



   'TOTAL_POSTS'   => sprintf($user->lang[$l_total_post_s], $total_posts),
   'TOTAL_TOPICS'   => sprintf($user->lang[$l_total_topic_s], $total_topics),
   'TOTAL_USERS'   => sprintf($user->lang[$l_total_user_s], $total_users),
   'NEWEST_USER'   => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),

   // BEGIN Welcome Mod   
    'S_WELCOME'                   => $s_welcome,
    'S_JOINED_DATE'               => $user->lang['JOINED'] . ':&nbsp;' . $user->format_date($user->data['user_regdate']),
    'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
    'MEMBER_FOR'               => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . '&nbsp;' . $member_for : '',
      // END Welcome Mod

   
   'LEGEND'      => $legend,
   
      
   'BIRTHDAY_LIST'   => $birthday_list,

   'FORUM_IMG'            => $user->img('forum_read', 'NO_NEW_POSTS'),
   'FORUM_NEW_IMG'         => $user->img('forum_unread', 'NEW_POSTS'),
   'FORUM_LOCKED_IMG'      => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
   'FORUM_NEW_LOCKED_IMG'   => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
   

   'FORUM_UNREAD_SUBFORUM_IMG'   => $user->img('forum_unread_subforum', 'NEW_POSTS'),   
   'FORUM_READ_SUBFORUM_IMG'   => $user->img('forum_read_subforum', 'NO_NEW_POSTS'),   
   'FORUM_LINK_IMG'   => $user->img('forum_link', 'FORUM_LINK'),
   

   'S_LOGIN_ACTION'         => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
   'S_DISPLAY_BIRTHDAY_LIST'   => ($config['load_birthdays']) ? true : false,

   'U_MARK_FORUMS'      => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums') : '',
   'U_MCP'            => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '')
);

// BEGIN mChat Mod
$mchat_installed = (!empty($config['mchat_on_index']) && !empty($config['mchat_enable'])) ? true : false;
if(!defined('MCHAT_INCLUDE') && $mchat_installed && $auth->acl_get('u_mchat_view') && $user->data['user_mchat_index'])
{
   define('MCHAT_INCLUDE', true);
   $mchat_include_index = true;
   include($phpbb_root_path.'mchat.'.$phpEx);
}
// END mChat Mod

// [+] Karma MOD
$karmamod->toplist();
// [-] Karma MOD

include($phpbb_root_path . 'includes/functions_activity_stats.' . $phpEx);
activity_mod();


// Output page
page_header($user->lang['INDEX']);

$template->set_filenames(array(
   'body' => 'index_body.html')
);

page_footer();

?>
itsallaboutmusic
Newbie/Neuling
 
Posts: 1
Joined: Wed Dec 15, 2010 7:10 am

Re: Email on Birthday 1.0.1b

Postby lefty » Thu Dec 23, 2010 8:42 pm

hi sorry i missed this, glad it's working for you now :)
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby samlauncher » Mon Jan 17, 2011 7:52 am

Appreciated info, its good to know..
samlauncher
Newbie/Neuling
 
Posts: 1
Joined: Mon Jan 17, 2011 7:46 am

Re: Email on Birthday 1.0.1b

Postby Blackwolf » Thu Jan 27, 2011 10:35 am

Hi lefty !! Huge fan of your mods :thumbsup: Have 6/7

I have a small issue with this one.....I am Grey-Bearded Geek ( test user from way back )

Screenshot.png
3 emails sent...( screenshot from ACP )
Screenshot.png (7.42 KiB) Viewed 14120 times


& sometimes it will send not 1 but 3 as it did on this occasion.... :thinking:

I did recently upgrade your popup on birthday mod works fine after
Code: Select all
ALTER TABLE phpbb_users ADD user_birthday_popup INT( 11 ) UNSIGNED NOT NULL
DEFAULT '0';
:cheer: I received the 3 emails so I know it's working !!

Might be a mis edit on my part. :write:
My forum is http://www.ultimateeditionoz.com/forum/index.php
PhpBB3 Version: 3.0.10
Oz Unity
Ultimate Edition
Ultimate Edition Oz

We are Anonymous. We are Legion. We do not forgive. We do not forget. Expect us.
Blackwolf
Forum Member
 
Posts: 25
Joined: Thu Jan 27, 2011 10:18 am
Location: Melbourne, Australia

Re: Email on Birthday 1.0.1b

Postby lefty » Thu Jan 27, 2011 9:43 pm

hi blackwolf, thanks :)

that is odd, i'll try to take a look this weekend.
would you happen to have noticed any similarities between those cases when it happened?
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby Blackwolf » Thu Jan 27, 2011 10:49 pm

lefty wrote:hi blackwolf, thanks :)

that is odd, i'll try to take a look this weekend.
would you happen to have noticed any similarities between those cases when it happened?

No...I had never gotten the popup on birthday to work until I re checked all my edits and ran the 2nd line in myadmin after a forum crash....Tested the popup last night & it worked without a hitch. :thumbsup:
The birthday email is superb but might annoy some people getting 3 :rotfl2:

Appreciate your looking into it. Take your time. :happysmerk:
PhpBB3 Version: 3.0.10
Oz Unity
Ultimate Edition
Ultimate Edition Oz

We are Anonymous. We are Legion. We do not forgive. We do not forget. Expect us.
Blackwolf
Forum Member
 
Posts: 25
Joined: Thu Jan 27, 2011 10:18 am
Location: Melbourne, Australia

Re: Email on Birthday 1.0.1b

Postby lefty » Fri Jan 28, 2011 9:40 pm

i only get one email on my testboard (3.0.8) and i have all my mods installed on it.

here is the index.php from it, you may want to compare it to yours:
Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: index.php 9614 2009-06-18 11:04:54Z nickvergessen $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

display_forums('', $config['load_moderators']);

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts   = $config['num_posts'];
$total_topics   = $config['num_topics'];
$total_users   = $config['num_users'];

$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';

// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
   $sql = 'SELECT group_id, group_name, group_colour, group_type
      FROM ' . GROUPS_TABLE . '
      WHERE group_legend = 1
      ORDER BY group_name ASC';
}
else
{
   $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
      FROM ' . GROUPS_TABLE . ' g
      LEFT JOIN ' . USER_GROUP_TABLE . ' ug
         ON (
            g.group_id = ug.group_id
            AND ug.user_id = ' . $user->data['user_id'] . '
            AND ug.user_pending = 0
         )
      WHERE g.group_legend = 1
         AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
      ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
   $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
   $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];

   if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
   {
      $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
   }
   else
   {
      $legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
   }
}
$db->sql_freeresult($result);

$legend = implode(', ', $legend);

// Generate birthday list if required ...
$birthday_list = '';
$bd_list_ary = $bd_list_log_ary = array();

if ($config['load_birthdays'] && $config['allow_birthdays'])
{
   $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
   $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday, u.user_email, u.user_lang,u.user_notify_type, u.user_jabber
      FROM ' . USERS_TABLE . ' u
      LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
      WHERE (b.ban_id IS NULL
         OR b.ban_exclude = 1)
         AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
         AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
   $result = $db->sql_query($sql);

   while ($row = $db->sql_fetchrow($result))
   {
      $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      if ($age = (int) substr($row['user_birthday'], -4))
      {
         $birthday_list .= ' (' . ($now['year'] - $age) . ')';
      }

      if (trim($row['user_email']) && $config['birthday_emails'])
      {
         $bd_list_ary[] = array(
            'method'   => $row['user_notify_type'],
            'email'      => $row['user_email'],
            'jabber'   => $row['user_jabber'],
            'name'      => $row['username'],
            'lang'      => $row['user_lang']
         );
      }
   }
   $db->sql_freeresult($result);

   $check_time_bdemail = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));

   if ( sizeof($bd_list_ary) && ($user->data['user_timezone'] == $config['board_timezone'] && $user->data['user_dst'] == $config['board_dst']) && ($config['birthday_run'] != $check_time_bdemail) && $config['birthday_emails'] )
   {
      set_config('birthday_run', $check_time_bdemail);
      
      include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
      $messenger = new messenger();

      foreach ($bd_list_ary as $pos => $addr)
      {
         $messenger->template('birthday_email', $addr['lang']);
         
         $messenger->to($addr['email'], $addr['name']);
         $messenger->im($addr['jabber'], $addr['name']);
         // if you want to receive copies of the birthday emails, just uncomment below line
         //$messenger->cc('your@email.com', 'your_name');
         
         $messenger->assign_vars(array(
            'USERNAME'      => htmlspecialchars_decode($addr['name'])
         ));
         $messenger->send($addr['method']);
         
         $bd_list_log_ary[] = $addr['name'];
      }
      add_log('admin', 'LOG_BIRTHDAY_EMAIL_SENT', implode(', ', $bd_list_log_ary));            
      unset($bd_list_ary);
      unset($bd_list_log_ary);
      
      $messenger->save_queue();
      unset($messenger);
   }

   }

if ( isset($config['announcement_enable']))
{
   if ( $config['announcement_show_index'] && ($config['announcement_enable'] || $config['announcement_show_birthdays_always']) )
   {
      if (!function_exists('get_announcement_data'))
      {
         include_once($phpbb_root_path . 'includes/functions_announcements.' . $phpEx);
      }
      get_announcement_data();
   }
}
//print_r(get_defined_constants(true));

//Generate top poster list if enabled
if ($config['amount_top_posters'])
{
   if (!function_exists('get_top_posters'))
   {   
      include_once($phpbb_root_path . 'includes/functions_topposter.' . $phpEx);
   }
   get_top_posters();
}

if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
   if(!function_exists('get_upcbirthdays'))
   {   
      include_once($phpbb_root_path . 'includes/functions_upcbirthdays.' . $phpEx);
   }
   get_upcbirthdays();
}

// if automatic reminders is set, remind people. lets only run this once a day.
if (isset($config['user_reminder_enable']))
{
   if ( $config['user_reminder_enable'] == ENABLED )
   {
      $check_time = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));
   
      if ( $config['user_reminder_last_auto_run'] != $check_time)
      {
         if (!function_exists('send_user_reminders'))
         {
            include($phpbb_root_path . 'includes/functions_user_reminder.' . $phpEx);
         }
         
         send_user_reminders();
         
         if ($config['user_reminder_log_opt_users_react'])
         {
            add_log('admin', 'LOG_USER_REMINDER_AUTO_RUN');
         }
         
         set_config('user_reminder_last_auto_run', $check_time);
      }
   }
}

// Assign index specific vars
$template->assign_vars(array(
   'TOTAL_POSTS'   => sprintf($user->lang[$l_total_post_s], $total_posts),
   'TOTAL_TOPICS'   => sprintf($user->lang[$l_total_topic_s], $total_topics),
   'TOTAL_USERS'   => sprintf($user->lang[$l_total_user_s], $total_users),
   'NEWEST_USER'   => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),

   'LEGEND'      => $legend,
   'BIRTHDAY_LIST'   => $birthday_list,

   'FORUM_IMG'            => $user->img('forum_read', 'NO_UNREAD_POSTS'),
   'FORUM_UNREAD_IMG'         => $user->img('forum_unread', 'UNREAD_POSTS'),
   'FORUM_LOCKED_IMG'      => $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'),
   'FORUM_UNREAD_LOCKED_IMG'   => $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'),

   'S_LOGIN_ACTION'         => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
   'S_DISPLAY_BIRTHDAY_LIST'   => ($config['load_birthdays']) ? true : false,

   'U_MARK_FORUMS'      => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums') : '',
   'U_MCP'            => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '')
);

// Output page
page_header($user->lang['INDEX']);

$template->set_filenames(array(
   'body' => 'index_body.html')
);

page_footer();

?>
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby Blackwolf » Sat Jan 29, 2011 12:13 am

Thanks...will compare it later on tonight. :thumbsup:
PhpBB3 Version: 3.0.10
Oz Unity
Ultimate Edition
Ultimate Edition Oz

We are Anonymous. We are Legion. We do not forgive. We do not forget. Expect us.
Blackwolf
Forum Member
 
Posts: 25
Joined: Thu Jan 27, 2011 10:18 am
Location: Melbourne, Australia

Re: Email on Birthday 1.0.1b

Postby Blackwolf » Sat Jan 29, 2011 5:12 am

ummmmm :embarrassed:
Found 3 instances of the below code in index.php...woops !
Code: Select all
$check_time_bdemail = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));

   if ( sizeof($bd_list_ary) && ($user->data['user_timezone'] == $config['board_timezone'] && $user->data['user_dst'] == $config['board_dst']) && ($config['birthday_run'] != $check_time_bdemail) && $config['birthday_emails'] )
   {
      set_config('birthday_run', $check_time_bdemail);
      
      include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
      $messenger = new messenger();

      foreach ($bd_list_ary as $pos => $addr)
      {
         $messenger->template('birthday_email', $addr['lang']);
         
         $messenger->to($addr['email'], $addr['name']);
         $messenger->im($addr['jabber'], $addr['name']);
         // if you want to receive copies of the birthday emails, just uncomment below line
         //$messenger->cc('your@email.com', 'your_name');
         
         $messenger->assign_vars(array(
            'USERNAME'      => htmlspecialchars_decode($addr['name'])
         ));
         $messenger->send($addr['method']);
         
         $bd_list_log_ary[] = $addr['name'];
      }
      add_log('admin', 'LOG_BIRTHDAY_EMAIL_SENT', implode(', ', $bd_list_log_ary));            
      unset($bd_list_ary);
      unset($bd_list_log_ary);
      
      $messenger->save_queue();
      unset($messenger);
   }

I tried to delete 2 of them but has some errors, think it's okay now..no errors....could I trouble you (if you don't mind ) check my edits as I removed the 2 extras :scared3: Final as per my below attached /forum/index.php please !! :unfurlhelp: Sometimes my index page takes so long to load/edit posts...would you mind giving it the once over please ?
Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: index.php 9614 2009-06-18 11:04:54Z nickvergessen $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');


display_forums('', $config['load_moderators']);

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts   = $config['num_posts'];
$total_topics   = $config['num_topics'];
$total_users   = $config['num_users'];
$total_files      = $config['num_files'];
$start_date     = date("d M Y, H:i:s", $config['board_startdate'] );
$boarddays       = ceil((time() - $config['board_startdate']) / 86400);
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
$l_total_file_s = ($total_files == 0) ? 'TOTAL_FILES_ZERO' : 'TOTAL_FILES_OTHER';
$posts_per_day = $total_posts / $boarddays;
$l_posts_per_day_s = ($posts_per_day == 0) ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
$posts_per_year = $posts_per_day * 365;
$l_posts_per_year_s = ($posts_per_year == 0) ? 'POSTS_PER_YEAR_ZERO' : 'POSTS_PER_YEAR_OTHER';
$posts_per_user = $total_posts / $total_users;
$l_posts_per_user_s = ($posts_per_user == 0) ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
$posts_per_topic = $total_posts / $total_topics;
$l_posts_per_topic_s = ($posts_per_topic == 0) ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';
$topics_per_day = $total_topics / $boarddays;
$l_topics_per_day_s = ($topics_per_day == 0) ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
$topics_per_year = $topics_per_day * 365;
$l_topics_per_year_s = ($topics_per_year == 0) ? 'TOPICS_PER_YEAR_ZERO' : 'TOPICS_PER_YEAR_OTHER';
$topics_per_user = $total_topics / $total_users;
$l_topics_per_user_s = ($topics_per_user == 0) ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
$files_per_day = $total_files / $boarddays;
$l_files_per_day_s = ($files_per_day == 0) ? 'FILES_PER_DAY_ZERO' : 'FILES_PER_DAY_OTHER';
$files_per_year = $files_per_day * 365;
$l_files_per_year_s = ($files_per_year == 0) ? 'FILES_PER_YEAR_ZERO' : 'FILES_PER_YEAR_OTHER';
$files_per_user = $total_files / $total_users;
$l_files_per_user_s = ($files_per_day == 0) ? 'FILES_PER_USER_ZERO' : 'FILES_PER_USER_OTHER';
$users_per_day = $total_users / $boarddays;
$l_users_per_day_s = ($users_per_day == 0) ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
$users_per_year = $users_per_day * 365;
$l_users_per_year_s = ($users_per_year == 0) ? 'USERS_PER_YEAR_ZERO' : 'USERS_PER_YEAR_OTHER';
// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
   $sql = 'SELECT group_id, group_name, group_colour, group_type
      FROM ' . GROUPS_TABLE . '
      WHERE group_legend = 1
      ORDER BY group_name ASC';
}
else
{
   $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
      FROM ' . GROUPS_TABLE . ' g
      LEFT JOIN ' . USER_GROUP_TABLE . ' ug
         ON (
            g.group_id = ug.group_id
            AND ug.user_id = ' . $user->data['user_id'] . '
            AND ug.user_pending = 0
         )
      WHERE g.group_legend = 1
         AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
      ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
   $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
   $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];

   if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
   {
      $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
   }
   else
   {
      $legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
   }
}
$db->sql_freeresult($result);

$legend = implode(' | ', $legend);

// Generate birthday list if required ...
$birthday_list = '';
$bd_list_ary = $bd_list_log_ary = array();

if ($config['load_birthdays'] && $config['allow_birthdays'])
{
   $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
   $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday, u.user_email, u.user_lang,u.user_notify_type, u.user_jabber
      FROM ' . USERS_TABLE . ' u
      LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
      WHERE (b.ban_id IS NULL
         OR b.ban_exclude = 1)
         AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
         AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
   $result = $db->sql_query($sql);

   while ($row = $db->sql_fetchrow($result))
   {
      $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      if ($age = (int) substr($row['user_birthday'], -4))
      {
         $birthday_list .= ' (' . ($now['year'] - $age) . ')';
      }
// Show amount of reported and queue posts for authenticated users
if ($auth->acl_getf_global('m_report') || $auth->acl_getf_global('m_approve'))
{
   if (!function_exists('get_forum_list'))
   {
      include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
   }
   $user->add_lang('mcp');
   
   // Reported Posts
   $forum_list = get_forum_list('m_report');
   if (!empty($forum_list))
   {
      $sql = 'SELECT COUNT(r.report_id) AS total_reported
         FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
         WHERE r.post_id = p.post_id
            AND r.report_closed = 0
            AND ' . $db->sql_in_set('p.forum_id', $forum_list);
      $result = $db->sql_query($sql);
      $total_reported = (int) $db->sql_fetchfield('total_reported');
      $db->sql_freeresult($result);

      if ($total_reported)
      {         
         $template->assign_vars(array(
            'L_REPORTS_TOTAL'   => ($total_reported == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total_reported),
            'U_MCP_REPORTS'      => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports'))
         );
      }
   }
   
   // Reported PMs
   $sql = 'SELECT COUNT(report_id) AS total_pm_reported
      FROM ' . REPORTS_TABLE . ' 
      WHERE pm_id <> 0
         AND report_closed = 0';
   $result = $db->sql_query($sql);
   $total_pm_reported = (int) $db->sql_fetchfield('total_pm_reported');
   $db->sql_freeresult($result);

   if ($total_pm_reported)
   {         
      $template->assign_vars(array(
         'L_PM_REPORTS_TOTAL'   => ($total_pm_reported == 1) ? $user->lang['PM_REPORT_TOTAL'] : sprintf($user->lang['PM_REPORTS_TOTAL'], $total_pm_reported),
         'U_MCP_PM_REPORTS'      => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports'))
      );
   }
   
   // Posts and Topics in the Queue
   $forum_list = get_forum_list('m_approve');
   if (!empty($forum_list))
   {
      // Get the queue topics and posts in 1 query :)
      $sql = 'SELECT COUNT(t.topic_id) AS total_queue_topics, (
                     SELECT COUNT(p.post_id)
                     FROM ' . POSTS_TABLE . ' p
                     WHERE p.post_approved = 0
                        AND ' . $db->sql_in_set('p.forum_id', $forum_list) . ' ) AS total_queue_posts
            FROM ' . TOPICS_TABLE . ' t
            WHERE t.topic_approved = 0
               AND ' . $db->sql_in_set('t.forum_id', $forum_list);
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      // Topics contain posts, so let's remove these
      $total_queue_posts = $row['total_queue_posts'] - $row['total_queue_topics'];      
      $total_queue_topics = $row['total_queue_topics'];
      
      if ($total_queue_posts)
      {
         $template->assign_vars(array(
            'L_UNAPPROVED_POSTS_TOTAL'   => ($total_queue_posts == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total_queue_posts),
            'U_MCP_POSTS_QUEUE'         => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=unapproved_posts'))
         );
      }
      
      if ($total_queue_topics)
      {
         $template->assign_vars(array(
            'L_UNAPPROVED_TOPICS_TOTAL'   => ($total_queue_topics == 1) ? $user->lang['UNAPPROVED_TOPIC_TOTAL'] : sprintf($user->lang['UNAPPROVED_TOPICS_TOTAL'], $total_queue_topics),
            'U_MCP_TOPICS_QUEUE'      => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=unapproved_topics'))
         );
      }
      
   }   
}
         if (trim($row['user_email']) && $config['birthday_emails'])
      {
         $bd_list_ary[] = array(
            'method'   => $row['user_notify_type'],
            'email'      => $row['user_email'],
            'jabber'   => $row['user_jabber'],
            'name'      => $row['username'],
            'lang'      => $row['user_lang']
         );
      }
         if (trim($row['user_email']) && $config['birthday_emails'])
      {
         $bd_list_ary[] = array(
            'method'   => $row['user_notify_type'],
            'email'      => $row['user_email'],
            'jabber'   => $row['user_jabber'],
            'name'      => $row['username'],
            'lang'      => $row['user_lang']
         );
      }
         if (trim($row['user_email']) && $config['birthday_emails'])
      {
         $bd_list_ary[] = array(
            'method'   => $row['user_notify_type'],
            'email'      => $row['user_email'],
            'jabber'   => $row['user_jabber'],
            'name'      => $row['username'],
            'lang'      => $row['user_lang']
         );
      }
   }
   $db->sql_freeresult($result);

       $check_time_bdemail = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));

       if ( sizeof($bd_list_ary) && ($user->data['user_timezone'] == $config['board_timezone'] && $user->data['user_dst'] == $config['board_dst']) && ($config['birthday_run'] != $check_time_bdemail) && $config['birthday_emails'] )
       {
          set_config('birthday_run', $check_time_bdemail);
         
          include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
          $messenger = new messenger();

          foreach ($bd_list_ary as $pos => $addr)
          {
             $messenger->template('birthday_email', $addr['lang']);
             
             $messenger->to($addr['email'], $addr['name']);
             $messenger->im($addr['jabber'], $addr['name']);
             // if you want to receive copies of the birthday emails, just uncomment below line
             //$messenger->cc('your@email.com', 'your_name');
             
             $messenger->assign_vars(array(
                'USERNAME'      => htmlspecialchars_decode($addr['name'])
             ));
             $messenger->send($addr['method']);
             
             $bd_list_log_ary[] = $addr['name'];
          }
          add_log('admin', 'LOG_BIRTHDAY_EMAIL_SENT', implode(', ', $bd_list_log_ary));           
          unset($bd_list_ary);
          unset($bd_list_log_ary);
         
          $messenger->save_queue();
          unset($messenger);
       }

       }

if (!function_exists('display_who_was_here'))
{
   include($phpbb_root_path . 'includes/functions_wwh.' . $phpEx);
}
display_who_was_here();

    // BEGIN Welcome Mod
    //--Welcome_Mod--get the hour number-->
    $date = $user->format_date(time(), 'H');

    if ($user->data['is_registered'])
    {
        $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
    }
    else
    {
        $u_user_name = $user->lang['WELCOME_GUEST'];
    }   

    switch (true)
    {
            case ($date < 1):
                // if the hour is 6pm-11pm (18-23)
                $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
            break;
         
          case ($date < 4):
                // if the hour is 1-3 am
                $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
            break;
           
            case ($date < 8):
                // if the hour is 4-7 am
                $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
            break;
           
            case ($date < 12):
                // if the hour is 8-11 am
                $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
            break;
           
            case ($date < 18):
                // if the hour is 12-5pm (12-17)
                $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
            break;
           
            case ($date < 24):
                // if the hour is 6pm-11pm (18-23_
                $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
            break;
    }

    // how long a member for
    $member_for = '';
    if ($user->data['is_registered'] && !$user->data['is_bot'])
    {
        $member_length = time() - $user->data['user_regdate'];
        $years = $months = $days = 0;
        $member_for = '';
        if ($member_length)
        {   
            if ($member_length >= 31536000)
            {
                $years = floor($member_length / 31536000);
                $member_length = $member_length - ($years * 31536000);
                $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
            }
            $months = floor($member_length / 2628000);
            if ($months)
            {
                $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
                $member_length = $member_length - ($months * 2628000);
                $member_for .= $months;
            }
            $days = floor($member_length / 86400);
            if ($days)
            {
                $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
                $member_for .= $days;
            }       
        }
    }
    //END Welcome Mod
if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
   if(!function_exists('get_upcbirthdays'))
   {   
      include($phpbb_root_path . 'includes/functions_upcbirthdays.' . $phpEx);
   }
   get_upcbirthdays();
}
//-- mod: top five ---------------------------------------------------------//
   include($phpbb_root_path . 'includes/top_five.' . $phpEx);
//-- end: top five ---------------------------------------------------------//

// if automatic reminders is set, remind people. lets only run this once a day.
if (isset($config['user_reminder_enable']))
{
   if ( $config['user_reminder_enable'] == ENABLED )
   {
      $check_time = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));
   
      if ( $config['user_reminder_last_auto_run'] != $check_time)
      {
         if (!function_exists('send_user_reminders'))
         {
            include($phpbb_root_path . 'includes/functions_user_reminder.' . $phpEx);
         }
         
         send_user_reminders();
         
         if ($config['user_reminder_log_opt_users_react'])
         {
            add_log('admin', 'LOG_USER_REMINDER_AUTO_RUN');
         }
         
         set_config('user_reminder_last_auto_run', $check_time);
      }
   }
}

if ( isset($config['announcement_enable']))
{
   if ( $config['announcement_show_index'] && ($config['announcement_enable'] || $config['announcement_show_birthdays_always']) )
   {
      if (!function_exists('get_announcement_data'))
      {
         include($phpbb_root_path . 'includes/functions_announcements.' . $phpEx);
      }
      get_announcement_data();
   }
}
// BEGIN Welcome Mod
//--Welcome_Mod--get the hour number-->
$date = $user->format_date(time(), 'H');

if ($user->data['is_registered'])
{
    $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
}
else
{
    $u_user_name = $user->lang['WELCOME_GUEST'];
}   

switch (true)
{
        case ($date < 1):
            // if the hour is 11am-12am (18-23)
            $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
        break;
     
         case ($date < 4):
            // if the hour is 1-3 am
            $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
        break;
       
        case ($date < 8):
            // if the hour is 4-7 am
            $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
        break;
       
        case ($date < 12):
            // if the hour is 8-11 am
            $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
        break;
       
        case ($date < 18):
            // if the hour is 12-5pm
            $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
        break;
       
        case ($date < 24):
            // if the hour is 6pm-11pm
            $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
        break;
}

// how long a member for
$member_for = '';
if ($user->data['is_registered'] && !$user->data['is_bot'])
{
    $member_length = time() - $user->data['user_regdate'];
    $years = $months = $days = 0;
    $member_for = '';
    if ($member_length)
    {   
        if ($member_length >= 31536000)
        {
            $years = floor($member_length / 31536000);
            $member_length = $member_length - ($years * 31536000);
            $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
        }
        $months = floor($member_length / 2628000);
        if ($months)
        {
            $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
            $member_length = $member_length - ($months * 2628000);
            $member_for .= $months;
        }
        $days = floor($member_length / 86400);
        if ($days)
        {
            $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
            $member_for .= $days;
        }       
    }
}
//END Welcome Mod
//-- mod: Top Poster of the Month ----------------------------------------------------------//
// if the user is a bot, we won’t even process this function...
if (!$user->data['is_bot'])
{
   include($phpbb_root_path . 'includes/functions_tpotm.' . $phpEx);
   tpotm_set_template_vars();
}
//-- end: Top Poster Of The Month ----------------------------------------------------------//
// Assign index specific vars
$template->assign_vars(array(
      'TOTAL_POSTS'    => sprintf($user->lang[$l_total_post_s], number_format($total_posts, 0, ',', '.')),
    'POSTS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_day_s], $posts_per_day)),
    'POSTS_PER_YEAR'    => sprintf($user->lang[$l_posts_per_year_s], number_format($posts_per_year, 0, ',', '.')),
    'POSTS_PER_TOPIC'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_topic_s], $posts_per_topic)),
    'POSTS_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_user_s], $posts_per_user)),
    'TOTAL_TOPICS'    => sprintf($user->lang[$l_total_topic_s], number_format($total_topics, 0, ',', '.')),
    'TOPICS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_topics_per_day_s], $topics_per_day)),
    'TOPICS_PER_YEAR'   => sprintf($user->lang[$l_topics_per_year_s], number_format($topics_per_year, 0, ',', '.')),
    'TOPICS_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_topics_per_user_s], $topics_per_user)),
    'TOTAL_FILES'    => sprintf($user->lang[$l_total_file_s], number_format($total_files, 0, ',', '.')),
    'FILES_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_files_per_day_s], $files_per_day)),
    'FILES_PER_YEAR'    => sprintf($user->lang[$l_files_per_year_s], number_format($files_per_year, 0, ',', '.')),
    'FILES_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_files_per_user_s], $files_per_user)),
    'TOTAL_USERS'    => sprintf($user->lang[$l_total_user_s], number_format($total_users, 0, ',', '.')),
    'USERS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_users_per_day_s], $users_per_day)),
    'USERS_PER_YEAR'    => sprintf($user->lang[$l_users_per_year_s], number_format($users_per_year, 0, ',', '.')),
    'NEWEST_USER'   => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
    'START_DATE'         => $start_date,

       // BEGIN Welcome Mod   
    'S_WELCOME'                   => $s_welcome,
    'S_JOINED_DATE'               => $user->lang['JOINED'] . ':&nbsp;' . $user->format_date($user->data['user_regdate']),
    'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
    'MEMBER_FOR'               => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . '&nbsp;' . $member_for : '',
      // END Welcome Mod

   'LEGEND'      => $legend,
   'BIRTHDAY_LIST'   => $birthday_list,

   'FORUM_IMG'            => $user->img('forum_read', 'NO_NEW_POSTS'),
   'FORUM_NEW_IMG'         => $user->img('forum_unread', 'NEW_POSTS'),
   'FORUM_LOCKED_IMG'      => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
   'FORUM_NEW_LOCKED_IMG'   => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),

   'S_LOGIN_ACTION'         => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
   'S_DISPLAY_BIRTHDAY_LIST'   => ($config['load_birthdays']) ? true : false,
    'SEO_DESC'                 => (isset($config['seo_desc']) && $config['seo_desc']) ? $config['seo_desc'] : false,
    'SEO_KEY'                    => (isset($config['seo_key']) && $config['seo_key']) ? $config['seo_key'] : false,

   
   'U_MARK_FORUMS'      => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums') : '',
   'U_MCP'            => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '')
);

// BEGIN mChat Mod
if(!defined('MCHAT_INCLUDE') && $config['mchat_on_index'] && $config['mchat_enable'] && $auth->acl_get('u_mchat_view'))
{
   define('MCHAT_INCLUDE', true);
   $mchat_include_index = true;
   include($phpbb_root_path.'mchat.'.$phpEx);
}
// END mChat Mod
// BEGAN - ModernDignity.com Hello Name Tag of Newest User mod
   include($phpbb_root_path . 'includes/hellotag.' . $phpEx);
// ENDED - ModernDignity.com Hello Name Tag of Newest User mod

// BEGAN - ModernDignity.com Flash Animated Cumulus Tag Cloud
if (!function_exists('display_cloud'))
{
   include($phpbb_root_path . 'includes/functions_cloud.' . $phpEx);
}
display_cloud();
// ENDED - ModernDignity.com Flash Animated Cumulus Tag Cloud
// Output page
page_header('Oz Unity');

$template->set_filenames(array(
   'body' => 'index_body.html')
);

page_footer();

?>


Appreciate it so very much ! :thumbsup:
PhpBB3 Version: 3.0.10
Oz Unity
Ultimate Edition
Ultimate Edition Oz

We are Anonymous. We are Legion. We do not forgive. We do not forget. Expect us.
Blackwolf
Forum Member
 
Posts: 25
Joined: Thu Jan 27, 2011 10:18 am
Location: Melbourne, Australia

Re: Email on Birthday 1.0.1b

Postby lefty » Sat Jan 29, 2011 5:56 pm

hmm, those 3 instances of the edit were still in the code you pasted. there was also some code in between the birthday code
Code: Select all
// Show amount of reported and queue posts for authenticated users
.....


so I moved that one.

i haven't looked much further but you can try this one:

Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: index.php 9614 2009-06-18 11:04:54Z nickvergessen $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');


display_forums('', $config['load_moderators']);

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts   = $config['num_posts'];
$total_topics   = $config['num_topics'];
$total_users   = $config['num_users'];
$total_files      = $config['num_files'];
$start_date     = date("d M Y, H:i:s", $config['board_startdate'] );
$boarddays       = ceil((time() - $config['board_startdate']) / 86400);
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
$l_total_file_s = ($total_files == 0) ? 'TOTAL_FILES_ZERO' : 'TOTAL_FILES_OTHER';
$posts_per_day = $total_posts / $boarddays;
$l_posts_per_day_s = ($posts_per_day == 0) ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
$posts_per_year = $posts_per_day * 365;
$l_posts_per_year_s = ($posts_per_year == 0) ? 'POSTS_PER_YEAR_ZERO' : 'POSTS_PER_YEAR_OTHER';
$posts_per_user = $total_posts / $total_users;
$l_posts_per_user_s = ($posts_per_user == 0) ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
$posts_per_topic = $total_posts / $total_topics;
$l_posts_per_topic_s = ($posts_per_topic == 0) ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';
$topics_per_day = $total_topics / $boarddays;
$l_topics_per_day_s = ($topics_per_day == 0) ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
$topics_per_year = $topics_per_day * 365;
$l_topics_per_year_s = ($topics_per_year == 0) ? 'TOPICS_PER_YEAR_ZERO' : 'TOPICS_PER_YEAR_OTHER';
$topics_per_user = $total_topics / $total_users;
$l_topics_per_user_s = ($topics_per_user == 0) ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
$files_per_day = $total_files / $boarddays;
$l_files_per_day_s = ($files_per_day == 0) ? 'FILES_PER_DAY_ZERO' : 'FILES_PER_DAY_OTHER';
$files_per_year = $files_per_day * 365;
$l_files_per_year_s = ($files_per_year == 0) ? 'FILES_PER_YEAR_ZERO' : 'FILES_PER_YEAR_OTHER';
$files_per_user = $total_files / $total_users;
$l_files_per_user_s = ($files_per_day == 0) ? 'FILES_PER_USER_ZERO' : 'FILES_PER_USER_OTHER';
$users_per_day = $total_users / $boarddays;
$l_users_per_day_s = ($users_per_day == 0) ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
$users_per_year = $users_per_day * 365;
$l_users_per_year_s = ($users_per_year == 0) ? 'USERS_PER_YEAR_ZERO' : 'USERS_PER_YEAR_OTHER';
// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
   $sql = 'SELECT group_id, group_name, group_colour, group_type
      FROM ' . GROUPS_TABLE . '
      WHERE group_legend = 1
      ORDER BY group_name ASC';
}
else
{
   $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
      FROM ' . GROUPS_TABLE . ' g
      LEFT JOIN ' . USER_GROUP_TABLE . ' ug
         ON (
            g.group_id = ug.group_id
            AND ug.user_id = ' . $user->data['user_id'] . '
            AND ug.user_pending = 0
         )
      WHERE g.group_legend = 1
         AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
      ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
   $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
   $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];

   if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
   {
      $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
   }
   else
   {
      $legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
   }
}
$db->sql_freeresult($result);

$legend = implode(' | ', $legend);

// Generate birthday list if required ...
$birthday_list = '';
$bd_list_ary = $bd_list_log_ary = array();

if ($config['load_birthdays'] && $config['allow_birthdays'])
{
   $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
   $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday, u.user_email, u.user_lang,u.user_notify_type, u.user_jabber
      FROM ' . USERS_TABLE . ' u
      LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
      WHERE (b.ban_id IS NULL
         OR b.ban_exclude = 1)
         AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
         AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
   $result = $db->sql_query($sql);

   while ($row = $db->sql_fetchrow($result))
   {
      $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      if ($age = (int) substr($row['user_birthday'], -4))
      {
         $birthday_list .= ' (' . ($now['year'] - $age) . ')';
      }

         if (trim($row['user_email']) && $config['birthday_emails'])
      {
         $bd_list_ary[] = array(
            'method'   => $row['user_notify_type'],
            'email'      => $row['user_email'],
            'jabber'   => $row['user_jabber'],
            'name'      => $row['username'],
            'lang'      => $row['user_lang']
         );
      }
   }
   $db->sql_freeresult($result);

       $check_time_bdemail = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));

       if ( sizeof($bd_list_ary) && ($user->data['user_timezone'] == $config['board_timezone'] && $user->data['user_dst'] == $config['board_dst']) && ($config['birthday_run'] != $check_time_bdemail) && $config['birthday_emails'] )
       {
          set_config('birthday_run', $check_time_bdemail);
         
          include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
          $messenger = new messenger();

          foreach ($bd_list_ary as $pos => $addr)
          {
             $messenger->template('birthday_email', $addr['lang']);
             
             $messenger->to($addr['email'], $addr['name']);
             $messenger->im($addr['jabber'], $addr['name']);
             // if you want to receive copies of the birthday emails, just uncomment below line
             //$messenger->cc('your@email.com', 'your_name');
             
             $messenger->assign_vars(array(
                'USERNAME'      => htmlspecialchars_decode($addr['name'])
             ));
             $messenger->send($addr['method']);
             
             $bd_list_log_ary[] = $addr['name'];
          }
          add_log('admin', 'LOG_BIRTHDAY_EMAIL_SENT', implode(', ', $bd_list_log_ary));           
          unset($bd_list_ary);
          unset($bd_list_log_ary);
         
          $messenger->save_queue();
          unset($messenger);
       }

       }

// Show amount of reported and queue posts for authenticated users
if ($auth->acl_getf_global('m_report') || $auth->acl_getf_global('m_approve'))
{
   if (!function_exists('get_forum_list'))
   {
      include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
   }
   $user->add_lang('mcp');
   
   // Reported Posts
   $forum_list = get_forum_list('m_report');
   if (!empty($forum_list))
   {
      $sql = 'SELECT COUNT(r.report_id) AS total_reported
         FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
         WHERE r.post_id = p.post_id
            AND r.report_closed = 0
            AND ' . $db->sql_in_set('p.forum_id', $forum_list);
      $result = $db->sql_query($sql);
      $total_reported = (int) $db->sql_fetchfield('total_reported');
      $db->sql_freeresult($result);

      if ($total_reported)
      {         
         $template->assign_vars(array(
            'L_REPORTS_TOTAL'   => ($total_reported == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total_reported),
            'U_MCP_REPORTS'      => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports'))
         );
      }
   }
   
   // Reported PMs
   $sql = 'SELECT COUNT(report_id) AS total_pm_reported
      FROM ' . REPORTS_TABLE . ' 
      WHERE pm_id <> 0
         AND report_closed = 0';
   $result = $db->sql_query($sql);
   $total_pm_reported = (int) $db->sql_fetchfield('total_pm_reported');
   $db->sql_freeresult($result);

   if ($total_pm_reported)
   {         
      $template->assign_vars(array(
         'L_PM_REPORTS_TOTAL'   => ($total_pm_reported == 1) ? $user->lang['PM_REPORT_TOTAL'] : sprintf($user->lang['PM_REPORTS_TOTAL'], $total_pm_reported),
         'U_MCP_PM_REPORTS'      => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports'))
      );
   }
   
   // Posts and Topics in the Queue
   $forum_list = get_forum_list('m_approve');
   if (!empty($forum_list))
   {
      // Get the queue topics and posts in 1 query :)
      $sql = 'SELECT COUNT(t.topic_id) AS total_queue_topics, (
                     SELECT COUNT(p.post_id)
                     FROM ' . POSTS_TABLE . ' p
                     WHERE p.post_approved = 0
                        AND ' . $db->sql_in_set('p.forum_id', $forum_list) . ' ) AS total_queue_posts
            FROM ' . TOPICS_TABLE . ' t
            WHERE t.topic_approved = 0
               AND ' . $db->sql_in_set('t.forum_id', $forum_list);
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      // Topics contain posts, so let's remove these
      $total_queue_posts = $row['total_queue_posts'] - $row['total_queue_topics'];     
      $total_queue_topics = $row['total_queue_topics'];
     
      if ($total_queue_posts)
      {
         $template->assign_vars(array(
            'L_UNAPPROVED_POSTS_TOTAL'   => ($total_queue_posts == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total_queue_posts),
            'U_MCP_POSTS_QUEUE'         => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=unapproved_posts'))
         );
      }
     
      if ($total_queue_topics)
      {
         $template->assign_vars(array(
            'L_UNAPPROVED_TOPICS_TOTAL'   => ($total_queue_topics == 1) ? $user->lang['UNAPPROVED_TOPIC_TOTAL'] : sprintf($user->lang['UNAPPROVED_TOPICS_TOTAL'], $total_queue_topics),
            'U_MCP_TOPICS_QUEUE'      => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=unapproved_topics'))
         );
      }
     
   }   
}

if (!function_exists('display_who_was_here'))
{
   include($phpbb_root_path . 'includes/functions_wwh.' . $phpEx);
}
display_who_was_here();

    // BEGIN Welcome Mod
    //--Welcome_Mod--get the hour number-->
    $date = $user->format_date(time(), 'H');

    if ($user->data['is_registered'])
    {
        $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
    }
    else
    {
        $u_user_name = $user->lang['WELCOME_GUEST'];
    }   

    switch (true)
    {
            case ($date < 1):
                // if the hour is 6pm-11pm (18-23)
                $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
            break;
         
          case ($date < 4):
                // if the hour is 1-3 am
                $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
            break;
           
            case ($date < 8):
                // if the hour is 4-7 am
                $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
            break;
           
            case ($date < 12):
                // if the hour is 8-11 am
                $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
            break;
           
            case ($date < 18):
                // if the hour is 12-5pm (12-17)
                $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
            break;
           
            case ($date < 24):
                // if the hour is 6pm-11pm (18-23_
                $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
            break;
    }

    // how long a member for
    $member_for = '';
    if ($user->data['is_registered'] && !$user->data['is_bot'])
    {
        $member_length = time() - $user->data['user_regdate'];
        $years = $months = $days = 0;
        $member_for = '';
        if ($member_length)
        {   
            if ($member_length >= 31536000)
            {
                $years = floor($member_length / 31536000);
                $member_length = $member_length - ($years * 31536000);
                $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
            }
            $months = floor($member_length / 2628000);
            if ($months)
            {
                $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
                $member_length = $member_length - ($months * 2628000);
                $member_for .= $months;
            }
            $days = floor($member_length / 86400);
            if ($days)
            {
                $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
                $member_for .= $days;
            }       
        }
    }
    //END Welcome Mod
if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
   if(!function_exists('get_upcbirthdays'))
   {   
      include($phpbb_root_path . 'includes/functions_upcbirthdays.' . $phpEx);
   }
   get_upcbirthdays();
}
//-- mod: top five ---------------------------------------------------------//
   include($phpbb_root_path . 'includes/top_five.' . $phpEx);
//-- end: top five ---------------------------------------------------------//

// if automatic reminders is set, remind people. lets only run this once a day.
if (isset($config['user_reminder_enable']))
{
   if ( $config['user_reminder_enable'] == ENABLED )
   {
      $check_time = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));
   
      if ( $config['user_reminder_last_auto_run'] != $check_time)
      {
         if (!function_exists('send_user_reminders'))
         {
            include($phpbb_root_path . 'includes/functions_user_reminder.' . $phpEx);
         }
         
         send_user_reminders();
         
         if ($config['user_reminder_log_opt_users_react'])
         {
            add_log('admin', 'LOG_USER_REMINDER_AUTO_RUN');
         }
         
         set_config('user_reminder_last_auto_run', $check_time);
      }
   }
}

if ( isset($config['announcement_enable']))
{
   if ( $config['announcement_show_index'] && ($config['announcement_enable'] || $config['announcement_show_birthdays_always']) )
   {
      if (!function_exists('get_announcement_data'))
      {
         include($phpbb_root_path . 'includes/functions_announcements.' . $phpEx);
      }
      get_announcement_data();
   }
}
// BEGIN Welcome Mod
//--Welcome_Mod--get the hour number-->
$date = $user->format_date(time(), 'H');

if ($user->data['is_registered'])
{
    $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
}
else
{
    $u_user_name = $user->lang['WELCOME_GUEST'];
}   

switch (true)
{
        case ($date < 1):
            // if the hour is 11am-12am (18-23)
            $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
        break;
     
         case ($date < 4):
            // if the hour is 1-3 am
            $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
        break;
       
        case ($date < 8):
            // if the hour is 4-7 am
            $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
        break;
       
        case ($date < 12):
            // if the hour is 8-11 am
            $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
        break;
       
        case ($date < 18):
            // if the hour is 12-5pm
            $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
        break;
       
        case ($date < 24):
            // if the hour is 6pm-11pm
            $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
        break;
}

// how long a member for
$member_for = '';
if ($user->data['is_registered'] && !$user->data['is_bot'])
{
    $member_length = time() - $user->data['user_regdate'];
    $years = $months = $days = 0;
    $member_for = '';
    if ($member_length)
    {   
        if ($member_length >= 31536000)
        {
            $years = floor($member_length / 31536000);
            $member_length = $member_length - ($years * 31536000);
            $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
        }
        $months = floor($member_length / 2628000);
        if ($months)
        {
            $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
            $member_length = $member_length - ($months * 2628000);
            $member_for .= $months;
        }
        $days = floor($member_length / 86400);
        if ($days)
        {
            $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
            $member_for .= $days;
        }       
    }
}
//END Welcome Mod
//-- mod: Top Poster of the Month ----------------------------------------------------------//
// if the user is a bot, we won’t even process this function...
if (!$user->data['is_bot'])
{
   include($phpbb_root_path . 'includes/functions_tpotm.' . $phpEx);
   tpotm_set_template_vars();
}
//-- end: Top Poster Of The Month ----------------------------------------------------------//
// Assign index specific vars
$template->assign_vars(array(
      'TOTAL_POSTS'    => sprintf($user->lang[$l_total_post_s], number_format($total_posts, 0, ',', '.')),
    'POSTS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_day_s], $posts_per_day)),
    'POSTS_PER_YEAR'    => sprintf($user->lang[$l_posts_per_year_s], number_format($posts_per_year, 0, ',', '.')),
    'POSTS_PER_TOPIC'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_topic_s], $posts_per_topic)),
    'POSTS_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_user_s], $posts_per_user)),
    'TOTAL_TOPICS'    => sprintf($user->lang[$l_total_topic_s], number_format($total_topics, 0, ',', '.')),
    'TOPICS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_topics_per_day_s], $topics_per_day)),
    'TOPICS_PER_YEAR'   => sprintf($user->lang[$l_topics_per_year_s], number_format($topics_per_year, 0, ',', '.')),
    'TOPICS_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_topics_per_user_s], $topics_per_user)),
    'TOTAL_FILES'    => sprintf($user->lang[$l_total_file_s], number_format($total_files, 0, ',', '.')),
    'FILES_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_files_per_day_s], $files_per_day)),
    'FILES_PER_YEAR'    => sprintf($user->lang[$l_files_per_year_s], number_format($files_per_year, 0, ',', '.')),
    'FILES_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_files_per_user_s], $files_per_user)),
    'TOTAL_USERS'    => sprintf($user->lang[$l_total_user_s], number_format($total_users, 0, ',', '.')),
    'USERS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_users_per_day_s], $users_per_day)),
    'USERS_PER_YEAR'    => sprintf($user->lang[$l_users_per_year_s], number_format($users_per_year, 0, ',', '.')),
    'NEWEST_USER'   => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
    'START_DATE'         => $start_date,

       // BEGIN Welcome Mod   
    'S_WELCOME'                   => $s_welcome,
    'S_JOINED_DATE'               => $user->lang['JOINED'] . ':&nbsp;' . $user->format_date($user->data['user_regdate']),
    'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
    'MEMBER_FOR'               => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . '&nbsp;' . $member_for : '',
      // END Welcome Mod

   'LEGEND'      => $legend,
   'BIRTHDAY_LIST'   => $birthday_list,

   'FORUM_IMG'            => $user->img('forum_read', 'NO_NEW_POSTS'),
   'FORUM_NEW_IMG'         => $user->img('forum_unread', 'NEW_POSTS'),
   'FORUM_LOCKED_IMG'      => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
   'FORUM_NEW_LOCKED_IMG'   => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),

   'S_LOGIN_ACTION'         => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
   'S_DISPLAY_BIRTHDAY_LIST'   => ($config['load_birthdays']) ? true : false,
    'SEO_DESC'                 => (isset($config['seo_desc']) && $config['seo_desc']) ? $config['seo_desc'] : false,
    'SEO_KEY'                    => (isset($config['seo_key']) && $config['seo_key']) ? $config['seo_key'] : false,

   
   'U_MARK_FORUMS'      => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums') : '',
   'U_MCP'            => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '')
);

// BEGIN mChat Mod
if(!defined('MCHAT_INCLUDE') && $config['mchat_on_index'] && $config['mchat_enable'] && $auth->acl_get('u_mchat_view'))
{
   define('MCHAT_INCLUDE', true);
   $mchat_include_index = true;
   include($phpbb_root_path.'mchat.'.$phpEx);
}
// END mChat Mod
// BEGAN - ModernDignity.com Hello Name Tag of Newest User mod
   include($phpbb_root_path . 'includes/hellotag.' . $phpEx);
// ENDED - ModernDignity.com Hello Name Tag of Newest User mod

// BEGAN - ModernDignity.com Flash Animated Cumulus Tag Cloud
if (!function_exists('display_cloud'))
{
   include($phpbb_root_path . 'includes/functions_cloud.' . $phpEx);
}
display_cloud();
// ENDED - ModernDignity.com Flash Animated Cumulus Tag Cloud
// Output page
page_header('Oz Unity');

$template->set_filenames(array(
   'body' => 'index_body.html')
);

page_footer();
?>
lefty aka The Heikze! :eyebrowe:

Heiko Carstens
http://www.lefty74.com

Would you like me to install one of my mods for you? Read here for details
lefty
Abschlussklasse R10c
 
Posts: 1357
Joined: Mon Feb 06, 2006 1:20 am
Location: Den Haag - NL

Re: Email on Birthday 1.0.1b

Postby Blackwolf » Sat Jan 29, 2011 11:28 pm

This is my edited one....looks okay now....yours created some extra large text... :rotfl2:
& made the registration bar follow the page as you scrolled down.
I have uncommented the email line to to get a cc.....will let you know :birthdayparty:

Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: index.php 9614 2009-06-18 11:04:54Z nickvergessen $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');


display_forums('', $config['load_moderators']);

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts   = $config['num_posts'];
$total_topics   = $config['num_topics'];
$total_users   = $config['num_users'];
$total_files      = $config['num_files'];
$start_date     = date("d M Y, H:i:s", $config['board_startdate'] );
$boarddays       = ceil((time() - $config['board_startdate']) / 86400);
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
$l_total_file_s = ($total_files == 0) ? 'TOTAL_FILES_ZERO' : 'TOTAL_FILES_OTHER';
$posts_per_day = $total_posts / $boarddays;
$l_posts_per_day_s = ($posts_per_day == 0) ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
$posts_per_year = $posts_per_day * 365;
$l_posts_per_year_s = ($posts_per_year == 0) ? 'POSTS_PER_YEAR_ZERO' : 'POSTS_PER_YEAR_OTHER';
$posts_per_user = $total_posts / $total_users;
$l_posts_per_user_s = ($posts_per_user == 0) ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
$posts_per_topic = $total_posts / $total_topics;
$l_posts_per_topic_s = ($posts_per_topic == 0) ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';
$topics_per_day = $total_topics / $boarddays;
$l_topics_per_day_s = ($topics_per_day == 0) ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
$topics_per_year = $topics_per_day * 365;
$l_topics_per_year_s = ($topics_per_year == 0) ? 'TOPICS_PER_YEAR_ZERO' : 'TOPICS_PER_YEAR_OTHER';
$topics_per_user = $total_topics / $total_users;
$l_topics_per_user_s = ($topics_per_user == 0) ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
$files_per_day = $total_files / $boarddays;
$l_files_per_day_s = ($files_per_day == 0) ? 'FILES_PER_DAY_ZERO' : 'FILES_PER_DAY_OTHER';
$files_per_year = $files_per_day * 365;
$l_files_per_year_s = ($files_per_year == 0) ? 'FILES_PER_YEAR_ZERO' : 'FILES_PER_YEAR_OTHER';
$files_per_user = $total_files / $total_users;
$l_files_per_user_s = ($files_per_day == 0) ? 'FILES_PER_USER_ZERO' : 'FILES_PER_USER_OTHER';
$users_per_day = $total_users / $boarddays;
$l_users_per_day_s = ($users_per_day == 0) ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
$users_per_year = $users_per_day * 365;
$l_users_per_year_s = ($users_per_year == 0) ? 'USERS_PER_YEAR_ZERO' : 'USERS_PER_YEAR_OTHER';
// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
   $sql = 'SELECT group_id, group_name, group_colour, group_type
      FROM ' . GROUPS_TABLE . '
      WHERE group_legend = 1
      ORDER BY group_name ASC';
}
else
{
   $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
      FROM ' . GROUPS_TABLE . ' g
      LEFT JOIN ' . USER_GROUP_TABLE . ' ug
         ON (
            g.group_id = ug.group_id
            AND ug.user_id = ' . $user->data['user_id'] . '
            AND ug.user_pending = 0
         )
      WHERE g.group_legend = 1
         AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
      ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
   $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
   $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];

   if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
   {
      $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
   }
   else
   {
      $legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
   }
}
$db->sql_freeresult($result);

$legend = implode(' | ', $legend);

// Generate birthday list if required ...
$birthday_list = '';
$bd_list_ary = $bd_list_log_ary = array();

if ($config['load_birthdays'] && $config['allow_birthdays'])
{
   $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
   $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday, u.user_email, u.user_lang,u.user_notify_type, u.user_jabber
      FROM ' . USERS_TABLE . ' u
      LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
      WHERE (b.ban_id IS NULL
         OR b.ban_exclude = 1)
         AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
         AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
   $result = $db->sql_query($sql);

   while ($row = $db->sql_fetchrow($result))
   {
      $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      if ($age = (int) substr($row['user_birthday'], -4))
      {
         $birthday_list .= ' (' . ($now['year'] - $age) . ')';
      }

         if (trim($row['user_email']) && $config['birthday_emails'])
      {
         $bd_list_ary[] = array(
            'method'   => $row['user_notify_type'],
            'email'      => $row['user_email'],
            'jabber'   => $row['user_jabber'],
            'name'      => $row['username'],
            'lang'      => $row['user_lang']
         );
      }
   }
   $db->sql_freeresult($result);

       $check_time_bdemail = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));

       if ( sizeof($bd_list_ary) && ($user->data['user_timezone'] == $config['board_timezone'] && $user->data['user_dst'] == $config['board_dst']) && ($config['birthday_run'] != $check_time_bdemail) && $config['birthday_emails'] )
       {
          set_config('birthday_run', $check_time_bdemail);
         
          include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
          $messenger = new messenger();

          foreach ($bd_list_ary as $pos => $addr)
          {
             $messenger->template('birthday_email', $addr['lang']);
             
             $messenger->to($addr['email'], $addr['name']);
             $messenger->im($addr['jabber'], $addr['name']);
             // if you want to receive copies of the birthday emails, just uncomment below line
             $messenger->cc('ultimateblackwolf@gmail.com', 'your_name');
             
             $messenger->assign_vars(array(
                'USERNAME'      => htmlspecialchars_decode($addr['name'])
             ));
             $messenger->send($addr['method']);
             
             $bd_list_log_ary[] = $addr['name'];
          }
          add_log('admin', 'LOG_BIRTHDAY_EMAIL_SENT', implode(', ', $bd_list_log_ary));           
          unset($bd_list_ary);
          unset($bd_list_log_ary);
         
          $messenger->save_queue();
          unset($messenger);
       }

       }

if (!function_exists('display_who_was_here'))
{
   include($phpbb_root_path . 'includes/functions_wwh.' . $phpEx);
}
display_who_was_here();

    // BEGIN Welcome Mod
    //--Welcome_Mod--get the hour number-->
    $date = $user->format_date(time(), 'H');

    if ($user->data['is_registered'])
    {
        $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
    }
    else
    {
        $u_user_name = $user->lang['WELCOME_GUEST'];
    }   

    switch (true)
    {
            case ($date < 1):
                // if the hour is 6pm-11pm (18-23)
                $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
            break;
         
          case ($date < 4):
                // if the hour is 1-3 am
                $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
            break;
           
            case ($date < 8):
                // if the hour is 4-7 am
                $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
            break;
           
            case ($date < 12):
                // if the hour is 8-11 am
                $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
            break;
           
            case ($date < 18):
                // if the hour is 12-5pm (12-17)
                $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
            break;
           
            case ($date < 24):
                // if the hour is 6pm-11pm (18-23_
                $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
            break;
    }

    // how long a member for
    $member_for = '';
    if ($user->data['is_registered'] && !$user->data['is_bot'])
    {
        $member_length = time() - $user->data['user_regdate'];
        $years = $months = $days = 0;
        $member_for = '';
        if ($member_length)
        {   
            if ($member_length >= 31536000)
            {
                $years = floor($member_length / 31536000);
                $member_length = $member_length - ($years * 31536000);
                $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
            }
            $months = floor($member_length / 2628000);
            if ($months)
            {
                $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
                $member_length = $member_length - ($months * 2628000);
                $member_for .= $months;
            }
            $days = floor($member_length / 86400);
            if ($days)
            {
                $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
                $member_for .= $days;
            }       
        }
    }
    //END Welcome Mod
if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
   if(!function_exists('get_upcbirthdays'))
   {   
      include($phpbb_root_path . 'includes/functions_upcbirthdays.' . $phpEx);
   }
   get_upcbirthdays();
}
//-- mod: top five ---------------------------------------------------------//
   include($phpbb_root_path . 'includes/top_five.' . $phpEx);
//-- end: top five ---------------------------------------------------------//

// if automatic reminders is set, remind people. lets only run this once a day.
if (isset($config['user_reminder_enable']))
{
   if ( $config['user_reminder_enable'] == ENABLED )
   {
      $check_time = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));
   
      if ( $config['user_reminder_last_auto_run'] != $check_time)
      {
         if (!function_exists('send_user_reminders'))
         {
            include($phpbb_root_path . 'includes/functions_user_reminder.' . $phpEx);
         }
         
         send_user_reminders();
         
         if ($config['user_reminder_log_opt_users_react'])
         {
            add_log('admin', 'LOG_USER_REMINDER_AUTO_RUN');
         }
         
         set_config('user_reminder_last_auto_run', $check_time);
      }
   }
}

if ( isset($config['announcement_enable']))
{
   if ( $config['announcement_show_index'] && ($config['announcement_enable'] || $config['announcement_show_birthdays_always']) )
   {
      if (!function_exists('get_announcement_data'))
      {
         include($phpbb_root_path . 'includes/functions_announcements.' . $phpEx);
      }
      get_announcement_data();
   }
}
// BEGIN Welcome Mod
//--Welcome_Mod--get the hour number-->
$date = $user->format_date(time(), 'H');

if ($user->data['is_registered'])
{
    $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
}
else
{
    $u_user_name = $user->lang['WELCOME_GUEST'];
}   

switch (true)
{
        case ($date < 1):
            // if the hour is 11am-12am (18-23)
            $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
        break;
     
         case ($date < 4):
            // if the hour is 1-3 am
            $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
        break;
       
        case ($date < 8):
            // if the hour is 4-7 am
            $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
        break;
       
        case ($date < 12):
            // if the hour is 8-11 am
            $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
        break;
       
        case ($date < 18):
            // if the hour is 12-5pm
            $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
        break;
       
        case ($date < 24):
            // if the hour is 6pm-11pm
            $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
        break;
}

// how long a member for
$member_for = '';
if ($user->data['is_registered'] && !$user->data['is_bot'])
{
    $member_length = time() - $user->data['user_regdate'];
    $years = $months = $days = 0;
    $member_for = '';
    if ($member_length)
    {   
        if ($member_length >= 31536000)
        {
            $years = floor($member_length / 31536000);
            $member_length = $member_length - ($years * 31536000);
            $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
        }
        $months = floor($member_length / 2628000);
        if ($months)
        {
            $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
            $member_length = $member_length - ($months * 2628000);
            $member_for .= $months;
        }
        $days = floor($member_length / 86400);
        if ($days)
        {
            $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
            $member_for .= $days;
        }       
    }
}
//END Welcome Mod
//-- mod: Top Poster of the Month ----------------------------------------------------------//
// if the user is a bot, we won’t even process this function...
if (!$user->data['is_bot'])
{
   include($phpbb_root_path . 'includes/functions_tpotm.' . $phpEx);
   tpotm_set_template_vars();
}
//-- end: Top Poster Of The Month ----------------------------------------------------------//
// Assign index specific vars
$template->assign_vars(array(
      'TOTAL_POSTS'    => sprintf($user->lang[$l_total_post_s], number_format($total_posts, 0, ',', '.')),
    'POSTS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_day_s], $posts_per_day)),
    'POSTS_PER_YEAR'    => sprintf($user->lang[$l_posts_per_year_s], number_format($posts_per_year, 0, ',', '.')),
    'POSTS_PER_TOPIC'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_topic_s], $posts_per_topic)),
    'POSTS_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_posts_per_user_s], $posts_per_user)),
    'TOTAL_TOPICS'    => sprintf($user->lang[$l_total_topic_s], number_format($total_topics, 0, ',', '.')),
    'TOPICS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_topics_per_day_s], $topics_per_day)),
    'TOPICS_PER_YEAR'   => sprintf($user->lang[$l_topics_per_year_s], number_format($topics_per_year, 0, ',', '.')),
    'TOPICS_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_topics_per_user_s], $topics_per_user)),
    'TOTAL_FILES'    => sprintf($user->lang[$l_total_file_s], number_format($total_files, 0, ',', '.')),
    'FILES_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_files_per_day_s], $files_per_day)),
    'FILES_PER_YEAR'    => sprintf($user->lang[$l_files_per_year_s], number_format($files_per_year, 0, ',', '.')),
    'FILES_PER_USER'   => str_replace('.', ',', sprintf($user->lang[$l_files_per_user_s], $files_per_user)),
    'TOTAL_USERS'    => sprintf($user->lang[$l_total_user_s], number_format($total_users, 0, ',', '.')),
    'USERS_PER_DAY'   => str_replace('.', ',', sprintf($user->lang[$l_users_per_day_s], $users_per_day)),
    'USERS_PER_YEAR'    => sprintf($user->lang[$l_users_per_year_s], number_format($users_per_year, 0, ',', '.')),
    'NEWEST_USER'   => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
    'START_DATE'         => $start_date,

       // BEGIN Welcome Mod   
    'S_WELCOME'                   => $s_welcome,
    'S_JOINED_DATE'               => $user->lang['JOINED'] . ':&nbsp;' . $user->format_date($user->data['user_regdate']),
    'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
    'MEMBER_FOR'               => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . '&nbsp;' . $member_for : '',
      // END Welcome Mod

   'LEGEND'      => $legend,
   'BIRTHDAY_LIST'   => $birthday_list,

   'FORUM_IMG'            => $user->img('forum_read', 'NO_NEW_POSTS'),
   'FORUM_NEW_IMG'         => $user->img('forum_unread', 'NEW_POSTS'),
   'FORUM_LOCKED_IMG'      => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
   'FORUM_NEW_LOCKED_IMG'   => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),

   'S_LOGIN_ACTION'         => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
   'S_DISPLAY_BIRTHDAY_LIST'   => ($config['load_birthdays']) ? true : false,
    'SEO_DESC'                 => (isset($config['seo_desc']) && $config['seo_desc']) ? $config['seo_desc'] : false,
    'SEO_KEY'                    => (isset($config['seo_key']) && $config['seo_key']) ? $config['seo_key'] : false,

   
   'U_MARK_FORUMS'      => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums') : '',
   'U_MCP'            => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '')
);

// BEGIN mChat Mod
if(!defined('MCHAT_INCLUDE') && $config['mchat_on_index'] && $config['mchat_enable'] && $auth->acl_get('u_mchat_view'))
{
   define('MCHAT_INCLUDE', true);
   $mchat_include_index = true;
   include($phpbb_root_path.'mchat.'.$phpEx);
}
// END mChat Mod
// BEGAN - ModernDignity.com Hello Name Tag of Newest User mod
   include($phpbb_root_path . 'includes/hellotag.' . $phpEx);
// ENDED - ModernDignity.com Hello Name Tag of Newest User mod

// BEGAN - ModernDignity.com Flash Animated Cumulus Tag Cloud
if (!function_exists('display_cloud'))
{
   include($phpbb_root_path . 'includes/functions_cloud.' . $phpEx);
}
display_cloud();
// ENDED - ModernDignity.com Flash Animated Cumulus Tag Cloud
// Output page
page_header('Welcome');

$template->set_filenames(array(
   'body' => 'index_body.html')
);

page_footer();

?>


Will keep an eye on it :goodideasign:

I had 3 x the below......removed 2 :laughpound:
Code: Select all
if (trim($row['user_email']) && $config['birthday_emails'])
      {
         $bd_list_ary[] = array(
            'method'   => $row['user_notify_type'],
            'email'      => $row['user_email'],
            'jabber'   => $row['user_jabber'],
            'name'      => $row['username'],
            'lang'      => $row['user_lang']
         );
PhpBB3 Version: 3.0.10
Oz Unity
Ultimate Edition
Ultimate Edition Oz

We are Anonymous. We are Legion. We do not forgive. We do not forget. Expect us.
Blackwolf
Forum Member
 
Posts: 25
Joined: Thu Jan 27, 2011 10:18 am
Location: Melbourne, Australia

PreviousNext

Return to [3.0.x] MOD Database Releases

Who is online

Users browsing this forum: No registered users and 1 guest

cron