[ Index ] |
PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2010 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 // ---------------------------------------------------------------- 24 // obligate check for phpwcms constants 25 if (!defined('PHPWCMS_ROOT')) { 26 die("You Cannot Access This Script Directly, Have a Nice Day."); 27 } 28 // ---------------------------------------------------------------- 29 30 //search form 31 32 $CNT_TMP .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]); 33 $content["search"] = unserialize($crow["acontent_form"]); 34 $s_result_list = ''; 35 $content["search_word"] = ''; 36 $content['highlight'] = array(); 37 $s_list = array(); 38 39 if(empty($content['search']["text_html"])) { 40 $content['search']['text_html'] = 0; 41 } 42 43 $content['search']['search_filenames'] = empty($content['search']["no_filenames"]) ? true : false; // search/list for file/imagenames 44 $content['search']['show_summary'] = empty($content['search']["hide_summary"]) ? true : false; // show search tester text 45 46 if(!empty($_POST["search_input_field"]) || !empty($_GET['searchwords'])) { 47 48 $s_run = 0; 49 // check search 50 // remove unsecure replacement tags 51 $content["search_word"] = empty($_POST["search_input_field"]) ? rawurldecode($_GET['searchwords']) : $_POST["search_input_field"]; 52 $content["search_word"] = clean_slweg($content["search_word"]); 53 $content["search_word"] = clean_replacement_tags($content["search_word"]); 54 $content["search_word"] = cleanUpSpecialHtmlEntities($content["search_word"]); 55 56 // split all search words 57 $content["search_word"] = explode(' ', $content["search_word"]); 58 $content["search_word"] = array_unique($content["search_word"]); 59 60 $content['search']['highlight_result'] = empty($content["search"]['highlight_result']) ? false : true; 61 $content['search']['wordlimit'] = isset($content["search"]['wordlimit']) && is_intval($content["search"]['wordlimit']) ? intval($content["search"]['wordlimit']) : 35; 62 63 $content["search"]["result_per_page"] = empty($content["search"]['result_per_page']) ? 15 : $content["search"]['result_per_page']; 64 if($content["search"]["result_per_page"] == -1) { 65 $content["search"]["result_per_page"] = 100000; 66 } 67 68 if(!isset($content["search"]["show_always"])) $content["search"]["show_always"] = 1; 69 if(!isset($content["search"]["show_top"])) $content["search"]["show_top"] = 1; 70 if(!isset($content["search"]["show_bottom"])) $content["search"]["show_bottom"] = 1; 71 if(!isset($content["search"]["show_next"])) $content["search"]["show_next"] = 1; 72 if(!isset($content["search"]["show_prev"])) $content["search"]["show_prev"] = 1; 73 if(!isset($content["search"]["minchar"])) $content["search"]["minchar"] = 3; 74 75 if(!isset($content["search"]["start_at"]) || !is_array($content["search"]["start_at"])) { 76 $content["search"]["start_at"] = array(0); 77 } 78 79 // include neccessary frontend functions, but only once 80 include_once (PHPWCMS_ROOT.'/include/inc_front/content/cnt_functions/cnt13.func.inc.php'); 81 $content["search"]["start_at"] = get_SearchForStructureID($content["search"]["start_at"]); 82 83 $content['highlight'] = array(); 84 foreach($content["search_word"] as $key => $value) { 85 //$_strlen_value = MB_SAFE ? mb_strlen($value) : strlen($value); 86 $_strlen_value = strlen($value); 87 if($_strlen_value >= $content["search"]["minchar"]) { 88 $value = trim($value); 89 $content["search_word"][$key] = preg_quote($value); 90 $content["search_word"][$key] = str_replace("\\?", '.?', $content["search_word"][$key]); 91 $content["search_word"][$key] = str_replace("\\*", '.*', $content["search_word"][$key]); 92 $content['highlight'][] = $value; 93 } 94 } 95 96 if(count($content['highlight'])) { 97 98 $s_result_highlight = implode(' ', $content['highlight']); 99 100 if(!empty($_POST["search_input_field"])) { 101 // make a redirection to avoid message when using browser back 102 $GLOBALS['_getVar']['searchstart'] = 1; 103 $GLOBALS['_getVar']['searchwords'] = $s_result_highlight; 104 headerRedirect(PHPWCMS_URL.'index.php' . returnGlobalGET_QueryString('rawurlencode')); 105 } 106 107 $s_result_highlight = rawurlencode($s_result_highlight); 108 109 $sql = "SELECT article_id, article_cid, article_title, article_username, article_subtitle, "; 110 $sql .= "article_summary, article_keyword, UNIX_TIMESTAMP(article_tstamp) AS article_date "; 111 $sql .= "FROM ".DB_PREPEND."phpwcms_article ar "; 112 113 $sql .= "LEFT JOIN ".DB_PREPEND."phpwcms_articlecat ac ON "; 114 $sql .= "(ar.article_cid = ac.acat_id OR ar.article_cid = 0)"; 115 $sql .= " WHERE "; 116 117 // limit to special structure IDs if not all 118 if(count($content["search"]["start_at"])) { 119 120 $sql .= 'ar.article_cid IN ('.implode(',', $content["search"]["start_at"]).')'; 121 122 } else { 123 124 $sql .= "IF(ar.article_cid = 0, " . (empty($GLOBALS['indexpage']['acat_nosearch']) ? 1 : 0) .", 1)"; 125 126 } 127 128 $sql .= " AND ac.acat_nosearch != 1 AND ac.acat_aktiv=1 AND ac.acat_public=1 AND "; 129 if(!FEUSER_LOGIN_STATUS) { 130 $sql .= "ac.acat_regonly=0 AND "; 131 } 132 $sql .= "ar.article_public=1 AND ar.article_aktiv=1 AND ar.article_deleted=0 AND ar.article_nosearch!=1 AND "; 133 // enhanced IF statement by kh 2008/12/03 134 $sql .= "IF((ar.article_begin < NOW() AND ar.article_end > NOW()) OR (ar.article_archive_status=1 AND ac.acat_archive=1), 1, 0) "; 135 $sql .= "GROUP BY ar.article_id"; 136 137 if($sresult = mysql_query($sql, $db)) { 138 $s_search_words = implode('|', $content["search_word"]); 139 while($srow = mysql_fetch_assoc($sresult)) { 140 141 // read article base info for search 142 $s_id = $srow["article_id"]; 143 $s_cid = $srow["article_cid"]; 144 $s_title = $srow["article_title"]; 145 $s_date = $srow["article_date"]; 146 $s_user = $srow["article_username"]; 147 $s_text = $srow["article_subtitle"].' '.$srow["article_summary"]; 148 149 // read article content for search 150 $csql = "SELECT acontent_title, acontent_subtitle, acontent_text, acontent_html, acontent_files, acontent_type, acontent_form, acontent_image FROM "; 151 $csql .= DB_PREPEND."phpwcms_articlecontent WHERE acontent_aid=".$s_id." "; 152 $csql .= "AND acontent_visible=1 AND acontent_trash=0 AND "; 153 if( !FEUSER_LOGIN_STATUS ) { 154 $csql .= 'acontent_granted=0 AND '; 155 } 156 $csql .= "acontent_type IN (0, 1, 2, 4, 5, 6, 7, 11, 14, 26, 27, 29, 100, 31, 32)"; 157 158 159 if($scresult = mysql_query($csql, $db)) { 160 while($scrow = mysql_fetch_row($scresult)) { 161 162 // always title, subtitle 163 $s_text .= ' '.$scrow[0].' '.$scrow[1]; 164 165 switch($scrow[5]) { 166 167 // just no additional search terms 168 case 3: 169 case 8: 170 case 9: 171 case 10: 172 case 12: 173 case 13: 174 case 15: 175 case 16: 176 case 18: 177 case 19: 178 case 20: 179 case 21: 180 case 22: 181 case 23: 182 case 24: 183 case 25: 184 case 28: 185 case 33: 186 case 50: 187 case 51: 188 case 52: 189 case 53: 190 break; 191 192 // only HTML 193 case 6: 194 case 14: $s_text .= ' '.$scrow[3]; 195 break; 196 197 // only TEXT 198 case 0: 199 case 4: 200 case 5: 201 case 11: 202 case 32: 203 case 100: $s_text .= ' '.$scrow[2]; 204 break; 205 206 case 7: // file list, get files listed here 207 $s_text .= ' '.$scrow[2]; 208 if($content['search']['search_filenames']) { 209 $s_files = getFileInformation( explode(':', $scrow[4]) ); 210 if(is_array($s_files) && count($s_files)) { 211 // retrieve file information 212 foreach($s_files as $s_files_value) { 213 $s_text .= ' '.$s_files_value['f_name']; 214 } 215 } 216 } 217 break; 218 219 // optimize images for search 220 case 1 : $s_text .= ' '.$scrow[2]; 221 if($content['search']['search_filenames'] && $scrow[7]) { 222 $scrow[7] = explode(":", $scrow[7]); 223 $s_text .= ' '.$scrow[1]; 224 } 225 break; 226 227 case 29: $s_text .= ' '.$scrow[2]; 228 case 2: $scrow[6] = @unserialize($scrow[6]); 229 if(isset($scrow[6]['images']) && is_array($scrow[6]['images']) && count($scrow[6]['images'])) { 230 $s_imgname = ''; 231 foreach($scrow[6]['images'] as $s_imgtext) { 232 233 $s_imgtext[6] = getImageCaption($s_imgtext[6], '', true); 234 235 if($s_imgtext[6]['caption']) { 236 $s_text .= ' '.$s_imgtext[6]['caption']; 237 } elseif($s_imgtext[6]['title']) { 238 $s_text .= ' '.$s_imgtext[6]['title']; 239 } elseif($s_imgtext[6]['alt']) { 240 $s_text .= ' '.$s_imgtext[6]['alt']; 241 } 242 243 if($content['search']['search_filenames']) { 244 $s_imgname .= ' '.$s_imgtext[1]; 245 } 246 } 247 $s_text .= $s_imgname; 248 } 249 break; 250 251 case 31: $s_text .= ' '.$scrow[3]; 252 $scrow[6] = @unserialize($scrow[6]); 253 if(isset($scrow[6]['images']) && is_array($scrow[6]['images']) && count($scrow[6]['images'])) { 254 foreach($scrow[6]['images'] as $s_imgtext) { 255 $s_text .= ' '.$s_imgtext['caption']; 256 //$s_text .= ' '.$s_imgtext['url']; 257 if($content['search']['search_filenames']) { 258 $s_text .= ' '.$s_imgtext['thumb_name']; 259 $s_text .= ' '.$s_imgtext['zoom_name']; 260 } 261 } 262 } 263 break; 264 265 // search recipe 266 case 26: $s_text .= ' '.$scrow[2].' '.$scrow[3]; 267 $scrow[6] = @unserialize($scrow[6]); 268 if(isset($scrow[6]['preparation'])) { 269 $s_text .= ' '.$scrow[6]['preparation'].' '.$scrow[6]['ingredients']; 270 $s_text .= ' '.$scrow[6]['calorificvalue'].' '.$scrow[6]['calorificvalue_add']; 271 } 272 break; 273 274 // all other non defined CPs 275 default: $s_text .= ' '.$scrow[2].' '.$scrow[3]; 276 277 } 278 $s_text = preg_replace('/<script[^>]*>.*?<\/script>/is', '', $s_text); // strip all <script> Tags 279 $s_text = str_replace(array('~', '|', ':', 'http', '//', '_blank'), ' ', $s_text ); 280 281 } 282 mysql_free_result($scresult); 283 } 284 285 // search given string 286 if(isset($s_result)) { 287 unset($s_result); 288 } 289 $s_result = array(); 290 291 $s_text = clean_search_text($s_text.' --##-'.$srow["article_keyword"].' '.$s_title.' '.$s_user.'-##--'); 292 293 preg_match_all('/'.$s_search_words.'/is', $s_text, $s_result ); //search string 294 295 $s_text = preg_replace("/(<\/?)(\w+)([^>]*>)/i", '', $s_text); 296 297 $s_count = 0; //set search_result to 0 298 foreach($s_result as $svalue) { 299 $s_count += count($svalue); 300 } 301 302 if($s_count) { 303 304 $s_text = preg_replace('/--##-.*?-##--/', '', $s_text); 305 306 $s_list[$s_run]["id"] = $s_id; 307 $s_list[$s_run]["cid"] = $s_cid; 308 $s_list[$s_run]["rank"] = $s_count; 309 $s_list[$s_run]["title"] = $content['search']['highlight_result'] ? highlightSearchResult($s_title, $content['highlight']) : $s_title; 310 $s_list[$s_run]["date"] = $s_date; 311 $s_list[$s_run]["user"] = $s_user; 312 $s_list[$s_run]['query'] = 'aid='.$s_id; 313 314 if($content['search']['show_summary'] && $content['search']['wordlimit'] > 0) { 315 $s_list[$s_run]["text"] = getCleanSubString($s_text, $content['search']['wordlimit'], $template_default['ellipse_sign'], 'word'); 316 $s_list[$s_run]["text"] = html_specialchars($s_list[$s_run]["text"]); 317 if($content['search']['highlight_result']) { 318 $s_list[$s_run]["text"] = highlightSearchResult($s_list[$s_run]["text"], $content['highlight']); 319 } 320 } else { 321 $s_list[$s_run]["text"] = ''; 322 } 323 324 $s_run++; 325 } 326 } 327 mysql_free_result($sresult); 328 329 } 330 331 // at this point we inject search by module search results 332 if(isset($content['search']['module']) && is_array($content['search']['module']) && count($content['search']['module'])) { 333 foreach($content['search']['module'] as $key => $value) { 334 if(isset($phpwcms['modules'][$key]) && is_file($phpwcms['modules'][$key]['path'].'frontend.search.php')) { 335 336 // include module search 337 include($phpwcms['modules'][$key]['path'].'frontend.search.php'); 338 339 } 340 } 341 } 342 343 // news search 344 if(!empty($content['search']['search_news'])) { 345 346 // initialize search for news 347 $s_news = new search_News(); 348 349 // set current search result counter 350 $s_news->search_result_entry = $s_run; 351 $s_news->search_words = $s_search_words; 352 $s_news->search_highlight = $content['search']['highlight_result']; 353 $s_news->search_highlight_words = $content['highlight']; 354 $s_news->search_wordlimit = $content['search']['wordlimit']; 355 $s_news->search_category = $content['search']['news_category']; 356 $s_news->search_language = $content['search']['news_lang']; 357 $s_news->search_andor = $content['search']['news_andor']; 358 $s_news->ellipse_sign = $template_default['ellipse_sign']; 359 $s_news->search_target_url = $content['search']['news_url']; 360 361 $s_news->search(); 362 363 // add news search results 364 $s_list += $s_news->search_results; 365 366 // get final search result counter 367 $s_run = $s_news->search_result_entry; 368 369 unset($s_news); 370 } 371 372 373 if($s_run) { 374 $CNT_TMP .= $content['search']['text_html'] ? $content["search"]["text_result"] : nl2br(html_specialchars($content['search']['text_result'])); 375 376 // create search result listing 377 // ranking 378 foreach($s_list as $s_key => $svalue) { 379 $s_rank[$s_key] = $s_list[$s_key]["rank"]; 380 } 381 arsort($s_rank, SORT_NUMERIC); 382 383 //check result listing 384 $_search_results = count($s_rank); 385 $_search_max_pages = 1; 386 $_search_current_page = 1; 387 $_search_next_page = 1; 388 $_search_prev_page = 1; 389 if($_search_results > $content["search"]["result_per_page"]) { 390 $_search_max_pages = ceil($_search_results / $content["search"]["result_per_page"]); 391 $_search_current_page = empty($_GET['searchstart']) ? 1 : intval($_GET['searchstart']); 392 if($_search_current_page > $_search_max_pages) { 393 $_search_current_page = $_search_max_pages; 394 } elseif($_search_current_page < 1) { 395 $_search_current_page = 1; 396 } 397 398 if($_search_current_page == 1) { 399 $_search_next_page = 2; 400 $_search_prev_page = 1; 401 } elseif($_search_current_page == $_search_max_pages) { 402 $_search_next_page = $_search_current_page; 403 $_search_prev_page = $_search_current_page - 1; 404 } else { 405 $_search_next_page = $_search_current_page + 1; 406 $_search_prev_page = $_search_current_page - 1; 407 } 408 } 409 410 $_search_pagination_counter = 1; 411 $_search_start_at = ($_search_current_page-1) * $content["search"]["result_per_page"]; 412 $_search_end_at = $content["search"]["result_per_page"] * $_search_current_page; 413 414 foreach($s_rank as $s_key => $svalue) { 415 416 if($_search_pagination_counter <= $_search_start_at) { 417 $_search_pagination_counter++; 418 continue; 419 } 420 421 $s_result_list .= '<div class="search-result">'.LF; 422 $s_result_list .= ' <h3><a href="'; 423 424 if(strpos($s_list[$s_key]['query'], 'index.php') !== false || strpos($s_list[$s_key]['query'], 'http') === 0) { 425 $s_result_list .= $s_list[$s_key]['query']; 426 } else { 427 $s_result_list .= 'index.php?'.$s_list[$s_key]['query']; 428 } 429 430 if($content['search']['highlight_result']) { 431 $s_result_list .= '&highlight='.$s_result_highlight; 432 } 433 $s_result_list .= ($content["search"]["newwin"]) ? '" target="_blank">' : '">'; 434 $s_result_list .= $s_list[$s_key]["title"].'</a></h3>'.LF; 435 436 if($content['search']['show_summary'] && $s_list[$s_key]["text"]) { 437 $s_result_list .= ' <p>'.$s_list[$s_key]["text"].'</p>'.LF; 438 } 439 $s_result_list .= '</div>'.LF; 440 441 if($_search_pagination_counter == $_search_end_at) { 442 break; 443 } else { 444 $_search_pagination_counter++; 445 } 446 447 } 448 449 $_search_next_link = ''; 450 $_search_prev_link = ''; 451 $_search_linkblock = ''; 452 453 // create link to search page 454 unset($GLOBALS['_getVar']['searchstart']); 455 $GLOBALS['_getVar']['searchwords'] = $s_result_highlight; 456 $_search_page_link = 'index.php' . returnGlobalGET_QueryString('htmlentities'); 457 458 if($_search_end_at > $_search_results) $_search_end_at = $_search_results; 459 460 $_search_pages_of = $content["search"]["label_pages"]; 461 $_search_pages_of = str_replace('#####', $_search_results, $_search_pages_of); 462 $_search_pages_of = str_replace('####', $_search_end_at, $_search_pages_of); 463 $_search_pages_of = str_replace('###', $_search_start_at+1, $_search_pages_of); 464 $_search_pages_of = str_replace('##', $_search_max_pages, $_search_pages_of); 465 $_search_pages_of = str_replace('#', $_search_current_page, $_search_pages_of); 466 467 if($_search_next_page != $_search_current_page) { 468 469 $_search_next_link = '<a href="'.$_search_page_link.'&searchstart='. ($_search_current_page + 1 ).'">'; 470 471 } 472 if($_search_prev_page != $_search_current_page) { 473 474 $_search_prev_link = '<a href="'.$_search_page_link.'&searchstart='. ($_search_current_page - 1 ).'">'; 475 476 } 477 478 $GLOBALS['_search_next_link_t'] = ''; 479 $GLOBALS['_search_prev_link_t'] = ''; 480 $GLOBALS['_search_navi'] = ''; 481 482 $_search_pages_of = preg_replace_callback('/\{NEXT:(.*?)\}/', create_function('$matches', '$GLOBALS["_search_next_link_t"]=$matches[1]; return "{NEXT}";'), $_search_pages_of); 483 $_search_pages_of = preg_replace_callback('/\{PREV:(.*?)\}/', create_function('$matches', '$GLOBALS["_search_prev_link_t"]=$matches[1]; return "{PREV}";'), $_search_pages_of); 484 $_search_pages_of = preg_replace_callback('/\{NAVI:(.*?)\}/', create_function('$matches', '$GLOBALS["_search_navi"]=$matches[1]; return "{NAVI}";'), $_search_pages_of); 485 486 if($_search_prev_link) { 487 $_search_prev_link = $_search_prev_link.$GLOBALS['_search_prev_link_t'].'</a>'; 488 } elseif($content["search"]["show_prev"]) { 489 $_search_prev_link = $GLOBALS['_search_prev_link_t']; 490 } 491 if($_search_next_link) { 492 $_search_next_link = $_search_next_link.$GLOBALS['_search_next_link_t'].'</a>'; 493 } elseif($content["search"]["show_next"]) { 494 $_search_next_link = $GLOBALS['_search_next_link_t']; 495 } 496 497 $_search_pages_of = str_replace('{NEXT}', $_search_next_link, $_search_pages_of); 498 $_search_pages_of = str_replace('{PREV}', $_search_prev_link, $_search_pages_of); 499 500 501 $GLOBALS['_search_navi'] = explode(',', $GLOBALS['_search_navi'], 2); 502 $GLOBALS['_search_navi'][0] = trim($GLOBALS['_search_navi'][0]); 503 $GLOBALS['_search_navi'][1] = empty($GLOBALS['_search_navi'][1]) ? '' : explode('|', $GLOBALS['_search_navi'][1]); 504 505 if($GLOBALS['_search_navi'][0] == '123') { 506 507 $GLOBALS['_search_navi'][1][0] = empty($GLOBALS['_search_navi'][1][0]) ? ' ' : $GLOBALS['_search_navi'][1][0]; // spacer 508 $GLOBALS['_search_navi'][1][1] = empty($GLOBALS['_search_navi'][1][1]) ? '' : $GLOBALS['_search_navi'][1][1]; // link prefix 509 $GLOBALS['_search_navi'][1][2] = empty($GLOBALS['_search_navi'][1][2]) ? '' : $GLOBALS['_search_navi'][1][2]; // link suffix 510 511 $_search_navi_x = array(); 512 for($_search_page_i = 1; $_search_page_i <= $_search_max_pages; $_search_page_i++) { 513 514 $_search_navi_x[$_search_page_i] = $GLOBALS['_search_navi'][1][1]; 515 if($_search_current_page == $_search_page_i) { 516 $_search_navi_x[$_search_page_i] .= $_search_page_i; 517 } else { 518 $_search_navi_x[$_search_page_i] .= '<a href="'.$_search_page_link.'&searchstart='. $_search_page_i .'">' . $_search_page_i . '</a>'; 519 } 520 $_search_navi_x[$_search_page_i] .= $GLOBALS['_search_navi'][1][2]; 521 522 } 523 $GLOBALS['_search_navi'] = implode($GLOBALS['_search_navi'][1][0], $_search_navi_x); 524 525 } elseif($GLOBALS['_search_navi'][0] == '1-3') { 526 527 $GLOBALS['_search_navi'][1][0] = empty($GLOBALS['_search_navi'][1][0]) ? ' ' : $GLOBALS['_search_navi'][1][0]; // spacer 528 $GLOBALS['_search_navi'][1][1] = empty($GLOBALS['_search_navi'][1][1]) ? '' : $GLOBALS['_search_navi'][1][1]; // link prefix 529 $GLOBALS['_search_navi'][1][2] = empty($GLOBALS['_search_navi'][1][2]) ? '' : $GLOBALS['_search_navi'][1][2]; // link suffix 530 531 $_search_navi_x = array(); 532 for($_search_page_i = 1; $_search_page_i <= $_search_max_pages; $_search_page_i++) { 533 534 $_search_navi_x[$_search_page_i] = $GLOBALS['_search_navi'][1][1]; 535 $_search_page_i_start = ($_search_page_i-1) * $content["search"]["result_per_page"]; 536 $_search_page_i_end = $_search_page_i_start + $content["search"]["result_per_page"]; 537 if($_search_results < $_search_page_i_end) { 538 $_search_page_i_end = $_search_results; 539 } 540 $_search_page_i_start++; 541 if($_search_current_page == $_search_page_i) { 542 $_search_navi_x[$_search_page_i] .= $_search_page_i_start.'-'.$_search_page_i_end; 543 } else { 544 $_search_navi_x[$_search_page_i] .= '<a href="'.$_search_page_link.'&searchstart='. $_search_page_i .'">' . $_search_page_i_start.'-'.$_search_page_i_end . '</a>'; 545 } 546 $_search_navi_x[$_search_page_i] .= $GLOBALS['_search_navi'][1][2]; 547 548 } 549 $GLOBALS['_search_navi'] = implode($GLOBALS['_search_navi'][1][0], $_search_navi_x); 550 551 552 } else { 553 $GLOBALS['_search_navi'] = ''; 554 } 555 $_search_pages_of = str_replace('{NAVI}', $GLOBALS['_search_navi'], $_search_pages_of); 556 557 $_search_linkblock = '<div class="phpwcmsSearchNextPrev">'; 558 $_search_linkblock .= $_search_pages_of; 559 $_search_linkblock .= '</div>' . LF; 560 561 if($s_result_list) { 562 $s_result_listing = '<div class="'. ($content["search"]["style_result"] ? $content["search"]["style_result"] : 'phpwcmsSearchResult') .'">'; 563 if($content["search"]["show_top"] && ($_search_max_pages > 1 || $content["search"]["show_always"])) { 564 $s_result_listing .= $_search_linkblock; 565 } 566 $s_result_listing .= $s_result_list; 567 if($content["search"]["show_bottom"] && ($_search_max_pages > 1 || $content["search"]["show_always"])) { 568 $s_result_listing .= $_search_linkblock; 569 } 570 $s_result_listing .= '</div>'; 571 572 $s_result_list = $s_result_listing; 573 } 574 575 } else { 576 577 $CNT_TMP .= $content['search']['text_html'] ? $content["search"]["text_noresult"] : nl2br(html_specialchars($content['search']['text_noresult'])); 578 } 579 580 } else { 581 582 $CNT_TMP .= $content['search']['text_html'] ? $content["search"]["text_noresult"] : nl2br(html_specialchars($content['search']['text_noresult'])); 583 584 } 585 } else { 586 587 $CNT_TMP .= $content['search']['text_html'] ? $content["search"]["text_intro"] : nl2br(html_specialchars($content['search']['text_intro'])); 588 589 } 590 591 if(count($content['highlight'])) { 592 $content["search_word"] = html_specialchars(implode(' ', $content['highlight'])); 593 } else { 594 $content["search_word"] = ''; 595 } 596 597 if(isset($content["search"]["result_per_page"])) { 598 599 //build search form 600 $CNT_TMP .= LF; 601 $CNT_TMP .= '<div class="search_form"'; 602 switch($content["search"]["align"]) { 603 case 1: $CNT_TMP .= ' align="right"'; break; 604 case 2: $CNT_TMP .= ' align="center"'; break; 605 } 606 $CNT_TMP .= '>'; 607 608 unset($GLOBALS['_getVar']['searchwords'], $GLOBALS['_getVar']['searchstart']); 609 610 $CNT_TMP .= '<form action="index.php' . returnGlobalGET_QueryString('htmlentities') . '" method="post">'.LF; 611 $CNT_TMP .= '<table cellspacing="0" cellpadding="0" border="0" summary="Search">'.LF.'<tr>'.LF; 612 if($content["search"]["label_input"]) { 613 $CNT_TMP .= '<td class="formLabel">'; 614 $CNT_TMP .= $content["search"]["label_input"]."</td>\n<td> </td>\n"; 615 } 616 $CNT_TMP .= '<td class="formSearch">'; 617 $CNT_TMP .= '<input name="search_input_field" id="search_input_field" type="text" size="20" maxlength="200" '; 618 $CNT_TMP .= 'value="'.$content["search_word"].'"'; 619 if($content["search"]["style_input"]) { 620 $CNT_TMP .= ' class="'.$content["search"]["style_input"].'"'; 621 } 622 $CNT_TMP .= " /></td>\n<td> </td>\n<td>"; 623 $CNT_TMP .= '<input type="submit" name="submit" id="search_submit_button" value="'; 624 $CNT_TMP .= ($content["search"]["label_button"]) ? $content["search"]["label_button"] : 'Search'; 625 $CNT_TMP .= '"'; 626 if($content["search"]["style_button"]) { 627 $CNT_TMP .= ' class="'.$content["search"]["style_button"].'"'; 628 } 629 $CNT_TMP .= " /></td>\n"; 630 $CNT_TMP .= "</tr>\n</table>\n</form>\n</div>\n"; 631 } 632 633 $CNT_TMP .= $s_result_list; 634 635 636 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Nov 16 22:51:00 2010 | Cross-referenced by PHPXref 0.7 |