navegador; $publico=$row->publico; $fechas=$row->fechas; $xpag=$row->anunciosxpag; $paginas=$row->paginas; $titulo=$row->titulo; $user_html=$row->user_html; $comment=$row->comment; $show_titulos=$row->show_titulos; if ($const !='') { $GET_cadena.='&const='.$const; } else { $titulos = $show_titulos; } // VARIABLES POR DEFECTO ANTES DE ENTRAR AL TABLON if ($p_actual) $GET_paginas.='&p_actual='.$p_actual; if ($anunciosxpag) $GET_paginas.='&anunciosxpag='.$anunciosxpag; if ($titulos ==1) { $GET_cadena.='&titulos='.$titulos; } else { $GET_cadena.='&titulos=0';} if ($tema) $GET_cadena.='&tema='.$tema; //echo '

Get_paginas = '.$GET_paginas.'

'; //echo '

Get_cadena = '.$GET_cadena.'

'; if ($op !='' && $publico !=0) { switch ($op) { case 'Cancelar': break; case 'comment': if ($comment !=1) break; // si los comentarios estan habilidatos continua if ($id =='' or $ctitulo =='' or $ctexto ==''){ require("plantilla_navegador.sw"); echo '

Volver

'; $comment =0; // cuando se ven los comentarios, oculta el boton COMENTARIOS if ($addcomment == 'Publicar'){ echo '

'.' FALTAN CAMPOS POR RELLENAR '.'

'; }; if ($id !='' && ereg("^[0-9]+$",$id) ){ // CUANDO BUSCAMOS UN DETERMINADO ANUNCIO. $query =' and id like\''.$id.'\''; $result = mysql_query("SELECT *, date_format(fecha_alta,'%d-%m-%Y') as fecha FROM noticias where estado='1'".$query." ORDER BY fecha_alta DESC",$linkdb); $row = mysql_fetch_object($result); $id=$row->id; $nick=$row->nick; $texto=$row->texto; $email=$row->email; $web=$row->web; $imagen=$row->imagen; $estado=$row->estado; $fecha=$row->fecha; $show_marco=$row->show_marco; $align_img=$row->align_img; require("plantilla_01.sw"); } else { echo '

'.' ID ES INCORRECTO '.'

'; break; } $num_comment = mysql_num_rows( mysql_query("SELECT * FROM comentarios where idref='".$id."'",$linkdb) ); if ($num_comment > 0) { echo ''.'-> LISTA DE COMENTARIOS <-'.'

'; }; $ccolor = '#FB9E37'; $result = mysql_query("SELECT *, date_format(cfecha_alta,'%d-%m-%Y') as fecha FROM comentarios where idref='".$id."' ORDER BY cfecha_alta DESC",$linkdb); while ( $row = mysql_fetch_object($result) ){ $nick=$row->ctitulo; $texto=$row->ctexto; $email=$row->cemail; $web=$row->cweb; $imagen=''; $estado=$row->cestado; $fecha=$row->fecha; $show_marco='1'; $align_img=$row->align_img; require("plantilla_01.sw"); }; // ---------------------------------------- fin while echo ''.'-> INSERTAR COMENTARIO <-'.''; require("plantilla_comment.sw"); } else { $idref = $id; $cfecha_alta=date('YmdHis'); $cestado = 1; // visible o oculto $sql = "INSERT INTO comentarios VALUES (0,'$idref', '$ctitulo', '$ctexto', '$cfecha_alta', '$cemail', '$cestado', '$cweb')"; mysql_query($sql,$linkdb); echo "

INFORMACION PUBLICADA

"; echo '

Pulsa aqui para volver al tablon


'; } break; case 'add': require("plantilla_navegador.sw"); require("plantilla_addnews.sw"); break; case 'Publicar': require("plantilla_navegador.sw"); if ($nick =='' or $texto ==''){ echo "

introduzca los datos

"; require("plantilla_addnews.sw"); } else { //echo '

___ '.$text_format.' ___

'; //echo '

___ '.$user_html.' ___

'; if ($text_format != 'html' && $user_html ==1) { $texto = nl2br(htmlentities($texto)); } $system_time=date('YmdHis'); // coge la fecha y hora del sistema (aņo mes dia hora minutos segundos) $sql = "INSERT INTO noticias VALUES (0,'$nick', '$texto', '$email', '$web', '$imagen', '$estado', '$system_time', '$show_marco', '$align_img', '$mail_list', '$resumen', '$tema')"; mysql_query($sql,$linkdb); echo "

INFORMACION PUBLICADA

"; echo '

Pulsa aqui para volver al tablon


'; $id=''; $nick=''; $texto=''; $email=''; $web=''; $imagen=''; $estado=''; $show_marco=''; $align_img=''; $mail_list=''; $resumen=''; $tema=''; //poniendo valores a 0 } break; default: echo "No seas tonto"; break; } // end switch $ver_tabla ='NO'; } //if ($op != '' && publico !=0) if ($ver_tabla !='NO'){ if ($paginas!=1){ $anunciosxpag = $xpag; $p_actual = 1; } else { if ($anunciosxpag <= 0 || $anunciosxpag >= 20){ $anunciosxpag = $xpag;} if ($p_actual <= 1){ $p_actual = 1;} } //echo "
".$query."
"; if ($titulo!=''){ require("plantilla_navegador.sw"); if ($tema){ $query =' and tema like\''.$tema.'\''; } if ($busqueda !='') { if (strlen(trim($busqueda)) >= $min_busquead) { // # Comprobamos si la busqueda tiene mas de '$min_busquead' caracteres # $query.=' and '; $query.=' (texto like \'%%%'.$busqueda.'%%\' or nick like \'%%%'.$busqueda.'%%\')'; if ($busqueda !='') {$GET_cadena .= '&busqueda='.$busqueda;} } elseif (trim($busqueda)!='') { echo '

Introduzca como minimo '.$min_busquead.' caracteres

' ; $ver_tabla = 'NO'; } } // if ($busqueda !='') } // ---- if ($titulo!='') if ($id !='' && ereg("^[0-9]+$",$id) ){ // CUANDO BUSCAMOS UN DETERMINADO ANUNCIO. $query =' and id like\''.$id.'\''; $zoom = 1; // VARIABLE PARA MOSTRAR UNA NOTICIA AL COMPLETO $paginas = 0; } if ($ver_tabla !='NO') { $result = mysql_query("SELECT *, date_format(fecha_alta,'%d-%m-%Y') as fecha FROM noticias where estado='1'".$query." ORDER BY fecha_alta DESC",$linkdb); if ($navegador!=0 && $busqueda !=''){ _RESULTADO(mysql_num_rows($result),$mostrar,$busqueda); } $num_pag = ceil(mysql_num_rows($result)/$anunciosxpag); if (!$num_pag < 1){ // si hay paginas muestra si no las hay... no muestra nada if ($p_actual > $num_pag ) {$p_actual = $num_pag; } mysql_data_seek($result, ($p_actual*$anunciosxpag)-$anunciosxpag); // puntero a la noticia por la que empezaremos a mostrar //_PAGINAS(mysql_num_rows($result),$anunciosxpag,$p_actual,$GET_cadena); // ------------------------------ mostrando tablas while ($row = mysql_fetch_object($result)){ $contador++; $id=$row->id; $nick=$row->nick; $texto=$row->texto; $resumen=$row->resumen; $email=$row->email; $web=$row->web; $imagen=$row->imagen; $estado=$row->estado; $fecha=$row->fecha; $show_marco=$row->show_marco; $align_img=$row->align_img; $tema=$row->tema; $num_comment = mysql_num_rows( mysql_query("SELECT * FROM comentarios where idref='".$id."'",$linkdb) ); $tema = $array_temas[$tema]; if($titulos != 1 || $zoom ==1) { require("plantilla_01.sw"); } else { require("plantilla_titulos.sw"); require("plantilla_pienoticia.sw"); echo "
"; } if ($contador == $anunciosxpag){ break; } }; // ---------------------------------------- fin while echo "

"; if ($zoom ==1) echo '

Volver
'; if ($paginas!=0){ _PAGINAS(mysql_num_rows($result),$anunciosxpag,$p_actual,$GET_cadena); } } // end if si no hay paginas..... } //if ($ver_tabla !='NO') } //($ver_tabla !='NO') ?>