View Single Post
  #5 (permalink)  
Old 11-05-2006, 12:49 PM
Marty Marty is offline
Member
 
Join Date: Jul 2004
Posts: 450
Works fine... you can see this in action on www.gamers-crib.com/modules.php?name=Forums down the bottom

I set mine to 72hours and to display Topics rather then Posts, its optional.

The only real changes made where the database .sql other then that it was just a matter to edit the right files.

PS: Dont let the word bbtonuke frighten you, its just php all php mods relative to phpbb can implemented into phpnuke all versions. The same goes for any kind of nuke Module, you might find around the net, they can all be added to any version of nuke, with a little editting if necessary.

Code:
##############################################################

#
#------[ SQL ]--------------------------------------
#
INSERT INTO nuke_bbconfig (config_name, config_value) VALUES ('search_latest_hours', '24,48,72');
INSERT INTO nuke_bbconfig (config_name, config_value) VALUES ('search_latest_results', 'topics');
#
#------[ OPEN ]--------------------------------------
#
modules/Forums/language/lang_english/lang_main.php
#
#------[ FIND ]--------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------
#
#------[ BEFORE, ADD ]-----------------------------
#
//+MOD: Search latest 24h 48h 72h
$lang['Search_latest'] = 'View latest';
$lang['Search_latest_XXh'] = '%dh';
//-MOD: Search latest 24h 48h 72h

#
#------[ OPEN ]--------------------------------------
#
modules/Forums/language/lang_english/lang_admin.php
#
#------[ FIND ]--------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
#
#------[ BEFORE, ADD ]-----------------------------
#
//+MOD: Search latest 24h 48h 72h
$lang['Search_latest_hours'] = 'Search latest (hours)';
$lang['Search_latest_hours_explain'] = 'Specify a comma separated list of numbers. These numbers will be used to dynamically build the search latest hours links on top of your forum index.';
$lang['Search_latest_hours_error'] = 'Invalid value entered in the \'Search latest (hours)\' field.

Please, specify a comma separated list of numbers.';
$lang['Search_latest_results'] = 'Search latest (results)';
$lang['Search_latest_results_explain'] = 'Specify how results of the the search latest hours links should be shown.';
//-MOD: Search latest 24h 48h 72h

#
#-----[ OPEN ]------------------------------------------
#
modules/Forums/index.php
#
#-----[ FIND ]-----------------------------------------
#
	$template->set_filenames(array(
		'body' => 'index_body.tpl')
	);
#
#-----[ AFTER, ADD ]----------------------------------
#

//+MOD: Search latest 24h 48h 72h
	$search_latest_hours = explode(',', $board_config['search_latest_hours']);

	for( $search_i = 0; $search_i < (count($search_latest_hours)-1); $search_i++ )
	{
		$template->assign_block_vars('search_latest', array(
			'L_SEARCH_LATEST_XXH' => sprintf($lang['Search_latest_XXh'], $search_latest_hours[$search_i]),
			'U_SEARCH_LATEST_XXH' => append_sid('search.'.$phpEx.'?search_id=latest&amp;hours=' . $search_latest_hours[$search_i])
		));
	}
	$template->assign_vars(array(
		'L_SEARCH_LATEST' => $lang['Search_latest'],
		'L_SEARCH_LATEST_XXH' => sprintf($lang['Search_latest_XXh'], $search_latest_hours[$search_i]),
		'U_SEARCH_LATEST_XXH' => append_sid('search.'.$phpEx.'?search_id=latest&amp;hours=' . $search_latest_hours[$search_i])
	));
//-MOD: Search latest 24h 48h 72h
#
#-----[ OPEN ]-----------------------------------------
# NOTE --- Remember to do this for all your installed styles
#
themes/Your_Theme/Forums/index_body.tpl
#
#-----[ FIND ]-----------------------------------------
# NOTE --- This is a partial match. The original line in subSilver looks something like this:
#		{L_SEARCH_UNANSWERED}</td>
#
{U_SEARCH_UNANSWERED}
#
#------[ BEFORE, ADD ]-----------------------------
#
		
		{L_SEARCH_LATEST}:
		
		{search_latest.L_SEARCH_LATEST_XXH}
		
		{L_SEARCH_LATEST_XXH}

		
#
#-----[ OPEN ]------------------------------------------------
#
modules/Forums/search.php
# 
#-----[ FIND ]----------------------------------------- 
# 
	//
	// Cycle through options ...
	//
	if ( $search_id == 'newposts' ||
#
# NOTE --- the previous is a partial search. The line should something like this:
#	if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' ) 
#
#
#-----[ IN-LINE FIND ]----------------------------------------
#
$search_id == 'newposts'
# 
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
 || $search_id == 'latest'
# 
#-----[ FIND ]----------------------------------------- 
# 
		if ( $search_id == 'newposts' ||
#
# NOTE --- the previous is a partial search. The line should something like this:
#		if ( $search_id == 'newposts' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' )  )
#
#
#-----[ IN-LINE FIND ]----------------------------------------
#
$search_id == 'newposts'
# 
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
 || $search_id == 'latest'
#
#-----[ FIND ]------------------------------------------------
#
			else if ( $search_id == 'egosearch' )
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//+MOD: Search latest 24h 48h 72h
			else if ( $search_id == 'latest' )
			{
				$search_latest_hours = explode(',', $board_config['search_latest_hours']);

				$latest_hours = intval( isset($HTTP_GET_VARS['hours']) ? $HTTP_GET_VARS['hours'] : $search_latest_hours[0] );
				if( !in_array($latest_hours, $search_latest_hours) )
				{
					$latest_hours = $search_latest_hours[0];
				}

				$sql = "SELECT post_id 
					FROM " . POSTS_TABLE . " 
					WHERE post_time > " . ( time() - ($latest_hours * 60 * 60) );

				$show_results = $board_config['search_latest_results'];
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
//-MOD: Search latest 24h 48h 72h
#
#-----[ OPEN ]------------------------------------------------
#
modules/Forums/admin/admin_board.php
# 
#-----[ FIND ]----------------------------------------- 
# 
		if ($config_name == 'cookie_name')
#
#------[ BEFORE, ADD ]-----------------------------
#
//+MOD: Search latest 24h 48h 72h
		if ($config_name == 'search_latest_hours' && isset($HTTP_POST_VARS['submit']))
		{
			$temp = explode(',', $new['search_latest_hours']);
			sort($temp);
			for( $num = 0; $num < count($temp); $num++ )
			{
				if( ($temp[$num] = intval($temp[$num])) <= 0 )
				{
					message_die(GENERAL_ERROR, $lang['Search_latest_hours_error']);
				}
			}
			$new['search_latest_hours'] = implode(',', $temp);
			unset($temp, $num);
		}
//-MOD: Search latest 24h 48h 72h

# 
#-----[ FIND ]----------------------------------------- 
# 
$override_user_style_yes = ( $new['override_user_style'] ) ? "checked=\"checked\"" : "";
#
#------[ BEFORE, ADD ]-----------------------------
#
//+MOD: Search latest 24h 48h 72h
$search_latest_results_posts = ( $new['search_latest_results'] == 'posts' ) ? ' checked="checked"' : '';
$search_latest_results_topics = ( $new['search_latest_results'] != 'posts' ) ? ' checked="checked"' : '';
//-MOD: Search latest 24h 48h 72h

# 
#-----[ FIND ]----------------------------------------- 
# NOTE --- This is a partial match. The original line looks something like this:
#	"L_TOPICS_PER_PAGE" => $lang['Topics_per_page'],
# 
"L_TOPICS_PER_PAGE" =>
#
#------[ BEFORE, ADD ]-----------------------------
#
//+MOD: Search latest 24h 48h 72h
	'L_SEARCH_LATEST_HOURS' => $lang['Search_latest_hours'],
	'L_SEARCH_LATEST_HOURS_EXPLAIN' => $lang['Search_latest_hours_explain'],
	'L_SEARCH_LATEST_RESULTS' => $lang['Search_latest_results'],
	'L_SEARCH_LATEST_RESULTS_EXPLAIN' => $lang['Search_latest_results_explain'],
	'L_TOPICS' => $lang['Topics'],
	'L_POSTS' => $lang['Posts'],
//-MOD: Search latest 24h 48h 72h
# 
#-----[ FIND ]----------------------------------------- 
# NOTE --- This is a partial match. The original line looks something like this:
#	"TOPICS_PER_PAGE" => $new['topics_per_page'],
# 
"TOPICS_PER_PAGE" =>
#
#------[ BEFORE, ADD ]-----------------------------
#
//+MOD: Search latest 24h 48h 72h
	'SEARCH_LATEST_HOURS' => $new['search_latest_hours'],
	'SEARCH_LATEST_RESULTS_POSTS' => $search_latest_results_posts,
	'SEARCH_LATEST_RESULTS_TOPICS' => $search_latest_results_topics,
//-MOD: Search latest 24h 48h 72h
#
#-----[ OPEN ]------------------------------------------------
#
#
templates/subSilver/admin/board_config_body.tpl
#
#-----[ FIND ]-----------------------------------------
# NOTE --- This is a partial match. The original line in subSilver looks something like this:
#	<tr>
#		<td class="row1">{L_TOPICS_PER_PAGE}</td>
#
<tr>
{L_TOPICS_PER_PAGE}
#
#------[ BEFORE, ADD ]-----------------------------
#
	
	<tr>
		<td class="row1">{L_SEARCH_LATEST_HOURS}:
<span class="gensmall">{L_SEARCH_LATEST_HOURS_EXPLAIN}</span></td>
		<td class="row2"><input class="post" type="text" name="search_latest_hours" size="30" maxlength="40" value="{SEARCH_LATEST_HOURS}" /></td>
	</tr>
	<tr>
		<td class="row1">{L_SEARCH_LATEST_RESULTS}:
<span class="gensmall">{L_SEARCH_LATEST_RESULTS_EXPLAIN}</span></td>
		<td class="row2"><input type="radio" name="search_latest_results" value="posts"{SEARCH_LATEST_RESULTS_POSTS} /> {L_POSTS}<input type="radio" name="search_latest_results" value="topics"{SEARCH_LATEST_RESULTS_TOPICS} /> {L_TOPICS}</td>
	</tr>
	
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# Marty
__________________
What is Pay Per Play ?
ADVERTISING has commenced!!! We have launched!!!!!!!
Reply With Quote