func_boardstats.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 513 行 · 第 1/2 页

PHP
513
字号
			{				if ( is_array($this->ipsclass->cache['birthdays']) AND count( $this->ipsclass->cache['birthdays'] ) )				{					foreach( $this->ipsclass->cache['birthdays'] as $id => $u )					{						if ( $u['bday_day'] == $day and $u['bday_month'] == $month )						{							$users[] = $u;						}					}				}								//-----------------------------------------				// Spin and print...				//-----------------------------------------								foreach ( $users as $id => $user )				{					$birthstring .= "<a href='{$this->ipsclass->base_url}showuser={$user['id']}'>{$user['members_display_name']}</a>";										if ($user['bday_year'])					{						$pyear = $year - $user['bday_year'];						$birthstring .= "(<b>$pyear</b>)";					}										$birthstring .= $this->sep_char."\n";										$count++;				}								//-----------------------------------------				// Fix up string...				//-----------------------------------------								$birthstring = preg_replace( "/".$this->sep_char."$/", "", trim($birthstring) );								$lang = $this->ipsclass->lang['no_birth_users'];								if ($count > 0)				{					$lang = ($count > 1) ? $this->ipsclass->lang['birth_users'] : $this->ipsclass->lang['birth_user'];					$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->birthdays( $birthstring, $count, $lang  );				}				else				{					$count = "";										if ( ! $this->ipsclass->vars['autohide_bday'] )					{						$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->birthdays( $birthstring, $count, $lang  );					}				}			}		}				//-----------------------------------------		// Are we viewing the calendar?		//-----------------------------------------				if ($this->ipsclass->vars['show_calendar'])		{			$this->ipsclass->vars['calendar_limit']  = intval($this->ipsclass->vars['calendar_limit']) < 2 ? 1 : intval($this->ipsclass->vars['calendar_limit']);						$our_unix    = gmmktime( 0, 0, 0, $month, $day, $year);			$max_date    = $our_unix + ($this->ipsclass->vars['calendar_limit'] * 86400);			$events      = array();			$show_events = array();						if ( is_array($this->ipsclass->cache['calendar']) AND count( $this->ipsclass->cache['calendar'] ) )			{				foreach( $this->ipsclass->cache['calendar'] as $id => $u )				{					$set_offset = 0;					if( $u['event_timeset'] && !($u['event_recurring'] == 0 AND $u['event_unix_to']) )					{						$set_offset = $this->ipsclass->member['time_offset'] * 3600;					}					$u['_unix_from'] = $u['event_unix_from'] - $set_offset;					$u['_unix_to']   = $u['event_unix_to'] - $set_offset;										//-----------------------------------------					// Private?					//-----------------------------------------										if ( $u['event_private'] == 1 and $this->ipsclass->member['id'] != $u['event_member_id'] )					{						continue;					}										//-----------------------------------------					// Got perms?					//-----------------------------------------										if ( $this->ipsclass->check_perms( $u['event_perms'] ) != TRUE )					{						continue;					}											//-----------------------------------------					// Got calendar perms?					//-----------------------------------------										if ( $this->ipsclass->check_perms( $u['_perm_read'] ) != TRUE )					{						continue;					}										//-----------------------------------------					// In range?					//-----------------------------------------									if ( $u['event_recurring'] == 0 AND ( ( $u['event_unix_from'] >= $our_unix AND $u['event_unix_from'] <= $max_date )						OR ( $u['event_unix_to'] = 0 AND $u['event_unix_from'] >= $our_unix AND $u['event_unix_from'] <= $max_date ) ) )					{						$u['event_activetime'] = $u['_unix_from'];						$events[$u['event_unix_from'].$u['event_id']] = $u;					}					elseif( $u['event_recurring'] > 0 )					{						$cust_range_s = $u['event_unix_from'];						while( $cust_range_s < $u['event_unix_to'])						{							if( $cust_range_s >= $our_unix AND $cust_range_s <= $max_date )							{								$u['event_activetime'] = $cust_range_s;								$events[$cust_range_s.$u['event_id']] = $u;							}							if( $u['event_recurring'] == "1" )							{								$cust_range_s += 604800;							}							elseif ( $u['event_recurring'] == "2" )							{								$cust_range_s += 18144000;							}							else							{								$cust_range_s += 31536000;							}						}													}				}			}						//-----------------------------------------			// Print...			//-----------------------------------------						ksort($events);						foreach( $events as $e => $event )			{				//-----------------------------------------				// Recurring?				//-----------------------------------------				$c_time = '';				//if ( ! $event['event_recurring'] )				//{					$c_time = gmdate( 'j-F-y', $event['event_activetime'] );				//}								$show_events[] = "<a href='{$this->ipsclass->base_url}act=calendar&amp;code=showevent&amp;calendar_id={$event['event_calendar_id']}&amp;event_id={$event['event_id']}' title='$c_time'>".$event['event_title']."</a>";			}						$this->ipsclass->lang['calender_f_title'] = sprintf( $this->ipsclass->lang['calender_f_title'], $this->ipsclass->vars['calendar_limit'] );						if ( count($show_events) > 0 )			{				$event_string = implode( $this->sep_char.' ', $show_events );				$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->calendar_events( $event_string  );			}			else			{				if ( ! $this->ipsclass->vars['autohide_calendar'] )				{					$event_string = $this->ipsclass->lang['no_calendar_events'];					$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->calendar_events( $event_string  );				}			}		}			return $stats_html;		}	/*-------------------------------------------------------------------------*/	//	// SHOW TOTALS	//	/*-------------------------------------------------------------------------*/		function show_totals()	{		if ($this->ipsclass->vars['show_totals'])		{			if ( ! is_array( $this->ipsclass->cache['stats'] ) )			{				$this->ipsclass->cache['stats'] = array();								$this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 1 ) );			}						$stats =& $this->ipsclass->cache['stats'];						//-----------------------------------------			// Update the most active count if needed			//-----------------------------------------						if ($this->users_online > $stats['most_count'])			{				$stats['most_count'] = $this->users_online;				$stats['most_date']  = time();								$this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 1 ) );					  			}						$most_time = $this->ipsclass->get_date( $stats['most_date'], 'LONG' );						$this->ipsclass->lang['most_online'] = str_replace( "<#NUM#>" ,   $this->ipsclass->do_number_format($stats['most_count'])  , $this->ipsclass->lang['most_online'] );			$this->ipsclass->lang['most_online'] = str_replace( "<#DATE#>",                   $most_time                    , $this->ipsclass->lang['most_online'] );						$total_posts = $stats['total_replies'] + $stats['total_topics'];						$total_posts        = $this->ipsclass->do_number_format($total_posts);			$stats['mem_count'] = $this->ipsclass->do_number_format($stats['mem_count']);						$this->total_posts    = $total_posts;			$this->total_members  = $stats['mem_count'];						$link = $this->ipsclass->base_url."showuser=".$stats['last_mem_id'];						$this->ipsclass->lang['total_word_string'] = str_replace( "<#posts#>" , "$total_posts"          , $this->ipsclass->lang['total_word_string'] );			$this->ipsclass->lang['total_word_string'] = str_replace( "<#reg#>"   , $stats['mem_count']     , $this->ipsclass->lang['total_word_string'] );			$this->ipsclass->lang['total_word_string'] = str_replace( "<#mem#>"   , $stats['last_mem_name'] , $this->ipsclass->lang['total_word_string'] );			$this->ipsclass->lang['total_word_string'] = str_replace( "<#link#>"  , $link                   , $this->ipsclass->lang['total_word_string'] );						$stats_html .= $this->ipsclass->compiled_templates['skin_boards']->ShowStats($this->ipsclass->lang['total_word_string']);					}		return $stats_html;			}}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?