/var/www/vhosts/sivana.com.br/httpdocs/busca.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<?
 
include_once("init.php");
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="iso-8859-1">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="icon" href="../../favicon.ico">

        <title>Sivana | Busca</title>
        <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER HTTP_SERVER) . DIR_WS_CATALOG?>" />
        <!-- Bootstrap core CSS -->
        <link href="dist/css/bootstrap.min.css" rel="stylesheet">

        <!-- Custom styles for this template -->
        <link href="css/sivana.css" rel="stylesheet">
        <!-- Owl Carousel Assets -->
        <link href="owl-carousel/owl.carousel.css" rel="stylesheet">
        <link href="owl-carousel/owl.theme.css" rel="stylesheet">
        <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
        <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
        <script src="assets/js/ie-emulation-modes-warning.js"></script>

        <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
        <script src="assets/js/ie10-viewport-bug-workaround.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
        <script type="text/javascript" src="js/switch_display.js"></script>
        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>
        <? include ("topo.php"?>
        <!-- Static navbar -->
        <? include ("menu.php"?>
        <?
        
function sem_acentos($string) {
                    
$string ereg_replace("[ÁÀÂÃÄ]""A"$string);
                    
$string ereg_replace("[áàâãäª]""a"$string);
                    
$string ereg_replace("[ÉÈÊË]""E"$string);
                    
$string ereg_replace("[éèêë]""e"$string);
                    
$string ereg_replace("[ÍÌÎÏ]""I"$string);
                    
$string ereg_replace("[íìîï]""i"$string);
                    
$string ereg_replace("[ÓÒÔÕÖ]""O"$string);
                    
$string ereg_replace("[óòôõöº]""o"$string);
                    
$string ereg_replace("[ÚÙÛÜ]""U"$string);
                    
$string ereg_replace("[úùûü]""u"$string);
                    
$string str_replace("Ç""C"$string);
                    
$string str_replace("ç""c"$string);
                    
$string str_replace("´"""$string);
                    
$string str_replace("`"""$string);
                    
$string str_replace("~"""$string);
                    
$string str_replace("^"""$string);
                    
$string str_replace("¨"""$string);
                    return 
$string;
                }

                
$item rtrim(anti_injection($_REQUEST['PESQ']));
        
        function 
sqlstr($val) {
                    return 
str_replace("'""''"$val);
                }

                
$filterstr sqlstr($item);

                
                if (isset(
$_REQUEST['PESQ'])) {
                    if (
$filterstr != '')
                        
$filterstr "%" $filterstr "%";
                    
//if ($filterstr!='') $filterstr = trim(rtrim($filterstr));
                
}else {
                    
$filterstr '';
                }

                
$qpagina " select * from texto_interno";
                
$qpagina .=" WHERE (pagina LIKE '$filterstr' or texto LIKE '$filterstr')";

                
$pagina mysql_query($qpagina) or die(mysql_error());
                
                
$qpagina2 " select * from conteudo";
                
$qpagina2 .=" WHERE (titulo LIKE '$filterstr' or conteudo LIKE '$filterstr')";

                
$pagina2 mysql_query($qpagina2) or die(mysql_error());


                
$filtro[0]['original'] = sem_acentos($_REQUEST['PESQ']);
                
$filtro[0]['filtrada'] = '<span class="pal_b"><b>' $_REQUEST['PESQ'] . '</span></b>';

                function 
Filtrar($t) {
                    global 
$filtro;

                    for (
$f 0$f count($filtro); $f++) {
                        
$errado $filtro[$f]['original'];
                        
$certo $filtro[$f]['filtrada'];
                        if (
preg_match("/" $errado "/i"$t$match[$f])) {
                            
$ucwords = ($match[$f][0] == ucwords($match[$f][0])) ? true false;
                            
$t preg_replace("/" $errado "/i", (($ucwords == true) ? ucwords($certo) : $certo), $t);
                        }
                    }return 
$t;
          }
        
        
?>
        <div class="conteudo">
            <div class="container">
                <? include ("aviso.php"?>             
                <div class="row">
                    <div class="col-md-8">
                        <div class="principal">

                            <h1>Resultado da Busca</h1>
                            
                             <?php
                                                        
if ($_REQUEST['PESQ'] != '') {

                                                           
                            
                                    
                                    if (@
mysql_num_rows($pagina) > 0) {
                                    
?>
                                    <div id="content"> 
                                    <?php while ($rp mysql_fetch_array($pagina)) { 
                                    switch(
$rp['idtexto_interno']){
                                        case 
'1'
                                                
$urls='o-sindicato-estrutura/';
                                                break;
                                        case 
'2'
                                                
$urls='o-sindicato-diretoria/';
                                                break;
                                        case 
'3':
                                                
$urls='o-sindicato-base-territorial/';
                                                break;
                                        case 
'4':
                                                
$urls='contribuicao-sindical/';
                                                break;
                                                
                                        case 
'5':
                                                
$urls='filia-se-vantagens/';
                                                break;
                                        case 
'6':
                                                
$urls='filia-se-documentos/';
                                                break;
                                        default:
                                                
$urls='#';
                                                break;
                                    }
                                    
                                    
                                    
?>
                                    <div class="vagas esq">
                                       <a href="<?=$urls?>"><?= $rp['pagina']; ?></a>
                                    </div>
                                    <? }// fim while ?>
                                    </div>
                                    <? // fim if 
                                    
                                    
                                     
if (@mysql_num_rows($pagina2) > 0) {
                                    
?>
                                    <div id="content"> 
                                    <?php while ($rp2 mysql_fetch_array($pagina2)) { 
                                    switch(
$rp2['idconteudo']){
                                        case 
'4'
                                                
$urls2='o-sindicato-historico/';
                                                break;
                                        default:
                                                
$urls2='#';
                                                break;
                                    }
                                    
                                    
                                    
?>
                                    <div class="vagas esq">
                                       <a href="<?=$urls2?>"><?= $rp2['titulo']; ?></a>
                                    </div>
                                    <? }// fim while ?>
                                    </div>
                                    <? // fim if 
                                    
                                    
$quantidade "SELECT COUNT(*) artigo FROM artigo WHERE  (artigo.titulo LIKE '$filterstr' OR intro LIKE '$filterstr' OR conteudo LIKE '$filterstr')";


                                                            
$qnot " SELECT idartigo, titulo, intro FROM artigo ";
                                                            
$qnot .=" WHERE  (titulo LIKE '$filterstr' OR intro LIKE '$filterstr' OR conteudo LIKE '$filterstr')";
                                                            
$qnot .=" ORDER BY titulo";



// PAGINAÇÃO *** INICIO ***
                                                            
$pagAtual $HTTP_SERVER_VARS["PHP_SELF"]; //Define a Pagina Atual
                                                            
$maxRows 50//Configura o Numero de Itens que podem aparecer por pagina
                                                            
$pagNum 0// Configure qual pagina está.

                                                            
if (isset($HTTP_GET_VARS['pagNum'])) {
                                                                
$pagNum $HTTP_GET_VARS['pagNum'];
                                                            }

                                                            
$inicioRow $pagNum $maxRows;
                                                            
$qlimit sprintf("%s LIMIT %d, %d"$qnot$inicioRow$maxRows);
                                                            
$not mysql_query($qlimit) or die("Erro ao selecionar" mysql_error());

                                                            if (isset(
$HTTP_GET_VARS['totalRows'])) {
                                                                
$totalRows $HTTP_GET_VARS['totalRows'];
                                                            } else {
                                                                
$all mysql_query($quantidade);
                                                                
$registro mysql_fetch_array($all);
                                                                
$totalRows $registro['artigo'];
                                                            }

                                                            
$totalPages = (int) ($totalRows $maxRows);
                                                            if (empty(
$HTTP_GET_VARS["pagNum"])) {
                                                                
$pagAnt 0;
                                                            } else {
                                                                if (
$HTTP_GET_VARS["pagNum"] > 0) {
                                                                    
$pagAnt $HTTP_GET_VARS["pagNum"] - 1;
                                                                } else {
                                                                    
$pagAnt 0;
                                                                }
                                                            }
                                                            if (empty(
$HTTP_GET_VARS["pagNum"])) {
                                                                
$pagNum 0;
                                                            } else {
                                                                
$pagNum $HTTP_GET_VARS["pagNum"];
                                                            }
                                                            if (
$pagNum >= $totalPages) {
                                                                
$pagProx $totalPages;
                                                            } else {
                                                                
$pagProx $pagNum 1;
                                                            }

// PAGINAÇÃO *** FIM ***

                                                            
@$tot2 mysql_num_rows($pagina);
                                                            
                                                            
?>
                                                       <h2><strong>Notícias </strong></h2>
                                                      <h2><strong>Resultados encontrados: <strong><?php echo $totalRows $count3 $tot2?></strong> </strong></h2>       
                                    <?
                                    $count 
mysql_num_rows($not);
                                    if (
$count 0) {    ?>
                                    <div id="content">
                                        <?php
                                        
for ($i 0$i $count$i++) {
                                        
$rl mysql_fetch_assoc($not);
                                        
$url $rl['titulo'];
                                        
$urllimpo strtolowerereg_replace("[^a-zA-Z0-9-]""-"strtr(trim($url), ("áaaâéeíóôoúünçÁAAÂÉEÍÓÔOÚÜNÇ"),"aaaaeeiooouuncAAAAEEIOOOUUNC-")) );
                                        
$text_certo $rl["intro"];
                                        echo 
'<div class="vagas esq"><a href="noticia/'.$rl['idartigo'].'/'.$urllimpo.'">' $rl['titulo'] . '</a>
                                        <p>'
;
                                        if (
strlen(stripslashes($text_certo)) >= 200) {
                                        
$text1 = (substr(stripslashes($text_certo), 0200) . "...");
                                        } else {
                                        
$text1 = (stripslashes($text_certo));
                                        }
                                        
$m1 Filtrar($text1);
                                        
$m1 Filtrar(sem_acentos($text1));
                                        echo 
$m1;
                                        
                                        echo 
'</p></div>';
                                        } 
mysql_free_result($not);
                                        
?>
                                    </div>
                                <?
                                

                            }
                                
?>
                           
                            <div class="clearfix"></div>
                        </div>

                    </div><!-- -->
                    <div class="col-md-4">
                        <? include ("menu-rapido.php")?>
                    </div>
                    
                           



                    

                </div>
                <div class="vintespaco"></div>
                <?  include("parceiros.php"?>
            </div> <!-- /container -->
            <? include ("rodape.php"?>
        </div><!-- Conteudo do site-->


        <!-- Bootstrap core JavaScript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->
        
        <script src="dist/js/bootstrap.min.js"></script>
        <script src="owl-carousel/owl.carousel.js"></script>
        <script>
            $(document).ready(function() {
                $("#owl-demo").owlCarousel({
                    autoPlay: 3000,
                    navigation: true,
                    slideSpeed: 300,
                    paginationSpeed: 400,
                    singleItem: true

                            // "singleItem:true" is a shortcut for:
                            // items : 1, 
                            // itemsDesktop : false,
                            // itemsDesktopSmall : false,
                            // itemsTablet: false,
                            // itemsMobile : false

                });
                $("#owl-demo2").owlCarousel({
                    autoPlay: 5000,
                    navigation: false,
                    pagination: false,
                    slideSpeed: 900,
                    paginationSpeed: 400,
                    singleItem: true

                            // "singleItem:true" is a shortcut for:
                            // items : 1, 
                            // itemsDesktop : false,
                            // itemsDesktopSmall : false,
                            // itemsTablet: false,
                            // itemsMobile : false

                });
            });
        </script>
    </body>
</html>
<?
function jf_anti_injection($sql) {
    
$sql mysql_real_escape_string($sql);
    return 
$sql;
}
?>