[ Príspevok: 1 ] 
AutorSpráva
Offline

Prevádzkovateľ fóra
Prevádzkovateľ fóra
Search latest 24h 48h 72h

Registrovaný: 01.05.05
Príspevky: 12424
Témy: 1447 | 1447
Bydlisko: Bratislava
Vek: 32
NapísalOffline : 14.10.2006 15:13 | Search latest 24h 48h 72h

Kód:
##############################################################
## MOD Title: Search latest 24h 48h 72h
## MOD Author: markus_petrux < nospam@phpmix.com > (Markus) http://www.phpmix.com
## MOD Description: This MOD adds a new search feature so it allows to search for posts from
##                  latest XX hours. The list of latest hours can be specified from the ACP,
##                  also whether to show results as posts or topics.
## MOD Version: 1.1.0
##
## Installation Level: (Easy)
## Installation Time: 15 Minutes
## Files To Edit: 7
##      language/lang_english/lang_main.php
##      language/lang_english/lang_admin.php
##      index.php
##      templates/subSilver/index_body.tpl
##      search.php
##      admin/admin_board.php
##      templates/subSilver/admin/board_config_body.tpl
## Included Files: none
## License: http://opensource.org/licenses/gpl-license.php GNU Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## - Tested with phpBB 2.0.15, 2.0.16 and 2.0.17
## - This MOD is EasyMOD friendly.
##
##############################################################
## MOD History:
##
## 2005/07/25 - 1.1.0
##   - Added ability to specifiy the list of hours from the ACP,
##    also whether to show results as posts or topics.
##
## 2005/06/17 - 1.0.2
##   - Changed the way the links are constructed, so all HTML/CSS attributes
##    are now moved to the template, for easy adaption to other styles.
##
## 2005/01/31 - 1.0.0
##   - Initial release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#------[ SQL ]--------------------------------------
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_latest_hours', '24,48,72');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_latest_results', 'topics');
#
#------[ OPEN ]--------------------------------------
#
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 ]--------------------------------------
#
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.<br /><br />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 ]------------------------------------------
#
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
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]-----------------------------------------
# NOTE --- This is a partial match. The original line in subSilver looks something like this:
#      <a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td>
#
{U_SEARCH_UNANSWERED}
#
#------[ BEFORE, ADD ]-----------------------------
#
      <!-- +MOD: Search latest 24h 48h 72h -->
      {L_SEARCH_LATEST}:
      <!-- BEGIN search_latest -->
      <a href="{search_latest.U_SEARCH_LATEST_XXH}" class="gensmall">{search_latest.L_SEARCH_LATEST_XXH}</a>
      <!-- END search_latest -->
      <a href="{U_SEARCH_LATEST_XXH}" class="gensmall">{L_SEARCH_LATEST_XXH}</a><br />
      <!-- -MOD: Search latest 24h 48h 72h -->
#
#-----[ OPEN ]------------------------------------------------
#
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 ]------------------------------------------------
#
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 ]------------------------------------------------
# NOTE --- Remember to do this for all your installed styles
#
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 ]-----------------------------
#
   <!-- +MOD: Search latest 24h 48h 72h -->
   <tr>
      <td class="row1">{L_SEARCH_LATEST_HOURS}:<br /><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}:<br /><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}&nbsp;&nbsp;<input type="radio" name="search_latest_results" value="topics"{SEARCH_LATEST_RESULTS_TOPICS} /> {L_TOPICS}</td>
   </tr>
   <!-- -MOD: Search latest 24h 48h 72h -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


_________________
SilverStone SST CS01 | Corsair SF600 600W SFX | ASRock X99E-ITX/ac | Intel Xeon E5-2683 v4 (16 Cores / 32 Threads) & Noctua NH-U9DX i4 | Kingston HyperX Savage 32 GB DDR4 2400 MHz | PNY NVIDIA Quadro K1200 DP 4 GB DDR5 | Intel SSD 750 1.2 TB NVMe & Intel SSD 730 240 GB SATA & Seagate BackUp Plus Portable 12 TB USB | 31.5" 4K LCD EIZO FlexScan EV3237 & 2 x 24" LCD EIZO FlexScan EV2451 | Ergotron LX Wall Mount Keyboard Arm | Logitech Craft | Logitech Wireless G700s | Harman Kardon Nova | Microsoft Windows 7 Ultimate | APC Back-UPS ES 700 | Lenovo ThinkPad X250 - Intel Core i7 5600U, 8 GB DDR3 1600 MHz, Intel HD Graphics 5500, SanDisk SSD 512 GB, 12.5 FHD LED IPS, WWAN 3G 4G LTE, Microsoft Windows 7 Ultimate | Nintendo Classic Mini | BlackBerry Passport 96 GB
 [ Príspevok: 1 ] 


Search latest 24h 48h 72h



Podobné témy

 Témy  Odpovede  Zobrazenia  Posledný príspevok 
V tomto fóre nie sú ďalšie neprečítané témy.

24h

v Redakčné systémy

7

1125

09.07.2006 16:18

M@rek

V tomto fóre nie sú ďalšie neprečítané témy.

D: Xbox Live Gold 48H Trial

v Vymením a darujem

0

114

17.02.2017 12:44

T.C.B.E.E

V tomto fóre nie sú ďalšie neprečítané témy.

Kolko MB ma 24h zaznam

v Ostatné

3

463

05.12.2008 17:59

br4n0

V tomto fóre nie sú ďalšie neprečítané témy.

Search

v JavaScript, VBScript, Ajax

1

516

20.03.2009 16:07

chrono

V tomto fóre nie sú ďalšie neprečítané témy.

Search

v PHP, ASP

2

555

08.01.2010 14:41

Ecko

V tomto fóre nie sú ďalšie neprečítané témy.

search

v PHP, ASP

3

474

20.09.2008 22:00

Numline1

V tomto fóre nie sú ďalšie neprečítané témy.

Search mod

v Redakčné systémy

4

631

08.02.2007 19:45

Wyktor

Táto téma je zamknutá, nemôžete posielať nové príspevky alebo odpovedať na staršie.

Search Engine?

v Správy pre vedenie fóra

3

191

08.08.2015 19:00

Loki999

V tomto fóre nie sú ďalšie neprečítané témy.

Jednoduchy Search

v PHP, ASP

6

475

10.05.2009 13:29

jtomcik

V tomto fóre nie sú ďalšie neprečítané témy.

Proximity search

v PHP, ASP

2

308

17.10.2008 20:04

SonnY

V tomto fóre nie sú ďalšie neprečítané témy.

search index

v Databázy

2

309

11.01.2010 16:13

Unlink

V tomto fóre nie sú ďalšie neprečítané témy.

AJAX live search

v JavaScript, VBScript, Ajax

2

328

21.01.2010 17:28

emer

V tomto fóre nie sú ďalšie neprečítané témy.

Search aneb game

v PHP, ASP

28

723

21.03.2008 11:15

Blackshadow

V tomto fóre nie sú ďalšie neprečítané témy.

Google search nesprávny title

v Internetový marketing, SEO, reklama

0

145

21.08.2014 13:52

majky358

V tomto fóre nie sú ďalšie neprečítané témy.

Chyba s search.php

v Správy pre vedenie fóra

10

1396

25.02.2008 22:37

walther

V tomto fóre nie sú ďalšie neprečítané témy.

Mozilla Firefox -bueno search

v Sieťové a internetové programy

5

196

01.08.2014 9:19

samko



© 2005 - 2017 PCforum, edited by JanoF