Project

General

Profile

« Previous | Next » 

Revision 769

Added by thorn over 16 years ago

search: added search_time_limit in settings (mainly for sites with PHP < 4.3.3 and slow search)

View differences:

trunk/CHANGELOG
10 10
# = Bugfix
11 11
! = Update/Change
12 12

  
13
------------------------------------- 2.7.0 -------------------------------------
13
------------------------------------- 2.7.0 -------------------------------------
14
25-Mar-2008 Thomas Hornik
15
+	search: added search_time_limit in settings (mainly for sites with PHP < 4.3.3 and slow search)
14 16
25-Mar-2008 Matthias Gallas
15 17
#	Fixed missing <body> tag in Admin Interface (ticket #572)
16 18
24-Mar-2008 Matthias Gallas
trunk/wb/upgrade-script.php
263 263
	}
264 264
}
265 265

  
266
echo "<br /><u>Adding module_order and max_excerpt to search-table</u><br />";
266
echo "<br /><u>Adding module_order, max_excerpt and time_limit to search-table</u><br />";
267 267
// module_order - in which order to show the search-results
268 268
// max_excerpt - how many lines of excerpt to print per matching page
269

  
269
// time_limit - time-limit for searching per module
270 270
$cfg = array(
271 271
	'module_order' => 'faqbaker,manual,wysiwyg',
272
	'max_excerpt' => '15'
272
	'max_excerpt' => '15',
273
	'time_limit' => '0'
273 274
);
274 275
foreach($cfg as $key=>$value) {
275 276
	db_add_search_key_value($key, $value);
trunk/wb/admin/settings/index.php
88 88
		case 'max_excerpt':
89 89
			$template->set_var('SEARCH_MAX_EXCERPT', $setting_value);
90 90
		break;
91
		// time-limit
92
		case 'time_limit':
93
			$template->set_var('SEARCH_TIME_LIMIT', $setting_value);
94
		break;
91 95
		// Search template
92 96
		case 'template':
93 97
			$search_template = $setting_value;
......
615 619
								'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
616 620
								'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING'],
617 621
								'TEXT_MODULE_ORDER' => $TEXT['MODULE_ORDER'],
618
								'TEXT_MAX_EXCERPT' => $TEXT['MAX_EXCERPT']
622
								'TEXT_MAX_EXCERPT' => $TEXT['MAX_EXCERPT'],
623
								'TEXT_TIME_LIMIT' => $TEXT['TIME_LIMIT']
619 624
								)
620 625
						);
621 626

  
trunk/wb/admin/settings/template.html
427 427
		<input type="text" name="search_max_excerpt" value="{SEARCH_MAX_EXCERPT}" />
428 428
	</td>
429 429
</tr>
430
<tr class="advanced">
431
	<td class="setting_name">{TEXT_TIME_LIMIT}:</td>
432
	<td class="setting_value" colspan="2">
433
		<input type="text" name="search_time_limit" value="{SEARCH_TIME_LIMIT}" />
434
	</td>
435
</tr>
430 436
<tr>
431 437
	<td>&nbsp;</td>
432 438
	<td>
trunk/wb/search/search.php
193 193
} else { $fetch_cfg_enable_flush['value'] = 'false'; }
194 194
if($fetch_cfg_enable_flush['value'] == 'false') { $cfg_enable_flush = false;
195 195
} else { $cfg_enable_flush = true; }
196
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'time_limit' LIMIT 1"); // time-limit per module
197
if($query->numRows() > 0) { $fetch_search_time_limit = $query->fetchRow();
198
} else { $fetch_search_time_limit['value'] = 'false'; }
199
$search_time_limit = (int)($fetch_search_time_limit['value']);
200
if($search_time_limit < 1) $search_time_limit = 0;
196 201
// Replace vars in search settings with values
197 202
$vars = array('[SEARCH_STRING]', '[WB_URL]', '[PAGE_EXTENSION]', '[TEXT_RESULTS_FOR]');
198 203
$values = array($search_display_string, WB_URL, PAGE_EXTENSION, $TEXT['RESULTS_FOR']);
......
309 314
	$seen_pages = array(); // seen pages per module.
310 315
	$pages_listed = array(); // seen pages.
311 316
	foreach($sorted_modules AS $module_name) {
317
		$start_time = time();	// get start-time to check time-limit; not very accurate, but ok
312 318
		$seen_pages[$module_name] = array();
313 319
		if(!isset($search_funcs[$module_name])) {
314 320
			continue; // there is no search_func for this module
......
326 332
		");
327 333
		if($sections_query->numRows() > 0) {
328 334
			while($res = $sections_query->fetchRow()) {
335
				// check if time-limit is exceeded for this module
336
				if($search_time_limit > 0 && (time()-$start_time > $search_time_limit)) {
337
					break;
338
				}
329 339
				// Only show this section if it is not "out of publication-date"
330 340
				$now = time();
331 341
				if( !( $now<$res['publ_end'] && ($now>$res['publ_start'] || $res['publ_start']==0) ||
trunk/wb/search/search_modext.php
95 95
	// stop-sign: .!?; + DOUBLE EXCLAMATION MARK - INTERROBANG - EXCLAMATION QUESTION MARK - QUESTION EXCLAMATION MARK - DOUBLE QUESTION MARK - HALFWIDTH IDEOGRAPHIC FULL STOP - IDEOGRAPHIC FULL STOP - IDEOGRAPHIC COMMA
96 96
	$str2=".!?;"."\xE2\x80\xBC"."\xE2\x80\xBD"."\xE2\x81\x89"."\xE2\x81\x88"."\xE2\x81\x87"."\xEF\xBD\xA1"."\xE3\x80\x82"."\xE3\x80\x81";
97 97
	$regex='/(?:^|\b|['.$str1.'])([^'.$str1.']{0,200}?'.$word.'[^'.$str2.']{0,200}(?:['.$str2.']|\b|$))/Sisu';
98
	if(version_compare(PHP_VERSION, '4.3.3', '>=') == 1) {
98
	if(version_compare(PHP_VERSION, '4.3.3', '>=')) {
99 99
		// jump from match to match, get excerpt, stop if $max_excerpt_num is reached
100 100
		$last_end = 0; $offset = 0;
101 101
		while(preg_match('/'.$word.'/Sisu', $text, $match_array, PREG_OFFSET_CAPTURE, $last_end)) {
......
232 232
		{ return false; }
233 233
	if($mod_no_highlight) // no highlighting
234 234
		{ $mod_page_link_target = "&amp;nohighlight=1".$mod_page_link_target; }
235

  
236 235
	// clean the text:
237 236
	$mod_text = str_replace(array("\x0D","\x0A"), ' ', $mod_text);
238 237
	$mod_text = preg_replace('#<(!--.*--|style.*</style|script.*</script)>#SiU', ' ', $mod_text);
trunk/wb/install/save.php
626 626
	$search_max_excerpt = addslashes('15');
627 627
	$insert_search_max_excerpt = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'max_excerpt', '$search_max_excerpt', '')";
628 628
	$database->query($insert_search_max_excerpt);
629
	// max time to search per module
630
	$search_time_limit = addslashes('0');
631
	$insert_search_time_limit = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'time_limit', '$search_time_limit', '')";
632
	$database->query($insert_search_time_limit);
629 633
	// some config-elements
630 634
	$database->query("INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'cfg_enable_old_search', 'true', '')");
631 635
	$database->query("INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'cfg_search_keywords', 'true', '')");
trunk/wb/languages/FI.php
402 402
$TEXT['CHARSET'] = 'Merkist&ouml;';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/EN.php
402 402
$TEXT['CHARSET'] = 'Charset';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching';
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt';
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module';
405 406
$TEXT['PUBL_START_DATE'] = 'Start date';
406 407
$TEXT['PUBL_END_DATE'] = 'End date';
407 408
$TEXT['CALENDAR'] = 'Calender';
trunk/wb/languages/CS.php
402 402
$TEXT['CHARSET'] = 'K&oacute;dov&aacute; str&aacute;nka';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/SE.php
402 402
$TEXT['CHARSET'] = 'Typsnitt';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/ES.php
402 402
$TEXT['CHARSET'] = 'Conjunto de Caraceteres';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/FR.php
402 402
$TEXT['CHARSET'] = 'Encodage';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/ET.php
402 402
$TEXT['CHARSET'] = 'Charset'; //needs to be translated
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/HR.php
402 402
$TEXT['CHARSET'] = 'Postavka znakova';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/NL.php
402 402
$TEXT['CHARSET'] = 'Tekenset';
403 403
$TEXT['MODULE_ORDER'] = 'Module volgorde om te zoeken'; 
404 404
$TEXT['MAX_EXCERPT'] = 'Max lijnen per zoeksessie'; 
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start datum'; 
406 407
$TEXT['PUBL_END_DATE'] = 'Eind datum'; 
407 408
$TEXT['CALENDAR'] = 'Kalender'; 
trunk/wb/languages/PL.php
402 402
$TEXT['CHARSET'] = 'Kodowanie znak&oacute;w';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/HU.php
402 402
$TEXT['CHARSET'] = 'Charset'; //needs to be translated
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/IT.php
402 402
$TEXT['CHARSET'] = 'Caratteri';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/LV.php
402 402
$TEXT['CHARSET'] = 'Simbolu kopa';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/PT.php
402 402
$TEXT['CHARSET'] = 'Charset'; //needs to be translated
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/CA.php
402 402
$TEXT['CHARSET'] = 'Charset'; //needs to be translated
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/DA.php
400 400
$TEXT['VERIFICATION'] = 'Indtast verifikationstal';
401 401
$TEXT['DEFAULT_CHARSET'] = 'Standard tegns&aelig;t';
402 402
$TEXT['CHARSET'] = 'Tegns&aelig;t';
403
$TEXT['MODULE_ORDER'] = 'Modul-r&aelig;kkef&oslash;lge ved s&oslash;gning'; 
404
$TEXT['MAX_EXCERPT'] = 'Max linier i uddrag'; 
403
$TEXT['MODULE_ORDER'] = 'Modul-r&aelig;kkef&oslash;lge ved s&oslash;gning';
404
$TEXT['MAX_EXCERPT'] = 'Max linier i uddrag';
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Startdato';
406 407
$TEXT['PUBL_END_DATE'] = 'Slutdato'; 
407 408
$TEXT['CALENDAR'] = 'Kalender'; 
trunk/wb/languages/TR.php
402 402
$TEXT['CHARSET'] = 'Charset'; //needs to be translated
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/RU.php
402 402
$TEXT['CHARSET'] = 'Charset';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated
trunk/wb/languages/DE.php
402 402
$TEXT['CHARSET'] = 'Zeichensatz';
403 403
$TEXT['MODULE_ORDER'] = 'Modulreihenfolge f&uuml;r die Suche';
404 404
$TEXT['MAX_EXCERPT'] = 'Max Anzahl Zitate pro Seite';
405
$TEXT['TIME_LIMIT'] = 'Zeitlimit zur Erstellung der Zitate pro Modul';
405 406
$TEXT['PUBL_START_DATE'] = 'Start Datum';
406 407
$TEXT['PUBL_END_DATE'] = 'End Datum';
407 408
$TEXT['CALENDAR'] = 'Kalender';
trunk/wb/languages/BG.php
402 402
$TEXT['CHARSET'] = '&#1050;&#1086;&#1076;&#1086;&#1074;&#1072; &#1090;&#1072;&#1073;&#1083;&#1080;&#1094;&#1072;';
403 403
$TEXT['MODULE_ORDER'] = 'Module-order for searching'; //needs to be translated
404 404
$TEXT['MAX_EXCERPT'] = 'Max lines of excerpt'; //needs to be translated
405
$TEXT['TIME_LIMIT'] = 'Max time to gather excerpts per module'; //needs to be translated
405 406
$TEXT['PUBL_START_DATE'] = 'Start date'; //needs to be translated
406 407
$TEXT['PUBL_END_DATE'] = 'End date'; //needs to be translated
407 408
$TEXT['CALENDAR'] = 'Calender'; //needs to be translated

Also available in: Unified diff