mert2015 0 Newbie Poster

Hi coders,


i am from germany,i have a problem with my php pagination.

my problem is when i am searching something on my website pagination working without problem but when i am searching something on my website with türkisch or german things pagination or not working special charesters are not showing.

for example when i am searchin car,news like this it s working
but for example ümit besen, tarık ümit, ıt does not working. ( just for some special charset)

mysql kollaction is utf8
please help me last 23 hours i am searching any solve.

/ ################# Start recognize SEO Url data #############################



$p_url     = explode('/',$_SERVER['REQUEST_URI']);

$seo_title = array_pop($p_url);



preg_match_all("|page([0-9]*).html|U", $seo_title, $out, PREG_PATTERN_ORDER);

$_GET['p'] = $out[1][0];



if (empty($_GET['p'])) {

  $_GET['p'] = 1;

}



if ($_GET['p']>0) {

  $seo_title = array_pop($p_url);

}



if(empty($seo_title)) {

  $seo_title = array_pop($p_url);

}



$seo_title = urldecode($seo_title);



$i=0;

$stop = false;

while($i<count($keyword_list)) {

  if($seo_title == SeoTitleEncode($keyword_list[$i])) {

    $keyword = $keyword_list[$i];

  }

  $i++;

}


if (empty($_GET['q'])) {

  $q = $seo_title;
$keyword=$_GET['keyword'];
$keyword=str_replace("ÄŸ", "g", $keyword); 
$keyword=str_replace("Ä".chr(158), "G", $keyword); 
$keyword=str_replace("ı", "i", $keyword); 
$keyword=str_replace("Ä°", "I", $keyword); 
$keyword=str_replace("ç", "ç", $keyword); 
$keyword=str_replace("Ç", "Ç", $keyword); 
$keyword=str_replace("ü", "ü", $keyword); 
$keyword=str_replace("Ãœ", "Ü", $keyword); 
$keyword=str_replace("ö", "ö", $keyword); 
$keyword=str_replace("Ö", "Ö", $keyword); 
$keyword=str_replace("Å".chr(158), "S", $keyword); 
$keyword=str_replace("ÅŸ", "s", $keyword); 
}

if (empty($_GET['orderby'])) {
  $orderby = "relevance";
}else{
  $orderby = $_GET['orderby'];
}

// ################# Start getting Youtube GData ##############################

$cat_id = (int) $_GET['id'];
$category_desc	= "";

if ( $cat_id > 0 ){
	$CategoryObject = new Category($cat_id);
	$CategoryObject->load();
	$category_desc	= stripslashes($CategoryObject->c_desc);
	
	if ( $CategoryObject->c_listing_source == 'keyword' ) {
		$keyword = str_replace("-"," ", $CategoryObject->c_keyword); 
		$data_videos = YT_ListByTag($keyword, $_GET['p'], $orderby);
		$total_videos	= YT_Total_Videos($data_videos);
		$videos			= YT_Videos($data_videos);
		
	} else if ( $CategoryObject->c_listing_source == 'author' ) {
		$keyword = str_replace("-"," ", $CategoryObject->c_name); 
		$data_videos = YT_GetUserUpload($CategoryObject->c_user_videos, $_GET['p'], $config['list_per_page']);
		$total_videos	= YT_Total_Videos($data_videos);
		$videos			= YT_Videos($data_videos);
		
	} else if ( $CategoryObject->c_listing_source == 'playlist_id' ) {
		$keyword 		= str_replace("-"," ", $CategoryObject->c_name); 
		$data_videos 	= YT_GetUserPlaylistsEntry_XML($CategoryObject->c_playlist_id, $_GET['p'], $config['list_per_page']);
		$total_videos	= YT_Total_Videos($data_videos);
		$videos			= YT_Videos($data_videos, 'playlists_entry');
	}
} else if ( isset($_GET['q']) && trim($_GET['q']) != '' ) {

	$q			= $_GET['q'];
	$keyword = str_replace("-"," ", urldecode($q));
	$keyword = strip_tags($keyword);
	
	if ( trim($keyword) != '' ) {
	
		if ( get_magic_quotes_gpc() ) {
			$keyword	= stripslashes($keyword);
		}
		
		$keyword	= htmLawed($keyword, array('safe'=>1));
		
		if ( $config["search_log_enabled"] == "true" && isset($_GET['filter']) ) {
			$ip_address		= $_SERVER['REMOTE_ADDR'];
			$keyword_log	= $keyword;
			
			$sqlQuery		= "INSERT INTO `".DB_PREFIX."search_log` SET `search_term` = '".mysql_real_escape_string($keyword_log)."', `ip_address` = '{$ip_address}', `time` = ".time();
			
			dbQuery($sqlQuery);
		}
		
		$data_videos 	= YT_ListByTag($keyword, $_GET['p'], $orderby, true);
		$total_videos	= YT_Total_Videos($data_videos);
		$videos			= YT_Videos($data_videos);
	} else {
		header("Location: ".$config['website_url']);
		exit(0);
	}
	
} else if ( $keyword != '' ) {
	$keyword = str_replace("-"," ", urldecode($keyword));
	$keyword = strip_tags($keyword);
	
	if ( trim($keyword) != '' ) {
	
		if ( get_magic_quotes_gpc() ) {
			$keyword	= stripslashes($keyword);
		}
		
		$keyword	= htmLawed($keyword, array('safe'=>1));
		
		if ( $config["search_log_enabled"] == "true" && isset($_GET['filter']) ) {
			$ip_address		= $_SERVER['REMOTE_ADDR'];
			$keyword_log	= $keyword;
			
			$sqlQuery		= "INSERT INTO `".DB_PREFIX."search_log` SET `search_term` = '".mysql_real_escape_string($keyword_log)."', `ip_address` = '{$ip_address}', `time` = ".time();
			
			dbQuery($sqlQuery);
		}
		
		$data_videos 	= YT_ListByTag($keyword, $_GET['p'], $orderby, true);
		$total_videos	= YT_Total_Videos($data_videos);
		$videos			= YT_Videos($data_videos);
	} else {
		header("Location: ".$config['website_url']);
		exit(0);
	}
}

$first_video_id =$videos[0].video_id;

// ################# Start parse xml attributes manually ######################

if($_GET['p'] == 1) {
	stripTags($_GET['q']);
}

// ################# Start calculate pagination ###############################


// ################# Start assign template variables ##########################

if($first_video_id != "")
$video_data    = YT_GetDetail($first_video_id);


if($config["enable_home_player"]) {
	if($config['longtail_enabled']) {
		//$player_longtail_param = '&ltas.cc='.$config["longtail_channel"].'&plugins=ltas,clickproxy&clickproxy.listener=get_video_url&icons=false';
		$player_longtail_param = '&plugins=ltas&ltas.cc='.$config["longtail_channel"].'&icons=false';
		$player_autostart = "true";

	}else{
		//$player_longtail_param = '&plugins=clickproxy&clickproxy.listener=get_video_url&icons=false';
		$player_longtail_param = '&icons=false';
		$player_autostart = "true";
	}
	
	if($config['cplayer_skin'] == "player/skins/fashion.swf")
		$player_skin = "";
	else
		$player_skin = "&skin=".$config["website_url"]."player/skins/".$config["cplayer_skin"];

	//$player_file = urlencode($config["website_url"].'xml.playlist.php?tag='.stripslashes($randKeyword));
 
	$download_link = "http://www.youtube.com/watch?v=".$first_video_id ."&fmt=".$_GET['fmt'];

			$player_file = urlencode($config['website_url'].$download_link);
			$is_filtered	= is_yt_thumbnail_filtered($video_data);
			
			if ( !$is_filtered ) {
				$player_image= 'http://img.youtube.com/vi/' . $first_video_id . '/0.jpg';
			} else {
				$player_image= $config['website_url'] . 'images/disallowed_thumbnail.gif';
			}







	$player_colors = '&backcolor='. $config["player_backcolor"]. '&frontcolor='. $config["player_frontcolor"]. '&lightcolor='. $config["player_lightcolor"]. '&screencolor='. $config["player_screencolor"];
}

$tpl->assign('enable_home_player',$config["enable_home_player"]);

if($config["enable_home_player"]) {
	$tpl->assign('player_file',$player_file);
	$tpl->assign('player_skin',$player_skin); 
	$tpl->assign('player_custom_plugins_home',$config["player_custom_plugins_home"]); 
	$tpl->assign('enable_player_colors',$config["enable_player_colors"]);
	$tpl->assign('player_colors',$player_colors);
	$tpl->assign('player_longtail_param',$player_longtail_param); 
	$tpl->assign('player_autostart',$player_autostart); 
}




















if((($_GET['p']) * $config['list_per_page']) < $total_videos) {

  $next_page = $_GET['p'] + 1;

}

if($_GET['p']>1) {

  $prev_page = $_GET['p'] - 1;

}


$feed_id 	= isset($_GET['fid']) ? $_GET['fid'] : '';
if ( isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] != '' ) {
	//$feed_id = 'relevance';
}

$main_menu	= main_menu($feed_id);

// ################# Start assign template variables ##########################

if ( !isset($CategoryObject) ) {
	$CategoryObject = new Category($cat_id);
	$CategoryObject->load();
}

if ( !isset($videos) || $total_videos <= 0 ) {
	include_once("config/admin_login.php");
	if ( isset($_GET['id']) && $config['empty_categories_notification_enabled'] == 'true'){
		$purpose	= "no video source";
		
		if ( !isset($CategoryObject) ) {
			$CategoryObject = new Category($cat_id);
			$CategoryObject->load();
		}
		
		$category_parent	= $CategoryObject->position;
		$cat_parents		= explode(">", $category_parent);
		$category_title_str	= stripslashes($CategoryObject->c_name);
		if ( count($cat_parents) > 1 ) {
			foreach($cat_parents as $cat_parent_id) {
				$cat_parent_id	= trim($cat_parent_id);
				if ($cat_parent_id != '' && $cat_parent_id != $cat_id) {
					$catParentObj	= new Category($cat_parent_id);
					$catParentObj->load();
					$category_title_str	.= " > ".stripslashes($catParentObj->c_name);
				}
			}
		}
		
		$subject	= "Error retrieving videos source from Youtube for {$category_title_str}";
		$request_url= curPageURL();
		if ( isset($_GET['id']) ) {
		$message	= "There was an error retrieving the source of videos for this category:\r\n{$category_title_str}\r\nURL: {$request_url}\r\n----";
		} else {
		$message	= "There was an error retrieving the source of videos for this category:\r\n{$category_title_str}\r\nURL: {$request_url}\r\n 11";
		}
		if ( !is_null($cat_id) ) {
		$send_mail = send_mail_notification($config['admin_email'], $cat_id, $purpose, $message, $subject);
		}
	}
}


$tpl->assign('total',ceil($total_videos / $config['list_per_page']));
$tpl->assign('videos',$videos);

if ( isset($_GET['id']) ) {
	if ( get_magic_quotes_gpc() ) {
		$tpl->assign('keyword', stripslashes(htmlentities($keyword, ENT_COMPAT, 'UTF-8', false)) .";");
	} else {
		$tpl->assign('keyword', htmlentities($keyword, ENT_COMPAT, 'UTF-8', false).";");
	}
} else {
	$tpl->assign('keyword', htmlentities($keyword, ENT_COMPAT, 'UTF-8', false).";");
}

//////////////////////html template//////////////////////////////////////////

{include file="header.html" showHomePlayer=true keywords="" title_page="$lang_home" title_inner="$keyword"}
 <div class="leftContent">
  <!-- Left content Begins -->
<!--
  <div class="blueBar">
	{include file="box.list_menu.html" showOrder="true"}
  </div>
-->







  <!-- google_ad_section_start -->
  <div id="category">
	{if $category_desc != ''}
	<div id="heading10">{$category_desc}</div>
	{/if}
	{section loop=$videos name=i}
		{include file="item.video_brief.html" videos=$videos}

	{sectionelse}
	  <p>{$lang_no_related_videos}</p>
	{/section}
	  <div class="blueBar">{if $total > 0}<span class="page">{$lang_page}: {$curr_page} {$lang_of} {$total}</span>{/if}
		<div class="orderBy">
	 
		{if $next_page}
		  <a href="{if $cid}categories/{else}tag/{/if}{$keyword|seotitle}/{if $cid}{$cid}/{/if}{if $orderby}orderby-{$orderby}/{/if}page{$next_page}.html" class="next">{$lang_next_page} &gt;&gt;</a>
		{/if}
		
		{if $prev_page}
		  <a href="{if $cid}categories/{else}tag/{/if}{$keyword|seotitle}/{if $cid}{$cid}/{/if}{if $orderby}orderby-{$orderby}/{/if}page{$prev_page}.html" class="next">&lt;&lt; {$lang_previous_page}</a>
		{/if}
		</div>
	  </div>
	</div>

	<div class="gallery" id="display_list" style="display:none;">
	{if $category_desc != ''}
	<div class="gal_cats_desc">{$category_desc}</div>
	{/if}
	{section loop=$videos name=i}
		{include file="item.video_detailed.html" videos=$videos}
		{if $smarty.section.i.index eq "2"}
			<div class="ad468_home" id="grid_ad" align="center">{$list_ads}</div>
		{/if}
	{sectionelse}
	  <p>{$lang_no_video_available}</p>
	{/section}
	</div>
	<!-- google_ad_section_end -->
	<script>
	setTimeout('setDisplayOnLoad();',1);
	</script>

	<div class="ad468_home" id="grid_ad" align="center">{$list_ads}</div>
		 
{include file="footer.html"}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.