ASCII $trans= array ( "<" => "<", ">" => ">", "&" => "&", // """ => "", " " => " ", // "®" => "", // "©" => "©", "à" => "à", "á" => "á", "â" => "â", "ã" => "ã", "À" => "À", "Á" => "Á", "Â" => "Â", "Ã" => "Ã", "é" => "é", "ê" => "ê", "É" => "É", "Ê" => "Ê", "í" => "í", "Í" => "Í", "ó" => "ó", "ô" => "ô", "õ" => "õ", "Ó" => "Ó", "Ô" => "Ô", "Õ" => "Õ", "ú" => "ú", "Ú" => "Ú", "ç" => "ç", "Ç" => "Ç" ); $retorno=strtr ($retorno, $trans); // Substitue caracteres especiais WAP e PHP $trans= array ( "&" => "&", "\$" => "\$\$", "@" => "@", '"' => """, "'" => "'", "/" => "/", "\\" => "\", "<" => "<", ">" => ">" ); $retorno=strtr ($retorno, $trans); */ // Converte para padrão WAP: $trans= array ( // "&" => "&", "à" => "à", "á" => "á", "â" => "â", "ã" => "ã", "À" => "À", "Á" => "Á", "Â" => "Â", "Ã" => "Ã", "é" => "é", "ê" => "ê", "É" => "É", "Ê" => "Ê", "í" => "í", "Í" => "Í", "ó" => "ó", "ô" => "ô", "õ" => "õ", "Ó" => "Ó", "Ô" => "Ô", "Õ" => "Õ", "ú" => "ú", "Ú" => "Ú", "ç" => "ç", "Ç" => "Ç", "°" => "°", "º" => "º", "ª" => "ª", // "°" => "°", // "ª" => "ª", //"=" => "=", "$" => "$", //"#" => "#", "¿" => "â", "ä" => "ä", "Ä" => "Ä", "ë" => "ë", "Ë" => "Ë", "ö" => "ö", "Ö" => "Ö", "ü" => "ü", "Ü" => "Ü", "ñ" => "ñ", "Ñ" => "Ñ", "ß" => "ß", chr(150) => "-", chr(147) => """, chr(148) => """, chr(146) => "'", chr(128) => "£" ); $retorno=strtr ($retorno, $trans); return $retorno; } function TraduzReverso ($retorno) { //converte padrao wap pra ASCII $trans= array ( "&" => "&", "$" => "\$", "@" => "@", """ => '"', "'" => "'", "/" => "/", "<" => "<", ">" => ">", " " => " ", "à" => "à", "á" => "á", "â" => "â", "ã" => "ã", "À" => "À", "Á" => "Á", "Â" => "Â", "Ã" => "Ã", "é" => "é", "ê" => "ê", "É" => "É", "Ê" => "Ê", "í" => "í", "Í" => "Í", "ó" => "ó", "ô" => "ô", "õ" => "õ", "Ó" => "Ó", "Ô" => "Ô", "Õ" => "Õ", "ú" => "ú", "Ú" => "Ú", "ç" => "ç", "ç" => "Ç", "°" => "º", "ª" => "ª", "=" => "=", "ä" => "ä", "Ä" => "Ä", "ë" => "ë", "Ë" => "Ë", "ö" => "ö", "Ö" => "Ö", "ü" => "ü", "Ü" => "Ü", "ñ" => "ñ", "Ñ" => "Ñ", "ß" => "ß" ); $retorno=strtr ($retorno, $trans); return $retorno; } function TraduzSemAcento ($retorno) { //converte padrao wap pra ASCII $trans= array ( "à" => "a", "á" => "a", "â" => "a", "ã" => "a", "À" => "A", "Á" => "A", "Â" => "A", "Ã" => "A", "é" => "e", "ê" => "e", "É" => "E", "Ê" => "E", "í" => "i", "Í" => "I", "ó" => "o", "ô" => "o", "õ" => "o", "Ó" => "O", "Ô" => "O", "Õ" => "O", "ú" => "u", "Ú" => "U", "ç" => "c", "ç" => "c", "°" => "º", "ª" => "ª", // "=" => "=" , "ä" => "a", "Ä" => "A", "ë" => "e", "Ë" => "E", "ö" => "o", "Ö" => "O", "ü" => "u", "Ü" => "U", "ñ" => "n", "Ñ" => "N" ); $retorno=strtr ($retorno, $trans); return $retorno; } function TraduzSemAcentoASCII ($retorno) { //fdg $trans= array ( "á" => "a", "à" => "a", "â" => "a", "ã" => "a", "Á" => "A", "À" => "A", "Â" => "A", "Ã" => "A", "é" => "e", "ê" => "e", "Ê" => "E", "É" => "E", "í" => "i", "Í" => "I", "ó" => "o", "ò" => "o", "ô" => "o", "õ" => "o", "Ó" => "O", "Ô" => "O", "Õ" => "O", "ú" => "u", "Ú" => "U", "ç" => "c", "Ç" => "C", "ä" => "a", "Ä" => "A", "ë" => "e", "Ë" => "E", "ö" => "o", "Ö" => "O", "ü" => "u", "Ü" => "U", "Ñ" => "N", "ñ" => "n" ); $retorno=strtr ($retorno, $trans); return $retorno; } function Traduz_ctrs_estranhos($retorno){ $trans= array ( '"' => "*", "'" => "*", // "#" => "*", "\$" => "*", "\\" => "*", ">" => "*", "<" => "*", // "%" => "*", "&" => "*", "¡" => "*", "¢" => "*", "£" => "*", "¤" => "*", "¥" => "*", "¦" => "*", "§" => "*", "¨" => "*", "©" => "*", "ª" => "*", "«" => "*", "¬" => "*", "®" => "*", "¯" => "*", "°" => "*", "²" => "*", "³" => "*", "µ" => "*", "¶" => "*", "·" => "*", "¸" => "*", "¹" => "*", "º" => "*", "»" => "*", "¼" => "*", "½" => "*", "¾" => "*", "Æ" => "*", "Ð" => "*", "×" => "*", "Ø" => "*", "Ý" => "*", "Þ" => "*", "ß" => "*", "æ" => "*", "ð" => "*", "ø" => "*", "ý" => "*", "þ" => "*", "ÿ" => "*" ); $retorno=strtr ($retorno, $trans); return $retorno; } ?> file = $file; switch($mode) { case '>>': $this->mode = 'a'; break; case '>': $this->mode = 'w'; break; default: $this->mode = 'a'; break; } $this->handler = fopen($this->file, $this->mode); if ($this->handler === false) { $this->erro = true; } } function _write($texto) { if ( !fwrite($this->handler, date("[Y-m-d H:i:s] ").$texto."\n") ) $this->erro = true; } function close(){ if ($this->handler) { fclose($this->handler); } return true; } } ?> >"); $log->_write($_SERVER["HTTP_USER_AGENT"]); ?> [Volver]"; break; case 'imode': $voltar = "[Volver]"; break; case 'wml_nokia': $voltar = "[Voltar]"; break; case 'wml_phone': $voltar = ""; break; } return $voltar; } function volta_home($PHPSESSID, $parceiro=null) { $url = volta_url($parceiro); switch($GLOBALS[lang_type]) { case 'xhtml': $home = "[Voltar]"; break; case 'imode': $home = "[Voltar]"; break; case 'wml_nokia': $home = "[Voltar]"; break; case 'wml_phone': $home = ""; break; } return $home; } function volta_url ($parceiro=null) { if ($parceiro == 'carnaval2006_tim') {$url = 'http://wap.tim.com.br';} else {$url = 'http://wap.terra.com.br';} return $url; } function volta_paredao($PHPSESSID) { switch($GLOBALS[lang_type]) { case 'xhtml': $home = "[Voltar]"; break; case 'imode': $home = "[Voltar]"; break; case 'wml_nokia': $home = "[Voltar]"; break; case 'wml_phone': $home = ""; break; } return $home; } function volta_categorias($PHPSESSID, $id_avo=null) { switch($GLOBALS[lang_type]) { case 'xhtml': $voltar = "[Voltar]"; break; case 'imode': $voltar = "[Voltar]"; break; case 'wml_nokia': $voltar = "[Voltar]"; break; case 'wml_phone': $voltar = ""; break; } return $voltar; } function volta_titulos($PHPSESSID, $id_avo, $start, $url_back=null) { switch($GLOBALS[lang_type]) { case 'xhtml': $voltar = "[Voltar]"; break; case 'imode': $voltar = "[Voltar]"; break; case 'wml_nokia': $voltar = "[Voltar]"; break; case 'wml_phone': $voltar = ""; break; } return $voltar; } //---------------------------------------------------------- //---- ---- //---- Busca noticia ---- //---- ---- //---------------------------------------------------------- function busca_noticia( $id_not, $mysql ){ global $table2; $query = "SELECT noticia FROM ".$table2." WHERE id_noticia=".$id_not ; //print $query; $row = $mysql->select('','','','','',$query); $cont = $row[1]['noticia']; return traduz_e_comercial($cont); } //---------------------------------------------------------- //---- ---- //---- L�Arquivo ---- //---- ---- //---------------------------------------------------------- function readpage( $arq ) { global $canal; //print_r($_SERVER); switch($GLOBALS[lang_type]) { case 'imode': $arquivo="./imode/"; break; case 'xhtml': $arquivo="./".$GLOBALS[dir_template]; break; case 'wml_nokia': $arquivo="./".$GLOBALS[dir_template]; break; case 'wml_phone': $arquivo="./".$GLOBALS[dir_template]; break; } $arquivo.=$arq; //print $arquivo; $template=fopen($arquivo,"r"); if ($template){ while (!feof($template)) $retorno.= fgets($template,1000); } fclose ($template); $retorno = str_replace ( "##canais##" , $canal , $retorno ); return $retorno; } function existe_arquivo( $arq ) { switch($GLOBALS[lang_type]) { case 'imode': $arquivo="./imode/"; break; case 'xhtml': $arquivo="./".$GLOBALS[dir_template]; break; case 'wml_nokia': $arquivo="./".$GLOBALS[dir_template]; break; case 'wml_phone': $arquivo="./".$GLOBALS[dir_template]; break; } $arquivo.=$arq; // print $arquivo." "; if(is_file($arquivo)) return true; else return false; } function arg_separator($link) { switch($GLOBALS[lang_type]) { case 'xhtml': $link = str_replace("&", "&", $link); break; case 'wml_phone': case 'wml_nokia': $link = str_replace("&", "&", $link); break; } return $link; } /* Table Category */ /*------------------------------*/ function table_category ($result, $start=null, $id_avo=null, $id_pai) { global $PHPSESSID; if (!isset($id_avo) || empty($id_avo)) $id_avo = 0; $i = 1; if (!isset($start) || empty($start)) $start = 1; $end = $start + 13; $back = $start - 13; $total = count($result); switch($GLOBALS[lang_type]) { case 'xhtml': for ($i = $start ; $result[$i] && $i< $end ; $i++) { if ( permite_operadora($result[$i]["id_categoria"]) ) { if ($result[$i]['tipo'] == 5) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"])."
\r\n"; } elseif ($result[$i]['tipo'] == 4) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"])."
\r\n"; } elseif ($result[$i]['tipo'] == 2) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"])."
\r\n"; //&PHPSESSID=##PHPSESSID## } else { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"])."
\r\n"; //&PHPSESSID=##PHPSESSID## } } } if ($_SESSION['parceiro'] == 'carnaval2006') { if ($id_pai != 0) $sel_category .= "Home Carnaval
\r\n"; $sel_category .= "Home Terra\r\n"; } if($start>=13){ $sel_category .="<<
\r\n"; //&PHPSESSID=##PHPSESSID## } if ($total>=$end){ $sel_category .=">>
\r\n"; //&PHPSESSID=##PHPSESSID## } break; case 'imode': for ($i = $start ; $result[$i] && $i< $end ; $i++) { if ( permite_operadora($result[$i]["id_categoria"]) ) { if ($result[$i]['tipo'] == 5) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"])."
\r\n"; } elseif ($result[$i]['tipo'] == 4) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"])."
\r\n"; } elseif ($result[$i]['tipo'] == 2) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"])."
\r\n"; //&PHPSESSID=##PHPSESSID## } else { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"])."
\r\n"; //&PHPSESSID=##PHPSESSID## } } } if($start>=13){ $sel_category .="<<
\r\n"; //&PHPSESSID=##PHPSESSID## } if ($total>=$end){ $sel_category .=">>
\r\n"; //&PHPSESSID=##PHPSESSID## } break; case 'wml_nokia': for ($i = $start ; $result[$i] && $i< $end ; $i++) { if ( permite_operadora($result[$i]["id_categoria"]) ) { if ( !empty($result[$i]["icone_color"]) ) { $result[$i]["icone_color"] = preg_replace("/\.(gif|jpg)$/i", ".wbmp", $result[$i]["icone_color"]); if ( !is_file(DIR_ICONES.$result[$i]["icone_color"]) ) $result[$i]["icone_color"] = ''; } if ($result[$i]['tipo'] == 5) { if (!$result[$i]['tipo_color']) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"]).""; //&PHPSESSID=##PHPSESSID## if ($i<$total) $sel_category .= "
\r\n"; } } elseif ($result[$i]['tipo'] == 4) { if (!$result[$i]['tipo_color']) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"]).""; //&PHPSESSID=##PHPSESSID## if ($i<$total) $sel_category .= "
\r\n"; } } elseif ($result[$i]['tipo'] == 2) { if (!$result[$i]['tipo_color']) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"]).""; //&PHPSESSID=##PHPSESSID## if ($i<$total) $sel_category .= "
\r\n"; } } else { if (!$result[$i]['tipo_color']) { $sel_category .= (!empty($result[$i]["icone_color"]) ? "\"\"/ " : "" )."".traduz_e_comercial($result[$i]["titulo"]).""; //&PHPSESSID=##PHPSESSID## if ($i<$total) $sel_category .= "
\r\n"; } } } } if ($_SESSION['parceiro'] == 'carnaval2006') { $sel_category .= "
\r\n"; if ($id_pai != 0) $sel_category .= "Home Carnaval
"; $sel_category .= "Home Terra"; } if($start>=13){ $sel_category .="<<
\r\n"; //&PHPSESSID=##PHPSESSID## } if ($total>=$end){ $sel_category .=">>
\r\n"; //&PHPSESSID=##PHPSESSID## } break; case 'wml_phone': $sel_category = ""; for ($i = $start ; $result[$i] && $i< $end ; $i++) { if ( permite_operadora($result[$i]["id_categoria"]) ) { if ( !empty($result[$i]["icone_color"]) ) { $result[$i]["icone_color"] = preg_replace("/\.(gif|jpg)$/i", ".wbmp", $result[$i]["icone_color"]); if ( !is_file(DIR_ICONES.$result[$i]["icone_color"]) ) $result[$i]["icone_color"] = ''; } if($result[$i]["tipo"] == 5) { if (!$result[$i]['tipo_color']) $sel_category .= "\r\n"; } elseif ($result[$i]["tipo"] == 4) { if (!$result[$i]['tipo_color']) $sel_category .= "\r\n"; } elseif ($result[$i]["tipo"] == 2) { if (!$result[$i]['tipo_color']) $sel_category .= "\r\n"; } else { if (!$result[$i]['tipo_color']) $sel_category .= "\r\n"; //&PHPSESSID=##PHPSESSID## } } } if ($_SESSION['parceiro'] == 'carnaval2006') { $sel_category .= "\r\n"; } if($start>=13){ $sel_category .="\r\n"; //&PHPSESSID=##PHPSESSID## } if ($total>=$end){ $sel_category .="\r\n"; //&PHPSESSID=##PHPSESSID## } $sel_category .= "##HOME##"; break; } return $sel_category; } /*-------------------------------*/ function get_operadoras_categoria ($mysql, $id_categoria) { $res_oper = $mysql->select('operadora', 'categoria_operadora', 'id_categoria = '.$id_categoria); $operadoras_categoria = array(); if ( is_array($res_oper) ) { foreach ($res_oper as $oper) { $operadoras_categoria[] = $oper['operadora']; } } return $operadoras_categoria; } function permite_operadora ($id) { if ($id==557) $op_aceitas = array('waaap'); if ( is_array($op_aceitas) ) { $aceita = false; foreach ($op_aceitas as $op) { if (strpos($_SERVER['HTTP_VIA'], $op) !== false || strpos($_SERVER['HTTP_X_UP_SUBNO'], $op) !== false) { $aceita = true; break; } } return $aceita; } else return true; } function get_operadora() { //print $_SERVER['HTTP_VIA'].'|___|'.$_SERVER['HTTP_X_UP_SUBNO'].'|____|'.$_SERVER['REMOTE_ADDR']; //if ($_SERVER['REMOTE_ADDR'] == '201.6.253.218' || $_SERVER['REMOTE_ADDR'] == '192.168.1.11' || $_SERVER['REMOTE_ADDR'] == '200.171.33.210') return 'vivo'; if (strpos($_SERVER['HTTP_VIA'], 'waaap') !== false || strpos($_SERVER['HTTP_X_UP_SUBNO'], 'waaap') !== false) return 'vivo'; if (strpos($_SERVER['HTTP_VIA'], 'wgw.oi') !== false || strpos($_SERVER['HTTP_X_UP_SUBNO'], 'wgw.oi') !== false || $_SERVER['REMOTE_ADDR'] == '200.202.193.1' || $_SERVER['REMOTE_ADDR'] == '200.222.108.241') return 'oi'; if ($_SERVER['REMOTE_ADDR'] == '200.255.121.21') return 'claro'; if (strpos($_SERVER['HTTP_VIA'], 'wgnokia.tim') !== false || strpos($_SERVER['HTTP_X_UP_SUBNO'], 'wgnokia.tim') !== false || $_SERVER['REMOTE_ADDR'] == '200.179.66.238' || $_SERVER['REMOTE_ADDR'] == '200.166.236.226') return 'tim'; } function eh_operadora ($ope) { if ($ope=='vivo') $op_aceitas = array('waaap'); if ($ope=='oi') $op_aceitas = array('wgw.oi'); if ($ope=='oi' && ($_SERVER['REMOTE_ADDR'] == '200.202.193.1' || $_SERVER['REMOTE_ADDR'] == '200.222.108.241')) return true; // if ($_SERVER['REMOTE_ADDR'] == '201.6.253.218' || $_SERVER['REMOTE_ADDR'] == '192.168.1.11') return true; // if ($ope=='vivo' && ($_SERVER['REMOTE_ADDR'] == '201.6.253.218' || $_SERVER['REMOTE_ADDR'] == '192.168.1.11')) return true; if ($_SESSION["wr"]==1) return true; if ( is_array($op_aceitas) ) { $aceita = false; foreach ($op_aceitas as $op) { if (strpos($_SERVER['HTTP_VIA'], $op) !== false || strpos($_SERVER['HTTP_X_UP_SUBNO'], $op) !== false) { $aceita = true; break; } } return $aceita; } else return true; } //---------------------------------------------------------- //---- ---- //---- Monta titulo da not�ia ---- //---- ---- //---------------------------------------------------------- function monta_titulo( $numnot, $id_categoria, $mysql,$id_aparelho=null,$lista_numerada ){ global $table2; $j = 1; $query = "SELECT id_noticia,titulo FROM ".$table2." WHERE id_categoria= ".$id_categoria." AND titulo != '' AND noticia != '' ORDER BY ordem, dt_publicacao ASC LIMIT ".$numnot.",9"; $row = $mysql->select('', '' , '', '', '', $query); while ( isset($row[$j]) ) { $href[$j] = "index.php?state=55&id_ca=".$id_categoria."&id_n=".$row[$j]['id_noticia']."&pos_inicial=0&num_not=".$numnot."&PHPSESSID=##PHPSESSID##"; //."&PHPSESSID=##PHPSESSID##" $titu[$j] = traduz_e_comercial($row[$j]['titulo']); $j++; } $GLOBALS['n_noticias'] = count($titu); switch($GLOBALS[lang_type]) { case 'wml_nokia': for ( $i = 1 ; $href[$i] ; $i++ ) { $titulo .= "".$titu[$i]."
"; } break; case 'wml_phone': for ( $i = 1 ; $href[$i] ; $i++ ) { $titulo .= ""; if ($i < 12) $titulo .= "\n"; } break; case 'imode': for ( $i = 1 ; $href[$i] ; $i++ ) { $titulo .= "".$titu[$i]."
"; //if ($i < 12) $titulo .= "
\n"; } break; case 'xhtml': for ( $i = 1 ; $href[$i] ; $i++ ) { if ($lista_numerada==0) $titulo .= $quebra."
".$titu[$i]."
"; else $titulo .= $quebra."
".$i." - ".$titu[$i]."
"; // $quebra = $id_aparelho==388 ? "
" : "
"; $quebra = "
"; } break; } return $titulo; } //---------------------------------------------------------- //---- ---- //---- Monta link para ver mais noticias ---- //---- ---- //---------------------------------------------------------- function mais_noticias( $numnot, $id_categoria, $mysql) { global $table2; $query = "SELECT count(*) as TOTAL from ".$table2." WHERE titulo != '' AND noticia != '' AND id_categoria=".$id_categoria; $total = $mysql->select('', '' , '', '', '', $query); if ( $numnot >= $total[1]['TOTAL'] - 9 ) { $retorna = ""; } else { $numnot = $numnot + 9; $link = arg_separator("index.php?state=1&id_pai=".$id_categoria."&num_not=".$numnot."&;PHPSESSID=".session_id()); switch($GLOBALS[lang_type]) { case 'wml_nokia': $retorna = "próxima>>"; //&PHPSESSID=##PHPSESSID## break; case 'wml_phone': $retorna = ""; //&num_not=".$numnot."&PHPSESSID=##PHPSESSID## break; case 'imode': $retorna = "próxima>>"; break; case 'xhtml': $retorna = ""; break; } } return $retorna; } //-------------------------------------------------------------------------------------------- //---- ---- //---- Calcula start para voltar dos titluos para a categoria correspondente ---- //---- ---- //-------------------------------------------------------------------------------------------- function calc_start($id_pai, $id_categoria, $mysql){ $ret = $mysql->select("id_categoria", "categoria", "id_pai=".$id_pai." AND parceiro='universia' AND titulo not in('Dicas', 'Gabaritos')", "titulo", "asc"); $i = 1; while ($ret[$i]["id_categoria"]) { if ($ret[$i]["id_categoria"] == $id_categoria) { break; } $i++; } if ($i%5 == 0 ) { $start = ( ( intval($i/5) - 1 )* 5) + 1; } else { $start = ( ( intval($i/5) )* 5) + 1; } return $start; } //-------------------------------------------------------------------------------------------- //---------------------------------------------------------- //---- ---- //---- Monta link para ver menos noticias ---- //---- ---- //---------------------------------------------------------- function menos_noticias( $numnot, $id_categoria ) { if ( $numnot == 0 ) { $retorna = ""; } else { $numnot = $numnot - 9; $link = arg_separator("index.php?state=1&id_pai=".$id_categoria."&num_not=".$numnot."&PHPSESSID=".session_id()); switch($GLOBALS[lang_type]) { case 'wml_nokia': $retorna = "<<anterior"; break; case 'wml_phone': $retorna = ""; break; case 'imode': $retorna = "<<anterior"; break; case 'xhtml': $retorna = ""; } } return $retorna; } //---------------------------------------------------------- //---- ---- //---- Monta link para continuar a noticia ---- //---- ---- //---------------------------------------------------------- function mais_noticia ( $pos_i , $tam_n , $taman , $num_not , $id_not , $id_cat , $VAL){ if ( $pos_i >= $tam_n - $taman ) { $retorna = ""; } else { if ($pos_i>0) { $quebra = "
"; } $pos_i = $pos_i + $taman; $link = arg_separator("index.php?state=55&id_ca=".$id_cat."&id_n=".$id_not."&pos_inicial=".$pos_i."&num_not=".$num_not."&PHPSESSID=".session_id()."&ind_tpl=1"); switch ($GLOBALS[lang_type]) { case 'xhtml': $retorna = ""; break; case 'imode': $retorna = "próxima>>"; break; case 'wml_phone': $retorna = "
próxima>>".$quebra; break; case 'wml_nokia': $retorna = "
próxima>>".$quebra; break; } } return $retorna; } function atualizar_noticia($id_cat,$id_not) { $link = arg_separator("index.php?state=55&id_ca=".$id_cat."&id_n=".$id_not."&PHPSESSID=".session_id()); switch ($GLOBALS[lang_type]) { case 'xhtml': return "
"; case 'imode': return "atualizar"; case 'wml_phone': return "
atualizar"; case 'wml_nokia': return "
atualizar"; } } function url_atualizar_noticia($id_cat,$id_not) { return arg_separator("index.php?state=55&id_ca=".$id_cat."&id_n=".$id_not."&PHPSESSID=".session_id()); } //---------------------------------------------------------- //---- ---- //---- Monta link para retroceder a noticia ---- //---- ---- //---------------------------------------------------------- function menos_noticia ( $pos_i , $tam_n , $taman , $num_not , $id_not , $id_cat , $VAL){ //global $tpl_noticia; //global $tpl_cont; if ( $pos_i == 0 ) { $retorna = ""; } else { if ( $pos_i >= $tam_n - $taman ) { $quebra = "
"; } $pos_i = $pos_i - $_SESSION['tpl_noticia'][$_SESSION['tpl_cont'] - 1]; // $tpl_noticia[$tpl_cont - 1] $link = arg_separator("index.php?state=56&id_ca=".$id_cat."&id_n=".$id_not."&pos_inicial=".$pos_i."&num_not=".$num_not."&PHPSESSID=".session_id()."&ind_tpl=-1"); switch ($GLOBALS[lang_type]) { case 'wml_nokia': $retorna = $quebra."<<anterior"; break; case 'wml_phone': $retorna = $quebra."<<anterior"; break; case 'imode': $retorna = "<<anterior"; break; case 'xhtml': $retorna = ""; break; } } return $retorna; } //====================================================================== /* Tree category */ /*------------------------------*/ function arvore_categoria ($id_categoria, $parceiro=null) { global $mysql; $result = $mysql->select("*", "categoria", "id_categoria=".$id_categoria); //print $id_categoria; // $categoria[1] = $result[1]["tipo"] == 1 && $GLOBALS[lang_type] != 'xhtml' ? ''.$result[1]["titulo"].'' : $result[1]["titulo"]; if ($result[1]["tipo"] == 0) { $result_filho = $mysql->select("count(*) as tc", "categoria", "id_pai=".$id_categoria); $result_noticias = $mysql->select("count(*) as tn", "noticia", "id_categoria=".$id_categoria); // print_r($result); if ($result_filho[1]['tc']>0 || $result_noticias[1]['tn']>0) $categoria[1] = $GLOBALS[lang_type] != 'xhtml' ? ''.$result[1]["titulo"].'' : $result[1]["titulo"]; } // print '|'.$cat_um.'|'; // else { // $categoria[1] = ''; //$result[1]["tipo"] == 1 && $GLOBALS[lang_type] != 'xhtml' ? ''.$result[1]["titulo"].'' : $result[1]["titulo"]; // } // print_r($categoria); for ($i = count($categoria)+1; $result ; $i++) { $result = $mysql->select("*", "categoria", "id_categoria=".$result[1]["id_pai"]); if ( !empty($result) ) { $categoria[$i] = $result[1]["titulo"]; } } $count = count($categoria); // if ($count>0) { // $categoria[1] = $cat_um; // } $u=0; for ($j = $count ; $categoria[$j] ; $j--) { if ($j == $count) { if ($parceiro == 'carnaval2006') { if ($u==0){ $title .= "Carnaval 2006
"; } } $title .= "".$categoria[$j]; $u++; } else { if ($u<4) { $title .= !empty($categoria[$j]) ? "
".$categoria[$j] : ''; $u++; } } } return traduz_e_comercial($title); } /*------------------------------*/ function replace_eng_month ($strm) { $strm = str_replace('Feb', 'Fev', $strm); $strm = str_replace('Dec', 'Dez', $strm); $strm = str_replace('Oct', 'Out', $strm); $strm = str_replace('May', 'Mai', $strm); $strm = str_replace('Aug', 'Ago', $strm); $strm = str_replace('Sep', 'Set', $strm); $strm = str_replace('Apr', 'Abr', $strm); return $strm; } ?> obj_mysql = $mysql; } function get_parceiro ($login) { $this->login = $login; $result = $this->obj_mysql->select('', '', '', '', '', 'select a.* FROM access_user as a WHERE LOGIN="'.$this->login.'"'); if (is_array($result) ) { foreach ($result as $i => $registro) { foreach($registro as $coluna => $valor) { eval('$this->'.strtolower($coluna).'='.'"'.$valor.'";'); } } } //$this->descricao = $result[1]['DESCRIPTION']; //$this->parceiro = $result[1]['LOGIN']; //$this->img_color = $result[1]['IMG_COLOR']; //$this->img_wbmp = $result[1]['IMG_WBMP']; } } ?>