HEX
Server: Apache/2
System: Linux sv1.freethailand.com 2.6.18-410.el5 #1 SMP Wed May 11 06:00:14 EDT 2016 x86_64
User: apache (101)
PHP: 5.3.29
Disabled: symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,pcntl_exec,proc_get_status,proc_nice,proc_terminate,pclose,ini_alter,virtual,openlog,ini_restore
Upload Files
File: /home/pengthai/domains/pengthaicurry.com/public_html/include/function.ph1
<?php
if($_SERVER['HTTP_HOST'] == 'localhost' || strncmp($_SERVER['HTTP_HOST'], "192.168.", 8)==0){
	$backto = base64_encode("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}else{
	$backto = base64_encode("https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}

if( $_SESSION['sess_lang'] == "EN" ){
	include("lang.english.inc.php");
	$class_curen = "active";
	$langBody = "";
}else{
	include("lang.thai.inc.php");	
	$class_curth = "active";
	$langBody = "thai-font";
}	

/*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 

function showDateTH($x)
{
	$date_m = array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");

	$time_array=explode(" ",$x);

	$date = $time_array[0];
	$time = $time_array[1];

	$date_array=explode("-",$date);
	
	$y = $date_array[0]+543;
	$m = $date_array[1]-1;
	$d = $date_array[2];

	$m=$date_m[$m];
	$displaydate= "$d $m $y ";
	return $displaydate;
}

function showDateEN($x)
{
	$date_m = array("January","February","March","April","May","June","July","August","September","October","November","December");

	$time_array=explode(" ",$x);

	$date = $time_array[0];
	$time = $time_array[1];

	$date_array=explode("-",$date);

	$y = $date_array[0];
	$m = $date_array[1]-1;
	$d = $date_array[2];

	$m=$date_m[$m];
	$displaydate= "$m $d, $y ";
	return $displaydate;
}

function getEmail($email){
	$mail_contact = explode(',', $email);
	$count = 0 ;
	$total=count($mail_contact);
	while ($count < $total) {
		if ($count >=1) {
			$displayemail .= ", ";
		}
		$displayemail .= "<a href='mailto:".$mail_contact[$count]."'> ".$mail_contact[$count]." </a>" ;
		$count ++;
	}
	return $displayemail;
}

function getPhone($phone){
	$tel_b = explode(',', $phone);
	$count = 0 ;
	$total=count($tel_b);	
	while ($count < $total) {
		$tel_b[$count] = trim($tel_b[$count]);
		$cut_tel = array(' ','+', "\n", "(", ")");   //"-",
		$tel_a[$count] = str_replace($cut_tel, '', $tel_b[$count] );  
		$rest = str_replace("-",'', $tel_a[$count] );
		$rest = substr($rest, 0, 10);	
		if($count >=1) {
			$displayphone .= ", ";
		}
		preg_match("/[[:digit:]]+\.?[[:digit:]]*/", $rest , $phone_number ) ;
		$displayphone .= '<a href="tel:'.$phone_number[0].'">'.$tel_b[$count].'</a>      ';                   
		$count ++;
	}	
	return $displayphone;
}


function getPhone2($phone){
	$tel_b = explode(',', $phone);
	$count = 0 ;
	$total=count($tel_b);
	
	while ($count < $total) {
	$tel_b[$count] = trim($tel_b[$count]);
	
	$cut_tel = array(' ','+', "\n", "(", ")");   //"-",
	$tel_a[$count] = str_replace($cut_tel, '', $tel_b[$count] );  
	$rest = str_replace("-",'', $tel_a[$count] );
	$rest = substr($rest, 0, 10);
	
	if ($count >=1) {
	 $displayphone .= ", ";
	}
	preg_match("/[[:digit:]]+\.?[[:digit:]]*/", $rest , $phone_number ) ;
	
	$displayphone .= $tel_b[$count];                   
	$count ++;
	}
	
	return $displayphone;
}

function getPhone3($phone,$limt=null){
	$tel_b = explode(',', $phone);
	$count = 0 ;
	$total=count($tel_b);
	
	if(!empty($limt)){
		//จำนวนที่อยากให้แสดง
		$total=$limt;
	}
	
	while ($count < $total) {
		$tel_b[$count] = trim($tel_b[$count]);
		
		$cut_tel = array(' ','+', "\n", "(", ")");   //"-",
		$tel_a[$count] = str_replace($cut_tel, '', $tel_b[$count] );  
		$rest = str_replace("-",'', $tel_a[$count] );
		$rest = substr($rest, 0, 10);
		
		if($count >=1) {
			$displayphone .= "<br> ";
		}
		
		preg_match("/[[:digit:]]+\.?[[:digit:]]*/", $rest , $phone_number ) ;
		$displayphone .= '<a href="tel:'.$phone_number[0].'">'.$tel_b[$count].'</a>';    
		//$displayphone .= $tel_b[$count];                   
		$count ++;
	}
	
	return $displayphone;
}

function getPhoneTel($phone,$numsubstr){
	$tel_b = explode(',', $phone);
	$count = 0 ;
	$total=count($tel_b);
	
	while ($count < $total) {
	$tel_b[$count] = trim($tel_b[$count]);
	
	$cut_tel = array(' ','+', "\n", "(", ")");   //"-",
	$tel_a[$count] = str_replace($cut_tel, '', $tel_b[$count] );  
	$rest = str_replace("-",'', $tel_a[$count] );
	$rest = substr($rest, 0, $numsubstr);
	
	if ($count >=1) {
	 $displayphone .= ", ";
	}
	preg_match("/[[:digit:]]+\.?[[:digit:]]*/", $rest , $phone_number ) ;
	
	$displayphone .= '<a href="tel:'.$phone_number[0].'">'.$tel_b[$count].'</a>';                   
	$count ++;
	}
	
	return $displayphone;
}

/*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function word_name_link($text) {
	$news_name_link = str_replace(" ", "-", trim($text)); //ถ้าเป็นช่องว่าง ให้เติม -
	$news_name_link = str_replace('&quot;', '' , trim($news_name_link)); //ถ้าเป็น " ให้ตัดออก
	$cut_name_link = array(' ','+', '\n', ':', '(", ")','/','-/-','"','"');  //"-",
	$news_name_link = str_replace($cut_name_link, '', $news_name_link );  
	$news_name_link = substr($news_name_link,0,200); //ตัดข้อความไม่ให้ยาวเกิน	
	return $news_name_link;
}


?>