Код: Выделить всё
##############################################################
## MOD Title: Posts in Last 24 Hours
## MOD Author: Throckmorton < lance at cylan dot net > (Lance Clarke) n/a
## MOD Description: Adds number of posts in the last 24 hours to your board stats
## MOD Version: 1.0.1
http://www.phpbb.com/phpBB/viewtopic.php?t=315941
+ куски из:
Код: Выделить всё
## MOD Title: Today At/Yesterday At
## MOD Author: netclectic < adrian@netclectic.com > (Adrian Cockburn) http://www.netclectic.com
## MOD Description: Will show Today At if the post was posted today
## Will show Yesterday At if the post was posted yesterday
##
## MOD Version: 1.3.1
Моды писать не умею, поэтому по-нашему, по-неучёному :wink:
Как читать:
минус (-) -- удалить строку,
плюс (+) -- вставить строку,
@@ -230,6 +230,10 @@ -- в старом файле кусок занимал строки с 230 по 236, в новом -- с 230 по 210 (но это у меня)
Что искать и так понятно -- по три строки контекста приводится до и после изменённого куска.
Поехали.
language/lang_russian/lang_main.php
Код: Выделить всё
@@ -170,6 +170,7 @@
//
$lang['Posted_articles_zero_total'] = 'Наши пользователи не оставили ни одного сообщения'; // Number of posts
$lang['Posted_article_total'] = 'Наши пользователи оставили сообщений: <b>%d</b>'; // Number of posts
+$lang['Posted_today'] = ', сегодня: <b>%d</b>'; // Number of posts since midnight
$lang['Posted_articles_total'] = 'Наши пользователи оставили сообщений: <b>%d</b>'; // Number of posts
$lang['Registered_users_zero_total'] = 'У нас нет зарегистрированных пользователей'; // # registered users
$lang['Registered_user_total'] = 'Всего зарегистрированных пользователей: <b>%d</b>'; // # registered users
Код: Выделить всё
@@ -23,7 +23,7 @@
function get_db_stat($mode)
{
- global $db;
+ global $db, $board_config;
switch( $mode )
{
@@ -46,6 +46,11 @@
$sql = "SELECT SUM(forum_topics) AS topic_total, SUM(forum_posts) AS post_total
FROM " . FORUMS_TABLE;
break;
+ case 'poststoday':
+ $sql = "SELECT COUNT(post_id)
+ FROM " . POSTS_TABLE . "
+ WHERE post_time > " . $board_config['today_time'];
+ break;
}
if ( !($result = $db->sql_query($sql)) )
@@ -69,6 +74,9 @@
case 'topiccount':
return $row['topic_total'];
break;
+ case 'poststoday':
+ return $row['COUNT(post_id)'];
+ break;
}
return false;
@@ -272,6 +280,9 @@
if ( isset($userdata['user_timezone']) )
{
$board_config['board_timezone'] = $userdata['user_timezone'];
+ $today_ary = explode('|', create_date('m|d|Y', time(), $board_config['board_timezone']));
+ $board_config['today_time'] = gmmktime(0, 0, 0, $today_ary[0], $today_ary[1], $today_ary[2]);
+ unset($today_ary);
}
}
Код: Выделить всё
@@ -230,6 +230,10 @@
unset($time_reg);
unset($regs);
+$today_ary = explode('|', create_date('m|d|Y', time(), $board_config['board_timezone']));
+$board_config['today_time'] = gmmktime(0, 0, 0, $today_ary[0], $today_ary[1], $today_ary[2]);
+unset($today_ary);
+
include($phpbb_root_path . 'attach_mod/attachment_mod.'.$phpEx);
if (file_exists('install') || file_exists('contrib'))
Код: Выделить всё
@@ -105,6 +105,7 @@
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
+$posts_today = get_db_stat('poststoday');
if( $total_posts == 0 )
{
@@ -119,6 +120,8 @@
$l_total_post_s = $lang['Posted_articles_total'];
}
+$l_posted_today = $lang['Posted_today'];
+
if( $total_users == 0 )
{
$l_total_user_s = $lang['Registered_users_zero_total'];
@@ -351,7 +354,7 @@
);
$template->assign_vars(array(
- 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
+ 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts) . sprintf($l_posted_today, $posts_today),
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),