| | |
| Stránka: 1 z 1
| [ Príspevok: 1 ] | |
Autor | Správa |
---|
Registrovaný: 01.05.05 Príspevky: 13343 Témy: 1494 Bydlisko: Bratislava | Napísal JanoF: 14.10.2006 15:13 | |
|
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&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&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} <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
_________________ Streacom DA2 | SilverStone Titanium SX800-LTI 800W | ASRock X299E-ITX/ac | Intel Core i9-9980XE & be quiet! Dark Rock TF | Kingston HyperX Impact 64 GB DDR4 2666 MHz | NVIDIA Titan RTX 24 GB | Intel SSD Optane 905P 480 GB NVMe U.2 & Intel SSD 750 1,2 TB NVMe U.2 & Intel SSD 660p 2 TB NVMe M.2 & Seagate BackUp Plus Portable 56 TB USB | 55" 4K OLED Dell Alienware AW5520QF & 24" LCD EIZO FlexScan EV2451 | Ergotron LX Wall Mount Keyboard Arm | Logitech Craft | Logitech G603 | Logitech F710 | Harman Kardon Sabre SB 35 & Sennheiser RS 175 | Microsoft Windows 7 Ultimate | APC Back-UPS ES 700 | Lenovo ThinkPad X250 | iPhone X 256 GB & Pitaka Aramid | SilverStone ML05B Milo | Corsair SF600 SFX 600W | ASRock X99E-ITX/ac | Intel Xeon E5-2683 v4 & NOCTUA NH-L12S | Kingston HyperX Savage 32 GB DDR4 2400 MHz | NVIDIA GeForce GT 710 1 GB | Intel SSD Optane Memory 32 GB NVMe M.2 & Intel SSD 730 240 GB SATA | Ubuntu Server |
|
| Stránka: 1 z 1
| [ Príspevok: 1 ] | |
Podobné témy | Témy | Odpovede | Zobrazenia | Posledný príspevok |
---|
| 24h v Redakčné systémy | 7 | 1272 | 09.07.2006 16:18 M@rek | | D: Xbox Live Gold 48H Trial v Vymením a darujem | 0 | 325 | 17.02.2017 12:44 T.C.B.E.E | | Search v JavaScript, VBScript, Ajax | 1 | 784 | 20.03.2009 16:07 chrono | | search v PHP, ASP | 3 | 769 | 20.09.2008 22:00 Numline1 | | Search v PHP, ASP | 2 | 808 | 08.01.2010 14:41 Ecko | | Proximity search v PHP, ASP | 2 | 499 | 17.10.2008 20:04 SonnY | | Google search v Smartfóny a tablety | 2 | 516 | 16.05.2019 18:54 kirik | | Search Engine? v Správy pre vedenie fóra | 3 | 889 | 08.08.2015 19:00 Loki999 | | Jednoduchy Search v PHP, ASP | 6 | 750 | 10.05.2009 13:29 jtomcik | | Search mod v Redakčné systémy | 4 | 1545 | 08.02.2007 19:45 Wyktor | | search index v Databázy | 2 | 549 | 11.01.2010 16:13 Unlink | | Search aneb game v PHP, ASP | 28 | 1042 | 21.03.2008 11:15 Blackshadow | | AJAX live search v JavaScript, VBScript, Ajax | 2 | 626 | 21.01.2010 17:28 emer | | Google search nesprávny title v Internetový marketing, SEO, reklama | 0 | 412 | 21.08.2014 13:52 majky358 | | search in the web v PHP, ASP | 7 | 856 | 24.09.2006 20:59 itsgoingd | | Mozilla Firefox -bueno search v Sieťové a internetové programy | 5 | 462 | 01.08.2014 9:19 samko |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|