All pastes #254375 Raw Edit

chronos

public text v1 · immutable
#254375 ·published 2006-11-21 20:19 UTC
rendered paste body
<?php
/********************************************************************************
*       RADIUM SYSTEMS LTDA
*
* Component C-Publisher
* Authors:  Gustavo B. Oliveira
* Date:         23/05/2002
* Description:  Search result page
*
* CVS Status
* $Id: search_engine.php,v 1.11 2006/10/23 13:10:34 handrus Exp $
*
*********************************************************************************/

//Cleaning the search parameter
$l_strSearch = strip_tags($l_strSearch);

if ( $l_strSearch == '' || $l_strSearch == NULL ) {
  header("Location: search_error.php");
  exit;
}

if (($l_intBuscaLib == NULL)&&($l_intBuscaEvt == NULL)&&($l_intBuscaPess == NULL)&&($l_intBuscaPub == NULL)&&($l_intBuscaFor == NULL)&&($l_intBuscaPR == NULL)) {
  header("Location: search_error.php");
  exit;
}

//Ok to include
unset ($checkpermission);
$checkpermission = 0; // Initialization of variables

include_once("incCPub/comuns.inc");

/*
if (!$f_iLogged) {
  loginGuest($_SERVER['REQUEST_URI']);
  exit;
}*/

//Including archieves
include_once('packSearch/classSearch.cd');
include_once('packLib/classLibDoc.cd');
include_once('packEvent/classEvent.cd');
include_once("packForumRadium/classForMsg.cd");
include_once("packForumRadium/classForMsg.cd");

if (!$f_iLogged) { // Se não estiver logado, atribui as permissões padrão
  $f_arrData["usrcod"] = 0;
  $f_arrData["groups"] = DEFAULT_COMMUNITY;
}

//Create a Data Access Abstract Layer
$l_objDataAccessServices = new DataAccessServices();

//Receiving the Connection to the Database
$l_objConnection = $l_objDataAccessServices->OpenDataServices();

//Creating the object
$l_objSearch = new Search($l_objConnection);

unset($l_arrSearchEngine);

$l_intCount = 0;
unset($l_output);

//********** Search News

if ($l_intBuscaPub == 1) {
  $l_arrSearchEngine = $l_objSearch->SearchEngine($l_strSearch, $f_arrData['community']);
  while ( $l_intCount < count($l_arrSearchEngine) ){
    $l_outputNews .= '<tr>';
    $l_outputNews .= '<td class="BuscaText5" valign="top">'.$l_arrSearchEngine[$l_intCount]["data"].'</td>';
    $l_outputNews .= '</tr>';
    $l_outputNews .= '<tr>';
    $l_outputNews .= '<td valign="top"><a class="BuscaLink3" href="search_page.php?l_intNewCod='.$l_arrSearchEngine[$l_intCount]["codigo"].'">'.$l_arrSearchEngine[$l_intCount]["titulo"].'</a></td>';
    $l_outputNews .= '</tr><tr><td>&nbsp;</td></tr>';

    $l_intCount++;
  }
  $counter_news = $l_intCount;
}

//********** Search Event

if ($l_intBuscaEvt == 1) {
  $l_objEvent = new Event($l_objConnection);
  $l_arrSearchEngine = $l_objEvent->frontSearch($l_strSearch, $f_arrData['community']);
  $l_intAux = 0;
  while ( $l_arrEvt = $l_arrSearchEngine->next() ) {
    $l_outputEvt .= '<tr>';
	$l_outputEvt .= '<td colspan="2" class="BuscaLink3">&nbsp;<a class="BuscaLink3" href="/event/pages/vieweventf.php?l_intEvtCod='.$l_arrEvt["evtcod"].'">'.$l_arrEvt["evttit"].'</a></td>';
	$l_outputEvt .= "<td colspan='2'><pre>".var_dump($l_arrEvt).'</pre></td>';
	$l_outputEvt .= '</tr>';
	$l_outputEvt .= '<tr><td colspan="2">&nbsp;</td></tr>';

	$l_intAux++;
  }

  $l_intCount += $l_intAux;
  $counter_evt = $l_intAux;
}

//********** Search Users

if ($l_intBuscaPess == 1) {
  $l_objSearch1 = new Search($l_objConnection);
  $l_arrUser = $l_objSearch1->searchUser($l_strSearch, $f_arrData['community']);

  $l_intAux = 0;
  while (  $l_intAux < count($l_arrUser) ) {

        $l_outputPeople .= '<tr>';
        $l_outputPeople .= '<td valign="top"><a class="BuscaLink3" href=\'javascript:popup2("/register/pages/impdig.php?l_intUsrCod='.$l_arrUser[$l_intAux]["codigo"].'&pop=1", "ImpDig", "392", "600", "0", "0", "yes");\'>'.$l_arrUser[$l_intAux]["titulo"].'</a></td>';
        $l_outputPeople .= '</tr>';

        $l_intAux++;
  }

  $l_intCount += $l_intAux;
  $counter_people = $l_intAux;
}

//********** Search Library Docs

if ($l_intBuscaLib == 1) {
  $l_intAux = 0;
  $l_objDoc = new LibDoc($l_objConnection);


  $l_objRecordSet = $l_objDoc->frontSearch($l_strSearch, $g_arrUsrData["usrcod"], $g_arrUsrData["groups"], "0", $f_arrData['community']);
  while ($l_arrRow = $l_objRecordSet->next())  {
      $find = 1;
      $l_outputDoc .= '<tr><td><table width="100%"><tr><td align="left" class="BuscaLink3"><a class="BuscaLink3" href="javascript:viewdoc('.$l_arrRow["doccod"].');">'.$l_arrRow["doctitle"].'</a><br><br></td></tr></table></td></tr>';
      $l_intAux++;
  }

  $l_intCount += $l_intAux;
  $counter_docs = $l_intAux;
}

//********* Search Forum

$l_objForMsg = new ForMsg($l_objConnection);

if ($l_intBuscaFor == 1) {
  //Forum
  $l_intAux = 0;
  $l_arrSubject = $l_objForMsg->SearchEngine($l_strSearch, null, null, IS_FOR_FORUM, $f_arrData['community']);
  $l_intAux = count($l_arrSubject['assunto']);
  for($i = 0; $i < $l_intAux; $i++) {
    $assunto = $l_arrSubject['descricao'][$i];
    $l_outputForum .= '<tr>
                       <td align="left" class="BuscaLink3">
                       <a class="BuscaLink3" href="/forum/pages/forummsg.php?l_intFocCod='.$l_arrSubject['categoria'][$i]."&l_intFosCod=".$l_arrSubject['subcat'][$i]."&l_intFasCod=".$l_arrSubject['assunto'][$i].'">'.$assunto.'</a><br>&nbsp;
					   </td>
					   </tr>';
  }

  $l_intCount += $l_intAux;
  $counter_forum = $l_intAux;
}

//********* Search Faq
//include_once("incReg/permission.inc");
//if ($f_isLogged)
//{
if ($l_intBuscaPR == 1) {
  //Faq
  $l_intAux = 0;
  $l_arrSubject = $l_objForMsg->SearchEngine($l_strSearch, null, null, IS_FOR_FAQ, $f_arrData['community']);
  $l_intAux = count($l_arrSubject['assunto']);
  for($i = 0; $i < $l_intAux; $i++) {
    $pergunta = $l_arrSubject['descricao'][$i];
    $l_outputFaq .= '<tr>
                     <td align="left" class="BuscaLink3">
                     <a class="BuscaLink3" href="/faq/pages/forummsg.php?l_intFocCod='.$l_arrSubject['categoria'][$i]."&l_intFosCod=".$l_arrSubject['subcat'][$i]."&l_intFasCod=".$l_arrSubject['assunto'][$i].'">'.$pergunta.'</a><br>&nbsp;
					 </td>
                     </tr>';
  }

  $l_intCount += $l_intAux;
  $counter_faq = $l_intAux;
}
//}

//Closing the connection
$l_objDataAccessServices->CloseDataServices($l_objConnection);


// Header of community
if (isset($f_arrData['community'])) {
  $header = "header_".$f_arrData['community'];
  $header = "ltCPub/".$$header;
  include($header);
}
else {
  //include("ltCPub/header_pre_login.php");
  include("incCPub/page_header.inc");
}
//include('ltCPub/basic_page_header.php');
?>

<script language="javascript">
function viewdoc(cod) {
   window.open("/lib/pages/viewdoc.php?l_intDocCod="+cod, "viewdoc", "directories=no,height=480,width=540,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,copyhistory=no");
}

function showdoc(cod) {
   window.open("/lib/pages/download.php?l_intDocCod="+cod+"&l_intView=1", "showdoc", "directories=no,height=480,width=540,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,copyhistory=no");
}

function addfav(cod) {
   window.open("/lib/pages/insfav.php?l_intDocCod="+cod, "addfav", "directories=no,height=480,width=540,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,copyhistory=no");
}
</script>

<table width="100%" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td width="12">&nbsp;</td>
    <td width="743">&nbsp;</td>
  </tr>
    <td width="12">&nbsp;</td>
    <td>


  <table bgcolor="<?php echo MAIN_COLOR; ?>" width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr>
      <td colspan="3" bgcolor="#ffffff" class="BuscaText5"><b>Resultados da Busca por:</b> <font class="BuscaText3"><?php echo $l_strSearch; ?></font></td>
    </tr>
    <tr>
        <td width="100%">
        <table bgcolor="<?php echo MAIN_COLOR; ?>" width="100%" cellpadding="0" cellspacing="0" border="0">
          <tr><td>&nbsp;</td></tr>
          <tr>
            <td><font class="BuscaText5"><?php echo LABEL_SEARCH_RESULT; ?></font><font class="BuscaText2"><?php echo $l_intCount; ?></font></td>
          </tr>
          <tr>
            <td width="100%">&nbsp;</td>
          </tr> 
          <tr>
            <td width="100%">
              <table bgcolor="#FFFFFF" width="80%" cellpadding="0" cellspacing="5" border="0">
                <tr>

                  <?php if ($l_intBuscaLib == 1) { ?>
                    <td align="left" class="BuscaText2"><?php if($counter_docs > 0){ ?><a href="#documentos" class="BuscaLink3">Documentos</a><?php }else{ ?>Documentos<?php } echo ":  ".$counter_docs; ?></td>
                  <?php } ?>

                  <?php if ($l_intBuscaEvt == 1) { ?>
                    <td align="left" class="BuscaText2"><?php if($counter_evt >	0){ ?><a href="#eventos" class="BuscaLink3">Eventos</a><?php }else{ ?>Eventos<?php } echo ":  ".$counter_evt; ?></td>
                  <?php } ?>

                  <?php if ($l_intBuscaPess == 1) { ?>
                    <td align="left" class="BuscaText2"><?php if($counter_people > 0){ ?><a href="#pessoas" class="BuscaLink3">Pessoas</a><?php }else{ ?>Pessoas<?php } echo ":  ".$counter_people; ?></td>
                  <?php } ?>

                  <?php if ($l_intBuscaPub == 1) { ?>
                    <td align="left" class="BuscaText2"><?php if($counter_news > 0){ ?><a href="#noticias" class="BuscaLink3">Notícias</a><?php }else{ ?>Notícias<?php } echo ":  ".$counter_news; ?></td>
                  <?php } ?>

                  <?php if ($l_intBuscaFor == 1) { ?>
                    <td align="left" class="BuscaText2"><?php if($counter_forum > 0){ ?><a href="#forum" class="BuscaLink3">Fórum</a><?php }else{ ?>Fórum<?php } echo ":  ".$counter_forum; ?></td>
                  <?php } ?>

                  <?php if ($l_intBuscaPR == 1) { ?>
                    <td align="left" class="BuscaText2"><?php if($counter_faq > 0){ ?><a href="#faq" class="BuscaLink3">P&amp;R</a><?php }else{ ?>P&amp;R<?php } echo ":  ".$counter_faq; ?></td>
                  <?php } ?>
 
                </tr>
              </table>
            </td>
          </tr>
          <tr>


          <!-- Begin Documentos -->
          <?php
            if($l_outputDoc != '')
            {
              ?>
                <tr><td>&nbsp;</td></tr>
                <tr>
                  <td width="100%" align="left" valign="top">
                    <table width="100%" cellpadding="3" cellspacing="3" style="border: 1px solid #669966;" border="0">
                      <tr>
                        <td bgcolor="<?php echo CPUB_CSS_COLOR_8; ?>" valign="top" class="BuscaText6"><a name="documentos">Documentos</a></td>
                      </tr>
                      <tr>
                        <td width="100%" valign="top">
                          <table width="100%" cellpadding="3" cellspacing="3" border="0" style="border: 1px solid #669966;">
                            <?php
                              echo $l_outputDoc;
                            ?>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              <?php
            }
          ?>
          <!-- End Documentos -->
		  <!-- Begin Eventos -->
		  <?php
			if($l_outputEvt != '')
			{
		  ?>
		  <tr><td>&nbsp;</td></tr>
		  <tr>
			<td width="100%" align="left" valign="top">
			<table  width="100%" cellpadding="2" cellspacing="2" border="0"	style="border: 1px solid #669966;">
            <tr bgcolor="<?php echo CPUB_CSS_COLOR_8;?>">
              <td width="100%" align='left' valign='top' class='BuscaText6'><a name='eventos' class='BuscaText6'>Eventos</a></td>
            </tr>
			<tr>
              <td width="100%" valign="top">
                <table width="100%" cellpadding="2" cellspacing="0" border="0" style="border: 1px solid #669966;">
				<?php
                  echo $l_outputEvt;
				?>
				</table>
			  </td>
            </tr>
            </table>
            </td>
          </tr>
          <?php
            }
          ?>
          <!-- End Eventos -->
          <!-- Begin Pessoas -->
          <?php
            if($l_outputPeople != '')
            {
              ?>
                <tr><td><br>&nbsp;<br><br></td></tr>
                <tr>
                  <td width="100%" align="left" valign="top">
                    <table width="100%" cellpadding="3" cellspacing="3" border="0" style="border: 1px solid #669966;">
                                            <tr>
                        <td bgcolor="<?php echo CPUB_CSS_COLOR_8; ?>" valign="top" class="BuscaText6"><a name="pessoas">Pessoas</a></td>
                      </tr>
                        <tr>
                        <td width="100%" valign="top">
                          <table width="100%" cellpadding="2" cellspacing="0" border="0" style="border: 1px solid #669966;">
                            <?php
                              echo $l_outputPeople;
                            ?>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              <?php
            }
          ?>
          <!-- End Pessoas -->
          <!-- Begin Conteudos -->
          <?php
            if($l_outputNews != '')
            {
              ?>
                <tr><td><br>&nbsp;<br><br></td></tr>
                <tr>
                  <td width="100%" align="left" valign="top">
                    <table width="100%" cellpadding="3" cellspacing="3" border="0" style="border: 1px solid #669966;">
                    <tr>
                        <td bgcolor="<?php echo CPUB_CSS_COLOR_8; ?>" valign="top" class="BuscaText6"><a name="noticias">Notícias</a></td>
                      </tr>
                      <tr>
                        <td width="100%" valign="top">
                          <table width="100%" cellpadding="3" cellspacing="3" border="0" style="border: 1px solid #669966;">
                            <?php
                              echo $l_outputNews;
                            ?>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              <?php
            }
          ?>
          <!-- End Conteudos -->
          <!-- Begin Fórum -->
          <?php
            if($l_outputForum != '')
            {
              ?>
                <tr><td><br>&nbsp;<br><br></td></tr>
                <tr>
                  <td width="100%" align="left" valign="top">
                    <table width="100%" cellpadding="3" cellspacing="3" border="0" style="border: 1px solid #669966;">                      <tr>
                        <td bgcolor="<?php echo CPUB_CSS_COLOR_8; ?>" valign="top" class="BuscaText6"><a name="forum">Fórum</a></td>
                      </tr>
                      <tr>
                        <td width="100%" valign="top">
                            <table width="100%" cellpadding="3" cellspacing="3" border="0" style="border: 1px solid #669966;"> 
                            <?php
                              echo $l_outputForum;
                            ?>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              <?php
            }
          ?>
          <!-- End Fórum -->
          <!-- Begin Faq -->
          <?php
            if($l_outputFaq != '')
            {
              ?>
                <tr><td><br>&nbsp;<br><br></td></tr>
                <tr>
                  <td width="100%" align="left" valign="top">
                    <table width="100%" cellpadding="3" cellspacing="3" border="0" style="border: 1px solid #669966;">                      <tr>
                        <td bgcolor="<?php echo CPUB_CSS_COLOR_8; ?>" valign="top" class="BuscaText6"><a name="faq">P&amp;R</a></td>
                      </tr>
                      <tr>
                        <td width="100%" valign="top">
                            <table width="100%" cellpadding="3" cellspacing="3" border="0" style="border: 1px solid #669966;"> 
                            <?php
                              echo $l_outputFaq;
                            ?>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              <?php
            }
          ?>
          <!-- End Faq --> 
        </table>
      </td>
    </tr>
    <tr><td>&nbsp;</td></tr>
  </table>

</td></tr>
</table>


<!-- Closing headers tables -->
<?php
include('ltCPub/basic_page_footer.php');
include("ltRA/footerfront.php");
?>