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