DLE Son Yorumlar v 1.2

Konu sahibi son olarak 448 gün önce görüldü
Merhabalar arkadaşlar başlıktan da anlaşılacağı gibi son yorumlar modülünü sizler için hatalı olan kısımları düzelterek Türkçeleştirmesini gerçekleştirdim.

Modül Kurulumu

last_comments adında bir tane .php dosyası oluşturuyoruz daha sonra bu dosya içerisine aşağıda vermiş olduğum kodları yapıştırıp engine/modules dosyasına upload ediyoruz.

Kod:
<?php
/*
============================================================
 Modul Turkcelestirme: http://ircforumlari.com.tr
============================================================
 Yazar : YaRGuCi
============================================================


*/

if ( ! defined( 'DATALIFEENGINE' ) ) die( 'Hacking attempt!' );

$debag = ( isset( $debag ) ) ? intval( $debag ) : false;
$cache = ( isset( $cache ) ) ? intval( $cache ) : 0;

if ( $debag )
{
	$Timer = new microTimer ( );
	$Timer->start ( );
}

if ( $config['allow_cache'] != 'yes' )
{
	$allow_cache = true;
	$config['allow_cache'] = 'yes';
} else $allow_cache = false;

if ( $cache > 0 )
{
	if( $is_logged ) $name = $member_id['user_group'];
	else $name = '0';
	
	if ( $config['version_id'] >= '8.5' ) $cache_id = '7a1920d61156abc05a60135aefe8bc67';
	else $cache_id = 'last_comments';
	
	$filename = ENGINE_DIR . '/cache/last_comments' . '_' . $cache_id . '_' . $name . '.tmp';
	
	if ( time( ) - @filemtime( $filename ) > $cache * 60 ) @unlink( $filename );
}

$tpl->result['result'] = dle_cache( 'last_comments', $config['skin'], true );

if ( $tpl->result['result'] === false )
{
	function trimming( $text, $limit, $postfix = '' )
	{	global $config;
		
		if ( strtolower( $config['charset'] ) == 'utf-8' )
		{
			if ( iconv_strlen( $text, 'utf-8' )  > $limit )
				return iconv_substr( $text, 0, $limit, 'utf-8' ) . $postfix;
		
		} else
		{
			if ( strlen( $text ) > $limit )
				return substr( $text, 0, $limit ) . $postfix;
		}
		
		return $text;
	}
	
	function search( $str, $needle )
	{	global $config;

		if ( strtolower( $config['charset'] ) == 'utf-8' ) return iconv_strpos( $str, $needle, 0, 'utf-8' );
		else return strpos( $str, $needle );
	}
	
	$replase = array( );
	$comment = ( isset( $comment ) AND intval( $comment ) > 0 ) ? intval( $comment ) : 5;

	$tpl->load_template ( 'last_comments.tpl' );

	$allow_cats = explode ( ',', $user_group[$member_id['user_group']]['allow_cats'] );
	
	if ( $allow_cats[0] != 'all' )
	{
		if ( $config['allow_multi_category'] ) $allow_news = " AND category regexp '[[:<:]](" . implode ( '|', $allow_cats ) . ")[[:>:]]'";
		else $allow_news = " AND category IN ('" . implode ( "','", $allow_cats ) . "')";
	} else $allow_news = '';
	
	$result = $db->query( "SELECT " . PREFIX . "_comments.id, " . PREFIX . "_comments.date, " . PREFIX . "_comments.autor, " . PREFIX . "_comments.text, is_register, " . PREFIX . "_post.id AS pid, " . PREFIX . "_post.autor AS pautor, " . PREFIX . "_post.date AS pdate, title, category, alt_name, " . PREFIX . "_post.comm_num, allow_rate, rating, vote_num, news_read, flag, access, " . PREFIX . "_users.news_num, " . PREFIX . "_users.comm_num as ucomm_num, user_group, lastdate, reg_date, info, foto, fullname, land, icq FROM " . PREFIX . "_comments LEFT JOIN " . PREFIX . "_post ON " . PREFIX . "_comments.post_id = " . PREFIX . "_post.id LEFT JOIN " . PREFIX . "_users ON " . PREFIX . "_comments.user_id = " . PREFIX . "_users.user_id WHERE " . PREFIX . "_comments.approve = '1' AND " . PREFIX . "_post.approve = '1'{$allow_news} ORDER BY " . PREFIX . "_comments.id DESC LIMIT 0,{$comment}" );
	
	while ( $row = $db->get_row( $result ) )
	{
		if ( $row['access'] != '' )
		{
			$is_access = true;
			
			$access = explode( '||', $row['access'] );

			foreach ( $access as $value )
			{
				$value = explode( ':', $value );
				
				if ( $value[0] == $member_id['user_group'] )
				{
					if ( $value[1] == 3 )
					{
						$is_access = false;
						break;
					}
				}
			}
			
			if ( ! $is_access ) continue;
		}
		
		$row['pdate'] = strtotime( $row['pdate'] );
		$row['category'] = intval( $row['category'] );
			
		if ( $config['allow_alt_url'] == 'yes' )
		{
			if ( $row['flag'] and $config['seo_type'] )
			{
				if ( $row['category'] and $config['seo_type'] == 2 ) $full_link = $config['http_home_url'] . get_url( $row['category'] ) . '/' . $row['pid'] . '-' . $row['alt_name'] . '.html';
				else $full_link = $config['http_home_url'] . $row['pid'] . '-' . $row['alt_name'] . '.html';
			} else $full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['pdate'] ) . $row['alt_name'] . '.html';
		} else $full_link = $config['http_home_url'] . 'index.php?newsid=' . $row['pid'];

		if ( search( $tpl->result['content'], '{content-' . $row['pid'] . '}' ) === false )
		{
			$row['title'] = strip_tags( stripslashes( $row['title'] ) );
			
			$tpl->copy_template = preg_replace ( "#\\[main\\](.*?)\\[/main\\]#is", '', $tpl->copy_template );
			$tpl->copy_template = preg_replace ( "#\\[comment\\](.*?)\\[/comment\\]#is", '', $tpl->copy_template );

			$tpl->set ( '[news]', '' );
			$tpl->set ( '[/news]', '' );

			$tpl->set( '[news-link]', '<a href="' . $full_link . '">' );
			$tpl->set( '[/news-link]', '</a>' );

			$tpl->set ( '{id}', $row['pid'] );
			$tpl->set ( '{news-link}', $full_link );
			$tpl->set ( '{title}', $row['title'] );

			if ( search( $tpl->copy_template, '{title=' ) !== false ) $tpl->copy_template = preg_replace ( "#\{title=([0-9]{0,3})\|?([^\}]+)?\}#ie", "trimming( '{$row['title']}', '\\1', '\\2' )", $tpl->copy_template );

			if ( date( Ymd, $row['pdate'] ) == date( Ymd, $_TIME ) ) $tpl->set( '{date}', $lang['time_heute'] . langdate( ', H:i', $row['pdate'] ) );
			elseif ( date( Ymd, $row['pdate'] ) == date( Ymd, ( $_TIME - 86400 ) ) ) $tpl->set( '{date}', $lang['time_gestern'] . langdate( ", H:i", $row['pdate'] ) );
			else $tpl->set( '{date}', langdate( $config['timestamp_active'], $row['pdate'] ) );

			if ( search( $tpl->copy_template, '{date=' ) !== false ) $tpl->copy_template = preg_replace ( "#\{date=(.+?)\}#ie", "langdate('\\1', '{$row['pdate']}')", $tpl->copy_template );

			$tpl->set ( '{author}', $row['pautor'] );
					
			if ( $config['allow_alt_url'] == 'yes' )
			{
				$tpl->set( '[day-news]', '<a href="' . $config['http_home_url'] . date( 'Y/m/d/', $row['pdate'] ) . '" >' );
			
				$go_page = $config['http_home_url'] . 'user/' . urlencode( $row['pautor'] ) . '/';
				$news_page = $config['http_home_url'] . 'user/' . urlencode( $row['pautor'] ) . '/news/';
			}
			else
			{
				$tpl->set( '[day-news]', "<a href=\"$PHP_SELF?year=" . date( 'Y', $row['pdate'] ) . '&amp;month=' . date( 'm', $row['pdate'] ) . '&amp;day=' . date( 'd', $row['pdate'] ) . '" >' );
			
				$go_page = $PHP_SELF . '?subaction=userinfo&user=' . urlencode( $row['pautor'] );
				$news_page = $PHP_SELF . '?subaction=allnews&amp;user=' . urlencode( $row['pautor'] );
			}

			$tpl->set( '[/day-news]', '</a>' );
					
			if ( $config['version_id'] >= '9.0' ) $go_page = "onclick=\"ShowProfile('" . urlencode( $row['pautor'] ) . "', '" . htmlspecialchars( $go_page ) . "'); return false;\"";
			else $go_page = "onclick=\"return dropdownmenu(this, event, UserNewsMenu('" . htmlspecialchars( 'href="' . $go_page . '"' ) . "', '" . htmlspecialchars( 'href="' . $news_page . '"' ) . "','" . urlencode( $row['pautor'] ) . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'), '170px')\" onmouseout=\"delayhidemenu()\"";

			if( $config['allow_alt_url'] == 'yes' ) $tpl->set( '[profile]', "<a {$go_page} href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['pautor'] ) . '/">' );
			else $tpl->set( '[profile]', "<a {$go_page} href=\"$PHP_SELF?subaction=userinfo&amp;user=" . urlencode( $row['pautor'] ) . '">' );
			
			$tpl->set ( '[/profile]', '</a>' );
			
			$tpl->set ( '{comment-num}', $row['comm_num'] );
			$tpl->set ( '{news-read}', $row['news_read'] );

			if ( $row['allow_rate'] ) $tpl->set( '{rating}', ShortRating( $row['pid'], $row['rating'], $row['vote_num'], false ) );
			else $tpl->set( '{rating}', '' );
			
			$tpl->set ( '{comment}', '{content-' . $row['pid'] . '}' );
			
			$tpl->compile ( 'content' );
		}

		$row['date'] = strtotime( $row['date'] );
		$row['text'] = stripslashes( $row['text'] );
		
		if ( $user_group[$member_id['user_group']]['allow_hide'] ) $row['text'] = preg_replace( "'\[hide\](.*?)\[/hide\]'si", "\\1", $row['text'] );
		else $row['text'] = preg_replace ( "'\[hide\](.*?)\[/hide\]'si", ' ', $row['text'] );

		$tpl->copy_template = preg_replace ( "#\\[main\\](.*?)\\[/main\\]#is", '', $tpl->copy_template );
		$tpl->copy_template = preg_replace ( "#\\[news\\](.*?)\\[/news\\]#is", '', $tpl->copy_template );

		$tpl->set ( '[comment]', '' );
		$tpl->set ( '[/comment]', '' );

		$tpl->set( '[comment-link]', '<a href="' . $full_link . '#comment-' . $row['id'] . '">' );
		$tpl->set( '[/comment-link]', '</a>' );

		$tpl->set ( '{id}', $row['id'] );
		$tpl->set ( '{author}', $row['autor'] );
		$tpl->set ( '{news-link}', $full_link );
		$tpl->set ( '{comment-link}', $full_link . '#comment-' . $row['id'] );
		$tpl->set ( '{full-comment}', $row['text'] );
		
		if ( ! $row['is_register'] OR $row['autor'] == '' )
		{
			$tpl->set ( '[profile]', '' );
			$tpl->set ( '[/profile]', '' );
			$tpl->set ( '{news-num}', '--' );
			$tpl->set ( '{comment-num}', '--' );
			$tpl->set ( '{lastdate}', '--' );
			$tpl->set ( '{registration}', '--' );
			$tpl->set ( '{info}', '--' );
			$tpl->set ( '{land}', '--' );
			$tpl->set ( '{fullname}', '--' );
			$tpl->set ( '{icq}', '--' );
			$tpl->set ( '{foto}', '{THEME}/images/noavatar.png' );
			
			$tpl->set ( '[not-register]', '' );
			$tpl->set ( '[/not-register]', '' );
			
			$tpl->set_block ( "'\\[register\\](.*?)\\[/register\\]'si", '' );
		} else
		{
			if ( $config['allow_alt_url'] == 'yes' )
			{
				$go_page = $config['http_home_url'] . 'user/' . urlencode( $row['autor'] ) . '/';
				$news_page = $config['http_home_url'] . 'user/' . urlencode( $row['autor'] ) . '/news/';
			} else
			{
				$go_page = $PHP_SELF . '?subaction=userinfo&user=' . urlencode( $row['autor'] );
				$news_page = $PHP_SELF . '?subaction=allnews&amp;user=' . urlencode( $row['autor'] );
			}

			if ( $config['version_id'] >= '9.0' ) $go_page = "onclick=\"ShowProfile('" . urlencode( $row['autor'] ) . "', '" . htmlspecialchars( $go_page ) . "'); return false;\"";
			else $go_page = "onclick=\"return dropdownmenu(this, event, UserNewsMenu('" . htmlspecialchars( 'href="' . $go_page . '"' ) . "', '" . htmlspecialchars( 'href="' . $news_page . '"' ) . "','" . urlencode( $row['autor'] ) . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'), '170px')\" onmouseout=\"delayhidemenu()\"";

			if( $config['allow_alt_url'] == 'yes' ) $tpl->set( '[profile]', "<a {$go_page} href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['autor'] ) . '/">' );
			else $tpl->set( '[profile]', "<a {$go_page} href=\"$PHP_SELF?subaction=userinfo&amp;user=" . urlencode( $row['autor'] ) . '">' );

			$tpl->set ( '[/profile]', '</a>' );
			
			$tpl->set ( '{news-num}', $row['news_num'] );
			$tpl->set ( '{comment-num}', $row['ucomm_num'] );
			$tpl->set ( '{lastdate}', langdate( "j F Y H:i", $row['lastdate'] ) );
			$tpl->set ( '{registration}', langdate( "j F Y H:i", $row['reg_date'] ) );
			$tpl->set ( '{info}', stripslashes( $row['info'] ) );
			$tpl->set ( '{land}', stripslashes( $row['land'] ) );
			$tpl->set ( '{fullname}', stripslashes( $row['fullname'] ) );
			$tpl->set ( '{icq}', stripslashes( $row['icq'] ) );
			
			$tpl->set ( '[register]', '' );
			$tpl->set ( '[/register]', '' );
			
			$tpl->set_block ( "'\\[not-register\\](.*?)\\[/not-register\\]'si", '' );
			
			if ( $row['foto'] and ( file_exists( ROOT_DIR . '/uploads/fotos/' . $row['foto'] ) ) ) $tpl->set ( '{foto}', $config['http_home_url'] . 'uploads/fotos/' . $row['foto'] );
			else $tpl->set ( '{foto}', '{THEME}/images/noavatar.png' );
		}
		
		$tpl->set ( '{user-group}',  $user_group[$row['user_group']]['group_prefix'] . $user_group[$row['user_group']]['group_name'] . $user_group[$row['user_group']]['group_suffix'] );
			
		if ( $user_group[$row['user_group']]['icon'] ) $tpl->set( '{group-icon}', '<img src="' . $user_group[$row['user_group']]['icon'] . '" border="0" />' );
		else $tpl->set( '{group-icon}', '' );
			
		$row['text'] = strip_tags( $row['text'] );
		
		$tpl->set ( '{comment}', $row['text'] );

		if ( search( $tpl->copy_template, '{comment=' ) !== false ) $tpl->copy_template = preg_replace ( "#\{comment=([0-9]{0,3})\|?([^\}]+)?\}#ie", "trimming( '{$row['text']}', '\\1', '\\2' )", $tpl->copy_template );

		if ( date( Ymd, $row['date'] ) == date( Ymd, $_TIME ) ) $tpl->set( '{date}', $lang['time_heute'] . langdate( ', H:i', $row['date'] ) );
		elseif ( date( Ymd, $row['date'] ) == date( Ymd, ( $_TIME - 86400 ) ) ) $tpl->set( '{date}', $lang['time_gestern'] . langdate( ", H:i", $row['date'] ) );
		else $tpl->set( '{date}', langdate( $config['timestamp_active'], $row['date'] ) );

		if ( search( $tpl->copy_template, '{date=' ) !== false ) $tpl->copy_template = preg_replace ( "#\{date=(.+?)\}#ie", "langdate('\\1', '{$row['date']}')", $tpl->copy_template );

		$replase[$row['pid']] = true;
		
		$tpl->compile ( 'comment_' . $row['pid'] );
	}
	
	$db->free( $result );
	
	foreach( $replase as $key => $value ) $tpl->result['content'] = str_replace( '{content-' . $key . '}', $tpl->result['comment_' . $key], $tpl->result['content'] );
	
	$tpl->copy_template = preg_replace ( "#\\[news\\](.*?)\\[/news\\]#is", '', $tpl->copy_template );
	$tpl->copy_template = preg_replace ( "#\\[comment\\](.*?)\\[/comment\\]#is", '', $tpl->copy_template );

	$tpl->set ( '[main]', '' );
	$tpl->set ( '[/main]', '' );

	$tpl->set ( '{content}', $tpl->result['content'] );
	
	$tpl->compile ( 'result' );
	
	create_cache( 'last_comments', $tpl->result['result'], $config['skin'], true );
}

if ( $allow_cache ) $config['allow_cache'] = 'no';

echo $tpl->result['result'];

$tpl->global_clear( );

if ( $debag ) echo '<!-- Modul yurutme suresi ' . $Timer->stop( ) . '-->';

?>

bu kodu kopyaladıktan sonra; templates/{temaadınız} temanızın ana dizininde .tpl dosyası oluşturup aşağıda vermiş olduğum kodu yapıştırıyoruz.

Kod:
[main]
<style type="text/css">
.com_span {
	border: 1px solid #eee;
	padding: 1px;
	font-size: 9px;
	overflow:hidden;
}

.com_news a:link, .com_news a:visited, .com_news a:active, .com_news a:hover {
	text-decoration: none;
}

.com_line {
	clear: both;
	height: 2px;
	background: url({THEME}/images/com_line.gif) repeat-x;
}

.com_comment {
	border: 1px solid #eee;
	padding: 1px;
	margin: 1px;
}

.com_comment > span, .com_news > span {
	display:none;
	font-family: Verdana;
	font-size: 11px;
	color: #fff;
	background: #000;
	border: 1px solid #000;
	border-radius: 5px;
	padding: 2px;
	margin: 3px;
	z-index: 100;
	position: absolute;
	width:400px;
	-webkit-border-radius: 5px; 
    -moz-border-radius: 5px;
}

</style>

<script language="javascript" type="text/javascript">
$(document).ready(function()
{
	$(".com_comment, .com_news").mouseover(function () {
		  $(this).children( 'span' ).fadeTo( 'slow', 0.8 ).show( );
	});
	$(".com_comment, .com_news").mouseout(function (){
		  $(this).children( 'span' ).hide( );
	});
});
</script>				  
{content}
[/main]

[news]
<div class="com_span"><div class="com_news"><a href="{news-link}">{title=25| ->}</a>
<span><strong>Makale:</strong> {title} ([day-news]{date=Y-m-d}[/day-news])<br />
<div style="float:left;"><strong>Makale Degerlendirmesi:</strong>&nbsp;</div>{rating}<br />
<strong>Yazar:</strong> [profile]{author}[/profile]<br />
<strong>Ac?klama:</strong> <div style="display:none;"></div>{comment-num}<br />
<strong>Goruntulenme:</strong> {news-read}<br />
<div style="text-align:right;"><a href="{news-link}">Makaleye Git</a></div>
</span></div>{comment}</div>
[/news]

[comment]

<div class="com_comment">

<a href="{comment-link}">{comment=50|...}</a>

<span>
<img src="{foto}" alt="" title="" align="left" border="0" style="margin:3px;"/>
<strong>Yazar:</strong> {author} [not-register]<br /><br /><br /><div style="text-align:center;">Kay?tl? kullan?c? degil</div>[/not-register]
[register][profile]Kullan?c? Profili[/profile]<br />
<strong>Kullan?c? grubu:</strong> {user-group}
<strong>Kay?t tarihi:</strong> {registration}<br />
<strong>Ziyaret tarihi:</strong> {lastdate}<br />
<strong>Makale:</strong> {news-num}<br />
<strong>Ac?klama:</strong> {comment-num}[/register]
<div class="com_line">&nbsp;</div>
<strong>Yorum ({date=Y-m-d}) <a href="{comment-link}">Yoruma git</a>:</strong>
<div class="com_line">&nbsp;</div>
{full-comment}</span>

</div>
[/comment]

.tpl dosyamızı oluşturduk Daha sonra temanızın/images klasörüne aşağıda vermiş olduğum com_line içindeki com_line.gif resmini yüklüyoruz.Hepsi bu kadar güle güle kullanınız.Takıldığınız her hangi bir yer olursa konu başlığı altında belirtebilirsiniz.

Kf56G7.gif
 

Ekli dosyalar

Geri