[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_front/content/ -> cnt13.article.inc.php (source)

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


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7