| 1 | <?php
 | 
  
    | 2 | 
 | 
  
    | 3 | // $Id: search.php 561 2008-01-18 20:48:09Z Ruebenwurzel $
 | 
  
    | 4 | 
 | 
  
    | 5 | /*
 | 
  
    | 6 | 
 | 
  
    | 7 |  Website Baker Project <http://www.websitebaker.org/>
 | 
  
    | 8 |  Copyright (C) 2004-2008, Ryan Djurovich
 | 
  
    | 9 | 
 | 
  
    | 10 |  Website Baker is free software; you can redistribute it and/or modify
 | 
  
    | 11 |  it under the terms of the GNU General Public License as published by
 | 
  
    | 12 |  the Free Software Foundation; either version 2 of the License, or
 | 
  
    | 13 |  (at your option) any later version.
 | 
  
    | 14 | 
 | 
  
    | 15 |  Website Baker is distributed in the hope that it will be useful,
 | 
  
    | 16 |  but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
  
    | 17 |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
  
    | 18 |  GNU General Public License for more details.
 | 
  
    | 19 | 
 | 
  
    | 20 |  You should have received a copy of the GNU General Public License
 | 
  
    | 21 |  along with Website Baker; if not, write to the Free Software
 | 
  
    | 22 |  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
  
    | 23 | 
 | 
  
    | 24 | */
 | 
  
    | 25 | 
 | 
  
    | 26 | function form_search($func_vars) {
 | 
  
    | 27 | 	extract($func_vars, EXTR_PREFIX_ALL, 'func');
 | 
  
    | 28 | 	
 | 
  
    | 29 | 	// how many lines of excerpt we want to have at most
 | 
  
    | 30 | 	$max_excerpt_num = $func_default_max_excerpt;
 | 
  
    | 31 | 	$divider = ".";
 | 
  
    | 32 | 	$result = false;
 | 
  
    | 33 | 	
 | 
  
    | 34 | 	// fetch all form-fields on this page
 | 
  
    | 35 | 	$table = TABLE_PREFIX."mod_form_fields";
 | 
  
    | 36 | 	$query = $func_database->query("
 | 
  
    | 37 | 		SELECT title, value
 | 
  
    | 38 | 		FROM $table
 | 
  
    | 39 | 		WHERE section_id='$func_section_id'
 | 
  
    | 40 | 		ORDER BY position ASC
 | 
  
    | 41 | 	");
 | 
  
    | 42 | 	// now call print_excerpt() only once for all items
 | 
  
    | 43 | 	if($query->numRows() > 0) {
 | 
  
    | 44 | 		$text="";
 | 
  
    | 45 | 		while($res = $query->fetchRow()) {
 | 
  
    | 46 | 			$text .= $res['title'].$divider.$res['value'].$divider;
 | 
  
    | 47 | 		}
 | 
  
    | 48 | 		$mod_vars = array(
 | 
  
    | 49 | 			'page_link' => $func_page_link,
 | 
  
    | 50 | 			'page_link_target' => "#wb_section_$func_section_id",
 | 
  
    | 51 | 			'page_title' => $func_page_title,
 | 
  
    | 52 | 			'page_description' => $func_page_description,
 | 
  
    | 53 | 			'page_modified_when' => $func_page_modified_when,
 | 
  
    | 54 | 			'page_modified_by' => $func_page_modified_by,
 | 
  
    | 55 | 			'text' => $text,
 | 
  
    | 56 | 			'max_excerpt_num' => $max_excerpt_num
 | 
  
    | 57 | 		);
 | 
  
    | 58 | 		if(print_excerpt2($mod_vars, $func_vars)) {
 | 
  
    | 59 | 			$result = true;
 | 
  
    | 60 | 		}
 | 
  
    | 61 | 	}
 | 
  
    | 62 | 	return $result;
 | 
  
    | 63 | }
 | 
  
    | 64 | 
 | 
  
    | 65 | ?>
 |