'SET NAMES UTF8' ); $conexao = new PDO("mysql:host=localhost;dbname=gazetainteriorco_interior", "gazetainteriorco_interior", "bCXnB)byCU1t", $opcoes); // $conexao = new PDO("mysql:host=localhost;dbname=gazetado_interior", "gazetado_interior", "G4az34asdf!", $opcoes); } catch (PDOException $e) { echo "Erro de Conexão " . $e->getMessage() . "\n"; exit; } $url = "https://www.gazetainterior.com.br/"; // $url = "http://187.108.196.217/~gazetadointerior/"; $sql_termos = "select * from configuracoes where cod_config = 1"; $consulta_termos = $conexao->query($sql_termos); while ($linha_termos = $consulta_termos->fetch(PDO::FETCH_ASSOC)) { $facebook = $linha_termos['social_facebook']; $instagram = $linha_termos['social_instagram']; $youtube = $linha_termos['social_youtube']; $issu_profile = $linha_termos['social_issuu']; $ultima_edicao = $linha_termos['ultima_edicao']; $telefone = $linha_termos['fone']; $link_telefone = $linha_termos['link_fone']; $whatsapp = $linha_termos['whatsapp']; $link_whatsapp = $linha_termos['link_whatsapp']; $email_principal = $linha_termos['email']; $titulo_configuracao = $linha_termos['titulo']; $descricao_configuracao = $linha_termos['descricao']; $palavra_chave_configuracao = $linha_termos['palavra_chave']; $logo_config = $linha_termos['logo']; $status_config = $linha_termos['status_site']; } $link_ultimas_noticias = $url; $link_home = $url; $link_agazeta = $url . "a-gazeta"; $link_comercial = $url . "comercial"; $link_redacao = $url . "redacao"; $link_gazetaemvideo = $url . "gazeta-em-video"; // $link_ultimas_noticias = $url; // $link_home = $url; // $link_agazeta = $url . "_institucional.php?texto=1"; // $link_comercial = $url . "_comercial.php"; // $link_redacao = $url . "_redacao.php"; // $link_gazetaemvideo = $url . "_videos.php"; // Criar funçõa de data em tempo real $data = date('D'); $mes = date('M'); $dia = date('d'); $ano = date('Y'); $semana = array( 'Sun' => 'Domingo', 'Mon' => 'Segunda-Feira', 'Tue' => 'Terca-Feira', 'Wed' => 'Quarta-Feira', 'Thu' => 'Quinta-Feira', 'Fri' => 'Sexta-Feira', 'Sat' => 'Sábado' ); $mes_extenso = array( 'Jan' => 'Janeiro', 'Feb' => 'Fevereiro', 'Mar' => 'Março', 'Apr' => 'Abril', 'May' => 'Maio', 'Jun' => 'Junho', 'Jul' => 'Julho', 'Aug' => 'Agosto', 'Nov' => 'Novembro', 'Sep' => 'Setembro', 'Oct' => 'Outubro', 'Dec' => 'Dezembro' ); // fim da data function categoria_noticia($conexao, $cod_noticias){ $sql_categoria = "select * from termos where cod_termo = (select cod_termo from noticias_termo where cod_noticia = $cod_noticias limit 1) "; $retorno = $sql_categoria; $consulta_categoria = $conexao->query($sql_categoria); $retorno = "Gazeta do Interior"; while ($linha_categoria = $consulta_categoria->fetch(PDO::FETCH_ASSOC)) { $retorno = $linha_categoria['titulo']; } return $retorno; } function ajusta($string){ $string = str_replace(".", "", $string); $string = str_replace("ç", "c", $string); $string = str_replace("/", "-", $string); $string = str_replace("acute", "", $string); $string = str_replace("grave", "", $string); $string = str_replace("tilde", "", $string); $string = str_replace("cedil", "", $string); $string = str_replace("uml", "", $string); $string = str_replace("circ", "", $string); $string = str_replace("$", "", $string); $string = str_replace("%", "", $string); $string = preg_replace("/[ÁÀÂÃÄáàâãä]/", "a", $string); $string = preg_replace("/[ÉÈÊéèê]/", "e", $string); $string = preg_replace("/[ÍÌíì]/", "i", $string); $string = preg_replace("/[ÓÒÔÕÖóòôõö]/", "o", $string); $string = preg_replace("/[ÚÙÜúùü]/", "u", $string); $string = preg_replace("/Çç/", "c", $string); $string = preg_replace("/Ññ/", "n", $string); $string = preg_replace("/[][><}{)(:;,!?*%~^`@&]/", "", $string); $string = preg_replace("/ /", "-", $string); $string = str_replace("---", "-", $string); $string = str_replace("--", "-", $string); $string = str_replace("#39", "", $string); $string = str_replace("#", "", $string); $string = str_replace("?", "", $string); $string = str_replace("$", "", $string); $string = str_replace("--", "", $string); $string = str_replace("°", "", $string); $string = str_replace("º", "", $string); $string = str_replace("ª", "", $string); $string = str_replace("•", "", $string); $string = str_replace("%", "", $string); $string = str_replace("!", "", $string); $string = str_replace("@", "", $string); $string = str_replace("#", "", $string); $string = str_replace("$", "", $string); $string = str_replace("^", "", $string); $string = str_replace("&", "", $string); $string = str_replace("*", "", $string); $string = str_replace("(", "", $string); $string = str_replace(")", "", $string); $string = str_replace("=", "", $string); $string = str_replace("+", "", $string); $string = str_replace("?", "", $string); return $string; } function capa_noticia($url,$thumb){ if ($thumb == "" or is_null($thumb)){ return $url."img/config/05d942051dac55ca39413a4acae2281c.png"; } else { // verifica se tem url no link, se não tiver, vai direto do site. return $url."img/noticias/".$thumb; } } function anti_injection( $obj ) { $obj = trim($obj); $obj = strip_tags($obj); if(!get_magic_quotes_gpc()) { $obj = addslashes($obj); return $obj; } } function tratahtml($valor) { $valor = str_replace("À", "À", $valor); $valor = str_replace("Á", "Á", $valor); $valor = str_replace("Â", "Â", $valor); $valor = str_replace("Ã", "Ã", $valor); $valor = str_replace("Ä", "Ä", $valor); $valor = str_replace("Å", "Å", $valor); $valor = str_replace("Æ", "Æ", $valor); $valor = str_replace("Ç", "Ç", $valor); $valor = str_replace("È", "È", $valor); $valor = str_replace("É", "É", $valor); $valor = str_replace("Ê", "Ê", $valor); $valor = str_replace("Ë", "Ë", $valor); $valor = str_replace("Ì", "Ì", $valor); $valor = str_replace("Í", "Í", $valor); $valor = str_replace("Î", "Î", $valor); $valor = str_replace("Ï", "Ï", $valor); $valor = str_replace("Ð", "Ð", $valor); $valor = str_replace("Ñ", "Ñ", $valor); $valor = str_replace("Ò", "Ò", $valor); $valor = str_replace("Ó", "Ó", $valor); $valor = str_replace("Ô", "Ô", $valor); $valor = str_replace("Õ", "Õ", $valor); $valor = str_replace("Ö", "Ö", $valor); $valor = str_replace("Ø", "Ø", $valor); $valor = str_replace("Ù", "Ù", $valor); $valor = str_replace("Ú", "Ú", $valor); $valor = str_replace("Û", "Û", $valor); $valor = str_replace("Ü", "Ü", $valor); $valor = str_replace("Ý", "Ý", $valor); $valor = str_replace("Þ", "Þ", $valor); $valor = str_replace("ß", "ß", $valor); $valor = str_replace("à", "à", $valor); $valor = str_replace("á", "á", $valor); $valor = str_replace("â", "â", $valor); $valor = str_replace("ã", "ã", $valor); $valor = str_replace("ä", "ä", $valor); $valor = str_replace("å", "å", $valor); $valor = str_replace("æ", "æ", $valor); $valor = str_replace("ç", "ç", $valor); $valor = str_replace("è", "è", $valor); $valor = str_replace("é", "é", $valor); $valor = str_replace("ê", "ê", $valor); $valor = str_replace("ë", "ë", $valor); $valor = str_replace("ì", "ì", $valor); $valor = str_replace("í", "í", $valor); $valor = str_replace("î", "î", $valor); $valor = str_replace("ï", "ï", $valor); $valor = str_replace("ð", "ð", $valor); $valor = str_replace("ñ", "ñ", $valor); $valor = str_replace("ò", "ò", $valor); $valor = str_replace("ó", "ó", $valor); $valor = str_replace("ô", "ô", $valor); $valor = str_replace("õ", "õ", $valor); $valor = str_replace("ö", "ö", $valor); $valor = str_replace("ø", "ø", $valor); $valor = str_replace("ù", "ù", $valor); $valor = str_replace("ú", "ú", $valor); $valor = str_replace("û", "û", $valor); $valor = str_replace("ü", "ü", $valor); $valor = str_replace("ý", "ý", $valor); $valor = str_replace("þ", "þ", $valor); $valor = str_replace("ÿ", "ÿ", $valor); $valor = str_replace("ª", "ª", $valor); $valor = str_replace("º", "º", $valor); $valor = str_replace("'", "'", $valor); $valor = str_replace("'", "'", $valor); $valor = str_replace("’", "'", $valor); $valor = str_replace("'", "'", $valor); $valor = str_replace("'", "'", $valor); $valor = str_replace("‘", "'", $valor); $valor = str_replace("“", """, $valor); $valor = str_replace("”", """, $valor); $valor = str_replace("—", "-", $valor); $valor = str_replace("–", "-", $valor); $valor = str_replace("¬", "-", $valor); $valor = str_replace('src="/uploads', 'src="http://'.$_SERVER["HTTP_HOST"].'/admin/uploads', $valor); return $valor; } function imprimeData($data){ $rData = str_replace("00:00:00", "", $data); $rData = explode("-", $rData); // return var_dump($rData); $rData = $rData[2].'/'.$rData[1]; return $rData; } function imprimeData_completa($data){ $rData = $data; //$data = str_replace(' 00:00:00', '', $data); $rData = explode(" ", $data); $Data_ = $rData[0]; $Hora_ = $rData[1]; $rData = $Data_ . " " . $Hora_; $Data_ = explode("-", $Data_); $Data_ = $Data_[2].'/'.$Data_[1].'/'.$Data_[0]; $rData = $Data_ . " " . $Hora_; //$rData = $rData[2].'/'.$rData[1].'/'.$rData[0]; return $rData; } function tratar_link_video ($link_de_teste){ $verificar = parse_url($link_de_teste); // echo $verificar['host'] ; // exit(); $url_transmissao = ""; if ($verificar['host'] == 'www.youtube.com' || $verificar['host'] == 'youtube.com' || $verificar['host'] == 'youtu.be' || $verificar['host'] == 'm.youtube.com'){ $VideoYoutube = ""; if ($verificar['host'] == 'm.youtube.com'){ $url_transmissao = str_replace("https://m.youtube.com/", "", $link_de_teste); $url_transmissao = str_replace("watch?", "", $url_transmissao); $url_transmissao = str_replace("&v=", "", $url_transmissao); $url_transmissao = str_replace("feature=youtu.be", "", $url_transmissao); $VideoYoutube = $url_transmissao; } else if ($verificar['host'] == 'youtu.be'){ $url_transmissao = str_replace("https://youtu.be/", "", $link_de_teste); $VideoYoutube = $url_transmissao; } else if ($verificar['host'] == "www.youtube.com" || $verificar['host'] == "youtube.com"){ $array = explode("&", $verificar['query']); $VideoYoutube = substr($array[0], 2); } $url_transmissao = "https://www.youtube.com/embed/". $VideoYoutube; } else if($verificar['host'] == 'www.vimeo.com' || $verificar['host'] == 'vimeo.com'){ $VideoId = substr($verificar['path'], 1); $url_transmissao = "https://player.vimeo.com/video/". $VideoId .""; } else if ($verificar['host'] == 'www.twitch.tv'){ $array = explode('/', $link_de_teste); $channel = $array[3]; $url_transmissao = "https://player.twitch.tv/?channel=". $channel ."&parent=www.rodeioplay.com"; } else { $url_transmissao = $link_de_teste; } return $url_transmissao; } function gerar_link_noticias($url, $cod_noticias, $titulo_noticia){ return $url."view/".$cod_noticias."/".ajusta($titulo_noticia); // return $url."_detalhe-noticia.php?id=".$cod_noticias; } function gerar_link_categoria($url, $cod_noticias, $titulo_noticia){ return $url."noticias/".$cod_noticias."/".ajusta($titulo_noticia); // return $url."_noticias.php?id=".$cod_noticias; } function limita_caracteres($texto, $limite){ $texto = strip_tags($texto); $tamanho = strlen($texto); $novo_texto = trim(substr($texto, 0, $limite))."..."; return $novo_texto; // Retorna o valor formatado } function contador_view($conexao, $id_noticia){ $nome_cookies = "noticias".$id_noticia; if (!isset($_COOKIE[$nome_cookies])){ setcookie($nome_cookies, 1, time()+(60*60*24*30)); $sql_selec = "select * from noticias where cod_noticias = $id_noticia"; $consulta_selec = $conexao->query($sql_selec); if ($consulta_selec != "") { $linha_selec = $consulta_selec->fetch(PDO::FETCH_ASSOC); $view_noticias = $linha_selec['views']; $cod_noticias = $linha_selec['cod_noticias']; $view_noticias = $view_noticias + 1; $sql = "UPDATE noticias SET " . "views = '$view_noticias' " . "WHERE cod_noticias = $cod_noticias"; $editar = $conexao->query($sql); } // return $sql; } else { // return "já existe"; } } $thumb_head = $url. "img/config/05d942051dac55ca39413a4acae2281c.png"; $url_fa = $url; ?>