<?php

        $width_tabfilmseriti = ($vbulletin->options['width_tabfilmseriti']);
        $height_tabfilmseriti = ($vbulletin->options['height_tabfilmseriti']);
		$height_tabfilmseriti1 = ($vbulletin->options['height_tabfilmseriti'] + 12);
        $ismi_tabfilmseriti = ($vbulletin->options['ismi_tabfilmseriti']);
        $hizi_tabfilmseriti = ($vbulletin->options['hizi_tabfilmseriti']);
        $rengi_tabfilmseriti = ($vbulletin->options['rengi_tabfilmseriti']);
        $resmi_tabfilmseriti = ($vbulletin->options['resmi_tabfilmseriti']);
        $id_tabfilmseriti_tab8 = ($vbulletin->options['id_tabfilmseriti_tab8']);
        $kac_tabfilmseriti = intval($vbulletin->options['kac_tabfilmseriti']);
        $resimyoksa_tabfilmseriti = intval($vbulletin->options['resimyoksa_tabfilmseriti']);
//tab8 bas
if ($vbulletin->options['only_sabit_konular_tabfilmseriti']){
	$threadsticky = " AND thread.sticky = 1"; 
}
$tabfilmseritit_tab8 = $vbulletin->db->query_read("SELECT
thread.forumid as forumid, thread.visible, thread.views, thread.sticky, thread.votenum, thread.votetotal, post.title as title, thread.threadid as threadid, post.postid, post.pagetext as pagetext, icon.iconid
    FROM " . TABLE_PREFIX . "thread as thread
    LEFT JOIN " . TABLE_PREFIX . "post as post on (thread.firstpostid = post.postid)
    LEFT JOIN " . TABLE_PREFIX . "forum as forum on (thread.forumid = forum.forumid)
    LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = post.iconid)
    WHERE thread.visible = 1".$threadsticky." AND thread.forumid IN (0,".$id_tabfilmseriti_tab8.")
    GROUP BY threadid
	ORDER BY threadid DESC
    LIMIT 0,".$kac_tabfilmseriti."
    ");

        $tekrar_tab8=1;
        while ($post = $vbulletin->db->fetch_array($tabfilmseritit_tab8))
        {

 $px = "px"; $post['title'] = substr($post['title'], 0,100);

 $metin = $post['pagetext'];

 $imdbp['cek'] = null;
if (stripos($metin, '[/imdbpuan]') !== false){    
    preg_match('/\[(imdbpuan|IMDBPUAN)\]\s*(https?:\/\/([^*\r]+|[a-z0-9\/\\\._\- !]+))\[\/(imdbpuan|IMDBPUAN)\]/Ui',$metin,$imdbRs);	
    $imdbmatch[2] = '<div class="imdb"><em><iframe src="includes/yilmaz/tabli_film_seriti/imdb.php?imdb='.$imdbRs[2].'" allowtransparency="true" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" width="43" height="20"></iframe></em></div>';	
	if (isset($imdbmatch[2]) && !empty($imdbmatch[2])){
            $imdbp['cek'] = $imdbmatch[2];			
      }	
 }
 
    $resimurl_tab8 = null;
	
    if (stripos($metin, '[/img]') !== false){
    
    preg_match('/\[(img|IMG)\]\s*(https?:\/\/([^*\r]+|[a-z0-9\/\\\._\- !]+))\[\/(img|IMG)\]/Ui',$metin,$imgRs);
    $match[2] = $imgRs[2];
    
        
     if (isset($match[2]) && !empty($match[2])){
            $resimurl_tab8 = $match[2];
        }
    } else if (stripos($metin, '[/imgr]') !== false){
	preg_match('/\[(imgr|IMGR)\]\s*(https?:\/\/([^*\r]+|[a-z0-9\/\\\._\- !]+))\[\/(imgr|IMGR)\]/Ui',$metin,$imgRs);
    $match[2] = $imgRs[2];
	if (isset($match[2]) && !empty($match[2])){
            $resimurl_tab8 = $match[2];
        }
    } else if (stripos($metin, '[/imgl]') !== false){
	preg_match('/\[(imgl|IMGL)\]\s*(https?:\/\/([^*\r]+|[a-z0-9\/\\\._\- !]+))\[\/(imgl|IMGL)\]/Ui',$metin,$imgRs);
    $match[2] = $imgRs[2];
	if (isset($match[2]) && !empty($match[2])){
            $resimurl_tab8 = $match[2];
        }	
    } else if (stripos($metin, '[/attach]') !== false){
    
        $resimsec = '#\[attach(?:=(right|left|config))?\](\d+)\[/attach\]#i';
        preg_match($resimsec, $metin, $match);
        if (isset($match[2]) && !empty($match[2])){
            $resimurl_tab8 = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $match[2];
        }
    
    }else{
        $resimurl_tab8 = "".$resimyoksa_tabfilmseriti."";
    }	
if ($vbulletin->options['resimphp_tabfilmseriti']){
$ycresim = "includes/yilmaz/t.php?zc=1&amp;w=$width_tabfilmseriti&amp;h=$height_tabfilmseriti&amp;src=$resimurl_tab8";
} else {
$ycresim = "$resimurl_tab8";
} 
if (!$resimurl_tab8){
$ycresim = $vbulletin->options['resmiyoksa_tabfilmseriti'];
}
if ($vbulletin->options['ycizleme_tabfilmseriti']){
$ycizleme = '<div class="izleme"><em><font color="#fff"><img src="includes/yilmaz/tabli_film_seriti/img/views.png" alt="'.$vbphrase[views].'" />&nbsp;'.$post[views].'&nbsp;</font></em></div>';
}
if ($vbulletin->options['ycsitepuani_tabfilmseriti']){
$ycsitepuani = '<div class="sitepuani"><em><font color="#fff"><img src="includes/yilmaz/tabli_film_seriti/img/rating.png" alt="'.$vbphrase[degerlendirme].'" /> &nbsp;'.$post[votenum].'</font>/'.$post[votetotal].'&nbsp;</em></div>';
}
 $trans = array(
	"&amp;" => "&",
	"&amp;quot;" => " ",
	"'" => '',
	'"' => ''
	); 	
	$metin = preg_replace('#\[IMG\](.+?)\[\/IMG\]#i'," ",$metin);
    $metin = strip_bbcode($metin, true, true, true, true); 	
	$metin = substr($metin, 0, 250) . '...';
    $metin = str_replace(array('"'), '&quot;', $metin);
	
	if ($vbulletin->options['onoff_info_tabfilmseriti']){ $yctooltip = ' class="tooltip" title="'.$metin.'"'; }else{ $yctooltip = ' title="'.$post[title].'"';}
 
 $post['resimurl_tab8'] = '<div class="filmbg filmresim">'.$imdbp[cek].''.$ycizleme.''.$ycsitepuani.'<div class="simg"><a href="showthread.php?t='.$post[threadid].'"'.$yctooltip.'><img src="'.$ycresim.'" alt="'.$post[title].'" width="'.$width_tabfilmseriti.'px" height="'.$height_tabfilmseriti.'px" /></a><br /></div><div class="filmadi1"><a href="showthread.php?t='.$post[threadid].'" title="'.$post[title].'">'.$post[title].'</a> </div></div>
 ';
 $film_seriti_tab8 .= $post['resimurl_tab8'];
        }

        $templater = vB_Template::create('forumhome_tabfilmseriti_tab8');
        $templater->register('ismi_tabfilmseriti', $ismi_tabfilmseriti);
        $templater->register('hizi_tabfilmseriti', $hizi_tabfilmseriti);
        $templater->register('rengi_tabfilmseriti', $rengi_tabfilmseriti);
        $templater->register('height_tabfilmseriti', $height_tabfilmseriti); 
		$templater->register('height_tabfilmseriti1', $height_tabfilmseriti1);
        $templater->register('film_seriti_tab8', $film_seriti_tab8);
        $template_hook[tab8] .= $templater->render();
?>