wall.php
Código PHP:
<? include_once("db.php");
include_once("func.php");
include_once("wall_like.php");
include_once("log.php");
/*TIPOS
de usuario
1 - estado
2 - publicacion normal
3 - compartir foto
4 - compartir video
5 - compartir enlace
de un usuario a otro
6 - publicacion
7 - compartir foto
8 - compartir video
9 - compartir enlace
acciones de usuario
10 - acualizo albun
11 - amigo de...
*/
$user = $_GET['u'];
$limit1 = $_GET['lim1'];
$limit2 = $_GET['lim2'];
$mostrando = 0;
$wallCountGet = mysql_query("SELECT * FROM wall_post WHERE user='$user'");
$wallCount = mysql_num_rows($wallCountGet);
$wallToGet = mysql_query("SELECT * FROM wall_post WHERE user='$user' ORDER BY id DESC LIMIT $limit1, $limit2");
while($wallGet = mysql_fetch_array($wallToGet)){
$mostrando = $mostrando+1;
$idP = $wallGet['id'];
$tipoP = $wallGet['tipo'];
$likescount = countlikes($idP);
//usuario dueno
$userAvatar2 = avatar($user);
$userAvatar = $avatarCar.$userAvatar2;
$userName = showname($user);
//usuario de qn viene
$fromP = $wallGet['idfrom'];
$nameP = showname($fromP);
$avatarP2 = avatar($fromP);
$avatarP = $avatarCar.$avatarP2;
//LIke
$like_txt = userlike($idP, $idUser, $fromP);
if($idUser == $fromP or $user == $idUser){
$delete_txt = "<span class='likelink' onclick='deletePost($idP);'>eliminar</span> · ";
}else{
$delete_txt = "";
}
//Contenidos
$msjP = $wallGet['texto'];
$msjP = myCodeMsj($msjP);
$imgP = $wallGet['img'];
$flashP = $wallGet['flash'];
$linkP = $wallGet['link'];
//Fecha y hora
$horaP = $wallGet['hora'];
$minP = $wallGet['min'];
$diaNP = $wallGet['dian'];
$diaP = $wallGet['dia'];
$mesP = $wallGet['mes'];
$anioP = $wallGet['anio'];
$textoDate = datetext($diaP, $mesP, $anioP, $diaNP, $horaP, $minP, $hoyDia, $hoyMesNum, $hoyAnio, $hoyHora, $hoyMin);
//Procesa el tipo
switch($tipoP){
case 1; //Estado
echo "<li>
<a href='profile.php?id=$user'><img src='mini.php?i=$userAvatar' class='avatar'/><a>
<div class='status'><a href='profile.php?id=$user'><b>$userName</b></a><p class='message'>$msjP</p>";
break;
case 3;
echo "<li>
<a href='profile.php?id=$user'><img src='mini.php?i=$userAvatar' class='avatar'/><a>
<div class='status'><a href='profile.php?id=$user'><b>$userName</b></a>
<p class='message'>$msjP</p>
<p class='imag'><img src='miniphoto.php?s=200&i=photos/$imgP' onclick=\"mostrarWin('foto', '$imgP');\"/></p>";
break;
case 5;
echo "<li>
<a href='profile.php?id=$user'><img src='mini.php?i=$userAvatar' class='avatar'/><a>
<div class='status'><a href='profile.php?id=$user'><b>$userName</b></a>
<p class='message'>$msjP</p> $linkP";
break;
case 6; //Estado
echo "<li>
<a href='profile.php?id=$fromP'><img src='mini.php?i=$avatarP' class='avatar'/><a>
<div class='status'><a href='profile.php?id=$fromP'><b>$nameP</b></a> ›
<p class='message'>$msjP</p>";
break;
case 7;
echo "<li>
<a href='profile.php?id=$fromP'><img src='mini.php?i=$avatarP' class='avatar'/><a>
<div class='status'><a href='profile.php?id=$fromP'><b>$nameP</b></a> ›
<p class='message'>$msjP</p>
<p class='imag'><img src='miniphoto.php?s=200&i=photos/$imgP' onclick=\"mostrarWin('foto', '$imgP');\"/></p>";
break;
case 9;
echo "<li>
<a href='profile.php?id=$fromP'><img src='mini.php?i=$avatarP' class='avatar'/><a>
<div class='status'><a href='profile.php?id=$fromP'><b>$nameP</b></a> ›
<p class='message'>$msjP</p> $linkP";
break;
}
//Contar comentarios
$numComentsGet = mysql_query("SELECT * FROM wall_coment WHERE idObj='$idP'");
$comentsCount = mysql_num_rows($numComentsGet);
if($comentsCount > 1){
$numCom = "<div class='wall_coments_num' onclick=\"goUrl('pub.php?id=$idP')\">".$comentsCount." comentarios. <span class='cmentLink'>Comentar</span></div>";
$comentarBtn = "";
}else if($comentsCount == 1){
$numCom = "<div class='wall_coments_num' onclick=\"goUrl('pub.php?id=$idP')\">Un comentario. <span class='cmentLink'>Comentar</span></div>";
$comentarBtn = "";
}else{
$numCom = "";
$comentarBtn = " · <span class='likelink' onclick=\"goUrl('pub.php?id=$idP')\">Comentar</span>";
}
echo "<p class='likes'>".$delete_txt.$likescount.$like_txt.$comentarBtn." · Publicado $textoDate.</p>";
echo "<div class='wall_coments'>";
echo $numCom;
if($comentsCount < 5){
$limComIni = 0;
}else{
$limComIni = $comentsCount-5;
}
$comentToGet = mysql_query("SELECT * FROM wall_coment WHERE idObj='$idP' ORDER BY id ASC LIMIT $limComIni, $comentsCount");
while($comentGet = mysql_fetch_array($comentToGet)){
$idCom = $comentGet['id'];
$fromCom = $comentGet['idfrom'];
$nameFromCom = showname($fromCom);
$avatarFromCom2 = avatar($fromCom);
$avatarFromCom = $avatarCar.$avatarFromCom2;
$comentCom = $comentGet['coment'];
$comentCom = myCodeMsj($comentCom);
//fecha publicación
$horaCom = $comentGet['hora'];
$minCom = $comentGet['min'];
$dianCom = $comentGet['dian'];
$diaCom = $comentGet['dia'];
$mesCom = $comentGet['mes'];
$anioCom = $comentGet['anio'];
$dateCom = datetext($diaCom, $mesCom, $anioCom, $dianCom, $horaCom, $minCom, $hoyDia, $hoyMesNum, $hoyAnio, $hoyHora, $hoyMin);
if($idUser == $fromCom or $user == $idUser){
$borrarCom = "<span class='wall_coment_delete' onclick=\"deleteComent('".$idCom."');\">x</span>";
}else{
$borrarCom = "";
}
echo "<div class='wall_coment'><table border='0' width='100%'>
<tr>
<td width='35' valign='top'><a href='profile.php?id=$fromCom'><img src='miniphoto.php?s=35&i=$avatarFromCom' /></a></td>
<td><a href='profile.php?id=$fromCom'><b>$nameFromCom</b></a>".$borrarCom."<br>$comentCom<br><span class='comentDate'>Comentó $dateCom.</span></td>
</tr>
</table></div>";
}
//echo "<div class='wall_coment'><div id='coment_text_$idCom' class='comentinput' contenteditable='true'></div><input name='' type='text' /></div>";
echo "</div></div></li>";
}
if($wallCount > $mostrando){
echo "<div id='showmore' class='wallshowmore' onclick='showmore()'>Mostrando $mostrando de $wallCount. Ver mas</div>";
}else if($mostrando == 0){
echo "<div class='wallshowmore'>Este usuario aun no ha publicado</div>";
}else{
echo "<div class='wallshowmore'>No hay mas</div>";
}
?>