<?php

global $vbulletin, $stylevar, $db, $template_hook, $vbphrase, $foruminfo, $userinfo;
if ($vbulletin->options['ackapa_vb4filmseriti'] AND in_array($vbulletin->userinfo['usergroupid'], explode(',', $vbulletin->options['uyegrubu_vb4filmseriti'])))

{


        $width_vb4filmseriti = ($vbulletin->options['width_vb4filmseriti']);
        $height_vb4filmseriti = ($vbulletin->options['height_vb4filmseriti']);
        $ismi_vb4filmseriti = ($vbulletin->options['ismi_vb4filmseriti']);
        $hizi_vb4filmseriti = ($vbulletin->options['hizi_vb4filmseriti']);
        $rengi_vb4filmseriti = ($vbulletin->options['rengi_vb4filmseriti']);
        $resmi_vb4filmseriti = ($vbulletin->options['resmi_vb4filmseriti']);
        $id_vb4filmseriti = ($vbulletin->options['id_vb4filmseriti']);
        $kac_vb4filmseriti = intval($vbulletin->options['kac_vb4filmseriti']);
$vb4filmseriti = $vbulletin->db->query_read("SELECT
thread.forumid as forumid, thread.visible, post.title as title, thread.threadid as threadid, post.postid, post.pagetext as pagetext
    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)
    WHERE thread.visible = 1 AND thread.forumid IN (0,".$id_vb4filmseriti.")
    ORDER BY threadid DESC
    LIMIT 0,".$kac_vb4filmseriti."
    ");

        $tekrar=1;
        while ($post = $vbulletin->db->fetch_array($vb4filmseriti))
        {

 $px = "px";
 $contenttext = $post['pagetext'];


 $resimurl = null;
	
    if (stripos($contenttext, '[/img]') !== false){    
    preg_match('/\[(img|IMG)\]\s*(https?:\/\/([^*\r]+|[a-z0-9\/\\\._\- !]+))\[\/(img|IMG)\]/Ui',$contenttext,$imgRs);
    $match[2] = $imgRs[2];        
     if (isset($match[2]) && !empty($match[2])){
            $resimurl = $match[2];
	if ($vbulletin->options['resimphp_vb4filmseriti']){
$resimurl = "includes/yilmaz/t.php?zc=1&amp;w=$width_vb4filmseriti&amp;h=$height_vb4filmseriti&amp;src=$resimurl";
} else {
$resimurl = $match[2];
}
        }
    } else if (stripos($contenttext, '[/imgr]') !== false){
	preg_match('/\[(imgr|IMGR)\]\s*(https?:\/\/([^*\r]+|[a-z0-9\/\\\._\- !]+))\[\/(imgr|IMGR)\]/Ui',$contenttext,$imgRs);
    $match[2] = $imgRs[2];
	if (isset($match[2]) && !empty($match[2])){
            $resimurl = $match[2];
	if ($vbulletin->options['resimphp_vb4filmseriti']){
$resimurl = "includes/yilmaz/t.php?zc=1&amp;w=$width_vb4filmseriti&amp;h=$height_vb4filmseriti&amp;src=$resimurl";
} else {
$resimurl = $match[2];
}
        }
    } else if (stripos($contenttext, '[/imgl]') !== false){
	preg_match('/\[(imgl|IMGL)\]\s*(https?:\/\/([^*\r]+|[a-z0-9\/\\\._\- !]+))\[\/(imgl|IMGL)\]/Ui',$contenttext,$imgRs);
    $match[2] = $imgRs[2];
	if (isset($match[2]) && !empty($match[2])){
            $resimurl = $match[2];
		if ($vbulletin->options['resimphp_vb4filmseriti']){
$resimurl = "includes/yilmaz/t.php?zc=1&amp;w=$width_vb4filmseriti&amp;h=$height_vb4filmseriti&amp;src=$resimurl";
} else {
$resimurl = $match[2];
}	
			
        }	
    } else if (stripos($contenttext, '[/attach]') !== false){    
        $resimsec = '#\[attach(?:=(right|left|config))?\](\d+)\[/attach\]#i';
        preg_match($resimsec, $contenttext, $match);
        if (isset($match[2]) && !empty($match[2])){
            $resimurl = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $match[2];
        }
    
    }
 
 
 $post['resimurl'] = "<a href=\"showthread.php?t=$post[threadid]\"> <img src=\"$resimurl\" width=\"$width_vb4filmseriti\" height=\"$height_vb4filmseriti\" border=\"0\" style=\"padding:5px\" alt=\"$post[title]\" /></a>";
 


                $film_seriti2 .= ''.$post['resimurl'].'';
                $film_seriti .= ''.$post['resimurl'].'';
                $tekrar++;
        }
        $film_seriti = substr_replace($film_seriti,"",-2);
        $film_seriti2 = substr_replace($film_seriti2,"",-2);
        $templater = vB_Template::create('forumhome_vb4filmseriti');
        $templater->register('ismi_vb4filmseriti', $ismi_vb4filmseriti);
        $templater->register('hizi_vb4filmseriti', $hizi_vb4filmseriti);
        $templater->register('rengi_vb4filmseriti', $rengi_vb4filmseriti);
        $templater->register('resmi_vb4filmseriti', $resmi_vb4filmseriti);
        $templater->register('film_seriti', $film_seriti);
        $templater->register('film_seriti2', $film_seriti2);
        $template_hook[forumhome_above_forums] .= $templater->render();
}