Hacked By AnonymousFox

Current Path : C:/AppServ/www/stat1/lib/TemplatePower/
Upload File :
Current File : C:/AppServ/www/stat1/lib/TemplatePower/function.TemplatePower.inc.php

<?php
/*****************************************************************
Created :  4/25/2007
Author : Mr. Khwanchai Kaewyos (LookHin)
E-mail : webmaster@lookhin.com
Website : www.LookHin.com
Copyright (C) 2005-2006, www.LookHin.com all rights reserved.
*****************************************************************/

/*
# Function ThaiDateLong
# Example

ThaiDateLong("YYYY-mm-dd hh:ii:ss",false);
*/

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

	list($strYMD, $strTime) = explode(" ", $strDateTime);
	list($intY, $intM, $intD) = explode("-", $strYMD);
	
	$intY = $intY + 543;
	$strM = $arrThaiMonth[$intM*1];
	$intD = $intD * 1;

	if($booTime) $strShowTime = $strTime;

	return "$intD $strM $intY $strShowTime";
}

/*
# Function ThaiDateShort
# Example

ThaiDateShort("YYYY-mm-dd hh:ii:ss",false);
*/

function ThaiDateShort($strDateTime,$booTime){
	$arrThaiMonth = array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
	
	list($strYMD, $strTime) = explode(" ", $strDateTime);
	list($intY, $intM, $intD) = explode("-", $strYMD);
	
	$intY = $intY + 543;
	$strM = $arrThaiMonth[$intM*1];
	$intD = $intD * 1;

	if($booTime) $strShowTime = $strTime;

	return "$intD $strM $intY $strShowTime";
}

/*
# Function SplitExtension
# Example

SplitExtension("strFileName");
*/

function SplitExtension($strFileName){
   $arrSplit = explode(".", $strFileName);

   return $arrSplit[count($arrSplit)-1];
}

/*
# Function SplitText
# Example

SplitText("strText",intLength);
*/

function SplitText($strMessage,$intLength){
   $arrMessage = explode(" ", $strMessage);

   for($i=0;$i<count($arrMessage);$i++){
       $arrMessage[$i] = wordwrap($arrMessage[$i], $intLength, " ",1);
   }

   $strNewMessage = implode(" ", $arrMessage);

   return $strNewMessage;
}

/*
# Function ReplaceHtmlTag
# Example

ReplaceHtmlTag("strText",$arrRudeWord);
*/
function ReplaceHtmlTag($strHtmlOld,$arrRudeWord){
	
	for($i=0;$i<count($arrRudeWord);$i++){
		$strHtmlOld = str_replace($arrRudeWord[$i], " *** ", $strHtmlOld);
	}
	
	$strHtmlNew = str_replace("<", "&lt;", $strHtmlOld);
	$strHtmlNew = str_replace(">", "&gt;", $strHtmlNew);
	
	return $strHtmlNew;
}


/*
# Function Tis2Utf
# Example

Tis2Utf($strData);
*/
function Tis2Utf($strData){
	$strOutPut = "";
	for($i=0 ; $i < strlen($strData) ; $i++){
		$strTmp = substr($strData, $i, 1);
		$intOrd = ord($strTmp);
		
		if($intOrd < 0x80){
			$strOutPut .= $strTmp;
		}else if (( 0xA1 <= $intOrd && $intOrd <= 0xDA ) ||( 0xDF <= $intOrd && $intOrd <= 0xFB ) ){
			$strUnicode = 0x0E00 + $intOrd - 0xA0;
			$strOutPut .= chr( 0xE0 | ($strUnicode >> 12) );
			$strOutPut .= chr( 0x80 | (($strUnicode >> 6) & 0x3F) );
			$strOutPut .= chr( 0x80 | ($strUnicode & 0x3F) );
		}
	}
	return $strOutPut;
}


/*
# Function Utf2Tis
# Example

Utf2Tis($strData);
*/
function Utf2Tis($strData) {
	$strOutPut = "";
	for($i=0 ; $i < strlen($strData) ; $i++){
			$strTmp = substr($strData, $i, 1);

			if($strTmp > 127) { 
				if(($strTmp >= 0xc0) && ($strTmp <= 0xfd)) { // >= 192 && <=253    			
				
					$strTmp1 = ord(substr($strData, $i+1, 1));
					$strTmp2 = ord(substr($strData, $i+2, 1));

					if(($strTmp != 224) && (($strTmp1 < 184) || ($strTmp1 > 187))) exit(); // not Thai 
					
					$strTmp -= 224;
					$strTmp *= 16384;
					$strTmp1 -= 128;
					$strTmp1 *= 64;
					$strTmp2 -= 128;

					$strTmpTotal = $strTmp + $strTmp1 + $strTmp2;
					$strTmpTotal = $strTmpTotal- 0xe00 + 0xa0; // convert UTF -> TIS

					$strOutPut .= chr($strTmpTotal); // output ascii equivalent 
				}
			}else{ 
				$strOutPut .= chr($strTmp); // standard 7 bit ascii
			}
	}
	return $strOutPut;
}


/*
# Function GetMessage
# Example

GetMessage($intId);
*/

function GetMessage($intId){
	global $tableMessage;

	$query = "SELECT * FROM `$tableMessage` WHERE `ID`='$intId'";
	$result = mysql_query($query);
	$line = @mysql_fetch_array($result);
	
	return $line["MESSAGE"];
}



/*
# Function GetMenuAdmin
# Example

GetMenuAdmin();
*/

function GetMenuAdmin(){
	global $sesAdminPrivilege;
	global $tpl;

	if(substr_count($sesAdminPrivilege, "|1|") == 1) $tpl->newBlock("MENU1");
	if(substr_count($sesAdminPrivilege, "|2|") == 1) $tpl->newBlock("MENU2");
	if(substr_count($sesAdminPrivilege, "|3|") == 1) $tpl->newBlock("MENU3");
	if(substr_count($sesAdminPrivilege, "|4|") == 1) $tpl->newBlock("MENU4");
}

?>

Hacked By AnonymousFox1.0, Coded By AnonymousFox