Antiguo 17-oct-2006, 17:36   #1 (permalink)
Usuario activo
 
Fecha de Ingreso: agosto-2006
Mensajes: 21
iRufus sin puntos positivos o negativos
Predeterminado

El problema que tengo es que al hacer las modificaciones en el fichero (creo que viewforum.php) para añadir la columna de "Autor", como véis en la imagen he perdido la información de los últimos usuarios que respondieron en los temas.
No me dí cuenta del error y añadí algunos cambios más, con lo cual, la última copia de seguridad no me sirve porque esos últimos cambios quiero conservarlos. He intentado ir vuelta atrás pero es un follón.

Debajo de la imágen que incluyo, os dejo la pieza de código del archivo "viewforum.php" donde "creo" que está el error.

A ver si alguien se atreve con esto?

Salu2

[img]ftp://irufus__ftp:galadriel@irufus.com.es:21//files/Imagen%201.png[/img]

Código:
// Fetch list of topics to display on this page
// 

switch ($db_type)

{

	case 'mysql':
	case 'mysqli':
		$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
		break;

	case 'sqlite':
		$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.id IN(SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC';
		break;

	default:
		$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
		break;

}

$result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

// If there are topics in this forum.
if ($db->num_rows($result))
{
	while ($cur_topic = $db->fetch_assoc($result))
	{
		$icon_text = $lang_common['Normal icon'];
		$item_status = '';
		$icon_type = 'icon';
// MOD AUTHOR COLUMN 1 following line added
		$author = ''.pun_htmlspecialchars($cur_topic['poster']).'';		
		if ($cur_topic['moved_to'] != 0)

// 
			$subject = $lang_forum['Moved'].': '.pun_htmlspecialchars($cur_topic['subject']).'';
		else if ($cur_topic['closed'] == '0')

// 
			$subject = ''.pun_htmlspecialchars($cur_topic['subject']).'';
		else
		{
			$subject = ''.pun_htmlspecialchars($cur_topic['subject']).' <span class="byuser">'.$lang_common['by'].''.pun_htmlspecialchars($cur_topic['poster']).'</span>';
			$icon_text = $lang_common['Closed icon'];
			$item_status = 'iclosed';
		}

		if (!$pun_user['is_guest'] && $cur_topic['last_post'] > $pun_user['last_visit'] && $cur_topic['moved_to'] == null)
		{
			$icon_text .= ' '.$lang_common['New icon'];
			$item_status .= ' inew';
			$icon_type = 'icon inew';
			$subject = ''.$subject.'';
			$subject_new_posts = '<span class="newtext">['.$lang_common['New posts'].']</span>';
		}
		else
			$subject_new_posts = null;

// Should we display the dot or not? :)
		if (!$pun_user['is_guest'] && $pun_config['o_show_dot'] == '1')
		{
			if ($cur_topic['has_posted'] == $pun_user['id'])
				$subject = '&middot;'.$subject;
			else
				$subject = ''.$subject;
		}
// MOD AUTHOR COLUMN 2 following lines added

		else
			$subject = ''.$subject;
		
		if ($cur_topic['sticky'] == '1')
		{
			$subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;
			$item_status .= ' isticky';
			$icon_text .= ' '.$lang_forum['Sticky'];
		}

		$num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

		if ($num_pages_topic > 1)
			$subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';
		else
			$subject_multipage = null;

		// Should we show the "New posts" and/or the multipage links?
		if (!empty($subject_new_posts) || !empty($subject_multipage))
		{
			$subject .= ' '.(!empty($subject_new_posts) ? $subject_new_posts : '');
			$subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
		}

?>
				<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>
					<td class="tcl">
						<div class="intd">
							<div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div>
							<div class="tclcon">
								<?php echo $subject."\n" ?>
							</div>
						</div>
					</td>
					

					<td class="tc2"  style="WIDTH: 12%"><?php echo ($cur_topic['moved_to'] == null) ? $author : '' ?></td>					
					<td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : '' ?></td>
					<td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : '' ?></td>
					<td class="tcr"><?php echo $last_post ?></td>
				</tr>
<?php

	}
}
else
{

?>
				<tr>
					<td class="tcl" colspan="4"><?php echo $lang_forum['Empty forum'] ?></td>
				</tr>
<?php

}

?>
			</tbody>
			</table>
		</div>
	</div>
</div>

<div class="linksb">
	<div class="inbox">
		<p class="pagelink conl"><?php echo $paging_links ?></p>
<?php echo $post_link ?>
		<ul>[*]<?php echo $lang_common['Index'] ?>[*]&raquo;<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?>[/list]		<div class="clearer"></div>
	</div>
</div>
<?php

$forum_id = $id;
$footer_style = 'viewforum';
require PUN_ROOT.'footer.php';
Gracias por el esfuerzo
iRufus está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Responder Citando
Antiguo 19-oct-2006, 00:10   #2 (permalink)
Administrador
 
Avatar de Apolo
 
Fecha de Ingreso: febrero-2006
Ubicación: Colombia
Mensajes: 4.067
Apolo sigue por muy buen camino
Predeterminado

Hola,

Fíjate en el trozo de código un poco más completo:

Código:
<?php

// Fetch list of topics to display on this page
if ($pun_user['is_guest'] || $pun_config['o_show_dot'] == '0')
{
	// Without "the dot"
	$sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
}
else
{
	// With "the dot"
	switch ($db_type)
	{
		case 'mysql':
		case 'mysqli':
			$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
			break;

		case 'sqlite':
			$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.id IN(SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC';
			break;

		default:
			$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
			break;

	}
}

$result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
Mira que antes de la última instrucción ($result=) a dos corchetes de cierre, y en el código que tú has pegado solamente hay uno. Compara muy bien el código tuyo con el que yo he puesto y encontrarás las diferencias.

Saludos!

Jaime
__________________
Servicios para proveedores de hosting. Desde marketing hasta soporte · Jaime.ws
Apolo está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Responder Citando
Antiguo 19-oct-2006, 05:32   #3 (permalink)
Usuario activo
 
Fecha de Ingreso: agosto-2006
Mensajes: 21
iRufus sin puntos positivos o negativos
Predeterminado

Gracias por tu gran esfuerzo Apolo... Pero no está ahí el error.

He desandado el camino de la modificación que hice y he logrado devolver el Autor a su sitio...
Pero el Último Mensaje sigue sin salir. Despues de modificar lo que te digo me quedaron los dos corchetes igual que lo tienes tú.

Seguiré buscando...

Salu2
iRufus está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Responder Citando
Antiguo 16-nov-2006, 13:51   #4 (permalink)
Usuario activo
 
Fecha de Ingreso: agosto-2006
Mensajes: 21
iRufus sin puntos positivos o negativos
Predeterminado

Corregido por las bravas... Instalé la ultima versión de punbb...

Gracias de todas formas...

Salu2
iRufus está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Responder Citando
Antiguo 16-nov-2006, 16:41   #5 (permalink)
Administrador
 
Avatar de Apolo
 
Fecha de Ingreso: febrero-2006
Ubicación: Colombia
Mensajes: 4.067
Apolo sigue por muy buen camino
Predeterminado

Que bueno que lo has solucionado. :)

Saludos!
__________________
Servicios para proveedores de hosting. Desde marketing hasta soporte · Jaime.ws
Apolo está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Responder Citando
Respuesta

Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

Los Códigos BB están Activado
Las Caritas están Activado
[IMG] está Activado
El Código HTML está Desactivado
Trackbacks are Activado
Pingbacks are Activado
Refbacks are Activado

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Sobrepasamos los 3,000 mensajes Apolo Novedades y propuestas 6 01-jun-2007 06:38
Como integrar los 10 ultimos post de un foro smf? cato Programación y Diseño Web 5 02-ene-2007 22:38
ultimos post del foro generacion_animex Programación y Diseño Web 4 22-abr-2006 21:03

Alojamiento web, Hosting Reseller, Servidores Dedicados - All in Hosting

La franja horaria es GMT. Ahora son las 22:58.

Rioserver
Web hosting y dominios
Planes de hosting desde 2.90 USD
Soporte 24/7

www.rioserver.com

Infranetworking.com
Hosting PHP-MySQL
desde $3,5 dólares al mes!
Servidores Dedicados Hosting Reseller
www.infranetworking.com

Hosting en Mexico
500 Mb de espacio 29 pesos al mes
Soporte 24 h, cpanel,
Solicite prueba gratuita.

www.albergueweb.com.mx

AQPhost es Hosting Reseller
Te asesoramos
Inicia tu empresa de Web Hosting
¡hoy mismo!

www.aqphost.com/revendedores.htm


     ComunidadHosting  

La más grande comunidad dedicada al web hosting en nuestro idioma.

Para anunciar en ComunidadHosting, o para información general, por favor utiliza el formulario de contacto.







Desarrollado por: vBulletin® Versión 3.7.4
Derechos de Autor ©2000 - 2008, Jelsoft Enterprises Ltd.
Traducido por mcloud de vBhispano.com

Search Engine Friendly URLs by vBSEO 3.2.0