Просмотр файла pages/inform.php

Размер файла: 12.54Kb
<?php
/***************************************************************************
 *                                mides.ru
 *                            -------------------
 ***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
$start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']);
$boarddays = ( time() - $board_config['board_startdate'] ) / 86400;
$posts_per_day = sprintf("%.2f", $total_posts / $boarddays);
$topics_per_day = sprintf("%.2f", $total_topics / $boarddays);
$users_per_day = sprintf("%.2f", $total_users / $boarddays);
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
if( $total_posts == 0 )
{
	$l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
	$l_total_post_s = $lang['Posted_article_total'];
}
else
{
	$l_total_post_s = $lang['Posted_articles_total'];
}

if( $total_users == 0 )
{
	$l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
	$l_total_user_s = $lang['Registered_user_total'];
}
else
{
	$l_total_user_s = $lang['Registered_users_total'];
}

if( $userdata['session_logged_in'] )
{
	$sql = "SELECT COUNT(post_id) as total
			FROM " . POSTS_TABLE . "
			WHERE post_time >= " . $userdata['user_lastvisit'];
	$result = $db->sql_query($sql);
	if( $result )
	{
		$row = $db->sql_fetchrow($result);
		$lang['Search_new'] = $lang['Search_new'] . "&nbsp;(" . $row['total'] . ")";
	}
}
$sql = ($board_config['birthday_check_day']) ? "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username" :"";
if($result = $db->sql_query($sql))
{
if (!empty($result))
{
$time_now = time();
$this_year = create_date('Y', $time_now, $board_config['board_timezone']);
$date_today = create_date('Ymd', $time_now, $board_config['board_timezone']);
$date_forward = create_date('Ymd', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
while ($birthdayrow = $db->sql_fetchrow($result))
{
$user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] ));
if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
if ( $user_birthday2 > $date_today  && $user_birthday2 <= $date_forward )
{
$user_age = ( $this_year.$user_birthday < $date_today ) ? $this_year - realdate ('Y',$birthdayrow['user_birthday'])+1 : $this_year- realdate ('Y',$birthdayrow['user_birthday']);
switch ($birthdayrow['user_level'])
{
case ADMIN :
$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
break;
case MOD :
$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
break;
default: $style_color = '';
}
$birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,';
} else if ( $user_birthday2 == $date_today )
{
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
switch ($birthdayrow['user_level'])
{
case ADMIN :
$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
break;
case MOD :
$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
break;
default: $style_color = '';
}

$birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,';
}
}
if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
}
$db->sql_freeresult($result);
}
define('SHOW_ONLINE', true);
$page_title = 'Информация о сайте';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'inform_body.tpl')
);
//Считаем сколько icq
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_shop_icq);
$totalicq = mysql_fetch_array($result);
$totalicq = $totalicq['total'];
//Считаем сколько лс
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_privmsgs);
$totalpri = mysql_fetch_array($result);
$totalpri = $totalpri['total'];
//Считаем сколько дизайнов
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_styles_css);
$totaldiz = mysql_fetch_array($result);
$totaldiz = $totaldiz['total'];
/*Считаем сколько новостей
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_news);
$totalnews = mysql_fetch_array($result);
$totalnews = $totalnews ['total'];*/
//Считаем сколько Смайликов
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_smilies);
$totalsmi = mysql_fetch_array($result);
$totalsmi = $totalsmi ['total'];
//Считаем сколько тем
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_topics);
$totaltopic = mysql_fetch_array($result);
$totaltopic = $totaltopic ['total'];
//Считаем сколько раз проголосавали за юзера
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_reputation);
$totalrepa = mysql_fetch_array($result);
$totalrepa = $totalrepa ['total'];
//Считаем сколько url
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_shop_url);
$totalurl = mysql_fetch_array($result);
$totalurl = $totalurl ['total'];
//Считаем сколько реклы куплено
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_shop_sites);
$totalsites = mysql_fetch_array($result);
$totalsites = $totalsites ['total'];
//Считаем сколько лотерей прошло
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_lottery_history);
$totallot = mysql_fetch_array($result);
$totallot = $totallot ['total'];
//Считаем сколько создано опросов
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_vote_results);
$totalopr = mysql_fetch_array($result);
$totalopr = $totalopr ['total'];
//Считаем сколько ,bans
$result = mysql_query("SELECT count(*) AS total FROM " . phpbb_banlist);
$totalban = mysql_fetch_array($result);
$totalban = $totalban ['total'];
//files
$dr=opendir('files');
while ( $files = readdir ($dr)){
if (( $files != ".") && ($files != "..")){
$total_files_2++;
}}
//end-files
// Размер директории с аватарами
	$avatar_dir_size = 0;

	if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path']))
	{
		while( $file = @readdir($avatar_dir) )
		{
			if( $file != "." && $file != ".." )
			{
				$avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file);
			}
		}
		@closedir($avatar_dir);

		if($avatar_dir_size >= 1048576)
		{
			$avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MБ";
		}
		else if($avatar_dir_size >= 1024)
		{
			$avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KБ";
		}
		else
		{
			$avatar_dir_size = $avatar_dir_size . " Байт";
		}

	}
	else
	{
		$avatar_dir_size = $lang['Not_available'];
	}
// Размер директории с прикрепленными файлами
	$files_dir_size = 0;

	if ($files_dir = @opendir($phpbb_root_path . 'files' ))
	{
		while( $file = @readdir($files_dir) )
		{
			if( $file != "." && $file != ".." )
			{
				$files_dir_size += @filesize('files'. "/" . $file);
			}
		}
		@closedir($files_dir);

		if($files_dir_size >= 1048576)
		{
			$files_dir_size = round($files_dir_size / 1048576 * 100) / 100 . " MБ";
		}
		else if($files_dir_size >= 1024)
		{
			$files_dir_size = round($files_dir_size / 1024 * 100) / 100 . " KБ";
		}
		else
		{
			$files_dir_size = $files_dir_size . " Байт";
		}

	}
	else
	{
		$files_dir_size = 'нет';
	}
// клоличество загруженных файлов 
function count_files($dir){ 
 $c=0; 
 $d=dir($dir); 
 while($str=$d->read()){ 
  if($str{0}!='.'){ 
    if(is_dir($dir.'/'.$str)) $c+=count_files($dir.'/'.$str); 
    else $c++; 
  }; 
 } 
 $d->close(); 
 return $c; 
}
$total_files = count_files('files/');
//Количество фоток в альбоме
$result = mysql_query("SELECT count(*) AS total FROM " . ALBUM_TABLE); 
    $TotalImages = mysql_fetch_array($result); 
    $TotalImages = $TotalImages['total'];

$template->assign_vars(array(
	'WELCOME_TEXT' => $CFG['welcome_text'],
	'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
	'TOTAL_USERS' => sprintf($total_users),
	'TOTAL_TOPICS' => $total_topics,
	'BOARD_STARTED' => $start_date,
	'AVATAR_DIR_SIZE' => $avatar_dir_size,
	'FILES_DIR_SIZE' => $files_dir_size,
	'TOTALCHAT' => $totalchat,
        'TOTALGUEST' => $totalguest,
        'TOTALPRI' => $totalpri,
        'TOTALICQ' => $totalicq,
        'TOTALURL' => $totalurl,
        'TOTALSITES' => $totalsites,
        'TOTALLOAD' => $totalload,
        'TOTALDIZ' => $totaldiz,
        'TOTALSMI' => $totalsmi,
        'TOTALNEWS' => $totalnews,
        'TOTALREPA' => $totalrepa,
        'TOTALFILES' => $total_files,
        'TOTALBAN' => $totalban,
        'TOTALTOPIC' => $totaltopic,
        'TOTALLOT' => $totallot,
        'TOTALOPR' => $totalopr,
    'TOTALZ' => $totalz,
    'TOTAL_IMAGES' => $TotalImages,
    'TOTALOPRI' => $totalpri,
	'TOTALPOSTOFF' => sprintf($total_posts),
	'TOTAL_USEROFF' => sprintf($total_users),
        'TOTALFOTO' => $total_counter_2-3,
	'DB_SIZE' => $dbsize, 
	'GZIP_COMPRESSION' => ( $board_config['gzip_compress'] ) ? $lang['ON'] : $lang['OFF'],
	'POSTS_PER_DAY' => $posts_per_day,
	'TOPICS_PER_DAY' => $topics_per_day,
	'USERS_PER_DAY' => $users_per_day,
	'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
	// Start add - Birthday MOD
'L_WHOSBIRTHDAY_WEEK' => ($board_config['birthday_check_day'] > 1) ? sprintf( (($birthday_week_list) ? $lang['Birthday_week'] : $lang['Nobirthday_week']), $board_config['birthday_check_day']).$birthday_week_list : '',
'L_WHOSBIRTHDAY_TODAY' => ($board_config['birthday_check_day']) ? ($birthday_today_list) ? $lang['Birthday_today'].$birthday_today_list : $lang['Nobirthday_today'] : '',
// End add - Birthday MOD
	'L_FORUM' => $lang['Forum'],
	'L_POSTS_PER_DAY' => $lang['Posts_per_day'],
	'L_TOTAL_TOPICS' => $lang['Total_topics'],
	'L_TOPICS_PER_DAY' => $lang['Topics_per_day'],
	'L_USERS_PER_DAY' => $lang['Users_per_day'],
	'L_BOARD_STARTED' => $lang['Board_started'],
	'L_AVATAR_DIR_SIZE' => 'Размер директории с аватарами',
	'L_DB_SIZE' => $lang['Database_size'], 
	'L_FORUM_LOCATION' => $lang['Forum_Location'],
	'L_STARTED' => $lang['Login'],
	'L_GZIP_COMPRESSION' => $lang['Gzip_compression'],
	'L_BOARD_NAVIGATION' => $lang['Board_navigation'],
	'L_STATISTICS' => $lang['Statistics'],	
	'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
	'L_POSTED' => $lang['Posted'],
	'L_COMMENTS' => $lang['Comments'],
	'L_VIEW_COMMENTS' => $lang['View_comments'],
	'L_POST_COMMENT' => $lang['Post_your_comment'],
	'L_SEND_PASSWORD' => $lang['Forgotten_password'],
	'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
	'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '<a href="' . append_sid("profile.$phpEx?mode=register") . '">', '</a>'),
	'L_REMEMBER_ME' => $lang['Remember_me'],
	'L_VIEW_COMPLETE_LIST' => $lang['View_complete_list'],
	'L_POLL' => $lang['Poll'],
	'L_VOTE_BUTTON' => $lang['Vote'],

	// Welcome Avatar
	'L_NAME_WELCOME' => $lang['Welcome'],
	'U_NAME_LINK' => $name_link,
	'AVATAR_IMG' => $avatar_img)
);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>