<?php
/*
+----------------------------------------------------------------------+
|  MKPortal ultimos anuncios por categorias 1.0 (bloque lateral)	   |
|  for MKP M1.1.1 and VB 3.6										   |
|  by Kash <
[email protected]>	y modificado para vbulletin por robincracker	<
[email protected]>							   |
|  to 
http://www.desarrollo-mkportal.org							   |
+----------------------------------------------------------------------+
|   MkPortal														   |
|   ========================================						   |
|   by Meo aka Luponero <Amedeo de longis>							   |
|      Don K. Colburn <visiblesoul.net>								   |
|																	   |
|   Copyright (c) 2004-2006 mkportal.it								   |
|   
http://www.mkportal.it											   |
|   Email: 
[email protected]										   |
+----------------------------------------------------------------------+
|																	   |
|   > MKPortal														   |
|   > Written By Amedeo de longis									   |
|   > Date started: 9.2.2004										   |
+----------------------------------------------------------------------+*/  
/*
//_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-\\
\\-------------------------Configuración|||Config-------------------------//
//¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´¨`-_-´\\
*/ 
$limit = 10;          // Número de temas a mostrar en el bloque ||| ENGLISH: Number of topics to display
$cuttitle = 25;       // Número máximo de caracteres a mostrar, a partir de ese número se muestran puntos suspensivos(...) ||| ENGLISH: Max number of characteres to display, when the title get more of limit, shows etc points (...)
$imagen="punto_verde.gif";	//imagen a mostrar al lado de cada título del tema||| Image to display in the title of topic
$ico = "ico_news.gif";		//Icono que se verá al lado del título del bloque. Por ejemplo, al lado de noticias. ||| ENGLISH: Icon to display next to the title of block. For example, next to News.
$titulo_block = "pop-Pando";	//Título que se muestra dentro del bloque. A su lado va la imagen. ||| ENGLISH: Title to display into the block.
$mn = "<a href=\"http://www.mercado-negro.org\" target=\"_blank\">©Mercado-Negro.org</a>";	//Título que se muestra dentro del bloque. A su lado va la imagen. ||| ENGLISH: Title to display into the block.
$id_foro = "59";		//Nombre de la Categoría de los temas a mostrar ||| ENGLISH: Name of the category of the topics to display
/*------------------------------------------------------------------------*/ 
global $db_prefix, $SITE_URL, $mklib, $FORUM_PATH; 
$content = "
<tr>
  <td> 
    <table class=\"moduleborder\" cellspacing=\"1\" width=\"100%\">
      <tr>
		<th width=\"80%\" style=\"padding-left: 5px;\">$titulo_block</th>
		<th width=\"20%\" style=\"align: center;\"><img src=\"{$SITE_URL}/mkportal/blocks/images/{$ico}\" alt= \"ico\"></th>
      </tr>
";
   $db_prefix = vbs_; 
        $sql = "
        SELECT a.title, b.threadid, c.forumid
        FROM post AS a, thread AS b, forum AS c 
        WHERE a.threadid=b.threadid 
        AND
        b.forumid=c.forumid
        AND
        c.forumid='$id_foro'
        group by b.threadid 
        ORDER BY b.threadid DESC
   LIMIT $limit";  
        $DB->query($sql);
        while ( $post = $DB->fetch_row() ) {
             $titulo = strip_tags($post['title']);
           $titulo = str_replace( "!" , "!" ,$titulo );
           $titulo = str_replace( """, "\"", $titulo ); 
      $id = $post['threadid'];       
      $titulo = $post['title'];
	  $titulo2 = $post['title'];
      if (strlen($titulo) > $cuttitle) {
                   $titulo = substr( $titulo,0,($cuttitle - 3) ) . "...";
                   $titulo = preg_replace( '/&(#(\d+;?)?)?(\.\.\.)?$/', '...',$titulo );
      }   
      $content .= "
      <tr>
   <td class=\"modulecell\" style=\"padding-left: 3px; text-align: left;\" colspan=\"2\">
   <img src=\"{$SITE_URL}/mkportal/blocks/images/{$imagen}\" alt=\"img\" valign=\"absmiddle\">  
   <a href=\"{$mklib->sitepath}$FORUM_PATH/showthread.php?t=$id\" title='$titulo2'>$titulo</a> 
   </td>          
   </tr> 
      ";
} 
$content .= "
    </table>
  </td>
</tr>
<center><th width=\"100%\" style=\"padding-left: 5px;\">$mn</th></center> 
"; 
   unset($limit);
   unset($cuttitle);
   unset($post);
   unset($id);
   unset($title);
   unset($sql);
   unset($titulo_block);
   unset($imagen);
   unset($ico);  
?>